claude-code-workflow 6.3.43 → 6.3.44

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 (77) hide show
  1. package/.claude/agents/tdd-developer.md +530 -0
  2. package/.claude/commands/issue/discover-by-prompt.md +5 -1
  3. package/.claude/commands/issue/discover.md +472 -468
  4. package/.claude/commands/issue/execute.md +580 -581
  5. package/.claude/commands/issue/new.md +417 -413
  6. package/.claude/commands/issue/plan.md +5 -1
  7. package/.claude/commands/issue/queue.md +445 -441
  8. package/.claude/commands/task/breakdown.md +207 -203
  9. package/.claude/commands/task/replan.md +440 -436
  10. package/.claude/commands/workflow/action-plan-verify.md +485 -447
  11. package/.claude/commands/workflow/brainstorm/artifacts.md +457 -453
  12. package/.claude/commands/workflow/brainstorm/auto-parallel.md +5 -1
  13. package/.claude/commands/workflow/brainstorm/synthesis.md +402 -398
  14. package/.claude/commands/workflow/clean.md +67 -35
  15. package/.claude/commands/workflow/debug-with-file.md +670 -666
  16. package/.claude/commands/workflow/debug.md +331 -327
  17. package/.claude/commands/workflow/develop-with-file.md +5 -1
  18. package/.claude/commands/workflow/execute.md +546 -498
  19. package/.claude/commands/workflow/lite-execute.md +44 -26
  20. package/.claude/commands/workflow/lite-fix.md +780 -730
  21. package/.claude/commands/workflow/lite-lite-lite.md +5 -1
  22. package/.claude/commands/workflow/lite-plan.md +87 -39
  23. package/.claude/commands/workflow/multi-cli-plan.md +572 -568
  24. package/.claude/commands/workflow/plan-verify.md +527 -0
  25. package/.claude/commands/workflow/plan.md +555 -551
  26. package/.claude/commands/workflow/replan.md +572 -515
  27. package/.claude/commands/workflow/review-fix.md +608 -610
  28. package/.claude/commands/workflow/session/complete.md +37 -14
  29. package/.claude/commands/workflow/session/solidify.md +303 -299
  30. package/.claude/commands/workflow/tdd-plan.md +630 -597
  31. package/.claude/commands/workflow/tdd-verify.md +391 -206
  32. package/.claude/commands/workflow/tools/conflict-resolution.md +24 -12
  33. package/.claude/commands/workflow/tools/task-generate-agent.md +583 -563
  34. package/.claude/commands/workflow/tools/task-generate-tdd.md +749 -517
  35. package/.claude/commands/workflow/ui-design/animation-extract.md +1154 -1150
  36. package/.claude/commands/workflow/ui-design/layout-extract.md +792 -788
  37. package/.claude/commands/workflow/ui-design/style-extract.md +777 -773
  38. package/.claude/skills/ccw/command.json +4 -4
  39. package/.claude/skills/ccw-coordinator/README.md +45 -0
  40. package/.claude/skills/ccw-coordinator/SKILL.md +320 -0
  41. package/.claude/skills/ccw-coordinator/phases/actions/action-abort.md +9 -0
  42. package/.claude/skills/ccw-coordinator/phases/actions/action-command-build.md +40 -0
  43. package/.claude/skills/ccw-coordinator/phases/actions/action-command-execute.md +124 -0
  44. package/.claude/skills/ccw-coordinator/phases/actions/action-command-selection.md +48 -0
  45. package/.claude/skills/ccw-coordinator/phases/actions/action-complete.md +25 -0
  46. package/.claude/skills/ccw-coordinator/phases/actions/action-init.md +26 -0
  47. package/.claude/skills/ccw-coordinator/phases/orchestrator.md +59 -0
  48. package/.claude/skills/ccw-coordinator/phases/state-schema.md +66 -0
  49. package/.claude/skills/ccw-coordinator/skill-config.json +66 -0
  50. package/.claude/skills/ccw-coordinator/specs/command-library.md +169 -0
  51. package/.claude/skills/ccw-coordinator/specs/specs.md +362 -0
  52. package/.claude/skills/ccw-coordinator/tools/README.md +95 -0
  53. package/.claude/skills/ccw-coordinator/tools/chain-validate.cjs +320 -0
  54. package/.claude/skills/ccw-coordinator/tools/command-registry.cjs +255 -0
  55. package/.claude/skills/ccw-help/command.json +5 -5
  56. package/.claude/skills/ccw-help/scripts/analyze_commands.py +337 -337
  57. package/.claude/workflows/cli-templates/prompts/workflow-impl-plan-template.txt +1 -1
  58. package/ccw/dist/commands/issue.d.ts +4 -0
  59. package/ccw/dist/commands/issue.d.ts.map +1 -1
  60. package/ccw/dist/commands/issue.js +73 -6
  61. package/ccw/dist/commands/issue.js.map +1 -1
  62. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  63. package/ccw/dist/core/routes/cli-routes.js +32 -28
  64. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  65. package/ccw/dist/tools/claude-cli-tools.d.ts +10 -0
  66. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  67. package/ccw/dist/tools/claude-cli-tools.js +45 -0
  68. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  69. package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
  70. package/ccw/dist/tools/codex-lens.js +38 -11
  71. package/ccw/dist/tools/codex-lens.js.map +1 -1
  72. package/ccw/src/commands/issue.ts +84 -6
  73. package/ccw/src/core/routes/cli-routes.ts +30 -25
  74. package/ccw/src/templates/dashboard-js/views/help.js +1 -1
  75. package/ccw/src/tools/claude-cli-tools.ts +50 -0
  76. package/ccw/src/tools/codex-lens.ts +40 -11
  77. package/package.json +1 -1
