Files
Claude-Code-Workflow/ccw/docs-site/build/assets/js/611877e1.94144df0.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
16 KiB
JavaScript

"use strict";(globalThis.webpackChunkccw_docs=globalThis.webpackChunkccw_docs||[]).push([[407],{1184(e,n,t){t.d(n,{R:()=>d,x:()=>i});var s=t(3696);const l={},r=s.createContext(l);function d(e){const n=s.useContext(r);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:d(e.components),s.createElement(r.Provider,{value:n},e.children)}},1669(e,n,t){t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>i,default:()=>h,frontMatter:()=>d,metadata:()=>s,toc:()=>o});const s=JSON.parse('{"id":"commands/memory/memory-update-related","title":"/memory:update-related","description":"Update CLAUDE.md for git-changed modules using batched execution","source":"@site/docs/commands/memory/memory-update-related.mdx","sourceDirName":"commands/memory","slug":"/commands/memory/memory-update-related","permalink":"/docs/docs/commands/memory/memory-update-related","draft":false,"unlisted":false,"editUrl":"https://github.com/ccw/docs/tree/main/docs/commands/memory/memory-update-related.mdx","tags":[],"version":"current","sidebarPosition":2,"frontMatter":{"title":"/memory:update-related","sidebar_label":"/memory:update-related","sidebar_position":2,"description":"Update CLAUDE.md for git-changed modules using batched execution"},"sidebar":"docs","previous":{"title":"/memory:update-full","permalink":"/docs/docs/commands/memory/memory-update-full"},"next":{"title":"/memory:load","permalink":"/docs/docs/commands/memory/memory-load"}}');var l=t(2540),r=t(1184);const d={title:"/memory:update-related",sidebar_label:"/memory:update-related",sidebar_position:2,description:"Update CLAUDE.md for git-changed modules using batched execution"},i="/memory",a={},o=[{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 Modes",id:"execution-modes",level:2},{value:"Small Changes (&lt;15 modules)",id:"small-changes-15-modules",level:3},{value:"Large Changes (&gt;=15 modules)",id:"large-changes-15-modules",level:3},{value:"Execution Flow",id:"execution-flow",level:2},{value:"Phase 1: Change Detection &amp; Analysis",id:"phase-1-change-detection--analysis",level:3},{value:"Phase 2: Plan Presentation",id:"phase-2-plan-presentation",level:3},{value:"Phase 3A: Direct Execution (&lt;15 modules)",id:"phase-3a-direct-execution-15-modules",level:3},{value:"Phase 3B: Agent Execution (&gt;=15 modules)",id:"phase-3b-agent-execution-15-modules",level:3},{value:"Phase 4: Safety Verification",id:"phase-4-safety-verification",level:3},{value:"Strategy Selection",id:"strategy-selection",level:2},{value:"Comparison with Full Update",id:"comparison-with-full-update",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:"No Changes Detected",id:"no-changes-detected",level:3},{value:"Related Commands",id:"related-commands",level:2},{value:"Notes",id:"notes",level:2}];function c(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,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.header,{children:(0,l.jsxs)(n.h1,{id:"memory",children:["/memory",":update-related"]})}),"\n",(0,l.jsx)(n.p,{children:"Orchestrates context-aware CLAUDE.md updates for changed modules using batched agent execution with automatic tool fallback."}),"\n",(0,l.jsx)(n.h2,{id:"overview",children:"Overview"}),"\n",(0,l.jsxs)(n.p,{children:["The ",(0,l.jsx)(n.code,{children:"/memory:update-related"})," command updates CLAUDE.md documentation only for modules affected by git changes, providing faster updates for daily development."]}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.strong,{children:"Parameters"}),":"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"--tool &lt;gemini|qwen|codex&gt;"}),": Primary tool (default: gemini)"]}),"\n"]}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.strong,{children:"Execution Flow"}),":"]}),"\n",(0,l.jsxs)(n.ol,{children:["\n",(0,l.jsx)(n.li,{children:"Change Detection \u2192 2. Plan Presentation \u2192 3. Batched Execution \u2192 4. Safety Verification"}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"features",children:"Features"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Changed Module Detection"})," - Uses git diff to identify affected modules"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Intelligent Batching"})," - Groups modules by depth (4 modules/agent)"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Automatic Fallback"})," - gemini\u2192qwen\u2192codex on failure"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Depth Sequential"})," - Process depths N\u21920, parallel batches within depth"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Related Mode"})," - Update only changed modules and their parent contexts"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Smart Filtering"})," - Auto-detects and skips tests/build/config/docs"]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-bash",children:"# Update git-changed modules\r\n/memory:update-related\r\n\r\n# Use specific tool\r\n/memory:update-related --tool qwen\r\n\r\n# Fallback to recent modules if no changes detected\r\n/memory:update-related\n"})}),"\n",(0,l.jsx)(n.h2,{id:"tool-fallback-hierarchy",children:"Tool Fallback Hierarchy"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.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,l.jsxs)(n.p,{children:[(0,l.jsx)(n.strong,{children:"Trigger"}),": Non-zero exit code from update script"]}),"\n",(0,l.jsx)(n.h2,{id:"execution-modes",children:"Execution Modes"}),"\n",(0,l.jsx)(n.h3,{id:"small-changes-15-modules",children:"Small Changes (<15 modules)"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.strong,{children:"Direct parallel execution"})}),"\n",(0,l.jsx)(n.li,{children:"Max 4 concurrent per depth"}),"\n",(0,l.jsx)(n.li,{children:"No agent overhead"}),"\n"]}),"\n",(0,l.jsx)(n.h3,{id:"large-changes-15-modules",children:"Large Changes (>=15 modules)"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.strong,{children:"Agent batch processing"})}),"\n",(0,l.jsx)(n.li,{children:"4 modules/agent"}),"\n",(0,l.jsx)(n.li,{children:"Better resource utilization"}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"execution-flow",children:"Execution Flow"}),"\n",(0,l.jsx)(n.h3,{id:"phase-1-change-detection--analysis",children:"Phase 1: Change Detection & Analysis"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.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,l.jsxs)(n.p,{children:[(0,l.jsx)(n.strong,{children:"Parse output"})," ",(0,l.jsx)(n.code,{children:"depth:N|path:&lt;PATH&gt;|change:&lt;TYPE&gt;"})," to extract affected modules."]}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.strong,{children:"Smart filter"}),": Auto-detect and skip tests/build/config/docs based on project tech stack."]}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.strong,{children:"Fallback"}),": If no changes detected, use recent modules (first 10 by depth)."]}),"\n",(0,l.jsx)(n.h3,{id:"phase-2-plan-presentation",children:"Phase 2: Plan Presentation"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["Parse ",(0,l.jsx)(n.code,{children:"--tool"})," (default: gemini)"]}),"\n",(0,l.jsx)(n.li,{children:"Refresh code index for accurate change detection"}),"\n",(0,l.jsx)(n.li,{children:"Detect changed modules via detect_changed_modules"}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Smart filter modules"})," (auto-detect tech stack, skip tests/build/config/docs)"]}),"\n",(0,l.jsx)(n.li,{children:"Cache git changes"}),"\n",(0,l.jsx)(n.li,{children:"Apply fallback if no changes (recent 10 modules)"}),"\n",(0,l.jsx)(n.li,{children:"Construct tool fallback order"}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Present filtered plan"})," with skip reasons and change types"]}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.strong,{children:"Wait for y/n confirmation"})}),"\n"]}),"\n",(0,l.jsx)(n.h3,{id:"phase-3a-direct-execution-15-modules",children:"Phase 3A: Direct Execution (<15 modules)"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-javascript",children:'for (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 update_module_claude \'{"strategy":"single-layer","path":".","tool":"${tool}"}\'`,\r\n run_in_background: false\r\n });\r\n if (bash_result.exit_code === 0) {\r\n report(`\u2705 ${module.path} updated 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,l.jsx)(n.h3,{id:"phase-3b-agent-execution-15-modules",children:"Phase 3B: Agent Execution (>=15 modules)"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.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 let worker_tasks = [];\r\n\r\n for (let batch of batches) {\r\n worker_tasks.push(\r\n Task(\r\n subagent_type="memory-bridge",\r\n description=`Update ${batch.length} modules at depth ${depth}`,\r\n prompt=generate_batch_worker_prompt(batch, tool_order, "related")\r\n )\r\n );\r\n }\r\n\r\n await parallel_execute(worker_tasks); // Batches run in parallel\r\n}\n'})}),"\n",(0,l.jsx)(n.h3,{id:"phase-4-safety-verification",children:"Phase 4: Safety Verification"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:"Verify only CLAUDE.md files were modified"}),"\n",(0,l.jsx)(n.li,{children:"Display git diff statistics"}),"\n",(0,l.jsx)(n.li,{children:"Show summary of updates"}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"strategy-selection",children:"Strategy Selection"}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.strong,{children:"Related Mode"})," uses ",(0,l.jsx)(n.code,{children:"single-layer"})," strategy:"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:"Updates only the changed module's CLAUDE.md"}),"\n",(0,l.jsx)(n.li,{children:"Faster than full update's multi-layer approach"}),"\n",(0,l.jsx)(n.li,{children:"Suitable for iterative development"}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"comparison-with-full-update",children:"Comparison with Full Update"}),"\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Aspect"}),(0,l.jsx)(n.th,{children:"Related Update"}),(0,l.jsx)(n.th,{children:"Full Update"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"Scope"})}),(0,l.jsx)(n.td,{children:"Changed modules only"}),(0,l.jsx)(n.td,{children:"All project modules"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"Speed"})}),(0,l.jsx)(n.td,{children:"Fast (minutes)"}),(0,l.jsx)(n.td,{children:"Slower (10-30 min)"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"Use case"})}),(0,l.jsx)(n.td,{children:"Daily development"}),(0,l.jsx)(n.td,{children:"Major refactoring"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"Mode"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.code,{children:'"related"'})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.code,{children:'"full"'})})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"Trigger"})}),(0,l.jsx)(n.td,{children:"After commits"}),(0,l.jsx)(n.td,{children:"After major changes"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"Batching"})}),(0,l.jsx)(n.td,{children:"4 modules/agent"}),(0,l.jsx)(n.td,{children:"4 modules/agent"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"Fallback"})}),(0,l.jsx)(n.td,{children:"gemini\u2192qwen\u2192codex"}),(0,l.jsx)(n.td,{children:"gemini\u2192qwen\u2192codex"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"Complexity threshold"})}),(0,l.jsx)(n.td,{children:"<=15 modules"}),(0,l.jsx)(n.td,{children:"<=20 modules"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"Strategy"})}),(0,l.jsx)(n.td,{children:"single-layer only"}),(0,l.jsx)(n.td,{children:"multi-layer for depth>=3"})]})]})]}),"\n",(0,l.jsx)(n.h2,{id:"examples",children:"Examples"}),"\n",(0,l.jsx)(n.h3,{id:"basic-usage",children:"Basic Usage"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-bash",children:"# Update changed modules after commits\r\n/memory:update-related\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: Update 5 modules with gemini\u2192qwen\u2192codex fallback\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 updated\r\n# Safety check: Only CLAUDE.md modified \u2705\n"})}),"\n",(0,l.jsx)(n.h3,{id:"tool-selection",children:"Tool Selection"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-bash",children:"# Use Qwen for faster updates\r\n/memory:update-related --tool qwen\r\n\r\n# Tries qwen \u2192 gemini \u2192 codex\n"})}),"\n",(0,l.jsx)(n.h3,{id:"no-changes-detected",children:"No Changes Detected"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-bash",children:"# When no git changes found\r\n/memory:update-related\r\n\r\n# Output:\r\n# No git changes detected, using recent 10 modules\r\n# Plan: Update recent modules\n"})}),"\n",(0,l.jsx)(n.h2,{id:"related-commands",children:"Related Commands"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsxs)(n.strong,{children:["/memory",":update-full"]})," - Update all project modules"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsxs)(n.strong,{children:["/memory",":load"]})," - Load project context into memory"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsxs)(n.strong,{children:["/memory",":compact"]})," - Compact session memory"]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Direct execution"})," for <15 modules (faster, no agent overhead)"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Agent execution"})," for >=15 modules (better resource utilization)"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Smart filtering"})," automatically skips test/build/config directories"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Change detection"})," uses git diff to find affected modules"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Fallback"})," to recent modules when no changes detected"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Safety check"})," ensures only CLAUDE.md files are modified"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.strong,{children:"Git diff statistics"})," provide summary of changes"]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(c,{...e})}):c(e)}}}]);