musubix 1.1.6 → 1.1.8

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 CHANGED
@@ -276,7 +276,92 @@ npx musubix codegen generate <design.md> --output src/
276
276
 
277
277
  ---
278
278
 
279
- ## 📚 ドキュメント
279
+ ## 学習済みベストプラクティス(v1.1.7 NEW!)
280
+
281
+ Project-07 Medical Clinic、Project-08 Property Rentalの実装から学習したパターンです。
282
+
283
+ ### コードパターン
284
+
285
+ | ID | 名称 | 概要 | 信頼度 |
286
+ |----|------|------|--------|
287
+ | BP-CODE-001 | Entity Input DTO | エンティティ作成にInput DTOオブジェクトを使用 | 95% |
288
+ | BP-CODE-002 | Date-based ID Format | PREFIX-YYYYMMDD-NNN形式でIDを生成 | 90% |
289
+ | BP-CODE-003 | Value Objects | ドメイン概念にValue Objectを使用 | 90% |
290
+
291
+ **Entity Input DTO例**:
292
+ ```typescript
293
+ // ✅ 推奨: Input DTOを使用
294
+ interface CreatePatientInput {
295
+ name: PersonName;
296
+ dateOfBirth: Date;
297
+ contact: ContactInfo;
298
+ }
299
+ function createPatient(input: CreatePatientInput): Patient { ... }
300
+
301
+ // ❌ 非推奨: 複数パラメータ
302
+ function createPatient(name: PersonName, dob: Date, contact: ContactInfo): Patient
303
+ ```
304
+
305
+ ### 設計パターン
306
+
307
+ | ID | 名称 | 概要 | 信頼度 |
308
+ |----|------|------|--------|
309
+ | BP-DESIGN-001 | Status Transition Map | 有効なステータス遷移をMapで定義 | 95% |
310
+ | BP-DESIGN-002 | Repository Async Pattern | 将来のDB移行に備えてasync化 | 85% |
311
+ | BP-DESIGN-003 | Service Layer with DI | リポジトリをDIしたService層 | 90% |
312
+
313
+ **Status Transition Map例**:
314
+ ```typescript
315
+ const validStatusTransitions: Record<Status, Status[]> = {
316
+ draft: ['active'],
317
+ active: ['renewed', 'terminated', 'expired'],
318
+ renewed: [],
319
+ terminated: [],
320
+ expired: ['renewed'],
321
+ };
322
+ ```
323
+
324
+ ### テストパターン
325
+
326
+ | ID | 名称 | 概要 | 信頼度 |
327
+ |----|------|------|--------|
328
+ | BP-TEST-001 | Test Counter Reset | beforeEachでIDカウンターをリセット | 95% |
329
+ | BP-TEST-002 | Verify API Before Test | テスト前にAPIシグネチャを確認 | 80% |
330
+ | BP-TEST-003 | Vitest ESM Configuration | Vitest + TypeScript ESM構成 | 85% |
331
+
332
+ **Test Counter Reset例**:
333
+ ```typescript
334
+ // Entity側でresetXxxCounter()を提供
335
+ export function resetPatientCounter(): void { patientCounter = 0; }
336
+
337
+ // テスト側でbeforeEachでリセット
338
+ beforeEach(() => {
339
+ resetPatientCounter();
340
+ resetAppointmentCounter();
341
+ });
342
+ ```
343
+
344
+ ### CLIでベストプラクティスを表示
345
+
346
+ ```bash
347
+ # 全ベストプラクティス表示
348
+ npx musubix learn best-practices
349
+
350
+ # カテゴリ別フィルタ
351
+ npx musubix learn best-practices --category code
352
+ npx musubix learn best-practices --category design
353
+ npx musubix learn best-practices --category test
354
+
355
+ # 高信頼度パターンのみ
356
+ npx musubix learn best-practices --high-confidence
357
+
358
+ # Markdown出力
359
+ npx musubix learn best-practices --format markdown
360
+ ```
361
+
362
+ ---
363
+
364
+ ## �📚 ドキュメント
280
365
 
281
366
  | ドキュメント | 説明 |
282
367
  |-------------|------|
@@ -314,6 +399,6 @@ npx musubix codegen generate <design.md> --output src/
314
399
  ---
315
400
 
316
401
  **Agent**: GitHub Copilot / Claude
317
- **Last Updated**: 2026-01-04
318
- **Version**: 1.1.4
402
+ **Last Updated**: 2026-01-05
403
+ **Version**: 1.1.7
319
404
  **Repository**: https://github.com/nahisaho/MUSUBIX
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musubix",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Neuro-Symbolic AI Coding System - MUSUBI × YATA Integration",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -19,9 +19,11 @@
19
19
  "docs/",
