@nahisaho/musubix-core 1.0.0 → 1.0.2

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 (33) hide show
  1. package/dist/cli/commands/codegen.d.ts +125 -0
  2. package/dist/cli/commands/codegen.d.ts.map +1 -0
  3. package/dist/cli/commands/codegen.js +684 -0
  4. package/dist/cli/commands/codegen.js.map +1 -0
  5. package/dist/cli/commands/design.d.ts +158 -0
  6. package/dist/cli/commands/design.d.ts.map +1 -0
  7. package/dist/cli/commands/design.js +562 -0
  8. package/dist/cli/commands/design.js.map +1 -0
  9. package/dist/cli/commands/explain.d.ts +116 -0
  10. package/dist/cli/commands/explain.d.ts.map +1 -0
  11. package/dist/cli/commands/explain.js +419 -0
  12. package/dist/cli/commands/explain.js.map +1 -0
  13. package/dist/cli/commands/index.d.ts +13 -0
  14. package/dist/cli/commands/index.d.ts.map +1 -1
  15. package/dist/cli/commands/index.js +31 -7
  16. package/dist/cli/commands/index.js.map +1 -1
  17. package/dist/cli/commands/requirements.d.ts +103 -0
  18. package/dist/cli/commands/requirements.d.ts.map +1 -0
  19. package/dist/cli/commands/requirements.js +403 -0
  20. package/dist/cli/commands/requirements.js.map +1 -0
  21. package/dist/cli/commands/skills.d.ts +99 -0
  22. package/dist/cli/commands/skills.d.ts.map +1 -0
  23. package/dist/cli/commands/skills.js +363 -0
  24. package/dist/cli/commands/skills.js.map +1 -0
  25. package/dist/cli/commands/test.d.ts +113 -0
  26. package/dist/cli/commands/test.d.ts.map +1 -0
  27. package/dist/cli/commands/test.js +532 -0
  28. package/dist/cli/commands/test.js.map +1 -0
  29. package/dist/cli/commands/trace.d.ts +132 -0
  30. package/dist/cli/commands/trace.d.ts.map +1 -0
  31. package/dist/cli/commands/trace.js +553 -0
  32. package/dist/cli/commands/trace.js.map +1 -0
  33. package/package.json +5 -3
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Explain Command
3
+ *
4
+ * CLI commands for explanation and visualization
5
+ *
6
+ * @packageDocumentation
7
+ * @module cli/commands/explain
8
+ *
9
+ * @see REQ-CLI-006 - Explain CLI
10
+ * @see REQ-EXP-001 - Explanation Generation
11
+ * @see REQ-EXP-002 - Visualization
12
+ * @see DES-MUSUBIX-001 Section 16-C.6 - explainコマンド設計
13
+ * @see TSK-079〜080 - Explain CLI実装
14
+ */
15
+ import type { Command } from 'commander';
16
+ /**
17
+ * Explain command options
18
+ */
19
+ export interface ExplainOptions {
20
+ output?: string;
21
+ format?: 'text' | 'markdown' | 'json' | 'mermaid';
22
+ verbose?: boolean;
23
+ depth?: number;
24
+ }
25
+ /**
26
+ * Decision factor
27
+ */
28
+ export interface DecisionFactor {
29
+ type: 'requirement' | 'constraint' | 'pattern' | 'principle' | 'tradeoff';
30
+ id?: string;
31
+ description: string;
32
+ weight: number;
33
+ source?: string;
34
+ }
35
+ /**
36
+ * Decision explanation
37
+ */
38
+ export interface DecisionExplanation {
39
+ id: string;
40
+ decision: string;
41
+ rationale: string;
42
+ factors: DecisionFactor[];
43
+ alternatives: Array<{
44
+ description: string;
45
+ rejected: string;
46
+ }>;
47
+ confidence: number;
48
+ references: string[];
49
+ }
50
+ /**
51
+ * Why result
52
+ */
53
+ export interface WhyResult {
54
+ success: boolean;
55
+ explanation: DecisionExplanation;
56
+ relatedDecisions: string[];
57
+ message: string;
58
+ }
59
+ /**
60
+ * Graph node
61
+ */
62
+ export interface GraphNode {
63
+ id: string;
64
+ label: string;
65
+ type: 'decision' | 'requirement' | 'design' | 'code' | 'test' | 'factor';
66
+ metadata?: Record<string, string>;
67
+ }
68
+ /**
69
+ * Graph edge
70
+ */
71
+ export interface GraphEdge {
72
+ source: string;
73
+ target: string;
74
+ label: string;
75
+ type: 'implements' | 'derives' | 'supports' | 'constrains' | 'influences';
76
+ }
77
+ /**
78
+ * Reasoning graph
79
+ */
80
+ export interface ReasoningGraph {
81
+ nodes: GraphNode[];
82
+ edges: GraphEdge[];
83
+ rootId: string;
84
+ depth: number;
85
+ }
86
+ /**
87
+ * Graph result
88
+ */
89
+ export interface GraphResult {
90
+ success: boolean;
91
+ graph: ReasoningGraph;
92
+ visualization: string;
93
+ message: string;
94
+ }
95
+ /**
96
+ * Register explain command
97
+ */
98
+ export declare function registerExplainCommand(program: Command): void;
99
+ /**
100
+ * Analyze decision
101
+ */
102
+ declare function analyzeDecision(id: string): Promise<DecisionExplanation>;
103
+ /**
104
+ * Build reasoning graph
105
+ */
106
+ declare function buildReasoningGraph(rootId: string, maxDepth: number): Promise<ReasoningGraph>;
107
+ /**
108
+ * Generate Mermaid graph
109
+ */
110
+ declare function generateMermaidGraph(graph: ReasoningGraph): string;
111
+ /**
112
+ * Generate explanation markdown
113
+ */
114
+ declare function generateExplanationMarkdown(explanation: DecisionExplanation): string;
115
+ export { analyzeDecision, buildReasoningGraph, generateMermaidGraph, generateExplanationMarkdown, };
116
+ //# sourceMappingURL=explain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explain.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/explain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,aAAa,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IAC1E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG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Ac,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAYD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsG7D;AAED;;GAEG;AACH,iBAAe,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA4HvE;AAED;;GAEG;AACH,iBAAe,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAyE5F;AAED;;GAEG;AACH,iBAAS,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAsC3D;AAED;;GAEG;AACH,iBAAS,2BAA2B,CAAC,WAAW,EAAE,mBAAmB,GAAG,MAAM,CAqC7E;AAmCD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,GAC5B,CAAC"}
@@ -0,0 +1,419 @@
1
+ /**
2
+ * Explain Command
3
+ *
4
+ * CLI commands for explanation and visualization
5
+ *
6
+ * @packageDocumentation
7
+ * @module cli/commands/explain
8
+ *
9
+ * @see REQ-CLI-006 - Explain CLI
10
+ * @see REQ-EXP-001 - Explanation Generation
11
+ * @see REQ-EXP-002 - Visualization
12
+ * @see DES-MUSUBIX-001 Section 16-C.6 - explainコマンド設計
13
+ * @see TSK-079〜080 - Explain CLI実装
14
+ */
15
+ import { readFile, writeFile, readdir, mkdir } from 'fs/promises';
16
+ import { resolve, join, dirname } from 'path';
17
+ import { ExitCode, getGlobalOptions, outputResult } from '../base.js';
18
+ /**
19
+ * ID patterns
20
+ */
21
+ const ID_PATTERNS = {
22
+ requirement: /REQ-[A-Z]+-\d+/,
23
+ design: /DES-[A-Z]+-\d+/,
24
+ task: /TSK-[A-Z]*-?\d+/,
25
+ adr: /ADR-\d+/,
26
+ };
27
+ /**
28
+ * Register explain command
29
+ */
30
+ export function registerExplainCommand(program) {
31
+ const explain = program
32
+ .command('explain')
33
+ .description('Explanation and visualization');
34
+ // explain why
35
+ explain
36
+ .command('why <id>')
37
+ .description('Explain why a decision was made')
38
+ .option('-f, --format <format>', 'Output format', 'markdown')
39
+ .option('-o, --output <file>', 'Output file')
40
+ .action(async (id, options) => {
41
+ const globalOpts = getGlobalOptions(program);
42
+ try {
43
+ // Find and analyze the artifact
44
+ const explanation = await analyzeDecision(id);
45
+ const result = {
46
+ success: true,
47
+ explanation,
48
+ relatedDecisions: explanation.references.filter(r => r.match(/^(ADR|DES)-/)),
49
+ message: `Generated explanation for ${id}`,
50
+ };
51
+ // Output
52
+ if (options.output) {
53
+ const outputPath = resolve(process.cwd(), options.output);
54
+ await mkdir(dirname(outputPath), { recursive: true });
55
+ let content;
56
+ if (options.format === 'json' || globalOpts.json) {
57
+ content = JSON.stringify(result, null, 2);
58
+ }
59
+ else {
60
+ content = generateExplanationMarkdown(explanation);
61
+ }
62
+ await writeFile(outputPath, content, 'utf-8');
63
+ if (!globalOpts.quiet) {
64
+ console.log(`✅ Explanation saved to ${outputPath}`);
65
+ }
66
+ }
67
+ else if (globalOpts.json) {
68
+ outputResult(result, globalOpts);
69
+ }
70
+ else {
71
+ console.log(generateExplanationText(explanation));
72
+ }
73
+ process.exit(ExitCode.SUCCESS);
74
+ }
75
+ catch (error) {
76
+ if (!globalOpts.quiet) {
77
+ console.error(`❌ Explanation failed: ${error.message}`);
78
+ }
79
+ process.exit(ExitCode.GENERAL_ERROR);
80
+ }
81
+ });
82
+ // explain graph
83
+ explain
84
+ .command('graph <id>')
85
+ .description('Generate reasoning graph')
86
+ .option('-f, --format <format>', 'Output format (mermaid|json)', 'mermaid')
87
+ .option('-o, --output <file>', 'Output file')
88
+ .option('-d, --depth <number>', 'Graph depth', '3')
89
+ .action(async (id, options) => {
90
+ const globalOpts = getGlobalOptions(program);
91
+ try {
92
+ const depth = options.depth ?? 3;
93
+ const graph = await buildReasoningGraph(id, depth);
94
+ const visualization = options.format === 'json'
95
+ ? JSON.stringify(graph, null, 2)
96
+ : generateMermaidGraph(graph);
97
+ const result = {
98
+ success: true,
99
+ graph,
100
+ visualization,
101
+ message: `Generated reasoning graph with ${graph.nodes.length} nodes and ${graph.edges.length} edges`,
102
+ };
103
+ // Output
104
+ if (options.output) {
105
+ const outputPath = resolve(process.cwd(), options.output);
106
+ await mkdir(dirname(outputPath), { recursive: true });
107
+ await writeFile(outputPath, visualization, 'utf-8');
108
+ if (!globalOpts.quiet) {
109
+ console.log(`✅ Graph saved to ${outputPath}`);
110
+ }
111
+ }
112
+ else if (globalOpts.json) {
113
+ outputResult(result, globalOpts);
114
+ }
115
+ else {
116
+ console.log(visualization);
117
+ }
118
+ process.exit(ExitCode.SUCCESS);
119
+ }
120
+ catch (error) {
121
+ if (!globalOpts.quiet) {
122
+ console.error(`❌ Graph generation failed: ${error.message}`);
123
+ }
124
+ process.exit(ExitCode.GENERAL_ERROR);
125
+ }
126
+ });
127
+ }
128
+ /**
129
+ * Analyze decision
130
+ */
131
+ async function analyzeDecision(id) {
132
+ const specsDir = resolve(process.cwd(), 'storage/specs');
133
+ const adrDir = resolve(process.cwd(), 'docs/adr');
134
+ // Determine type
135
+ let artifactType = 'unknown';
136
+ for (const [type, pattern] of Object.entries(ID_PATTERNS)) {
137
+ if (pattern.test(id)) {
138
+ artifactType = type;
139
+ break;
140
+ }
141
+ }
142
+ // Search for the artifact
143
+ let content = '';
144
+ // Search in specs
145
+ try {
146
+ const files = await readdir(specsDir);
147
+ for (const file of files) {
148
+ if (!file.endsWith('.md'))
149
+ continue;
150
+ const fileContent = await readFile(join(specsDir, file), 'utf-8');
151
+ if (fileContent.includes(id)) {
152
+ content = fileContent;
153
+ break;
154
+ }
155
+ }
156
+ }
157
+ catch {
158
+ // Specs dir doesn't exist
159
+ }
160
+ // Search in ADR
161
+ if (!content) {
162
+ try {
163
+ const files = await readdir(adrDir);
164
+ for (const file of files) {
165
+ if (!file.endsWith('.md'))
166
+ continue;
167
+ const fileContent = await readFile(join(adrDir, file), 'utf-8');
168
+ if (fileContent.includes(id)) {
169
+ content = fileContent;
170
+ artifactType = 'adr';
171
+ break;
172
+ }
173
+ }
174
+ }
175
+ catch {
176
+ // ADR dir doesn't exist
177
+ }
178
+ }
179
+ // Extract information
180
+ const factors = [];
181
+ const alternatives = [];
182
+ const references = [];
183
+ // Find related IDs
184
+ for (const pattern of Object.values(ID_PATTERNS)) {
185
+ const matches = content.match(new RegExp(pattern.source, 'g')) || [];
186
+ for (const match of matches) {
187
+ if (match !== id) {
188
+ references.push(match);
189
+ }
190
+ }
191
+ }
192
+ // Extract factors from content
193
+ if (content.includes('SOLID')) {
194
+ factors.push({
195
+ type: 'principle',
196
+ description: 'SOLID principles compliance',
197
+ weight: 0.8,
198
+ source: 'Architecture guidelines',
199
+ });
200
+ }
201
+ if (content.includes('security') || content.includes('Security')) {
202
+ factors.push({
203
+ type: 'constraint',
204
+ description: 'Security requirements',
205
+ weight: 0.9,
206
+ source: 'Non-functional requirements',
207
+ });
208
+ }
209
+ if (content.includes('performance') || content.includes('Performance')) {
210
+ factors.push({
211
+ type: 'constraint',
212
+ description: 'Performance requirements',
213
+ weight: 0.7,
214
+ source: 'Non-functional requirements',
215
+ });
216
+ }
217
+ // Pattern detection
218
+ const patterns = ['Factory', 'Singleton', 'Observer', 'Strategy', 'Adapter'];
219
+ for (const pattern of patterns) {
220
+ if (content.includes(pattern)) {
221
+ factors.push({
222
+ type: 'pattern',
223
+ description: `${pattern} pattern applied`,
224
+ weight: 0.6,
225
+ source: 'Design patterns catalog',
226
+ });
227
+ }
228
+ }
229
+ // Extract description and rationale
230
+ const titleMatch = content.match(/^#+\s*(.+)$/m);
231
+ const decision = titleMatch?.[1] || id;
232
+ const rationaleMatch = content.match(/(?:Rationale|理由|Why|なぜ)[:\s]*\n([^\n]+)/i);
233
+ const rationale = rationaleMatch?.[1] || 'Decision based on requirements analysis and design principles';
234
+ // Calculate confidence
235
+ const confidence = Math.min(0.95, 0.5 + factors.length * 0.1 + references.length * 0.05);
236
+ return {
237
+ id,
238
+ decision,
239
+ rationale,
240
+ factors,
241
+ alternatives,
242
+ confidence,
243
+ references: [...new Set(references)],
244
+ };
245
+ }
246
+ /**
247
+ * Build reasoning graph
248
+ */
249
+ async function buildReasoningGraph(rootId, maxDepth) {
250
+ const nodes = [];
251
+ const edges = [];
252
+ const visited = new Set();
253
+ async function traverse(id, depth) {
254
+ if (depth > maxDepth || visited.has(id))
255
+ return;
256
+ visited.add(id);
257
+ // Determine node type
258
+ let nodeType = 'decision';
259
+ if (id.startsWith('REQ-'))
260
+ nodeType = 'requirement';
261
+ else if (id.startsWith('DES-'))
262
+ nodeType = 'design';
263
+ else if (id.startsWith('TSK-'))
264
+ nodeType = 'code';
265
+ else if (id.startsWith('TEST-'))
266
+ nodeType = 'test';
267
+ nodes.push({
268
+ id,
269
+ label: id,
270
+ type: nodeType,
271
+ });
272
+ // Find related artifacts
273
+ const explanation = await analyzeDecision(id);
274
+ for (const ref of explanation.references) {
275
+ if (!visited.has(ref)) {
276
+ // Determine edge type
277
+ let edgeType = 'influences';
278
+ if (ref.startsWith('REQ-'))
279
+ edgeType = 'derives';
280
+ else if (ref.startsWith('DES-'))
281
+ edgeType = 'implements';
282
+ else if (ref.startsWith('TSK-'))
283
+ edgeType = 'implements';
284
+ edges.push({
285
+ source: id,
286
+ target: ref,
287
+ label: edgeType,
288
+ type: edgeType,
289
+ });
290
+ await traverse(ref, depth + 1);
291
+ }
292
+ }
293
+ // Add factors as nodes
294
+ for (const factor of explanation.factors) {
295
+ const factorId = `factor-${nodes.length}`;
296
+ nodes.push({
297
+ id: factorId,
298
+ label: factor.description,
299
+ type: 'factor',
300
+ metadata: {
301
+ weight: factor.weight.toString(),
302
+ source: factor.source || '',
303
+ },
304
+ });
305
+ edges.push({
306
+ source: factorId,
307
+ target: id,
308
+ label: 'supports',
309
+ type: 'supports',
310
+ });
311
+ }
312
+ }
313
+ await traverse(rootId, 0);
314
+ return {
315
+ nodes,
316
+ edges,
317
+ rootId,
318
+ depth: maxDepth,
319
+ };
320
+ }
321
+ /**
322
+ * Generate Mermaid graph
323
+ */
324
+ function generateMermaidGraph(graph) {
325
+ let output = '```mermaid\nflowchart TB\n';
326
+ // Define node styles
327
+ output += ' classDef requirement fill:#e3f2fd,stroke:#1976d2\n';
328
+ output += ' classDef design fill:#e8f5e9,stroke:#388e3c\n';
329
+ output += ' classDef code fill:#fff3e0,stroke:#f57c00\n';
330
+ output += ' classDef test fill:#fce4ec,stroke:#c2185b\n';
331
+ output += ' classDef factor fill:#f3e5f5,stroke:#7b1fa2\n';
332
+ output += ' classDef decision fill:#fffde7,stroke:#fbc02d\n\n';
333
+ // Add nodes
334
+ for (const node of graph.nodes) {
335
+ const shape = node.type === 'factor' ? '{{' : node.type === 'requirement' ? '([' : '[';
336
+ const closeShape = node.type === 'factor' ? '}}' : node.type === 'requirement' ? '])' : ']';
337
+ const label = node.label.length > 30 ? node.label.slice(0, 30) + '...' : node.label;
338
+ output += ` ${node.id.replace(/-/g, '_')}${shape}"${label}"${closeShape}\n`;
339
+ }
340
+ output += '\n';
341
+ // Add edges
342
+ for (const edge of graph.edges) {
343
+ const sourceId = edge.source.replace(/-/g, '_');
344
+ const targetId = edge.target.replace(/-/g, '_');
345
+ output += ` ${sourceId} -->|${edge.label}| ${targetId}\n`;
346
+ }
347
+ output += '\n';
348
+ // Apply styles
349
+ for (const node of graph.nodes) {
350
+ const nodeId = node.id.replace(/-/g, '_');
351
+ output += ` class ${nodeId} ${node.type}\n`;
352
+ }
353
+ output += '```\n';
354
+ return output;
355
+ }
356
+ /**
357
+ * Generate explanation markdown
358
+ */
359
+ function generateExplanationMarkdown(explanation) {
360
+ let output = `# Explanation: ${explanation.id}\n\n`;
361
+ output += `## Decision\n\n${explanation.decision}\n\n`;
362
+ output += `## Rationale\n\n${explanation.rationale}\n\n`;
363
+ if (explanation.factors.length > 0) {
364
+ output += `## Contributing Factors\n\n`;
365
+ output += `| Type | Description | Weight | Source |\n`;
366
+ output += `|------|-------------|--------|--------|\n`;
367
+ for (const factor of explanation.factors) {
368
+ output += `| ${factor.type} | ${factor.description} | ${(factor.weight * 100).toFixed(0)}% | ${factor.source || '-'} |\n`;
369
+ }
370
+ output += '\n';
371
+ }
372
+ if (explanation.alternatives.length > 0) {
373
+ output += `## Alternatives Considered\n\n`;
374
+ for (const alt of explanation.alternatives) {
375
+ output += `- **${alt.description}**: Rejected because ${alt.rejected}\n`;
376
+ }
377
+ output += '\n';
378
+ }
379
+ if (explanation.references.length > 0) {
380
+ output += `## References\n\n`;
381
+ for (const ref of explanation.references) {
382
+ output += `- ${ref}\n`;
383
+ }
384
+ output += '\n';
385
+ }
386
+ output += `---\n\n`;
387
+ output += `*Confidence: ${(explanation.confidence * 100).toFixed(0)}%*\n`;
388
+ output += `*Generated: ${new Date().toISOString()}*\n`;
389
+ return output;
390
+ }
391
+ /**
392
+ * Generate explanation text
393
+ */
394
+ function generateExplanationText(explanation) {
395
+ let output = `\n📋 Explanation for ${explanation.id}\n`;
396
+ output += '═'.repeat(50) + '\n\n';
397
+ output += `📌 Decision: ${explanation.decision}\n\n`;
398
+ output += `💡 Rationale:\n ${explanation.rationale}\n\n`;
399
+ if (explanation.factors.length > 0) {
400
+ output += `🔍 Contributing Factors:\n`;
401
+ for (const factor of explanation.factors) {
402
+ const bar = '█'.repeat(Math.floor(factor.weight * 10)) + '░'.repeat(10 - Math.floor(factor.weight * 10));
403
+ output += ` • [${factor.type}] ${factor.description}\n`;
404
+ output += ` ${bar} ${(factor.weight * 100).toFixed(0)}%\n`;
405
+ }
406
+ output += '\n';
407
+ }
408
+ if (explanation.references.length > 0) {
409
+ output += `📚 Related:\n`;
410
+ for (const ref of explanation.references) {
411
+ output += ` → ${ref}\n`;
412
+ }
413
+ output += '\n';
414
+ }
415
+ output += `📊 Confidence: ${(explanation.confidence * 100).toFixed(0)}%\n`;
416
+ return output;
417
+ }
418
+ export { analyzeDecision, buildReasoningGraph, generateMermaidGraph, generateExplanationMarkdown, };
419
+ //# sourceMappingURL=explain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explain.js","sourceRoot":"","sources":["../../../src/cli/commands/explain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAyFtE;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,WAAW,EAAE,gBAAgB;IAC7B,MAAM,EAAE,gBAAgB;IACxB,IAAI,EAAE,iBAAiB;IACvB,GAAG,EAAE,SAAS;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,MAAM,OAAO,GAAG,OAAO;SACpB,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,+BAA+B,CAAC,CAAC;IAEhD,cAAc;IACd,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,iCAAiC,CAAC;SAC9C,MAAM,CAAC,uBAAuB,EAAE,eAAe,EAAE,UAAU,CAAC;SAC5D,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;SAC5C,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,OAAuB,EAAE,EAAE;QACpD,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAE7C,IAAI,CAAC;YACH,gCAAgC;YAChC,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,EAAE,CAAC,CAAC;YAE9C,MAAM,MAAM,GAAc;gBACxB,OAAO,EAAE,IAAI;gBACb,WAAW;gBACX,gBAAgB,EAAE,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EA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WAAW,IAAI,CAAC;YAC1D,MAAM,IAAI,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QACjE,CAAC;QACD,MAAM,IAAI,IAAI,CAAC;IACjB,CAAC;IAED,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,eAAe,CAAC;QAC1B,KAAK,MAAM,GAAG,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC;YACzC,MAAM,IAAI,QAAQ,GAAG,IAAI,CAAC;QAC5B,CAAC;QACD,MAAM,IAAI,IAAI,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,kBAAkB,CAAC,WAAW,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAE3E,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,GAC5B,CAAC"}
@@ -3,12 +3,25 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  * @module cli/commands
6
+ *
7
+ * @see REQ-CLI-001〜006 - CLI Commands
8
+ * @see DES-MUSUBIX-001 Section 16-C - CLI設計
9
+ * @see TSK-062〜080 - CLI実装タスク
6
10
  */
7
11
  import type { Command } from 'commander';
8
12
  /**
9
13
  * Register all CLI commands
14
+ *
15
+ * @see Article II - CLI Interface (Constitution)
10
16
  */
11
17
  export declare function registerCommands(program: Command): void;
12
18
  export { registerInitCommand } from './init.js';
13
19
  export { registerHelpCommand } from './help.js';
20
+ export { registerSkillsCommand } from './skills.js';
21
+ export { registerRequirementsCommand } from './requirements.js';
22
+ export { registerDesignCommand } from './design.js';
23
+ export { registerCodegenCommand } from './codegen.js';
24
+ export { registerTestCommand } from './test.js';
25
+ export { registerTraceCommand } from './trace.js';
26
+ export { registerExplainCommand } from './explain.js';
14
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAWvD;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWzC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAavD;AAGD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
@@ -3,23 +3,47 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  * @module cli/commands
6
+ *
7
+ * @see REQ-CLI-001〜006 - CLI Commands
8
+ * @see DES-MUSUBIX-001 Section 16-C - CLI設計
9
+ * @see TSK-062〜080 - CLI実装タスク
6
10
  */
7
11
  import { registerInitCommand } from './init.js';
8
12
  import { registerHelpCommand } from './help.js';
13
+ import { registerSkillsCommand } from './skills.js';
14
+ import { registerRequirementsCommand } from './requirements.js';
15
+ import { registerDesignCommand } from './design.js';
16
+ import { registerCodegenCommand } from './codegen.js';
17
+ import { registerTestCommand } from './test.js';
18
+ import { registerTraceCommand } from './trace.js';
19
+ import { registerExplainCommand } from './explain.js';
9
20
  /**
10
21
  * Register all CLI commands
22
+ *
23
+ * @see Article II - CLI Interface (Constitution)
11
24
  */
12
25
  export function registerCommands(program) {
26
+ // Core commands
13
27
  registerInitCommand(program);
14
28
  registerHelpCommand(program);
15
- // Future commands will be registered here:
16
- // registerRequirementsCommand(program);
17
- // registerDesignCommand(program);
18
- // registerCodegenCommand(program);
19
- // registerTestCommand(program);
20
- // registerTraceCommand(program);
21
- // registerExplainCommand(program);
29
+ registerSkillsCommand(program);
30
+ // SDD workflow commands (REQ-CLI-001〜006)
31
+ registerRequirementsCommand(program);
32
+ registerDesignCommand(program);
33
+ registerCodegenCommand(program);
34
+ registerTestCommand(program);
35
+ registerTraceCommand(program);
36
+ registerExplainCommand(program);
22
37
  }
38
+ // Core command exports
23
39
  export { registerInitCommand } from './init.js';
24
40
  export { registerHelpCommand } from './help.js';
41
+ export { registerSkillsCommand } from './skills.js';
42
+ // SDD workflow command exports
43
+ export { registerRequirementsCommand } from './requirements.js';
44
+ export { registerDesignCommand } from './design.js';
45
+ export { registerCodegenCommand } from './codegen.js';
46
+ export { registerTestCommand } from './test.js';
47
+ export { registerTraceCommand } from './trace.js';
48
+ export { registerExplainCommand } from './explain.js';
25
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC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