Refactor CLI command usage from ccw cli exec to ccw cli -p for improved prompt handling

- Updated command patterns across documentation and templates to reflect the new CLI syntax.
- Enhanced CLI tool implementation to support reading prompts from files and multi-line inputs.
- Modified core components and views to ensure compatibility with the new command structure.
- Adjusted help messages and internationalization strings to align with the updated command format.
- Improved error handling and user notifications in the CLI execution flow.
This commit is contained in:
catlog22
2025-12-18 14:12:45 +08:00
parent e096fc98e2
commit 8dd4a513c8
52 changed files with 386 additions and 243 deletions

View File

@@ -470,14 +470,14 @@ function computeCliStrategy(task, allTasks) {
// Pattern: Gemini CLI deep analysis // Pattern: Gemini CLI deep analysis
{ {
"step": "gemini_analyze_[aspect]", "step": "gemini_analyze_[aspect]",
"command": "ccw cli exec 'PURPOSE: [goal]\\nTASK: [tasks]\\nMODE: analysis\\nCONTEXT: @[paths]\\nEXPECTED: [output]\\nRULES: $(cat [template]) | [constraints] | analysis=READ-ONLY' --tool gemini --mode analysis --cd [path]", "command": "ccw cli -p 'PURPOSE: [goal]\\nTASK: [tasks]\\nMODE: analysis\\nCONTEXT: @[paths]\\nEXPECTED: [output]\\nRULES: $(cat [template]) | [constraints] | analysis=READ-ONLY' --tool gemini --mode analysis --cd [path]",
"output_to": "analysis_result" "output_to": "analysis_result"
}, },
// Pattern: Qwen CLI analysis (fallback/alternative) // Pattern: Qwen CLI analysis (fallback/alternative)
{ {
"step": "qwen_analyze_[aspect]", "step": "qwen_analyze_[aspect]",
"command": "ccw cli exec '[similar to gemini pattern]' --tool qwen --mode analysis --cd [path]", "command": "ccw cli -p '[similar to gemini pattern]' --tool qwen --mode analysis --cd [path]",
"output_to": "analysis_result" "output_to": "analysis_result"
}, },
@@ -518,7 +518,7 @@ The examples above demonstrate **patterns**, not fixed requirements. Agent MUST:
4. **Command Composition Patterns**: 4. **Command Composition Patterns**:
- **Single command**: `bash([simple_search])` - **Single command**: `bash([simple_search])`
- **Multiple commands**: `["bash([cmd1])", "bash([cmd2])"]` - **Multiple commands**: `["bash([cmd1])", "bash([cmd2])"]`
- **CLI analysis**: `ccw cli exec '[prompt]' --tool gemini --mode analysis --cd [path]` - **CLI analysis**: `ccw cli -p '[prompt]' --tool gemini --mode analysis --cd [path]`
- **MCP integration**: `mcp__[tool]__[function]([params])` - **MCP integration**: `mcp__[tool]__[function]([params])`
**Key Principle**: Examples show **structure patterns**, not specific implementations. Agent must create task-appropriate steps dynamically. **Key Principle**: Examples show **structure patterns**, not specific implementations. Agent must create task-appropriate steps dynamically.
@@ -542,9 +542,9 @@ The `implementation_approach` supports **two execution modes** based on the pres
- **Use for**: Large-scale features, complex refactoring, or when user explicitly requests CLI tool usage - **Use for**: Large-scale features, complex refactoring, or when user explicitly requests CLI tool usage
- **Required fields**: Same as default mode **PLUS** `command`, `resume_from` (optional) - **Required fields**: Same as default mode **PLUS** `command`, `resume_from` (optional)
- **Command patterns** (with resume support): - **Command patterns** (with resume support):
- `ccw cli exec '[prompt]' --tool codex --mode write --cd [path]` - `ccw cli -p '[prompt]' --tool codex --mode write --cd [path]`
- `ccw cli exec '[prompt]' --resume ${previousCliId} --tool codex --mode write` (resume from previous) - `ccw cli -p '[prompt]' --resume ${previousCliId} --tool codex --mode write` (resume from previous)
- `ccw cli exec '[prompt]' --tool gemini --mode write --cd [path]` (write mode) - `ccw cli -p '[prompt]' --tool gemini --mode write --cd [path]` (write mode)
- **Resume mechanism**: When step depends on previous CLI execution, include `--resume` with previous execution ID - **Resume mechanism**: When step depends on previous CLI execution, include `--resume` with previous execution ID
**Semantic CLI Tool Selection**: **Semantic CLI Tool Selection**:
@@ -621,7 +621,7 @@ Agent determines CLI tool usage per-step based on user semantics and task nature
"step": 3, "step": 3,
"title": "Execute implementation using CLI tool", "title": "Execute implementation using CLI tool",
"description": "Use Codex/Gemini for complex autonomous execution", "description": "Use Codex/Gemini for complex autonomous execution",
"command": "ccw cli exec '[prompt]' --tool codex --mode write --cd [path]", "command": "ccw cli -p '[prompt]' --tool codex --mode write --cd [path]",
"modification_points": ["[Same as default mode]"], "modification_points": ["[Same as default mode]"],
"logic_flow": ["[Same as default mode]"], "logic_flow": ["[Same as default mode]"],
"depends_on": [1, 2], "depends_on": [1, 2],
@@ -634,7 +634,7 @@ Agent determines CLI tool usage per-step based on user semantics and task nature
"step": 4, "step": 4,
"title": "Continue implementation with context", "title": "Continue implementation with context",
"description": "Resume from previous step with accumulated context", "description": "Resume from previous step with accumulated context",
"command": "ccw cli exec '[continuation prompt]' --resume ${step3_cli_id} --tool codex --mode write", "command": "ccw cli -p '[continuation prompt]' --resume ${step3_cli_id} --tool codex --mode write",
"resume_from": "step3_cli_id", // Reference previous step's CLI ID "resume_from": "step3_cli_id", // Reference previous step's CLI ID
"modification_points": ["[Continue from step 3]"], "modification_points": ["[Continue from step 3]"],
"logic_flow": ["[Build on previous output]"], "logic_flow": ["[Build on previous output]"],

View File

@@ -148,7 +148,7 @@ discuss → multi (gemini + codex parallel)
**Gemini/Qwen (Analysis)**: **Gemini/Qwen (Analysis)**:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: {goal} PURPOSE: {goal}
TASK: {task} TASK: {task}
MODE: analysis MODE: analysis
@@ -162,17 +162,17 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)
**Gemini/Qwen (Write)**: **Gemini/Qwen (Write)**:
```bash ```bash
ccw cli exec "..." --tool gemini --mode write --cd {dir} ccw cli -p "..." --tool gemini --mode write --cd {dir}
``` ```
**Codex (Write)**: **Codex (Write)**:
```bash ```bash
ccw cli exec "..." --tool codex --mode write --cd {dir} ccw cli -p "..." --tool codex --mode write --cd {dir}
``` ```
**Cross-Directory** (Gemini/Qwen): **Cross-Directory** (Gemini/Qwen):
```bash ```bash
ccw cli exec "CONTEXT: @**/* @../shared/**/*" --tool gemini --mode analysis --cd src/auth --includeDirs ../shared ccw cli -p "CONTEXT: @**/* @../shared/**/*" --tool gemini --mode analysis --cd src/auth --includeDirs ../shared
``` ```
**Directory Scope**: **Directory Scope**:

View File

@@ -78,7 +78,7 @@ rg "^import .* from " -n | head -30
### Gemini Semantic Analysis (deep-scan, dependency-map) ### Gemini Semantic Analysis (deep-scan, dependency-map)
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: {from prompt} PURPOSE: {from prompt}
TASK: {from prompt} TASK: {from prompt}
MODE: analysis MODE: analysis

View File

@@ -78,7 +78,7 @@ Phase 4: planObject Generation
## CLI Command Template ## CLI Command Template
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Generate plan for {task_description} PURPOSE: Generate plan for {task_description}
TASK: TASK:
• Analyze task/bug description and context • Analyze task/bug description and context

View File

@@ -107,7 +107,7 @@ Phase 3: Task JSON Generation
**Template-Based Command Construction with Test Layer Awareness**: **Template-Based Command Construction with Test Layer Awareness**:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Analyze {test_type} test failures and generate fix strategy for iteration {iteration} PURPOSE: Analyze {test_type} test failures and generate fix strategy for iteration {iteration}
TASK: TASK:
• Review {failed_tests.length} {test_type} test failures: [{test_names}] • Review {failed_tests.length} {test_type} test failures: [{test_names}]
@@ -527,7 +527,7 @@ See: `.process/iteration-{iteration}-cli-output.txt`
1. **Detect test_type**: "integration" → Apply integration-specific diagnosis 1. **Detect test_type**: "integration" → Apply integration-specific diagnosis
2. **Execute CLI**: 2. **Execute CLI**:
```bash ```bash
ccw cli exec "PURPOSE: Analyze integration test failure... ccw cli -p "PURPOSE: Analyze integration test failure...
TASK: Examine component interactions, data flow, interface contracts... TASK: Examine component interactions, data flow, interface contracts...
RULES: Analyze full call stack and data flow across components" --tool gemini --mode analysis RULES: Analyze full call stack and data flow across components" --tool gemini --mode analysis
``` ```

View File

@@ -123,7 +123,7 @@ When task JSON contains `flow_control.implementation_approach` array:
**CLI Command Execution (CLI Execute Mode)**: **CLI Command Execution (CLI Execute Mode)**:
When step contains `command` field with Codex CLI, execute via CCW CLI. For Codex resume: When step contains `command` field with Codex CLI, execute via CCW CLI. For Codex resume:
- First task (`depends_on: []`): `ccw cli exec "..." --tool codex --mode write --cd [path]` - First task (`depends_on: []`): `ccw cli -p "..." --tool codex --mode write --cd [path]`
- Subsequent tasks (has `depends_on`): Use CCW CLI with resume context to maintain session - Subsequent tasks (has `depends_on`): Use CCW CLI with resume context to maintain session
**Test-Driven Development**: **Test-Driven Development**:

View File

@@ -63,7 +63,7 @@ The agent supports **two execution modes** based on task JSON's `meta.cli_execut
- Agent substitutes [target_folders] into command - Agent substitutes [target_folders] into command
- Agent executes CLI command via CCW: - Agent executes CLI command via CCW:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Generate module documentation PURPOSE: Generate module documentation
TASK: Create API.md and README.md for each module TASK: Create API.md and README.md for each module
MODE: write MODE: write
@@ -216,7 +216,7 @@ Before completion, verify:
{ {
"step": "analyze_module_structure", "step": "analyze_module_structure",
"action": "Deep analysis of module structure and API", "action": "Deep analysis of module structure and API",
"command": "ccw cli exec \"PURPOSE: Document module comprehensively\nTASK: Extract module purpose, architecture, public API, dependencies\nMODE: analysis\nCONTEXT: @**/* System: [system_context]\nEXPECTED: Complete module analysis for documentation\nRULES: $(cat ~/.claude/workflows/cli-templates/prompts/documentation/module-documentation.txt)\" --tool gemini --mode analysis --cd src/auth", "command": "ccw cli -p \"PURPOSE: Document module comprehensively\nTASK: Extract module purpose, architecture, public API, dependencies\nMODE: analysis\nCONTEXT: @**/* System: [system_context]\nEXPECTED: Complete module analysis for documentation\nRULES: $(cat ~/.claude/workflows/cli-templates/prompts/documentation/module-documentation.txt)\" --tool gemini --mode analysis --cd src/auth",
"output_to": "module_analysis", "output_to": "module_analysis",
"on_error": "fail" "on_error": "fail"
} }

View File

