@@ -15,13 +15,6 @@ const EXCLUDE_DIRS = [
1515 'coverage' , '.nyc_output' , 'logs' , 'tmp' , 'temp'
1616] ;
1717
18- // Default models for each tool
19- const DEFAULT_MODELS = {
20- gemini : 'gemini-2.5-flash' ,
21- qwen : 'coder-model' ,
22- codex : 'gpt5-codex'
23- } ;
24-
2518/**
2619 * Count files in directory
2720 */
@@ -159,33 +152,23 @@ function createPromptFile(prompt) {
159152}
160153
161154/**
162- * Build CLI command using stdin piping for prompt (avoids shell escaping issues)
155+ * Build ccw cli command using prompt file
163156 */
164157function buildCliCommand ( tool , promptFile , model ) {
165- // Use stdin piping: cat file | tool or Get-Content | tool
166- // This avoids shell escaping issues with multiline prompts
158+ // Use ccw cli with prompt file
159+ // ccw cli reads prompt from file when using -p @file syntax
167160 const normalizedPath = promptFile . replace ( / \\ / g, '/' ) ;
168161 const isWindows = process . platform === 'win32' ;
169-
170- // Build the cat/read command based on platform
171- const catCmd = isWindows ? `Get-Content -Raw "${ normalizedPath } " | ` : `cat "${ normalizedPath } " | ` ;
172-
173- switch ( tool ) {
174- case 'qwen' :
175- return model === 'coder-model'
176- ? `${ catCmd } qwen --yolo`
177- : `${ catCmd } qwen -m "${ model } " --yolo` ;
178- case 'codex' :
179- // codex uses different syntax - prompt as exec argument
180- if ( isWindows ) {
181- return `codex --full-auto exec (Get-Content -Raw "${ normalizedPath } ") -m "${ model } " --skip-git-repo-check -s danger-full-access` ;
182- }
183- return `codex --full-auto exec "$(cat "${ normalizedPath } ")" -m "${ model } " --skip-git-repo-check -s danger-full-access` ;
184- case 'gemini' :
185- default :
186- // gemini reads from stdin when no positional prompt is given
187- return `${ catCmd } gemini -m "${ model } " --yolo` ;
188- }
162+
163+ // Read prompt content for ccw cli -p parameter
164+ const promptContent = readFileSync ( promptFile , 'utf8' ) ;
165+
166+ // Escape single quotes in prompt for shell
167+ const escapedPrompt = promptContent . replace ( / ' / g, "'\\''" ) ;
168+
169+ // Build ccw cli command with --mode write
170+ // Format: ccw cli -p 'prompt content' --tool <tool> --model <model> --mode write
171+ return `ccw cli -p '${ escapedPrompt } ' --tool ${ tool } --model ${ model } --mode write` ;
189172}
190173
191174/**
@@ -227,8 +210,9 @@ async function execute(params) {
227210 } ;
228211 }
229212
230- // Set model
231- const actualModel = model || DEFAULT_MODELS [ tool ] || DEFAULT_MODELS . gemini ;
213+ // Set model - if not provided by user, use SECONDARY_MODEL alias
214+ // The ccw cli will resolve this to the actual secondary model from cli-tools.json
215+ const actualModel = model || 'SECONDARY_MODEL' ;
232216
233217 // Load template
234218 const templateContent = loadTemplate ( ) ;
@@ -344,13 +328,15 @@ Instructions:
344328 */
345329export const updateModuleClaudeTool = {
346330 name : 'update_module_claude' ,
347- description : `Generate/update CLAUDE.md module documentation using CLI tools .
331+ description : `Generate/update CLAUDE.md module documentation using ccw cli .
348332
349333Strategies:
350334- single-layer: Read current dir code + child CLAUDE.md, generate ./CLAUDE.md
351335- multi-layer: Read all files, generate CLAUDE.md for each directory
352336
353- Tools: gemini (default), qwen, codex` ,
337+ Tools: gemini (default), qwen, codex
338+ Model: Supports model aliases (PRIMARY_MODEL, SECONDARY_MODEL) or explicit model names
339+ Default: SECONDARY_MODEL (resolved from ~/.claude/cli-tools.json)` ,
354340 parameters : {
355341 type : 'object' ,
356342 properties : {
0 commit comments