musubix 3.4.7 → 3.5.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.
Files changed (95) hide show
  1. package/README.md +50 -315
  2. package/bin/musubix.js +1 -9
  3. package/dist/index.d.ts +25 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +74 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +52 -58
  8. package/.github/AGENTS.md +0 -949
  9. package/.github/prompts/sdd-change-apply.prompt.md +0 -283
  10. package/.github/prompts/sdd-change-archive.prompt.md +0 -241
  11. package/.github/prompts/sdd-change-init.prompt.md +0 -269
  12. package/.github/prompts/sdd-design.prompt.md +0 -250
  13. package/.github/prompts/sdd-implement.prompt.md +0 -387
  14. package/.github/prompts/sdd-requirements.prompt.md +0 -193
  15. package/.github/prompts/sdd-review.prompt.md +0 -155
  16. package/.github/prompts/sdd-security.prompt.md +0 -228
  17. package/.github/prompts/sdd-steering.prompt.md +0 -269
  18. package/.github/prompts/sdd-tasks.prompt.md +0 -255
  19. package/.github/prompts/sdd-test.prompt.md +0 -230
  20. package/.github/prompts/sdd-validate.prompt.md +0 -304
  21. package/.github/skills/musubix-adr-generation/SKILL.md +0 -209
  22. package/.github/skills/musubix-best-practices/SKILL.md +0 -315
  23. package/.github/skills/musubix-c4-design/SKILL.md +0 -162
  24. package/.github/skills/musubix-code-generation/SKILL.md +0 -237
  25. package/.github/skills/musubix-domain-inference/SKILL.md +0 -196
  26. package/.github/skills/musubix-ears-validation/SKILL.md +0 -161
  27. package/.github/skills/musubix-sdd-workflow/SKILL.md +0 -217
  28. package/.github/skills/musubix-technical-writing/SKILL.md +0 -444
  29. package/.github/skills/musubix-test-generation/SKILL.md +0 -212
  30. package/.github/skills/musubix-traceability/SKILL.md +0 -141
  31. package/AGENTS.md +0 -1134
  32. package/LICENSE +0 -21
  33. package/README.ja.md +0 -313
  34. package/bin/musubix-mcp.js +0 -15
  35. package/docs/API-REFERENCE.md +0 -1425
  36. package/docs/GITHUB-ACTIONS-NPM-SETUP.md +0 -132
  37. package/docs/INSTALL-GUIDE.ja.md +0 -459
  38. package/docs/INSTALL-GUIDE.md +0 -459
  39. package/docs/MIGRATION-v3.0.md +0 -324
  40. package/docs/MUSUBI-enhancement_roadmap_20260105.md +0 -651
  41. package/docs/MUSUBIX-v3.0-User-Guide.md +0 -1357
  42. package/docs/MUSUBIXv2.2.0-Manual-outline.md +0 -136
  43. package/docs/MUSUBIXv2.2.0-Manual.md +0 -3123
  44. package/docs/MUSUBIXv2.3.5-Refactering.md +0 -1310
  45. package/docs/MUSUBIv1.6.1-enhancement_roadmap_20260105.md +0 -291
  46. package/docs/MUSUBIv2.2.0-USERGUIDE.md +0 -2079
  47. package/docs/ROADMAP-v1.5.md +0 -116
  48. package/docs/SwarmCoding.md +0 -1284
  49. package/docs/Test-prompt.md +0 -105
  50. package/docs/USER-GUIDE-v1.8.0.md +0 -2371
  51. package/docs/USER-GUIDE.ja.md +0 -2147
  52. package/docs/USER-GUIDE.md +0 -3022
  53. package/docs/YATA-GLOBAL-GUIDE.ja.md +0 -750
  54. package/docs/YATA-GLOBAL-GUIDE.md +0 -595
  55. package/docs/YATA-LOCAL-GUIDE.ja.md +0 -989
  56. package/docs/YATA-LOCAL-GUIDE.md +0 -730
  57. package/docs/adr/0001-real-time-pattern-learning-architecture-for-v1-5-0.md +0 -75
  58. package/docs/adr/0002-pattern-sharing-protocol-for-cross-team-collaborat.md +0 -79
  59. package/docs/adr/0003-owl-2-rl-implementation-strategy-for-advanced-infe.md +0 -90
  60. package/docs/adr/ADR-v3.4.0-001-deep-research-architecture.md +0 -217
  61. package/docs/adr/ADR-v3.4.0-002-search-provider-selection.md +0 -308
  62. package/docs/adr/ADR-v3.4.0-003-lm-api-integration.md +0 -475
  63. package/docs/enterprise-knowledge-management.md +0 -1737
  64. package/docs/evolution-from-musubi-to-musubix.md +0 -2170
  65. package/docs/getting-started-with-sdd.md +0 -1602
  66. package/docs/moodle-refactering-codegraph-musubix.md +0 -391
  67. package/docs/moodle-refactering-codegraph.md +0 -278
  68. package/docs/overview/MUSUBIX-CodeGraph.md +0 -322
  69. package/docs/overview/MUSUBIX-Core.md +0 -671
  70. package/docs/overview/MUSUBIX-Decisions.md +0 -494
  71. package/docs/overview/MUSUBIX-FormalVerify.md +0 -566
  72. package/docs/overview/MUSUBIX-Knowledge.md +0 -1231
  73. package/docs/overview/MUSUBIX-Learning.md +0 -837
  74. package/docs/overview/MUSUBIX-MCP-Server.md +0 -535
  75. package/docs/overview/MUSUBIX-Overview.md +0 -264
  76. package/docs/overview/MUSUBIX-Phase1-Complete.md +0 -271
  77. package/docs/overview/MUSUBIX-Phase2-Complete.md +0 -310
  78. package/docs/overview/MUSUBIX-Policy.md +0 -477
  79. package/docs/overview/MUSUBIX-Roadmap-v2.md +0 -399
  80. package/docs/overview/MUSUBIX-Security-Plan.md +0 -939
  81. package/docs/overview/MUSUBIX-Security-v2.1.md +0 -668
  82. package/docs/overview/MUSUBIX-Security.md +0 -891
  83. package/docs/overview/MUSUBIX-YATA.md +0 -666
  84. package/docs/overview/MUSUBIX-v2.2.0-Advanced-Learning.md +0 -513
  85. package/docs/overview/Neuro-SymbolicAI.md +0 -159
  86. package/docs/packages/knowledge.md +0 -594
  87. package/docs/qiita-linux-kernel-knowledge-graph.md +0 -596
  88. package/scripts/generate-quality-gate-report.ts +0 -106
  89. package/scripts/postinstall.js +0 -94
  90. package/steering/.musubi-version +0 -1
  91. package/steering/product.ja.md +0 -572
  92. package/steering/project.yml +0 -66
  93. package/steering/rules/constitution.md +0 -491
  94. package/steering/structure.ja.md +0 -503
  95. package/steering/tech.ja.md +0 -208
