musubix 1.0.1 → 1.0.3

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.
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: musubix-sdd-workflow
3
+ description: Guide for MUSUBIX SDD (Specification-Driven Development) workflow. Use this when asked to develop features using MUSUBIX methodology, create requirements, designs, or implement code following the 9 constitutional articles.
4
+ license: MIT
5
+ ---
6
+
7
+ # MUSUBIX SDD Workflow Skill
8
+
9
+ This skill guides you through the complete SDD workflow for MUSUBIX projects.
10
+
11
+ ## Prerequisites
12
+
13
+ Before starting any development task:
14
+
15
+ 1. Read `steering/` directory for project context
16
+ 2. Check `steering/rules/constitution.md` for the 9 constitutional articles
17
+ 3. Review existing specs in `storage/specs/`
18
+
19
+ ## Workflow Steps
20
+
21
+ ### Step 1: Requirements Phase (Article IV - EARS Format)
22
+
23
+ Create requirements using EARS patterns:
24
+
25
+ ```markdown
26
+ # REQ-[CATEGORY]-[NUMBER]
27
+
28
+ **種別**: [UBIQUITOUS|EVENT-DRIVEN|STATE-DRIVEN|UNWANTED|OPTIONAL]
29
+ **優先度**: [P0|P1|P2]
30
+
31
+ **要件**:
32
+ [EARS形式の要件文]
33
+
34
+ **トレーサビリティ**: DES-XXX, TEST-XXX
35
+ ```
36
+
37
+ EARS Patterns:
38
+ - **Ubiquitous**: `THE [system] SHALL [requirement]`
39
+ - **Event-driven**: `WHEN [event], THE [system] SHALL [response]`
40
+ - **State-driven**: `WHILE [state], THE [system] SHALL [response]`
41
+ - **Unwanted**: `THE [system] SHALL NOT [behavior]`
42
+ - **Optional**: `IF [condition], THEN THE [system] SHALL [response]`
43
+
44
+ ### Step 2: Design Phase (Article VII - Design Patterns)
45
+
46
+ Create C4 model design documents:
47
+
48
+ 1. **Context Level**: System boundaries and external actors
49
+ 2. **Container Level**: Technology choices and container composition
50
+ 3. **Component Level**: Internal structure of containers
51
+ 4. **Code Level**: Implementation details
52
+
53
+ Design document template:
54
+ ```markdown
55
+ # DES-[CATEGORY]-[NUMBER]
56
+
57
+ ## トレーサビリティ
58
+ - 要件: REQ-XXX
59
+
60
+ ## C4モデル
61
+ ### Level 2: Container
62
+ [PlantUML diagram]
63
+
64
+ ## コンポーネント設計
65
+ [Component details]
66
+ ```
67
+
68
+ ### Step 3: Task Generation
69
+
70
+ Generate implementation tasks from design:
71
+
72
+ ```markdown
73
+ # TSK-[CATEGORY]-[NUMBER]
74
+
75
+ ## 関連設計: DES-XXX
76
+ ## 関連要件: REQ-XXX
77
+
78
+ ## タスク内容
79
+ [Implementation task description]
80
+
81
+ ## 受入基準
82
+ - [ ] Criterion 1
83
+ - [ ] Criterion 2
84
+ ```
85
+
86
+ ### Step 4: Implementation (Article III - Test-First)
87
+
88
+ Follow Red-Green-Blue cycle:
89
+
90
+ 1. **Red**: Write failing test first
91
+ 2. **Green**: Write minimal code to pass
92
+ 3. **Blue**: Refactor while keeping tests green
93
+
94
+ ### Step 5: Traceability Validation (Article V)
95
+
96
+ Ensure 100% traceability:
97
+ ```
98
+ REQ-* → DES-* → TSK-* → Code → Test
99
+ ```
100
+
101
+ Add requirement IDs in code comments:
102
+ ```typescript
103
+ /**
104
+ * @see REQ-INT-001 - Neuro-Symbolic Integration
105
+ */
106
+ ```
107
+
108
+ ## CLI Commands
109
+
110
+ ```bash
111
+ # Requirements
112
+ npx musubix requirements analyze <file>
113
+ npx musubix requirements validate <file>
114
+
115
+ # Design
116
+ npx musubix design generate <file>
117
+ npx musubix design patterns <context>
118
+
119
+ # Code Generation
120
+ npx musubix codegen generate <file>
121
+
122
+ # Traceability
123
+ npx musubix trace matrix
124
+ npx musubix trace validate
125
+ ```
126
+
127
+ ## Constitutional Articles Checklist
128
+
129
+ - [ ] **Article I**: Library-First - Is this a standalone library?
130
+ - [ ] **Article II**: CLI Interface - Does it expose CLI?
131
+ - [ ] **Article III**: Test-First - Are tests written first?
132
+ - [ ] **Article IV**: EARS Format - Are requirements in EARS?
133
+ - [ ] **Article V**: Traceability - Is everything traceable?
134
+ - [ ] **Article VI**: Project Memory - Did you check steering/?
135
+ - [ ] **Article VII**: Design Patterns - Are patterns documented?
136
+ - [ ] **Article VIII**: Decision Records - Is ADR created?
137
+ - [ ] **Article IX**: Quality Gates - Are quality checks passed?
package/AGENTS.md ADDED
@@ -0,0 +1,286 @@
1
+ # MUSUBIX - Neuro-Symbolic AI Integration System
2
+
3
+ > **AI Coding Agent向け**: このファイルはAIエージェント(GitHub Copilot、Claude等)がMUSUBIXプロジェクトを理解するためのガイドです。
4
+
5
+ ## 🎯 プロジェクト概要
6
+
7
+ **MUSUBIX**は、**Neural(LLM)** と **Symbolic(Knowledge Graph)** 推論を統合した次世代AIコーディングシステムです。MUSUBI SDD方法論とYATA知識グラフ推論を組み合わせ、高品質なソフトウェア開発を支援します。
8
+
9
+ | 項目 | 詳細 |
10
+ |------|------|
11
+ | **バージョン** | 1.0.0 |
12
+ | **言語** | TypeScript |
13
+ | **ランタイム** | Node.js >= 20.0.0 |
14
+ | **パッケージマネージャ** | npm >= 10.0.0 |
15
+ | **ビルドシステム** | モノレポ(npm workspaces) |
16
+ | **テストフレームワーク** | Vitest |
17
+
18
+ ---
19
+
20
+ ## 📦 アーキテクチャ
21
+
22
+ ### パッケージ構成
23
+
24
+ ```
25
+ packages/
26
+ ├── core/ # @nahisaho/musubix-core
27
+ ├── mcp-server/ # @nahisaho/musubix-mcp-server
28
+ └── yata-client/ # @nahisaho/musubix-yata-client
29
+ ```
30
+
31
+ | パッケージ | npm | 役割 |
32
+ |-----------|-----|------|
33
+ | `packages/core/` | `@nahisaho/musubix-core` | コアライブラリ - CLI、EARS検証、コード生成、設計パターン |
34
+ | `packages/mcp-server/` | `@nahisaho/musubix-mcp-server` | MCPサーバー - 9ツール、3プロンプト |
35
+ | `packages/yata-client/` | `@nahisaho/musubix-yata-client` | YATAクライアント - 知識グラフ連携 |
36
+
37
+ ### Core パッケージモジュール
38
+
39
+ ```
40
+ packages/core/src/
41
+ ├── auth/ # 認証・認可
42
+ ├── cli/ # CLIインターフェース
43
+ ├── codegen/ # コード生成・解析
44
+ ├── design/ # 設計パターン・C4モデル
45
+ ├── error/ # エラーハンドリング
46
+ ├── explanation/ # 説明生成・可視化
47
+ ├── requirements/ # 要件分析・分解
48
+ ├── traceability/ # トレーサビリティ
49
+ ├── types/ # 型定義
50
+ ├── utils/ # ユーティリティ
51
+ └── validators/ # EARS検証
52
+ ```
53
+
54
+ ---
55
+
56
+ ## 🛠️ CLI コマンド
57
+
58
+ ```bash
59
+ # プロジェクト初期化
60
+ npx musubix init [path] [--name <name>] [--force]
61
+
62
+ # 要件分析(EARS形式)
63
+ npx musubix requirements analyze <file> # 自然言語 → EARS変換
64
+ npx musubix requirements validate <file> # EARS構文検証
65
+ npx musubix requirements map <file> # オントロジーマッピング
66
+ npx musubix requirements search <query> # 関連要件検索
67
+
68
+ # 設計生成
69
+ npx musubix design generate <file> # 要件から設計生成
70
+ npx musubix design patterns <context> # パターン検出
71
+ npx musubix design validate <file> # SOLID準拠検証
72
+ npx musubix design c4 <file> # C4ダイアグラム生成
73
+ npx musubix design adr <decision> # ADR生成
74
+
75
+ # コード生成
76
+ npx musubix codegen generate <file> # 設計からコード生成
77
+ npx musubix codegen analyze <file> # 静的解析
78
+ npx musubix codegen security <path> # セキュリティスキャン
79
+
80
+ # テスト
81
+ npx musubix test generate <file> # テスト生成
82
+ npx musubix test coverage <dir> # カバレッジ測定
83
+
84
+ # トレーサビリティ
85
+ npx musubix trace matrix # トレーサビリティマトリクス
86
+ npx musubix trace impact <id> # 影響分析
87
+ npx musubix trace validate # リンク検証
88
+
89
+ # 説明生成
90
+ npx musubix explain why <id> # 決定理由の説明
91
+ npx musubix explain graph <id> # 推論グラフ生成
92
+
93
+ # ヘルプ
94
+ npx musubix --help
95
+ npx musubix help <command>
96
+ ```
97
+
98
+ ---
99
+
100
+ ## 🔌 MCP Server
101
+
102
+ ### 起動方法
103
+
104
+ ```bash
105
+ npx @nahisaho/musubix-mcp-server
106
+ npx musubix-mcp --transport stdio
107
+ ```
108
+
109
+ ### ツール一覧(9ツール)
110
+
111
+ | ツール名 | 説明 |
112
+ |---------|------|
113
+ | `sdd_create_requirements` | EARS形式の要件ドキュメント作成 |
114
+ | `sdd_validate_requirements` | 要件のEARS検証・憲法準拠チェック |
115
+ | `sdd_create_design` | C4モデル設計ドキュメント作成 |
116
+ | `sdd_validate_design` | 設計の要件トレーサビリティ検証 |
117
+ | `sdd_create_tasks` | 設計から実装タスク生成 |
118
+ | `sdd_query_knowledge` | YATA知識グラフへのクエリ |
119
+ | `sdd_update_knowledge` | 知識グラフの更新 |
120
+ | `sdd_validate_constitution` | 9憲法条項への準拠検証 |
121
+ | `sdd_validate_traceability` | 要件↔設計↔タスクのトレーサビリティ検証 |
122
+
123
+ ### プロンプト一覧(3プロンプト)
124
+
125
+ | プロンプト名 | 説明 |
126
+ |-------------|------|
127
+ | `sdd_requirements_analysis` | 機能説明からEARS形式要件を生成 |
128
+ | `sdd_requirements_review` | 要件の完全性・憲法準拠レビュー |
129
+ | `sdd_design_generation` | 要件からC4モデル設計を生成 |
130
+
131
+ ---
132
+
133
+ ## 📋 9憲法条項(Constitutional Articles)
134
+
135
+ すべての開発活動を統治する不変のルールです。
136
+
137
+ | 条項 | 名称 | 概要 |
138
+ |-----|------|------|
139
+ | **I** | Library-First | 機能は独立ライブラリとして開始 |
140
+ | **II** | CLI Interface | すべてのライブラリはCLI公開必須 |
141
+ | **III** | Test-First | Red-Green-Blueサイクルでテスト先行 |
142
+ | **IV** | EARS Format | 要件はEARS形式で記述 |
143
+ | **V** | Traceability | 要件↔設計↔コード↔テストの100%追跡 |
144
+ | **VI** | Project Memory | steering/を参照してから決定 |
145
+ | **VII** | Design Patterns | 設計パターン適用の文書化 |
146
+ | **VIII** | Decision Records | すべての決定をADRで記録 |
147
+ | **IX** | Quality Gates | フェーズ移行前の品質検証 |
148
+
149
+ **詳細**: [steering/rules/constitution.md](steering/rules/constitution.md)
150
+
151
+ ---
152
+
153
+ ## 📁 プロジェクトメモリ(Steering)
154
+
155
+ AIエージェントは決定前に必ずこれらのファイルを参照してください。
156
+
157
+ | ファイル | 内容 |
158
+ |---------|------|
159
+ | `steering/structure.ja.md` | アーキテクチャパターン、レイヤー構造 |
160
+ | `steering/tech.ja.md` | 技術スタック(TypeScript, Node.js 20+) |
161
+ | `steering/product.ja.md` | プロダクトコンテキスト |
162
+ | `steering/rules/constitution.md` | 9憲法条項 |
163
+ | `steering/project.yml` | プロジェクト設定 |
164
+
165
+ ---
166
+
167
+ ## 📂 ストレージ構造
168
+
169
+ | パス | 内容 |
170
+ |-----|------|
171
+ | `storage/specs/` | 要件(REQ-*)、設計(DES-*)、タスク(TSK-*) |
172
+ | `storage/design/` | 設計ドキュメント、C4ダイアグラム |
173
+ | `storage/traceability/` | トレーサビリティマトリクス |
174
+ | `storage/reviews/` | コードレビュー、検証結果 |
175
+ | `storage/changes/` | 変更履歴 |
176
+ | `storage/archive/` | アーカイブ |
177
+
178
+ ---
179
+
180
+ ## 🧪 開発コマンド
181
+
182
+ ```bash
183
+ # 依存関係インストール
184
+ npm install
185
+
186
+ # 全パッケージビルド
187
+ npm run build
188
+
189
+ # テスト実行
190
+ npm run test # 全テスト
191
+ npm run test:unit # ユニットテスト
192
+ npm run test:integration # 統合テスト
193
+ npm run test:coverage # カバレッジ計測
194
+
195
+ # コード品質
196
+ npm run lint # ESLint
197
+ npm run lint:fix # ESLint 自動修正
198
+ npm run typecheck # TypeScript型チェック
199
+
200
+ # クリーンアップ
201
+ npm run clean
202
+ ```
203
+
204
+ ---
205
+
206
+ ## 🔑 主要機能
207
+
208
+ ### 1. Neuro-Symbolic統合(REQ-INT-001〜003準拠)
209
+ - **Neural(LLM)**: 創造的なコード生成、自然言語理解
210
+ - **Symbolic(YATA)**: 知識グラフによる精密な推論、一貫性検証
211
+ - **信頼度評価ルール** (REQ-INT-002):
212
+ | シンボリック結果 | ニューラル信頼度 | 最終決定 |
213
+ |-----------------|-----------------|---------|
214
+ | invalid | - | ニューラル結果を棄却 |
215
+ | valid | ≥0.8 | ニューラル結果を採用 |
216
+ | valid | <0.8 | シンボリック結果を優先 |
217
+
218
+ ### 2. EARS要件分析
219
+ 5つのEARSパターンで要件を形式化(REQ-RA-001準拠):
220
+
221
+ | パターン | 構文 | 用途 |
222
+ |---------|------|------|
223
+ | Ubiquitous | `THE [system] SHALL [requirement]` | システムが常に満たすべき要件 |
224
+ | Event-driven | `WHEN [event], THE [system] SHALL [response]` | 特定イベント発生時の要件 |
225
+ | State-driven | `WHILE [state], THE [system] SHALL [response]` | 特定状態における要件 |
226
+ | Unwanted | `THE [system] SHALL NOT [behavior]` | 回避すべき動作の要件 |
227
+ | Optional | `IF [condition], THEN THE [system] SHALL [response]` | 条件付き要件 |
228
+
229
+ **要件総数**: 41要件(REQ-MUSUBIX-001定義)
230
+ **優先度**: P0(必須)、P1(重要)、P2(任意)
231
+
232
+ ### 3. C4モデル設計
233
+ 4つのレベルで設計を構造化:
234
+ - **Context**: システム境界と外部アクター
235
+ - **Container**: 技術選択とコンテナ構成
236
+ - **Component**: コンテナ内部構造
237
+ - **Code**: 実装詳細
238
+
239
+ ### 4. 完全なトレーサビリティ
240
+ ```
241
+ 要件(REQ-*) → 設計(DES-*) → タスク(TSK-*) → コード → テスト
242
+ ```
243
+
244
+ ---
245
+
246
+ ## 📚 ドキュメント
247
+
248
+ | ドキュメント | 説明 |
249
+ |-------------|------|
250
+ | [docs/INSTALL-GUIDE.md](docs/INSTALL-GUIDE.md) | インストールガイド |
251
+ | [docs/USER-GUIDE.md](docs/USER-GUIDE.md) | ユーザーガイド |
252
+ | [docs/API-REFERENCE.md](docs/API-REFERENCE.md) | APIリファレンス |
253
+ | [README.md](README.md) | 英語版README |
254
+ | [README.ja.md](README.ja.md) | 日本語版README |
255
+
256
+ ---
257
+
258
+ ## 🤝 AI Agent向けガイドライン
259
+
260
+ ### コード生成時の注意点
261
+
262
+ 1. **憲法条項の遵守**: 9条項を必ず確認
263
+ 2. **steering/参照**: 決定前にproject memoryを確認
264
+ 3. **EARS形式**: 要件は必ずEARS形式で記述
265
+ 4. **トレーサビリティ**: コードコメントに要件IDを記載
266
+ 5. **テスト先行**: Red-Green-Blueサイクルを遵守
267
+ 6. **モノレポ構造**: パッケージ間の依存関係に注意
268
+
269
+ ### 推奨ワークフロー
270
+
271
+ ```
272
+ 1. steering/ を読む
273
+ 2. 要件をEARS形式で定義
274
+ 3. C4モデルで設計
275
+ 4. テストを先に書く(Red)
276
+ 5. 最小限のコードで実装(Green)
277
+ 6. リファクタリング(Blue)
278
+ 7. トレーサビリティを検証
279
+ ```
280
+
281
+ ---
282
+
283
+ **Agent**: GitHub Copilot / Claude
284
+ **Last Updated**: 2026-01-02
285
+ **Version**: 1.0.0
286
+ **Repository**: https://github.com/nahisaho/MUSUBIX