@@ -238,9 +238,9 @@ api_id=$((group_count + 3))
| **CLI** | true | implementation_approach | write | --mode write | Execute CLI commands, validate output | | **CLI** | true | implementation_approach | write | --mode write | Execute CLI commands, validate output |
**Command Patterns**: **Command Patterns**:
- Gemini/Qwen: `ccw cli exec "..." --tool gemini --mode analysis --cd dir` - Gemini/Qwen: `ccw cli -p "..." --tool gemini --mode analysis --cd dir`
- CLI Mode: `ccw cli exec "..." --tool gemini --mode write --cd dir` - CLI Mode: `ccw cli -p "..." --tool gemini --mode write --cd dir`
- Codex: `ccw cli exec "..." --tool codex --mode write --cd dir` - Codex: `ccw cli -p "..." --tool codex --mode write --cd dir`
**Generation Process**: **Generation Process**:
1. Read configuration values (tool, cli_execute, mode) from workflow-session.json 1. Read configuration values (tool, cli_execute, mode) from workflow-session.json
@@ -331,7 +331,7 @@ api_id=$((group_count + 3))
{ {
"step": 2, "step": 2,
"title": "Batch generate documentation via CLI", "title": "Batch generate documentation via CLI",
"command": "ccw cli exec 'PURPOSE: Generate module docs\\nTASK: Create documentation\\nMODE: write\\nCONTEXT: @**/* [phase2_context]\\nEXPECTED: API.md and README.md\\nRULES: Mirror structure' --tool gemini --mode write --cd ${dirs_from_group}", "command": "ccw cli -p 'PURPOSE: Generate module docs\\nTASK: Create documentation\\nMODE: write\\nCONTEXT: @**/* [phase2_context]\\nEXPECTED: API.md and README.md\\nRULES: Mirror structure' --tool gemini --mode write --cd ${dirs_from_group}",
"depends_on": [1], "depends_on": [1],
"output": "generated_docs" "output": "generated_docs"
} }
@@ -363,7 +363,7 @@ api_id=$((group_count + 3))
}, },
{ {
"step": "analyze_project", "step": "analyze_project",
"command": "bash(ccw cli exec \"PURPOSE: Analyze project structure\\nTASK: Extract overview from modules\\nMODE: analysis\\nCONTEXT: [all_module_docs]\\nEXPECTED: Project outline\" --tool gemini --mode analysis)", "command": "bash(ccw cli -p \"PURPOSE: Analyze project structure\\nTASK: Extract overview from modules\\nMODE: analysis\\nCONTEXT: [all_module_docs]\\nEXPECTED: Project outline\" --tool gemini --mode analysis)",
"output_to": "project_outline" "output_to": "project_outline"
} }
], ],
@@ -403,7 +403,7 @@ api_id=$((group_count + 3))
"pre_analysis": [ "pre_analysis": [
{"step": "load_existing_docs", "command": "bash(cat .workflow/docs/${project_name}/{ARCHITECTURE,EXAMPLES}.md 2>/dev/null || echo 'No existing docs')", "output_to": "existing_arch_examples"}, {"step": "load_existing_docs", "command": "bash(cat .workflow/docs/${project_name}/{ARCHITECTURE,EXAMPLES}.md 2>/dev/null || echo 'No existing docs')", "output_to": "existing_arch_examples"},
{"step": "load_all_docs", "command": "bash(cat .workflow/docs/${project_name}/README.md && find .workflow/docs/${project_name} -type f -name '*.md' ! -path '*/README.md' ! -path '*/ARCHITECTURE.md' ! -path '*/EXAMPLES.md' ! -path '*/api/*' | xargs cat)", "output_to": "all_docs"}, {"step": "load_all_docs", "command": "bash(cat .workflow/docs/${project_name}/README.md && find .workflow/docs/${project_name} -type f -name '*.md' ! -path '*/README.md' ! -path '*/ARCHITECTURE.md' ! -path '*/EXAMPLES.md' ! -path '*/api/*' | xargs cat)", "output_to": "all_docs"},
{"step": "analyze_architecture", "command": "bash(ccw cli exec \"PURPOSE: Analyze system architecture\\nTASK: Synthesize architectural overview and examples\\nMODE: analysis\\nCONTEXT: [all_docs]\\nEXPECTED: Architecture + Examples outline\" --tool gemini --mode analysis)", "output_to": "arch_examples_outline"} {"step": "analyze_architecture", "command": "bash(ccw cli -p \"PURPOSE: Analyze system architecture\\nTASK: Synthesize architectural overview and examples\\nMODE: analysis\\nCONTEXT: [all_docs]\\nEXPECTED: Architecture + Examples outline\" --tool gemini --mode analysis)", "output_to": "arch_examples_outline"}
], ],
"implementation_approach": [ "implementation_approach": [
{ {
@@ -440,7 +440,7 @@ api_id=$((group_count + 3))
"pre_analysis": [ "pre_analysis": [
{"step": "discover_api", "command": "bash(rg 'router\\.| @(Get|Post)' -g '*.{ts,js}')", "output_to": "endpoint_discovery"}, {"step": "discover_api", "command": "bash(rg 'router\\.| @(Get|Post)' -g '*.{ts,js}')", "output_to": "endpoint_discovery"},
{"step": "load_existing_api", "command": "bash(cat .workflow/docs/${project_name}/api/README.md 2>/dev/null || echo 'No existing API docs')", "output_to": "existing_api_docs"}, {"step": "load_existing_api", "command": "bash(cat .workflow/docs/${project_name}/api/README.md 2>/dev/null || echo 'No existing API docs')", "output_to": "existing_api_docs"},
{"step": "analyze_api", "command": "bash(ccw cli exec \"PURPOSE: Document HTTP API\\nTASK: Analyze endpoints\\nMODE: analysis\\nCONTEXT: @src/api/**/* [endpoint_discovery]\\nEXPECTED: API outline\" --tool gemini --mode analysis)", "output_to": "api_outline"} {"step": "analyze_api", "command": "bash(ccw cli -p \"PURPOSE: Document HTTP API\\nTASK: Analyze endpoints\\nMODE: analysis\\nCONTEXT: @src/api/**/* [endpoint_discovery]\\nEXPECTED: API outline\" --tool gemini --mode analysis)", "output_to": "api_outline"}
], ],
"implementation_approach": [ "implementation_approach": [
{ {

View File

@@ -136,7 +136,7 @@ Task(
Execute Gemini/Qwen CLI for deep analysis (saves main thread tokens): Execute Gemini/Qwen CLI for deep analysis (saves main thread tokens):
\`\`\`bash \`\`\`bash
ccw cli exec " ccw cli -p "
PURPOSE: Extract project core context for task: ${task_description} PURPOSE: Extract project core context for task: ${task_description}
TASK: Analyze project architecture, tech stack, key patterns, relevant files TASK: Analyze project architecture, tech stack, key patterns, relevant files
MODE: analysis MODE: analysis

View File

@@ -187,7 +187,7 @@ Objectives:
3. Use Gemini for aggregation (optional): 3. Use Gemini for aggregation (optional):
Command pattern: Command pattern:
ccw cli exec " ccw cli -p "
PURPOSE: Extract lessons and conflicts from workflow session PURPOSE: Extract lessons and conflicts from workflow session
TASK: TASK:
• Analyze IMPL_PLAN and lessons from manifest • Analyze IMPL_PLAN and lessons from manifest
@@ -334,7 +334,7 @@ Objectives:
- Sort sessions by date - Sort sessions by date
2. Use Gemini for final aggregation: 2. Use Gemini for final aggregation:
ccw cli exec " ccw cli -p "
PURPOSE: Aggregate lessons and conflicts from all workflow sessions PURPOSE: Aggregate lessons and conflicts from all workflow sessions
TASK: TASK:
• Group successes by functional domain • Group successes by functional domain

View File

@@ -474,7 +474,7 @@ Detailed plan: ${executionContext.session.artifacts.plan}`)
return prompt return prompt
} }
ccw cli exec "${buildCLIPrompt(batch)}" --tool codex --mode write ccw cli -p "${buildCLIPrompt(batch)}" --tool codex --mode write
``` ```
**Execution with fixed IDs** (predictable ID pattern): **Execution with fixed IDs** (predictable ID pattern):
@@ -497,8 +497,8 @@ const previousCliId = batch.resumeFromCliId || null
// Build command with fixed ID (and optional resume for continuation) // Build command with fixed ID (and optional resume for continuation)
const cli_command = previousCliId const cli_command = previousCliId
? `ccw cli exec "${buildCLIPrompt(batch)}" --tool codex --mode write --id ${fixedExecutionId} --resume ${previousCliId}` ? `ccw cli -p "${buildCLIPrompt(batch)}" --tool codex --mode write --id ${fixedExecutionId} --resume ${previousCliId}`
: `ccw cli exec "${buildCLIPrompt(batch)}" --tool codex --mode write --id ${fixedExecutionId}` : `ccw cli -p "${buildCLIPrompt(batch)}" --tool codex --mode write --id ${fixedExecutionId}`
bash_result = Bash( bash_result = Bash(
command=cli_command, command=cli_command,
@@ -520,7 +520,7 @@ if (bash_result.status === 'failed' || bash_result.status === 'timeout') {
⚠️ Execution incomplete. Resume available: ⚠️ Execution incomplete. Resume available:
Fixed ID: ${fixedExecutionId} Fixed ID: ${fixedExecutionId}
Lookup: ccw cli detail ${fixedExecutionId} Lookup: ccw cli detail ${fixedExecutionId}
Resume: ccw cli exec "Continue tasks" --resume ${fixedExecutionId} --tool codex --mode write --id ${fixedExecutionId}-retry Resume: ccw cli -p "Continue tasks" --resume ${fixedExecutionId} --tool codex --mode write --id ${fixedExecutionId}-retry
`) `)
// Store for potential retry in same session // Store for potential retry in same session
@@ -575,15 +575,15 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/02-review-code-q
# - Report findings directly # - Report findings directly
# Method 2: Gemini Review (recommended) # Method 2: Gemini Review (recommended)
ccw cli exec "[Shared Prompt Template with artifacts]" --tool gemini --mode analysis ccw cli -p "[Shared Prompt Template with artifacts]" --tool gemini --mode analysis
# CONTEXT includes: @**/* @${plan.json} [@${exploration.json}] # CONTEXT includes: @**/* @${plan.json} [@${exploration.json}]
# Method 3: Qwen Review (alternative) # Method 3: Qwen Review (alternative)
ccw cli exec "[Shared Prompt Template with artifacts]" --tool qwen --mode analysis ccw cli -p "[Shared Prompt Template with artifacts]" --tool qwen --mode analysis
# Same prompt as Gemini, different execution engine # Same prompt as Gemini, different execution engine
# Method 4: Codex Review (autonomous) # Method 4: Codex Review (autonomous)
ccw cli exec "[Verify plan acceptance criteria at ${plan.json}]" --tool codex --mode write ccw cli -p "[Verify plan acceptance criteria at ${plan.json}]" --tool codex --mode write
``` ```
**Multi-Round Review with Fixed IDs**: **Multi-Round Review with Fixed IDs**:
@@ -592,12 +592,12 @@ ccw cli exec "[Verify plan acceptance criteria at ${plan.json}]" --tool codex --
const reviewId = `${sessionId}-review` const reviewId = `${sessionId}-review`
// First review pass with fixed ID // First review pass with fixed ID
const reviewResult = Bash(`ccw cli exec "[Review prompt]" --tool gemini --mode analysis --id ${reviewId}`) const reviewResult = Bash(`ccw cli -p "[Review prompt]" --tool gemini --mode analysis --id ${reviewId}`)
// If issues found, continue review dialog with fixed ID chain // If issues found, continue review dialog with fixed ID chain
if (hasUnresolvedIssues(reviewResult)) { if (hasUnresolvedIssues(reviewResult)) {
// Resume with follow-up questions // Resume with follow-up questions
Bash(`ccw cli exec "Clarify the security concerns you mentioned" --resume ${reviewId} --tool gemini --mode analysis --id ${reviewId}-followup`) Bash(`ccw cli -p "Clarify the security concerns you mentioned" --resume ${reviewId} --tool gemini --mode analysis --id ${reviewId}-followup`)
} }
``` ```
@@ -672,7 +672,7 @@ console.log(`✓ Development index: [${category}] ${entry.title}`)
| Empty file | File exists but no content | Error: "File is empty: {path}. Provide task description." | | Empty file | File exists but no content | Error: "File is empty: {path}. Provide task description." |
| Invalid Enhanced Task JSON | JSON missing required fields | Warning: "Missing required fields. Treating as plain text." | | Invalid Enhanced Task JSON | JSON missing required fields | Warning: "Missing required fields. Treating as plain text." |
| Malformed JSON | JSON parsing fails | Treat as plain text (expected for non-JSON files) | | Malformed JSON | JSON parsing fails | Treat as plain text (expected for non-JSON files) |
| Execution failure | Agent/Codex crashes | Display error, use fixed ID `${sessionId}-${groupId}` for resume: `ccw cli exec "Continue" --resume <fixed-id> --id <fixed-id>-retry` | | Execution failure | Agent/Codex crashes | Display error, use fixed ID `${sessionId}-${groupId}` for resume: `ccw cli -p "Continue" --resume <fixed-id> --id <fixed-id>-retry` |
| Execution timeout | CLI exceeded timeout | Use fixed ID for resume with extended timeout | | Execution timeout | CLI exceeded timeout | Use fixed ID for resume with extended timeout |
| Codex unavailable | Codex not installed | Show installation instructions, offer Agent execution | | Codex unavailable | Codex not installed | Show installation instructions, offer Agent execution |
| Fixed ID not found | Custom ID lookup failed | Check `ccw cli history`, verify date directories | | Fixed ID not found | Custom ID lookup failed | Check `ccw cli history`, verify date directories |
@@ -745,5 +745,5 @@ Appended to `previousExecutionResults` array for context continuity in multi-exe
ccw cli detail ${fixedCliId} ccw cli detail ${fixedCliId}
# Resume with new fixed ID for retry # Resume with new fixed ID for retry
ccw cli exec "Continue from where we left off" --resume ${fixedCliId} --tool codex --mode write --id ${fixedCliId}-retry ccw cli -p "Continue from where we left off" --resume ${fixedCliId} --tool codex --mode write --id ${fixedCliId}-retry
``` ```

View File

@@ -136,7 +136,7 @@ After bash validation, the model takes control to:
``` ```
- Use Gemini for security analysis: - Use Gemini for security analysis:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Security audit of completed implementation PURPOSE: Security audit of completed implementation
TASK: Review code for security vulnerabilities, insecure patterns, auth/authz issues TASK: Review code for security vulnerabilities, insecure patterns, auth/authz issues
CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md
@@ -148,7 +148,7 @@ After bash validation, the model takes control to:
**Architecture Review** (`--type=architecture`): **Architecture Review** (`--type=architecture`):
- Use Qwen for architecture analysis: - Use Qwen for architecture analysis:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Architecture compliance review PURPOSE: Architecture compliance review
TASK: Evaluate adherence to architectural patterns, identify technical debt, review design decisions TASK: Evaluate adherence to architectural patterns, identify technical debt, review design decisions
CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md
@@ -160,7 +160,7 @@ After bash validation, the model takes control to:
**Quality Review** (`--type=quality`): **Quality Review** (`--type=quality`):
- Use Gemini for code quality: - Use Gemini for code quality:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Code quality and best practices review PURPOSE: Code quality and best practices review
TASK: Assess code readability, maintainability, adherence to best practices TASK: Assess code readability, maintainability, adherence to best practices
CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md
@@ -182,7 +182,7 @@ After bash validation, the model takes control to:
done done
# Check implementation summaries against requirements # Check implementation summaries against requirements
ccw cli exec " ccw cli -p "
PURPOSE: Verify all requirements and acceptance criteria are met PURPOSE: Verify all requirements and acceptance criteria are met
TASK: Cross-check implementation summaries against original requirements TASK: Cross-check implementation summaries against original requirements
CONTEXT: @.task/IMPL-*.json,.summaries/IMPL-*.md,../.. @../../CLAUDE.md CONTEXT: @.task/IMPL-*.json,.summaries/IMPL-*.md,../.. @../../CLAUDE.md

View File

@@ -141,7 +141,7 @@ done
**Gemini analysis for comprehensive TDD compliance report** **Gemini analysis for comprehensive TDD compliance report**
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Generate TDD compliance report PURPOSE: Generate TDD compliance report
TASK: Analyze TDD workflow execution and generate quality report TASK: Analyze TDD workflow execution and generate quality report
CONTEXT: @{.workflow/active/{sessionId}/.task/*.json,.workflow/active/{sessionId}/.summaries/*,.workflow/active/{sessionId}/.process/tdd-cycle-report.md} CONTEXT: @{.workflow/active/{sessionId}/.task/*.json,.workflow/active/{sessionId}/.summaries/*,.workflow/active/{sessionId}/.process/tdd-cycle-report.md}

View File

@@ -133,7 +133,7 @@ Task(subagent_type="cli-execution-agent", run_in_background=false, prompt=`
### 2. Execute CLI Analysis (Enhanced with Exploration + Scenario Uniqueness) ### 2. Execute CLI Analysis (Enhanced with Exploration + Scenario Uniqueness)
Primary (Gemini): Primary (Gemini):
ccw cli exec " ccw cli -p "
PURPOSE: Detect conflicts between plan and codebase, using exploration insights PURPOSE: Detect conflicts between plan and codebase, using exploration insights
TASK: TASK:
• **Review pre-identified conflict_indicators from exploration results** • **Review pre-identified conflict_indicators from exploration results**

View File

@@ -256,7 +256,7 @@ Based on userConfig.executionMethod:
CLI Resume Support (MANDATORY for all CLI commands): CLI Resume Support (MANDATORY for all CLI commands):
- Use --resume parameter to continue from previous task execution - Use --resume parameter to continue from previous task execution
- Read previous task's cliExecutionId from session state - Read previous task's cliExecutionId from session state
- Format: ccw cli exec "[prompt]" --resume ${previousCliId} --tool ${tool} --mode write - Format: ccw cli -p "[prompt]" --resume ${previousCliId} --tool ${tool} --mode write
## EXPLORATION CONTEXT (from context-package.exploration_results) ## EXPLORATION CONTEXT (from context-package.exploration_results)
- Load exploration_results from context-package.json - Load exploration_results from context-package.json
@@ -308,10 +308,10 @@ Each task JSON MUST include:
4. **merge_fork**: Task has multiple parents - merges all parent contexts into new conversation 4. **merge_fork**: Task has multiple parents - merges all parent contexts into new conversation
**Execution Command Patterns**: **Execution Command Patterns**:
- new: `ccw cli exec "[prompt]" --tool [tool] --mode write --id [cli_execution_id]` - new: `ccw cli -p "[prompt]" --tool [tool] --mode write --id [cli_execution_id]`
- resume: `ccw cli exec "[prompt]" --resume [resume_from] --tool [tool] --mode write` - resume: `ccw cli -p "[prompt]" --resume [resume_from] --tool [tool] --mode write`
- fork: `ccw cli exec "[prompt]" --resume [resume_from] --id [cli_execution_id] --tool [tool] --mode write` - fork: `ccw cli -p "[prompt]" --resume [resume_from] --id [cli_execution_id] --tool [tool] --mode write`
- merge_fork: `ccw cli exec "[prompt]" --resume [merge_from.join(',')] --id [cli_execution_id] --tool [tool] --mode write` - merge_fork: `ccw cli -p "[prompt]" --resume [merge_from.join(',')] --id [cli_execution_id] --tool [tool] --mode write`
## QUALITY STANDARDS ## QUALITY STANDARDS
Hard Constraints: Hard Constraints:

View File

@@ -90,7 +90,7 @@ Template: ~/.claude/workflows/cli-templates/prompts/test/test-concept-analysis.t
## EXECUTION STEPS ## EXECUTION STEPS
1. Execute Gemini analysis: 1. Execute Gemini analysis:
ccw cli exec "$(cat ~/.claude/workflows/cli-templates/prompts/test/test-concept-analysis.txt)" --tool gemini --mode write --cd .workflow/active/{test_session_id}/.process ccw cli -p "$(cat ~/.claude/workflows/cli-templates/prompts/test/test-concept-analysis.txt)" --tool gemini --mode write --cd .workflow/active/{test_session_id}/.process
2. Generate TEST_ANALYSIS_RESULTS.md: 2. Generate TEST_ANALYSIS_RESULTS.md:
Synthesize gemini-test-analysis.md into standardized format for task generation Synthesize gemini-test-analysis.md into standardized format for task generation

View File

@@ -181,7 +181,7 @@ Task(subagent_type="ui-design-agent",
- Pattern: rg → Extract values → Compare → If different → Read full context with comments → Record conflict - Pattern: rg → Extract values → Compare → If different → Read full context with comments → Record conflict
- Alternative (if many files): Execute CLI analysis for comprehensive report: - Alternative (if many files): Execute CLI analysis for comprehensive report:
\`\`\`bash \`\`\`bash
ccw cli exec \" ccw cli -p \"
PURPOSE: Detect color token conflicts across all CSS/SCSS/JS files PURPOSE: Detect color token conflicts across all CSS/SCSS/JS files
TASK: • Scan all files for color definitions • Identify conflicting values • Extract semantic comments TASK: • Scan all files for color definitions • Identify conflicting values • Extract semantic comments
MODE: analysis MODE: analysis
@@ -297,7 +297,7 @@ Task(subagent_type="ui-design-agent",
- Pattern: rg → Identify animation types → Map framework usage → Prioritize extraction targets - Pattern: rg → Identify animation types → Map framework usage → Prioritize extraction targets
- Alternative (if complex framework mix): Execute CLI analysis for comprehensive report: - Alternative (if complex framework mix): Execute CLI analysis for comprehensive report:
\`\`\`bash \`\`\`bash
ccw cli exec \" ccw cli -p \"
PURPOSE: Detect animation frameworks and patterns PURPOSE: Detect animation frameworks and patterns
TASK: • Identify frameworks • Map animation patterns • Categorize by complexity TASK: • Identify frameworks • Map animation patterns • Categorize by complexity
MODE: analysis MODE: analysis
@@ -377,7 +377,7 @@ Task(subagent_type="ui-design-agent",
- Pattern: rg → Count occurrences → Classify by frequency → Prioritize universal components - Pattern: rg → Count occurrences → Classify by frequency → Prioritize universal components
- Alternative (if large codebase): Execute CLI analysis for comprehensive categorization: - Alternative (if large codebase): Execute CLI analysis for comprehensive categorization:
\`\`\`bash \`\`\`bash
ccw cli exec \" ccw cli -p \"
PURPOSE: Classify components as universal vs specialized PURPOSE: Classify components as universal vs specialized
TASK: • Identify UI components • Classify reusability • Map layout systems TASK: • Identify UI components • Classify reusability • Map layout systems
MODE: analysis MODE: analysis

View File

@@ -205,7 +205,7 @@ Comprehensive command guide for Claude Code Workflow (CCW) system covering 78 co
- Specify required analysis depth - Specify required analysis depth
- Request structured comparison/synthesis - Request structured comparison/synthesis
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Analyze command documentation to answer user query PURPOSE: Analyze command documentation to answer user query
TASK: • [extracted user question with context] TASK: • [extracted user question with context]
MODE: analysis MODE: analysis

View File

@@ -470,14 +470,14 @@ function computeCliStrategy(task, allTasks) {
// Pattern: Gemini CLI deep analysis // Pattern: Gemini CLI deep analysis
{ {
"step": "gemini_analyze_[aspect]", "step": "gemini_analyze_[aspect]",
"command": "ccw cli exec 'PURPOSE: [goal]\\nTASK: [tasks]\\nMODE: analysis\\nCONTEXT: @[paths]\\nEXPECTED: [output]\\nRULES: $(cat [template]) | [constraints] | analysis=READ-ONLY' --tool gemini --mode analysis --cd [path]", "command": "ccw cli -p 'PURPOSE: [goal]\\nTASK: [tasks]\\nMODE: analysis\\nCONTEXT: @[paths]\\nEXPECTED: [output]\\nRULES: $(cat [template]) | [constraints] | analysis=READ-ONLY' --tool gemini --mode analysis --cd [path]",
"output_to": "analysis_result" "output_to": "analysis_result"
}, },
// Pattern: Qwen CLI analysis (fallback/alternative) // Pattern: Qwen CLI analysis (fallback/alternative)
{ {
"step": "qwen_analyze_[aspect]", "step": "qwen_analyze_[aspect]",
"command": "ccw cli exec '[similar to gemini pattern]' --tool qwen --mode analysis --cd [path]", "command": "ccw cli -p '[similar to gemini pattern]' --tool qwen --mode analysis --cd [path]",
"output_to": "analysis_result" "output_to": "analysis_result"
}, },
@@ -518,7 +518,7 @@ The examples above demonstrate **patterns**, not fixed requirements. Agent MUST:
4. **Command Composition Patterns**: 4. **Command Composition Patterns**:
- **Single command**: `bash([simple_search])` - **Single command**: `bash([simple_search])`
- **Multiple commands**: `["bash([cmd1])", "bash([cmd2])"]` - **Multiple commands**: `["bash([cmd1])", "bash([cmd2])"]`
- **CLI analysis**: `ccw cli exec '[prompt]' --tool gemini --mode analysis --cd [path]` - **CLI analysis**: `ccw cli -p '[prompt]' --tool gemini --mode analysis --cd [path]`
- **MCP integration**: `mcp__[tool]__[function]([params])` - **MCP integration**: `mcp__[tool]__[function]([params])`
**Key Principle**: Examples show **structure patterns**, not specific implementations. Agent must create task-appropriate steps dynamically. **Key Principle**: Examples show **structure patterns**, not specific implementations. Agent must create task-appropriate steps dynamically.
@@ -542,9 +542,9 @@ The `implementation_approach` supports **two execution modes** based on the pres
- **Use for**: Large-scale features, complex refactoring, or when user explicitly requests CLI tool usage - **Use for**: Large-scale features, complex refactoring, or when user explicitly requests CLI tool usage
- **Required fields**: Same as default mode **PLUS** `command`, `resume_from` (optional) - **Required fields**: Same as default mode **PLUS** `command`, `resume_from` (optional)
- **Command patterns** (with resume support): - **Command patterns** (with resume support):
- `ccw cli exec '[prompt]' --tool codex --mode write --cd [path]` - `ccw cli -p '[prompt]' --tool codex --mode write --cd [path]`
- `ccw cli exec '[prompt]' --resume ${previousCliId} --tool codex --mode write` (resume from previous) - `ccw cli -p '[prompt]' --resume ${previousCliId} --tool codex --mode write` (resume from previous)
- `ccw cli exec '[prompt]' --tool gemini --mode write --cd [path]` (write mode) - `ccw cli -p '[prompt]' --tool gemini --mode write --cd [path]` (write mode)
- **Resume mechanism**: When step depends on previous CLI execution, include `--resume` with previous execution ID - **Resume mechanism**: When step depends on previous CLI execution, include `--resume` with previous execution ID
**Semantic CLI Tool Selection**: **Semantic CLI Tool Selection**:
@@ -621,7 +621,7 @@ Agent determines CLI tool usage per-step based on user semantics and task nature
"step": 3, "step": 3,
"title": "Execute implementation using CLI tool", "title": "Execute implementation using CLI tool",
"description": "Use Codex/Gemini for complex autonomous execution", "description": "Use Codex/Gemini for complex autonomous execution",
"command": "ccw cli exec '[prompt]' --tool codex --mode write --cd [path]", "command": "ccw cli -p '[prompt]' --tool codex --mode write --cd [path]",
"modification_points": ["[Same as default mode]"], "modification_points": ["[Same as default mode]"],
"logic_flow": ["[Same as default mode]"], "logic_flow": ["[Same as default mode]"],
"depends_on": [1, 2], "depends_on": [1, 2],
@@ -634,7 +634,7 @@ Agent determines CLI tool usage per-step based on user semantics and task nature
"step": 4, "step": 4,
"title": "Continue implementation with context", "title": "Continue implementation with context",
"description": "Resume from previous step with accumulated context", "description": "Resume from previous step with accumulated context",
"command": "ccw cli exec '[continuation prompt]' --resume ${step3_cli_id} --tool codex --mode write", "command": "ccw cli -p '[continuation prompt]' --resume ${step3_cli_id} --tool codex --mode write",
"resume_from": "step3_cli_id", // Reference previous step's CLI ID "resume_from": "step3_cli_id", // Reference previous step's CLI ID
"modification_points": ["[Continue from step 3]"], "modification_points": ["[Continue from step 3]"],
"logic_flow": ["[Build on previous output]"], "logic_flow": ["[Build on previous output]"],

View File

@@ -148,7 +148,7 @@ discuss → multi (gemini + codex parallel)
**Gemini/Qwen (Analysis)**: **Gemini/Qwen (Analysis)**:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: {goal} PURPOSE: {goal}
TASK: {task} TASK: {task}
MODE: analysis MODE: analysis
@@ -162,17 +162,17 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)
**Gemini/Qwen (Write)**: **Gemini/Qwen (Write)**:
```bash ```bash
ccw cli exec "..." --tool gemini --mode write --cd {dir} ccw cli -p "..." --tool gemini --mode write --cd {dir}
``` ```
**Codex (Write)**: **Codex (Write)**:
```bash ```bash
ccw cli exec "..." --tool codex --mode write --cd {dir} ccw cli -p "..." --tool codex --mode write --cd {dir}
``` ```
**Cross-Directory** (Gemini/Qwen): **Cross-Directory** (Gemini/Qwen):
```bash ```bash
ccw cli exec "CONTEXT: @**/* @../shared/**/*" --tool gemini --mode analysis --cd src/auth --includeDirs ../shared ccw cli -p "CONTEXT: @**/* @../shared/**/*" --tool gemini --mode analysis --cd src/auth --includeDirs ../shared
``` ```
**Directory Scope**: **Directory Scope**:

View File

@@ -78,7 +78,7 @@ rg "^import .* from " -n | head -30
### Gemini Semantic Analysis (deep-scan, dependency-map) ### Gemini Semantic Analysis (deep-scan, dependency-map)
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: {from prompt} PURPOSE: {from prompt}
TASK: {from prompt} TASK: {from prompt}
MODE: analysis MODE: analysis

View File

@@ -78,7 +78,7 @@ Phase 4: planObject Generation
## CLI Command Template ## CLI Command Template
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Generate plan for {task_description} PURPOSE: Generate plan for {task_description}
TASK: TASK:
• Analyze task/bug description and context • Analyze task/bug description and context

View File

@@ -107,7 +107,7 @@ Phase 3: Task JSON Generation
**Template-Based Command Construction with Test Layer Awareness**: **Template-Based Command Construction with Test Layer Awareness**:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Analyze {test_type} test failures and generate fix strategy for iteration {iteration} PURPOSE: Analyze {test_type} test failures and generate fix strategy for iteration {iteration}
TASK: TASK:
• Review {failed_tests.length} {test_type} test failures: [{test_names}] • Review {failed_tests.length} {test_type} test failures: [{test_names}]
@@ -527,7 +527,7 @@ See: `.process/iteration-{iteration}-cli-output.txt`
1. **Detect test_type**: "integration" → Apply integration-specific diagnosis 1. **Detect test_type**: "integration" → Apply integration-specific diagnosis
2. **Execute CLI**: 2. **Execute CLI**:
```bash ```bash
ccw cli exec "PURPOSE: Analyze integration test failure... ccw cli -p "PURPOSE: Analyze integration test failure...
TASK: Examine component interactions, data flow, interface contracts... TASK: Examine component interactions, data flow, interface contracts...
RULES: Analyze full call stack and data flow across components" --tool gemini --mode analysis RULES: Analyze full call stack and data flow across components" --tool gemini --mode analysis
``` ```

View File

@@ -123,7 +123,7 @@ When task JSON contains `flow_control.implementation_approach` array:
**CLI Command Execution (CLI Execute Mode)**: **CLI Command Execution (CLI Execute Mode)**:
When step contains `command` field with Codex CLI, execute via CCW CLI. For Codex resume: When step contains `command` field with Codex CLI, execute via CCW CLI. For Codex resume:
- First task (`depends_on: []`): `ccw cli exec "..." --tool codex --mode write --cd [path]` - First task (`depends_on: []`): `ccw cli -p "..." --tool codex --mode write --cd [path]`
- Subsequent tasks (has `depends_on`): Use CCW CLI with resume context to maintain session - Subsequent tasks (has `depends_on`): Use CCW CLI with resume context to maintain session
**Test-Driven Development**: **Test-Driven Development**:

View File

@@ -63,7 +63,7 @@ The agent supports **two execution modes** based on task JSON's `meta.cli_execut
- Agent substitutes [target_folders] into command - Agent substitutes [target_folders] into command
- Agent executes CLI command via CCW: - Agent executes CLI command via CCW:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Generate module documentation PURPOSE: Generate module documentation
TASK: Create API.md and README.md for each module TASK: Create API.md and README.md for each module
MODE: write MODE: write
@@ -216,7 +216,7 @@ Before completion, verify:
{ {
"step": "analyze_module_structure", "step": "analyze_module_structure",
"action": "Deep analysis of module structure and API", "action": "Deep analysis of module structure and API",
"command": "ccw cli exec \"PURPOSE: Document module comprehensively\nTASK: Extract module purpose, architecture, public API, dependencies\nMODE: analysis\nCONTEXT: @**/* System: [system_context]\nEXPECTED: Complete module analysis for documentation\nRULES: $(cat ~/.claude/workflows/cli-templates/prompts/documentation/module-documentation.txt)\" --tool gemini --mode analysis --cd src/auth", "command": "ccw cli -p \"PURPOSE: Document module comprehensively\nTASK: Extract module purpose, architecture, public API, dependencies\nMODE: analysis\nCONTEXT: @**/* System: [system_context]\nEXPECTED: Complete module analysis for documentation\nRULES: $(cat ~/.claude/workflows/cli-templates/prompts/documentation/module-documentation.txt)\" --tool gemini --mode analysis --cd src/auth",
"output_to": "module_analysis", "output_to": "module_analysis",
"on_error": "fail" "on_error": "fail"
} }

View File

@@ -239,9 +239,9 @@ api_id=$((group_count + 3))
| **CLI** | true | implementation_approach | write | --mode write | Execute CLI commands, validate output | | **CLI** | true | implementation_approach | write | --mode write | Execute CLI commands, validate output |
**Command Patterns**: **Command Patterns**:
- Gemini/Qwen: `ccw cli exec "..." --tool gemini --mode analysis --cd dir` - Gemini/Qwen: `ccw cli -p "..." --tool gemini --mode analysis --cd dir`
- CLI Mode: `ccw cli exec "..." --tool gemini --mode write --cd dir` - CLI Mode: `ccw cli -p "..." --tool gemini --mode write --cd dir`
- Codex: `ccw cli exec "..." --tool codex --mode write --cd dir` - Codex: `ccw cli -p "..." --tool codex --mode write --cd dir`
**Generation Process**: **Generation Process**:
1. Read configuration values (tool, cli_execute, mode) from workflow-session.json 1. Read configuration values (tool, cli_execute, mode) from workflow-session.json
@@ -332,7 +332,7 @@ api_id=$((group_count + 3))
{ {
"step": 2, "step": 2,
"title": "Batch generate documentation via CLI", "title": "Batch generate documentation via CLI",
"command": "ccw cli exec 'PURPOSE: Generate module docs\\nTASK: Create documentation\\nMODE: write\\nCONTEXT: @**/* [phase2_context]\\nEXPECTED: API.md and README.md\\nRULES: Mirror structure' --tool gemini --mode write --cd ${dirs_from_group}", "command": "ccw cli -p 'PURPOSE: Generate module docs\\nTASK: Create documentation\\nMODE: write\\nCONTEXT: @**/* [phase2_context]\\nEXPECTED: API.md and README.md\\nRULES: Mirror structure' --tool gemini --mode write --cd ${dirs_from_group}",
"depends_on": [1], "depends_on": [1],
"output": "generated_docs" "output": "generated_docs"
} }
@@ -364,7 +364,7 @@ api_id=$((group_count + 3))
}, },
{ {
"step": "analyze_project", "step": "analyze_project",
"command": "bash(ccw cli exec \"PURPOSE: Analyze project structure\\nTASK: Extract overview from modules\\nMODE: analysis\\nCONTEXT: [all_module_docs]\\nEXPECTED: Project outline\" --tool gemini --mode analysis)", "command": "bash(ccw cli -p \"PURPOSE: Analyze project structure\\nTASK: Extract overview from modules\\nMODE: analysis\\nCONTEXT: [all_module_docs]\\nEXPECTED: Project outline\" --tool gemini --mode analysis)",
"output_to": "project_outline" "output_to": "project_outline"
} }
], ],
@@ -404,7 +404,7 @@ api_id=$((group_count + 3))
"pre_analysis": [ "pre_analysis": [
{"step": "load_existing_docs", "command": "bash(cat .workflow/docs/${project_name}/{ARCHITECTURE,EXAMPLES}.md 2>/dev/null || echo 'No existing docs')", "output_to": "existing_arch_examples"}, {"step": "load_existing_docs", "command": "bash(cat .workflow/docs/${project_name}/{ARCHITECTURE,EXAMPLES}.md 2>/dev/null || echo 'No existing docs')", "output_to": "existing_arch_examples"},
{"step": "load_all_docs", "command": "bash(cat .workflow/docs/${project_name}/README.md && find .workflow/docs/${project_name} -type f -name '*.md' ! -path '*/README.md' ! -path '*/ARCHITECTURE.md' ! -path '*/EXAMPLES.md' ! -path '*/api/*' | xargs cat)", "output_to": "all_docs"}, {"step": "load_all_docs", "command": "bash(cat .workflow/docs/${project_name}/README.md && find .workflow/docs/${project_name} -type f -name '*.md' ! -path '*/README.md' ! -path '*/ARCHITECTURE.md' ! -path '*/EXAMPLES.md' ! -path '*/api/*' | xargs cat)", "output_to": "all_docs"},
{"step": "analyze_architecture", "command": "bash(ccw cli exec \"PURPOSE: Analyze system architecture\\nTASK: Synthesize architectural overview and examples\\nMODE: analysis\\nCONTEXT: [all_docs]\\nEXPECTED: Architecture + Examples outline\" --tool gemini --mode analysis)", "output_to": "arch_examples_outline"} {"step": "analyze_architecture", "command": "bash(ccw cli -p \"PURPOSE: Analyze system architecture\\nTASK: Synthesize architectural overview and examples\\nMODE: analysis\\nCONTEXT: [all_docs]\\nEXPECTED: Architecture + Examples outline\" --tool gemini --mode analysis)", "output_to": "arch_examples_outline"}
], ],
"implementation_approach": [ "implementation_approach": [
{ {
@@ -441,7 +441,7 @@ api_id=$((group_count + 3))
"pre_analysis": [ "pre_analysis": [
{"step": "discover_api", "command": "bash(rg 'router\\.| @(Get|Post)' -g '*.{ts,js}')", "output_to": "endpoint_discovery"}, {"step": "discover_api", "command": "bash(rg 'router\\.| @(Get|Post)' -g '*.{ts,js}')", "output_to": "endpoint_discovery"},
{"step": "load_existing_api", "command": "bash(cat .workflow/docs/${project_name}/api/README.md 2>/dev/null || echo 'No existing API docs')", "output_to": "existing_api_docs"}, {"step": "load_existing_api", "command": "bash(cat .workflow/docs/${project_name}/api/README.md 2>/dev/null || echo 'No existing API docs')", "output_to": "existing_api_docs"},
{"step": "analyze_api", "command": "bash(ccw cli exec \"PURPOSE: Document HTTP API\\nTASK: Analyze endpoints\\nMODE: analysis\\nCONTEXT: @src/api/**/* [endpoint_discovery]\\nEXPECTED: API outline\" --tool gemini --mode analysis)", "output_to": "api_outline"} {"step": "analyze_api", "command": "bash(ccw cli -p \"PURPOSE: Document HTTP API\\nTASK: Analyze endpoints\\nMODE: analysis\\nCONTEXT: @src/api/**/* [endpoint_discovery]\\nEXPECTED: API outline\" --tool gemini --mode analysis)", "output_to": "api_outline"}
], ],
"implementation_approach": [ "implementation_approach": [
{ {

View File

@@ -136,7 +136,7 @@ Task(
Execute Gemini/Qwen CLI for deep analysis (saves main thread tokens): Execute Gemini/Qwen CLI for deep analysis (saves main thread tokens):
\`\`\`bash \`\`\`bash
ccw cli exec " ccw cli -p "
PURPOSE: Extract project core context for task: ${task_description} PURPOSE: Extract project core context for task: ${task_description}
TASK: Analyze project architecture, tech stack, key patterns, relevant files TASK: Analyze project architecture, tech stack, key patterns, relevant files
MODE: analysis MODE: analysis

View File

@@ -187,7 +187,7 @@ Objectives:
3. Use Gemini for aggregation (optional): 3. Use Gemini for aggregation (optional):
Command pattern: Command pattern:
ccw cli exec " ccw cli -p "
PURPOSE: Extract lessons and conflicts from workflow session PURPOSE: Extract lessons and conflicts from workflow session
TASK: TASK:
• Analyze IMPL_PLAN and lessons from manifest • Analyze IMPL_PLAN and lessons from manifest
@@ -334,7 +334,7 @@ Objectives:
- Sort sessions by date - Sort sessions by date
2. Use Gemini for final aggregation: 2. Use Gemini for final aggregation:
ccw cli exec " ccw cli -p "
PURPOSE: Aggregate lessons and conflicts from all workflow sessions PURPOSE: Aggregate lessons and conflicts from all workflow sessions
TASK: TASK:
• Group successes by functional domain • Group successes by functional domain

View File

@@ -473,7 +473,7 @@ Detailed plan: ${executionContext.session.artifacts.plan}`)
return prompt return prompt
} }
ccw cli exec "${buildCLIPrompt(batch)}" --tool codex --mode write ccw cli -p "${buildCLIPrompt(batch)}" --tool codex --mode write
``` ```
**Execution with fixed IDs** (predictable ID pattern): **Execution with fixed IDs** (predictable ID pattern):
@@ -496,8 +496,8 @@ const previousCliId = batch.resumeFromCliId || null
// Build command with fixed ID (and optional resume for continuation) // Build command with fixed ID (and optional resume for continuation)
const cli_command = previousCliId const cli_command = previousCliId
? `ccw cli exec "${buildCLIPrompt(batch)}" --tool codex --mode write --id ${fixedExecutionId} --resume ${previousCliId}` ? `ccw cli -p "${buildCLIPrompt(batch)}" --tool codex --mode write --id ${fixedExecutionId} --resume ${previousCliId}`
: `ccw cli exec "${buildCLIPrompt(batch)}" --tool codex --mode write --id ${fixedExecutionId}` : `ccw cli -p "${buildCLIPrompt(batch)}" --tool codex --mode write --id ${fixedExecutionId}`
bash_result = Bash( bash_result = Bash(
command=cli_command, command=cli_command,
@@ -519,7 +519,7 @@ if (bash_result.status === 'failed' || bash_result.status === 'timeout') {
⚠️ Execution incomplete. Resume available: ⚠️ Execution incomplete. Resume available:
Fixed ID: ${fixedExecutionId} Fixed ID: ${fixedExecutionId}
Lookup: ccw cli detail ${fixedExecutionId} Lookup: ccw cli detail ${fixedExecutionId}
Resume: ccw cli exec "Continue tasks" --resume ${fixedExecutionId} --tool codex --mode write --id ${fixedExecutionId}-retry Resume: ccw cli -p "Continue tasks" --resume ${fixedExecutionId} --tool codex --mode write --id ${fixedExecutionId}-retry
`) `)
// Store for potential retry in same session // Store for potential retry in same session
@@ -574,15 +574,15 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/02-review-code-q
# - Report findings directly # - Report findings directly
# Method 2: Gemini Review (recommended) # Method 2: Gemini Review (recommended)
ccw cli exec "[Shared Prompt Template with artifacts]" --tool gemini --mode analysis ccw cli -p "[Shared Prompt Template with artifacts]" --tool gemini --mode analysis
# CONTEXT includes: @**/* @${plan.json} [@${exploration.json}] # CONTEXT includes: @**/* @${plan.json} [@${exploration.json}]
# Method 3: Qwen Review (alternative) # Method 3: Qwen Review (alternative)
ccw cli exec "[Shared Prompt Template with artifacts]" --tool qwen --mode analysis ccw cli -p "[Shared Prompt Template with artifacts]" --tool qwen --mode analysis
# Same prompt as Gemini, different execution engine # Same prompt as Gemini, different execution engine
# Method 4: Codex Review (autonomous) # Method 4: Codex Review (autonomous)
ccw cli exec "[Verify plan acceptance criteria at ${plan.json}]" --tool codex --mode write ccw cli -p "[Verify plan acceptance criteria at ${plan.json}]" --tool codex --mode write
``` ```
**Multi-Round Review with Fixed IDs**: **Multi-Round Review with Fixed IDs**:
@@ -591,12 +591,12 @@ ccw cli exec "[Verify plan acceptance criteria at ${plan.json}]" --tool codex --
const reviewId = `${sessionId}-review` const reviewId = `${sessionId}-review`
// First review pass with fixed ID // First review pass with fixed ID
const reviewResult = Bash(`ccw cli exec "[Review prompt]" --tool gemini --mode analysis --id ${reviewId}`) const reviewResult = Bash(`ccw cli -p "[Review prompt]" --tool gemini --mode analysis --id ${reviewId}`)
// If issues found, continue review dialog with fixed ID chain // If issues found, continue review dialog with fixed ID chain
if (hasUnresolvedIssues(reviewResult)) { if (hasUnresolvedIssues(reviewResult)) {
// Resume with follow-up questions // Resume with follow-up questions
Bash(`ccw cli exec "Clarify the security concerns you mentioned" --resume ${reviewId} --tool gemini --mode analysis --id ${reviewId}-followup`) Bash(`ccw cli -p "Clarify the security concerns you mentioned" --resume ${reviewId} --tool gemini --mode analysis --id ${reviewId}-followup`)
} }
``` ```
@@ -671,7 +671,7 @@ console.log(`✓ Development index: [${category}] ${entry.title}`)
| Empty file | File exists but no content | Error: "File is empty: {path}. Provide task description." | | Empty file | File exists but no content | Error: "File is empty: {path}. Provide task description." |
| Invalid Enhanced Task JSON | JSON missing required fields | Warning: "Missing required fields. Treating as plain text." | | Invalid Enhanced Task JSON | JSON missing required fields | Warning: "Missing required fields. Treating as plain text." |
| Malformed JSON | JSON parsing fails | Treat as plain text (expected for non-JSON files) | | Malformed JSON | JSON parsing fails | Treat as plain text (expected for non-JSON files) |
| Execution failure | Agent/Codex crashes | Display error, use fixed ID `${sessionId}-${groupId}` for resume: `ccw cli exec "Continue" --resume <fixed-id> --id <fixed-id>-retry` | | Execution failure | Agent/Codex crashes | Display error, use fixed ID `${sessionId}-${groupId}` for resume: `ccw cli -p "Continue" --resume <fixed-id> --id <fixed-id>-retry` |
| Execution timeout | CLI exceeded timeout | Use fixed ID for resume with extended timeout | | Execution timeout | CLI exceeded timeout | Use fixed ID for resume with extended timeout |
| Codex unavailable | Codex not installed | Show installation instructions, offer Agent execution | | Codex unavailable | Codex not installed | Show installation instructions, offer Agent execution |
| Fixed ID not found | Custom ID lookup failed | Check `ccw cli history`, verify date directories | | Fixed ID not found | Custom ID lookup failed | Check `ccw cli history`, verify date directories |
@@ -744,5 +744,5 @@ Appended to `previousExecutionResults` array for context continuity in multi-exe
ccw cli detail ${fixedCliId} ccw cli detail ${fixedCliId}
# Resume with new fixed ID for retry # Resume with new fixed ID for retry
ccw cli exec "Continue from where we left off" --resume ${fixedCliId} --tool codex --mode write --id ${fixedCliId}-retry ccw cli -p "Continue from where we left off" --resume ${fixedCliId} --tool codex --mode write --id ${fixedCliId}-retry
``` ```

View File

@@ -137,7 +137,7 @@ After bash validation, the model takes control to:
``` ```
- Use Gemini for security analysis: - Use Gemini for security analysis:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Security audit of completed implementation PURPOSE: Security audit of completed implementation
TASK: Review code for security vulnerabilities, insecure patterns, auth/authz issues TASK: Review code for security vulnerabilities, insecure patterns, auth/authz issues
CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md
@@ -149,7 +149,7 @@ After bash validation, the model takes control to:
**Architecture Review** (`--type=architecture`): **Architecture Review** (`--type=architecture`):
- Use Qwen for architecture analysis: - Use Qwen for architecture analysis:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Architecture compliance review PURPOSE: Architecture compliance review
TASK: Evaluate adherence to architectural patterns, identify technical debt, review design decisions TASK: Evaluate adherence to architectural patterns, identify technical debt, review design decisions
CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md
@@ -161,7 +161,7 @@ After bash validation, the model takes control to:
**Quality Review** (`--type=quality`): **Quality Review** (`--type=quality`):
- Use Gemini for code quality: - Use Gemini for code quality:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Code quality and best practices review PURPOSE: Code quality and best practices review
TASK: Assess code readability, maintainability, adherence to best practices TASK: Assess code readability, maintainability, adherence to best practices
CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md CONTEXT: @.summaries/IMPL-*.md,../.. @../../CLAUDE.md
@@ -183,7 +183,7 @@ After bash validation, the model takes control to:
done done
# Check implementation summaries against requirements # Check implementation summaries against requirements
ccw cli exec " ccw cli -p "
PURPOSE: Verify all requirements and acceptance criteria are met PURPOSE: Verify all requirements and acceptance criteria are met
TASK: Cross-check implementation summaries against original requirements TASK: Cross-check implementation summaries against original requirements
CONTEXT: @.task/IMPL-*.json,.summaries/IMPL-*.md,../.. @../../CLAUDE.md CONTEXT: @.task/IMPL-*.json,.summaries/IMPL-*.md,../.. @../../CLAUDE.md

View File

@@ -141,7 +141,7 @@ done
**Gemini analysis for comprehensive TDD compliance report** **Gemini analysis for comprehensive TDD compliance report**
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Generate TDD compliance report PURPOSE: Generate TDD compliance report
TASK: Analyze TDD workflow execution and generate quality report TASK: Analyze TDD workflow execution and generate quality report
CONTEXT: @{.workflow/active/{sessionId}/.task/*.json,.workflow/active/{sessionId}/.summaries/*,.workflow/active/{sessionId}/.process/tdd-cycle-report.md} CONTEXT: @{.workflow/active/{sessionId}/.task/*.json,.workflow/active/{sessionId}/.summaries/*,.workflow/active/{sessionId}/.process/tdd-cycle-report.md}

View File

@@ -133,7 +133,7 @@ Task(subagent_type="cli-execution-agent", prompt=`
### 2. Execute CLI Analysis (Enhanced with Exploration + Scenario Uniqueness) ### 2. Execute CLI Analysis (Enhanced with Exploration + Scenario Uniqueness)
Primary (Gemini): Primary (Gemini):
ccw cli exec " ccw cli -p "
PURPOSE: Detect conflicts between plan and codebase, using exploration insights PURPOSE: Detect conflicts between plan and codebase, using exploration insights
TASK: TASK:
• **Review pre-identified conflict_indicators from exploration results** • **Review pre-identified conflict_indicators from exploration results**

View File

@@ -255,7 +255,7 @@ Based on userConfig.executionMethod:
CLI Resume Support (MANDATORY for all CLI commands): CLI Resume Support (MANDATORY for all CLI commands):
- Use --resume parameter to continue from previous task execution - Use --resume parameter to continue from previous task execution
- Read previous task's cliExecutionId from session state - Read previous task's cliExecutionId from session state
- Format: ccw cli exec "[prompt]" --resume ${previousCliId} --tool ${tool} --mode write - Format: ccw cli -p "[prompt]" --resume ${previousCliId} --tool ${tool} --mode write
## EXPLORATION CONTEXT (from context-package.exploration_results) ## EXPLORATION CONTEXT (from context-package.exploration_results)
- Load exploration_results from context-package.json - Load exploration_results from context-package.json
@@ -307,10 +307,10 @@ Each task JSON MUST include:
4. **merge_fork**: Task has multiple parents - merges all parent contexts into new conversation 4. **merge_fork**: Task has multiple parents - merges all parent contexts into new conversation
**Execution Command Patterns**: **Execution Command Patterns**:
- new: `ccw cli exec "[prompt]" --tool [tool] --mode write --id [cli_execution_id]` - new: `ccw cli -p "[prompt]" --tool [tool] --mode write --id [cli_execution_id]`
- resume: `ccw cli exec "[prompt]" --resume [resume_from] --tool [tool] --mode write` - resume: `ccw cli -p "[prompt]" --resume [resume_from] --tool [tool] --mode write`
- fork: `ccw cli exec "[prompt]" --resume [resume_from] --id [cli_execution_id] --tool [tool] --mode write` - fork: `ccw cli -p "[prompt]" --resume [resume_from] --id [cli_execution_id] --tool [tool] --mode write`
- merge_fork: `ccw cli exec "[prompt]" --resume [merge_from.join(',')] --id [cli_execution_id] --tool [tool] --mode write` - merge_fork: `ccw cli -p "[prompt]" --resume [merge_from.join(',')] --id [cli_execution_id] --tool [tool] --mode write`
## QUALITY STANDARDS ## QUALITY STANDARDS
Hard Constraints: Hard Constraints:

View File

@@ -89,7 +89,7 @@ Template: ~/.claude/workflows/cli-templates/prompts/test/test-concept-analysis.t
## EXECUTION STEPS ## EXECUTION STEPS
1. Execute Gemini analysis: 1. Execute Gemini analysis:
ccw cli exec "$(cat ~/.claude/workflows/cli-templates/prompts/test/test-concept-analysis.txt)" --tool gemini --mode write --cd .workflow/active/{test_session_id}/.process ccw cli -p "$(cat ~/.claude/workflows/cli-templates/prompts/test/test-concept-analysis.txt)" --tool gemini --mode write --cd .workflow/active/{test_session_id}/.process
2. Generate TEST_ANALYSIS_RESULTS.md: 2. Generate TEST_ANALYSIS_RESULTS.md:
Synthesize gemini-test-analysis.md into standardized format for task generation Synthesize gemini-test-analysis.md into standardized format for task generation

View File

@@ -180,7 +180,7 @@ Task(subagent_type="ui-design-agent",
- Pattern: rg → Extract values → Compare → If different → Read full context with comments → Record conflict - Pattern: rg → Extract values → Compare → If different → Read full context with comments → Record conflict
- Alternative (if many files): Execute CLI analysis for comprehensive report: - Alternative (if many files): Execute CLI analysis for comprehensive report:
\`\`\`bash \`\`\`bash
ccw cli exec \" ccw cli -p \"
PURPOSE: Detect color token conflicts across all CSS/SCSS/JS files PURPOSE: Detect color token conflicts across all CSS/SCSS/JS files
TASK: • Scan all files for color definitions • Identify conflicting values • Extract semantic comments TASK: • Scan all files for color definitions • Identify conflicting values • Extract semantic comments
MODE: analysis MODE: analysis
@@ -295,7 +295,7 @@ Task(subagent_type="ui-design-agent",
- Pattern: rg → Identify animation types → Map framework usage → Prioritize extraction targets - Pattern: rg → Identify animation types → Map framework usage → Prioritize extraction targets
- Alternative (if complex framework mix): Execute CLI analysis for comprehensive report: - Alternative (if complex framework mix): Execute CLI analysis for comprehensive report:
\`\`\`bash \`\`\`bash
ccw cli exec \" ccw cli -p \"
PURPOSE: Detect animation frameworks and patterns PURPOSE: Detect animation frameworks and patterns
TASK: • Identify frameworks • Map animation patterns • Categorize by complexity TASK: • Identify frameworks • Map animation patterns • Categorize by complexity
MODE: analysis MODE: analysis
@@ -374,7 +374,7 @@ Task(subagent_type="ui-design-agent",
- Pattern: rg → Count occurrences → Classify by frequency → Prioritize universal components - Pattern: rg → Count occurrences → Classify by frequency → Prioritize universal components
- Alternative (if large codebase): Execute CLI analysis for comprehensive categorization: - Alternative (if large codebase): Execute CLI analysis for comprehensive categorization:
\`\`\`bash \`\`\`bash
ccw cli exec \" ccw cli -p \"
PURPOSE: Classify components as universal vs specialized PURPOSE: Classify components as universal vs specialized
TASK: • Identify UI components • Classify reusability • Map layout systems TASK: • Identify UI components • Classify reusability • Map layout systems
MODE: analysis MODE: analysis

View File

@@ -70,7 +70,7 @@ Document recurring conflict patterns across workflow sessions with resolutions.
**Command Pattern**: **Command Pattern**:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Identify conflict patterns from workflow sessions PURPOSE: Identify conflict patterns from workflow sessions
TASK: • Extract conflicts from IMPL_PLAN and lessons • Group by type (architecture/dependencies/testing/performance) • Identify recurring patterns (same conflict in different sessions) • Link resolutions to specific sessions TASK: • Extract conflicts from IMPL_PLAN and lessons • Group by type (architecture/dependencies/testing/performance) • Identify recurring patterns (same conflict in different sessions) • Link resolutions to specific sessions
MODE: analysis MODE: analysis

View File

@@ -66,7 +66,7 @@ Aggregate lessons learned from workflow sessions, categorized by functional doma
**Command Pattern**: **Command Pattern**:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Aggregate workflow lessons from session data PURPOSE: Aggregate workflow lessons from session data
TASK: • Group successes by functional domain • Categorize challenges by severity (HIGH/MEDIUM/LOW) • Identify watch patterns with frequency >= 2 • Mark CRITICAL patterns (3+ sessions) TASK: • Group successes by functional domain • Categorize challenges by severity (HIGH/MEDIUM/LOW) • Identify watch patterns with frequency >= 2 • Mark CRITICAL patterns (3+ sessions)
MODE: analysis MODE: analysis

View File

@@ -62,7 +62,7 @@ RULES: $(cat ~/.claude/workflows/cli-templates/protocols/[mode]-protocol.md) $(c
## Essential Command Structure ## Essential Command Structure
```bash ```bash
ccw cli exec "<PROMPT>" --tool <gemini|qwen|codex> --mode <analysis|write> ccw cli -p "<PROMPT>" --tool <gemini|qwen|codex> --mode <analysis|write>
``` ```
**⚠️ CRITICAL**: `--mode` parameter is **MANDATORY** for all CLI executions. No defaults are assumed. **⚠️ CRITICAL**: `--mode` parameter is **MANDATORY** for all CLI executions. No defaults are assumed.
@@ -70,7 +70,7 @@ ccw cli exec "<PROMPT>" --tool <gemini|qwen|codex> --mode <analysis|write>
### Core Principles ### Core Principles
- **Use tools early and often** - Tools are faster and more thorough - **Use tools early and often** - Tools are faster and more thorough
- **Unified CLI** - Always use `ccw cli exec` for consistent parameter handling - **Unified CLI** - Always use `ccw cli -p` for consistent parameter handling
- **Mode is MANDATORY** - ALWAYS explicitly specify `--mode analysis|write` (no implicit defaults) - **Mode is MANDATORY** - ALWAYS explicitly specify `--mode analysis|write` (no implicit defaults)
- **One template required** - ALWAYS reference exactly ONE template in RULES (use universal fallback if no specific match) - **One template required** - ALWAYS reference exactly ONE template in RULES (use universal fallback if no specific match)
- **Write protection** - Require EXPLICIT `--mode write` for file operations - **Write protection** - Require EXPLICIT `--mode write` for file operations
@@ -131,7 +131,7 @@ RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md) $(ca
### Gemini & Qwen ### Gemini & Qwen
**Via CCW**: `ccw cli exec "<prompt>" --tool gemini --mode analysis` or `--tool qwen --mode analysis` **Via CCW**: `ccw cli -p "<prompt>" --tool gemini --mode analysis` or `--tool qwen --mode analysis`
**Characteristics**: **Characteristics**:
- Large context window, pattern recognition - Large context window, pattern recognition
@@ -147,7 +147,7 @@ RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md) $(ca
### Codex ### Codex
**Via CCW**: `ccw cli exec "<prompt>" --tool codex --mode write` **Via CCW**: `ccw cli -p "<prompt>" --tool codex --mode write`
**Characteristics**: **Characteristics**:
- Autonomous development, mathematical reasoning - Autonomous development, mathematical reasoning
@@ -161,8 +161,8 @@ RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md) $(ca
**Resume via `--resume` parameter**: **Resume via `--resume` parameter**:
```bash ```bash
ccw cli exec "Continue analyzing" --tool gemini --mode analysis --resume # Resume last session ccw cli -p "Continue analyzing" --tool gemini --mode analysis --resume # Resume last session
ccw cli exec "Fix issues found" --tool codex --mode write --resume <id> # Resume specific session ccw cli -p "Fix issues found" --tool codex --mode write --resume <id> # Resume specific session
``` ```
- **`--resume` (empty)**: Resume most recent session - **`--resume` (empty)**: Resume most recent session
@@ -264,7 +264,7 @@ rg "export.*Component" --files-with-matches --type ts
CONTEXT: @components/Auth.tsx @types/auth.d.ts | Memory: Previous type refactoring CONTEXT: @components/Auth.tsx @types/auth.d.ts | Memory: Previous type refactoring
# Step 3: Execute CLI # Step 3: Execute CLI
ccw cli exec "..." --tool gemini --mode analysis --cd src ccw cli -p "..." --tool gemini --mode analysis --cd src
``` ```
### RULES Configuration ### RULES Configuration
@@ -284,13 +284,13 @@ ccw cli exec "..." --tool gemini --mode analysis --cd src
**Critical**: Use double quotes `"..."` around the entire prompt to enable `$(cat ...)` expansion: **Critical**: Use double quotes `"..."` around the entire prompt to enable `$(cat ...)` expansion:
```bash ```bash
# ✓ CORRECT - double quotes allow shell expansion # ✓ CORRECT - double quotes allow shell expansion
ccw cli exec "RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) ..." --tool gemini ccw cli -p "RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) ..." --tool gemini
# ✗ WRONG - single quotes prevent expansion # ✗ WRONG - single quotes prevent expansion
ccw cli exec 'RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) ...' --tool gemini ccw cli -p 'RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) ...' --tool gemini
# ✗ WRONG - escaped $ prevents expansion # ✗ WRONG - escaped $ prevents expansion
ccw cli exec "RULES: \$(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) ..." --tool gemini ccw cli -p "RULES: \$(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) ..." --tool gemini
``` ```
**Examples**: **Examples**:
@@ -397,10 +397,10 @@ When using `--cd`:
```bash ```bash
# Single directory # Single directory
ccw cli exec "CONTEXT: @**/* @../shared/**/*" --tool gemini --mode analysis --cd src/auth --includeDirs ../shared ccw cli -p "CONTEXT: @**/* @../shared/**/*" --tool gemini --mode analysis --cd src/auth --includeDirs ../shared
# Multiple directories # Multiple directories
ccw cli exec "..." --tool gemini --mode analysis --cd src/auth --includeDirs ../shared,../types,../utils ccw cli -p "..." --tool gemini --mode analysis --cd src/auth --includeDirs ../shared,../types,../utils
``` ```
**Rule**: If CONTEXT contains `@../dir/**/*`, MUST include `--includeDirs ../dir` **Rule**: If CONTEXT contains `@../dir/**/*`, MUST include `--includeDirs ../dir`
@@ -433,7 +433,7 @@ CCW automatically maps to tool-specific syntax:
**Analysis Task** (Security Audit): **Analysis Task** (Security Audit):
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Identify OWASP Top 10 vulnerabilities in authentication module to pass security audit; success = all critical/high issues documented with remediation PURPOSE: Identify OWASP Top 10 vulnerabilities in authentication module to pass security audit; success = all critical/high issues documented with remediation
TASK: • Scan for injection flaws (SQL, command, LDAP) • Check authentication bypass vectors • Evaluate session management • Assess sensitive data exposure TASK: • Scan for injection flaws (SQL, command, LDAP) • Check authentication bypass vectors • Evaluate session management • Assess sensitive data exposure
MODE: analysis MODE: analysis
@@ -445,7 +445,7 @@ RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) $
**Implementation Task** (New Feature): **Implementation Task** (New Feature):
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Implement rate limiting for API endpoints to prevent abuse; must be configurable per-endpoint; backward compatible with existing clients PURPOSE: Implement rate limiting for API endpoints to prevent abuse; must be configurable per-endpoint; backward compatible with existing clients
TASK: • Create rate limiter middleware with sliding window • Implement per-route configuration • Add Redis backend for distributed state • Include bypass for internal services TASK: • Create rate limiter middleware with sliding window • Implement per-route configuration • Add Redis backend for distributed state • Include bypass for internal services
MODE: write MODE: write
@@ -457,7 +457,7 @@ RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md) $(ca
**Bug Fix Task**: **Bug Fix Task**:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Fix memory leak in WebSocket connection handler causing server OOM after 24h; root cause must be identified before any fix PURPOSE: Fix memory leak in WebSocket connection handler causing server OOM after 24h; root cause must be identified before any fix
TASK: • Trace connection lifecycle from open to close • Identify event listener accumulation • Check cleanup on disconnect • Verify garbage collection eligibility TASK: • Trace connection lifecycle from open to close • Identify event listener accumulation • Check cleanup on disconnect • Verify garbage collection eligibility
MODE: analysis MODE: analysis
@@ -469,7 +469,7 @@ RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) $
**Refactoring Task**: **Refactoring Task**:
```bash ```bash
ccw cli exec " ccw cli -p "
PURPOSE: Refactor payment processing to use strategy pattern for multi-gateway support; no functional changes; all existing tests must pass PURPOSE: Refactor payment processing to use strategy pattern for multi-gateway support; no functional changes; all existing tests must pass
TASK: • Extract gateway interface from current implementation • Create strategy classes for Stripe, PayPal • Implement factory for gateway selection • Migrate existing code to use strategies TASK: • Extract gateway interface from current implementation • Create strategy classes for Stripe, PayPal • Implement factory for gateway selection • Migrate existing code to use strategies
MODE: write MODE: write
@@ -501,8 +501,8 @@ RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md) $(ca
**Codex Multiplier**: 3x allocated time (minimum 15min / 900000ms) **Codex Multiplier**: 3x allocated time (minimum 15min / 900000ms)
```bash ```bash
ccw cli exec "<prompt>" --tool gemini --mode analysis --timeout 600000 # 10 min ccw cli -p "<prompt>" --tool gemini --mode analysis --timeout 600000 # 10 min
ccw cli exec "<prompt>" --tool codex --mode write --timeout 1800000 # 30 min ccw cli -p "<prompt>" --tool codex --mode write --timeout 1800000 # 30 min
``` ```
### Permission Framework ### Permission Framework
@@ -530,10 +530,10 @@ ccw cli exec "<prompt>" --tool codex --mode write --timeout 1800000 # 30 min
### Workflow Integration ### Workflow Integration
- **Understanding**: `ccw cli exec "<prompt>" --tool gemini --mode analysis` - **Understanding**: `ccw cli -p "<prompt>" --tool gemini --mode analysis`
- **Architecture**: `ccw cli exec "<prompt>" --tool gemini --mode analysis` - **Architecture**: `ccw cli -p "<prompt>" --tool gemini --mode analysis`
- **Implementation**: `ccw cli exec "<prompt>" --tool codex --mode write` - **Implementation**: `ccw cli -p "<prompt>" --tool codex --mode write`
- **Quality**: `ccw cli exec "<prompt>" --tool codex --mode write` - **Quality**: `ccw cli -p "<prompt>" --tool codex --mode write`
### Planning Checklist ### Planning Checklist

View File

@@ -153,6 +153,8 @@ export function run(argv: string[]): void {
program program
.command('cli [subcommand] [args...]') .command('cli [subcommand] [args...]')
.description('Unified CLI tool executor (gemini/qwen/codex/claude)') .description('Unified CLI tool executor (gemini/qwen/codex/claude)')
.option('-p, --prompt <prompt>', 'Prompt text (alternative to positional argument)')
.option('-f, --file <file>', 'Read prompt from file (best for multi-line prompts)')
.option('--tool <tool>', 'CLI tool to use', 'gemini') .option('--tool <tool>', 'CLI tool to use', 'gemini')
.option('--mode <mode>', 'Execution mode: analysis, write, auto', 'analysis') .option('--mode <mode>', 'Execution mode: analysis, write, auto', 'analysis')
.option('--model <model>', 'Model override') .option('--model <model>', 'Model override')

View File

@@ -58,6 +58,8 @@ function notifyDashboard(data: Record<string, unknown>): void {
} }
interface CliExecOptions { interface CliExecOptions {
prompt?: string; // Prompt via --prompt/-p option (preferred for multi-line)
file?: string; // Read prompt from file
tool?: string; tool?: string;
mode?: string; mode?: string;
model?: string; model?: string;
@@ -269,6 +271,83 @@ function showStorageHelp(): void {
console.log(); console.log();
} }
/**
* Test endpoint for debugging multi-line prompt parsing
* Shows exactly how Commander.js parsed the arguments
*/
function testParseAction(args: string[], options: CliExecOptions): void {
console.log(chalk.bold.cyan('\n ═══════════════════════════════════════════════'));
console.log(chalk.bold.cyan(' │ CLI PARSE TEST ENDPOINT │'));
console.log(chalk.bold.cyan(' ═══════════════════════════════════════════════\n'));
// Show args array parsing
console.log(chalk.bold.yellow('📦 Positional Arguments (args[]):'));
console.log(chalk.gray(' Length: ') + chalk.white(args.length));
if (args.length === 0) {
console.log(chalk.gray(' (empty)'));
} else {
args.forEach((arg, i) => {
console.log(chalk.gray(` [${i}]: `) + chalk.green(`"${arg}"`));
// Show if multiline
if (arg.includes('\n')) {
console.log(chalk.yellow(` ↳ Contains ${arg.split('\n').length} lines`));
}
});
}
console.log();
// Show options parsing
console.log(chalk.bold.yellow('⚙️ Options:'));
const optionEntries = Object.entries(options).filter(([_, v]) => v !== undefined);
if (optionEntries.length === 0) {
console.log(chalk.gray(' (none)'));
} else {
optionEntries.forEach(([key, value]) => {
const displayValue = typeof value === 'string' && value.includes('\n')
? `"${value.substring(0, 50)}..." (${value.split('\n').length} lines)`
: JSON.stringify(value);
console.log(chalk.gray(` --${key}: `) + chalk.cyan(displayValue));
});
}
console.log();
// Show what would be used as prompt
console.log(chalk.bold.yellow('🎯 Final Prompt Resolution:'));
const { prompt: optionPrompt, file } = options;
if (file) {
console.log(chalk.gray(' Source: ') + chalk.magenta('--file/-f option'));
console.log(chalk.gray(' File: ') + chalk.cyan(file));
} else if (optionPrompt) {
console.log(chalk.gray(' Source: ') + chalk.magenta('--prompt/-p option'));
console.log(chalk.gray(' Value: ') + chalk.green(`"${optionPrompt.substring(0, 100)}${optionPrompt.length > 100 ? '...' : ''}"`));
if (optionPrompt.includes('\n')) {
console.log(chalk.yellow(` ↳ Multiline: ${optionPrompt.split('\n').length} lines`));
}
} else if (args[0]) {
console.log(chalk.gray(' Source: ') + chalk.magenta('positional argument (args[0])'));
console.log(chalk.gray(' Value: ') + chalk.green(`"${args[0].substring(0, 100)}${args[0].length > 100 ? '...' : ''}"`));
if (args[0].includes('\n')) {
console.log(chalk.yellow(` ↳ Multiline: ${args[0].split('\n').length} lines`));
}
} else {
console.log(chalk.red(' No prompt found!'));
}
console.log();
// Show raw debug info
console.log(chalk.bold.yellow('🔍 Raw Debug Info:'));
console.log(chalk.gray(' process.argv:'));
process.argv.forEach((arg, i) => {
console.log(chalk.gray(` [${i}]: `) + chalk.dim(arg.length > 60 ? arg.substring(0, 60) + '...' : arg));
});
console.log(chalk.bold.cyan('\n ═══════════════════════════════════════════════\n'));
}
/** /**
* Show CLI tool status * Show CLI tool status
*/ */
@@ -295,14 +374,42 @@ async function statusAction(): Promise<void> {
* @param {string} prompt - Prompt to execute * @param {string} prompt - Prompt to execute
* @param {Object} options - CLI options * @param {Object} options - CLI options
*/ */
async function execAction(prompt: string | undefined, options: CliExecOptions): Promise<void> { async function execAction(positionalPrompt: string | undefined, options: CliExecOptions): Promise<void> {
if (!prompt) { const { prompt: optionPrompt, file, tool = 'gemini', mode = 'analysis', model, cd, includeDirs, timeout, noStream, resume, id, noNative } = options;
// Priority: 1. --file, 2. --prompt/-p option, 3. positional argument
let finalPrompt: string | undefined;
if (file) {
// Read from file
const { readFileSync, existsSync } = await import('fs');
const { resolve } = await import('path');
const filePath = resolve(file);
if (!existsSync(filePath)) {
console.error(chalk.red(`Error: File not found: ${filePath}`));
process.exit(1);
}
finalPrompt = readFileSync(filePath, 'utf8').trim();
if (!finalPrompt) {
console.error(chalk.red('Error: File is empty'));
process.exit(1);
}
} else if (optionPrompt) {
// Use --prompt/-p option (preferred for multi-line)
finalPrompt = optionPrompt;
} else {
// Fall back to positional argument
finalPrompt = positionalPrompt;
}
if (!finalPrompt) {
console.error(chalk.red('Error: Prompt is required')); console.error(chalk.red('Error: Prompt is required'));
console.error(chalk.gray('Usage: ccw cli exec "<prompt>" --tool gemini')); console.error(chalk.gray('Usage: ccw cli -p "<prompt>" --tool gemini'));
console.error(chalk.gray(' or: ccw cli -f prompt.txt --tool codex'));
process.exit(1); process.exit(1);
} }
const { tool = 'gemini', mode = 'analysis', model, cd, includeDirs, timeout, noStream, resume, id, noNative } = options; const prompt_to_use = finalPrompt;
// Parse resume IDs for merge scenario // Parse resume IDs for merge scenario
const resumeIds = resume && typeof resume === 'string' ? resume.split(',').map(s => s.trim()).filter(Boolean) : []; const resumeIds = resume && typeof resume === 'string' ? resume.split(',').map(s => s.trim()).filter(Boolean) : [];
@@ -333,7 +440,7 @@ async function execAction(prompt: string | undefined, options: CliExecOptions):
event: 'started', event: 'started',
tool, tool,
mode, mode,
prompt_preview: prompt.substring(0, 100) + (prompt.length > 100 ? '...' : ''), prompt_preview: prompt_to_use.substring(0, 100) + (prompt_to_use.length > 100 ? '...' : ''),
custom_id: id || null custom_id: id || null
}); });
@@ -345,7 +452,7 @@ async function execAction(prompt: string | undefined, options: CliExecOptions):
try { try {
const result = await cliExecutorTool.execute({ const result = await cliExecutorTool.execute({
tool, tool,
prompt, prompt: prompt_to_use,
mode, mode,
model, model,
cd, cd,
@@ -398,7 +505,7 @@ async function execAction(prompt: string | undefined, options: CliExecOptions):
console.error(chalk.red(result.stderr)); console.error(chalk.red(result.stderr));
} }
// Notify dashboard: execution failed // Notify dashboard: execution failccw cli -p
notifyDashboard({ notifyDashboard({
event: 'completed', event: 'completed',
tool, tool,
@@ -535,7 +642,7 @@ function getTimeAgo(date: Date): string {
return date.toLocaleDateString(); return date.toLocaleDateString();
} }
/** /**ccw cli -p
* CLI command entry point * CLI command entry point
* @param {string} subcommand - Subcommand (status, exec, history, detail) * @param {string} subcommand - Subcommand (status, exec, history, detail)
* @param {string[]} args - Arguments array * @param {string[]} args - Arguments array
@@ -553,10 +660,6 @@ export async function cliCommand(
await statusAction(); await statusAction();
break; break;
case 'exec':
await execAction(argsArray[0], options as CliExecOptions);
break;
case 'history': case 'history':
await historyAction(options as HistoryOptions); await historyAction(options as HistoryOptions);
break; break;
@@ -569,42 +672,62 @@ export async function cliCommand(
await storageAction(argsArray[0], options as unknown as StorageOptions); await storageAction(argsArray[0], options as unknown as StorageOptions);
break; break;
default: case 'test-parse':
console.log(chalk.bold.cyan('\n CCW CLI Tool Executor\n')); // Test endpoint to debug multi-line prompt parsing
console.log(' Unified interface for Gemini, Qwen, and Codex CLI tools.\n'); testParseAction(argsArray, options as CliExecOptions);
console.log(' Subcommands:'); break;
console.log(chalk.gray(' status Check CLI tools availability'));
console.log(chalk.gray(' storage [cmd] Manage CCW storage (info/clean/config)')); default: {
console.log(chalk.gray(' exec <prompt> Execute a CLI tool')); const execOptions = options as CliExecOptions;
console.log(chalk.gray(' history Show execution history')); // Auto-exec if: has -p/--prompt, has --stdin, has --resume, or subcommand looks like a prompt
console.log(chalk.gray(' detail <id> Show execution detail')); const hasPromptOption = !!execOptions.prompt;
console.log(); const hasStdin = !!execOptions.stdin;
console.log(' Exec Options:'); const hasResume = execOptions.resume !== undefined;
console.log(chalk.gray(' --tool <tool> Tool to use: gemini, qwen, codex (default: gemini)')); const subcommandIsPrompt = subcommand && !subcommand.startsWith('-');
console.log(chalk.gray(' --mode <mode> Mode: analysis, write, auto (default: analysis)'));
console.log(chalk.gray(' --model <model> Model override')); if (hasPromptOption || hasStdin || hasResume || subcommandIsPrompt) {
console.log(chalk.gray(' --cd <path> Working directory')); // Treat as exec: use subcommand as positional prompt if no -p option
console.log(chalk.gray(' --includeDirs <dirs> Additional directories (comma-separated)')); const positionalPrompt = subcommandIsPrompt ? subcommand : undefined;
console.log(chalk.gray(' → gemini/qwen: --include-directories')); await execAction(positionalPrompt, execOptions);
console.log(chalk.gray(' → codex: --add-dir')); } else {
console.log(chalk.gray(' --timeout <ms> Timeout in milliseconds (default: 300000)')); // Show help
console.log(chalk.gray(' --no-stream Disable streaming output')); console.log(chalk.bold.cyan('\n CCW CLI Tool Executor\n'));
console.log(chalk.gray(' --resume [id] Resume previous session (empty=last, or execution ID)')); console.log(' Unified interface for Gemini, Qwen, and Codex CLI tools.\n');
console.log(chalk.gray(' --id <id> Custom execution ID (e.g., IMPL-001-step1)')); console.log(' Usage:');
console.log(); console.log(chalk.gray(' ccw cli -p "<prompt>" --tool <tool> Direct execution (recommended)'));
console.log(' History Options:'); console.log(chalk.gray(' ccw cli "<prompt>" --tool <tool> Shorthand'));
console.log(chalk.gray(' --limit <n> Number of results (default: 20)')); console.log(chalk.gray(' ccw cli exec "<prompt>" --tool <tool> Explicit exec'));
console.log(chalk.gray(' --tool <tool> Filter by tool')); console.log();
console.log(chalk.gray(' --status <status> Filter by status')); console.log(' Subcommands:');
console.log(); console.log(chalk.gray(' status Check CLI tools availability'));
console.log(' Examples:'); console.log(chalk.gray(' storage [cmd] Manage CCW storage (info/clean/config)'));
console.log(chalk.gray(' ccw cli status')); console.log(chalk.gray(' exec <prompt> Execute a CLI tool (optional, default behavior)'));
console.log(chalk.gray(' ccw cli exec "Analyze the auth module" --tool gemini')); console.log(chalk.gray(' history Show execution history'));
console.log(chalk.gray(' ccw cli exec "Analyze with context" --tool gemini --includeDirs ../shared,../types')); console.log(chalk.gray(' detail <id> Show execution detail'));
console.log(chalk.gray(' ccw cli exec "Implement feature" --tool codex --mode auto --includeDirs ./lib')); console.log(chalk.gray(' test-parse [args] Debug CLI argument parsing'));
console.log(chalk.gray(' ccw cli exec "Continue analysis" --resume # Resume last session')); console.log();
console.log(chalk.gray(' ccw cli exec "Continue..." --resume <id> --tool gemini # Resume specific session')); console.log(' Exec Options:');
console.log(chalk.gray(' ccw cli history --tool gemini --limit 10')); console.log(chalk.gray(' -p, --prompt <text> Prompt text (preferred for multi-line)'));
console.log(); console.log(chalk.gray(' -f, --file <file> Read prompt from file'));
console.log(chalk.gray(' --stdin Read prompt from stdin'));
console.log(chalk.gray(' --tool <tool> Tool to use: gemini, qwen, codex (default: gemini)'));
console.log(chalk.gray(' --mode <mode> Mode: analysis, write, auto (default: analysis)'));
console.log(chalk.gray(' --model <model> Model override'));
console.log(chalk.gray(' --cd <path> Working directory'));
console.log(chalk.gray(' --includeDirs <dirs> Additional directories (comma-separated)'));
console.log(chalk.gray(' ccw cli -ps> Timeout in milliseconds (default: 300000)'));
console.log(chalk.gray(' --no-stream Disable streaming output'));
console.log(chalk.gray(' --resume [id] Resume previous session'));
console.log(chalk.gray(' --id <id> Custom execution ID'));
console.log();
console.log(' Examples:');
console.log(chalk.gray(' ccw cli -p "Analyze auth module" --tool gemini'));
console.log(chalk.gray(' ccw cli "Simple prompt" --tool codex --mode write'));
console.log(chalk.gray(' ccw cli -p "$(cat prompt.txt)" --tool gemini'));
console.log(chalk.gray(' ccw cli --resume --tool gemini'));
console.log(chalk.gray(' ccw cli history --tool gemini --limit 10'));
console.log();
}
}
} }
} }

View File

@@ -68,7 +68,8 @@ const MODULE_CSS_FILES = [
'13-claude-manager.css', '13-claude-manager.css',
'14-graph-explorer.css', '14-graph-explorer.css',
'15-mcp-manager.css', '15-mcp-manager.css',
'16-help.css' '16-help.css',
'17-core-memory.css'
]; ];
// Modular JS files in dependency order // Modular JS files in dependency order
@@ -82,41 +83,45 @@ const MODULE_FILES = [
'components/modals.js', 'components/modals.js',
'components/navigation.js', 'components/navigation.js',
'components/sidebar.js', 'components/sidebar.js',
'components/tabs-context.js',
'components/tabs-other.js',
'components/task-drawer-core.js',
'components/task-drawer-renderers.js',
'components/flowchart.js',
'components/carousel.js', 'components/carousel.js',
'components/notifications.js', 'components/notifications.js',
'components/global-notifications.js', 'components/global-notifications.js',
'components/version-check.js', 'components/task-queue-sidebar.js',
'components/mcp-manager.js',
'components/hook-manager.js',
'components/cli-status.js', 'components/cli-status.js',
'components/cli-history.js', 'components/cli-history.js',
'components/mcp-manager.js',
'components/hook-manager.js',
'components/version-check.js',
'components/storage-manager.js', 'components/storage-manager.js',
'components/index-manager.js',
'components/_exp_helpers.js', 'components/_exp_helpers.js',
'components/tabs-other.js',
'components/tabs-context.js',
'components/_conflict_tab.js', 'components/_conflict_tab.js',
'components/_review_tab.js', 'components/_review_tab.js',
'components/task-drawer-core.js',
'components/task-drawer-renderers.js',
'components/task-queue-sidebar.js',
'components/flowchart.js',
'views/home.js', 'views/home.js',
'views/project-overview.js', 'views/project-overview.js',
'views/session-detail.js', 'views/session-detail.js',
'views/review-session.js', 'views/review-session.js',
'views/lite-tasks.js', 'views/lite-tasks.js',
'views/fix-session.js', 'views/fix-session.js',
'views/cli-manager.js',
'views/codexlens-manager.js',
'views/explorer.js',
'views/mcp-manager.js', 'views/mcp-manager.js',
'views/hook-manager.js', 'views/hook-manager.js',
'views/cli-manager.js',
'views/history.js', 'views/history.js',
'views/explorer.js', 'views/graph-explorer.js',
'views/memory.js', 'views/memory.js',
'views/core-memory.js',
'views/core-memory-graph.js',
'views/prompt-history.js', 'views/prompt-history.js',
'views/skills-manager.js', 'views/skills-manager.js',
'views/rules-manager.js', 'views/rules-manager.js',
'views/claude-manager.js', 'views/claude-manager.js',
'views/graph-explorer.js',
'views/help.js', 'views/help.js',
'main.js' 'main.js'
]; ];

View File

@@ -138,7 +138,11 @@ function initNavigation() {
} else if (currentView === 'help') { } else if (currentView === 'help') {
renderHelpView(); renderHelpView();
} else if (currentView === 'core-memory') { } else if (currentView === 'core-memory') {
renderCoreMemoryView(); if (typeof renderCoreMemoryView === 'function') {
renderCoreMemoryView();
} else {
console.error('renderCoreMemoryView not defined - please refresh the page');
}
} }
}); });
}); });

View File

@@ -208,7 +208,7 @@ function handleNotification(data) {
break; break;
case 'cli_execution': case 'cli_execution':
// Handle CLI command notifications (ccw cli exec) // Handle CLI command notifications (ccw cli -p)
handleCliCommandNotification(payload); handleCliCommandNotification(payload);
break; break;
@@ -500,7 +500,7 @@ function handleToolExecutionNotification(payload) {
} }
/** /**
* Handle CLI command notifications (ccw cli exec) * Handle CLI command notifications (ccw cli -p)
* @param {Object} payload - CLI execution payload * @param {Object} payload - CLI execution payload
*/ */
function handleCliCommandNotification(payload) { function handleCliCommandNotification(payload) {

View File

@@ -67,9 +67,9 @@ var helpI18n = {
'help.workflows.brainstorm.next': '进入规划阶段', 'help.workflows.brainstorm.next': '进入规划阶段',
// Workflow Steps - CLI Resume // Workflow Steps - CLI Resume
'help.workflows.cliResume.firstExec': 'ccw cli exec "分析..."', 'help.workflows.cliResume.firstExec': 'ccw cli -p "分析..."',
'help.workflows.cliResume.saveContext': '保存会话上下文', 'help.workflows.cliResume.saveContext': '保存会话上下文',
'help.workflows.cliResume.resumeCmd': 'ccw cli exec --resume', 'help.workflows.cliResume.resumeCmd': 'ccw cli -p --resume',
'help.workflows.cliResume.merge': '合并历史对话', 'help.workflows.cliResume.merge': '合并历史对话',
'help.workflows.cliResume.continue': '继续执行任务', 'help.workflows.cliResume.continue': '继续执行任务',
'help.workflows.cliResume.splitOutput': '拆分结果存储', 'help.workflows.cliResume.splitOutput': '拆分结果存储',
@@ -188,9 +188,9 @@ var helpI18n = {
'help.workflows.brainstorm.next': 'Enter Planning Phase', 'help.workflows.brainstorm.next': 'Enter Planning Phase',
// Workflow Steps - CLI Resume // Workflow Steps - CLI Resume
'help.workflows.cliResume.firstExec': 'ccw cli exec "analyze..."', 'help.workflows.cliResume.firstExec': 'ccw cli -p "analyze..."',
'help.workflows.cliResume.saveContext': 'Save Session Context', 'help.workflows.cliResume.saveContext': 'Save Session Context',
'help.workflows.cliResume.resumeCmd': 'ccw cli exec --resume', 'help.workflows.cliResume.resumeCmd': 'ccw cli -p --resume',
'help.workflows.cliResume.merge': 'Merge Conversation History', 'help.workflows.cliResume.merge': 'Merge Conversation History',
'help.workflows.cliResume.continue': 'Continue Execution', 'help.workflows.cliResume.continue': 'Continue Execution',
'help.workflows.cliResume.splitOutput': 'Split & Store Results', 'help.workflows.cliResume.splitOutput': 'Split & Store Results',

View File

@@ -87,7 +87,7 @@ function renderKnowledgeGraphD3(graph) {
})); }));
// Create SVG with zoom support // Create SVG with zoom support
graphSvg = d3.select('#knowledgeGraphContainer') coreMemGraphSvg = d3.select('#knowledgeGraphContainer')
.append('svg') .append('svg')
.attr('width', width) .attr('width', width)
.attr('height', height) .attr('height', height)
@@ -95,19 +95,19 @@ function renderKnowledgeGraphD3(graph) {
.attr('viewBox', [0, 0, width, height]); .attr('viewBox', [0, 0, width, height]);
// Create a group for zoom/pan transformations // Create a group for zoom/pan transformations
graphGroup = graphSvg.append('g').attr('class', 'graph-content'); coreMemGraphGroup = coreMemGraphSvg.append('g').attr('class', 'graph-content');
// Setup zoom behavior // Setup zoom behavior
graphZoom = d3.zoom() coreMemGraphZoom = d3.zoom()
.scaleExtent([0.1, 4]) .scaleExtent([0.1, 4])
.on('zoom', (event) => { .on('zoom', (event) => {
graphGroup.attr('transform', event.transform); coreMemGraphGroup.attr('transform', event.transform);
}); });
graphSvg.call(graphZoom); coreMemGraphSvg.call(coreMemGraphZoom);
// Add arrowhead marker // Add arrowhead marker
graphSvg.append('defs').append('marker') coreMemGraphSvg.append('defs').append('marker')
.attr('id', 'arrowhead-core') .attr('id', 'arrowhead-core')
.attr('viewBox', '-0 -5 10 10') .attr('viewBox', '-0 -5 10 10')
.attr('refX', 20) .attr('refX', 20)
@@ -122,7 +122,7 @@ function renderKnowledgeGraphD3(graph) {
.style('stroke', 'none'); .style('stroke', 'none');
// Create force simulation // Create force simulation
graphSimulation = d3.forceSimulation(nodes) coreMemGraphSimulation = d3.forceSimulation(nodes)
.force('link', d3.forceLink(edges).id(d => d.id).distance(100)) .force('link', d3.forceLink(edges).id(d => d.id).distance(100))
.force('charge', d3.forceManyBody().strength(-300)) .force('charge', d3.forceManyBody().strength(-300))
.force('center', d3.forceCenter(width / 2, height / 2)) .force('center', d3.forceCenter(width / 2, height / 2))
@@ -131,7 +131,7 @@ function renderKnowledgeGraphD3(graph) {
.force('y', d3.forceY(height / 2).strength(0.05)); .force('y', d3.forceY(height / 2).strength(0.05));
// Draw edges // Draw edges
const link = graphGroup.append('g') const link = coreMemGraphGroup.append('g')
.attr('class', 'graph-links') .attr('class', 'graph-links')
.selectAll('line') .selectAll('line')
.data(edges) .data(edges)
@@ -143,7 +143,7 @@ function renderKnowledgeGraphD3(graph) {
.attr('marker-end', 'url(#arrowhead-core)'); .attr('marker-end', 'url(#arrowhead-core)');
// Draw nodes // Draw nodes
const node = graphGroup.append('g') const node = coreMemGraphGroup.append('g')
.attr('class', 'graph-nodes') .attr('class', 'graph-nodes')
.selectAll('g') .selectAll('g')
.data(nodes) .data(nodes)
@@ -183,7 +183,7 @@ function renderKnowledgeGraphD3(graph) {
.attr('fill', '#333'); .attr('fill', '#333');
// Update positions on simulation tick // Update positions on simulation tick
graphSimulation.on('tick', () => { coreMemGraphSimulation.on('tick', () => {
link link
.attr('x1', d => d.source.x) .attr('x1', d => d.source.x)
.attr('y1', d => d.source.y) .attr('y1', d => d.source.y)
@@ -195,7 +195,7 @@ function renderKnowledgeGraphD3(graph) {
// Drag functions // Drag functions
function dragstarted(event, d) { function dragstarted(event, d) {
if (!event.active) graphSimulation.alphaTarget(0.3).restart(); if (!event.active) coreMemGraphSimulation.alphaTarget(0.3).restart();
d.fx = d.x; d.fx = d.x;
d.fy = d.y; d.fy = d.y;
} }
@@ -206,7 +206,7 @@ function renderKnowledgeGraphD3(graph) {
} }
function dragended(event, d) { function dragended(event, d) {
if (!event.active) graphSimulation.alphaTarget(0); if (!event.active) coreMemGraphSimulation.alphaTarget(0);
d.fx = null; d.fx = null;
d.fy = null; d.fy = null;
} }

View File

@@ -1,15 +1,15 @@
// Core Memory View // Core Memory View
// Manages strategic context entries with knowledge graph and evolution tracking // Manages strategic context entries with knowledge graph and evolution tracking
// State for visualization // State for visualization (prefixed to avoid collision with memory.js)
let graphSvg = null; var coreMemGraphSvg = null;
let graphGroup = null; var coreMemGraphGroup = null;
let graphZoom = null; var coreMemGraphZoom = null;
let graphSimulation = null; var coreMemGraphSimulation = null;
async function renderCoreMemoryView() { async function renderCoreMemoryView() {
const content = document.getElementById('content'); const content = document.getElementById('content');
hideStatsAndSearch(); hideStatsAndCarousel();
// Fetch core memories // Fetch core memories
const archived = false; const archived = false;
@@ -214,7 +214,8 @@ async function fetchCoreMemories(archived = false) {
try { try {
const response = await fetch(`/api/core-memory/memories?path=${encodeURIComponent(projectPath)}&archived=${archived}`); const response = await fetch(`/api/core-memory/memories?path=${encodeURIComponent(projectPath)}&archived=${archived}`);
if (!response.ok) throw new Error(`HTTP ${response.status}`); if (!response.ok) throw new Error(`HTTP ${response.status}`);
return await response.json(); const data = await response.json();
return data.memories || [];
} catch (error) { } catch (error) {
console.error('Failed to fetch core memories:', error); console.error('Failed to fetch core memories:', error);
showNotification(t('coreMemory.fetchError'), 'error'); showNotification(t('coreMemory.fetchError'), 'error');
@@ -226,7 +227,8 @@ async function fetchMemoryById(memoryId) {
try { try {
const response = await fetch(`/api/core-memory/memories/${memoryId}?path=${encodeURIComponent(projectPath)}`); const response = await fetch(`/api/core-memory/memories/${memoryId}?path=${encodeURIComponent(projectPath)}`);
if (!response.ok) throw new Error(`HTTP ${response.status}`); if (!response.ok) throw new Error(`HTTP ${response.status}`);
return await response.json(); const data = await response.json();
return data.memory || null;
} catch (error) { } catch (error) {
console.error('Failed to fetch memory:', error); console.error('Failed to fetch memory:', error);
showNotification(t('coreMemory.fetchError'), 'error'); showNotification(t('coreMemory.fetchError'), 'error');

View File

@@ -7,6 +7,7 @@ const CCW_MCP_TOOLS = [
{ name: 'write_file', desc: 'Write/create files', core: true }, { name: 'write_file', desc: 'Write/create files', core: true },
{ name: 'edit_file', desc: 'Edit/replace content', core: true }, { name: 'edit_file', desc: 'Edit/replace content', core: true },
{ name: 'smart_search', desc: 'Hybrid search (regex + semantic)', core: true }, { name: 'smart_search', desc: 'Hybrid search (regex + semantic)', core: true },
{ name: 'core_memory', desc: 'Core memory management', core: true },
// Optional tools // Optional tools
{ name: 'session_manager', desc: 'Workflow sessions', core: false }, { name: 'session_manager', desc: 'Workflow sessions', core: false },
{ name: 'generate_module_docs', desc: 'Generate docs', core: false }, { name: 'generate_module_docs', desc: 'Generate docs', core: false },

View File

@@ -11,7 +11,7 @@ import { StoragePaths, ensureStorageDir } from '../config/storage-paths.js';
export interface CliToolConfig { export interface CliToolConfig {
enabled: boolean; enabled: boolean;
primaryModel: string; // For CLI endpoint calls (ccw cli exec) primaryModel: string; // For CLI endpoint calls (ccw cli -p)
secondaryModel: string; // For internal calls (llm_enhancer, generate_module_docs) secondaryModel: string; // For internal calls (llm_enhancer, generate_module_docs)
} }

View File

@@ -319,8 +319,9 @@ function buildCommand(params: {
break; break;
case 'codex': case 'codex':
// Codex does NOT support stdin - prompt must be passed as command line argument // Codex supports stdin when using `-` as prompt argument
useStdin = false; // Using stdin avoids Windows command line escaping issues with multi-line/special char prompts
useStdin = true;
// Native resume: codex resume <uuid> [prompt] or --last // Native resume: codex resume <uuid> [prompt] or --last
if (nativeResume?.enabled) { if (nativeResume?.enabled) {
args.push('resume'); args.push('resume');
@@ -333,8 +334,13 @@ function buildCommand(params: {
if (dir) { if (dir) {
args.push('-C', dir); args.push('-C', dir);
} }
// Permission configuration based on mode:
// - analysis: --full-auto (read-only sandbox, no prompts) - safer for read operations
// - write/auto: --dangerously-bypass-approvals-and-sandbox (full access for modifications)
if (mode === 'write' || mode === 'auto') { if (mode === 'write' || mode === 'auto') {
args.push('--skip-git-repo-check', '-s', 'danger-full-access'); args.push('--dangerously-bypass-approvals-and-sandbox');
} else {
args.push('--full-auto');
} }
if (model) { if (model) {
args.push('-m', model); args.push('-m', model);
@@ -345,19 +351,21 @@ function buildCommand(params: {
args.push('--add-dir', addDir); args.push('--add-dir', addDir);
} }
} }
// Add prompt as positional argument for resume // Use `-` to indicate reading prompt from stdin
if (prompt) { args.push('-');
args.push(prompt);
}
} else { } else {
// Standard exec mode // Standard exec mode
args.push('exec'); args.push('exec');
if (dir) { if (dir) {
args.push('-C', dir); args.push('-C', dir);
} }
args.push('--full-auto'); // Permission configuration based on mode:
// - analysis: --full-auto (read-only sandbox, no prompts) - safer for read operations
// - write/auto: --dangerously-bypass-approvals-and-sandbox (full access for modifications)
if (mode === 'write' || mode === 'auto') { if (mode === 'write' || mode === 'auto') {
args.push('--skip-git-repo-check', '-s', 'danger-full-access'); args.push('--dangerously-bypass-approvals-and-sandbox');
} else {
args.push('--full-auto');
} }
if (model) { if (model) {
args.push('-m', model); args.push('-m', model);
@@ -368,10 +376,8 @@ function buildCommand(params: {
args.push('--add-dir', addDir); args.push('--add-dir', addDir);
} }
} }
// Add prompt as positional argument (codex exec "prompt") // Use `-` to indicate reading prompt from stdin (avoids Windows escaping issues)
if (prompt) { args.push('-');
args.push(prompt);
}
} }
break; break;
@@ -734,8 +740,8 @@ async function executeCliTool(
} }
} }
// Only pass model if explicitly provided - let CLI tools use their own defaults // Use configured primary model if no explicit model provided
const effectiveModel = model; const effectiveModel = model || getPrimaryModel(workingDir, tool);
// Build command // Build command
const { command, args, useStdin } = buildCommand({ const { command, args, useStdin } = buildCommand({

View File

@@ -16,4 +16,4 @@ Got it. I'm ready for your first command.
✓ Completed in 16.1s ✓ Completed in 16.1s
ID: 1765691168543-gemini ID: 1765691168543-gemini
Continue: ccw cli exec "..." --resume 1765691168543-gemini Continue: ccw cli -p "..." --resume 1765691168543-gemini

View File

@@ -17,6 +17,6 @@ Setup complete. I am ready for your first command.
✓ Completed in 19.6s ✓ Completed in 19.6s
ID: 1765690404300-gemini ID: 1765690404300-gemini
Continue: ccw cli exec "..." --resume 1765690404300-gemini Continue: ccw cli -p "..." --resume 1765690404300-gemini
=== STDERR === === STDERR ===

View File

@@ -16,4 +16,4 @@ Setup complete. I am ready for your first command.
✓ Completed in 16.0s ✓ Completed in 16.0s
ID: 1765690668720-gemini ID: 1765690668720-gemini
Continue: ccw cli exec "..." --resume 1765690668720-gemini Continue: ccw cli -p "..." --resume 1765690668720-gemini