Files
Claude-Code-Workflow/.claude/workflows/cli-templates/prompts/workflow/task-json-cli-mode.txt
catlog22 692a68da6f Refactor workflow tools and user interaction methods
- Updated synthesis tool to enhance user interaction with multi-select options and improved question presentation in Chinese.
- Revised conflict resolution tool to allow batch processing of conflicts, increasing the limit from 4 to 10 per round and changing user interaction from AskUserQuestion to text output.
- Added context_package_path to task generation tools for better context management.
- Improved task generation schema to include context_package_path for enhanced context delivery.
- Updated CLI templates to reflect changes in task JSON schema, ensuring context_package_path is included.
2025-10-25 14:43:55 +08:00

183 lines
6.9 KiB
Plaintext

Task JSON Schema - CLI Execute Mode (With Command Field)
## Schema Structure
```json
{
"id": "IMPL-N[.M]",
"title": "Descriptive task name",
"status": "pending",
"context_package_path": "{context_package_path}",
"meta": {
"type": "feature|bugfix|refactor|test|docs",
"agent": "@code-developer|@test-fix-agent|@universal-executor"
},
"context": {
"requirements": ["extracted from analysis"],
"focus_paths": ["src/paths"],
"acceptance": ["measurable criteria"],
"depends_on": ["IMPL-N"],
"artifacts": [
{
"type": "synthesis_specification",
"path": "{synthesis_spec_path}",
"priority": "highest",
"usage": "Primary requirement source - use for consolidated requirements and cross-role alignment"
},
{
"type": "role_analysis",
"path": "{role_analysis_path}",
"priority": "high",
"usage": "Technical/design/business details from specific roles"
}
]
},
"flow_control": {
"pre_analysis": [
{
"step": "load_synthesis_specification",
"action": "Load consolidated synthesis specification",
"commands": [
"Read({synthesis_spec_path})"
],
"output_to": "synthesis_specification",
"on_error": "fail"
},
{
"step": "load_context_package",
"action": "Load context package",
"commands": [
"Read({context_package_path})"
],
"output_to": "context_pkg",
"on_error": "fail"
},
{
"step": "local_codebase_exploration",
"action": "Explore codebase using local search",
"commands": [
"bash(rg '^(function|class|interface).*{keyword}' --type ts -n --max-count 15)",
"bash(find . -name '*{keyword}*' -type f | grep -v node_modules | head -10)"
],
"output_to": "codebase_structure",
"on_error": "skip_optional"
}
],
"implementation_approach": [
{
"step": 1,
"title": "Implement task with Codex",
"description": "Implement '{title}' using Codex CLI tool",
"command": "bash(codex -C {focus_path} --full-auto exec \"PURPOSE: {purpose} TASK: {task_description} MODE: auto CONTEXT: @{{synthesis_spec_path}} @{{context_package_path}} EXPECTED: {expected_output} RULES: Follow synthesis specification\" --skip-git-repo-check -s danger-full-access)",
"modification_points": [
"Create/modify implementation files",
"Follow synthesis specification requirements",
"Integrate with existing patterns"
],
"logic_flow": [
"Codex loads context package and synthesis",
"Codex implements according to specification",
"Codex validates against acceptance criteria"
],
"depends_on": [],
"output": "implementation"
}
],
"target_files": ["file:function:lines", "path/to/NewFile.ts"]
}
}
```
## Multi-Step Example (Complex Task with Resume)
```json
{
"id": "IMPL-002",
"title": "Implement RBAC system",
"flow_control": {
"implementation_approach": [
{
"step": 1,
"title": "Create RBAC models",
"description": "Create role and permission data models",
"command": "bash(codex -C src/models --full-auto exec \"PURPOSE: Create RBAC models TASK: Define role and permission models MODE: auto CONTEXT: @{{synthesis_spec_path}} @{{context_package_path}} EXPECTED: Models with migrations RULES: Follow synthesis spec\" --skip-git-repo-check -s danger-full-access)",
"modification_points": ["Define role model", "Define permission model"],
"logic_flow": ["Design schema", "Implement models", "Generate migrations"],
"depends_on": [],
"output": "rbac_models"
},
{
"step": 2,
"title": "Implement RBAC middleware",
"description": "Create route protection middleware",
"command": "bash(codex --full-auto exec \"PURPOSE: Create RBAC middleware TASK: Route protection middleware MODE: auto CONTEXT: RBAC models from step 1 EXPECTED: Middleware for route protection RULES: Use session patterns\" resume --last --skip-git-repo-check -s danger-full-access)",
"modification_points": ["Create permission checker", "Add route decorators"],
"logic_flow": ["Check user role", "Validate permissions", "Allow/deny access"],
"depends_on": [1],
"output": "rbac_middleware"
}
]
}
}
```
## Key Features - CLI Execute Mode
**Execution Model**: Commands in `command` field execute steps directly
**Command Field Required**: Every step in `implementation_approach` MUST include `command` field
**Context Delivery**: Context provided via CONTEXT field in command prompt using `@{path}` syntax
**Multi-Step Support**:
- First step: Full context with `-C directory` and complete CONTEXT field
- Subsequent steps: Use `resume --last` to maintain session continuity
- Step dependencies: Use `depends_on` array to specify step order
## Command Templates
### Single-Step Codex Command
```bash
bash(codex -C {focus_path} --full-auto exec "PURPOSE: {purpose} TASK: {task} MODE: auto CONTEXT: @{{synthesis_spec_path}} @{{context_package_path}} EXPECTED: {expected} RULES: {rules}" --skip-git-repo-check -s danger-full-access)
```
### Multi-Step Codex with Resume
```bash
# First step
bash(codex -C {path} --full-auto exec "..." --skip-git-repo-check -s danger-full-access)
# Subsequent steps
bash(codex --full-auto exec "..." resume --last --skip-git-repo-check -s danger-full-access)
```
### Gemini/Qwen Commands (Analysis/Documentation)
```bash
bash(gemini "PURPOSE: {purpose} TASK: {task} MODE: analysis CONTEXT: @{synthesis_spec_path} EXPECTED: {expected} RULES: {rules}")
# With write permission
bash(gemini --approval-mode yolo "PURPOSE: {purpose} TASK: {task} MODE: write CONTEXT: @{context} EXPECTED: {expected} RULES: {rules}")
```
## Field Descriptions
**implementation_approach**: Array of step objects (WITH command field)
- **step**: Sequential step number
- **title**: Step description
- **description**: Brief step description
- **command**: Complete CLI command to execute the step
- **modification_points**: Specific code modifications (for reference)
- **logic_flow**: Execution sequence (for reference)
- **depends_on**: Step dependencies (array of step numbers, empty for independent)
- **output**: Expected deliverable variable name
## Usage Guidelines
1. **Always Include Command**: Every step MUST have a `command` field
2. **Context via CONTEXT Field**: Provide context using `@{path}` syntax in command prompt
3. **First Step Full Context**: First step should include `-C directory` and full context package
4. **Resume for Continuity**: Use `resume --last` for subsequent steps in same task
5. **Step Dependencies**: Use `depends_on: [1, 2]` to specify execution order
6. **Parameter Position**:
- Codex: `--skip-git-repo-check -s danger-full-access` at END
- Gemini/Qwen: `--approval-mode yolo` BEFORE the prompt