@@ -1,477 +0,0 @@
1
- # MUSUBIX Policy パッケージ
2
-
3
- **パッケージ名**: `@musubix/policy`
4
- **バージョン**: 3.0.1
5
- **最終更新**: 2026-01-12
6
-
7
- ---
8
-
9
- ## 1. 概要
10
-
11
- `@musubix/policy` は、MUSUBIX v3.0で導入されたポリシー検証エンジンです。MUSUBIX 9憲法条項に基づいてプロジェクトの構造・品質を自動検証し、開発プロセスの一貫性を保証します。
12
-
13
- ### 1.1 特徴
14
-
15
- | 特徴 | 説明 |
16
- |------|------|
17
- | **9憲法条項検証** | MUSUBIX開発ルールへの準拠を自動チェック |
18
- | **CI/CD統合** | GitHub Actions等への組み込みが容易 |
19
- | **カスタムポリシー** | プロジェクト固有のルールを追加可能 |
20
- | **詳細レポート** | 違反箇所と修正方法を明示 |
21
- | **型安全** | TypeScriptによる完全な型定義 |
22
-
23
- ### 1.2 9憲法条項
24
-
25
- | 条項 | ID | 名称 | 概要 |
26
- |------|-----|------|------|
27
- | I | CONST-001 | Library-First | 機能は独立ライブラリとして開始 |
28
- | II | CONST-002 | CLI Interface | すべてのライブラリはCLI公開必須 |
29
- | III | CONST-003 | Test-First | Red-Green-Blueサイクルでテスト先行 |
30
- | IV | CONST-004 | EARS Format | 要件はEARS形式で記述 |
31
- | V | CONST-005 | Traceability | 要件↔設計↔コード↔テストの100%追跡 |
32
- | VI | CONST-006 | Project Memory | steering/を参照してから決定 |
33
- | VII | CONST-007 | Design Patterns | 設計パターン適用の文書化 |
34
- | VIII | CONST-008 | Decision Records | すべての決定をADRで記録 |
35
- | IX | CONST-009 | Quality Gates | フェーズ移行前の品質検証 |
36
-
37
- ---
38
-
39
- ## 2. インストール
40
-
41
- ```bash
42
- # 単体インストール
43
- npm install @musubix/policy
44
-
45
- # または musubix パッケージ経由
46
- npm install musubix
47
- ```
48
-
49
- ---
50
-
51
- ## 3. 基本的な使い方
52
-
53
- ### 3.1 ポリシーエンジンの初期化
54
-
55
- ```typescript
56
- import { createPolicyEngine } from '@musubix/policy';
57
-
58
- const engine = createPolicyEngine();
59
- ```
60
-
61
- ### 3.2 プロジェクト全体の検証
62
-
63
- ```typescript
64
- const report = await engine.validateProject('.');
65
-
66
- console.log('合格:', report.passed);
67
- console.log('違反数:', report.violations.length);
68
- console.log('警告数:', report.warnings.length);
69
-
70
- // 違反の詳細
71
- for (const v of report.violations) {
72
- console.log(`[${v.severity}] ${v.policyId}: ${v.message}`);
73
- if (v.suggestion) {
74
- console.log(` 修正案: ${v.suggestion}`);
75
- }
76
- }
77
- ```
78
-
79
- ### 3.3 特定ポリシーのみ検証
80
-
81
- ```typescript
82
- // CONST-001(Library-First)とCONST-003(Test-First)のみ
83
- const report = await engine.validate(
84
- { projectPath: '.' },
85
- ['CONST-001', 'CONST-003']
86
- );
87
- ```
88
-
89
- ### 3.4 ファイル単位の検証
90
-
91
- ```typescript
92
- // 要件ファイルがEARS形式か確認
93
- const report = await engine.validateFile('storage/specs/REQ-001.md');
94
-
95
- if (!report.passed) {
96
- console.log('EARS形式に準拠していません');
97
- for (const v of report.violations) {
98
- console.log(` - ${v.message}`);
99
- }
100
- }
101
- ```
102
-
103
- ---
104
-
105
- ## 4. ポリシー詳細
106
-
107
- ### 4.1 CONST-001: Library-First
108
-
109
- **検証内容**: `packages/` ディレクトリの存在を確認
110
-
111
- ```typescript
112
- // 違反例
113
- project/
114
- ├── src/ # packages/ がない → 違反
115
- └── package.json
116
-
117
- // 準拠例
118
- project/
119
- ├── packages/
120
- │ ├── core/
121
- │ └── utils/
122
- └── package.json
123
- ```
124
-
125
- ### 4.2 CONST-002: CLI Interface
126
-
127
- **検証内容**: `bin/` ディレクトリまたは package.json の `bin` フィールドを確認
128
-
129
- ```json
130
- // 準拠例: package.json
131
- {
132
- "name": "my-package",
133
- "bin": {
134
- "my-cli": "./bin/cli.js"
135
- }
136
- }
137
- ```
138
-
139
- ### 4.3 CONST-003: Test-First
140
-
141
- **検証内容**: テストファイル(`*.test.ts`, `*.spec.ts`)の存在を確認
142
-
143
- ```typescript
144
- // 検証対象パターン
145
- **/*.test.ts
146
- **/*.spec.ts
147
- **/__tests__/*.ts
148
- ```
149
-
150
- ### 4.4 CONST-004: EARS Format
151
-
152
- **検証内容**: 要件ファイルがEARS形式(5パターン)で記述されているか確認
153
-
154
- ```markdown
155
- <!-- 5つのEARSパターン -->
156
- 1. Ubiquitous: THE [system] SHALL [requirement]
157
- 2. Event-driven: WHEN [event], THE [system] SHALL [response]
158
- 3. State-driven: WHILE [state], THE [system] SHALL [response]
159
- 4. Unwanted: THE [system] SHALL NOT [behavior]
160
- 5. Optional: IF [condition], THEN THE [system] SHALL [response]
161
- ```
162
-
163
- ### 4.5 CONST-005: Traceability
164
-
165
- **検証内容**: `storage/traceability/` ディレクトリの存在を確認
166
-
167
- ```
168
- project/
169
- └── storage/
170
- └── traceability/
171
- ├── matrix.json
172
- └── links.json
173
- ```
174
-
175
- ### 4.6 CONST-006: Project Memory
176
-
177
- **検証内容**: `steering/` ディレクトリの存在を確認
178
-
179
- ```
180
- project/
181
- └── steering/
182
- ├── structure.ja.md
183
- ├── tech.ja.md
184
- ├── product.ja.md
185
- └── rules/
186
- └── constitution.md
187
- ```
188
-
189
- ### 4.7 CONST-007: Design Patterns
190
-
191
- **検証内容**: `storage/design/` ディレクトリの存在を確認
192
-
193
- ```
194
- project/
195
- └── storage/
196
- └── design/
197
- ├── patterns.md
198
- └── decisions/
199
- ```
200
-
201
- ### 4.8 CONST-008: Decision Records
202
-
203
- **検証内容**: `docs/decisions/` または `docs/adr/` ディレクトリの存在を確認
204
-
205
- ```
206
- project/
207
- └── docs/
208
- └── decisions/
209
- ├── ADR-0001.md
210
- └── ADR-0002.md
211
- ```
212
-
213
- ### 4.9 CONST-009: Quality Gates
214
-
215
- **検証内容**: CI設定(`.github/workflows/`)またはテスト設定(`vitest.config.ts`等)の存在を確認
216
-
217
- ```
218
- project/
219
- ├── .github/
220
- │ └── workflows/
221
- │ └── ci.yml
222
- └── vitest.config.ts
223
- ```
224
-
225
- ---
226
-
227
- ## 5. ポリシー一覧の取得
228
-
229
- ```typescript
230
- // 全ポリシー
231
- const all = engine.listPolicies();
232
-
233
- // 憲法条項のみ
234
- const constitution = engine.listPolicies('constitution');
235
-
236
- // カスタムポリシーのみ
237
- const custom = engine.listPolicies('custom');
238
-
239
- for (const p of constitution) {
240
- console.log(`${p.id}: ${p.name} (${p.severity})`);
241
- }
242
- ```
243
-
244
- ---
245
-
246
- ## 6. カスタムポリシーの登録
247
-
248
- ### 6.1 カスタムポリシーの作成
249
-
250
- ```typescript
251
- engine.registerPolicy({
252
- id: 'CUSTOM-001',
253
- name: 'No Console Log',
254
- description: 'プロダクションコードでconsole.logを禁止',
255
- category: 'custom',
256
- severity: 'warning',
257
-
258
- async validate(context) {
259
- const violations = [];
260
-
261
- // srcディレクトリのTSファイルを検査
262
- const files = await context.glob('src/**/*.ts');
263
-
264
- for (const file of files) {
265
- const content = await context.readFile(file);
266
- const lines = content.split('\n');
267
-
268
- lines.forEach((line, index) => {
269
- if (line.includes('console.log')) {
270
- violations.push({
271
- file,
272
- line: index + 1,
273
- message: `console.log found at line ${index + 1}`,
274
- suggestion: 'Use a proper logger instead',
275
- });
276
- }
277
- });
278
- }
279
-
280
- return {
281
- passed: violations.length === 0,
282
- violations,
283
- };
284
- },
285
- });
286
- ```
287
-
288
- ### 6.2 カスタムポリシーの実行
289
-
290
- ```typescript
291
- // カスタムポリシーを含めて検証
292
- const report = await engine.validate(
293
- { projectPath: '.' },
294
- ['CONST-001', 'CUSTOM-001'] // 憲法条項 + カスタム
295
- );
296
- ```
297
-
298
- ---
299
-
300
- ## 7. CI/CD統合
301
-
302
- ### 7.1 GitHub Actions
303
-
304
- ```yaml
305
- # .github/workflows/policy-check.yml
306
- name: Policy Check
307
-
308
- on: [push, pull_request]
309
-
310
- jobs:
311
- policy:
312
- runs-on: ubuntu-latest
313
- steps:
314
- - uses: actions/checkout@v4
315
- - uses: actions/setup-node@v4
316
- with:
317
- node-version: '20'
318
-
319
- - run: npm install
320
-
321
- - name: Run Policy Check
322
- run: |
323
- npx ts-node -e "
324
- import { createPolicyEngine } from '@musubix/policy';
325
-
326
- async function main() {
327
- const engine = createPolicyEngine();
328
- const report = await engine.validateProject('.');
329
-
330
- if (!report.passed) {
331
- console.error('Policy violations found:');
332
- for (const v of report.violations) {
333
- console.error(\` [\${v.severity}] \${v.policyId}: \${v.message}\`);
334
- }
335
- process.exit(1);
336
- }
337
-
338
- console.log('All policies passed!');
339
- }
340
-
341
- main();
342
- "
343
- ```
344
-
345
- ### 7.2 pre-commit フック
346
-
347
- ```bash
348
- # .husky/pre-commit
349
- #!/bin/sh
350
- npx ts-node scripts/policy-check.ts
351
- ```
352
-
353
- ---
354
-
355
- ## 8. API リファレンス
356
-
357
- ### 8.1 PolicyEngine インターフェース
358
-
359
- ```typescript
360
- interface PolicyEngine {
361
- // 検証
362
- validateProject(projectPath: string): Promise<PolicyReport>;
363
- validate(context: ValidationContext, policyIds?: string[]): Promise<PolicyReport>;
364
- validateFile(filePath: string): Promise<PolicyReport>;
365
-
366
- // ポリシー管理
367
- listPolicies(category?: 'constitution' | 'custom'): Policy[];
368
- getPolicy(id: string): Policy | null;
369
- registerPolicy(policy: CustomPolicy): void;
370
- unregisterPolicy(id: string): boolean;
371
- }
372
- ```
373
-
374
- ### 8.2 PolicyReport インターフェース
375
-
376
- ```typescript
377
- interface PolicyReport {
378
- passed: boolean; // 全ポリシー合格か
379
- violations: Violation[]; // 違反リスト(error)
380
- warnings: Violation[]; // 警告リスト(warning)
381
- checkedPolicies: string[]; // チェックしたポリシーID
382
- timestamp: string; // 検証日時
383
- }
384
- ```
385
-
386
- ### 8.3 Violation インターフェース
387
-
388
- ```typescript
389
- interface Violation {
390
- policyId: string; // 例: 'CONST-001'
391
- severity: 'error' | 'warning';
392
- message: string; // 違反メッセージ
393
- file?: string; // 違反ファイルパス
394
- line?: number; // 違反行番号
395
- suggestion?: string; // 修正提案
396
- }
397
- ```
398
-
399
- ---
400
-
401
- ## 9. ユースケース
402
-
403
- ### 9.1 新規プロジェクトのセットアップ検証
404
-
405
- ```typescript
406
- import { createPolicyEngine } from '@musubix/policy';
407
-
408
- async function validateNewProject(projectPath: string) {
409
- const engine = createPolicyEngine();
410
-
411
- // 必須の憲法条項のみチェック
412
- const criticalPolicies = [
413
- 'CONST-001', // Library-First
414
- 'CONST-003', // Test-First
415
- 'CONST-005', // Traceability
416
- 'CONST-006', // Project Memory
417
- ];
418
-
419
- const report = await engine.validate(
420
- { projectPath },
421
- criticalPolicies
422
- );
423
-
424
- if (!report.passed) {
425
- console.log('プロジェクト構造を修正してください:');
426
- for (const v of report.violations) {
427
- console.log(` - ${v.message}`);
428
- if (v.suggestion) {
429
- console.log(` 修正: ${v.suggestion}`);
430
- }
431
- }
432
- }
433
-
434
- return report;
435
- }
436
- ```
437
-
438
- ### 9.2 PRマージ前の品質ゲート
439
-
440
- ```typescript
441
- async function prQualityGate() {
442
- const engine = createPolicyEngine();
443
- const report = await engine.validateProject('.');
444
-
445
- // エラーがあればマージ拒否
446
- if (report.violations.length > 0) {
447
- console.error('❌ Quality gate failed');
448
- process.exit(1);
449
- }
450
-
451
- // 警告は許容するが表示
452
- if (report.warnings.length > 0) {
453
- console.warn(`⚠️ ${report.warnings.length} warnings found`);
454
- }
455
-
456
- console.log('✅ Quality gate passed');
457
- }
458
- ```
459
-
460
- ---
461
-
462
- ## 10. 関連パッケージ
463
-
464
- | パッケージ | 説明 |
465
- |------------|------|
466
- | `@musubix/knowledge` | Git-Native知識グラフシステム |
467
- | `@musubix/decisions` | Architecture Decision Records管理 |
468
- | `musubix` | 3パッケージを含むメインパッケージ |
469
-
470
- ---
471
-
472
- ## 11. 参照
473
-
474
- - [MUSUBIX v3.0 User Guide](../MUSUBIX-v3.0-User-Guide.md)
475
- - [9憲法条項](../../steering/rules/constitution.md)
476
- - [GitHub Repository](https://github.com/nahisaho/MUSUBIX)
477
- - [npm Package](https://www.npmjs.com/package/@musubix/policy)