musubix 3.5.1 → 3.6.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 (99) hide show
  1. package/.github/AGENTS.md +949 -0
  2. package/.github/prompts/sdd-change-apply.prompt.md +283 -0
  3. package/.github/prompts/sdd-change-archive.prompt.md +241 -0
  4. package/.github/prompts/sdd-change-init.prompt.md +269 -0
  5. package/.github/prompts/sdd-design.prompt.md +250 -0
  6. package/.github/prompts/sdd-implement.prompt.md +387 -0
  7. package/.github/prompts/sdd-requirements.prompt.md +193 -0
  8. package/.github/prompts/sdd-review.prompt.md +155 -0
  9. package/.github/prompts/sdd-security.prompt.md +228 -0
  10. package/.github/prompts/sdd-steering.prompt.md +269 -0
  11. package/.github/prompts/sdd-tasks.prompt.md +255 -0
  12. package/.github/prompts/sdd-test.prompt.md +230 -0
  13. package/.github/prompts/sdd-validate.prompt.md +304 -0
  14. package/.github/skills/musubix-adr-generation/SKILL.md +209 -0
  15. package/.github/skills/musubix-best-practices/SKILL.md +315 -0
  16. package/.github/skills/musubix-c4-design/SKILL.md +162 -0
  17. package/.github/skills/musubix-code-generation/SKILL.md +237 -0
  18. package/.github/skills/musubix-domain-inference/SKILL.md +196 -0
  19. package/.github/skills/musubix-ears-validation/SKILL.md +161 -0
  20. package/.github/skills/musubix-sdd-workflow/SKILL.md +217 -0
  21. package/.github/skills/musubix-technical-writing/SKILL.md +444 -0
  22. package/.github/skills/musubix-test-generation/SKILL.md +212 -0
  23. package/.github/skills/musubix-traceability/SKILL.md +141 -0
  24. package/AGENTS.md +1136 -0
  25. package/LICENSE +21 -0
  26. package/README.ja.md +313 -0
  27. package/README.md +315 -50
  28. package/bin/musubix-mcp.js +15 -0
  29. package/bin/musubix.js +9 -1
  30. package/docs/API-REFERENCE.md +1425 -0
  31. package/docs/GITHUB-ACTIONS-NPM-SETUP.md +132 -0
  32. package/docs/INSTALL-GUIDE.ja.md +459 -0
  33. package/docs/INSTALL-GUIDE.md +459 -0
  34. package/docs/MIGRATION-v3.0.md +324 -0
  35. package/docs/MUSUBI-enhancement_roadmap_20260105.md +651 -0
  36. package/docs/MUSUBIX-v3.0-User-Guide.md +1357 -0
  37. package/docs/MUSUBIXv2.2.0-Manual-outline.md +136 -0
  38. package/docs/MUSUBIXv2.2.0-Manual.md +3123 -0
  39. package/docs/MUSUBIXv2.3.5-Refactering.md +1310 -0
  40. package/docs/MUSUBIv1.6.1-enhancement_roadmap_20260105.md +291 -0
  41. package/docs/MUSUBIv2.2.0-USERGUIDE.md +2079 -0
  42. package/docs/ROADMAP-v1.5.md +116 -0
  43. package/docs/SwarmCoding.md +1284 -0
  44. package/docs/Test-prompt.md +105 -0
  45. package/docs/USER-GUIDE-v1.8.0.md +2371 -0
  46. package/docs/USER-GUIDE.ja.md +2147 -0
  47. package/docs/USER-GUIDE.md +3022 -0
  48. package/docs/YATA-GLOBAL-GUIDE.ja.md +750 -0
  49. package/docs/YATA-GLOBAL-GUIDE.md +595 -0
  50. package/docs/YATA-LOCAL-GUIDE.ja.md +989 -0
  51. package/docs/YATA-LOCAL-GUIDE.md +730 -0
  52. package/docs/adr/0001-real-time-pattern-learning-architecture-for-v1-5-0.md +75 -0
  53. package/docs/adr/0002-pattern-sharing-protocol-for-cross-team-collaborat.md +79 -0
  54. package/docs/adr/0003-owl-2-rl-implementation-strategy-for-advanced-infe.md +90 -0
  55. package/docs/adr/ADR-v3.4.0-001-deep-research-architecture.md +217 -0
  56. package/docs/adr/ADR-v3.4.0-002-search-provider-selection.md +308 -0
  57. package/docs/adr/ADR-v3.4.0-003-lm-api-integration.md +475 -0
  58. package/docs/enterprise-knowledge-management.md +1737 -0
  59. package/docs/evolution-from-musubi-to-musubix.md +2170 -0
  60. package/docs/experiments/EXPERIMENT-ASSISTANT-AXIS-DRIFT-DETECTION.md +155 -0
  61. package/docs/getting-started-with-sdd.md +1602 -0
  62. package/docs/moodle-refactering-codegraph-musubix.md +391 -0
  63. package/docs/moodle-refactering-codegraph.md +278 -0
  64. package/docs/overview/MUSUBIX-CodeGraph.md +322 -0
  65. package/docs/overview/MUSUBIX-Core.md +671 -0
  66. package/docs/overview/MUSUBIX-Decisions.md +494 -0
  67. package/docs/overview/MUSUBIX-FormalVerify.md +566 -0
  68. package/docs/overview/MUSUBIX-Knowledge.md +1231 -0
  69. package/docs/overview/MUSUBIX-Learning.md +837 -0
  70. package/docs/overview/MUSUBIX-MCP-Server.md +535 -0
  71. package/docs/overview/MUSUBIX-Overview.md +264 -0
  72. package/docs/overview/MUSUBIX-Phase1-Complete.md +271 -0
  73. package/docs/overview/MUSUBIX-Phase2-Complete.md +310 -0
  74. package/docs/overview/MUSUBIX-Policy.md +477 -0
  75. package/docs/overview/MUSUBIX-Roadmap-v2.md +399 -0
  76. package/docs/overview/MUSUBIX-Security-Plan.md +939 -0
  77. package/docs/overview/MUSUBIX-Security-v2.1.md +668 -0
  78. package/docs/overview/MUSUBIX-Security.md +891 -0
  79. package/docs/overview/MUSUBIX-YATA.md +666 -0
  80. package/docs/overview/MUSUBIX-v2.2.0-Advanced-Learning.md +513 -0
  81. package/docs/overview/Neuro-SymbolicAI.md +159 -0
  82. package/docs/packages/knowledge.md +594 -0
  83. package/docs/qiita/musubix-v3.6.0-fastrender-insights.md +625 -0
  84. package/docs/qiita-linux-kernel-knowledge-graph.md +596 -0
  85. package/docs/qiita-musubix-assistant-axis.md +380 -0
  86. package/package.json +58 -52
  87. package/scripts/generate-quality-gate-report.ts +106 -0
  88. package/scripts/postinstall.js +94 -0
  89. package/scripts/register-release-knowledge.ts +127 -0
  90. package/steering/.musubi-version +1 -0
  91. package/steering/product.ja.md +572 -0
  92. package/steering/project.yml +66 -0
  93. package/steering/rules/constitution.md +491 -0
  94. package/steering/structure.ja.md +503 -0
  95. package/steering/tech.ja.md +208 -0
  96. package/dist/index.d.ts +0 -25
  97. package/dist/index.d.ts.map +0 -1
  98. package/dist/index.js +0 -74
  99. package/dist/index.js.map +0 -1
