claude-code-workflow 6.3.48 → 6.3.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/.claude/CLAUDE.md +6 -8
  2. package/.claude/agents/action-planning-agent.md +28 -45
  3. package/.claude/agents/cli-lite-planning-agent.md +93 -1
  4. package/.claude/agents/code-developer.md +144 -27
  5. package/.claude/commands/ccw-coordinator.md +175 -21
  6. package/.claude/commands/ccw-debug.md +832 -0
  7. package/.claude/commands/ccw.md +90 -9
  8. package/.claude/commands/cli/cli-init.md +1 -0
  9. package/.claude/commands/issue/convert-to-plan.md +718 -0
  10. package/.claude/commands/issue/from-brainstorm.md +382 -0
  11. package/.claude/commands/issue/new.md +1 -2
  12. package/.claude/commands/memory/tips.md +332 -0
  13. package/.claude/commands/workflow/analyze-with-file.md +804 -0
  14. package/.claude/commands/workflow/brainstorm/auto-parallel.md +18 -43
  15. package/.claude/commands/workflow/brainstorm/role-analysis.md +705 -0
  16. package/.claude/commands/workflow/brainstorm-with-file.md +1153 -0
  17. package/.claude/commands/workflow/debug-with-file.md +7 -5
  18. package/.claude/commands/workflow/execute.md +6 -4
  19. package/.claude/commands/workflow/lite-plan.md +2 -2
  20. package/.claude/commands/workflow/plan-verify.md +162 -327
  21. package/.claude/commands/workflow/plan.md +162 -26
  22. package/.claude/commands/workflow/replan.md +78 -2
  23. package/.claude/commands/workflow/{review-fix.md → review-cycle-fix.md} +6 -6
  24. package/.claude/commands/workflow/review-module-cycle.md +2 -2
  25. package/.claude/commands/workflow/review-session-cycle.md +2 -2
  26. package/.claude/commands/workflow/tools/conflict-resolution.md +16 -26
  27. package/.claude/commands/workflow/tools/context-gather.md +81 -118
  28. package/.claude/commands/workflow/tools/task-generate-agent.md +94 -10
  29. package/.claude/skills/ccw-help/command.json +4 -4
  30. package/.claude/skills/lite-skill-generator/SKILL.md +650 -0
  31. package/.claude/skills/lite-skill-generator/templates/simple-skill.md +68 -0
  32. package/.claude/skills/lite-skill-generator/templates/style-guide.md +64 -0
  33. package/.claude/skills/skill-generator/SKILL.md +277 -85
  34. package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +4 -15
  35. package/.claude/skills/skill-generator/phases/02-structure-generation.md +72 -17
  36. package/.claude/skills/skill-generator/phases/03-phase-generation.md +218 -51
  37. package/.claude/skills/skill-generator/phases/04-specs-templates.md +111 -41
  38. package/.claude/skills/skill-generator/phases/05-validation.md +139 -56
  39. package/.claude/skills/skill-generator/templates/autonomous-action.md +78 -268
  40. package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +14 -0
  41. package/.claude/skills/skill-generator/templates/code-analysis-action.md +12 -0
  42. package/.claude/skills/skill-generator/templates/llm-action.md +12 -0
  43. package/.claude/skills/skill-generator/templates/script-template.md +368 -0
  44. package/.claude/skills/skill-generator/templates/sequential-phase.md +14 -0
  45. package/.claude/skills/skill-generator/templates/skill-md.md +14 -0
  46. package/.claude/skills/skill-tuning/SKILL.md +130 -266
  47. package/.claude/skills/skill-tuning/phases/orchestrator.md +95 -283
  48. package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +90 -198
  49. package/.claude/skills/skill-tuning/specs/tuning-strategies.md +193 -1345
  50. package/.claude/workflows/cli-templates/schemas/plan-verify-agent-schema.json +47 -0
  51. package/.claude/workflows/cli-templates/schemas/verify-json-schema.json +158 -0
  52. package/.claude/workflows/cli-tools-usage.md +1 -1
  53. package/.codex/AGENTS.md +1 -3
  54. package/.codex/prompts/analyze-with-file.md +610 -0
  55. package/.codex/prompts/brainstorm-to-cycle.md +456 -0
  56. package/.codex/prompts/brainstorm-with-file.md +937 -0
  57. package/.codex/prompts/clean.md +7 -2
  58. package/.codex/prompts/compact.md +5 -3
  59. package/.codex/prompts/debug-with-file.md +21 -22
  60. package/.codex/prompts/execute.md +6 -2
  61. package/.codex/prompts/issue-execute.md +10 -2
  62. package/.codex/prompts/issue-new.md +390 -285
  63. package/.codex/prompts/lite-execute.md +8 -7
  64. package/.codex/prompts/lite-fix.md +6 -2
  65. package/.codex/prompts/lite-plan-a.md +6 -2
  66. package/.codex/prompts/lite-plan-b.md +6 -2
  67. package/.codex/prompts/lite-plan-c.md +6 -2
  68. package/.codex/skills/ccw-cli-tools/SKILL.md +559 -0
  69. package/ccw/dist/cli.d.ts.map +1 -1
  70. package/ccw/dist/cli.js +1 -0
  71. package/ccw/dist/cli.js.map +1 -1
  72. package/ccw/dist/commands/cli.d.ts +1 -0
  73. package/ccw/dist/commands/cli.d.ts.map +1 -1
  74. package/ccw/dist/commands/cli.js +80 -9
  75. package/ccw/dist/commands/cli.js.map +1 -1
  76. package/ccw/dist/commands/issue.d.ts +2 -0
  77. package/ccw/dist/commands/issue.d.ts.map +1 -1
  78. package/ccw/dist/commands/issue.js +62 -20
  79. package/ccw/dist/commands/issue.js.map +1 -1
  80. package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
  81. package/ccw/dist/config/litellm-api-config-manager.js +5 -3
  82. package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
  83. package/ccw/dist/config/litellm-provider-models.d.ts +73 -0
  84. package/ccw/dist/config/litellm-provider-models.d.ts.map +1 -0
  85. package/ccw/dist/config/litellm-provider-models.js +172 -0
  86. package/ccw/dist/config/litellm-provider-models.js.map +1 -0
  87. package/ccw/dist/config/provider-models.d.ts +25 -51
  88. package/ccw/dist/config/provider-models.d.ts.map +1 -1
  89. package/ccw/dist/config/provider-models.js +84 -149
  90. package/ccw/dist/config/provider-models.js.map +1 -1
  91. package/ccw/dist/config/storage-paths.d.ts.map +1 -1
  92. package/ccw/dist/config/storage-paths.js +23 -5
  93. package/ccw/dist/config/storage-paths.js.map +1 -1
  94. package/ccw/dist/core/auth/csrf-middleware.js +3 -3
  95. package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
  96. package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
  97. package/ccw/dist/core/dashboard-generator.js +3 -1
  98. package/ccw/dist/core/dashboard-generator.js.map +1 -1
  99. package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -1
  100. package/ccw/dist/core/routes/claude-routes.js +206 -14
  101. package/ccw/dist/core/routes/claude-routes.js.map +1 -1
  102. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  103. package/ccw/dist/core/routes/cli-routes.js +16 -1
  104. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  105. package/ccw/dist/core/routes/commands-routes.d.ts +7 -0
  106. package/ccw/dist/core/routes/commands-routes.d.ts.map +1 -0
  107. package/ccw/dist/core/routes/commands-routes.js +480 -0
  108. package/ccw/dist/core/routes/commands-routes.js.map +1 -0
  109. package/ccw/dist/core/routes/model-routes.d.ts +11 -0
  110. package/ccw/dist/core/routes/model-routes.d.ts.map +1 -0
  111. package/ccw/dist/core/routes/model-routes.js +112 -0
  112. package/ccw/dist/core/routes/model-routes.js.map +1 -0
  113. package/ccw/dist/core/routes/nav-status-routes.d.ts.map +1 -1
  114. package/ccw/dist/core/routes/nav-status-routes.js +84 -1
  115. package/ccw/dist/core/routes/nav-status-routes.js.map +1 -1
  116. package/ccw/dist/core/routes/provider-routes.d.ts +11 -0
  117. package/ccw/dist/core/routes/provider-routes.d.ts.map +1 -0
  118. package/ccw/dist/core/routes/provider-routes.js +67 -0
  119. package/ccw/dist/core/routes/provider-routes.js.map +1 -0
  120. package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -1
  121. package/ccw/dist/core/routes/skills-routes.js +219 -7
  122. package/ccw/dist/core/routes/skills-routes.js.map +1 -1
  123. package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
  124. package/ccw/dist/core/routes/system-routes.js +58 -6
  125. package/ccw/dist/core/routes/system-routes.js.map +1 -1
  126. package/ccw/dist/core/server.d.ts.map +1 -1
  127. package/ccw/dist/core/server.js +13 -0
  128. package/ccw/dist/core/server.js.map +1 -1
  129. package/ccw/dist/mcp-server/index.js +2 -2
  130. package/ccw/dist/mcp-server/index.js.map +1 -1
  131. package/ccw/dist/tools/claude-cli-tools.d.ts +48 -11
  132. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  133. package/ccw/dist/tools/claude-cli-tools.js +146 -50
  134. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  135. package/ccw/dist/tools/cli-config-manager.d.ts +1 -13
  136. package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
  137. package/ccw/dist/tools/cli-config-manager.js +3 -27
  138. package/ccw/dist/tools/cli-config-manager.js.map +1 -1
  139. package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
  140. package/ccw/dist/tools/cli-executor-core.js +7 -2
  141. package/ccw/dist/tools/cli-executor-core.js.map +1 -1
  142. package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -1
  143. package/ccw/dist/tools/cli-history-store.d.ts +11 -0
  144. package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
  145. package/ccw/dist/tools/cli-history-store.js +82 -2
  146. package/ccw/dist/tools/cli-history-store.js.map +1 -1
  147. package/ccw/dist/tools/command-registry.d.ts +7 -0
  148. package/ccw/dist/tools/command-registry.d.ts.map +1 -1
  149. package/ccw/dist/tools/command-registry.js +14 -1
  150. package/ccw/dist/tools/command-registry.js.map +1 -1
  151. package/ccw/dist/tools/generate-module-docs.d.ts.map +1 -1
  152. package/ccw/dist/tools/generate-module-docs.js +11 -7
  153. package/ccw/dist/tools/generate-module-docs.js.map +1 -1
  154. package/ccw/dist/tools/litellm-executor.d.ts +1 -0
  155. package/ccw/dist/tools/litellm-executor.d.ts.map +1 -1
  156. package/ccw/dist/tools/litellm-executor.js +11 -9
  157. package/ccw/dist/tools/litellm-executor.js.map +1 -1
  158. package/ccw/dist/types/skill-types.d.ts +97 -0
  159. package/ccw/dist/types/skill-types.d.ts.map +1 -0
  160. package/ccw/dist/types/skill-types.js +6 -0
  161. package/ccw/dist/types/skill-types.js.map +1 -0
  162. package/ccw/src/cli.ts +1 -0
  163. package/ccw/src/commands/cli.ts +87 -9
  164. package/ccw/src/commands/issue.ts +81 -26
  165. package/ccw/src/config/litellm-api-config-manager.ts +5 -3
  166. package/ccw/src/config/litellm-provider-models.ts +222 -0
  167. package/ccw/src/config/provider-models.ts +91 -190
  168. package/ccw/src/config/storage-paths.ts +20 -5
  169. package/ccw/src/core/auth/csrf-middleware.ts +3 -3
  170. package/ccw/src/core/dashboard-generator.ts +3 -1
  171. package/ccw/src/core/routes/claude-routes.ts +233 -15
  172. package/ccw/src/core/routes/cli-routes.ts +18 -4
  173. package/ccw/src/core/routes/commands-routes.ts +620 -0
  174. package/ccw/src/core/routes/nav-status-routes.ts +95 -1
  175. package/ccw/src/core/routes/provider-routes.ts +78 -0
  176. package/ccw/src/core/routes/skills-routes.ts +266 -45
  177. package/ccw/src/core/routes/system-routes.ts +102 -50
  178. package/ccw/src/core/server.ts +13 -0
  179. package/ccw/src/mcp-server/index.ts +2 -2
  180. package/ccw/src/templates/dashboard-css/18-cli-settings.css +35 -0
  181. package/ccw/src/templates/dashboard-css/37-commands.css +193 -0
  182. package/ccw/src/templates/dashboard-js/components/navigation.js +4 -0
  183. package/ccw/src/templates/dashboard-js/i18n.js +116 -0
  184. package/ccw/src/templates/dashboard-js/views/cli-manager.js +249 -4
  185. package/ccw/src/templates/dashboard-js/views/commands-manager.js +503 -0
  186. package/ccw/src/templates/dashboard-js/views/issue-manager.js +7 -7
  187. package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2 -7
  188. package/ccw/src/templates/dashboard-js/views/skills-manager.js +164 -23
  189. package/ccw/src/templates/dashboard.html +7 -0
  190. package/ccw/src/tools/claude-cli-tools.ts +170 -56
  191. package/ccw/src/tools/cli-config-manager.ts +2 -33
  192. package/ccw/src/tools/cli-executor-core.ts +8 -2
  193. package/ccw/src/tools/cli-history-store.ts +92 -2
  194. package/ccw/src/tools/command-registry.ts +16 -1
  195. package/ccw/src/tools/generate-module-docs.ts +11 -7
  196. package/ccw/src/tools/litellm-executor.ts +13 -9
  197. package/ccw/src/types/skill-types.ts +99 -0
  198. package/package.json +1 -1
  199. package/.claude/commands/enhance-prompt.md +0 -93
  200. package/.claude/commands/memory/code-map-memory.md +0 -687
  201. package/.claude/commands/memory/docs.md +0 -615
  202. package/.claude/commands/memory/load-skill-memory.md +0 -182
  203. package/.claude/commands/memory/skill-memory.md +0 -525
  204. package/.claude/commands/memory/swagger-docs.md +0 -773
  205. package/.claude/commands/memory/tech-research-rules.md +0 -310
  206. package/.claude/commands/memory/workflow-skill-memory.md +0 -517
  207. package/.claude/commands/task/breakdown.md +0 -208
  208. package/.claude/commands/task/create.md +0 -152
  209. package/.claude/commands/task/execute.md +0 -270
  210. package/.claude/commands/task/replan.md +0 -441
  211. package/.claude/commands/version.md +0 -254
  212. package/.claude/commands/workflow/action-plan-verify.md +0 -485
  213. package/.claude/commands/workflow/brainstorm/api-designer.md +0 -587
  214. package/.claude/commands/workflow/brainstorm/data-architect.md +0 -220
  215. package/.claude/commands/workflow/brainstorm/product-manager.md +0 -200
  216. package/.claude/commands/workflow/brainstorm/product-owner.md +0 -200
  217. package/.claude/commands/workflow/brainstorm/scrum-master.md +0 -200
  218. package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +0 -200
  219. package/.claude/commands/workflow/brainstorm/system-architect.md +0 -389
  220. package/.claude/commands/workflow/brainstorm/ui-designer.md +0 -221
  221. package/.claude/commands/workflow/brainstorm/ux-expert.md +0 -221
  222. package/.claude/commands/workflow/debug.md +0 -331
  223. package/.claude/commands/workflow/develop-with-file.md +0 -1044
  224. package/.claude/skills/ccw-loop/README.md +0 -303
  225. package/.claude/skills/skill-generator/templates/script-bash.md +0 -277
  226. package/.claude/skills/skill-generator/templates/script-python.md +0 -198
  227. package/.codex/prompts/debug.md +0 -318
  228. package/ccw/src/core/routes/mcp-routes.ts.backup +0 -549
