musubix 3.4.7 → 3.5.0

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 +51 -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,596 +0,0 @@
1
- ---
2
- title: 【実践】MUSUBIXでLinuxカーネルのナレッジグラフを構築する - 大規模Cソースコード解析
3
- tags: Linux Kernel MUSUBIX KnowledgeGraph AIコーディング
4
- private: false
5
- ---
6
-
7
- # 【実践】MUSUBIXでLinuxカーネルのナレッジグラフを構築する
8
-
9
- ## はじめに
10
-
11
- Linuxカーネルは**9000万行以上**のコードを持つ世界最大級のオープンソースプロジェクトです。この巨大なコードベースを理解するには、効果的なナレッジ管理が不可欠です。
12
-
13
- 本記事では、**MUSUBIX v3.0** の Git-Native Knowledge System を使用して、Linuxカーネルのスケジューラ(`kernel/sched/`)からナレッジグラフを自動構築する方法を解説します。
14
-
15
- ### 達成できること
16
-
17
- | 項目 | 内容 |
18
- |------|------|
19
- | 📊 解析規模 | 45ファイル、2,222関数、76構造体 |
20
- | 📚 ナレッジ | 2,475エンティティ、2,484リレーション |
21
- | 🗃️ 出力形式 | Git-friendly JSON(1.7MB) |
22
- | ⏱️ 処理時間 | 約10秒 |
23
-
24
- ## 環境準備
25
-
26
- ### 前提条件
27
-
28
- ```bash
29
- # Node.js v20以上
30
- node --version # v20.0.0+
31
-
32
- # Git
33
- git --version
34
- ```
35
-
36
- ### ディレクトリ構成
37
-
38
- ```
39
- /tmp/linux-kernel/ # 作業ディレクトリ
40
- ├── kernel/sched/ # 解析対象(スケジューラ)
41
- ├── .knowledge/
42
- │ └── graph.json # 生成されるナレッジグラフ
43
- ├── package.json
44
- ├── node_modules/
45
- └── build-knowledge.mjs # 構築スクリプト
46
- ```
47
-
48
- ## Step 1: Linuxカーネルソースのダウンロード
49
-
50
- ```bash
51
- # /tmp に移動してLinuxカーネルをshallow cloneでダウンロード
52
- cd /tmp
53
- git clone --depth 1 https://github.com/torvalds/linux.git linux-kernel
54
-
55
- # 確認
56
- ls -la linux-kernel/kernel/sched/
57
- # → 45ファイル(.c, .h)
58
- ```
59
-
60
- :::note info
61
- **Shallow Clone (`--depth 1`)**を使用することで、ダウンロードサイズを約2GBに抑えます。全履歴をクローンすると数十GBになります。
62
- :::
63
-
64
- ## Step 2: MUSUBIXのインストール
65
-
66
- ```bash
67
- cd /tmp/linux-kernel
68
-
69
- # プロジェクト初期化
70
- npm init -y
71
-
72
- # ESモジュールを有効化
73
- sed -i 's/"type": "commonjs"/"type": "module"/' package.json
74
-
75
- # MUSUBIXパッケージをインストール
76
- npm install musubix
77
- ```
78
-
79
- :::note warn
80
- **npm バージョン依存の問題**
81
-
82
- v3.0.3以前のバージョンでは`peerDependencies`の問題でインストールに失敗する場合があります。その場合は以下を試してください:
83
-
84
- ```bash
85
- npm install musubix --legacy-peer-deps
86
- ```
87
-
88
- または、ローカルビルドからインストール:
89
-
90
- ```bash
91
- npm install /path/to/MUSUBIX/packages/musubix
92
- npm install /path/to/MUSUBIX/packages/knowledge
93
- npm install /path/to/MUSUBIX/packages/codegraph
94
- ```
95
- :::
96
-
97
- ## Step 3: ナレッジ構築スクリプトの作成
98
-
99
- `build-knowledge.mjs` を作成します:
100
-
101
- ```javascript
102
- #!/usr/bin/env node
103
- /**
104
- * Linux Kernel Knowledge Builder
105
- *
106
- * MUSUBIXのKnowledge Storeを使用して
107
- * Linuxカーネルソースコードから知識グラフを構築します。
108
- */
109
-
110
- import { createKnowledgeStore } from '@musubix/knowledge';
111
- import { readdir, readFile } from 'fs/promises';
112
- import { join, basename, extname } from 'path';
113
-
114
- // 設定
115
- const KERNEL_PATH = '/tmp/linux-kernel';
116
- const TARGET_SUBSYSTEM = 'kernel/sched';
117
- const KNOWLEDGE_PATH = join(KERNEL_PATH, '.knowledge');
118
-
119
- // リレーションIDカウンター
120
- let relationCounter = 0;
121
- function nextRelationId() {
122
- return `rel-${++relationCounter}`;
123
- }
124
-
125
- /**
126
- * Cファイルを再帰的に取得
127
- */
128
- async function getCFiles(dir, files = []) {
129
- const entries = await readdir(dir, { withFileTypes: true });
130
-
131
- for (const entry of entries) {
132
- const fullPath = join(dir, entry.name);
133
- if (entry.isDirectory()) {
134
- await getCFiles(fullPath, files);
135
- } else if (entry.isFile() && ['.c', '.h'].includes(extname(entry.name))) {
136
- files.push(fullPath);
137
- }
138
- }
139
-
140
- return files;
141
- }
142
-
143
- /**
144
- * 関数定義を抽出(簡易パーサー)
145
- */
146
- function extractFunctions(content, filename) {
147
- const functions = [];
148
-
149
- // Cの関数定義パターン
150
- const funcRegex = /^(\w[\w\s\*]+?)\s+(\w+)\s*\(([^)]*)\)\s*\{/gm;
151
- let match;
152
-
153
- while ((match = funcRegex.exec(content)) !== null) {
154
- const returnType = match[1].trim();
155
- const name = match[2];
156
- const params = match[3].trim();
157
-
158
- functions.push({
159
- name,
160
- returnType: returnType.replace(/static|inline/g, '').trim(),
161
- params,
162
- isStatic: returnType.includes('static'),
163
- isInline: returnType.includes('inline'),
164
- file: filename,
165
- });
166
- }
167
-
168
- return functions;
169
- }
170
-
171
- /**
172
- * 構造体定義を抽出
173
- */
174
- function extractStructs(content, filename) {
175
- const structs = [];
176
- const structRegex = /struct\s+(\w+)\s*\{/g;
177
- let match;
178
-
179
- while ((match = structRegex.exec(content)) !== null) {
180
- structs.push({
181
- name: match[1],
182
- file: filename,
183
- });
184
- }
185
-
186
- return structs;
187
- }
188
-
189
- /**
190
- * メイン処理
191
- */
192
- async function main() {
193
- console.log('🐧 Linux Kernel Knowledge Builder');
194
- console.log(`Target: ${TARGET_SUBSYSTEM}`);
195
-
196
- // Knowledge Store初期化
197
- const store = createKnowledgeStore(KNOWLEDGE_PATH);
198
-
199
- // ファイル取得
200
- const targetPath = join(KERNEL_PATH, TARGET_SUBSYSTEM);
201
- const cFiles = await getCFiles(targetPath);
202
- console.log(`Found ${cFiles.length} C/H files`);
203
-
204
- // サブシステムエンティティを作成
205
- await store.putEntity({
206
- id: 'subsystem:sched',
207
- type: 'code',
208
- name: 'Linux Scheduler',
209
- description: 'Linux kernel process scheduler implementation',
210
- properties: {
211
- path: TARGET_SUBSYSTEM,
212
- algorithms: ['CFS', 'RT', 'Deadline', 'Stop', 'Idle'],
213
- },
214
- tags: ['kernel', 'scheduler', 'linux', 'subsystem'],
215
- });
216
-
217
- // 各ファイルを解析
218
- for (const file of cFiles) {
219
- const filename = file.replace(KERNEL_PATH + '/', '');
220
- const content = await readFile(file, 'utf-8');
221
-
222
- // ファイルエンティティ
223
- const fileId = `file:${filename.replace(/[\/\.]/g, '-')}`;
224
- await store.putEntity({
225
- id: fileId,
226
- type: 'code',
227
- name: basename(file),
228
- properties: {
229
- path: filename,
230
- lines: content.split('\n').length,
231
- language: 'c',
232
- },
233
- tags: extname(file) === '.h' ? ['header', 'c'] : ['source', 'c'],
234
- });
235
-
236
- await store.addRelation({
237
- id: nextRelationId(),
238
- source: 'subsystem:sched',
239
- target: fileId,
240
- type: 'implements',
241
- });
242
-
243
- // 関数抽出
244
- const functions = extractFunctions(content, filename);
245
- for (const func of functions) {
246
- const funcId = `function:${func.name}`;
247
- const existing = await store.getEntity(funcId);
248
-
249
- if (!existing) {
250
- await store.putEntity({
251
- id: funcId,
252
- type: 'code',
253
- name: func.name,
254
- properties: {
255
- returnType: func.returnType,
256
- params: func.params,
257
- isStatic: func.isStatic,
258
- file: func.file,
259
- },
260
- tags: ['function', func.isStatic ? 'static' : 'public'],
261
- });
262
-
263
- await store.addRelation({
264
- id: nextRelationId(),
265
- source: fileId,
266
- target: funcId,
267
- type: 'implements',
268
- });
269
- }
270
- }
271
-
272
- // 構造体抽出
273
- const structs = extractStructs(content, filename);
274
- for (const struct of structs) {
275
- const structId = `struct:${struct.name}`;
276
- const existing = await store.getEntity(structId);
277
-
278
- if (!existing) {
279
- await store.putEntity({
280
- id: structId,
281
- type: 'code',
282
- name: struct.name,
283
- properties: { file: struct.file },
284
- tags: ['struct', 'data-structure'],
285
- });
286
-
287
- await store.addRelation({
288
- id: nextRelationId(),
289
- source: fileId,
290
- target: structId,
291
- type: 'implements',
292
- });
293
- }
294
- }
295
-
296
- console.log(`📄 ${filename} (${functions.length} funcs)`);
297
- }
298
-
299
- // コンセプトエンティティを追加
300
- const concepts = [
301
- {
302
- id: 'concept:cfs',
303
- name: 'Completely Fair Scheduler (CFS)',
304
- description: 'The default scheduler. Uses red-black tree sorted by vruntime.',
305
- tags: ['scheduler', 'cfs', 'algorithm'],
306
- },
307
- {
308
- id: 'concept:runqueue',
309
- name: 'Run Queue (rq)',
310
- description: 'Per-CPU data structure holding runnable processes.',
311
- tags: ['scheduler', 'data-structure'],
312
- },
313
- {
314
- id: 'concept:vruntime',
315
- name: 'Virtual Runtime',
316
- description: 'Weighted CPU time. Used by CFS to pick next task.',
317
- tags: ['cfs', 'metric'],
318
- },
319
- ];
320
-
321
- for (const concept of concepts) {
322
- await store.putEntity({
323
- id: concept.id,
324
- type: 'pattern',
325
- name: concept.name,
326
- description: concept.description,
327
- properties: {},
328
- tags: concept.tags,
329
- });
330
-
331
- await store.addRelation({
332
- id: nextRelationId(),
333
- source: 'subsystem:sched',
334
- target: concept.id,
335
- type: 'implements',
336
- });
337
- }
338
-
339
- // 保存
340
- await store.save();
341
-
342
- const stats = store.getStats();
343
- console.log(`\n✅ Entities: ${stats.entityCount}, Relations: ${stats.relationCount}`);
344
- console.log(`📁 Saved to: ${KNOWLEDGE_PATH}/graph.json`);
345
- }
346
-
347
- main().catch(console.error);
348
- ```
349
-
350
- ## Step 4: ナレッジグラフの構築
351
-
352
- ```bash
353
- # スクリプト実行
354
- node build-knowledge.mjs
355
- ```
356
-
357
- ### 実行結果
358
-
359
- ```
360
- 🐧 Linux Kernel Knowledge Builder
361
- Target: kernel/sched
362
- Found 45 C/H files
363
- 📄 kernel/sched/autogroup.c (16 funcs)
364
- 📄 kernel/sched/clock.c (24 funcs)
365
- 📄 kernel/sched/core.c (403 funcs)
366
- 📄 kernel/sched/fair.c (445 funcs)
367
- 📄 kernel/sched/rt.c (121 funcs)
368
- 📄 kernel/sched/deadline.c (134 funcs)
369
- ...
370
-
371
- ✅ Entities: 2475, Relations: 2484
372
- 📁 Saved to: /tmp/linux-kernel/.knowledge/graph.json
373
- ```
374
-
375
- ## Step 5: ナレッジグラフの確認
376
-
377
- ```bash
378
- # ファイルサイズ確認
379
- ls -lh /tmp/linux-kernel/.knowledge/graph.json
380
- # → 1.7M
381
-
382
- # 構造確認
383
- head -50 /tmp/linux-kernel/.knowledge/graph.json
384
- ```
385
-
386
- ### 生成されたナレッジグラフの構造
387
-
388
- ```json
389
- {
390
- "version": "1.0.0",
391
- "metadata": {
392
- "lastModified": "2026-01-11T20:14:57.921Z",
393
- "entityCount": 2475,
394
- "relationCount": 2484
395
- },
396
- "entities": {
397
- "subsystem:sched": {
398
- "id": "subsystem:sched",
399
- "type": "code",
400
- "name": "Linux Scheduler",
401
- "description": "Linux kernel process scheduler implementation",
402
- "properties": {
403
- "path": "kernel/sched",
404
- "algorithms": ["CFS", "RT", "Deadline", "Stop", "Idle"]
405
- },
406
- "tags": ["kernel", "scheduler", "linux", "subsystem"]
407
- },
408
- "function:update_curr": {
409
- "id": "function:update_curr",
410
- "type": "code",
411
- "name": "update_curr",
412
- "properties": {
413
- "returnType": "void",
414
- "params": "struct cfs_rq *cfs_rq",
415
- "isStatic": true,
416
- "file": "kernel/sched/fair.c"
417
- },
418
- "tags": ["function", "static"]
419
- }
420
- // ... 2,473件のエンティティ
421
- },
422
- "relations": [
423
- {
424
- "id": "rel-1",
425
- "source": "subsystem:sched",
426
- "target": "file:kernel-sched-autogroup-c",
427
- "type": "implements"
428
- }
429
- // ... 2,483件のリレーション
430
- ]
431
- }
432
- ```
433
-
434
- ## ナレッジの活用例
435
-
436
- ### 1. 関数の検索
437
-
438
- ```javascript
439
- import { createKnowledgeStore } from '@musubix/knowledge';
440
-
441
- const store = createKnowledgeStore('/tmp/linux-kernel/.knowledge');
442
- await store.load();
443
-
444
- // CFSに関連する関数を検索
445
- const cfsFunctions = await store.search('cfs', {
446
- fields: ['name', 'tags'],
447
- limit: 10,
448
- });
449
-
450
- console.log(cfsFunctions.map(f => f.name));
451
- // ['pick_next_task_fair', 'enqueue_task_fair', 'dequeue_task_fair', ...]
452
- ```
453
-
454
- ### 2. 構造体の依存関係
455
-
456
- ```javascript
457
- // rq構造体に関連するエンティティを取得
458
- const rqRelations = await store.getRelations('struct:rq', 'both');
459
- console.log(`rq has ${rqRelations.length} relations`);
460
- ```
461
-
462
- ### 3. サブグラフの抽出
463
-
464
- ```javascript
465
- // スケジューラサブシステムから深さ2のサブグラフを取得
466
- const subgraph = await store.getSubgraph('subsystem:sched', 2);
467
- console.log(`Subgraph: ${Object.keys(subgraph.entities).length} entities`);
468
- ```
469
-
470
- ## Step 5: CodeGraph CLIによるインデックス作成(オプション)
471
-
472
- MUSUBIXにはCodeGraph CLIが付属しており、AST解析によるコードグラフも作成できます。
473
-
474
- ```bash
475
- # CodeGraph CLIでインデックス作成
476
- npx musubix cg index ./kernel/sched
477
-
478
- # サポート言語一覧
479
- npx musubix cg languages
480
-
481
- # 統計表示
482
- npx musubix cg stats
483
- ```
484
-
485
- ### CodeGraphの機能
486
-
487
- | 機能 | 説明 |
488
- |------|------|
489
- | **AST解析** | Tree-sitterベースの構文解析(16言語対応) |
490
- | **依存関係** | 関数間の呼び出しグラフ構築 |
491
- | **GraphRAG** | 意味的なコード検索 |
492
-
493
- ```bash
494
- # 依存関係の検索
495
- npx musubix cg deps schedule
496
-
497
- # 関数の呼び出し元を検索
498
- npx musubix cg callers update_curr
499
-
500
- # セマンティック検索
501
- npx musubix cg search "process scheduling algorithm"
502
- ```
503
-
504
- :::note info
505
- **Knowledge Store vs CodeGraph**
506
-
507
- | 観点 | Knowledge Store | CodeGraph |
508
- |------|-----------------|-----------|
509
- | 用途 | ドメイン知識・概念の管理 | コード構造・依存関係の解析 |
510
- | 永続化 | JSON(Git管理可) | SQLite / メモリ |
511
- | 抽象度 | 高(概念レベル) | 低(コードレベル) |
512
- | 検索 | タグ・テキスト検索 | GraphRAG・依存関係走査 |
513
-
514
- 両者を組み合わせることで、**コード構造**と**ドメイン知識**の両方を統合管理できます。
515
- :::
516
-
517
- ## Git-Native Knowledge Systemの利点
518
-
519
- ### 1. サーバーレス
520
-
521
- ```
522
- ❌ 従来: データベースサーバーが必要
523
- PostgreSQL, Neo4j, etc.
524
-
525
- ✅ MUSUBIX v3.0: JSONファイルのみ
526
- .knowledge/graph.json
527
- ```
528
-
529
- ### 2. バージョン管理
530
-
531
- ```bash
532
- # ナレッジグラフの変更をGitで追跡
533
- git add .knowledge/
534
- git commit -m "Add scheduler knowledge graph"
535
- git push
536
- ```
537
-
538
- ### 3. チーム協業
539
-
540
- ```bash
541
- # プルリクエストでナレッジの変更をレビュー
542
- git diff .knowledge/graph.json
543
-
544
- # マージコンフリクトはJSONレベルで解決可能
545
- ```
546
-
547
- ## 拡張: 全カーネルの解析
548
-
549
- スケジューラ以外のサブシステムも同様に解析できます:
550
-
551
- ```javascript
552
- const SUBSYSTEMS = [
553
- 'kernel/sched', // スケジューラ
554
- 'mm', // メモリ管理
555
- 'fs', // ファイルシステム
556
- 'net', // ネットワーク
557
- 'drivers/usb', // USBドライバ
558
- ];
559
-
560
- for (const subsystem of SUBSYSTEMS) {
561
- const files = await getCFiles(join(KERNEL_PATH, subsystem));
562
- console.log(`${subsystem}: ${files.length} files`);
563
- }
564
- ```
565
-
566
- :::note warn
567
- **注意**: 全カーネル(9万ファイル以上)を解析すると、数十GBのナレッジグラフが生成される可能性があります。サブシステム単位での解析を推奨します。
568
- :::
569
-
570
- ## まとめ
571
-
572
- | 項目 | 内容 |
573
- |------|------|
574
- | **目的** | Linuxカーネルのナレッジグラフ構築 |
575
- | **ツール** | MUSUBIX v3.0 Git-Native Knowledge System |
576
- | **対象** | kernel/sched(スケジューラ) |
577
- | **結果** | 2,475エンティティ、2,484リレーション |
578
- | **出力** | JSON形式(1.7MB、Git管理可能) |
579
-
580
- ### 今後の発展
581
-
582
- - 🔍 **CodeGraph連携**: ASTパーサーによる精密な解析
583
- - 🤖 **AI連携**: LLMによるナレッジの自動拡充
584
- - 📊 **可視化**: グラフDBへのエクスポート、D3.js可視化
585
-
586
- ## 参考リンク
587
-
588
- - [MUSUBIX GitHub](https://github.com/nahisaho/MUSUBIX)
589
- - [Linux Kernel Source](https://github.com/torvalds/linux)
590
- - [Linuxカーネルスケジューラ - LWN.net](https://lwn.net/Kernel/Index/)
591
-
592
- ---
593
-
594
- **関連記事**:
595
- - [MUSUBIXで始めるエンタープライズナレッジ管理](https://qiita.com/nahisaho/items/xxx)
596
- - [Git-Native Knowledge Systemの設計思想](https://qiita.com/nahisaho/items/yyy)
@@ -1,106 +0,0 @@
1
- /**
2
- * Quality Gate Report Generator
3
- *
4
- * Generates an approval report for the Neuro-Symbolic Integration implementation.
5
- *
6
- * Usage: npx tsx scripts/generate-quality-gate-report.ts
7
- */
8
-
9
- import { QualityGateValidator, createComponentValidation } from '../packages/core/src/symbolic/quality-gate.js';
10
- import type { TraceabilityCoverage } from '../packages/core/src/symbolic/quality-gate.js';
11
- import * as fs from 'fs';
12
- import * as path from 'path';
13
-
14
- // Traceability data based on REQ-SYMB-001 and DES-SYMB-001
15
- const traceabilityData: TraceabilityCoverage[] = [
16
- // Semantic Filter requirements (REQ-SF-001〜003)
17
- { requirementId: 'REQ-SF-001', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-001'], testIds: ['semantic-filter.test.ts'], coveragePercent: 100 },
18
- { requirementId: 'REQ-SF-002', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-001'], testIds: ['semantic-filter.test.ts'], coveragePercent: 100 },
19
- { requirementId: 'REQ-SF-003', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-002'], testIds: ['hallucination-detector.test.ts'], coveragePercent: 100 },
20
-
21
- // Formal Verification requirements (REQ-FV-001〜005)
22
- { requirementId: 'REQ-FV-001', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-009'], testIds: ['ears-to-formal.test.ts'], coveragePercent: 100 },
23
- { requirementId: 'REQ-FV-002', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-010'], testIds: ['vc-generator.test.ts'], coveragePercent: 100 },
24
- { requirementId: 'REQ-FV-003', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-011'], testIds: ['z3-adapter.test.ts'], coveragePercent: 100 },
25
- { requirementId: 'REQ-FV-004', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-012'], testIds: ['z3-adapter.test.ts'], coveragePercent: 100 },
26
- { requirementId: 'REQ-FV-005', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-013'], testIds: ['security-scanner.test.ts'], coveragePercent: 100 },
27
-
28
- // Constitution requirements (REQ-CONST-001〜010)
29
- { requirementId: 'REQ-CONST-001', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-003'], testIds: ['constitution-registry.test.ts'], coveragePercent: 100 },
30
- { requirementId: 'REQ-CONST-002', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-003'], testIds: ['constitution-registry.test.ts'], coveragePercent: 100 },
31
- { requirementId: 'REQ-CONST-003', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-003'], testIds: ['constitution-registry.test.ts'], coveragePercent: 100 },
32
- { requirementId: 'REQ-CONST-004', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-003', 'TSK-SYMB-019'], testIds: ['constitution-registry.test.ts', 'quality-gate.test.ts'], coveragePercent: 100 },
33
- { requirementId: 'REQ-CONST-005', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-003'], testIds: ['constitution-registry.test.ts'], coveragePercent: 100 },
34
- { requirementId: 'REQ-CONST-006', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-003'], testIds: ['constitution-registry.test.ts'], coveragePercent: 100 },
35
- { requirementId: 'REQ-CONST-007', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-003'], testIds: ['constitution-registry.test.ts'], coveragePercent: 100 },
36
- { requirementId: 'REQ-CONST-008', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-003'], testIds: ['constitution-registry.test.ts'], coveragePercent: 100 },
37
- { requirementId: 'REQ-CONST-009', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-003', 'TSK-SYMB-019'], testIds: ['constitution-registry.test.ts', 'quality-gate.test.ts'], coveragePercent: 100 },
38
- { requirementId: 'REQ-CONST-010', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-004', 'TSK-SYMB-019'], testIds: ['confidence-estimator.test.ts', 'quality-gate.test.ts'], coveragePercent: 100 },
39
-
40
- // Routing requirements (REQ-ROUTE-001〜003)
41
- { requirementId: 'REQ-ROUTE-001', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-005'], testIds: ['confidence-router.test.ts'], coveragePercent: 100 },
42
- { requirementId: 'REQ-ROUTE-002', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-005'], testIds: ['confidence-router.test.ts'], coveragePercent: 100 },
43
- { requirementId: 'REQ-ROUTE-003', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-006'], testIds: ['error-handler.test.ts'], coveragePercent: 100 },
44
-
45
- // Non-functional requirements (REQ-NFR-001〜006)
46
- { requirementId: 'REQ-NFR-001', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-018'], testIds: ['performance-budget.test.ts'], coveragePercent: 100 },
47
- { requirementId: 'REQ-NFR-002', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-016'], testIds: ['rule-config.test.ts'], coveragePercent: 100 },
48
- { requirementId: 'REQ-NFR-003', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-001', 'TSK-SYMB-003', 'TSK-SYMB-006', 'TSK-SYMB-008', 'TSK-SYMB-012', 'TSK-SYMB-019'], testIds: ['multiple'], coveragePercent: 100 },
49
- { requirementId: 'REQ-NFR-004', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-014'], testIds: ['candidate-ranker.test.ts'], coveragePercent: 100 },
50
- { requirementId: 'REQ-NFR-005', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-013'], testIds: ['security-scanner.test.ts'], coveragePercent: 100 },
51
- { requirementId: 'REQ-NFR-006', designIds: ['DES-SYMB-001'], taskIds: ['TSK-SYMB-017'], testIds: ['audit-logger.test.ts'], coveragePercent: 100 },
52
- ];
53
-
54
- // Component validation based on implemented modules
55
- const componentValidation = createComponentValidation({
56
- // Phase 3 Components
57
- performanceBudgetDefined: true, // TSK-SYMB-018: PerformanceBudget implemented
58
- extensibleConfigDefined: true, // TSK-SYMB-016: ExtensibleRuleConfig implemented
59
- explanationGeneratorDefined: true, // All components have Explanation support
60
- securityMaskingDefined: true, // TSK-SYMB-013: SecurityScanner with masking
61
- auditLoggingDefined: true, // TSK-SYMB-017: AuditLogger with hash-chain
62
-
63
- // Constitution Compliance
64
- libraryFirstCompliant: true, // Article I: All modules are independent libraries
65
- cliInterfaceDefined: true, // Article II: CLI available via musubix command
66
- testFirstCompliant: true, // Article III: 598 tests written first
67
- earsFormatCompliant: true, // Article IV: REQ-SYMB-001 uses EARS format
68
- traceabilityCompliant: true, // Article V: Full traceability matrix
69
- projectMemoryCompliant: true, // Article VI: steering/ directory maintained
70
- designPatternsDocumented: true, // Article VII: DES-SYMB-001 documents patterns
71
- adrCompliant: true, // Article VIII: Decision records in design doc
72
- qualityGatesConfigured: true, // Article IX: QualityGateValidator implemented
73
- });
74
-
75
- // Generate report
76
- const validator = new QualityGateValidator();
77
- const result = validator.validate(traceabilityData, componentValidation);
78
- const report = validator.generateApprovalReport(result);
79
-
80
- // Output paths
81
- const outputDir = path.join(process.cwd(), 'storage', 'reviews');
82
- const outputPath = path.join(outputDir, `quality-gate-report-${new Date().toISOString().split('T')[0]}.md`);
83
-
84
- // Ensure directory exists
85
- if (!fs.existsSync(outputDir)) {
86
- fs.mkdirSync(outputDir, { recursive: true });
87
- }
88
-
89
- // Write report
90
- fs.writeFileSync(outputPath, report);
91
-
92
- console.log('\n' + '='.repeat(60));
93
- console.log('Quality Gate Validation Complete');
94
- console.log('='.repeat(60));
95
- console.log(`\nStatus: ${result.passed ? '✅ PASSED' : '❌ FAILED'}`);
96
- console.log(`\nSummary:`);
97
- console.log(` Total Checks: ${result.summary.totalChecks}`);
98
- console.log(` Passed: ${result.summary.passedChecks}`);
99
- console.log(` Failed: ${result.summary.failedChecks}`);
100
- console.log(` Blockers: ${result.summary.blockerCount}`);
101
- console.log(` Critical: ${result.summary.criticalCount}`);
102
- console.log(`\nReport saved to: ${outputPath}`);
103
- console.log('='.repeat(60) + '\n');
104
-
105
- // Also print the report
106
- console.log(report);