mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-04 01:40:45 +08:00
- 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.
1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
"use strict";(globalThis.webpackChunkccw_docs=globalThis.webpackChunkccw_docs||[]).push([[268],{783(e,n,s){s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>h,frontMatter:()=>i,metadata:()=>l,toc:()=>c});const l=JSON.parse('{"id":"commands/memory/memory-docs-related-cli","title":"/memory:docs-related-cli","description":"Generate CLI documentation for git-changed modules","source":"@site/docs/commands/memory/memory-docs-related-cli.mdx","sourceDirName":"commands/memory","slug":"/commands/memory/memory-docs-related-cli","permalink":"/docs/docs/commands/memory/memory-docs-related-cli","draft":false,"unlisted":false,"editUrl":"https://github.com/ccw/docs/tree/main/docs/commands/memory/memory-docs-related-cli.mdx","tags":[],"version":"current","sidebarPosition":5,"frontMatter":{"title":"/memory:docs-related-cli","sidebar_label":"/memory:docs-related-cli","sidebar_position":5,"description":"Generate CLI documentation for git-changed modules"},"sidebar":"docs","previous":{"title":"/memory:docs-full-cli","permalink":"/docs/docs/commands/memory/memory-docs-full-cli"},"next":{"title":"/memory:compact","permalink":"/docs/docs/commands/memory/memory-compact"}}');var t=s(2540),r=s(1184);const i={title:"/memory:docs-related-cli",sidebar_label:"/memory:docs-related-cli",sidebar_position:5,description:"Generate CLI documentation for git-changed modules"},o="/memory",d={},c=[{value:"Overview",id:"overview",level:2},{value:"Features",id:"features",level:2},{value:"Usage",id:"usage",level:2},{value:"Tool Fallback Hierarchy",id:"tool-fallback-hierarchy",level:2},{value:"Execution Flow",id:"execution-flow",level:2},{value:"Phase 1: Change Detection & Analysis",id:"phase-1-change-detection--analysis",level:3},{value:"Phase 2: Plan Presentation",id:"phase-2-plan-presentation",level:3},{value:"Phase 3: Batched Documentation Generation",id:"phase-3-batched-documentation-generation",level:3},{value:"Phase 4: Verification",id:"phase-4-verification",level:3},{value:"Strategy Selection",id:"strategy-selection",level:2},{value:"Comparison with Full CLI Documentation",id:"comparison-with-full-cli-documentation",level:2},{value:"Examples",id:"examples",level:2},{value:"Basic Usage",id:"basic-usage",level:3},{value:"Tool Selection",id:"tool-selection",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",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsxs)(n.h1,{id:"memory",children:["/memory",":docs-related-cli"]})}),"\n",(0,t.jsx)(n.p,{children:"Generate CLI documentation for modules affected by git changes using batched agent execution with automatic tool fallback."}),"\n",(0,t.jsx)(n.h2,{id:"overview",children:"Overview"}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"/memory:docs-related-cli"})," command generates documentation only for modules affected by recent git changes, providing faster documentation updates for daily development."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.strong,{children:"Parameters"}),":"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"--tool <gemini|qwen|codex>"}),": Primary tool (default: gemini)"]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.strong,{children:"Execution Flow"}),":"]}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsx)(n.li,{children:"Change Detection \u2192 2. Plan Presentation \u2192 3. Batched Generation \u2192 4. Verification"}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"features",children:"Features"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Changed Module Detection"})," - Uses git diff to identify affected modules"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Intelligent Batching"})," - Groups modules by depth (4 modules/agent)"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Automatic Fallback"})," - gemini\u2192qwen\u2192codex on failure"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Depth Sequential"})," - Process depths N\u21920, parallel batches within depth"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Smart Filtering"})," - Auto-detects and skips tests/build/config/docs"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Single Strategy"})," - Uses single-layer documentation for speed"]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"# Generate docs for changed modules\r\n/memory:docs-related-cli\r\n\r\n# Use specific tool\r\n/memory:docs-related-cli --tool qwen\n"})}),"\n",(0,t.jsx)(n.h2,{id:"tool-fallback-hierarchy",children:"Tool Fallback Hierarchy"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-javascript",children:"--tool gemini \u2192 [gemini, qwen, codex] // default\r\n--tool qwen \u2192 [qwen, gemini, codex]\r\n--tool codex \u2192 [codex, gemini, qwen]\n"})}),"\n",(0,t.jsx)(n.h2,{id:"execution-flow",children:"Execution Flow"}),"\n",(0,t.jsx)(n.h3,{id:"phase-1-change-detection--analysis",children:"Phase 1: Change Detection & Analysis"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-javascript",children:'// Detect changed modules\r\nBash({command: "ccw tool exec detect_changed_modules \'{\\"format\\":\\"list\\"}\'", run_in_background: false});\r\n\r\n// Cache git changes\r\nBash({command: "git add -A 2>/dev/null || true", run_in_background: false});\n'})}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.strong,{children:"Parse output"})," ",(0,t.jsx)(n.code,{children:"depth:N|path:<PATH>|change:<TYPE>"})," to extract affected modules."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.strong,{children:"Smart filter"}),": Auto-detect and skip tests/build/config/docs based on project tech stack."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.strong,{children:"Fallback"}),": If no changes detected, use recent modules (first 10 by depth)."]}),"\n",(0,t.jsx)(n.h3,{id:"phase-2-plan-presentation",children:"Phase 2: Plan Presentation"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Parse ",(0,t.jsx)(n.code,{children:"--tool"})," (default: gemini)"]}),"\n",(0,t.jsx)(n.li,{children:"Refresh code index for accurate change detection"}),"\n",(0,t.jsx)(n.li,{children:"Detect changed modules"}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Smart filter modules"})," (auto-detect tech stack, skip tests/build/config)"]}),"\n",(0,t.jsx)(n.li,{children:"Cache git changes"}),"\n",(0,t.jsx)(n.li,{children:"Apply fallback if no changes"}),"\n",(0,t.jsx)(n.li,{children:"Construct tool fallback order"}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Present filtered plan"})," with change types"]}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.strong,{children:"Wait for y/n confirmation"})}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"phase-3-batched-documentation-generation",children:"Phase 3: Batched Documentation Generation"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-javascript",children:'let modules_by_depth = group_by_depth(changed_modules);\r\nlet tool_order = construct_tool_order(primary_tool);\r\n\r\nfor (let depth of sorted_depths.reverse()) { // N \u2192 0\r\n let batches = batch_modules(modules_by_depth[depth], 4);\r\n\r\n for (let batch of batches) {\r\n let parallel_tasks = batch.map(module => {\r\n return async () => {\r\n for (let tool of tool_order) {\r\n Bash({\r\n command: `cd ${module.path} && ccw tool exec generate_module_docs \'{"strategy":"single","sourcePath":".","projectName":"${project_name}","tool":"${tool}"}\'`,\r\n run_in_background: false\r\n });\r\n if (bash_result.exit_code === 0) {\r\n report(`\u2705 ${module.path} docs generated with ${tool}`);\r\n return true;\r\n }\r\n }\r\n report(`\u274c FAILED: ${module.path} failed all tools`);\r\n return false;\r\n };\r\n });\r\n await Promise.all(parallel_tasks.map(task => task()));\r\n }\r\n}\n'})}),"\n",(0,t.jsx)(n.h3,{id:"phase-4-verification",children:"Phase 4: Verification"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"Verify documentation files were created"}),"\n",(0,t.jsx)(n.li,{children:"Display statistics"}),"\n",(0,t.jsx)(n.li,{children:"Show summary of generated docs"}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"strategy-selection",children:"Strategy Selection"}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.strong,{children:"Related Mode"})," uses ",(0,t.jsx)(n.code,{children:"single"})," strategy:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"Generates single document per module"}),"\n",(0,t.jsx)(n.li,{children:"Faster than full mode's multi-layer approach"}),"\n",(0,t.jsx)(n.li,{children:"Suitable for iterative development"}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"comparison-with-full-cli-documentation",children:"Comparison with Full CLI Documentation"}),"\n",(0,t.jsxs)(n.table,{children:[(0,t.jsx)(n.thead,{children:(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.th,{children:"Aspect"}),(0,t.jsx)(n.th,{children:"Related Docs"}),(0,t.jsx)(n.th,{children:"Full Docs"})]})}),(0,t.jsxs)(n.tbody,{children:[(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Scope"})}),(0,t.jsx)(n.td,{children:"Changed modules only"}),(0,t.jsx)(n.td,{children:"All project modules"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Speed"})}),(0,t.jsx)(n.td,{children:"Fast (minutes)"}),(0,t.jsx)(n.td,{children:"Slower (10-30 min)"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Use case"})}),(0,t.jsx)(n.td,{children:"Daily development"}),(0,t.jsx)(n.td,{children:"Major refactoring"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Strategy"})}),(0,t.jsx)(n.td,{children:"single only"}),(0,t.jsx)(n.td,{children:"full for depth>=3"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Trigger"})}),(0,t.jsx)(n.td,{children:"After commits"}),(0,t.jsx)(n.td,{children:"After major changes"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Batching"})}),(0,t.jsx)(n.td,{children:"4 modules/agent"}),(0,t.jsx)(n.td,{children:"4 modules/agent"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Fallback"})}),(0,t.jsx)(n.td,{children:"gemini\u2192qwen\u2192codex"}),(0,t.jsx)(n.td,{children:"gemini\u2192qwen\u2192codex"})]})]})]}),"\n",(0,t.jsx)(n.h2,{id:"examples",children:"Examples"}),"\n",(0,t.jsx)(n.h3,{id:"basic-usage",children:"Basic Usage"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"# Document changed modules after commits\r\n/memory:docs-related-cli\r\n\r\n# Output:\r\n# Detecting git changes...\r\n# Found 8 changed modules\r\n# Filtered: 3 test modules skipped\r\n# Plan: Generate docs for 5 modules\r\n# Confirm? (y/n): y\r\n#\r\n# Depth 3: [4/4] \u2705\r\n# Depth 2: [1/1] \u2705\r\n# Summary: 5/5 modules documented\n"})}),"\n",(0,t.jsx)(n.h3,{id:"tool-selection",children:"Tool Selection"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"# Use Qwen for generation\r\n/memory:docs-related-cli --tool qwen\n"})}),"\n",(0,t.jsx)(n.h2,{id:"related-commands",children:"Related Commands"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsxs)(n.strong,{children:["/memory",":docs-full-cli"]})," - Generate docs for all modules"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsxs)(n.strong,{children:["/memory",":update-related"]})," - Update CLAUDE.md for changed modules"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsxs)(n.strong,{children:["/memory",":compact"]})," - Compact session memory"]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Smart filtering"})," automatically skips test/build/config directories"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Change detection"})," uses git diff to find affected modules"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Single strategy"})," optimizes for speed in iterative development"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Tool fallback"})," ensures completion even if primary tool fails"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Verification"})," confirms all documentation files created successfully"]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}},1184(e,n,s){s.d(n,{R:()=>i,x:()=>o});var l=s(3696);const t={},r=l.createContext(t);function i(e){const n=l.useContext(r);return l.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),l.createElement(r.Provider,{value:n},e.children)}}}]); |