@@ -1,6 +1,6 @@
1
1
  ---
2
- description: Execute tasks based on in-memory plan, prompt description, or file content (Codex Subagent Version)
3
- argument-hint: "[--in-memory] [\"task description\"|file-path]"
2
+ description: Execute tasks based on in-memory plan, prompt description, or file content with optimized Codex subagent orchestration. Supports multiple input modes and execution control.
3
+ argument-hint: "[--plan=in-memory|<file-path>] [--parallel] [--skip-tests] [--dry-run]"
4
4
  ---
5
5
 
6
6
  # Workflow Lite-Execute Command (Codex Subagent Version)
@@ -28,13 +28,14 @@ Flexible task execution command with **optimized Codex subagent orchestration**.
28
28
  ### Command Syntax
29
29
  ```bash
30
30
  /workflow:lite-execute [FLAGS] <INPUT>
31
+ ```
31
32
 
32
- # Flags
33
- --in-memory Use plan from memory (called by lite-plan)
33
+ ### Flags
34
34
 
35
- # Arguments
36
- <input> Task description string, or path to file (required)
37
- ```
35
+ - `--plan=in-memory|<file-path>`: Input mode (in-memory plan or file path)
36
+ - `--parallel`: Execute tasks in parallel (default: sequential)
37
+ - `--skip-tests`: Skip test execution
38
+ - `--dry-run`: Preview execution without making changes
38
39
 
39
40
  ## Input Modes
40
41
 
@@ -1,6 +1,6 @@
1
1
  ---
2
- description: Lightweight bug diagnosis and fix workflow with optimized Codex subagent patterns (merged mode)
3
- argument-hint: BUG="<bug description or error message>" [HOTFIX="true"]
2
+ description: Lightweight bug diagnosis and fix workflow with optimized Codex subagent patterns. Supports severity and scope control.
3
+ argument-hint: "BUG=\"<description or error message>\" [--hotfix] [--severity=critical|high|medium|low] [--scope=<path>]"
4
4
  ---
5
5
 
6
6
  # Workflow Lite-Fix Command (Codex Optimized Version)
@@ -28,6 +28,10 @@ Intelligent lightweight bug fixing command with **optimized subagent orchestrati
28
28
  **Target bug**: $BUG
29
29
  **Hotfix mode**: $HOTFIX
30
30
 
31
+ - `--hotfix`: Hotfix mode, prioritize speed
32
+ - `--severity`: Bug severity (critical|high|medium|low)
33
+ - `--scope`: Debug scope limit (file path)
34
+
31
35
  ## Execution Modes
32
36
 
33
37
  ### Mode Selection Based on Severity
@@ -1,6 +1,6 @@
1
1
  ---
2
- description: Lightweight interactive planning workflow with single-agent merged mode for explore → clarify → plan full flow
3
- argument-hint: TASK="<task description or file.md path>"
2
+ description: Lightweight interactive planning workflow with single-agent merged mode for explore → clarify → plan full flow. Supports depth control and auto-clarification.
3
+ argument-hint: "TASK=\"<task description or file.md path>\" [--depth=standard|deep] [--auto-clarify] [--max-rounds=<n>] [--verbose]"
4
4
  ---
5
5
 
6
6
  # Workflow Lite-Plan-A (Merged Mode)
@@ -35,6 +35,10 @@ Single-agent merged mode for lightweight planning. One agent handles exploration
35
35
 
36
36
  **Target task**: $TASK
37
37
 
38
+ - `--depth`: Exploration depth (standard|deep)
39
+ - `--auto-clarify`: Auto clarify, skip confirmation
40
+ - `--max-rounds`: Max interaction rounds
41
+
38
42
  ## Execution Process
39
43
 
40
44
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
- description: Lightweight interactive planning workflow with hybrid mode - multi-agent parallel exploration + primary agent merge/clarify/plan
3
- argument-hint: TASK="<task description or file.md path>"
2
+ description: Lightweight interactive planning workflow with hybrid mode - multi-agent parallel exploration + primary agent merge/clarify/plan. Supports agent count and iteration control.
3
+ argument-hint: "TASK=\"<task description or file.md path>\" [--num-agents=<n>] [--max-iterations=<n>] [--angles=role1,role2,...]"
4
4
  ---
5
5
 
6
6
  # Workflow Lite-Plan-B (Hybrid Mode)
@@ -35,6 +35,10 @@ Hybrid mode for complex planning tasks. Multiple agents explore in parallel from
35
35
 
36
36
  **Target task**: $TASK
37
37
 
38
+ - `--num-agents`: Number of parallel agents (default: 4)
39
+ - `--max-iterations`: Max iteration rounds
40
+ - `--angles`: Exploration angles (role1,role2,...)
41
+
38
42
  ## Execution Process
39
43
 
40
44
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
- description: Lightweight interactive planning workflow with Codex subagent orchestration, outputs plan.json after user confirmation
3
- argument-hint: TASK="<task description or file.md path>" [EXPLORE="true"]
2
+ description: Lightweight interactive planning workflow with Codex subagent orchestration, outputs plan.json after user confirmation. Supports depth and exploration control.
3
+ argument-hint: "TASK=\"<description or file.md path>\" [--depth=standard|deep] [--explore] [--auto]"
4
4
  ---
5
5
 
6
6
  # Workflow Lite-Plan Command (Codex Subagent Version)
@@ -22,6 +22,10 @@ Intelligent lightweight planning command with dynamic workflow adaptation based
22
22
  **Target task**: $TASK
23
23
  **Force exploration**: $EXPLORE
24
24
 
25
+ - `--depth`: Exploration depth (standard|deep)
26
+ - `--explore`: Force exploration phase
27
+ - `--auto`: Auto mode, skip confirmation
28
+
25
29
  ## Execution Process
26
30
 
27
31
  ```
