claude-code-workflow 6.0.5 → 6.1.0

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 (117) hide show
  1. package/.claude/agents/action-planning-agent.md +1 -1
  2. package/.claude/agents/cli-execution-agent.md +269 -269
  3. package/.claude/agents/cli-explore-agent.md +182 -182
  4. package/.claude/agents/context-search-agent.md +582 -582
  5. package/.claude/agents/memory-bridge.md +93 -93
  6. package/.claude/commands/cli/cli-init.md +1 -1
  7. package/.claude/commands/memory/docs-full-cli.md +471 -471
  8. package/.claude/commands/memory/docs-related-cli.md +386 -386
  9. package/.claude/commands/memory/docs.md +615 -615
  10. package/.claude/commands/memory/load.md +1 -1
  11. package/.claude/commands/memory/update-full.md +332 -332
  12. package/.claude/commands/memory/update-related.md +5 -5
  13. package/.claude/commands/workflow/init.md +1 -1
  14. package/.claude/commands/workflow/lite-fix.md +621 -621
  15. package/.claude/commands/workflow/lite-plan.md +592 -592
  16. package/.claude/commands/workflow/tools/context-gather.md +434 -434
  17. package/.claude/commands/workflow/ui-design/generate.md +504 -504
  18. package/.claude/commands/workflow/ui-design/import-from-code.md +537 -537
  19. package/.claude/scripts/classify-folders.sh +4 -0
  20. package/.claude/scripts/convert_tokens_to_css.sh +4 -0
  21. package/.claude/scripts/detect_changed_modules.sh +5 -1
  22. package/.claude/scripts/discover-design-files.sh +87 -83
  23. package/.claude/scripts/generate_module_docs.sh +717 -713
  24. package/.claude/scripts/get_modules_by_depth.sh +5 -1
  25. package/.claude/scripts/ui-generate-preview.sh +4 -0
  26. package/.claude/scripts/ui-instantiate-prototypes.sh +4 -0
  27. package/.claude/scripts/update_module_claude.sh +4 -0
  28. package/.claude/skills/command-guide/index/all-commands.json +1 -12
  29. package/.claude/skills/command-guide/index/by-category.json +1 -12
  30. package/.claude/skills/command-guide/index/by-use-case.json +1 -12
  31. package/.claude/skills/command-guide/index/essential-commands.json +1 -12
  32. package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +127 -71
  33. package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +269 -269
  34. package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +182 -182
  35. package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +18 -38
  36. package/.claude/skills/command-guide/reference/agents/context-search-agent.md +582 -577
  37. package/.claude/skills/command-guide/reference/agents/memory-bridge.md +93 -93
  38. package/.claude/skills/command-guide/reference/commands/cli/cli-init.md +1 -1
  39. package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +471 -471
  40. package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +386 -386
  41. package/.claude/skills/command-guide/reference/commands/memory/docs.md +615 -610
  42. package/.claude/skills/command-guide/reference/commands/memory/load.md +1 -1
  43. package/.claude/skills/command-guide/reference/commands/memory/update-full.md +332 -332
  44. package/.claude/skills/command-guide/reference/commands/memory/update-related.md +5 -5
  45. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/artifacts.md +299 -451
  46. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +14 -37
  47. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/synthesis.md +252 -350
  48. package/.claude/skills/command-guide/reference/commands/workflow/init.md +2 -2
  49. package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +52 -0
  50. package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +621 -602
  51. package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +46 -36
  52. package/.claude/skills/command-guide/reference/commands/workflow/review-fix.md +18 -58
  53. package/.claude/skills/command-guide/reference/commands/workflow/review-module-cycle.md +22 -52
  54. package/.claude/skills/command-guide/reference/commands/workflow/review-session-cycle.md +19 -48
  55. package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +25 -5
  56. package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +1 -1
  57. package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +7 -7
  58. package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +434 -434
  59. package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +151 -11
  60. package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +4 -4
  61. package/.claude/skills/command-guide/reference/commands/workflow/tools/test-task-generate.md +1 -1
  62. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/generate.md +504 -504
  63. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +537 -537
  64. package/.claude/workflows/context-search-strategy.md +77 -77
  65. package/.claude/workflows/tool-strategy.md +90 -71
  66. package/.claude/workflows/workflow-architecture.md +1 -1
  67. package/ccw/src/cli.js +7 -0
  68. package/ccw/src/commands/tool.js +181 -0
  69. package/ccw/src/core/dashboard-generator.js +18 -3
  70. package/ccw/src/core/lite-scanner.js +35 -11
  71. package/ccw/src/core/server.js +531 -46
  72. package/ccw/src/templates/dashboard-css/01-base.css +161 -0
  73. package/ccw/src/templates/dashboard-css/02-session.css +726 -0
  74. package/ccw/src/templates/dashboard-css/03-tasks.css +512 -0
  75. package/ccw/src/templates/dashboard-css/04-lite-tasks.css +843 -0
  76. package/ccw/src/templates/dashboard-css/05-context.css +2206 -0
  77. package/ccw/src/templates/dashboard-css/06-cards.css +1570 -0
  78. package/ccw/src/templates/dashboard-css/07-managers.css +936 -0
  79. package/ccw/src/templates/dashboard-css/08-review.css +1266 -0
  80. package/ccw/src/templates/dashboard-css/09-explorer.css +1397 -0
  81. package/ccw/src/templates/dashboard-js/components/global-notifications.js +219 -0
  82. package/ccw/src/templates/dashboard-js/components/hook-manager.js +10 -0
  83. package/ccw/src/templates/dashboard-js/components/mcp-manager.js +11 -1
  84. package/ccw/src/templates/dashboard-js/components/navigation.js +11 -5
  85. package/ccw/src/templates/dashboard-js/components/tabs-context.js +20 -20
  86. package/ccw/src/templates/dashboard-js/components/tabs-other.js +11 -11
  87. package/ccw/src/templates/dashboard-js/components/theme.js +29 -1
  88. package/ccw/src/templates/dashboard-js/main.js +4 -0
  89. package/ccw/src/templates/dashboard-js/state.js +5 -0
  90. package/ccw/src/templates/dashboard-js/views/explorer.js +852 -0
  91. package/ccw/src/templates/dashboard-js/views/home.js +13 -9
  92. package/ccw/src/templates/dashboard-js/views/hook-manager.js +8 -5
  93. package/ccw/src/templates/dashboard-js/views/lite-tasks.js +21 -16
  94. package/ccw/src/templates/dashboard-js/views/mcp-manager.js +90 -19
  95. package/ccw/src/templates/dashboard-js/views/project-overview.js +15 -11
  96. package/ccw/src/templates/dashboard-js/views/review-session.js +3 -3
  97. package/ccw/src/templates/dashboard-js/views/session-detail.js +38 -28
  98. package/ccw/src/templates/dashboard.html +129 -28
  99. package/ccw/src/tools/classify-folders.js +204 -0
  100. package/ccw/src/tools/convert-tokens-to-css.js +250 -0
  101. package/ccw/src/tools/detect-changed-modules.js +288 -0
  102. package/ccw/src/tools/discover-design-files.js +134 -0
  103. package/ccw/src/tools/edit-file.js +266 -0
  104. package/ccw/src/tools/generate-module-docs.js +416 -0
  105. package/ccw/src/tools/get-modules-by-depth.js +308 -0
  106. package/ccw/src/tools/index.js +176 -0
  107. package/ccw/src/tools/ui-generate-preview.js +327 -0
  108. package/ccw/src/tools/ui-instantiate-prototypes.js +301 -0
  109. package/ccw/src/tools/update-module-claude.js +380 -0
  110. package/package.json +1 -1
  111. package/.claude/skills/command-guide/reference/commands/workflow/status.md +0 -352
  112. package/ccw/src/core/server.js.bak +0 -385
  113. package/ccw/src/core/server_original.bak +0 -385
  114. package/ccw/src/templates/dashboard.css +0 -8187
  115. package/ccw/src/templates/dashboard_tailwind.html +0 -42
  116. package/ccw/src/templates/dashboard_test.html +0 -37
  117. package/ccw/src/templates/tailwind-base.css +0 -212