@@ -0,0 +1,750 @@
1
+ # YATA Global ユーザーガイド
2
+
3
+ > **YATA Global** - 分散型知識グラフプラットフォーム
4
+
5
+ ## 📖 概要
6
+
7
+ YATA Global (`@nahisaho/yata-global`) は、コミュニティベースの知識共有プラットフォームです。フレームワーク知識、設計パターン、ベストプラクティスをグローバルに共有・検索できます。
8
+
9
+ ### 主な特徴
10
+
11
+ | 機能 | 説明 |
12
+ |------|------|
13
+ | **フレームワーク知識** | 各種フレームワークのナレッジベース |
14
+ | **パターン共有** | 設計パターン・コードパターンの共有 |
15
+ | **KGPR** | Knowledge Graph Pull Request によるコントリビューション |
16
+ | **オフラインモード** | ローカルキャッシュによるオフライン動作 |
17
+ | **同期エンジン** | 自動/手動のデータ同期 |
18
+ | **認証・認可** | ユーザー認証とアクセス制御 |
19
+
20
+ ---
21
+
22
+ ## 🚀 インストール
23
+
24
+ ```bash
25
+ npm install @nahisaho/yata-global
26
+ ```
27
+
28
+ ### 前提条件
29
+
30
+ - Node.js >= 20.0.0
31
+ - npm >= 10.0.0
32
+
33
+ ---
34
+
35
+ ## 📘 基本的な使い方
36
+
37
+ ### クライアントの初期化
38
+
39
+ ```typescript
40
+ import { createYataGlobal } from '@nahisaho/yata-global';
41
+
42
+ const yataGlobal = createYataGlobal({
43
+ serverUrl: 'https://api.yata.example.com', // APIサーバーURL
44
+ offlineMode: false, // オフラインモード
45
+ cacheSize: 100, // キャッシュサイズ(MB)
46
+ autoSync: true, // 自動同期
47
+ syncInterval: 300000, // 同期間隔(5分)
48
+ });
49
+
50
+ // イベントリスナー登録
51
+ yataGlobal.on('sync:start', () => console.log('Sync started'));
52
+ yataGlobal.on('sync:complete', (result) => console.log('Sync complete:', result));
53
+ yataGlobal.on('sync:error', (error) => console.error('Sync error:', error));
54
+
55
+ // 終了時
56
+ yataGlobal.close();
57
+ ```
58
+
59
+ ### 設定オプション
60
+
61
+ ```typescript
62
+ interface SyncConfig {
63
+ serverUrl: string; // APIサーバーURL
64
+ offlineMode: boolean; // オフラインモード(デフォルト: false)
65
+ cacheSize: number; // ローカルキャッシュサイズ(デフォルト: 100MB)
66
+ autoSync: boolean; // 自動同期(デフォルト: true)
67
+ syncInterval: number; // 同期間隔(ミリ秒、デフォルト: 300000)
68
+ retryAttempts: number; // リトライ回数(デフォルト: 3)
69
+ timeout: number; // タイムアウト(ミリ秒)
70
+ }
71
+ ```
72
+
73
+ ---
74
+
75
+ ## 🔐 認証
76
+
77
+ ### ログイン
78
+
79
+ ```typescript
80
+ // ユーザー名・パスワードでログイン
81
+ const token = await yataGlobal.login({
82
+ username: 'developer',
83
+ password: 'secure-password',
84
+ });
85
+
86
+ console.log('Logged in, token expires:', token.expiresAt);
87
+ ```
88
+
89
+ ### トークン認証
90
+
91
+ ```typescript
92
+ // 既存トークンでログイン
93
+ const token = await yataGlobal.loginWithToken('your-access-token');
94
+ ```
95
+
96
+ ### ログアウト
97
+
98
+ ```typescript
99
+ await yataGlobal.logout();
100
+ ```
101
+
102
+ ### 認証状態の確認
103
+
104
+ ```typescript
105
+ if (yataGlobal.isAuthenticated()) {
106
+ const user = await yataGlobal.getCurrentUser();
107
+ console.log('Current user:', user?.username);
108
+ }
109
+ ```
110
+
111
+ ---
112
+
113
+ ## 📚 フレームワーク知識
114
+
115
+ ### フレームワークの検索
116
+
117
+ ```typescript
118
+ const result = await yataGlobal.searchFrameworks({
119
+ query: 'react',
120
+ category: 'web-frontend',
121
+ language: 'typescript',
122
+ tags: ['ui', 'component'],
123
+ minQuality: 70,
124
+ sortBy: 'popularity', // 'popularity' | 'quality' | 'updated' | 'relevance'
125
+ limit: 20,
126
+ offset: 0,
127
+ });
128
+
129
+ console.log(`Found ${result.total} frameworks`);
130
+ for (const fw of result.items) {
131
+ console.log(`- ${fw.name} v${fw.version} (${fw.popularity}★)`);
132
+ }
133
+ ```
134
+
135
+ ### カテゴリ別フレームワーク
136
+
137
+ ```typescript
138
+ const frontendFrameworks = await yataGlobal.getFrameworksByCategory('web-frontend');
139
+ ```
140
+
141
+ ### フレームワークカテゴリ
142
+
143
+ ```typescript
144
+ type FrameworkCategory =
145
+ | 'web-frontend' // Webフロントエンド
146
+ | 'web-backend' // Webバックエンド
147
+ | 'mobile' // モバイル
148
+ | 'desktop' // デスクトップ
149
+ | 'database' // データベース
150
+ | 'orm' // ORM
151
+ | 'testing' // テスト
152
+ | 'build-tool' // ビルドツール
153
+ | 'cli' // CLI
154
+ | 'ai-ml' // AI/ML
155
+ | 'devops' // DevOps
156
+ | 'cloud' // クラウド
157
+ | 'security' // セキュリティ
158
+ | 'networking' // ネットワーク
159
+ | 'data-processing' // データ処理
160
+ | 'logging' // ロギング
161
+ | 'monitoring' // モニタリング
162
+ | 'documentation' // ドキュメント
163
+ | 'other'; // その他
164
+ ```
165
+
166
+ ### 個別フレームワークの取得
167
+
168
+ ```typescript
169
+ const framework = await yataGlobal.getFramework('react-18');
170
+ if (framework) {
171
+ console.log('Name:', framework.name);
172
+ console.log('Version:', framework.version);
173
+ console.log('Description:', framework.description);
174
+ console.log('Docs:', framework.documentationUrl);
175
+ console.log('Quality:', framework.quality);
176
+ console.log('Tags:', framework.tags.join(', '));
177
+ }
178
+ ```
179
+
180
+ ---
181
+
182
+ ## 🧩 パターン
183
+
184
+ ### パターンの検索
185
+
186
+ ```typescript
187
+ const patterns = await yataGlobal.searchPatterns({
188
+ query: 'repository pattern',
189
+ category: 'data-access',
190
+ language: 'typescript',
191
+ sortBy: 'quality',
192
+ limit: 20,
193
+ });
194
+
195
+ for (const pattern of patterns.items) {
196
+ console.log(`- ${pattern.name}: ${pattern.description}`);
197
+ console.log(` Rating: ${pattern.rating.average}/5 (${pattern.downloads} downloads)`);
198
+ }
199
+ ```
200
+
201
+ ### パターンカテゴリ
202
+
203
+ ```typescript
204
+ type PatternCategory =
205
+ | 'architecture' // アーキテクチャ
206
+ | 'design-pattern' // 設計パターン
207
+ | 'testing' // テスト
208
+ | 'error-handling' // エラー処理
209
+ | 'authentication' // 認証
210
+ | 'authorization' // 認可
211
+ | 'api-design' // API設計
212
+ | 'data-access' // データアクセス
213
+ | 'validation' // バリデーション
214
+ | 'logging' // ロギング
215
+ | 'caching' // キャッシュ
216
+ | 'async' // 非同期
217
+ | 'configuration' // 設定
218
+ | 'other'; // その他
219
+ ```
220
+
221
+ ### 個別パターンの取得
222
+
223
+ ```typescript
224
+ const pattern = await yataGlobal.getPattern('repository-pattern-ts');
225
+ if (pattern) {
226
+ console.log('Name:', pattern.name);
227
+ console.log('Description:', pattern.description);
228
+ console.log('Template:', pattern.template);
229
+ console.log('Example:', pattern.example);
230
+ }
231
+ ```
232
+
233
+ ### パターンの共有
234
+
235
+ ```typescript
236
+ // 認証が必要
237
+ if (!yataGlobal.isAuthenticated()) {
238
+ await yataGlobal.login({ username, password });
239
+ }
240
+
241
+ const patternId = await yataGlobal.sharePattern({
242
+ name: 'Service Layer Pattern',
243
+ description: 'ビジネスロジックをカプセル化するサービス層パターン',
244
+ category: 'architecture',
245
+ language: 'typescript',
246
+ frameworks: ['nestjs', 'express'],
247
+ template: `
248
+ export class {{ServiceName}} {
249
+ constructor(private readonly repository: I{{EntityName}}Repository) {}
250
+
251
+ async create(dto: Create{{EntityName}}Dto): Promise<{{EntityName}}> {
252
+ // ビジネスロジック
253
+ return this.repository.save(dto);
254
+ }
255
+ }`,
256
+ example: `
257
+ export class UserService {
258
+ constructor(private readonly repository: IUserRepository) {}
259
+
260
+ async createUser(dto: CreateUserDto): Promise<User> {
261
+ const exists = await this.repository.findByEmail(dto.email);
262
+ if (exists) throw new ConflictError('User already exists');
263
+ return this.repository.save(dto);
264
+ }
265
+ }`,
266
+ tags: ['service', 'layer', 'architecture', 'clean-architecture'],
267
+ visibility: 'public', // 'public' | 'private' | 'unlisted'
268
+ official: false,
269
+ });
270
+
271
+ console.log('Pattern shared:', patternId);
272
+ ```
273
+
274
+ ### パターンの評価
275
+
276
+ ```typescript
277
+ await yataGlobal.ratePattern('pattern-id', 5); // 1-5の評価
278
+ ```
279
+
280
+ ### パターンの削除
281
+
282
+ ```typescript
283
+ await yataGlobal.deletePattern('pattern-id');
284
+ ```
285
+
286
+ ---
287
+
288
+ ## 🔄 同期
289
+
290
+ ### 手動同期
291
+
292
+ ```typescript
293
+ const syncResult = await yataGlobal.sync();
294
+
295
+ console.log('Sync result:');
296
+ console.log(` Frameworks synced: ${syncResult.frameworksSynced}`);
297
+ console.log(` Patterns synced: ${syncResult.patternsSynced}`);
298
+ console.log(` Duration: ${syncResult.duration}ms`);
299
+ ```
300
+
301
+ ### 同期状態の確認
302
+
303
+ ```typescript
304
+ const status = yataGlobal.getSyncStatus();
305
+
306
+ console.log('Sync status:');
307
+ console.log(` Last sync: ${status.lastSyncAt}`);
308
+ console.log(` Pending changes: ${status.pendingChanges}`);
309
+ console.log(` Is syncing: ${status.isSyncing}`);
310
+ ```
311
+
312
+ ### オフラインモード
313
+
314
+ ```typescript
315
+ // オフラインモードを有効化
316
+ yataGlobal.enableOfflineMode();
317
+
318
+ // オフラインモードを無効化(オンライン復帰)
319
+ yataGlobal.disableOfflineMode();
320
+ ```
321
+
322
+ オフラインモードでは:
323
+ - ローカルキャッシュからデータを取得
324
+ - 変更操作は同期キューに保存
325
+ - オンライン復帰時に自動同期
326
+
327
+ ---
328
+
329
+ ## 📊 アナリティクス
330
+
331
+ ```typescript
332
+ const analytics = await yataGlobal.getAnalytics();
333
+
334
+ console.log('Platform Statistics:');
335
+ console.log(` Total frameworks: ${analytics.totalFrameworks}`);
336
+ console.log(` Total patterns: ${analytics.totalPatterns}`);
337
+ console.log(` Total users: ${analytics.totalUsers}`);
338
+ console.log('');
339
+ console.log('Top Frameworks:');
340
+ for (const fw of analytics.topFrameworks) {
341
+ console.log(` - ${fw.name}: ${fw.popularity}★`);
342
+ }
343
+ console.log('');
344
+ console.log('Top Patterns:');
345
+ for (const p of analytics.topPatterns) {
346
+ console.log(` - ${p.name}: ${p.downloads} downloads`);
347
+ }
348
+ ```
349
+
350
+ ---
351
+
352
+ ## 👤 ユーザー管理
353
+
354
+ ### プロフィール取得
355
+
356
+ ```typescript
357
+ const user = await yataGlobal.getCurrentUser();
358
+ if (user) {
359
+ console.log('Username:', user.username);
360
+ console.log('Email:', user.email);
361
+ console.log('Joined:', user.joinedAt);
362
+ }
363
+ ```
364
+
365
+ ### プロフィール更新
366
+
367
+ ```typescript
368
+ await yataGlobal.updateProfile({
369
+ displayName: 'New Display Name',
370
+ bio: 'TypeScript developer',
371
+ });
372
+ ```
373
+
374
+ ---
375
+
376
+ ## 📤 KGPR (Knowledge Graph Pull Request)
377
+
378
+ KGPRは、ローカル知識グラフの変更をYATA Globalにコントリビュートするためのワークフローです。
379
+
380
+ ### KGPR モジュールのインポート
381
+
382
+ ```typescript
383
+ import {
384
+ KGPRManager,
385
+ createKGPRManager,
386
+ MergeEngine,
387
+ createMergeEngine,
388
+ PrivacyFilter,
389
+ NotificationService,
390
+ } from '@nahisaho/yata-global';
391
+ ```
392
+
393
+ ### KGPRワークフロー
394
+
395
+ ```
396
+ ┌─────────────────────────────────────────────────────────────┐
397
+ │ KGPR ワークフロー │
398
+ │ │
399
+ │ [YATA Local] [YATA Global] │
400
+ │ │ │ │
401
+ │ 1. KGPR作成 │ │
402
+ │ (プライバシーフィルタ適用) │ │
403
+ │ │ │ │
404
+ │ ▼ │ │
405
+ │ 2. 差分計算 │ │
406
+ │ (エンティティ・関係性) │ │
407
+ │ │ │ │
408
+ │ └─── 3. KGPR送信 ────────►│ │
409
+ │ │ │
410
+ │ 4. レビュー │
411
+ │ (approve/reject) │
412
+ │ │ │
413
+ │ 5. マージ │
414
+ │ (コンフリクト解決) │
415
+ │ │ │
416
+ │ ◄───── 6. 結果通知 ───────┘ │
417
+ └─────────────────────────────────────────────────────────────┘
418
+ ```
419
+
420
+ ### KGPR REST API (HTTPサーバー)
421
+
422
+ YATA Global HTTPサーバーが提供するKGPR APIエンドポイント:
423
+
424
+ | メソッド | エンドポイント | 説明 |
425
+ |---------|---------------|------|
426
+ | GET | `/api/v1/kgprs` | KGPR一覧取得 |
427
+ | POST | `/api/v1/kgprs` | KGPR作成 |
428
+ | GET | `/api/v1/kgprs/:id` | KGPR詳細取得 |
429
+ | POST | `/api/v1/kgprs/:id/review` | KGPRレビュー |
430
+ | POST | `/api/v1/kgprs/:id/merge` | KGPRマージ |
431
+
432
+ ### KGPR作成(REST API)
433
+
434
+ ```bash
435
+ curl -X POST http://localhost:3000/api/v1/kgprs \
436
+ -H "Content-Type: application/json" \
437
+ -d '{
438
+ "title": "UserService パターンの追加",
439
+ "description": "ユーザー認証フローから学習したパターン",
440
+ "sourceNamespace": "app.services",
441
+ "labels": ["pattern", "authentication"],
442
+ "diff": {
443
+ "entities": {
444
+ "added": [
445
+ {
446
+ "changeType": "add",
447
+ "localId": "entity-1",
448
+ "name": "UserService",
449
+ "entityType": "class",
450
+ "namespace": "app.services",
451
+ "description": "ユーザー管理サービス"
452
+ }
453
+ ],
454
+ "updated": [],
455
+ "deleted": []
456
+ },
457
+ "relationships": {
458
+ "added": [],
459
+ "updated": [],
460
+ "deleted": []
461
+ },
462
+ "stats": {
463
+ "entitiesAdded": 1,
464
+ "entitiesUpdated": 0,
465
+ "entitiesDeleted": 0,
466
+ "relationshipsAdded": 0,
467
+ "relationshipsUpdated": 0,
468
+ "relationshipsDeleted": 0,
469
+ "totalChanges": 1
470
+ }
471
+ }
472
+ }'
473
+ ```
474
+
475
+ レスポンス:
476
+ ```json
477
+ {
478
+ "success": true,
479
+ "kgpr": {
480
+ "id": "KGPR-abc123",
481
+ "title": "UserService パターンの追加",
482
+ "status": "pending_review"
483
+ }
484
+ }
485
+ ```
486
+
487
+ ### KGPRレビュー(REST API)
488
+
489
+ ```bash
490
+ # 承認
491
+ curl -X POST http://localhost:3000/api/v1/kgprs/KGPR-abc123/review \
492
+ -H "Content-Type: application/json" \
493
+ -d '{
494
+ "decision": "approve",
495
+ "comment": "LGTM! Great pattern."
496
+ }'
497
+
498
+ # 変更要求
499
+ curl -X POST http://localhost:3000/api/v1/kgprs/KGPR-abc123/review \
500
+ -H "Content-Type: application/json" \
501
+ -d '{
502
+ "decision": "changes_requested",
503
+ "comment": "Please add more documentation."
504
+ }'
505
+ ```
506
+
507
+ ### KGPRマージ(REST API)
508
+
509
+ ```bash
510
+ curl -X POST http://localhost:3000/api/v1/kgprs/KGPR-abc123/merge \
511
+ -H "Content-Type: application/json" \
512
+ -d '{
513
+ "conflictStrategy": "skip_conflicts"
514
+ }'
515
+ ```
516
+
517
+ レスポンス:
518
+ ```json
519
+ {
520
+ "success": true,
521
+ "mergeResult": {
522
+ "merged": true,
523
+ "entitiesMerged": 1,
524
+ "relationshipsMerged": 0,
525
+ "conflicts": [],
526
+ "message": "KGPR merged successfully"
527
+ }
528
+ }
529
+ ```
530
+
531
+ ### マージエンジン
532
+
533
+ ```typescript
534
+ import { createMergeEngine } from '@nahisaho/yata-global';
535
+
536
+ const mergeEngine = createMergeEngine();
537
+
538
+ // コンフリクト検出
539
+ const conflicts = await mergeEngine.detectConflicts(kgpr, globalState);
540
+
541
+ for (const conflict of conflicts) {
542
+ console.log(`Conflict: ${conflict.type}`);
543
+ console.log(` Item: ${conflict.name} in ${conflict.namespace}`);
544
+ console.log(` Severity: ${conflict.severity}`);
545
+ console.log(` Suggestion: ${conflict.suggestedResolution}`);
546
+ }
547
+
548
+ // マージ実行
549
+ const mergeResult = await mergeEngine.merge(kgpr, {
550
+ conflictStrategy: 'skip_conflicts', // 'fail' | 'skip_conflicts' | 'force'
551
+ dryRun: false,
552
+ mergerId: 'user-123',
553
+ mergerName: 'Developer',
554
+ });
555
+
556
+ console.log(`Merged: ${mergeResult.merged}`);
557
+ console.log(`Entities merged: ${mergeResult.entitiesMerged}`);
558
+ console.log(`Relationships merged: ${mergeResult.relationshipsMerged}`);
559
+ ```
560
+
561
+ ### コンフリクトタイプ
562
+
563
+ ```typescript
564
+ type ConflictType =
565
+ | 'entity_exists' // 同名エンティティが既に存在
566
+ | 'entity_modified' // KGPR作成後にエンティティが変更された
567
+ | 'entity_deleted' // KGPR作成後にエンティティが削除された
568
+ | 'relationship_exists' // 関係性が既に存在
569
+ | 'relationship_broken' // ソース/ターゲットエンティティが存在しない
570
+ | 'circular_dependency' // 循環依存が発生する
571
+ | 'schema_violation'; // グローバルKGスキーマ違反
572
+
573
+ type ConflictSeverity = 'error' | 'warning' | 'info';
574
+
575
+ type ConflictResolution =
576
+ | 'use_local' // ローカル(KGPR)の値を使用
577
+ | 'use_global' // グローバルの値を保持
578
+ | 'merge' // 両方の値をマージ
579
+ | 'skip' // この変更をスキップ
580
+ | 'rename'; // リネームしてコンフリクト回避
581
+ ```
582
+
583
+ ---
584
+
585
+ ## 🐳 Docker環境
586
+
587
+ ### Docker Compose での起動
588
+
589
+ ```bash
590
+ cd docker
591
+ docker compose up -d
592
+ ```
593
+
594
+ ### 構成
595
+
596
+ ```
597
+ ┌─────────────────────────────────────────────────────────────┐
598
+ │ Docker Network │
599
+ │ ┌──────────────────┐ ┌──────────────────────────────┐ │
600
+ │ │ yata-global │ │ musubix-dev │ │
601
+ │ │ (Port 3000) │◄───│ (Development Environment) │ │
602
+ │ │ │ │ │ │
603
+ │ │ - HTTP API │ │ - MUSUBIX CLI │ │
604
+ │ │ - KGPR Server │ │ - YATA Local │ │
605
+ │ │ - Pattern Store │ │ - Project Workspace │ │
606
+ │ └──────────────────┘ └──────────────────────────────┘ │
607
+ └─────────────────────────────────────────────────────────────┘
608
+ ```
609
+
610
+ ### ヘルスチェック
611
+
612
+ ```bash
613
+ curl http://localhost:3000/health
614
+ # {"status":"healthy","timestamp":"...","version":"1.0.0"}
615
+ ```
616
+
617
+ ### E2Eテスト
618
+
619
+ ```bash
620
+ cd docker
621
+ ./test-kgpr-flow.sh
622
+ ```
623
+
624
+ ---
625
+
626
+ ## 🔧 HTTPサーバー
627
+
628
+ YATA Global HTTPサーバーはスタンドアロンで起動できます。
629
+
630
+ ### サーバーの起動
631
+
632
+ ```bash
633
+ # npm経由
634
+ npx yata-global-server
635
+
636
+ # または直接
637
+ node packages/yata-global/dist/bin/yata-global-server.js
638
+ ```
639
+
640
+ ### 環境変数
641
+
642
+ | 変数 | デフォルト | 説明 |
643
+ |------|-----------|------|
644
+ | `PORT` | 3000 | リッスンポート |
645
+ | `HOST` | 0.0.0.0 | リッスンホスト |
646
+
647
+ ### APIエンドポイント一覧
648
+
649
+ | メソッド | パス | 説明 |
650
+ |---------|------|------|
651
+ | GET | `/health` | ヘルスチェック |
652
+ | POST | `/auth/login` | ログイン |
653
+ | POST | `/auth/logout` | ログアウト |
654
+ | GET | `/api/v1/kgprs` | KGPR一覧 |
655
+ | POST | `/api/v1/kgprs` | KGPR作成 |
656
+ | GET | `/api/v1/kgprs/:id` | KGPR詳細 |
657
+ | POST | `/api/v1/kgprs/:id/review` | レビュー |
658
+ | POST | `/api/v1/kgprs/:id/merge` | マージ |
659
+ | GET | `/api/v1/patterns` | パターン一覧 |
660
+ | POST | `/api/v1/patterns` | パターン作成 |
661
+ | GET | `/api/v1/patterns/:id` | パターン詳細 |
662
+ | GET | `/api/v1/frameworks` | フレームワーク一覧 |
663
+ | GET | `/api/v1/frameworks/:id` | フレームワーク詳細 |
664
+
665
+ ---
666
+
667
+ ## 📱 イベント
668
+
669
+ YataGlobalは以下のイベントを発行します:
670
+
671
+ ```typescript
672
+ // 認証イベント
673
+ yataGlobal.on('auth:login', (user) => {
674
+ console.log('User logged in:', user.username);
675
+ });
676
+
677
+ yataGlobal.on('auth:logout', () => {
678
+ console.log('User logged out');
679
+ });
680
+
681
+ // 同期イベント
682
+ yataGlobal.on('sync:start', () => {
683
+ console.log('Sync started');
684
+ });
685
+
686
+ yataGlobal.on('sync:complete', (result) => {
687
+ console.log('Sync completed:', result);
688
+ });
689
+
690
+ yataGlobal.on('sync:error', (error) => {
691
+ console.error('Sync error:', error);
692
+ });
693
+
694
+ // 接続イベント
695
+ yataGlobal.on('connection:online', () => {
696
+ console.log('Online');
697
+ });
698
+
699
+ yataGlobal.on('connection:offline', () => {
700
+ console.log('Offline');
701
+ });
702
+ ```
703
+
704
+ ---
705
+
706
+ ## 🔒 プライバシーフィルター
707
+
708
+ KGPRを作成する際、プライバシーフィルターが適用されます。
709
+
710
+ ### プライバシーレベル
711
+
712
+ | レベル | 説明 |
713
+ |--------|------|
714
+ | `strict` | ファイルパス、行番号、機密メタデータを完全除去 |
715
+ | `moderate` | ファイルパスを相対化、行番号保持、機密メタデータ除去 |
716
+ | `none` | フィルタリングなし |
717
+
718
+ ### 機密情報の検出
719
+
720
+ 自動的にフィルタリングされる情報:
721
+ - API キー
722
+ - パスワード
723
+ - トークン
724
+ - 個人情報(メールアドレス等)
725
+ - 内部パス情報
726
+
727
+ ---
728
+
729
+ ## 📚 関連ドキュメント
730
+
731
+ - [YATA Local ユーザーガイド](./YATA-LOCAL-GUIDE.ja.md)
732
+ - [Docker環境 README](../docker/README.md)
733
+ - [API リファレンス](./API-REFERENCE.md)
734
+ - [MUSUBIX ユーザーガイド](./USER-GUIDE.ja.md)
735
+
736
+ ---
737
+
738
+ ## 📝 バージョン履歴
739
+
740
+ | バージョン | 主な変更 |
741
+ |-----------|---------|
742
+ | v2.4.1 | HTTPサーバー追加、Docker対応 |
743
+ | v1.7.0 | MergeEngine強化、コンフリクト解決 |
744
+ | v1.6.5 | KGPR、プライバシーフィルター追加 |
745
+ | v1.0.0 | 初期リリース |
746
+
747
+ ---
748
+
749
+ **最終更新**: 2026-01-11
750
+ **パッケージ**: `@nahisaho/yata-global`