@@ -0,0 +1,559 @@
1
+ ---
2
+ name: ccw-cli-tools
3
+ description: CLI tools execution specification (gemini/claude/codex/qwen/opencode) with unified prompt template, mode options, and auto-invoke triggers for code analysis and implementation tasks. Supports configurable CLI endpoints for analysis, write, and review modes.
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # CLI Tools - Unified Execution Framework
8
+
9
+ **Purpose**: Structured CLI tool usage with configuration-driven tool selection, unified prompt templates, and quality-gated execution.
10
+
11
+ **Configuration**: `~/.claude/cli-tools.json` (Global, always read at initialization)
12
+
13
+ ## Initialization (Required First Step)
14
+
15
+ **Before any tool selection or recommendation**:
16
+
17
+ 1. Check if configuration exists in memory:
18
+ - If configuration is already in conversation memory → Use it directly
19
+ - If NOT in memory → Read the configuration file:
20
+ ```bash
21
+ Read(file_path="~/.claude/cli-tools.json")
22
+ ```
23
+
24
+ 2. Parse the JSON to understand:
25
+ - Available tools and their `enabled` status
26
+ - Each tool's `primaryModel` and `secondaryModel`
27
+ - Tags defined for tag-based routing
28
+ - Tool types (builtin, cli-wrapper, api-endpoint)
29
+
30
+ 3. Use configuration throughout the selection process
31
+
32
+ **Why**: Tools, models, and tags may change. Configuration file is the single source of truth.
33
+ **Optimization**: Reuse in-memory configuration to avoid redundant file reads.
34
+
35
+ ## Process Flow
36
+
37
+ ```
38
+ ┌─ USER REQUEST
39
+
40
+ ├─ STEP 1: Load Configuration
41
+ │ ├─ Check if configuration exists in conversation memory
42
+ │ └─ If NOT in memory → Read(file_path="~/.claude/cli-tools.json")
43
+
44
+ ├─ STEP 2: Understand User Intent
45
+ │ ├─ Parse task type (analysis, implementation, security, etc.)
46
+ │ ├─ Extract required capabilities (tags)
47
+ │ └─ Identify scope (files, modules)
48
+
49
+ ├─ STEP 3: Select Tool (based on config)
50
+ │ ├─ Explicit --tool specified?
51
+ │ │ YES → Validate in config → Use it
52
+ │ │ NO → Match tags with enabled tools → Select best match
53
+ │ │ → No match → Use first enabled tool (default)
54
+ │ └─ Get primaryModel from config
55
+
56
+ ├─ STEP 4: Build Prompt
57
+ │ └─ Use 6-field template: PURPOSE, TASK, MODE, CONTEXT, EXPECTED, CONSTRAINTS
58
+
59
+ ├─ STEP 5: Select Rule Template
60
+ │ ├─ Determine rule from task type
61
+ │ └─ Pass via --rule parameter
62
+
63
+ ├─ STEP 6: Execute CLI Command
64
+ │ └─ ccw cli -p "<PROMPT>" --tool <tool> --mode <mode> --rule <rule>
65
+
66
+ └─ STEP 7: Handle Results
67
+ ├─ On success → Deliver output to user
68
+ └─ On failure → Check secondaryModel or fallback tool
69
+ ```
70
+
71
+ ## Configuration Reference
72
+
73
+ ### Configuration File Location
74
+
75
+ **Path**: `~/.claude/cli-tools.json` (Global configuration)
76
+
77
+ **IMPORTANT**: Check conversation memory first. Only read file if configuration is not in memory.
78
+
79
+ ### Reading Configuration
80
+
81
+ **Priority**: Check conversation memory first
82
+
83
+ **Loading Options**:
84
+ - **Option 1** (Preferred): Use in-memory configuration if already loaded in conversation
85
+ - **Option 2** (Fallback): Read from file when not in memory
86
+
87
+ ```bash
88
+ # Read configuration file
89
+ cat ~/.claude/cli-tools.json
90
+ ```
91
+
92
+ The configuration defines all available tools with their enabled status, models, and tags.
93
+
94
+ ### Configuration Structure
95
+
96
+ The JSON file contains a `tools` object where each tool has these fields:
97
+
98
+ | Field | Type | Description | Example |
99
+ |-------|------|-------------|---------|
100
+ | `enabled` | boolean | Tool availability status | `true` or `false` |
101
+ | `primaryModel` | string | Default model for execution | `"gemini-2.5-pro"` |
102
+ | `secondaryModel` | string | Fallback model on primary failure | `"gemini-2.5-flash"` |
103
+ | `tags` | array | Capability tags for routing | `["分析", "Debug"]` |
104
+ | `type` | string | Tool type | `"builtin"`, `"cli-wrapper"`, `"api-endpoint"` |
105
+
106
+ ### Expected Tools (Reference Only)
107
+
108
+ Typical tools found in configuration (actual availability determined by reading the file):
109
+
110
+ | Tool | Typical Type | Common Use |
111
+ |------|--------------|------------|
112
+ | `gemini` | builtin | Analysis, Debug (分析, Debug tags) |
113
+ | `qwen` | builtin | General coding |
114
+ | `codex` | builtin | Code review, implementation |
115
+ | `claude` | builtin | General tasks |
116
+ | `opencode` | builtin | Open-source model fallback |
117
+
118
+ **Note**: Tool availability, models, and tags may differ. Use in-memory configuration or read `~/.claude/cli-tools.json` if not cached.
119
+
120
+ ### Configuration Fields
121
+
122
+ - **`enabled`**: Tool availability (boolean)
123
+ - **`primaryModel`**: Default model for execution
124
+ - **`secondaryModel`**: Fallback model on primary failure
125
+ - **`tags`**: Capability tags for routing (分析, Debug, implementation, etc.)
126
+ - **`type`**: Tool type (builtin, cli-wrapper, api-endpoint)
127
+
128
+ ## Universal Prompt Template
129
+
130
+ **Structure**: Every CLI command follows this 6-field template
131
+
132
+ ```bash
133
+ ccw cli -p "PURPOSE: [goal] + [why] + [success criteria] + [scope]
134
+ TASK: • [step 1: specific action] • [step 2: specific action] • [step 3: specific action]
135
+ MODE: [analysis|write|review]
136
+ CONTEXT: @[file patterns] | Memory: [session/tech/module context]
137
+ EXPECTED: [deliverable format] + [quality criteria] + [structure requirements]
138
+ CONSTRAINTS: [domain constraints]" --tool <tool-id> --mode <mode> --rule <template>
139
+ ```
140
+
141
+ ### Field Specifications
142
+
143
+ #### PURPOSE (Goal Definition)
144
+
145
+ **What**: Clear objective + motivation + success criteria + scope boundary
146
+
147
+ **Components**:
148
+ - What: Specific task goal
149
+ - Why: Business/technical motivation
150
+ - Success: Measurable success criteria
151
+ - Scope: Bounded context/files
152
+
153
+ **Example - Good**:
154
+ ```
155
+ PURPOSE: Identify OWASP Top 10 vulnerabilities in auth module to pass security audit;
156
+ success = all critical/high issues documented with remediation;
157
+ scope = src/auth/** only
158
+ ```
159
+
160
+ **Example - Bad**:
161
+ ```
162
+ PURPOSE: Analyze code
163
+ ```
164
+
165
+ #### TASK (Action Steps)
166
+
167
+ **What**: Specific, actionable steps with clear verbs and targets
168
+
169
+ **Format**: Bullet list with concrete actions
170
+
171
+ **Example - Good**:
172
+ ```
173
+ TASK:
174
+ • Scan for SQL injection in query builders
175
+ • Check XSS in template rendering
176
+ • Verify CSRF token validation
177
+ ```
178
+
179
+ **Example - Bad**:
180
+ ```
181
+ TASK: Review code and find issues
182
+ ```
183
+
184
+ #### MODE (Permission Level)
185
+
186
+ **Options**:
187
+ - **`analysis`** - Read-only, safe for auto-execution
188
+ - **`write`** - Create/Modify/Delete files, full operations
189
+ - **`review`** - Git-aware code review (codex only)
190
+
191
+ **Rules**:
192
+ - Always specify explicitly
193
+ - Default to `analysis` for read-only tasks
194
+ - Require explicit `--mode write` for file modifications
195
+ - Use `--mode review` with `--tool codex` for git-aware review
196
+
197
+ #### CONTEXT (File Scope + Memory)
198
+
199
+ **Format**: `CONTEXT: @[file patterns] | Memory: [memory context]`
200
+
201
+ **File Patterns**:
202
+ - `@**/*` - All files (default)
203
+ - `@src/**/*.ts` - Specific pattern
204
+ - `@../shared/**/*` - Parent/sibling (requires `--includeDirs`)
205
+
206
+ **Memory Context** (when building on previous work):
207
+ ```
208
+ Memory: Building on auth refactoring (commit abc123), using JWT for sessions
209
+ Memory: Integration with auth module, shared error patterns from @shared/utils/errors.ts
210
+ ```
211
+
212
+ #### EXPECTED (Output Specification)
213
+
214
+ **What**: Output format + quality criteria + structure requirements
215
+
216
+ **Example - Good**:
217
+ ```
218
+ EXPECTED: Markdown report with:
219
+ severity levels (Critical/High/Medium/Low),
220
+ file:line references,
221
+ remediation code snippets,
222
+ priority ranking
223
+ ```
224
+
225
+ **Example - Bad**:
226
+ ```
227
+ EXPECTED: Report
228
+ ```
229
+
230
+ #### CONSTRAINTS (Domain Boundaries)
231
+
232
+ **What**: Scope limits, special requirements, focus areas
233
+
234
+ **Example - Good**:
235
+ ```
236
+ CONSTRAINTS: Focus on authentication | Ignore test files | No breaking changes
237
+ ```
238
+
239
+ **Example - Bad**:
240
+ ```
241
+ CONSTRAINTS: (missing or too vague)
242
+ ```
243
+
244
+ ## CLI Execution Modes
245
+
246
+ ### MODE: analysis
247
+ - **Permission**: Read-only
248
+ - **Use For**: Code review, architecture analysis, pattern discovery, exploration
249
+ - **Safe**: Yes - can auto-execute
250
+ - **Default**: When not specified
251
+
252
+ ### MODE: write
253
+ - **Permission**: Create/Modify/Delete files
254
+ - **Use For**: Feature implementation, bug fixes, documentation, code creation
255
+ - **Safe**: No - requires explicit `--mode write`
256
+ - **Requirements**: Must be explicitly requested by user
257
+
258
+ ### MODE: review
259
+ - **Permission**: Read-only (git-aware review output)
260
+ - **Use For**: Code review of uncommitted changes, branch diffs, specific commits
261
+ - **Tool Support**: `codex` only (others treat as analysis)
262
+ - **Constraint**: Target flags (`--uncommitted`, `--base`, `--commit`) and prompt are mutually exclusive
263
+
264
+ ## Command Structure
265
+
266
+ ### Basic Command
267
+
268
+ ```bash
269
+ ccw cli -p "<PROMPT>" --tool <tool-id> --mode <analysis|write|review>
270
+ ```
271
+
272
+ ### Command Options
273
+
274
+ | Option | Description | Example |
275
+ |--------|-------------|---------|
276
+ | `--tool <tool>` | Tool from config | `--tool gemini` |
277
+ | `--mode <mode>` | **REQUIRED**: analysis/write/review | `--mode analysis` |
278
+ | `--model <model>` | Model override | `--model gemini-2.5-flash` |
279
+ | `--cd <path>` | Working directory | `--cd src/auth` |
280
+ | `--includeDirs <dirs>` | Additional directories | `--includeDirs ../shared,../types` |
281
+ | `--rule <template>` | Auto-load template | `--rule analysis-review-architecture` |
282
+ | `--resume [id]` | Resume session | `--resume` or `--resume <id>` |
283
+
284
+ ### Advanced Directory Configuration
285
+
286
+ #### Working Directory (`--cd`)
287
+
288
+ When using `--cd`:
289
+ - `@**/*` = Files within working directory tree only
290
+ - Cannot reference parent/sibling without `--includeDirs`
291
+ - Reduces token usage by scoping context
292
+
293
+ #### Include Directories (`--includeDirs`)
294
+
295
+ **Two-step requirement for external files**:
296
+
297
+ 1. Add `--includeDirs` parameter
298
+ 2. Reference in CONTEXT with @ patterns
299
+
300
+ ```bash
301
+ # Single directory
302
+ ccw cli -p "CONTEXT: @**/* @../shared/**/*" \
303
+ --tool gemini --mode analysis \
304
+ --cd src/auth --includeDirs ../shared
305
+
306
+ # Multiple directories
307
+ ccw cli -p "..." \
308
+ --tool gemini --mode analysis \
309
+ --cd src/auth --includeDirs ../shared,../types,../utils
310
+ ```
311
+
312
+ ### Session Resume
313
+
314
+ **When to Use**:
315
+ - Multi-round planning (analysis → planning → implementation)
316
+ - Multi-model collaboration (tool A → tool B on same topic)
317
+ - Topic continuity (building on previous findings)
318
+
319
+ **Usage**:
320
+
321
+ ```bash
322
+ ccw cli -p "Continue analyzing" --tool <tool-id> --mode analysis --resume # Resume last
323
+ ccw cli -p "Fix issues found" --tool <tool-id> --mode write --resume <id> # Resume specific
324
+ ccw cli -p "Merge findings" --tool <tool-id> --mode analysis --resume <id1>,<id2> # Merge sessions
325
+ ```
326
+
327
+ ## Available Rule Templates
328
+
329
+ ### Template System
330
+
331
+ Use `--rule <template-name>` to auto-load protocol + template appended to prompt
332
+
333
+ ### Universal Templates
334
+ - `universal-rigorous-style` - Precise tasks (default)
335
+ - `universal-creative-style` - Exploratory tasks
336
+
337
+ ### Analysis Templates
338
+ - `analysis-trace-code-execution` - Execution tracing
339
+ - `analysis-diagnose-bug-root-cause` - Bug diagnosis
340
+ - `analysis-analyze-code-patterns` - Code patterns
341
+ - `analysis-analyze-technical-document` - Document analysis
342
+ - `analysis-review-architecture` - Architecture review
343
+ - `analysis-review-code-quality` - Code review
344
+ - `analysis-analyze-performance` - Performance analysis
345
+ - `analysis-assess-security-risks` - Security assessment
346
+
347
+ ### Planning Templates
348
+ - `planning-plan-architecture-design` - Architecture design
349
+ - `planning-breakdown-task-steps` - Task breakdown
350
+ - `planning-design-component-spec` - Component design
351
+ - `planning-plan-migration-strategy` - Migration strategy
352
+
353
+ ### Development Templates
354
+ - `development-implement-feature` - Feature implementation
355
+ - `development-refactor-codebase` - Code refactoring
356
+ - `development-generate-tests` - Test generation
357
+ - `development-implement-component-ui` - UI component
358
+ - `development-debug-runtime-issues` - Runtime debugging
359
+
360
+ ## Task-Type Specific Examples
361
+
362
+ ### Example 1: Security Analysis (Read-Only)
363
+
364
+ ```bash
365
+ ccw cli -p "PURPOSE: Identify OWASP Top 10 vulnerabilities in authentication module to pass security audit; success = all critical/high issues documented with remediation
366
+ TASK: • Scan for injection flaws (SQL, command, LDAP) • Check authentication bypass vectors • Evaluate session management • Assess sensitive data exposure
367
+ MODE: analysis
368
+ CONTEXT: @src/auth/**/* @src/middleware/auth.ts | Memory: Using bcrypt for passwords, JWT for sessions
369
+ EXPECTED: Security report with: severity matrix, file:line references, CVE mappings where applicable, remediation code snippets prioritized by risk
370
+ CONSTRAINTS: Focus on authentication | Ignore test files
371
+ " --tool gemini --mode analysis --rule analysis-assess-security-risks --cd src/auth
372
+ ```
373
+
374
+ ### Example 2: Feature Implementation (Write Mode)
375
+
376
+ ```bash
377
+ ccw cli -p "PURPOSE: Implement rate limiting for API endpoints to prevent abuse; must be configurable per-endpoint; backward compatible with existing clients
378
+ TASK: • Create rate limiter middleware with sliding window • Implement per-route configuration • Add Redis backend for distributed state • Include bypass for internal services
379
+ MODE: write
380
+ CONTEXT: @src/middleware/**/* @src/config/**/* | Memory: Using Express.js, Redis already configured, existing middleware pattern in auth.ts
381
+ EXPECTED: Production-ready code with: TypeScript types, unit tests, integration test, configuration example, migration guide
382
+ CONSTRAINTS: Follow existing middleware patterns | No breaking changes
383
+ " --tool gemini --mode write --rule development-implement-feature
384
+ ```
385
+
386
+ ### Example 3: Bug Root Cause Analysis
387
+
388
+ ```bash
389
+ ccw cli -p "PURPOSE: Fix memory leak in WebSocket connection handler causing server OOM after 24h; root cause must be identified before any fix
390
+ TASK: • Trace connection lifecycle from open to close • Identify event listener accumulation • Check cleanup on disconnect • Verify garbage collection eligibility
391
+ MODE: analysis
392
+ CONTEXT: @src/websocket/**/* @src/services/connection-manager.ts | Memory: Using ws library, ~5000 concurrent connections in production
393
+ EXPECTED: Root cause analysis with: memory profile, leak source (file:line), fix recommendation with code, verification steps
394
+ CONSTRAINTS: Focus on resource cleanup
395
+ " --tool gemini --mode analysis --rule analysis-diagnose-bug-root-cause --cd src
396
+ ```
397
+
398
+ ### Example 4: Code Review (Codex Review Mode)
399
+
400
+ ```bash
401
+ # Option 1: Custom focus (reviews uncommitted by default)
402
+ ccw cli -p "Focus on security vulnerabilities and error handling" --tool codex --mode review
403
+
404
+ # Option 2: Target flag only (no prompt with target flags)
405
+ ccw cli --tool codex --mode review --uncommitted
406
+ ccw cli --tool codex --mode review --base main
407
+ ccw cli --tool codex --mode review --commit abc123
408
+ ```
409
+
410
+ ## Tool Selection Strategy
411
+
412
+ ### Selection Algorithm
413
+
414
+ **STEP 0 (REQUIRED)**: Load configuration (memory-first strategy)
415
+
416
+ ```bash
417
+ # Check if configuration exists in conversation memory
418
+ # If YES → Use in-memory configuration
419
+ # If NO → Read(file_path="~/.claude/cli-tools.json")
420
+ ```
421
+
422
+ Then proceed with selection:
423
+
424
+ 1. **Parse task intent** → Extract required capabilities
425
+ 2. **Load configuration** → Parse enabled tools with tags from JSON
426
+ 3. **Match tags** → Filter tools supporting required capabilities
427
+ 4. **Select tool** → Choose by priority (explicit > tag-match > default)
428
+ 5. **Select model** → Use primaryModel, fallback to secondaryModel
429
+
430
+ ### Selection Decision Tree
431
+
432
+ ```
433
+ 0. LOAD CONFIGURATION (memory-first)
434
+ ├─ In memory? → Use it
435
+ └─ Not in memory? → Read ~/.claude/cli-tools.json
436
+
437
+ 1. Explicit --tool specified?
438
+ YES → Validate tool is enabled in config → Use it
439
+ NO → Proceed to tag-based selection
440
+ ├─ Extract task tags (security, analysis, implementation, etc.)
441
+ │ ├─ Find tools with matching tags
442
+ │ │ ├─ Multiple matches? Use first enabled
443
+ │ │ └─ Single match? Use it
444
+ │ └─ No tag match? Use default tool
445
+
446
+ └─ Default: Use first enabled tool in config
447
+ ```
448
+
449
+ ### Common Tag Routing
450
+
451
+ **Note**: Match task type to tags defined in `~/.claude/cli-tools.json`
452
+
453
+ | Task Type | Common Tags to Match |
454
+ |-----------|---------------------|
455
+ | Security audit | `分析`, `analysis`, `security` |
456
+ | Bug diagnosis | `Debug`, `分析`, `analysis` |
457
+ | Implementation | `implementation`, (any enabled tool) |
458
+ | Testing | `testing`, (any enabled tool) |
459
+ | Refactoring | `refactoring`, (any enabled tool) |
460
+ | Documentation | `documentation`, (any enabled tool) |
461
+
462
+ **Selection Logic**: Find tools where `tags` array contains matching keywords, otherwise use first enabled tool.
463
+
464
+ ### Fallback Chain
465
+
466
+ When primary tool fails (based on `~/.claude/cli-tools.json` configuration):
467
+
468
+ 1. Check `secondaryModel` for same tool (use `secondaryModel` from config)
469
+ 2. Try next enabled tool with matching tags (scan config for enabled tools)
470
+ 3. Fall back to default enabled tool (first enabled tool in config)
471
+
472
+ **Example Fallback**:
473
+ ```
474
+ Tool1: primaryModel fails
475
+
476
+ Try Tool1: secondaryModel
477
+ ↓ (if fails)
478
+ Try Tool2: primaryModel (next enabled with matching tags)
479
+ ↓ (if fails)
480
+ Try default: first enabled tool
481
+ ```
482
+
483
+ ## Permission Framework
484
+
485
+ **Single-Use Authorization**: Each execution requires explicit user instruction. Previous authorization does NOT carry over.
486
+
487
+ **Mode Hierarchy**:
488
+ - `analysis`: Read-only, safe for auto-execution
489
+ - `write`: Create/Modify/Delete files - requires explicit `--mode write`
490
+ - `review`: Git-aware code review (codex only) - requires explicit `--mode review`
491
+ - **Exception**: User provides clear instructions like "modify", "create", "implement"
492
+
493
+ ## Auto-Invoke Triggers
494
+
495
+ **Proactive CLI invocation** - Auto-invoke `ccw cli` when encountering these scenarios:
496
+
497
+ | Trigger | Suggested Rule | When |
498
+ |---------|----------------|------|
499
+ | **Self-repair fails** | `analysis-diagnose-bug-root-cause` | After 1+ failed fix attempts |
500
+ | **Ambiguous requirements** | `planning-breakdown-task-steps` | Task description lacks clarity |
501
+ | **Architecture decisions** | `planning-plan-architecture-design` | Complex feature needs design |
502
+ | **Pattern uncertainty** | `analysis-analyze-code-patterns` | Unsure of existing conventions |
503
+ | **Critical code paths** | `analysis-assess-security-risks` | Security/performance sensitive |
504
+
505
+ ### Execution Principles for Auto-Invoke
506
+
507
+ - **Default mode**: `--mode analysis` (read-only, safe)
508
+ - **No confirmation needed**: Invoke proactively when triggers match
509
+ - **Wait for results**: Complete analysis before next action
510
+ - **Tool selection**: Use context-appropriate tool or fallback chain
511
+ - **Rule flexibility**: Suggested rules are guidelines, adapt as needed
512
+
513
+ ## Best Practices
514
+
515
+ ### Core Principles
516
+
517
+ - **Configuration-driven** - All tool selection from `cli-tools.json`
518
+ - **Tag-based routing** - Match task requirements to tool capabilities
519
+ - **Use tools early and often** - Tools are faster and more thorough than manual analysis
520
+ - **Unified CLI** - Always use `ccw cli -p` for consistent parameter handling
521
+ - **Default to analysis** - Omit `--mode` for read-only, explicitly use `--mode write` for modifications
522
+ - **Use `--rule` for templates** - Auto-loads protocol + template appended to prompt
523
+ - **Write protection** - Require EXPLICIT `--mode write` for file operations
524
+
525
+ ### Workflow Principles
526
+
527
+ - **Use unified interface** - Always `ccw cli -p` format
528
+ - **Always include template** - Use `--rule <template-name>` to load templates
529
+ - **Be specific** - Clear PURPOSE, TASK, EXPECTED fields
530
+ - **Include constraints** - File patterns, scope in CONSTRAINTS
531
+ - **Leverage memory context** - When building on previous work
532
+ - **Discover patterns first** - Use rg/MCP before CLI execution
533
+ - **Default to full context** - Use `@**/*` unless specific files needed
534
+
535
+ ### Planning Checklist
536
+
537
+ - [ ] **Purpose defined** - Clear goal and intent
538
+ - [ ] **Mode selected** - `--mode analysis|write|review`
539
+ - [ ] **Context gathered** - File references + memory (default `@**/*`)
540
+ - [ ] **Directory navigation** - `--cd` and/or `--includeDirs` if needed
541
+ - [ ] **Tool selected** - Explicit `--tool` or tag-based auto-selection
542
+ - [ ] **Rule template** - `--rule <template-name>` loads template
543
+ - [ ] **Constraints** - Domain constraints in CONSTRAINTS field
544
+
545
+ ## Integration with CLAUDE.md Instructions
546
+
547
+ **From global CLAUDE.md**:
548
+ - Always use `run_in_background: false` for Task tool agent calls
549
+ - Default: Use Bash `run_in_background: true` for CLI calls
550
+ - After CLI call: Stop output immediately, wait for hook callback
551
+ - Wait for results: MUST wait for CLI analysis before taking write actions
552
+ - Value every call: Never waste analysis results, aggregate before proposing solutions
553
+
554
+ **From cli-tools-usage.md**:
555
+ - Strict cli-tools.json configuration adherence
556
+ - Configuration-driven tool selection
557
+ - Template system with --rule auto-loading
558
+ - Permission framework with single-use authorization
559
+ - Auto-invoke triggers for common failure scenarios
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAyEA,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA2PxC"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAyEA,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA4PxC"}
package/ccw/dist/cli.js CHANGED
@@ -186,6 +186,7 @@ export function run(argv) {
186
186
  .option('--turn <n>', 'Turn number for cache (default: latest)')
187
187
  .option('--raw', 'Raw output only (no formatting)')
188
188
  .option('--final', 'Output final result only with usage hint')
189
+ .option('--to-file <path>', 'Save output to file')
189
190
  .action((subcommand, args, options) => cliCommand(subcommand, args, options));
190
191
  // Memory command
191
192
  program