@nahisaho/musubix-core 3.3.9 → 3.4.1
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.
- package/AGENTS.md +7 -3
- package/bin/musubix.js +14 -0
- package/dist/cli/base.d.ts +2 -0
- package/dist/cli/base.d.ts.map +1 -1
- package/dist/cli/base.js +16 -1
- package/dist/cli/base.js.map +1 -1
- package/dist/cli/commands/codegen.d.ts +37 -1
- package/dist/cli/commands/codegen.d.ts.map +1 -1
- package/dist/cli/commands/codegen.js +224 -2
- package/dist/cli/commands/codegen.js.map +1 -1
- package/dist/cli/commands/deep-research.d.ts +14 -0
- package/dist/cli/commands/deep-research.d.ts.map +1 -0
- package/dist/cli/commands/deep-research.js +244 -0
- package/dist/cli/commands/deep-research.js.map +1 -0
- package/dist/cli/commands/index.d.ts +5 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +7 -0
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/scaffold.d.ts +24 -0
- package/dist/cli/commands/scaffold.d.ts.map +1 -1
- package/dist/cli/commands/scaffold.js +79 -4
- package/dist/cli/commands/scaffold.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/requirements/__tests__/clarifying-questions.test.d.ts +8 -0
- package/dist/requirements/__tests__/clarifying-questions.test.d.ts.map +1 -0
- package/dist/requirements/__tests__/clarifying-questions.test.js +96 -0
- package/dist/requirements/__tests__/clarifying-questions.test.js.map +1 -0
- package/dist/requirements/clarifying-questions.d.ts +28 -4
- package/dist/requirements/clarifying-questions.d.ts.map +1 -1
- package/dist/requirements/clarifying-questions.js +84 -5
- package/dist/requirements/clarifying-questions.js.map +1 -1
- package/dist/symbolic/quality-gate.d.ts +88 -0
- package/dist/symbolic/quality-gate.d.ts.map +1 -1
- package/dist/symbolic/quality-gate.js +88 -0
- package/dist/symbolic/quality-gate.js.map +1 -1
- package/dist/version.d.ts +38 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +100 -0
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
| 項目 | 詳細 |
|
|
10
10
|
|------|------|
|
|
11
|
-
| **バージョン** | 3.
|
|
11
|
+
| **バージョン** | 3.4.0 (Deep Research Integration) |
|
|
12
12
|
| **言語** | TypeScript |
|
|
13
13
|
| **ランタイム** | Node.js >= 20.0.0 |
|
|
14
14
|
| **パッケージマネージャ** | npm >= 10.0.0 |
|
|
15
15
|
| **ビルドシステム** | モノレポ(npm workspaces) |
|
|
16
16
|
| **テストフレームワーク** | Vitest |
|
|
17
|
-
| **テスト数** |
|
|
18
|
-
| **パッケージ数** |
|
|
17
|
+
| **テスト数** | 4966+ (全合格) |
|
|
18
|
+
| **パッケージ数** | 27 |
|
|
19
19
|
| **MCPツール数** | 107 |
|
|
20
20
|
| **Agent Skills** | 13 (Claude Code対応) |
|
|
21
21
|
|
|
@@ -45,6 +45,7 @@ packages/
|
|
|
45
45
|
├── skill-manager/ # @nahisaho/musubix-skill-manager
|
|
46
46
|
├── codegraph/ # @nahisaho/musubix-codegraph
|
|
47
47
|
├── expert-delegation/ # @nahisaho/musubix-expert-delegation (v3.2.0 NEW!)
|
|
48
|
+
├── deep-research/ # @nahisaho/musubix-deep-research (v3.4.0 NEW!)
|
|
48
49
|
├── knowledge/ # @musubix/knowledge (v3.0.0 NEW!)
|
|
49
50
|
├── policy/ # @musubix/policy (v3.0.0 NEW!)
|
|
50
51
|
└── decisions/ # @musubix/decisions (v3.0.0 NEW!)
|
|
@@ -73,6 +74,7 @@ packages/
|
|
|
73
74
|
| `packages/skill-manager/` | `@nahisaho/musubix-skill-manager` | **スキル管理** - スキル登録・実行・検証 |
|
|
74
75
|
| `packages/codegraph/` | `@nahisaho/musubix-codegraph` | **コードグラフ** - コード構造解析・依存関係追跡 |
|
|
75
76
|
| `packages/expert-delegation/` | `@nahisaho/musubix-expert-delegation` | **エキスパート委譲 (v3.2.0 NEW!)** - 7種AI専門家・VS Code LM API統合 |
|
|
77
|
+
| `packages/deep-research/` | `@nahisaho/musubix-deep-research` | **Deep Research (v3.4.0 NEW!)** - AI駆動型深層リサーチ・6統合機能・433テスト |
|
|
76
78
|
|
|
77
79
|
### 非推奨パッケージ(Deprecated) ⚠️
|
|
78
80
|
|
|
@@ -133,6 +135,8 @@ npx musubix design traceability --min-coverage 80 # カバレッジ閾値指定
|
|
|
133
135
|
|
|
134
136
|
# コード生成
|
|
135
137
|
npx musubix codegen generate <file> # 設計からコード生成
|
|
138
|
+
npx musubix codegen generate <file> --full-skeleton # 4ファイル生成 (v3.3.10 NEW!)
|
|
139
|
+
npx musubix codegen generate <file> --with-tests # テストファイル付き (v3.3.10 NEW!)
|
|
136
140
|
npx musubix codegen analyze <file> # 静的解析
|
|
137
141
|
npx musubix codegen security <path> # セキュリティスキャン
|
|
138
142
|
npx musubix codegen status <spec> # ステータス遷移コード生成 (v3.1.0 NEW!)
|
package/bin/musubix.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* MUSUBIX CLI Entry Point
|
|
4
4
|
*
|
|
5
5
|
* @see REQ-ARC-002 - CLI Interface
|
|
6
|
+
* @see REQ-BUGFIX-005-03 - Custom version action with verbose support
|
|
6
7
|
*
|
|
7
8
|
* Usage:
|
|
8
9
|
* npx @musubix/core
|
|
@@ -12,6 +13,19 @@
|
|
|
12
13
|
|
|
13
14
|
import { createProgram } from '../dist/cli/base.js';
|
|
14
15
|
import { registerCommands } from '../dist/cli/commands/index.js';
|
|
16
|
+
import { VERSION, formatVerboseVersion } from '../dist/version.js';
|
|
17
|
+
|
|
18
|
+
// Handle --version with --verbose before Commander processes it
|
|
19
|
+
// REQ-BUGFIX-005-03: Custom version action with verbose support
|
|
20
|
+
const args = process.argv.slice(2);
|
|
21
|
+
if (args.includes('-v') || args.includes('--version')) {
|
|
22
|
+
if (args.includes('--verbose')) {
|
|
23
|
+
console.log(formatVerboseVersion());
|
|
24
|
+
} else {
|
|
25
|
+
console.log(`musubix v${VERSION}`);
|
|
26
|
+
}
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
15
29
|
|
|
16
30
|
const program = createProgram();
|
|
17
31
|
registerCommands(program);
|
package/dist/cli/base.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @see REQ-ARC-002 - CLI Interface
|
|
10
10
|
* @see DES-MUSUBIX-001 Section 3.2 - CLI Interface Design
|
|
11
|
+
* @see REQ-BUGFIX-005-03 - Custom version action with verbose support
|
|
11
12
|
*/
|
|
12
13
|
import { Command } from 'commander';
|
|
13
14
|
/**
|
|
@@ -38,6 +39,7 @@ export interface GlobalOptions {
|
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
41
|
* Create the main CLI program
|
|
42
|
+
* @see REQ-BUGFIX-005-03 - Custom version action with --verbose support
|
|
41
43
|
*/
|
|
42
44
|
export declare function createProgram(): Command;
|
|
43
45
|
/**
|
package/dist/cli/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/cli/base.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/cli/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;CAOX,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CA+BvC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa,CAQhE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,IAAI,EAAE,CAAC,EACP,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3C,IAAI,CAUN;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAiBvE"}
|
package/dist/cli/base.js
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @see REQ-ARC-002 - CLI Interface
|
|
10
10
|
* @see DES-MUSUBIX-001 Section 3.2 - CLI Interface Design
|
|
11
|
+
* @see REQ-BUGFIX-005-03 - Custom version action with verbose support
|
|
11
12
|
*/
|
|
12
13
|
import { Command } from 'commander';
|
|
13
|
-
import { VERSION } from '../
|
|
14
|
+
import { VERSION, formatVerboseVersion } from '../version.js';
|
|
14
15
|
/**
|
|
15
16
|
* Exit codes for CLI commands
|
|
16
17
|
* @see DES-MUSUBIX-001 Section 3.2.3
|
|
@@ -25,6 +26,7 @@ export const ExitCode = {
|
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
27
28
|
* Create the main CLI program
|
|
29
|
+
* @see REQ-BUGFIX-005-03 - Custom version action with --verbose support
|
|
28
30
|
*/
|
|
29
31
|
export function createProgram() {
|
|
30
32
|
const program = new Command();
|
|
@@ -40,6 +42,19 @@ export function createProgram() {
|
|
|
40
42
|
sortSubcommands: true,
|
|
41
43
|
sortOptions: true,
|
|
42
44
|
});
|
|
45
|
+
// Custom version action for --verbose support (REQ-BUGFIX-005-03)
|
|
46
|
+
program.on('option:version', () => {
|
|
47
|
+
// Check if --verbose is also specified
|
|
48
|
+
const args = process.argv;
|
|
49
|
+
const hasVerbose = args.includes('--verbose') || args.some(arg => arg === '-v' && args.indexOf('-v') !== args.indexOf('--version'));
|
|
50
|
+
if (hasVerbose) {
|
|
51
|
+
console.log(formatVerboseVersion());
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
console.log(`musubix v${VERSION}`);
|
|
55
|
+
}
|
|
56
|
+
process.exit(0);
|
|
57
|
+
});
|
|
43
58
|
return program;
|
|
44
59
|
}
|
|
45
60
|
/**
|
package/dist/cli/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/cli/base.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/cli/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,CAAC;IACV,aAAa,EAAE,CAAC;IAChB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC;IACjB,gBAAgB,EAAE,CAAC;IACnB,aAAa,EAAE,CAAC;CACR,CAAC;AAmBX;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,OAAO;SACJ,IAAI,CAAC,SAAS,CAAC;SACf,WAAW,CAAC,2CAA2C,CAAC;SACxD,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,wBAAwB,CAAC;SAC3D,MAAM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
|
|
108
|
+
/**
|
|
109
|
+
* Generated skeleton for 4-file generation
|
|
110
|
+
* @see REQ-BUGFIX-003-01 - 4ファイル生成
|
|
111
|
+
* @see TSK-BUGFIX-003 - codegen完全実装
|
|
112
|
+
*/
|
|
113
|
+
export interface GeneratedSkeleton {
|
|
114
|
+
interface: GeneratedCode;
|
|
115
|
+
implementation: GeneratedCode;
|
|
116
|
+
test: GeneratedCode;
|
|
117
|
+
index: GeneratedCode;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Options for full skeleton generation
|
|
121
|
+
*/
|
|
122
|
+
export interface FullSkeletonOptions {
|
|
123
|
+
language: 'typescript' | 'javascript' | 'python';
|
|
124
|
+
patterns: string[];
|
|
125
|
+
requirements: string[];
|
|
126
|
+
designId?: string;
|
|
127
|
+
includeTest?: boolean;
|
|
128
|
+
}
|
|
108
129
|
/**
|
|
109
130
|
* Register codegen command
|
|
110
131
|
*/
|
|
111
132
|
export declare function registerCodegenCommand(program: Command): void;
|
|
133
|
+
/**
|
|
134
|
+
* Extended generation options for full skeleton
|
|
135
|
+
*/
|
|
136
|
+
interface ExtendedGenerateOptions {
|
|
137
|
+
fullSkeleton?: boolean;
|
|
138
|
+
withTests?: boolean;
|
|
139
|
+
}
|
|
112
140
|
/**
|
|
113
141
|
* Generate code from design
|
|
114
142
|
* Enhanced in v1.1.2: Domain-aware code generation using ComponentInference
|
|
143
|
+
* Enhanced in v3.3.10: Full skeleton generation (4 files per component)
|
|
144
|
+
* @see TSK-BUGFIX-003 - codegen完全実装
|
|
115
145
|
*/
|
|
116
|
-
declare function generateCodeFromDesign(content: string, options: CodegenOptions): GeneratedCode[];
|
|
146
|
+
declare function generateCodeFromDesign(content: string, options: CodegenOptions, extendedOptions?: ExtendedGenerateOptions): GeneratedCode[];
|
|
117
147
|
/**
|
|
118
148
|
* Analyze file
|
|
119
149
|
*/
|
|
@@ -122,5 +152,11 @@ declare function analyzeFile(file: string, lines: string[], issues: AnalysisIssu
|
|
|
122
152
|
* Scan file for security issues
|
|
123
153
|
*/
|
|
124
154
|
declare function scanFile(file: string, content: string, vulnerabilities: SecurityVulnerability[]): void;
|
|
155
|
+
/**
|
|
156
|
+
* Generate full skeleton with 4 files (interface, implementation, test, index)
|
|
157
|
+
* @see REQ-BUGFIX-003-01 - 4ファイル生成
|
|
158
|
+
* @see TSK-BUGFIX-003-02 - SkeletonGenerator拡張
|
|
159
|
+
*/
|
|
160
|
+
export declare function generateFullSkeleton(componentName: string, options: FullSkeletonOptions): GeneratedSkeleton;
|
|
125
161
|
export { generateCodeFromDesign, analyzeFile, scanFile, };
|
|
126
162
|
//# sourceMappingURL=codegen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,YAAY,GAAG,YAAY,GAAG,QAAQ,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,OAAO,EAAE;QACP,UAAU,EA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.option('-o, --output <dir>', 'Output directory', 'src/generated')
|
|
151
151
|
.option('-l, --language <lang>', 'Target language', 'typescript')
|
|
152
152
|
.option('-t, --template <name>', 'Code template to use')
|
|
153
|
+
.option('--full-skeleton', 'Generate 4 files per component (interface, impl, test, index)')
|
|
154
|
+
.option('--with-tests', 'Include test files in generation')
|
|
153
155
|
.action(async (design, options) => {
|
|
154
156
|
const globalOpts = getGlobalOptions(program);
|
|
155
157
|
try {
|
|
156
158
|
const designPath = resolve(process.cwd(), design);
|
|
157
159
|
const content = await readFile(designPath, 'utf-8');
|
|
158
160
|
// Parse design and generate code
|
|
159
|
-
const files = generateCodeFromDesign(content, options);
|
|
161
|
+
const files = generateCodeFromDesign(content, options, { fullSkeleton: options.fullSkeleton, withTests: options.withTests });
|
|
160
162
|
const outputDir = resolve(process.cwd(), options.output ?? 'src/generated');
|
|
161
163
|
await mkdir(outputDir, { recursive: true });
|
|
162
164
|
let totalLines = 0;
|
|
@@ -502,10 +504,13 @@ function inferComponentsFromRequirements(requirements) {
|
|
|
502
504
|
/**
|
|
503
505
|
* Generate code from design
|
|
504
506
|
* Enhanced in v1.1.2: Domain-aware code generation using ComponentInference
|
|
507
|
+
* Enhanced in v3.3.10: Full skeleton generation (4 files per component)
|
|
508
|
+
* @see TSK-BUGFIX-003 - codegen完全実装
|
|
505
509
|
*/
|
|
506
|
-
function generateCodeFromDesign(content, options) {
|
|
510
|
+
function generateCodeFromDesign(content, options, extendedOptions) {
|
|
507
511
|
const files = [];
|
|
508
512
|
const language = options.language ?? 'typescript';
|
|
513
|
+
const { fullSkeleton = false, withTests = false } = extendedOptions ?? {};
|
|
509
514
|
// Detect domain from content for domain-specific method generation
|
|
510
515
|
const componentInference = new ComponentInference();
|
|
511
516
|
const domainKeywords = content.toLowerCase();
|
|
@@ -527,6 +532,18 @@ function generateCodeFromDesign(content, options) {
|
|
|
527
532
|
for (const component of c4Components) {
|
|
528
533
|
if (component.type === 'person')
|
|
529
534
|
continue; // Skip user/person elements
|
|
535
|
+
// Full skeleton mode: generate 4 files per component
|
|
536
|
+
if (fullSkeleton) {
|
|
537
|
+
const skeleton = generateFullSkeleton(component.name, {
|
|
538
|
+
language: language,
|
|
539
|
+
patterns: patterns.map(p => p.name),
|
|
540
|
+
requirements: reqMatches.slice(0, 5),
|
|
541
|
+
designId: component.id,
|
|
542
|
+
includeTest: true,
|
|
543
|
+
});
|
|
544
|
+
files.push(skeleton.interface, skeleton.implementation, skeleton.test, skeleton.index);
|
|
545
|
+
continue;
|
|
546
|
+
}
|
|
530
547
|
const code = generateC4ComponentCode(component, language, reqMatches, patterns, detectedDomain);
|
|
531
548
|
// Normalize name: BLOG_PLATFORM → BlogPlatform → blog-platform
|
|
532
549
|
const normalizedName = toKebabCase(toPascalCase(component.name));
|
|
@@ -540,6 +557,20 @@ function generateCodeFromDesign(content, options) {
|
|
|
540
557
|
patterns: patterns.map(p => p.name),
|
|
541
558
|
},
|
|
542
559
|
});
|
|
560
|
+
// Generate test file if --with-tests is specified
|
|
561
|
+
if (withTests) {
|
|
562
|
+
const testCode = generateTestForComponent(normalizedName, language);
|
|
563
|
+
files.push({
|
|
564
|
+
filename: `${normalizedName}.test${ext}`,
|
|
565
|
+
language,
|
|
566
|
+
content: testCode,
|
|
567
|
+
metadata: {
|
|
568
|
+
requirements: [],
|
|
569
|
+
designElements: [],
|
|
570
|
+
patterns: [],
|
|
571
|
+
},
|
|
572
|
+
});
|
|
573
|
+
}
|
|
543
574
|
}
|
|
544
575
|
}
|
|
545
576
|
else if (isEarsDoc) {
|
|
@@ -1158,6 +1189,197 @@ function toKebabCase(str) {
|
|
|
1158
1189
|
.replace(/[\s_]+/g, '-')
|
|
1159
1190
|
.toLowerCase();
|
|
1160
1191
|
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Generate full skeleton with 4 files (interface, implementation, test, index)
|
|
1194
|
+
* @see REQ-BUGFIX-003-01 - 4ファイル生成
|
|
1195
|
+
* @see TSK-BUGFIX-003-02 - SkeletonGenerator拡張
|
|
1196
|
+
*/
|
|
1197
|
+
export function generateFullSkeleton(componentName, options) {
|
|
1198
|
+
const baseName = toKebabCase(componentName);
|
|
1199
|
+
const className = toPascalCase(componentName);
|
|
1200
|
+
const ext = options.language === 'typescript' ? '.ts' : options.language === 'javascript' ? '.js' : '.py';
|
|
1201
|
+
const reqComments = options.requirements.map(r => ` * @see ${r}`).join('\n');
|
|
1202
|
+
const patternComments = options.patterns.map(p => ` * @pattern ${p}`).join('\n');
|
|
1203
|
+
const traceComment = options.designId ? ` * @trace ${options.designId}` : '';
|
|
1204
|
+
// Interface file
|
|
1205
|
+
const interfaceContent = `/**
|
|
1206
|
+
* ${className} Interface
|
|
1207
|
+
*
|
|
1208
|
+
${reqComments}
|
|
1209
|
+
${patternComments}
|
|
1210
|
+
${traceComment}
|
|
1211
|
+
* @generated
|
|
1212
|
+
*/
|
|
1213
|
+
|
|
1214
|
+
export interface I${className} {
|
|
1215
|
+
/**
|
|
1216
|
+
* Get the identifier
|
|
1217
|
+
*/
|
|
1218
|
+
getId(): string;
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* Execute the main operation
|
|
1222
|
+
*/
|
|
1223
|
+
execute(): Promise<void>;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
export interface ${className}Config {
|
|
1227
|
+
readonly id: string;
|
|
1228
|
+
readonly options?: Record<string, unknown>;
|
|
1229
|
+
}
|
|
1230
|
+
`;
|
|
1231
|
+
// Implementation file
|
|
1232
|
+
const implementationContent = `/**
|
|
1233
|
+
* ${className} Implementation
|
|
1234
|
+
*
|
|
1235
|
+
${reqComments}
|
|
1236
|
+
${patternComments}
|
|
1237
|
+
${traceComment}
|
|
1238
|
+
* @generated
|
|
1239
|
+
*/
|
|
1240
|
+
|
|
1241
|
+
import type { I${className}, ${className}Config } from './${baseName}.interface${ext === '.ts' ? '' : ext}';
|
|
1242
|
+
|
|
1243
|
+
export class ${className} implements I${className} {
|
|
1244
|
+
private readonly config: ${className}Config;
|
|
1245
|
+
|
|
1246
|
+
constructor(config: ${className}Config) {
|
|
1247
|
+
this.config = config;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
getId(): string {
|
|
1251
|
+
return this.config.id;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
async execute(): Promise<void> {
|
|
1255
|
+
// TODO: Implement ${className} logic
|
|
1256
|
+
throw new Error('Not implemented');
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
export function create${className}(config: ${className}Config): I${className} {
|
|
1261
|
+
return new ${className}(config);
|
|
1262
|
+
}
|
|
1263
|
+
`;
|
|
1264
|
+
// Test file
|
|
1265
|
+
const testContent = `/**
|
|
1266
|
+
* ${className} Tests
|
|
1267
|
+
*
|
|
1268
|
+
${reqComments}
|
|
1269
|
+
* @generated
|
|
1270
|
+
*/
|
|
1271
|
+
|
|
1272
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
1273
|
+
import { ${className}, create${className} } from './${baseName}${ext === '.ts' ? '' : ext}';
|
|
1274
|
+
import type { ${className}Config } from './${baseName}.interface${ext === '.ts' ? '' : ext}';
|
|
1275
|
+
|
|
1276
|
+
describe('${className}', () => {
|
|
1277
|
+
let instance: ${className};
|
|
1278
|
+
const testConfig: ${className}Config = {
|
|
1279
|
+
id: 'test-${baseName}-001',
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1282
|
+
beforeEach(() => {
|
|
1283
|
+
instance = new ${className}(testConfig);
|
|
1284
|
+
});
|
|
1285
|
+
|
|
1286
|
+
describe('getId', () => {
|
|
1287
|
+
it('should return the configured id', () => {
|
|
1288
|
+
expect(instance.getId()).toBe(testConfig.id);
|
|
1289
|
+
});
|
|
1290
|
+
});
|
|
1291
|
+
|
|
1292
|
+
describe('execute', () => {
|
|
1293
|
+
it('should be implemented', async () => {
|
|
1294
|
+
// TODO: Update test when implementation is complete
|
|
1295
|
+
await expect(instance.execute()).rejects.toThrow('Not implemented');
|
|
1296
|
+
});
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1299
|
+
describe('create${className}', () => {
|
|
1300
|
+
it('should create an instance via factory', () => {
|
|
1301
|
+
const created = create${className}(testConfig);
|
|
1302
|
+
expect(created.getId()).toBe(testConfig.id);
|
|
1303
|
+
});
|
|
1304
|
+
});
|
|
1305
|
+
});
|
|
1306
|
+
`;
|
|
1307
|
+
// Index file
|
|
1308
|
+
const indexContent = `/**
|
|
1309
|
+
* ${className} Module
|
|
1310
|
+
* @generated
|
|
1311
|
+
*/
|
|
1312
|
+
|
|
1313
|
+
export type { I${className}, ${className}Config } from './${baseName}.interface${ext === '.ts' ? '' : ext}';
|
|
1314
|
+
export { ${className}, create${className} } from './${baseName}${ext === '.ts' ? '' : ext}';
|
|
1315
|
+
`;
|
|
1316
|
+
return {
|
|
1317
|
+
interface: {
|
|
1318
|
+
filename: `${baseName}.interface${ext}`,
|
|
1319
|
+
language: options.language,
|
|
1320
|
+
content: interfaceContent,
|
|
1321
|
+
metadata: {
|
|
1322
|
+
requirements: options.requirements,
|
|
1323
|
+
designElements: options.designId ? [options.designId] : [],
|
|
1324
|
+
patterns: options.patterns,
|
|
1325
|
+
},
|
|
1326
|
+
},
|
|
1327
|
+
implementation: {
|
|
1328
|
+
filename: `${baseName}${ext}`,
|
|
1329
|
+
language: options.language,
|
|
1330
|
+
content: implementationContent,
|
|
1331
|
+
metadata: {
|
|
1332
|
+
requirements: options.requirements,
|
|
1333
|
+
designElements: options.designId ? [options.designId] : [],
|
|
1334
|
+
patterns: options.patterns,
|
|
1335
|
+
},
|
|
1336
|
+
},
|
|
1337
|
+
test: {
|
|
1338
|
+
filename: `${baseName}.test${ext}`,
|
|
1339
|
+
language: options.language,
|
|
1340
|
+
content: testContent,
|
|
1341
|
+
metadata: {
|
|
1342
|
+
requirements: options.requirements,
|
|
1343
|
+
designElements: [],
|
|
1344
|
+
patterns: [],
|
|
1345
|
+
},
|
|
1346
|
+
},
|
|
1347
|
+
index: {
|
|
1348
|
+
filename: `index${ext}`,
|
|
1349
|
+
language: options.language,
|
|
1350
|
+
content: indexContent,
|
|
1351
|
+
metadata: {
|
|
1352
|
+
requirements: [],
|
|
1353
|
+
designElements: [],
|
|
1354
|
+
patterns: [],
|
|
1355
|
+
},
|
|
1356
|
+
},
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Generate test file for a component
|
|
1361
|
+
* @see TSK-BUGFIX-006 - テスト生成統合
|
|
1362
|
+
*/
|
|
1363
|
+
function generateTestForComponent(componentName, _language) {
|
|
1364
|
+
const className = toPascalCase(componentName);
|
|
1365
|
+
const baseName = toKebabCase(componentName);
|
|
1366
|
+
return `/**
|
|
1367
|
+
* ${className} Tests
|
|
1368
|
+
* @generated
|
|
1369
|
+
*/
|
|
1370
|
+
|
|
1371
|
+
import { describe, it, expect } from 'vitest';
|
|
1372
|
+
import { ${className} } from './${baseName}';
|
|
1373
|
+
|
|
1374
|
+
describe('${className}', () => {
|
|
1375
|
+
it('should be defined', () => {
|
|
1376
|
+
expect(${className}).toBeDefined();
|
|
1377
|
+
});
|
|
1378
|
+
|
|
1379
|
+
// TODO: Add more test cases based on the component's functionality
|
|
1380
|
+
});
|
|
1381
|
+
`;
|
|
1382
|
+
}
|
|
1161
1383
|
/**
|
|
1162
1384
|
* Parse C4 design document components from table format
|
|
1163
1385
|
*/
|