Files
Claude-Code-Workflow/ccw/docs-site/build/assets/js/97c6e66a.c0137c74.js
catlog22 c6093ef741 feat: add CLI Command Node and Prompt Node components for orchestrator
- Implemented CliCommandNode component for executing CLI tools with AI models.
- Implemented PromptNode component for constructing AI prompts with context.
- Added styling for mode and tool badges in both components.
- Enhanced user experience with command and argument previews, execution status, and error handling.

test: add comprehensive tests for ask_question tool

- Created direct test for ask_question tool execution.
- Developed end-to-end tests to validate ask_question tool integration with WebSocket and A2UI surfaces.
- Implemented simple and integrated WebSocket tests to ensure proper message handling and surface reception.
- Added tool registration test to verify ask_question tool is correctly registered.

chore: add WebSocket listener and simulation tests

- Added WebSocket listener for A2UI surfaces to facilitate testing.
- Implemented frontend simulation test to validate complete flow from backend to frontend.
- Created various test scripts to ensure robust testing of ask_question tool functionality.
2026-02-03 23:10:36 +08:00

1 line
17 KiB
JavaScript

"use strict";(globalThis.webpackChunkccw_docs=globalThis.webpackChunkccw_docs||[]).push([[814],{1184(e,n,i){i.d(n,{R:()=>l,x:()=>t});var s=i(3696);const r={},d=s.createContext(r);function l(e){const n=s.useContext(d);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function t(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(d.Provider,{value:n},e.children)}},6665(e,n,i){i.r(n),i.d(n,{assets:()=>c,contentTitle:()=>t,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>o});const s=JSON.parse('{"id":"commands/general/ccw-debug","title":"/ccw-debug","description":"Debug coordinator for intelligent debugging workflows","source":"@site/docs/commands/general/ccw-debug.mdx","sourceDirName":"commands/general","slug":"/commands/general/ccw-debug","permalink":"/docs/docs/commands/general/ccw-debug","draft":false,"unlisted":false,"editUrl":"https://github.com/ccw/docs/tree/main/docs/commands/general/ccw-debug.mdx","tags":[],"version":"current","sidebarPosition":5,"frontMatter":{"title":"/ccw-debug","sidebar_label":"/ccw-debug","sidebar_position":5,"description":"Debug coordinator for intelligent debugging workflows"},"sidebar":"docs","previous":{"title":"/ccw-coordinator","permalink":"/docs/docs/commands/general/ccw-coordinator"},"next":{"title":"/flow-create","permalink":"/docs/docs/commands/general/flow-create"}}');var r=i(2540),d=i(1184);const l={title:"/ccw-debug",sidebar_label:"/ccw-debug",sidebar_position:5,description:"Debug coordinator for intelligent debugging workflows"},t="/ccw-debug",c={},o=[{value:"Overview",id:"overview",level:2},{value:"Features",id:"features",level:2},{value:"Usage",id:"usage",level:2},{value:"Debug Modes",id:"debug-modes",level:2},{value:"CLI Mode",id:"cli-mode",level:3},{value:"Debug Mode",id:"debug-mode",level:3},{value:"Test Mode",id:"test-mode",level:3},{value:"Bidirectional Mode",id:"bidirectional-mode",level:3},{value:"Debug Units",id:"debug-units",level:2},{value:"Execution Flow",id:"execution-flow",level:2},{value:"Mode Detection",id:"mode-detection",level:2},{value:"Debug Pipeline Examples",id:"debug-pipeline-examples",level:2},{value:"State Management",id:"state-management",level:2},{value:"Dual Tracking System",id:"dual-tracking-system",level:3},{value:"Examples",id:"examples",level:2},{value:"CLI Mode",id:"cli-mode-1",level:3},{value:"Debug Mode",id:"debug-mode-1",level:3},{value:"Bidirectional Mode",id:"bidirectional-mode-1",level:3},{value:"Related Commands",id:"related-commands",level:2},{value:"Notes",id:"notes",level:2}];function a(e){const n={code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,d.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"ccw-debug",children:"/ccw-debug"})}),"\n",(0,r.jsx)(n.p,{children:"Debug coordinator - analyzes issues, selects debug strategy, and executes debug workflow in the main process."}),"\n",(0,r.jsx)(n.h2,{id:"overview",children:"Overview"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"/ccw-debug"})," command orchestrates debugging workflows by analyzing issue descriptions, selecting appropriate debug strategies, and executing targeted command chains."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Parameters"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"--mode &lt;mode&gt;"}),": Debug mode (cli, debug, test, bidirectional)"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"--yes|-y"}),": Skip confirmation prompts"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"bug description"'}),": Issue to debug (required)"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Core Concept"}),": Debug Units - commands grouped into logical units for different root cause strategies."]}),"\n",(0,r.jsx)(n.h2,{id:"features",children:"Features"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Issue Analysis"})," - Extracts symptoms, occurrence patterns, affected components"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Strategy Selection"})," - Auto-selects based on keywords and complexity"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Debug Units"})," - 4 debug modes for different scenarios"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Parallel Execution"})," - Bidirectional mode for complex issues"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"State Tracking"})," - TODO and status file tracking"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'# Auto-select mode (keyword-based detection)\r\n/ccw-debug "Login timeout error"\r\n\r\n# Explicit mode selection\r\n/ccw-debug --mode cli "Quick API question"\r\n/ccw-debug --mode debug "User authentication fails"\r\n/ccw-debug --mode test "Unit tests failing"\r\n/ccw-debug --mode bidirectional "Complex multi-module issue"\r\n\r\n# Skip confirmation\r\n/ccw-debug --yes "Fix typo in config"\n'})}),"\n",(0,r.jsx)(n.h2,{id:"debug-modes",children:"Debug Modes"}),"\n",(0,r.jsx)(n.h3,{id:"cli-mode",children:"CLI Mode"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Use for"}),": Quick analysis, simple questions, early diagnosis"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Command Chain"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"ccw cli --mode analysis --rule analysis-diagnose-bug-root-ause\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Characteristics"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Analysis only"}),"\n",(0,r.jsx)(n.li,{children:"No code changes"}),"\n",(0,r.jsx)(n.li,{children:"Returns findings and recommendations"}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"debug-mode",children:"Debug Mode"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Use for"}),": Standard bug diagnosis and fix"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Command Chain"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"/workflow:debug-with-file\r\n/workflow:test-fix-gen\r\n/workflow:test-cycle-execute\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Characteristics"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Hypothesis-driven debugging"}),"\n",(0,r.jsx)(n.li,{children:"Test generation"}),"\n",(0,r.jsx)(n.li,{children:"Iterative fixing"}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"test-mode",children:"Test Mode"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Use for"}),": Test failures, test validation"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Command Chain"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"/workflow:test-fix-gen\r\n/workflow:test-cycle-execute\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Characteristics"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Test-focused"}),"\n",(0,r.jsx)(n.li,{children:"Fix in testing"}),"\n",(0,r.jsx)(n.li,{children:"Iterative until pass"}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"bidirectional-mode",children:"Bidirectional Mode"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Use for"}),": Complex issues requiring multiple perspectives"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Command Chain"})," (Parallel):"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"/workflow:debug-with-file \u2225 /workflow:test-fix-gen \u2225 /workflow:test-cycle-execute\r\n \u2193\r\n Merge findings\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Characteristics"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Parallel execution"}),"\n",(0,r.jsx)(n.li,{children:"Multiple perspectives"}),"\n",(0,r.jsx)(n.li,{children:"Merged findings"}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"debug-units",children:"Debug Units"}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Unit Name"}),(0,r.jsx)(n.th,{children:"Commands"}),(0,r.jsx)(n.th,{children:"Purpose"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.strong,{children:"Quick Analysis"})}),(0,r.jsx)(n.td,{children:"ccw cli (analysis)"}),(0,r.jsx)(n.td,{children:"Quick diagnosis"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.strong,{children:"Standard Debug"})}),(0,r.jsx)(n.td,{children:"debug-with-file \u2192 test-fix-gen \u2192 test-cycle-execute"}),(0,r.jsx)(n.td,{children:"Full debug cycle"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.strong,{children:"Test Fix"})}),(0,r.jsx)(n.td,{children:"test-fix-gen \u2192 test-cycle-execute"}),(0,r.jsx)(n.td,{children:"Test-focused fix"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.strong,{children:"Comprehensive"})}),(0,r.jsx)(n.td,{children:"(debug \u2225 test \u2225 test-cycle) \u2192 merge"}),(0,r.jsx)(n.td,{children:"Multi-perspective"})]})]})]}),"\n",(0,r.jsx)(n.h2,{id:"execution-flow",children:"Execution Flow"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'User Input: "bug description"\r\n \u2193\r\nPhase 1: Analyze Issue\r\n \u251c\u2500 Extract: description, error_type, clarity, complexity, scope\r\n \u2514\u2500 If clarity < 2 \u2192 Phase 1.5: Clarify Issue\r\n \u2193\r\nPhase 2: Select Debug Strategy & Build Chain\r\n \u251c\u2500 Detect mode: cli | debug | test | bidirectional\r\n \u251c\u2500 Build command chain based on mode\r\n \u2514\u2500 Parallel execution for bidirectional\r\n \u2193\r\nPhase 3: User Confirmation (optional)\r\n \u251c\u2500 Show debug strategy\r\n \u2514\u2500 Allow mode change\r\n \u2193\r\nPhase 4: Setup TODO Tracking & Status File\r\n \u251c\u2500 Create todos with CCWD prefix\r\n \u2514\u2500 Initialize .workflow/.ccw-debug/{session_id}/status.json\r\n \u2193\r\nPhase 5: Execute Debug Chain\r\n \u251c\u2500 Sequential: execute commands in order\r\n \u251c\u2500 Bidirectional: execute debug + test in parallel\r\n \u251c\u2500 CLI: present findings, ask for escalation\r\n \u2514\u2500 Merge findings (bidirectional)\r\n \u2193\r\nUpdate status and TODO\n'})}),"\n",(0,r.jsx)(n.h2,{id:"mode-detection",children:"Mode Detection"}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Keywords"}),(0,r.jsx)(n.th,{children:"Detected Mode"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"quick, simple, question, what, how"}),(0,r.jsx)(n.td,{children:"cli"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"bug, error, fail, crash, timeout"}),(0,r.jsx)(n.td,{children:"debug"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"test, unit test, coverage, assertion"}),(0,r.jsx)(n.td,{children:"test"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"complex, multiple, module, integration"}),(0,r.jsx)(n.td,{children:"bidirectional"})]})]})]}),"\n",(0,r.jsx)(n.h2,{id:"debug-pipeline-examples",children:"Debug Pipeline Examples"}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Issue"}),(0,r.jsx)(n.th,{children:"Mode"}),(0,r.jsx)(n.th,{children:"Pipeline"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:'"Login timeout error (quick)"'}),(0,r.jsx)(n.td,{children:"cli"}),(0,r.jsx)(n.td,{children:"ccw cli \u2192 analysis \u2192 (escalate or done)"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:'"User login fails intermittently"'}),(0,r.jsx)(n.td,{children:"debug"}),(0,r.jsx)(n.td,{children:"debug-with-file \u2192 test-gen \u2192 test-cycle"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:'"Authentication tests failing"'}),(0,r.jsx)(n.td,{children:"test"}),(0,r.jsx)(n.td,{children:"test-fix-gen \u2192 test-cycle-execute"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:'"Multi-module auth + db sync issue"'}),(0,r.jsx)(n.td,{children:"bidirectional"}),(0,r.jsx)(n.td,{children:"(debug \u2225 test) \u2192 merge findings"})]})]})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Legend"}),": ",(0,r.jsx)(n.code,{children:"\u2225"})," = parallel execution"]}),"\n",(0,r.jsx)(n.h2,{id:"state-management",children:"State Management"}),"\n",(0,r.jsx)(n.h3,{id:"dual-tracking-system",children:"Dual Tracking System"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"1. TodoWrite-Based Tracking"})," (UI Display):"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"CCWD:debug: [1/3] /workflow:debug-with-file [in_progress]\r\nCCWD:debug: [2/3] /workflow:test-fix-gen [pending]\r\nCCWD:debug: [3/3] /workflow:test-cycle-execute [pending]\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"2. Status File"})," (Internal State):"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\r\n "session_id": "CCWD-...",\r\n "mode": "debug|cli|test|bidirectional",\r\n "status": "running",\r\n "parallel_execution": false|true,\r\n "issue": {\r\n "description": "...",\r\n "error_type": "...",\r\n "clarity": 1-5,\r\n "complexity": "low|medium|high"\r\n },\r\n "command_chain": [...],\r\n "findings": {\r\n "debug": {...},\r\n "test": {...},\r\n "merged": {...}\r\n }\r\n}\n'})}),"\n",(0,r.jsx)(n.h2,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(n.h3,{id:"cli-mode-1",children:"CLI Mode"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'# Quick analysis\r\n/ccw-debug --mode cli "Why is the API returning 500?"\r\n\r\n# Output:\r\n# Executing CLI analysis...\r\n# Analysis complete:\r\n# - Root cause: Database connection timeout\r\n# - Recommendation: Increase connection pool size\r\n# Escalate to debug mode? (y/n): y\n'})}),"\n",(0,r.jsx)(n.h3,{id:"debug-mode-1",children:"Debug Mode"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'# Standard debugging\r\n/ccw-debug "User login fails intermittently"\r\n\r\n# Output:\r\n# Analyzing issue...\r\n# Mode detected: debug\r\n# Command chain:\r\n# 1. /workflow:debug-with-file\r\n# 2. /workflow:test-fix-gen\r\n# 3. /workflow:test-cycle-execute\r\n# Confirm? (y/n): y\r\n#\r\n# CCWD:debug: [1/3] /workflow:debug-with-file [in_progress]\r\n# ...\n'})}),"\n",(0,r.jsx)(n.h3,{id:"bidirectional-mode-1",children:"Bidirectional Mode"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'# Complex issue\r\n/ccw-debug --mode bidirectional "Multi-module auth + database sync issue"\r\n\r\n# Output:\r\n# Analyzing issue...\r\n# Mode: bidirectional (parallel execution)\r\n# Command chain:\r\n# Branch A: /workflow:debug-with-file\r\n# Branch B: /workflow:test-fix-gen\r\n# Branch C: /workflow:test-cycle-execute\r\n# \u2192 Merge findings\r\n# Confirm? (y/n): y\r\n#\r\n# Executing branches in parallel...\r\n# Merging findings...\r\n# Final recommendations: ...\n'})}),"\n",(0,r.jsx)(n.h2,{id:"related-commands",children:"Related Commands"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsxs)(n.strong,{children:["/workflow",":debug-with-file"]})," - Hypothesis-driven debugging"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsxs)(n.strong,{children:["/workflow",":test-fix-gen"]})," - Test fix generation"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsxs)(n.strong,{children:["/workflow",":test-cycle-execute"]})," - Test cycle execution"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"/ccw"})," - Main workflow coordinator"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Auto mode detection"})," based on keywords"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Debug units"})," ensure complete debugging milestones"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"TODO tracking"})," with CCWD prefix"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Status file"})," in ",(0,r.jsx)(n.code,{children:".workflow/.ccw-debug/{session}/"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Parallel execution"})," for bidirectional mode"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Merge findings"})," combines multiple perspectives"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Escalation support"})," from CLI to other modes"]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,d.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(a,{...e})}):a(e)}}}]);