@@ -0,0 +1,320 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Chain Validation Tool
5
+ *
6
+ * Validates workflow command chains against defined rules.
7
+ *
8
+ * Usage:
9
+ * node chain-validate.js plan execute test-cycle-execute
10
+ * node chain-validate.js --json "plan,execute,test-cycle-execute"
11
+ * node chain-validate.js --file custom-chain.json
12
+ */
13
+
14
+ const fs = require('fs');
15
+ const path = require('path');
16
+
17
+ // Optional registry loading - gracefully degrade if not found
18
+ let registry = null;
19
+ try {
20
+ const registryPath = path.join(__dirname, '..', 'specs', 'chain-registry.json');
21
+ if (fs.existsSync(registryPath)) {
22
+ registry = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
23
+ }
24
+ } catch (error) {
25
+ // Registry not available - dependency validation will be skipped
26
+ }
27
+
28
+ class ChainValidator {
29
+ constructor(registry) {
30
+ this.registry = registry;
31
+ this.errors = [];
32
+ this.warnings = [];
33
+ }
34
+
35
+ validate(chain) {
36
+ this.errors = [];
37
+ this.warnings = [];
38
+
39
+ this.validateSinglePlanning(chain);
40
+ this.validateCompatiblePairs(chain);
41
+ this.validateTestingPosition(chain);
42
+ this.validateReviewPosition(chain);
43
+ this.validateBugfixStandalone(chain);
44
+ this.validateDependencies(chain);
45
+ this.validateNoRedundancy(chain);
46
+ this.validateCommandExistence(chain);
47
+
48
+ return {
49
+ valid: this.errors.length === 0,
50
+ errors: this.errors,
51
+ warnings: this.warnings
52
+ };
53
+ }
54
+
55
+ validateSinglePlanning(chain) {
56
+ const planningCommands = chain.filter(cmd =>
57
+ ['plan', 'lite-plan', 'multi-cli-plan', 'tdd-plan'].includes(cmd)
58
+ );
59
+
60
+ if (planningCommands.length > 1) {
61
+ this.errors.push({
62
+ rule: 'Single Planning Command',
63
+ message: `Too many planning commands: ${planningCommands.join(', ')}`,
64
+ severity: 'error'
65
+ });
66
+ }
67
+ }
68
+
69
+ validateCompatiblePairs(chain) {
70
+ const compatibility = {
71
+ 'lite-plan': ['lite-execute'],
72
+ 'multi-cli-plan': ['lite-execute', 'execute'],
73
+ 'plan': ['execute'],
74
+ 'tdd-plan': ['execute']
75
+ };
76
+
77
+ const planningCmd = chain.find(cmd =>
78
+ ['plan', 'lite-plan', 'multi-cli-plan', 'tdd-plan'].includes(cmd)
79
+ );
80
+
81
+ const executionCmd = chain.find(cmd =>
82
+ ['execute', 'lite-execute'].includes(cmd)
83
+ );
84
+
85
+ if (planningCmd && executionCmd) {
86
+ const compatible = compatibility[planningCmd] || [];
87
+ if (!compatible.includes(executionCmd)) {
88
+ this.errors.push({
89
+ rule: 'Compatible Pairs',
90
+ message: `${planningCmd} incompatible with ${executionCmd}`,
91
+ fix: `Use ${planningCmd} with ${compatible.join(' or ')}`,
92
+ severity: 'error'
93
+ });
94
+ }
95
+ }
96
+ }
97
+
98
+ validateTestingPosition(chain) {
99
+ const executionIdx = chain.findIndex(cmd =>
100
+ ['execute', 'lite-execute', 'develop-with-file'].includes(cmd)
101
+ );
102
+
103
+ const testingIdx = chain.findIndex(cmd =>
104
+ ['test-cycle-execute', 'tdd-verify', 'test-gen', 'test-fix-gen'].includes(cmd)
105
+ );
106
+
107
+ if (testingIdx !== -1 && executionIdx !== -1 && executionIdx > testingIdx) {
108
+ this.errors.push({
109
+ rule: 'Testing After Execution',
110
+ message: 'Testing commands must come after execution',
111
+ severity: 'error'
112
+ });
113
+ }
114
+
115
+ if (testingIdx !== -1 && executionIdx === -1) {
116
+ const hasTestGen = chain.some(cmd => ['test-gen', 'test-fix-gen'].includes(cmd));
117
+ if (!hasTestGen) {
118
+ this.warnings.push({
119
+ rule: 'Testing After Execution',
120
+ message: 'test-cycle-execute without execution context - needs test-gen or execute first',
121
+ severity: 'warning'
122
+ });
123
+ }
124
+ }
125
+ }
126
+
127
+ validateReviewPosition(chain) {
128
+ const executionIdx = chain.findIndex(cmd =>
129
+ ['execute', 'lite-execute'].includes(cmd)
130
+ );
131
+
132
+ const reviewIdx = chain.findIndex(cmd =>
133
+ cmd.includes('review')
134
+ );
135
+
136
+ if (reviewIdx !== -1 && executionIdx !== -1 && executionIdx > reviewIdx) {
137
+ this.errors.push({
138
+ rule: 'Review After Changes',
139
+ message: 'Review commands must come after execution',
140
+ severity: 'error'
141
+ });
142
+ }
143
+
144
+ if (reviewIdx !== -1 && executionIdx === -1) {
145
+ const isModuleReview = chain[reviewIdx] === 'review-module-cycle';
146
+ if (!isModuleReview) {
147
+ this.warnings.push({
148
+ rule: 'Review After Changes',
149
+ message: 'Review without execution - needs git changes to review',
150
+ severity: 'warning'
151
+ });
152
+ }
153
+ }
154
+ }
155
+
156
+ validateBugfixStandalone(chain) {
157
+ if (chain.includes('lite-fix')) {
158
+ const others = chain.filter(cmd => cmd !== 'lite-fix');
159
+ if (others.length > 0) {
160
+ this.errors.push({
161
+ rule: 'BugFix Standalone',
162
+ message: 'lite-fix must be standalone, cannot combine with other commands',
163
+ fix: 'Use lite-fix alone OR use plan + execute for larger changes',
164
+ severity: 'error'
165
+ });
166
+ }
167
+ }
168
+ }
169
+
170
+ validateDependencies(chain) {
171
+ // Skip if registry not available
172
+ if (!this.registry || !this.registry.commands) {
173
+ return;
174
+ }
175
+
176
+ for (let i = 0; i < chain.length; i++) {
177
+ const cmd = chain[i];
178
+ const cmdMeta = this.registry.commands[cmd];
179
+
180
+ if (!cmdMeta) continue;
181
+
182
+ const deps = cmdMeta.dependencies || [];
183
+ const depsOptional = cmdMeta.dependencies_optional || false;
184
+
185
+ if (deps.length > 0 && !depsOptional) {
186
+ const hasDependency = deps.some(dep => {
187
+ const depIdx = chain.indexOf(dep);
188
+ return depIdx !== -1 && depIdx < i;
189
+ });
190
+
191
+ if (!hasDependency) {
192
+ this.errors.push({
193
+ rule: 'Dependency Satisfaction',
194
+ message: `${cmd} requires ${deps.join(' or ')} before it`,
195
+ severity: 'error'
196
+ });
197
+ }
198
+ }
199
+ }
200
+ }
201
+
202
+ validateNoRedundancy(chain) {
203
+ const seen = new Set();
204
+ const duplicates = [];
205
+
206
+ for (const cmd of chain) {
207
+ if (seen.has(cmd)) {
208
+ duplicates.push(cmd);
209
+ }
210
+ seen.add(cmd);
211
+ }
212
+
213
+ if (duplicates.length > 0) {
214
+ this.errors.push({
215
+ rule: 'No Redundant Commands',
216
+ message: `Duplicate commands: ${duplicates.join(', ')}`,
217
+ severity: 'error'
218
+ });
219
+ }
220
+ }
221
+
222
+ validateCommandExistence(chain) {
223
+ // Skip if registry not available
224
+ if (!this.registry || !this.registry.commands) {
225
+ return;
226
+ }
227
+
228
+ for (const cmd of chain) {
229
+ if (!this.registry.commands[cmd]) {
230
+ this.errors.push({
231
+ rule: 'Command Existence',
232
+ message: `Unknown command: ${cmd}`,
233
+ severity: 'error'
234
+ });
235
+ }
236
+ }
237
+ }
238
+ }
239
+
240
+ function main() {
241
+ const args = process.argv.slice(2);
242
+
243
+ if (args.length === 0) {
244
+ console.log('Usage:');
245
+ console.log(' chain-validate.js <command1> <command2> ...');
246
+ console.log(' chain-validate.js --json "cmd1,cmd2,cmd3"');
247
+ console.log(' chain-validate.js --file chain.json');
248
+ process.exit(1);
249
+ }
250
+
251
+ let chain;
252
+
253
+ if (args[0] === '--json') {
254
+ chain = args[1].split(',').map(s => s.trim());
255
+ } else if (args[0] === '--file') {
256
+ const filePath = args[1];
257
+
258
+ // SEC-001: 路径遍历验证 - 只允许访问工作目录下的文件
259
+ const resolvedPath = path.resolve(filePath);
260
+ const workDir = path.resolve('.');
261
+ if (!resolvedPath.startsWith(workDir)) {
262
+ console.error('Error: File path must be within current working directory');
263
+ process.exit(1);
264
+ }
265
+
266
+ // CORR-001: JSON 解析错误处理
267
+ let fileContent;
268
+ try {
269
+ fileContent = JSON.parse(fs.readFileSync(resolvedPath, 'utf8'));
270
+ } catch (error) {
271
+ console.error(`Error: Failed to parse JSON file ${filePath}: ${error.message}`);
272
+ process.exit(1);
273
+ }
274
+
275
+ // CORR-002: 嵌套属性 null 检查
276
+ chain = fileContent.chain || fileContent.steps?.map(s => s.command) || [];
277
+ if (chain.length === 0) {
278
+ console.error('Error: No valid chain found in file (expected "chain" array or "steps" with "command" fields)');
279
+ process.exit(1);
280
+ }
281
+ } else {
282
+ chain = args;
283
+ }
284
+
285
+ const validator = new ChainValidator(registry);
286
+ const result = validator.validate(chain);
287
+
288
+ console.log('\n=== Chain Validation Report ===\n');
289
+ console.log('Chain:', chain.join(' → '));
290
+ console.log('');
291
+
292
+ if (result.valid) {
293
+ console.log('✓ Chain is valid!\n');
294
+ } else {
295
+ console.log('✗ Chain has errors:\n');
296
+ result.errors.forEach(err => {
297
+ console.log(` [${err.rule}] ${err.message}`);
298
+ if (err.fix) {
299
+ console.log(` Fix: ${err.fix}`);
300
+ }
301
+ });
302
+ console.log('');
303
+ }
304
+
305
+ if (result.warnings.length > 0) {
306
+ console.log('⚠ Warnings:\n');
307
+ result.warnings.forEach(warn => {
308
+ console.log(` [${warn.rule}] ${warn.message}`);
309
+ });
310
+ console.log('');
311
+ }
312
+
313
+ process.exit(result.valid ? 0 : 1);
314
+ }
315
+
316
+ if (require.main === module) {
317
+ main();
318
+ }
319
+
320
+ module.exports = { ChainValidator };
@@ -0,0 +1,255 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Command Registry Tool
5
+ *
6
+ * 功能:
7
+ * 1. 根据命令名称查找并提取 YAML 头
8
+ * 2. 从全局 .claude/commands/workflow 目录读取
9
+ * 3. 支持按需提取(不是全量扫描)
10
+ */
11
+
12
+ const fs = require('fs');
13
+ const path = require('path');
14
+ const os = require('os');
15
+
16
+ class CommandRegistry {
17
+ constructor(commandDir = null) {
18
+ // 优先使用传入的目录
19
+ if (commandDir) {
20
+ this.commandDir = commandDir;
21
+ } else {
22
+ // 自动查找 .claude/commands/workflow
23
+ this.commandDir = this.findCommandDir();
24
+ }
25
+ this.cache = {};
26
+ }
27
+
28
+ /**
29
+ * 自动查找 .claude/commands/workflow 目录
30
+ * 支持: 项目相对路径、用户 home 目录
31
+ */
32
+ findCommandDir() {
33
+ // 1. 尝试相对于当前工作目录
34
+ const relativePath = path.join('.claude', 'commands', 'workflow');
35
+ if (fs.existsSync(relativePath)) {
36
+ return path.resolve(relativePath);
37
+ }
38
+
39
+ // 2. 尝试用户 home 目录
40
+ const homeDir = os.homedir();
41
+ const homeCommandDir = path.join(homeDir, '.claude', 'commands', 'workflow');
42
+ if (fs.existsSync(homeCommandDir)) {
43
+ return homeCommandDir;
44
+ }
45
+
46
+ // 未找到时返回 null,后续操作会失败并提示
47
+ return null;
48
+ }
49
+
50
+ /**
51
+ * 解析 YAML 头 (简化版本)
52
+ *
53
+ * 限制:
54
+ * - 只支持简单的 key: value 对 (单行值)
55
+ * - 不支持多行值、嵌套对象、复杂列表
56
+ * - allowed-tools 字段支持逗号分隔的字符串,自动转为数组
57
+ *
58
+ * 示例:
59
+ * ---
60
+ * name: lite-plan
61
+ * description: "Lightweight planning workflow"
62
+ * allowed-tools: Read, Write, Bash
63
+ * ---
64
+ */
65
+ parseYamlHeader(content) {
66
+ // 处理 Windows 行结尾 (\r\n)
67
+ const match = content.match(/^---[\r\n]+([\s\S]*?)[\r\n]+---/);
68
+ if (!match) return null;
69
+
70
+ const yamlContent = match[1];
71
+ const result = {};
72
+
73
+ try {
74
+ const lines = yamlContent.split(/[\r\n]+/);
75
+ for (const line of lines) {
76
+ const trimmed = line.trim();
77
+ if (!trimmed || trimmed.startsWith('#')) continue; // 跳过空行和注释
78
+
79
+ const colonIndex = trimmed.indexOf(':');
80
+ if (colonIndex === -1) continue;
81
+
82
+ const key = trimmed.substring(0, colonIndex).trim();
83
+ const value = trimmed.substring(colonIndex + 1).trim();
84
+
85
+ if (!key) continue; // 跳过无效行
86
+
87
+ // 去除引号 (单引号或双引号)
88
+ let cleanValue = value.replace(/^["']|["']$/g, '');
89
+
90
+ // allowed-tools 字段特殊处理:转为数组
91
+ // 支持格式: "Read, Write, Bash" 或 "Read,Write,Bash"
92
+ if (key === 'allowed-tools') {
93
+ cleanValue = Array.isArray(cleanValue)
94
+ ? cleanValue
95
+ : cleanValue.split(',').map(t => t.trim()).filter(t => t);
96
+ }
97
+
98
+ result[key] = cleanValue;
99
+ }
100
+ } catch (error) {
101
+ console.error('YAML parsing error:', error.message);
102
+ return null;
103
+ }
104
+
105
+ return result;
106
+ }
107
+
108
+ /**
109
+ * 获取单个命令的元数据
110
+ * @param {string} commandName 命令名称 (e.g., "lite-plan" 或 "/workflow:lite-plan")
111
+ * @returns {object|null} 命令信息或 null
112
+ */
113
+ getCommand(commandName) {
114
+ if (!this.commandDir) {
115
+ console.error('ERROR: .claude/commands/workflow 目录未找到');
116
+ return null;
117
+ }
118
+
119
+ // 标准化命令名称
120
+ const normalized = commandName.startsWith('/workflow:')
121
+ ? commandName.substring('/workflow:'.length)
122
+ : commandName;
123
+
124
+ // 检查缓存
125
+ if (this.cache[normalized]) {
126
+ return this.cache[normalized];
127
+ }
128
+
129
+ // 读取命令文件
130
+ const filePath = path.join(this.commandDir, `${normalized}.md`);
131
+ if (!fs.existsSync(filePath)) {
132
+ return null;
133
+ }
134
+
135
+ try {
136
+ const content = fs.readFileSync(filePath, 'utf-8');
137
+ const header = this.parseYamlHeader(content);
138
+
139
+ if (header && header.name) {
140
+ const result = {
141
+ name: header.name,
142
+ command: `/workflow:${header.name}`,
143
+ description: header.description || '',
144
+ argumentHint: header['argument-hint'] || '',
145
+ allowedTools: Array.isArray(header['allowed-tools'])
146
+ ? header['allowed-tools']
147
+ : (header['allowed-tools'] ? [header['allowed-tools']] : []),
148
+ filePath: filePath
149
+ };
150
+
151
+ // 缓存结果
152
+ this.cache[normalized] = result;
153
+ return result;
154
+ }
155
+ } catch (error) {
156
+ console.error(`读取命令失败 ${filePath}:`, error.message);
157
+ }
158
+
159
+ return null;
160
+ }
161
+
162
+ /**
163
+ * 批量获取多个命令的元数据
164
+ * @param {array} commandNames 命令名称数组
165
+ * @returns {object} 命令信息映射
166
+ */
167
+ getCommands(commandNames) {
168
+ const result = {};
169
+
170
+ for (const name of commandNames) {
171
+ const cmd = this.getCommand(name);
172
+ if (cmd) {
173
+ result[cmd.command] = cmd;
174
+ }
175
+ }
176
+
177
+ return result;
178
+ }
179
+
180
+ /**
181
+ * 获取所有命令的名称和描述
182
+ * @returns {object} 命令名称和描述的映射
183
+ */
184
+ getAllCommandsSummary() {
185
+ const result = {};
186
+ const commandDir = this.commandDir;
187
+
188
+ if (!commandDir) {
189
+ return result;
190
+ }
191
+
192
+ try {
193
+ const files = fs.readdirSync(commandDir);
194
+
195
+ for (const file of files) {
196
+ if (!file.endsWith('.md')) continue;
197
+
198
+ const filePath = path.join(commandDir, file);
199
+ const stat = fs.statSync(filePath);
200
+
201
+ if (stat.isDirectory()) continue;
202
+
203
+ try {
204
+ const content = fs.readFileSync(filePath, 'utf-8');
205
+ const header = this.parseYamlHeader(content);
206
+
207
+ if (header && header.name) {
208
+ const commandName = `/workflow:${header.name}`;
209
+ result[commandName] = {
210
+ name: header.name,
211
+ description: header.description || ''
212
+ };
213
+ }
214
+ } catch (error) {
215
+ // 跳过读取失败的文件
216
+ continue;
217
+ }
218
+ }
219
+ } catch (error) {
220
+ // 目录读取失败
221
+ return result;
222
+ }
223
+
224
+ return result;
225
+ }
226
+
227
+ /**
228
+ * 生成注册表 JSON
229
+ */
230
+ toJSON(commands = null) {
231
+ const data = commands || this.cache;
232
+ return JSON.stringify(data, null, 2);
233
+ }
234
+ }
235
+
236
+ // CLI 模式
237
+ if (require.main === module) {
238
+ const args = process.argv.slice(2);
239
+
240
+ if (args.length === 0 || args[0] === '--all') {
241
+ // 获取所有命令的名称和描述
242
+ const registry = new CommandRegistry();
243
+ const commands = registry.getAllCommandsSummary();
244
+ console.log(JSON.stringify(commands, null, 2));
245
+ process.exit(0);
246
+ }
247
+
248
+ const registry = new CommandRegistry();
249
+ const commands = registry.getCommands(args);
250
+
251
+ console.log(JSON.stringify(commands, null, 2));
252
+ }
253
+
254
+ module.exports = CommandRegistry;
255
+
@@ -15,7 +15,7 @@
15
15
  "/workflow:review-session-cycle",
16
16
  "/memory:docs",
17
17
  "/workflow:brainstorm:artifacts",
18
- "/workflow:action-plan-verify",
18
+ "/workflow:plan-verify",
19
19
  "/version"
20
20
  ],
21
21
 
@@ -69,7 +69,7 @@
69
69
  "difficulty": "Intermediate",
70
70
  "essential": true,
71
71
  "flow": {
72
- "next_steps": ["/workflow:action-plan-verify", "/workflow:execute"],
72
+ "next_steps": ["/workflow:plan-verify", "/workflow:execute"],
73
73
  "alternatives": ["/workflow:tdd-plan"]
74
74
  },
75
75
  "source": "../../../commands/workflow/plan.md"
@@ -89,8 +89,8 @@
89
89
  "source": "../../../commands/workflow/execute.md"
90
90
  },
91
91
  {
92
- "name": "action-plan-verify",
93
- "command": "/workflow:action-plan-verify",
92
+ "name": "plan-verify",
93
+ "command": "/workflow:plan-verify",
94
94
  "description": "Cross-artifact consistency analysis",
95
95
  "arguments": "[--session session-id]",
96
96
  "category": "workflow",
@@ -100,7 +100,7 @@
100
100
  "prerequisites": ["/workflow:plan"],
101
101
  "next_steps": ["/workflow:execute"]
102
102
  },
103
- "source": "../../../commands/workflow/action-plan-verify.md"
103
+ "source": "../../../commands/workflow/plan-verify.md"
104
104
  },
105
105
  {
106
106
  "name": "init",