@@ -0,0 +1,416 @@
1
+ /**
2
+ * Generate Module Docs Tool
3
+ * Generate documentation for modules and projects with multiple strategies
4
+ */
5
+
6
+ import { readdirSync, statSync, existsSync, readFileSync, mkdirSync, writeFileSync, unlinkSync } from 'fs';
7
+ import { join, resolve, basename, extname, relative } from 'path';
8
+ import { execSync } from 'child_process';
9
+ import { tmpdir } from 'os';
10
+
11
+ // Directories to exclude
12
+ const EXCLUDE_DIRS = [
13
+ '.git', '__pycache__', 'node_modules', '.venv', 'venv', 'env',
14
+ 'dist', 'build', '.cache', '.pytest_cache', '.mypy_cache',
15
+ 'coverage', '.nyc_output', 'logs', 'tmp', 'temp', '.workflow'
16
+ ];
17
+
18
+ // Code file extensions
19
+ const CODE_EXTENSIONS = [
20
+ '.ts', '.tsx', '.js', '.jsx', '.py', '.sh', '.go', '.rs'
21
+ ];
22
+
23
+ // Default models for each tool
24
+ const DEFAULT_MODELS = {
25
+ gemini: 'gemini-2.5-flash',
26
+ qwen: 'coder-model',
27
+ codex: 'gpt5-codex'
28
+ };
29
+
30
+ // Template paths (relative to user home directory)
31
+ const TEMPLATE_BASE = '.claude/workflows/cli-templates/prompts/documentation';
32
+
33
+ /**
34
+ * Detect folder type (code vs navigation)
35
+ */
36
+ function detectFolderType(dirPath) {
37
+ try {
38
+ const entries = readdirSync(dirPath, { withFileTypes: true });
39
+ const codeFiles = entries.filter(e => {
40
+ if (!e.isFile()) return false;
41
+ const ext = extname(e.name).toLowerCase();
42
+ return CODE_EXTENSIONS.includes(ext);
43
+ });
44
+ return codeFiles.length > 0 ? 'code' : 'navigation';
45
+ } catch (e) {
46
+ return 'navigation';
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Count files in directory
52
+ */
53
+ function countFiles(dirPath) {
54
+ try {
55
+ const entries = readdirSync(dirPath, { withFileTypes: true });
56
+ return entries.filter(e => e.isFile() && !e.name.startsWith('.')).length;
57
+ } catch (e) {
58
+ return 0;
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Calculate output path
64
+ */
65
+ function calculateOutputPath(sourcePath, projectName, projectRoot) {
66
+ const absSource = resolve(sourcePath);
67
+ const normRoot = resolve(projectRoot);
68
+ let relPath = relative(normRoot, absSource);
69
+ relPath = relPath.replace(/\\/g, '/');
70
+
71
+ return join('.workflow', 'docs', projectName, relPath);
72
+ }
73
+
74
+ /**
75
+ * Load template content
76
+ */
77
+ function loadTemplate(templateName) {
78
+ const homePath = process.env.HOME || process.env.USERPROFILE;
79
+ const templatePath = join(homePath, TEMPLATE_BASE, `${templateName}.txt`);
80
+
81
+ if (existsSync(templatePath)) {
82
+ return readFileSync(templatePath, 'utf8');
83
+ }
84
+
85
+ // Fallback templates
86
+ const fallbacks = {
87
+ 'api': 'Generate API documentation with function signatures, parameters, return values, and usage examples.',
88
+ 'module-readme': 'Generate README documentation with purpose, usage, configuration, and examples.',
89
+ 'folder-navigation': 'Generate navigation README with overview of subdirectories and their purposes.',
90
+ 'project-readme': 'Generate project README with overview, installation, usage, and configuration.',
91
+ 'project-architecture': 'Generate ARCHITECTURE.md with system design, components, and data flow.'
92
+ };
93
+
94
+ return fallbacks[templateName] || 'Generate comprehensive documentation.';
95
+ }
96
+
97
+ /**
98
+ * Create temporary prompt file and return path
99
+ */
100
+ function createPromptFile(prompt) {
101
+ const timestamp = Date.now();
102
+ const randomSuffix = Math.random().toString(36).substring(2, 8);
103
+ const promptFile = join(tmpdir(), `docs-prompt-${timestamp}-${randomSuffix}.txt`);
104
+ writeFileSync(promptFile, prompt, 'utf8');
105
+ return promptFile;
106
+ }
107
+
108
+ /**
109
+ * Build CLI command using stdin piping (avoids shell escaping issues)
110
+ */
111
+ function buildCliCommand(tool, promptFile, model) {
112
+ const normalizedPath = promptFile.replace(/\\/g, '/');
113
+ const isWindows = process.platform === 'win32';
114
+
115
+ // Build the cat/read command based on platform
116
+ const catCmd = isWindows ? `Get-Content -Raw "${normalizedPath}" | ` : `cat "${normalizedPath}" | `;
117
+
118
+ switch (tool) {
119
+ case 'qwen':
120
+ return model === 'coder-model'
121
+ ? `${catCmd}qwen --yolo`
122
+ : `${catCmd}qwen -m "${model}" --yolo`;
123
+ case 'codex':
124
+ // codex uses different syntax - prompt as exec argument
125
+ if (isWindows) {
126
+ return `codex --full-auto exec (Get-Content -Raw "${normalizedPath}") -m "${model}" --skip-git-repo-check -s danger-full-access`;
127
+ }
128
+ return `codex --full-auto exec "$(cat "${normalizedPath}")" -m "${model}" --skip-git-repo-check -s danger-full-access`;
129
+ case 'gemini':
130
+ default:
131
+ return `${catCmd}gemini -m "${model}" --yolo`;
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Scan directory structure
137
+ */
138
+ function scanDirectoryStructure(targetPath, strategy) {
139
+ const lines = [];
140
+ const dirName = basename(targetPath);
141
+
142
+ let totalFiles = 0;
143
+ let totalDirs = 0;
144
+
145
+ function countRecursive(dir) {
146
+ try {
147
+ const entries = readdirSync(dir, { withFileTypes: true });
148
+ entries.forEach(e => {
149
+ if (e.name.startsWith('.') || EXCLUDE_DIRS.includes(e.name)) return;
150
+ if (e.isFile()) totalFiles++;
151
+ else if (e.isDirectory()) {
152
+ totalDirs++;
153
+ countRecursive(join(dir, e.name));
154
+ }
155
+ });
156
+ } catch (e) {
157
+ // Ignore
158
+ }
159
+ }
160
+
161
+ countRecursive(targetPath);
162
+ const folderType = detectFolderType(targetPath);
163
+
164
+ lines.push(`Directory: ${dirName}`);
165
+ lines.push(`Total files: ${totalFiles}`);
166
+ lines.push(`Total directories: ${totalDirs}`);
167
+ lines.push(`Folder type: ${folderType}`);
168
+
169
+ return {
170
+ info: lines.join('\n'),
171
+ folderType
172
+ };
173
+ }
174
+
175
+ /**
176
+ * Main execute function
177
+ */
178
+ async function execute(params) {
179
+ const { strategy, sourcePath, projectName, tool = 'gemini', model } = params;
180
+
181
+ // Validate parameters
182
+ const validStrategies = ['full', 'single', 'project-readme', 'project-architecture', 'http-api'];
183
+
184
+ if (!strategy) {
185
+ throw new Error(`Parameter "strategy" is required. Valid: ${validStrategies.join(', ')}`);
186
+ }
187
+
188
+ if (!validStrategies.includes(strategy)) {
189
+ throw new Error(`Invalid strategy '${strategy}'. Valid: ${validStrategies.join(', ')}`);
190
+ }
191
+
192
+ if (!sourcePath) {
193
+ throw new Error('Parameter "sourcePath" is required');
194
+ }
195
+
196
+ if (!projectName) {
197
+ throw new Error('Parameter "projectName" is required');
198
+ }
199
+
200
+ const targetPath = resolve(process.cwd(), sourcePath);
201
+
202
+ if (!existsSync(targetPath)) {
203
+ throw new Error(`Directory not found: ${targetPath}`);
204
+ }
205
+
206
+ if (!statSync(targetPath).isDirectory()) {
207
+ throw new Error(`Not a directory: ${targetPath}`);
208
+ }
209
+
210
+ // Set model
211
+ const actualModel = model || DEFAULT_MODELS[tool] || DEFAULT_MODELS.gemini;
212
+
213
+ // Scan directory
214
+ const { info: structureInfo, folderType } = scanDirectoryStructure(targetPath, strategy);
215
+
216
+ // Calculate output path
217
+ const outputPath = calculateOutputPath(targetPath, projectName, process.cwd());
218
+
219
+ // Ensure output directory exists
220
+ mkdirSync(outputPath, { recursive: true });
221
+
222
+ // Build prompt based on strategy
223
+ let prompt;
224
+ let templateContent;
225
+
226
+ switch (strategy) {
227
+ case 'full':
228
+ case 'single':
229
+ if (folderType === 'code') {
230
+ templateContent = loadTemplate('api');
231
+ prompt = `Directory Structure Analysis:
232
+ ${structureInfo}
233
+
234
+ Read: ${strategy === 'full' ? '@**/*' : '@*.ts @*.tsx @*.js @*.jsx @*.py @*.sh @*.md @*.json'}
235
+
236
+ Generate documentation files:
237
+ - API.md: Code API documentation
238
+ - README.md: Module overview and usage
239
+
240
+ Output directory: ${outputPath}
241
+
242
+ Template Guidelines:
243
+ ${templateContent}`;
244
+ } else {
245
+ templateContent = loadTemplate('folder-navigation');
246
+ prompt = `Directory Structure Analysis:
247
+ ${structureInfo}
248
+
249
+ Read: @*/API.md @*/README.md
250
+
251
+ Generate documentation file:
252
+ - README.md: Navigation overview of subdirectories
253
+
254
+ Output directory: ${outputPath}
255
+
256
+ Template Guidelines:
257
+ ${templateContent}`;
258
+ }
259
+ break;
260
+
261
+ case 'project-readme':
262
+ templateContent = loadTemplate('project-readme');
263
+ prompt = `Read all module documentation:
264
+ @.workflow/docs/${projectName}/**/API.md
265
+ @.workflow/docs/${projectName}/**/README.md
266
+
267
+ Generate project-level documentation:
268
+ - README.md in .workflow/docs/${projectName}/
269
+
270
+ Template Guidelines:
271
+ ${templateContent}`;
272
+ break;
273
+
274
+ case 'project-architecture':
275
+ templateContent = loadTemplate('project-architecture');
276
+ prompt = `Read project documentation:
277
+ @.workflow/docs/${projectName}/README.md
278
+ @.workflow/docs/${projectName}/**/API.md
279
+
280
+ Generate:
281
+ - ARCHITECTURE.md: System design documentation
282
+ - EXAMPLES.md: Usage examples
283
+
284
+ Output directory: .workflow/docs/${projectName}/
285
+
286
+ Template Guidelines:
287
+ ${templateContent}`;
288
+ break;
289
+
290
+ case 'http-api':
291
+ prompt = `Read API route files:
292
+ @**/routes/**/*.ts @**/routes/**/*.js
293
+ @**/api/**/*.ts @**/api/**/*.js
294
+
295
+ Generate HTTP API documentation:
296
+ - api/README.md: REST API endpoints documentation
297
+
298
+ Output directory: .workflow/docs/${projectName}/api/`;
299
+ break;
300
+ }
301
+
302
+ // Create temporary prompt file (avoids shell escaping issues)
303
+ const promptFile = createPromptFile(prompt);
304
+
305
+ // Build command using file-based prompt
306
+ const command = buildCliCommand(tool, promptFile, actualModel);
307
+
308
+ // Log execution info
309
+ console.log(`📚 Generating docs: ${sourcePath}`);
310
+ console.log(` Strategy: ${strategy} | Tool: ${tool} | Model: ${actualModel}`);
311
+ console.log(` Output: ${outputPath}`);
312
+ console.log(` Prompt file: ${promptFile}`);
313
+
314
+ try {
315
+ const startTime = Date.now();
316
+
317
+ execSync(command, {
318
+ cwd: targetPath,
319
+ encoding: 'utf8',
320
+ stdio: 'inherit',
321
+ timeout: 600000, // 10 minutes
322
+ shell: process.platform === 'win32' ? 'powershell.exe' : '/bin/bash'
323
+ });
324
+
325
+ const duration = Math.round((Date.now() - startTime) / 1000);
326
+
327
+ // Cleanup prompt file
328
+ try {
329
+ unlinkSync(promptFile);
330
+ } catch (e) {
331
+ // Ignore cleanup errors
332
+ }
333
+
334
+ console.log(` ✅ Completed in ${duration}s`);
335
+
336
+ return {
337
+ success: true,
338
+ strategy,
339
+ source_path: sourcePath,
340
+ project_name: projectName,
341
+ output_path: outputPath,
342
+ folder_type: folderType,
343
+ tool,
344
+ model: actualModel,
345
+ duration_seconds: duration,
346
+ message: `Documentation generated successfully in ${duration}s`
347
+ };
348
+ } catch (error) {
349
+ // Cleanup prompt file on error
350
+ try {
351
+ unlinkSync(promptFile);
352
+ } catch (e) {
353
+ // Ignore cleanup errors
354
+ }
355
+
356
+ console.log(` ❌ Generation failed: ${error.message}`);
357
+
358
+ return {
359
+ success: false,
360
+ strategy,
361
+ source_path: sourcePath,
362
+ project_name: projectName,
363
+ tool,
364
+ error: error.message
365
+ };
366
+ }
367
+ }
368
+
369
+ /**
370
+ * Tool Definition
371
+ */
372
+ export const generateModuleDocsTool = {
373
+ name: 'generate_module_docs',
374
+ description: `Generate documentation for modules and projects.
375
+
376
+ Module-Level Strategies:
377
+ - full: Full documentation (API.md + README.md for all directories)
378
+ - single: Single-layer documentation (current directory only)
379
+
380
+ Project-Level Strategies:
381
+ - project-readme: Project overview from module docs
382
+ - project-architecture: System design documentation
383
+ - http-api: HTTP API documentation
384
+
385
+ Output: .workflow/docs/{projectName}/...`,
386
+ parameters: {
387
+ type: 'object',
388
+ properties: {
389
+ strategy: {
390
+ type: 'string',
391
+ enum: ['full', 'single', 'project-readme', 'project-architecture', 'http-api'],
392
+ description: 'Documentation strategy'
393
+ },
394
+ sourcePath: {
395
+ type: 'string',
396
+ description: 'Source module directory path'
397
+ },
398
+ projectName: {
399
+ type: 'string',
400
+ description: 'Project name for output path'
401
+ },
402
+ tool: {
403
+ type: 'string',
404
+ enum: ['gemini', 'qwen', 'codex'],
405
+ description: 'CLI tool to use (default: gemini)',
406
+ default: 'gemini'
407
+ },
408
+ model: {
409
+ type: 'string',
410
+ description: 'Model name (optional, uses tool defaults)'
411
+ }
412
+ },
413
+ required: ['strategy', 'sourcePath', 'projectName']
414
+ },
415
+ execute
416
+ };