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,475 +0,0 @@
1
- # ADR-v3.4.0-003: LM API Integration Strategy
2
-
3
- **Status**: Accepted
4
- **Date**: 2026-01-16
5
- **Authors**: AI Agent
6
- **Context**: MUSUBIX v3.4.0 Deep Research Integration
7
- **Traces To**: REQ-DR-CORE-004, REQ-DR-INT-001, DES-DR-v3.4.0
8
-
9
- ---
10
-
11
- ## Context
12
-
13
- Deep Research機能では、Web検索結果を推論・分析してナレッジを抽出する必要がある。以下の技術的決定が必要:
14
-
15
- 1. **LM API選択**: どのLLM APIを使用するか
16
- 2. **統合方法**: VS Code Extension APIとの統合方法
17
- 3. **Expert Delegation統合**: 既存の@nahisaho/musubix-expert-delegation (v3.2.0+) の活用
18
-
19
- ### 要件からの制約
20
-
21
- - REQ-DR-CORE-004: LM APIによる推論・評価・質問生成
22
- - REQ-DR-INT-001: Expert Delegation統合(EARS変換、設計レビュー等)
23
- - 憲法Article II: CLI Interface必須
24
- - VS Code環境: GitHub Copilot via LM API使用
25
-
26
- ---
27
-
28
- ## Decision
29
-
30
- **VS Code LM API**(Language Model API)を直接使用し、**Expert Delegation**をラッパーとして活用する2層構造を採用。
31
-
32
- ### アーキテクチャ
33
-
34
- ```
35
- ┌─────────────────────────────────────────────────────┐
36
- │ Deep Research (Application Layer) │
37
- │ - LMReasoning │
38
- │ - QuestionGenerator │
39
- │ - AnswerEvaluator │
40
- └────────────────┬────────────────────────────────────┘
41
-
42
-
43
- ┌─────────────────────────────────────────────────────┐
44
- │ Expert Delegation (Middleware Layer) │
45
- │ - DelegationEngine.delegate() │
46
- │ - ExpertManager (7 specialists) │
47
- │ - VSCodeLMProvider │
48
- └────────────────┬────────────────────────────────────┘
49
-
50
-
51
- ┌─────────────────────────────────────────────────────┐
52
- │ VS Code LM API (Platform Layer) │
53
- │ - vscode.lm.selectChatModels() │
54
- │ - model.sendRequest() │
55
- └─────────────────────────────────────────────────────┘
56
- ```
57
-
58
- ### 実装戦略
59
-
60
- ```typescript
61
- // src/reasoning/lm-reasoning.ts
62
-
63
- import { DelegationEngine } from '@nahisaho/musubix-expert-delegation';
64
- import * as vscode from 'vscode';
65
-
66
- export class LMReasoning {
67
- constructor(
68
- private lmProvider: VSCodeLMProvider,
69
- private expertDelegation: DelegationEngine
70
- ) {}
71
-
72
- /**
73
- * 反射的質問生成
74
- * REQ-DR-CORE-009
75
- */
76
- async generateQuestions(
77
- query: string,
78
- currentKnowledge: KnowledgeBase
79
- ): Promise<ReflectiveQuestion[]> {
80
- const prompt = `
81
- Original query: ${query}
82
-
83
- Current knowledge: ${currentKnowledge.getSummary()}
84
-
85
- Generate 3-5 specific follow-up questions to fill knowledge gaps.
86
- Format: JSON array of {question, reason, priority}
87
- `;
88
-
89
- // 直接LM APIを使用
90
- const response = await this.lmProvider.generateText({
91
- messages: [{ role: 'user', content: prompt }],
92
- maxTokens: 500,
93
- });
94
-
95
- return JSON.parse(response.text);
96
- }
97
-
98
- /**
99
- * 回答評価
100
- * REQ-DR-CORE-004
101
- */
102
- async evaluateAnswer(
103
- query: string,
104
- answer: AnswerAction,
105
- knowledge: KnowledgeBase
106
- ): Promise<EvaluationResult> {
107
- const prompt = `
108
- Evaluate if this answer is definitive and complete:
109
-
110
- Query: ${query}
111
- Answer: ${answer.answer}
112
- Knowledge base: ${knowledge.size()} items
113
-
114
- Return JSON: {
115
- isDefinitive: boolean,
116
- confidence: number,
117
- missingAspects: string[],
118
- recommendations: string[]
119
- }
120
- `;
121
-
122
- // 直接LM APIを使用
123
- const response = await this.lmProvider.generateText({
124
- messages: [{ role: 'user', content: prompt }],
125
- maxTokens: 300,
126
- });
127
-
128
- return JSON.parse(response.text);
129
- }
130
-
131
- /**
132
- * EARS変換(Expert Delegation経由)
133
- * REQ-DR-INT-001, REQ-DR-INT-009
134
- */
135
- async convertToEARS(finding: Finding): Promise<string> {
136
- // Expert Delegationを使用
137
- const result = await this.expertDelegation.delegate({
138
- prompt: `Convert to EARS format: ${finding.statement}`,
139
- expertType: 'ears-analyst',
140
- mode: 'advisory',
141
- });
142
-
143
- return result.content;
144
- }
145
- }
146
- ```
147
-
148
- ---
149
-
150
- ## Rationale
151
-
152
- ### なぜVS Code LM APIを直接使用するか
153
-
154
- **✅ 採用理由**:
155
-
156
- 1. **GitHub Copilot統合**: VS Code環境でCopilotを直接利用可能
157
- 2. **ゼロコスト**: 追加のAPI Key不要(Copilotライセンス内)
158
- 3. **既存インフラ活用**: Expert Delegationが既にVS Code LM APIをラップ済み
159
- 4. **モデル選択柔軟性**: `selectChatModels()`でモデル切り替え可能
160
-
161
- **VS Code LM API例**:
162
- ```typescript
163
- import * as vscode from 'vscode';
164
-
165
- const models = await vscode.lm.selectChatModels({
166
- vendor: 'copilot',
167
- family: 'gpt-4',
168
- });
169
-
170
- const model = models[0];
171
- const response = await model.sendRequest(
172
- [{ role: vscode.LanguageModelChatMessageRole.User, content: prompt }],
173
- { maxTokens: 500 },
174
- token
175
- );
176
- ```
177
-
178
- ### LM Provider比較
179
-
180
- | プロバイダー | 長所 | 短所 | 判定 |
181
- |-------------|------|------|------|
182
- | **VS Code LM API** | Copilot統合、API Key不要 | VS Code環境依存 | ✅ 採用 |
183
- | **OpenAI API** | 高品質、独立動作 | ❌ 有料、API Key管理必要 | ❌ 不採用 |
184
- | **Azure OpenAI** | エンタープライズ対応 | ❌ 有料、Azure依存 | ❌ 不採用 |
185
- | **Anthropic Claude** | 長文対応 | ❌ 有料、API Key管理必要 | ❌ 不採用 |
186
- | **Ollama (Local)** | プライバシー、無料 | ❌ GPU必要、品質低い | ❌ 不採用 |
187
-
188
- ### Expert Delegationの役割
189
-
190
- **既存パッケージを活用**して以下の機能を委譲:
191
-
192
- | 機能 | Expert Type | 用途 |
193
- |------|------------|------|
194
- | **EARS変換** | `ears-analyst` | 調査結果をEARS形式要件に変換 |
195
- | **設計レビュー** | `design-reviewer` | 生成した設計のSOLID準拠チェック |
196
- | **セキュリティ分析** | `security-analyst` | 調査結果からセキュリティリスク検出 |
197
- | **アーキテクチャ分析** | `architect` | 技術選択肢の評価 |
198
-
199
- **Adapter Pattern**で統合:
200
-
201
- ```typescript
202
- // src/integrations/expert-integration.ts
203
-
204
- export class ExpertIntegration {
205
- constructor(private delegation: DelegationEngine) {}
206
-
207
- async convertToEARS(finding: string): Promise<string> {
208
- const result = await this.delegation.delegate({
209
- prompt: `Convert to EARS format: ${finding}`,
210
- expertType: 'ears-analyst',
211
- mode: 'advisory',
212
- });
213
- return result.content;
214
- }
215
-
216
- async reviewDesign(designDoc: string): Promise<string> {
217
- const result = await this.delegation.delegate({
218
- prompt: `Review this design for SOLID principles: ${designDoc}`,
219
- expertType: 'design-reviewer',
220
- mode: 'advisory',
221
- });
222
- return result.content;
223
- }
224
-
225
- async analyzeSecurityRisks(findings: Finding[]): Promise<SecurityAnalysis> {
226
- const result = await this.delegation.delegate({
227
- prompt: `Analyze security risks: ${JSON.stringify(findings)}`,
228
- expertType: 'security-analyst',
229
- mode: 'advisory',
230
- });
231
- return JSON.parse(result.content);
232
- }
233
- }
234
- ```
235
-
236
- ---
237
-
238
- ## Consequences
239
-
240
- ### Positive
241
-
242
- ✅ **ゼロコスト**: GitHub Copilotライセンス内で動作
243
- ✅ **既存資産活用**: Expert Delegation (v3.2.0+) をそのまま利用
244
- ✅ **テスト容易性**: VSCodeLMProviderをMockして単体テスト可能
245
- ✅ **専門知識**: 7種のExpertタイプで高品質な分析
246
-
247
- ### Negative
248
-
249
- ⚠️ **VS Code依存**: CLI実行時もVS Code環境が必要
250
- ⚠️ **モデル制限**: Copilotが提供するモデルに限定
251
- ⚠️ **トークン制限**: Copilotの利用制限に準拠
252
-
253
- ### Mitigations
254
-
255
- - **VS Code依存**:
256
- - CLIは`npx`でVS Code Extension Hostから実行
257
- - 将来的にはOpenAI APIへのフォールバック実装
258
- - **モデル制限**:
259
- - `selectChatModels()`でGPT-4を優先選択
260
- - 利用不可時はGPT-3.5へフォールバック
261
- - **トークン制限**:
262
- - TokenTrackerで予算管理(REQ-DR-CORE-006)
263
- - 予算80%消費時に警告
264
-
265
- ---
266
-
267
- ## Implementation Details
268
-
269
- ### VSCodeLMProviderラッパー
270
-
271
- ```typescript
272
- // src/providers/vscode-lm-provider.ts
273
-
274
- import * as vscode from 'vscode';
275
-
276
- export interface LMProvider {
277
- generateText(request: LMRequest): Promise<LMResponse>;
278
- }
279
-
280
- export interface LMRequest {
281
- messages: { role: string; content: string }[];
282
- maxTokens: number;
283
- temperature?: number;
284
- }
285
-
286
- export interface LMResponse {
287
- text: string;
288
- tokensUsed: number;
289
- model: string;
290
- }
291
-
292
- export class VSCodeLMProvider implements LMProvider {
293
- private modelSelector: { vendor: string; family: string };
294
-
295
- constructor(modelSelector = { vendor: 'copilot', family: 'gpt-4' }) {
296
- this.modelSelector = modelSelector;
297
- }
298
-
299
- async generateText(request: LMRequest): Promise<LMResponse> {
300
- // モデル選択
301
- const models = await vscode.lm.selectChatModels(this.modelSelector);
302
-
303
- if (models.length === 0) {
304
- throw new Error('No LM models available');
305
- }
306
-
307
- const model = models[0];
308
-
309
- // メッセージ変換
310
- const messages = request.messages.map(msg =>
311
- new vscode.LanguageModelChatMessage(
312
- msg.role === 'user'
313
- ? vscode.LanguageModelChatMessageRole.User
314
- : vscode.LanguageModelChatMessageRole.Assistant,
315
- msg.content
316
- )
317
- );
318
-
319
- // リクエスト送信
320
- const response = await model.sendRequest(
321
- messages,
322
- { maxTokens: request.maxTokens, temperature: request.temperature },
323
- new vscode.CancellationTokenSource().token
324
- );
325
-
326
- // レスポンス収集
327
- let text = '';
328
- for await (const chunk of response.text) {
329
- text += chunk;
330
- }
331
-
332
- return {
333
- text,
334
- tokensUsed: this.estimateTokens(text),
335
- model: model.name,
336
- };
337
- }
338
-
339
- private estimateTokens(text: string): number {
340
- // 簡易推定: 4文字 = 1トークン
341
- return Math.ceil(text.length / 4);
342
- }
343
- }
344
- ```
345
-
346
- ### トークン予算管理
347
-
348
- ```typescript
349
- // src/utils/token-tracker.ts
350
-
351
- export class TokenTracker {
352
- private usages: TokenUsage[] = [];
353
- private budget: number;
354
- private warningEmitted = false;
355
-
356
- constructor(budget: number) {
357
- this.budget = budget;
358
- }
359
-
360
- trackUsage(operation: string, tokens: number): void {
361
- this.usages.push({ operation, tokens, timestamp: Date.now() });
362
-
363
- // 80%警告
364
- if (this.getUsed() >= this.budget * 0.8 && !this.warningEmitted) {
365
- console.warn(`⚠️ Token budget 80% consumed (${this.getUsed()}/${this.budget})`);
366
- this.warningEmitted = true;
367
- }
368
-
369
- // 100%エラー
370
- if (this.isExceeded()) {
371
- throw new TokenBudgetExceededError(this.getUsed(), this.budget);
372
- }
373
- }
374
-
375
- getUsed(): number {
376
- return this.usages.reduce((sum, u) => sum + u.tokens, 0);
377
- }
378
-
379
- getRemaining(): number {
380
- return Math.max(0, this.budget - this.getUsed());
381
- }
382
-
383
- isExceeded(): boolean {
384
- return this.getUsed() >= this.budget;
385
- }
386
- }
387
- ```
388
-
389
- ---
390
-
391
- ## Compliance
392
-
393
- ### 要件準拠
394
-
395
- | 要件ID | 対応 |
396
- |--------|------|
397
- | REQ-DR-CORE-004 | ✅ LM APIで推論・評価実装 |
398
- | REQ-DR-CORE-006 | ✅ TokenTrackerで予算管理 |
399
- | REQ-DR-INT-001 | ✅ Expert Delegation統合 |
400
-
401
- ### 憲法準拠
402
-
403
- | 条項 | 対応 |
404
- |-----|------|
405
- | II. CLI Interface | ✅ CLIから実行可能 |
406
- | VII. Design Patterns | ✅ Adapter, Strategy適用 |
407
-
408
- ---
409
-
410
- ## Testing Strategy
411
-
412
- ### Mock LM Provider
413
-
414
- ```typescript
415
- // src/test/mocks/mock-lm-provider.ts
416
-
417
- export class MockLMProvider implements LMProvider {
418
- private responses: Map<string, string> = new Map();
419
-
420
- setResponse(prompt: string, response: string): void {
421
- this.responses.set(prompt, response);
422
- }
423
-
424
- async generateText(request: LMRequest): Promise<LMResponse> {
425
- const prompt = request.messages[0].content;
426
- const text = this.responses.get(prompt) || '{"default": "response"}';
427
-
428
- return {
429
- text,
430
- tokensUsed: Math.ceil(text.length / 4),
431
- model: 'mock-model',
432
- };
433
- }
434
- }
435
- ```
436
-
437
- ### テストケース
438
-
439
- ```typescript
440
- describe('LMReasoning', () => {
441
- it('should generate reflective questions', async () => {
442
- const mockProvider = new MockLMProvider();
443
- mockProvider.setResponse(
444
- 'Original query: ...',
445
- JSON.stringify([
446
- { question: 'What is X?', reason: '...', priority: 10 }
447
- ])
448
- );
449
-
450
- const reasoning = new LMReasoning(mockProvider, expertDelegation);
451
- const questions = await reasoning.generateQuestions('test', knowledge);
452
-
453
- expect(questions).toHaveLength(1);
454
- expect(questions[0].question).toBe('What is X?');
455
- });
456
- });
457
- ```
458
-
459
- ---
460
-
461
- ## References
462
-
463
- - [VS Code Language Model API](https://code.visualstudio.com/api/extension-guides/language-model)
464
- - [GitHub Copilot Extensions](https://github.com/features/copilot)
465
- - [@nahisaho/musubix-expert-delegation](../../packages/expert-delegation/README.md)
466
- - REQ-MUSUBIX-v3.4.0.md - 要件定義書
467
- - DES-DR-v3.4.0.md - 設計書
468
-
469
- ---
470
-
471
- ## Approval
472
-
473
- - **Author**: AI Agent (2026-01-16)
474
- - **Reviewer**: -
475
- - **Status**: Accepted