musubix 1.6.0 → 1.8.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.
- package/AGENTS.md +46 -9
- package/README.ja.md +8 -3
- package/README.md +11 -4
- package/docs/API-REFERENCE.md +444 -2
- package/docs/INSTALL-GUIDE.ja.md +2 -2
- package/docs/INSTALL-GUIDE.md +2 -2
- package/docs/MUSUBIv1.6.1-enhancement_roadmap_20260105.md +291 -0
- package/docs/USER-GUIDE.ja.md +598 -6
- package/docs/USER-GUIDE.md +598 -6
- package/docs/evolution-from-musubi-to-musubix.md +418 -4
- package/docs/getting-started-with-sdd.md +1 -1
- package/docs/overview/MUSUBIX-Core.md +671 -0
- package/docs/overview/MUSUBIX-FormalVerify.md +566 -0
- package/docs/overview/MUSUBIX-Learning.md +837 -0
- package/docs/overview/MUSUBIX-MCP-Server.md +535 -0
- package/docs/overview/MUSUBIX-Overview.md +264 -0
- package/docs/overview/MUSUBIX-Roadmap-v2.md +399 -0
- package/docs/overview/MUSUBIX-Security-Plan.md +939 -0
- package/docs/overview/MUSUBIX-YATA.md +666 -0
- package/docs/overview/Neuro-SymbolicAI.md +159 -0
- package/package.json +5 -3
package/AGENTS.md
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
| 項目 | 詳細 |
|
|
10
10
|
|------|------|
|
|
11
|
-
| **バージョン** | 1.
|
|
11
|
+
| **バージョン** | 1.8.0 (Security Analysis Edition) |
|
|
12
12
|
| **言語** | TypeScript |
|
|
13
13
|
| **ランタイム** | Node.js >= 20.0.0 |
|
|
14
14
|
| **パッケージマネージャ** | npm >= 10.0.0 |
|
|
15
15
|
| **ビルドシステム** | モノレポ(npm workspaces) |
|
|
16
16
|
| **テストフレームワーク** | Vitest |
|
|
17
|
-
| **テスト数** |
|
|
17
|
+
| **テスト数** | 1586 (全合格) |
|
|
18
18
|
| **コンポーネント数** | 249 (62ドメイン対応) |
|
|
19
19
|
| **Agent Skills** | 12 (Claude Code対応) |
|
|
20
20
|
|
|
@@ -28,18 +28,28 @@
|
|
|
28
28
|
packages/
|
|
29
29
|
├── core/ # @nahisaho/musubix-core
|
|
30
30
|
├── mcp-server/ # @nahisaho/musubix-mcp-server
|
|
31
|
+
├── security/ # @nahisaho/musubix-security (NEW!)
|
|
32
|
+
├── formal-verify/ # @nahisaho/musubix-formal-verify
|
|
31
33
|
├── yata-client/ # @nahisaho/musubix-yata-client
|
|
32
|
-
├──
|
|
33
|
-
├──
|
|
34
|
-
├──
|
|
35
|
-
|
|
34
|
+
├── yata-local/ # @nahisaho/yata-local
|
|
35
|
+
├── yata-global/ # @nahisaho/yata-global
|
|
36
|
+
├── yata-ui/ # @nahisaho/yata-ui
|
|
37
|
+
├── pattern-mcp/ # @nahisaho/musubix-pattern-mcp
|
|
38
|
+
├── ontology-mcp/ # @nahisaho/musubix-ontology-mcp
|
|
39
|
+
├── wake-sleep/ # @nahisaho/musubix-wake-sleep
|
|
40
|
+
└── sdd-ontology/ # @nahisaho/musubix-sdd-ontology
|
|
36
41
|
```
|
|
37
42
|
|
|
38
43
|
| パッケージ | npm | 役割 |
|
|
39
44
|
|-----------|-----|------|
|
|
40
45
|
| `packages/core/` | `@nahisaho/musubix-core` | コアライブラリ - CLI、EARS検証、コード生成、設計パターン |
|
|
41
46
|
| `packages/mcp-server/` | `@nahisaho/musubix-mcp-server` | MCPサーバー - 19ツール、3プロンプト |
|
|
47
|
+
| `packages/security/` | `@nahisaho/musubix-security` | **セキュリティ分析** - 脆弱性検出、シークレット検出、テイント解析 (NEW!) |
|
|
48
|
+
| `packages/formal-verify/` | `@nahisaho/musubix-formal-verify` | 形式検証 - Z3統合、Hoare検証、EARS→SMT変換 |
|
|
42
49
|
| `packages/yata-client/` | `@nahisaho/musubix-yata-client` | YATAクライアント - 知識グラフ連携 |
|
|
50
|
+
| `packages/yata-local/` | `@nahisaho/yata-local` | **YATA Local** - SQLiteベースローカル知識グラフ |
|
|
51
|
+
| `packages/yata-global/` | `@nahisaho/yata-global` | **YATA Global** - 分散型知識グラフプラットフォーム |
|
|
52
|
+
| `packages/yata-ui/` | `@nahisaho/yata-ui` | **YATA UI** - Web可視化・管理インターフェース |
|
|
43
53
|
| `packages/pattern-mcp/` | `@nahisaho/musubix-pattern-mcp` | パターン学習 - 抽出・圧縮・ライブラリ |
|
|
44
54
|
| `packages/ontology-mcp/` | `@nahisaho/musubix-ontology-mcp` | オントロジー - N3Store・推論エンジン |
|
|
45
55
|
| `packages/wake-sleep/` | `@nahisaho/musubix-wake-sleep` | Wake-Sleep学習サイクル |
|
|
@@ -96,8 +106,11 @@ npx musubix test coverage <dir> # カバレッジ測定
|
|
|
96
106
|
|
|
97
107
|
# トレーサビリティ
|
|
98
108
|
npx musubix trace matrix # トレーサビリティマトリクス
|
|
109
|
+
npx musubix trace matrix -p <project> # 指定プロジェクトのマトリクス
|
|
99
110
|
npx musubix trace impact <id> # 影響分析
|
|
100
111
|
npx musubix trace validate # リンク検証
|
|
112
|
+
npx musubix trace sync # トレースマトリクス自動更新 (v1.6.7 NEW!)
|
|
113
|
+
npx musubix trace sync --dry-run # プレビューのみ
|
|
101
114
|
|
|
102
115
|
# 説明生成
|
|
103
116
|
npx musubix explain why <id> # 決定理由の説明
|
|
@@ -126,6 +139,21 @@ npx musubix repl # 対話的シェルを起動
|
|
|
126
139
|
npx musubix repl --history <file> # カスタム履歴ファイル
|
|
127
140
|
npx musubix repl --no-color # 色なしモード
|
|
128
141
|
|
|
142
|
+
# KGPR - Knowledge Graph Pull Request (v1.6.4 NEW!)
|
|
143
|
+
npx musubix kgpr create -t "title" # KGPR作成
|
|
144
|
+
npx musubix kgpr diff # 差分プレビュー
|
|
145
|
+
npx musubix kgpr list # KGPR一覧
|
|
146
|
+
npx musubix kgpr submit <id> # KGPR送信
|
|
147
|
+
npx musubix kgpr show <id> # KGPR詳細表示
|
|
148
|
+
npx musubix kgpr close <id> # KGPRクローズ
|
|
149
|
+
# オプション: --namespace <ns>, --entity-types <types>, --privacy <strict|moderate|none>
|
|
150
|
+
|
|
151
|
+
# SDDプロジェクトスキャフォールド (v1.6.7 NEW!)
|
|
152
|
+
npx musubix scaffold domain-model <name> # DDDプロジェクト生成
|
|
153
|
+
npx musubix scaffold domain-model <name> -e "Entity1,Entity2" # エンティティ指定
|
|
154
|
+
npx musubix scaffold domain-model <name> -d DOMAIN # ドメイン接頭辞指定
|
|
155
|
+
npx musubix scaffold minimal <name> # 最小構成プロジェクト
|
|
156
|
+
|
|
129
157
|
# ヘルプ
|
|
130
158
|
npx musubix --help
|
|
131
159
|
npx musubix help <command>
|
|
@@ -142,7 +170,7 @@ npx @nahisaho/musubix-mcp-server
|
|
|
142
170
|
npx musubix-mcp --transport stdio
|
|
143
171
|
```
|
|
144
172
|
|
|
145
|
-
### ツール一覧(
|
|
173
|
+
### ツール一覧(24ツール)
|
|
146
174
|
|
|
147
175
|
#### SDD基本ツール(9ツール)
|
|
148
176
|
|
|
@@ -178,6 +206,16 @@ npx musubix-mcp --transport stdio
|
|
|
178
206
|
| `validate_triple` | 単一トリプルの事前検証 |
|
|
179
207
|
| `check_circular` | 循環依存の検出 |
|
|
180
208
|
|
|
209
|
+
#### KGPRツール(5ツール)- v1.6.4 NEW!
|
|
210
|
+
|
|
211
|
+
| ツール名 | 説明 |
|
|
212
|
+
|---------|------|
|
|
213
|
+
| `kgpr_create` | KGPR作成(ローカルKGからドラフト作成) |
|
|
214
|
+
| `kgpr_diff` | 差分プレビュー |
|
|
215
|
+
| `kgpr_list` | KGPR一覧表示 |
|
|
216
|
+
| `kgpr_submit` | KGPR送信(レビュー用) |
|
|
217
|
+
| `kgpr_review` | KGPRレビュー(approve/changes_requested/commented) |
|
|
218
|
+
|
|
181
219
|
### プロンプト一覧(3プロンプト)
|
|
182
220
|
|
|
183
221
|
| プロンプト名 | 説明 |
|
|
@@ -488,5 +526,4 @@ npx musubix learn best-practices --format markdown
|
|
|
488
526
|
|
|
489
527
|
**Agent**: GitHub Copilot / Claude
|
|
490
528
|
**Last Updated**: 2026-01-06
|
|
491
|
-
**Version**: 1.
|
|
492
|
-
**Repository**: https://github.com/nahisaho/MUSUBIX
|
|
529
|
+
**Version**: 1.6.4
|
package/README.ja.md
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
[](https://nodejs.org/)
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
[](https://www.typescriptlang.org/)
|
|
9
|
-
[](https://github.com/nahisaho/MUSUBIX)
|
|
10
10
|
|
|
11
11
|
> MUSUBI × YATA 統合による次世代AIコーディングシステム
|
|
12
12
|
>
|
|
13
|
-
> **v1.
|
|
13
|
+
> **v1.7.5** - 形式検証エディション
|
|
14
14
|
|
|
15
15
|
## 概要
|
|
16
16
|
|
|
@@ -32,6 +32,11 @@ MUSUBIXは、**ニューラル(LLM)** と **シンボリック(知識グ
|
|
|
32
32
|
- ⚙️ **品質ゲート** - フェーズ移行前の自動品質検証
|
|
33
33
|
- 🔮 **高度推論** - OWL 2 RL推論とDatalog評価 *(v1.4.5)*
|
|
34
34
|
- 🖥️ **対話的REPL** - コマンド補完、履歴管理、セッション変数 *(v1.6.0)*
|
|
35
|
+
- 🗄️ **YATA Local** - SQLiteベースローカル知識グラフ (BFS/DFS、推論) *(v1.6.3)*
|
|
36
|
+
- 🌐 **YATA Global** - オフライン同期対応分散型知識プラットフォーム *(v1.6.3)*
|
|
37
|
+
- 📤 **KGPR** - 安全な知識共有のためのKnowledge Graph Pull Request *(v1.6.4)*
|
|
38
|
+
- 🚀 **YATAプラットフォーム拡張** - インデックス最適化、拡張エクスポート、グローバル同期、コード生成、Web UI *(v1.7.0)*
|
|
39
|
+
- 🔬 **形式検証** - Z3 SMTソルバー統合、Hoareトリプル検証、EARS→SMT変換 *(v1.7.5)*
|
|
35
40
|
|
|
36
41
|
## アーキテクチャ
|
|
37
42
|
|
|
@@ -75,7 +80,7 @@ flowchart TB
|
|
|
75
80
|
| `packages/core/types/` | 型定義 |
|
|
76
81
|
| `packages/core/utils/` | ユーティリティ |
|
|
77
82
|
| `packages/core/validators/` | EARS検証 |
|
|
78
|
-
| `packages/mcp-server/` | MCPサーバー(
|
|
83
|
+
| `packages/mcp-server/` | MCPサーバー(24 tools, 3 prompts) |
|
|
79
84
|
| `packages/yata-client/` | YATA クライアント |
|
|
80
85
|
| `packages/pattern-mcp/` | **パターン学習(NEW!)** |
|
|
81
86
|
| `packages/ontology-mcp/` | **オントロジーエンジン(NEW!)** |
|
package/README.md
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
[](https://www.typescriptlang.org/)
|
|
10
|
-
[](https://github.com/nahisaho/MUSUBIX)
|
|
11
11
|
|
|
12
12
|
> Next-generation AI Coding System powered by MUSUBI × YATA Integration
|
|
13
13
|
>
|
|
14
|
-
> **v1.
|
|
14
|
+
> **v1.7.5** - Formal Verification Edition
|
|
15
15
|
|
|
16
16
|
**[日本語版 README](README.ja.md)**
|
|
17
17
|
|
|
@@ -35,6 +35,11 @@ MUSUBIX is an innovative AI coding system that integrates **Neural (LLM)** and *
|
|
|
35
35
|
- ⚙️ **Quality Gates** - Automated quality validation before phase transitions
|
|
36
36
|
- 🔮 **Advanced Inference** - OWL 2 RL reasoning and Datalog evaluation *(v1.4.5)*
|
|
37
37
|
- 🖥️ **Interactive REPL** - Command completion, history, session variables *(v1.6.0)*
|
|
38
|
+
- 🗄️ **YATA Local** - SQLite-based local knowledge graph (BFS/DFS, reasoning) *(v1.6.3)*
|
|
39
|
+
- 🌐 **YATA Global** - Distributed knowledge platform with offline sync *(v1.6.3)*
|
|
40
|
+
- 📤 **KGPR** - Knowledge Graph Pull Request for safe knowledge sharing *(v1.6.4)*
|
|
41
|
+
- 🚀 **YATA Platform Enhancements** - Index optimization, enhanced export, global sync, code generation, web UI *(v1.7.0)*
|
|
42
|
+
- 🔬 **Formal Verification** - Z3 SMT solver integration, Hoare triple verification, EARS-to-SMT conversion *(v1.7.5)*
|
|
38
43
|
|
|
39
44
|
## Architecture
|
|
40
45
|
|
|
@@ -78,12 +83,14 @@ flowchart TB
|
|
|
78
83
|
| `packages/core/types/` | Type Definitions |
|
|
79
84
|
| `packages/core/utils/` | Utilities |
|
|
80
85
|
| `packages/core/validators/` | EARS Validation |
|
|
81
|
-
| `packages/mcp-server/` | MCP Server (
|
|
86
|
+
| `packages/mcp-server/` | MCP Server (24 tools, 3 prompts) |
|
|
82
87
|
| `packages/yata-client/` | YATA Client |
|
|
83
88
|
| `packages/pattern-mcp/` | **Pattern Learning (NEW!)** |
|
|
84
89
|
| `packages/ontology-mcp/` | **Ontology Engine (NEW!)** |
|
|
85
90
|
| `packages/wake-sleep/` | **Wake-Sleep Learning (NEW!)** |
|
|
86
91
|
| `packages/sdd-ontology/` | **SDD Ontology (NEW!)** |
|
|
92
|
+
| `packages/yata-local/` | **YATA Local - SQLite Knowledge Graph (NEW!)** |
|
|
93
|
+
| `packages/yata-global/` | **YATA Global - Distributed Knowledge Platform (NEW!)** |
|
|
87
94
|
| `steering/` | Project Memory |
|
|
88
95
|
| `storage/` | Specifications & Artifacts |
|
|
89
96
|
| `templates/` | Templates |
|
|
@@ -171,7 +178,7 @@ npm run type-check
|
|
|
171
178
|
|
|
172
179
|
### MCP Server
|
|
173
180
|
|
|
174
|
-
Provides
|
|
181
|
+
Provides 24 tools (9 SDD + 7 Pattern + 3 Ontology + 5 KGPR) and 3 prompts:
|
|
175
182
|
|
|
176
183
|
```bash
|
|
177
184
|
# Start MCP Server
|
package/docs/API-REFERENCE.md
CHANGED
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
- [Symbolic](#symbolic)
|
|
15
15
|
- [Inference](#inference) *(v1.4.5)*
|
|
16
16
|
- [REPL](#repl) *(v1.5.0)*
|
|
17
|
+
- [YATA Local](#yata-local) *(v1.6.3)*
|
|
18
|
+
- [YATA Global](#yata-global) *(v1.6.3)*
|
|
19
|
+
- [KGPR](#kgpr) *(v1.6.4)*
|
|
20
|
+
- [YATA Platform](#yata-platform) *(v1.7.0)*
|
|
21
|
+
- [Formal Verification](#formal-verification) *(v1.7.5)*
|
|
17
22
|
- [Validation](#validation)
|
|
18
23
|
- [Utils](#utils)
|
|
19
24
|
- [MCP Server](#mcp-server)
|
|
@@ -681,6 +686,443 @@ await reasoner.reason(store, { progressReporter: reporter });
|
|
|
681
686
|
|
|
682
687
|
---
|
|
683
688
|
|
|
689
|
+
### YATA Platform (v1.7.0)
|
|
690
|
+
|
|
691
|
+
Version 1.7.0 introduces enhanced YATA platform APIs.
|
|
692
|
+
|
|
693
|
+
#### IndexOptimizer
|
|
694
|
+
|
|
695
|
+
Optimizes database indexes for improved query performance.
|
|
696
|
+
|
|
697
|
+
```typescript
|
|
698
|
+
import { IndexOptimizer } from '@nahisaho/yata-local';
|
|
699
|
+
|
|
700
|
+
const optimizer = new IndexOptimizer(database);
|
|
701
|
+
|
|
702
|
+
// Analyze query patterns
|
|
703
|
+
const analysis = await optimizer.analyzeQueryPatterns();
|
|
704
|
+
|
|
705
|
+
// Create optimal indexes
|
|
706
|
+
const created = await optimizer.createOptimalIndexes();
|
|
707
|
+
|
|
708
|
+
// Check index health
|
|
709
|
+
const health = await optimizer.checkIndexHealth();
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
**Methods:**
|
|
713
|
+
|
|
714
|
+
| Method | Parameters | Returns | Description |
|
|
715
|
+
|--------|------------|---------|-------------|
|
|
716
|
+
| `analyzeQueryPatterns()` | - | `QueryAnalysis` | Analyze query patterns |
|
|
717
|
+
| `createOptimalIndexes()` | - | `IndexCreationResult` | Create composite indexes |
|
|
718
|
+
| `checkIndexHealth()` | - | `IndexHealthReport` | Check fragmentation |
|
|
719
|
+
| `rebuildIndex(name)` | `name: string` | `void` | Rebuild specific index |
|
|
720
|
+
|
|
721
|
+
---
|
|
722
|
+
|
|
723
|
+
#### ExportPipeline
|
|
724
|
+
|
|
725
|
+
Exports knowledge graph data with transformation support.
|
|
726
|
+
|
|
727
|
+
```typescript
|
|
728
|
+
import { ExportPipeline } from '@nahisaho/yata-local';
|
|
729
|
+
|
|
730
|
+
const pipeline = new ExportPipeline(database);
|
|
731
|
+
|
|
732
|
+
// Full export
|
|
733
|
+
const data = await pipeline.exportFull({ namespace: 'myproject' });
|
|
734
|
+
|
|
735
|
+
// Incremental export
|
|
736
|
+
const changes = await pipeline.exportIncremental({
|
|
737
|
+
since: lastExportTime,
|
|
738
|
+
format: 'json'
|
|
739
|
+
});
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
**Methods:**
|
|
743
|
+
|
|
744
|
+
| Method | Parameters | Returns | Description |
|
|
745
|
+
|--------|------------|---------|-------------|
|
|
746
|
+
| `exportFull(options)` | `ExportOptions` | `ExportData` | Full data export |
|
|
747
|
+
| `exportIncremental(options)` | `IncrementalOptions` | `ExportData` | Export changes since timestamp |
|
|
748
|
+
| `exportWithTransform(options)` | `TransformOptions` | `ExportData` | Export with format transformation |
|
|
749
|
+
|
|
750
|
+
**Export Formats:**
|
|
751
|
+
|
|
752
|
+
| Format | Description |
|
|
753
|
+
|--------|-------------|
|
|
754
|
+
| `json` | JSON format (default) |
|
|
755
|
+
| `rdf` | RDF/Turtle format |
|
|
756
|
+
| `ntriples` | N-Triples format |
|
|
757
|
+
|
|
758
|
+
---
|
|
759
|
+
|
|
760
|
+
#### GlobalSyncClient
|
|
761
|
+
|
|
762
|
+
Synchronizes local knowledge graph with YATA Global.
|
|
763
|
+
|
|
764
|
+
```typescript
|
|
765
|
+
import { GlobalSyncClient } from '@nahisaho/yata-global';
|
|
766
|
+
|
|
767
|
+
const client = new GlobalSyncClient({
|
|
768
|
+
endpoint: 'https://yata-global.example.com',
|
|
769
|
+
offlineMode: true
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
await client.initialize();
|
|
773
|
+
|
|
774
|
+
const result = await client.sync({
|
|
775
|
+
namespace: 'myproject',
|
|
776
|
+
direction: 'push'
|
|
777
|
+
});
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
**Methods:**
|
|
781
|
+
|
|
782
|
+
| Method | Parameters | Returns | Description |
|
|
783
|
+
|--------|------------|---------|-------------|
|
|
784
|
+
| `initialize()` | - | `Promise<void>` | Initialize client |
|
|
785
|
+
| `sync(options)` | `SyncOptions` | `SyncResult` | Synchronize data |
|
|
786
|
+
| `getStatus()` | - | `SyncStatus` | Get sync status |
|
|
787
|
+
| `resolveConflict(id, resolution)` | `id: string, resolution: Resolution` | `void` | Resolve conflict |
|
|
788
|
+
|
|
789
|
+
---
|
|
790
|
+
|
|
791
|
+
#### SyncEngine
|
|
792
|
+
|
|
793
|
+
Core synchronization engine with conflict resolution.
|
|
794
|
+
|
|
795
|
+
```typescript
|
|
796
|
+
import { SyncEngine } from '@nahisaho/yata-global';
|
|
797
|
+
|
|
798
|
+
const engine = new SyncEngine({
|
|
799
|
+
conflictStrategy: 'server-wins',
|
|
800
|
+
batchSize: 100
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
const result = await engine.sync(localData, remoteData);
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
**Conflict Strategies:**
|
|
807
|
+
|
|
808
|
+
| Strategy | Description |
|
|
809
|
+
|----------|-------------|
|
|
810
|
+
| `server-wins` | Server data takes precedence |
|
|
811
|
+
| `client-wins` | Client data takes precedence |
|
|
812
|
+
| `merge` | Attempt automatic merge |
|
|
813
|
+
| `manual` | Require manual resolution |
|
|
814
|
+
|
|
815
|
+
---
|
|
816
|
+
|
|
817
|
+
#### CacheManager
|
|
818
|
+
|
|
819
|
+
Manages local caching for offline support.
|
|
820
|
+
|
|
821
|
+
```typescript
|
|
822
|
+
import { CacheManager } from '@nahisaho/yata-global';
|
|
823
|
+
|
|
824
|
+
const cache = new CacheManager({
|
|
825
|
+
maxSize: 100 * 1024 * 1024, // 100MB
|
|
826
|
+
ttl: 24 * 60 * 60 * 1000 // 24 hours
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
await cache.set('key', data);
|
|
830
|
+
const cached = await cache.get('key');
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
**Methods:**
|
|
834
|
+
|
|
835
|
+
| Method | Parameters | Returns | Description |
|
|
836
|
+
|--------|------------|---------|-------------|
|
|
837
|
+
| `get(key)` | `key: string` | `T \| undefined` | Get cached item |
|
|
838
|
+
| `set(key, value)` | `key: string, value: T` | `void` | Cache item |
|
|
839
|
+
| `has(key)` | `key: string` | `boolean` | Check if exists |
|
|
840
|
+
| `clearAll()` | - | `void` | Clear all cache |
|
|
841
|
+
| `getStats()` | - | `CacheStats` | Get cache statistics |
|
|
842
|
+
|
|
843
|
+
---
|
|
844
|
+
|
|
845
|
+
#### YataUIServer
|
|
846
|
+
|
|
847
|
+
Web-based visualization server for knowledge graphs.
|
|
848
|
+
|
|
849
|
+
```typescript
|
|
850
|
+
import { YataUIServer, createYataUIServer } from '@nahisaho/yata-ui';
|
|
851
|
+
|
|
852
|
+
const server = createYataUIServer({
|
|
853
|
+
port: 3000,
|
|
854
|
+
host: 'localhost',
|
|
855
|
+
cors: true,
|
|
856
|
+
enableRealtime: true
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
server.setDataProvider(async () => ({
|
|
860
|
+
nodes: await getEntities(),
|
|
861
|
+
edges: await getRelationships()
|
|
862
|
+
}));
|
|
863
|
+
|
|
864
|
+
await server.start();
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
**Methods:**
|
|
868
|
+
|
|
869
|
+
| Method | Parameters | Returns | Description |
|
|
870
|
+
|--------|------------|---------|-------------|
|
|
871
|
+
| `start()` | - | `Promise<void>` | Start server |
|
|
872
|
+
| `stop()` | - | `Promise<void>` | Stop server |
|
|
873
|
+
| `isRunning()` | - | `boolean` | Check if running |
|
|
874
|
+
| `getUrl()` | - | `string` | Get server URL |
|
|
875
|
+
| `setDataProvider(fn)` | `DataProvider` | `void` | Set data provider |
|
|
876
|
+
| `broadcastUpdate(event, data)` | `event: string, data: any` | `void` | Broadcast to clients |
|
|
877
|
+
|
|
878
|
+
**Configuration:**
|
|
879
|
+
|
|
880
|
+
| Option | Type | Default | Description |
|
|
881
|
+
|--------|------|---------|-------------|
|
|
882
|
+
| `port` | `number` | `3000` | Server port |
|
|
883
|
+
| `host` | `string` | `localhost` | Server host |
|
|
884
|
+
| `cors` | `boolean` | `true` | Enable CORS |
|
|
885
|
+
| `enableRealtime` | `boolean` | `true` | Enable WebSocket |
|
|
886
|
+
|
|
887
|
+
---
|
|
888
|
+
|
|
889
|
+
### Formal Verification (v1.7.5)
|
|
890
|
+
|
|
891
|
+
The formal verification module provides Z3 SMT solver integration for verifying code correctness.
|
|
892
|
+
|
|
893
|
+
#### Z3Adapter
|
|
894
|
+
|
|
895
|
+
Unified interface for Z3 backends (WASM or Process).
|
|
896
|
+
|
|
897
|
+
```typescript
|
|
898
|
+
import { Z3Adapter } from '@nahisaho/musubix-formal-verify';
|
|
899
|
+
|
|
900
|
+
// Create adapter (auto-selects best backend)
|
|
901
|
+
const z3 = await Z3Adapter.create();
|
|
902
|
+
|
|
903
|
+
// Check satisfiability
|
|
904
|
+
const result = await z3.checkSat('(declare-const x Int) (assert (> x 0))');
|
|
905
|
+
console.log(result); // 'sat' | 'unsat' | 'unknown'
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
**Methods:**
|
|
909
|
+
|
|
910
|
+
| Method | Parameters | Returns | Description |
|
|
911
|
+
|--------|------------|---------|-------------|
|
|
912
|
+
| `create()` | - | `Promise<Z3Adapter>` | Create adapter instance |
|
|
913
|
+
| `checkSat(smtLib2)` | `smtLib2: string` | `Promise<string>` | Check satisfiability |
|
|
914
|
+
| `dispose()` | - | `Promise<void>` | Cleanup resources |
|
|
915
|
+
|
|
916
|
+
---
|
|
917
|
+
|
|
918
|
+
#### PreconditionVerifier
|
|
919
|
+
|
|
920
|
+
Verifies preconditions for functions and methods.
|
|
921
|
+
|
|
922
|
+
```typescript
|
|
923
|
+
import { PreconditionVerifier } from '@nahisaho/musubix-formal-verify';
|
|
924
|
+
|
|
925
|
+
const verifier = new PreconditionVerifier(z3Adapter);
|
|
926
|
+
|
|
927
|
+
const result = await verifier.verify({
|
|
928
|
+
condition: { expression: 'amount > 0 && balance >= amount', format: 'javascript' },
|
|
929
|
+
variables: [
|
|
930
|
+
{ name: 'amount', type: 'Int' },
|
|
931
|
+
{ name: 'balance', type: 'Int' }
|
|
932
|
+
]
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
console.log(result.status); // 'valid' | 'invalid' | 'unknown' | 'error'
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
**Methods:**
|
|
939
|
+
|
|
940
|
+
| Method | Parameters | Returns | Description |
|
|
941
|
+
|--------|------------|---------|-------------|
|
|
942
|
+
| `verify(spec)` | `PreconditionSpec` | `Promise<VerificationResult>` | Verify precondition |
|
|
943
|
+
|
|
944
|
+
**PreconditionSpec:**
|
|
945
|
+
|
|
946
|
+
| Property | Type | Description |
|
|
947
|
+
|----------|------|-------------|
|
|
948
|
+
| `condition` | `Condition` | The precondition to verify |
|
|
949
|
+
| `variables` | `Variable[]` | Variables with types |
|
|
950
|
+
|
|
951
|
+
**VerificationResult:**
|
|
952
|
+
|
|
953
|
+
| Property | Type | Description |
|
|
954
|
+
|----------|------|-------------|
|
|
955
|
+
| `status` | `'valid' \| 'invalid' \| 'unknown' \| 'error'` | Verification status |
|
|
956
|
+
| `counterexample?` | `Record<string, any>` | Counterexample if invalid |
|
|
957
|
+
| `message?` | `string` | Additional message |
|
|
958
|
+
|
|
959
|
+
---
|
|
960
|
+
|
|
961
|
+
#### PostconditionVerifier
|
|
962
|
+
|
|
963
|
+
Verifies Hoare triples {P} C {Q}.
|
|
964
|
+
|
|
965
|
+
```typescript
|
|
966
|
+
import { PostconditionVerifier } from '@nahisaho/musubix-formal-verify';
|
|
967
|
+
|
|
968
|
+
const verifier = new PostconditionVerifier(z3Adapter);
|
|
969
|
+
|
|
970
|
+
const result = await verifier.verify({
|
|
971
|
+
precondition: { expression: 'balance >= amount', format: 'javascript' },
|
|
972
|
+
postcondition: { expression: 'balance_new == balance - amount', format: 'javascript' },
|
|
973
|
+
preVariables: [
|
|
974
|
+
{ name: 'balance', type: 'Int' },
|
|
975
|
+
{ name: 'amount', type: 'Int' }
|
|
976
|
+
],
|
|
977
|
+
postVariables: [
|
|
978
|
+
{ name: 'balance_new', type: 'Int' }
|
|
979
|
+
],
|
|
980
|
+
transition: 'balance_new == balance - amount'
|
|
981
|
+
});
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
**PostconditionSpec:**
|
|
985
|
+
|
|
986
|
+
| Property | Type | Description |
|
|
987
|
+
|----------|------|-------------|
|
|
988
|
+
| `precondition` | `Condition` | Pre-state condition |
|
|
989
|
+
| `postcondition` | `Condition` | Post-state condition |
|
|
990
|
+
| `preVariables` | `Variable[]` | Pre-state variables |
|
|
991
|
+
| `postVariables` | `Variable[]` | Post-state variables |
|
|
992
|
+
| `transition` | `string` | State transition expression |
|
|
993
|
+
|
|
994
|
+
---
|
|
995
|
+
|
|
996
|
+
#### EarsToSmtConverter
|
|
997
|
+
|
|
998
|
+
Converts EARS requirements to SMT-LIB2 formulas.
|
|
999
|
+
|
|
1000
|
+
```typescript
|
|
1001
|
+
import { EarsToSmtConverter } from '@nahisaho/musubix-formal-verify';
|
|
1002
|
+
|
|
1003
|
+
const converter = new EarsToSmtConverter();
|
|
1004
|
+
|
|
1005
|
+
// Single conversion
|
|
1006
|
+
const result = converter.convert('THE system SHALL validate inputs');
|
|
1007
|
+
|
|
1008
|
+
// Multiple conversions
|
|
1009
|
+
const results = converter.convertMultiple([
|
|
1010
|
+
'THE system SHALL validate inputs', // ubiquitous
|
|
1011
|
+
'WHEN error, THE system SHALL notify user', // event-driven
|
|
1012
|
+
'WHILE busy, THE system SHALL queue requests', // state-driven
|
|
1013
|
+
'THE system SHALL NOT expose secrets', // unwanted
|
|
1014
|
+
'IF admin, THEN THE system SHALL allow edit' // optional
|
|
1015
|
+
]);
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
**Methods:**
|
|
1019
|
+
|
|
1020
|
+
| Method | Parameters | Returns | Description |
|
|
1021
|
+
|--------|------------|---------|-------------|
|
|
1022
|
+
| `convert(ears)` | `ears: string` | `ConversionResult` | Convert single requirement |
|
|
1023
|
+
| `convertMultiple(ears[])` | `ears: string[]` | `ConversionResult[]` | Convert multiple requirements |
|
|
1024
|
+
|
|
1025
|
+
**EARS Patterns:**
|
|
1026
|
+
|
|
1027
|
+
| Pattern | Syntax | SMT Encoding |
|
|
1028
|
+
|---------|--------|--------------|
|
|
1029
|
+
| Ubiquitous | `THE system SHALL [action]` | `(assert action)` |
|
|
1030
|
+
| Event-driven | `WHEN [event], THE system SHALL [response]` | `(assert (=> event response))` |
|
|
1031
|
+
| State-driven | `WHILE [state], THE system SHALL [response]` | `(assert (=> state response))` |
|
|
1032
|
+
| Unwanted | `THE system SHALL NOT [behavior]` | `(assert (not behavior))` |
|
|
1033
|
+
| Optional | `IF [condition], THEN THE system SHALL [response]` | `(assert (=> condition response))` |
|
|
1034
|
+
|
|
1035
|
+
---
|
|
1036
|
+
|
|
1037
|
+
#### TraceabilityDB
|
|
1038
|
+
|
|
1039
|
+
SQLite-based traceability database.
|
|
1040
|
+
|
|
1041
|
+
```typescript
|
|
1042
|
+
import { TraceabilityDB } from '@nahisaho/musubix-formal-verify';
|
|
1043
|
+
|
|
1044
|
+
const db = new TraceabilityDB('./trace.db');
|
|
1045
|
+
|
|
1046
|
+
// Add nodes
|
|
1047
|
+
await db.addNode({ id: 'REQ-001', type: 'requirement', title: 'User Auth' });
|
|
1048
|
+
await db.addNode({ id: 'DES-001', type: 'design', title: 'AuthService' });
|
|
1049
|
+
await db.addNode({ id: 'CODE-001', type: 'code', title: 'auth.ts' });
|
|
1050
|
+
|
|
1051
|
+
// Add links
|
|
1052
|
+
await db.addLink({ source: 'DES-001', target: 'REQ-001', type: 'satisfies' });
|
|
1053
|
+
await db.addLink({ source: 'CODE-001', target: 'DES-001', type: 'implements' });
|
|
1054
|
+
|
|
1055
|
+
// Query
|
|
1056
|
+
const node = await db.getNode('REQ-001');
|
|
1057
|
+
const stats = await db.getStatistics();
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
**Methods:**
|
|
1061
|
+
|
|
1062
|
+
| Method | Parameters | Returns | Description |
|
|
1063
|
+
|--------|------------|---------|-------------|
|
|
1064
|
+
| `addNode(node)` | `TraceNode` | `Promise<void>` | Add traceability node |
|
|
1065
|
+
| `getNode(id)` | `id: string` | `Promise<TraceNode \| undefined>` | Get node by ID |
|
|
1066
|
+
| `addLink(link)` | `TraceLink` | `Promise<void>` | Add traceability link |
|
|
1067
|
+
| `getStatistics()` | - | `Promise<TraceStats>` | Get database statistics |
|
|
1068
|
+
| `query(nodeId, options?)` | `nodeId: string, QueryOptions` | `Promise<QueryResult>` | Query related nodes |
|
|
1069
|
+
| `close()` | - | `void` | Close database |
|
|
1070
|
+
|
|
1071
|
+
**Node Types:**
|
|
1072
|
+
|
|
1073
|
+
| Type | Description |
|
|
1074
|
+
|------|-------------|
|
|
1075
|
+
| `requirement` | Requirements (REQ-*) |
|
|
1076
|
+
| `design` | Design artifacts (DES-*) |
|
|
1077
|
+
| `code` | Code files |
|
|
1078
|
+
| `test` | Test cases |
|
|
1079
|
+
|
|
1080
|
+
**Link Types:**
|
|
1081
|
+
|
|
1082
|
+
| Type | Description |
|
|
1083
|
+
|------|-------------|
|
|
1084
|
+
| `satisfies` | Design satisfies requirement |
|
|
1085
|
+
| `implements` | Code implements design |
|
|
1086
|
+
| `verifies` | Test verifies requirement |
|
|
1087
|
+
| `traces-to` | Generic traceability |
|
|
1088
|
+
|
|
1089
|
+
---
|
|
1090
|
+
|
|
1091
|
+
#### ImpactAnalyzer
|
|
1092
|
+
|
|
1093
|
+
Analyzes change impact across traceability graph.
|
|
1094
|
+
|
|
1095
|
+
```typescript
|
|
1096
|
+
import { ImpactAnalyzer } from '@nahisaho/musubix-formal-verify';
|
|
1097
|
+
|
|
1098
|
+
const analyzer = new ImpactAnalyzer(traceabilityDB);
|
|
1099
|
+
|
|
1100
|
+
// Analyze impact of changing REQ-001
|
|
1101
|
+
const impact = await analyzer.analyze('REQ-001');
|
|
1102
|
+
|
|
1103
|
+
console.log(`Total impacted: ${impact.totalImpacted}`);
|
|
1104
|
+
console.log(`Direct: ${impact.directImpact.length}`);
|
|
1105
|
+
console.log(`Indirect: ${impact.indirectImpact.length}`);
|
|
1106
|
+
```
|
|
1107
|
+
|
|
1108
|
+
**Methods:**
|
|
1109
|
+
|
|
1110
|
+
| Method | Parameters | Returns | Description |
|
|
1111
|
+
|--------|------------|---------|-------------|
|
|
1112
|
+
| `analyze(nodeId)` | `nodeId: string` | `Promise<ImpactResult>` | Analyze change impact |
|
|
1113
|
+
|
|
1114
|
+
**ImpactResult:**
|
|
1115
|
+
|
|
1116
|
+
| Property | Type | Description |
|
|
1117
|
+
|----------|------|-------------|
|
|
1118
|
+
| `sourceId` | `string` | Source node ID |
|
|
1119
|
+
| `directImpact` | `ImpactedNode[]` | Directly impacted nodes |
|
|
1120
|
+
| `indirectImpact` | `ImpactedNode[]` | Transitively impacted nodes |
|
|
1121
|
+
| `totalImpacted` | `number` | Total number of impacted nodes |
|
|
1122
|
+
| `maxDepth` | `number` | Maximum impact depth |
|
|
1123
|
+
|
|
1124
|
+
---
|
|
1125
|
+
|
|
684
1126
|
### Utils
|
|
685
1127
|
|
|
686
1128
|
#### I18nManager
|
|
@@ -978,6 +1420,6 @@ MIT License - see [LICENSE](./LICENSE) for details.
|
|
|
978
1420
|
|
|
979
1421
|
---
|
|
980
1422
|
|
|
981
|
-
**Version:** 1.
|
|
982
|
-
**Generated:** 2026-01-
|
|
1423
|
+
**Version:** 1.7.0
|
|
1424
|
+
**Generated:** 2026-01-06
|
|
983
1425
|
**MUSUBIX Core Package**
|
package/docs/INSTALL-GUIDE.ja.md
CHANGED