20
20
  "steering/",
21
21
  "templates/",
22
- ".github/"
22
+ ".github/",
23
+ "scripts/"
23
24
  ],
24
25
  "scripts": {
26
+ "postinstall": "node scripts/postinstall.js",
25
27
  "build": "npm run build --workspaces --if-present",
26
28
  "test": "vitest run",
27
29
  "test:unit": "vitest run --dir packages/*/src/__tests__",
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * MUSUBIX Postinstall Script
4
+ *
5
+ * Copies .github/ and AGENTS.md to the project root after npm install.
6
+ * This enables GitHub Copilot and other AI agents to use MUSUBIX prompts and skills.
7
+ */
8
+
9
+ import { existsSync, cpSync, copyFileSync, mkdirSync } from 'fs';
10
+ import { dirname, join, resolve } from 'path';
11
+ import { fileURLToPath } from 'url';
12
+
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = dirname(__filename);
15
+
16
+ // Source: where musubix is installed (node_modules/musubix)
17
+ const packageRoot = resolve(__dirname, '..');
18
+
19
+ // Target: project root (where npm install was run)
20
+ // When installed as dependency: process.env.INIT_CWD points to project root
21
+ // When running in musubix repo itself: skip
22
+ const projectRoot = process.env.INIT_CWD || process.cwd();
23
+
24
+ // Skip if we're in the musubix package itself
25
+ if (projectRoot === packageRoot || projectRoot.includes('node_modules/musubix')) {
26
+ console.log('musubix: Skipping postinstall (running in package directory)');
27
+ process.exit(0);
28
+ }
29
+
30
+ const sourceGithub = join(packageRoot, '.github');
31
+ const sourceAgents = join(packageRoot, 'AGENTS.md');
32
+ const targetGithub = join(projectRoot, '.github');
33
+ const targetAgents = join(projectRoot, 'AGENTS.md');
34
+
35
+ let copied = false;
36
+
37
+ // Copy .github directory
38
+ if (existsSync(sourceGithub)) {
39
+ // Only copy musubix-specific files, don't overwrite existing .github
40
+ const musubixPrompts = join(sourceGithub, 'prompts');
41
+ const musubixSkills = join(sourceGithub, 'skills');
42
+ const musubixAgents = join(sourceGithub, 'AGENTS.md');
43
+
44
+ // Create .github if not exists
45
+ if (!existsSync(targetGithub)) {
46
+ mkdirSync(targetGithub, { recursive: true });
47
+ }
48
+
49
+ // Copy prompts
50
+ if (existsSync(musubixPrompts)) {
51
+ const targetPrompts = join(targetGithub, 'prompts');
52
+ if (!existsSync(targetPrompts)) {
53
+ mkdirSync(targetPrompts, { recursive: true });
54
+ }
55
+ cpSync(musubixPrompts, targetPrompts, { recursive: true, force: false });
56
+ console.log('musubix: Copied .github/prompts/');
57
+ copied = true;
58
+ }
59
+
60
+ // Copy skills
61
+ if (existsSync(musubixSkills)) {
62
+ const targetSkills = join(targetGithub, 'skills');
63
+ if (!existsSync(targetSkills)) {
64
+ mkdirSync(targetSkills, { recursive: true });
65
+ }
66
+ cpSync(musubixSkills, targetSkills, { recursive: true, force: false });
67
+ console.log('musubix: Copied .github/skills/');
68
+ copied = true;
69
+ }
70
+
71
+ // Copy .github/AGENTS.md
72
+ if (existsSync(musubixAgents)) {
73
+ const targetGithubAgents = join(targetGithub, 'AGENTS.md');
74
+ if (!existsSync(targetGithubAgents)) {
75
+ copyFileSync(musubixAgents, targetGithubAgents);
76
+ console.log('musubix: Copied .github/AGENTS.md');
77
+ copied = true;
78
+ }
79
+ }
80
+ }
81
+
82
+ // Copy AGENTS.md to project root
83
+ if (existsSync(sourceAgents) && !existsSync(targetAgents)) {
84
+ copyFileSync(sourceAgents, targetAgents);
85
+ console.log('musubix: Copied AGENTS.md');
86
+ copied = true;
87
+ }
88
+
89
+ if (copied) {
90
+ console.log('musubix: AI agent configuration files installed successfully!');
91
+ console.log('musubix: GitHub Copilot can now use MUSUBIX SDD prompts and skills.');
92
+ } else {
93
+ console.log('musubix: Configuration files already exist, skipping.');
94
+ }