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.
- package/.github/AGENTS.md +949 -0
- package/.github/prompts/sdd-change-apply.prompt.md +283 -0
- package/.github/prompts/sdd-change-archive.prompt.md +241 -0
- package/.github/prompts/sdd-change-init.prompt.md +269 -0
- package/.github/prompts/sdd-design.prompt.md +250 -0
- package/.github/prompts/sdd-implement.prompt.md +387 -0
- package/.github/prompts/sdd-requirements.prompt.md +193 -0
- package/.github/prompts/sdd-review.prompt.md +155 -0
- package/.github/prompts/sdd-security.prompt.md +228 -0
- package/.github/prompts/sdd-steering.prompt.md +269 -0
- package/.github/prompts/sdd-tasks.prompt.md +255 -0
- package/.github/prompts/sdd-test.prompt.md +230 -0
- package/.github/prompts/sdd-validate.prompt.md +304 -0
- package/.github/skills/musubix-adr-generation/SKILL.md +209 -0
- package/.github/skills/musubix-best-practices/SKILL.md +315 -0
- package/.github/skills/musubix-c4-design/SKILL.md +162 -0
- package/.github/skills/musubix-code-generation/SKILL.md +237 -0
- package/.github/skills/musubix-domain-inference/SKILL.md +196 -0
- package/.github/skills/musubix-ears-validation/SKILL.md +161 -0
- package/.github/skills/musubix-sdd-workflow/SKILL.md +217 -0
- package/.github/skills/musubix-technical-writing/SKILL.md +444 -0
- package/.github/skills/musubix-test-generation/SKILL.md +212 -0
- package/.github/skills/musubix-traceability/SKILL.md +141 -0
- package/AGENTS.md +1136 -0
- package/LICENSE +21 -0
- package/README.ja.md +313 -0
- package/README.md +315 -50
- package/bin/musubix-mcp.js +15 -0
- package/bin/musubix.js +9 -1
- package/docs/API-REFERENCE.md +1425 -0
- package/docs/GITHUB-ACTIONS-NPM-SETUP.md +132 -0
- package/docs/INSTALL-GUIDE.ja.md +459 -0
- package/docs/INSTALL-GUIDE.md +459 -0
- package/docs/MIGRATION-v3.0.md +324 -0
- package/docs/MUSUBI-enhancement_roadmap_20260105.md +651 -0
- package/docs/MUSUBIX-v3.0-User-Guide.md +1357 -0
- package/docs/MUSUBIXv2.2.0-Manual-outline.md +136 -0
- package/docs/MUSUBIXv2.2.0-Manual.md +3123 -0
- package/docs/MUSUBIXv2.3.5-Refactering.md +1310 -0
- package/docs/MUSUBIv1.6.1-enhancement_roadmap_20260105.md +291 -0
- package/docs/MUSUBIv2.2.0-USERGUIDE.md +2079 -0
- package/docs/ROADMAP-v1.5.md +116 -0
- package/docs/SwarmCoding.md +1284 -0
- package/docs/Test-prompt.md +105 -0
- package/docs/USER-GUIDE-v1.8.0.md +2371 -0
- package/docs/USER-GUIDE.ja.md +2147 -0
- package/docs/USER-GUIDE.md +3022 -0
- package/docs/YATA-GLOBAL-GUIDE.ja.md +750 -0
- package/docs/YATA-GLOBAL-GUIDE.md +595 -0
- package/docs/YATA-LOCAL-GUIDE.ja.md +989 -0
- package/docs/YATA-LOCAL-GUIDE.md +730 -0
- package/docs/adr/0001-real-time-pattern-learning-architecture-for-v1-5-0.md +75 -0
- package/docs/adr/0002-pattern-sharing-protocol-for-cross-team-collaborat.md +79 -0
- package/docs/adr/0003-owl-2-rl-implementation-strategy-for-advanced-infe.md +90 -0
- package/docs/adr/ADR-v3.4.0-001-deep-research-architecture.md +217 -0
- package/docs/adr/ADR-v3.4.0-002-search-provider-selection.md +308 -0
- package/docs/adr/ADR-v3.4.0-003-lm-api-integration.md +475 -0
- package/docs/enterprise-knowledge-management.md +1737 -0
- package/docs/evolution-from-musubi-to-musubix.md +2170 -0
- package/docs/experiments/EXPERIMENT-ASSISTANT-AXIS-DRIFT-DETECTION.md +155 -0
- package/docs/getting-started-with-sdd.md +1602 -0
- package/docs/moodle-refactering-codegraph-musubix.md +391 -0
- package/docs/moodle-refactering-codegraph.md +278 -0
- package/docs/overview/MUSUBIX-CodeGraph.md +322 -0
- package/docs/overview/MUSUBIX-Core.md +671 -0
- package/docs/overview/MUSUBIX-Decisions.md +494 -0
- package/docs/overview/MUSUBIX-FormalVerify.md +566 -0
- package/docs/overview/MUSUBIX-Knowledge.md +1231 -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-Phase1-Complete.md +271 -0
- package/docs/overview/MUSUBIX-Phase2-Complete.md +310 -0
- package/docs/overview/MUSUBIX-Policy.md +477 -0
- package/docs/overview/MUSUBIX-Roadmap-v2.md +399 -0
- package/docs/overview/MUSUBIX-Security-Plan.md +939 -0
- package/docs/overview/MUSUBIX-Security-v2.1.md +668 -0
- package/docs/overview/MUSUBIX-Security.md +891 -0
- package/docs/overview/MUSUBIX-YATA.md +666 -0
- package/docs/overview/MUSUBIX-v2.2.0-Advanced-Learning.md +513 -0
- package/docs/overview/Neuro-SymbolicAI.md +159 -0
- package/docs/packages/knowledge.md +594 -0
- package/docs/qiita/musubix-v3.6.0-fastrender-insights.md +625 -0
- package/docs/qiita-linux-kernel-knowledge-graph.md +596 -0
- package/docs/qiita-musubix-assistant-axis.md +380 -0
- package/package.json +58 -52
- package/scripts/generate-quality-gate-report.ts +106 -0
- package/scripts/postinstall.js +94 -0
- package/scripts/register-release-knowledge.ts +127 -0
- package/steering/.musubi-version +1 -0
- package/steering/product.ja.md +572 -0
- package/steering/project.yml +66 -0
- package/steering/rules/constitution.md +491 -0
- package/steering/structure.ja.md +503 -0
- package/steering/tech.ja.md +208 -0
- package/dist/index.d.ts +0 -25
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -74
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,1425 @@
|
|
|
1
|
+
# MUSUBIX API Reference
|
|
2
|
+
|
|
3
|
+
> Auto-generated API documentation for MUSUBIX Core Package
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Overview](#overview)
|
|
8
|
+
- [Installation](#installation)
|
|
9
|
+
- [Quick Start](#quick-start)
|
|
10
|
+
- [Core Modules](#core-modules)
|
|
11
|
+
- [Requirements](#requirements)
|
|
12
|
+
- [Design](#design)
|
|
13
|
+
- [Codegen](#codegen)
|
|
14
|
+
- [Symbolic](#symbolic)
|
|
15
|
+
- [Inference](#inference) *(v1.4.5)*
|
|
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)*
|
|
22
|
+
- [Validation](#validation)
|
|
23
|
+
- [Utils](#utils)
|
|
24
|
+
- [MCP Server](#mcp-server)
|
|
25
|
+
- [YATA Client](#yata-client)
|
|
26
|
+
- [Types Reference](#types-reference)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Overview
|
|
31
|
+
|
|
32
|
+
MUSUBIX is a neuro-symbolic AI system combining:
|
|
33
|
+
- **MUSUBI**: LLM-powered specification-driven development
|
|
34
|
+
- **YATA**: Knowledge graph for contextual reasoning
|
|
35
|
+
|
|
36
|
+
### Architecture
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
┌─────────────────────────────────────────────┐
|
|
40
|
+
│ MUSUBIX Core │
|
|
41
|
+
├─────────────────────────────────────────────┤
|
|
42
|
+
│ Requirements → Design → Tasks → Validation │
|
|
43
|
+
├─────────────────────────────────────────────┤
|
|
44
|
+
│ MCP Server (stdio/SSE) │
|
|
45
|
+
├─────────────────────────────────────────────┤
|
|
46
|
+
│ YATA Knowledge Graph │
|
|
47
|
+
└─────────────────────────────────────────────┘
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm install @nahisaho/musubix-core
|
|
56
|
+
# or
|
|
57
|
+
pnpm add @nahisaho/musubix-core
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Quick Start
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import {
|
|
66
|
+
createRequirementsAnalyzer,
|
|
67
|
+
createC4ModelGenerator,
|
|
68
|
+
createTaskGenerator,
|
|
69
|
+
createConstitutionalValidator
|
|
70
|
+
} from '@nahisaho/musubix-core';
|
|
71
|
+
|
|
72
|
+
// 1. Analyze requirements
|
|
73
|
+
const analyzer = createRequirementsAnalyzer();
|
|
74
|
+
const analysis = analyzer.analyze(requirementText);
|
|
75
|
+
|
|
76
|
+
// 2. Generate design
|
|
77
|
+
const c4Generator = createC4ModelGenerator();
|
|
78
|
+
const diagram = c4Generator.generateContext(systemSpec);
|
|
79
|
+
|
|
80
|
+
// 3. Create tasks
|
|
81
|
+
const taskGenerator = createTaskGenerator();
|
|
82
|
+
const tasks = taskGenerator.generate(requirements);
|
|
83
|
+
|
|
84
|
+
// 4. Validate
|
|
85
|
+
const validator = createConstitutionalValidator();
|
|
86
|
+
const result = validator.validate(artifact);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Core Modules
|
|
92
|
+
|
|
93
|
+
### Requirements
|
|
94
|
+
|
|
95
|
+
#### RequirementsAnalyzer
|
|
96
|
+
|
|
97
|
+
Analyzes and structures requirement specifications.
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { createRequirementsAnalyzer } from '@nahisaho/musubix-core';
|
|
101
|
+
|
|
102
|
+
const analyzer = createRequirementsAnalyzer({
|
|
103
|
+
strictMode: true,
|
|
104
|
+
validateEARS: true
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Analyze requirement text
|
|
108
|
+
const result = analyzer.analyze(requirementText);
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Methods:**
|
|
112
|
+
|
|
113
|
+
| Method | Parameters | Returns | Description |
|
|
114
|
+
|--------|------------|---------|-------------|
|
|
115
|
+
| `analyze(text)` | `text: string` | `AnalysisResult` | Analyzes requirement text |
|
|
116
|
+
| `validateEARS(req)` | `req: Requirement` | `ValidationResult` | Validates EARS compliance |
|
|
117
|
+
| `extractRequirements(text)` | `text: string` | `Requirement[]` | Extracts requirements from text |
|
|
118
|
+
|
|
119
|
+
**Configuration:**
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
interface AnalyzerConfig {
|
|
123
|
+
strictMode?: boolean; // Enable strict validation
|
|
124
|
+
validateEARS?: boolean; // Validate EARS format
|
|
125
|
+
autoClassify?: boolean; // Auto-classify requirement types
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
#### RequirementsDecomposer
|
|
132
|
+
|
|
133
|
+
Decomposes complex requirements into smaller units.
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { createRequirementsDecomposer } from '@nahisaho/musubix-core';
|
|
137
|
+
|
|
138
|
+
const decomposer = createRequirementsDecomposer({
|
|
139
|
+
maxDepth: 4,
|
|
140
|
+
targetUnitSize: 4
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const result = decomposer.decompose(requirement, 'functional');
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Methods:**
|
|
147
|
+
|
|
148
|
+
| Method | Parameters | Returns | Description |
|
|
149
|
+
|--------|------------|---------|-------------|
|
|
150
|
+
| `decompose(req, strategy)` | `req: Requirement, strategy?: DecompositionStrategy` | `DecompositionResult` | Decomposes requirement |
|
|
151
|
+
| `analyzeComplexity(req)` | `req: Requirement` | `ComplexityLevel` | Analyzes requirement complexity |
|
|
152
|
+
| `exportMarkdown(result)` | `result: DecompositionResult` | `string` | Exports as Markdown |
|
|
153
|
+
|
|
154
|
+
**Decomposition Strategies:**
|
|
155
|
+
|
|
156
|
+
- `functional` - By function/feature
|
|
157
|
+
- `behavioral` - By behavior/scenario
|
|
158
|
+
- `structural` - By component/module
|
|
159
|
+
- `temporal` - By phase/timeline
|
|
160
|
+
- `stakeholder` - By stakeholder needs
|
|
161
|
+
- `risk-based` - By risk priority
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
#### RelatedRequirementsFinder
|
|
166
|
+
|
|
167
|
+
Finds related requirements using semantic similarity.
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
import { createRelatedRequirementsFinder } from '@nahisaho/musubix-core';
|
|
171
|
+
|
|
172
|
+
const finder = createRelatedRequirementsFinder({
|
|
173
|
+
similarityThreshold: 0.7,
|
|
174
|
+
maxResults: 10
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const related = finder.findRelated(requirement, allRequirements);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Methods:**
|
|
181
|
+
|
|
182
|
+
| Method | Parameters | Returns | Description |
|
|
183
|
+
|--------|------------|---------|-------------|
|
|
184
|
+
| `findRelated(req, all)` | `req: Requirement, all: Requirement[]` | `RelatedResult[]` | Finds related requirements |
|
|
185
|
+
| `clusterRequirements(reqs)` | `reqs: Requirement[]` | `Cluster[]` | Clusters requirements |
|
|
186
|
+
| `findGaps(reqs)` | `reqs: Requirement[]` | `Gap[]` | Identifies coverage gaps |
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
### Design
|
|
191
|
+
|
|
192
|
+
#### C4ModelGenerator
|
|
193
|
+
|
|
194
|
+
Generates C4 architecture diagrams.
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
import { createC4ModelGenerator } from '@nahisaho/musubix-core';
|
|
198
|
+
|
|
199
|
+
const generator = createC4ModelGenerator({
|
|
200
|
+
defaultFormat: 'mermaid'
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
const contextDiagram = generator.generateContext(systemSpec);
|
|
204
|
+
const containerDiagram = generator.generateContainer(systemSpec);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Methods:**
|
|
208
|
+
|
|
209
|
+
| Method | Parameters | Returns | Description |
|
|
210
|
+
|--------|------------|---------|-------------|
|
|
211
|
+
| `generateContext(spec)` | `spec: SystemSpec` | `C4Diagram` | Generates Context diagram |
|
|
212
|
+
| `generateContainer(spec)` | `spec: SystemSpec` | `C4Diagram` | Generates Container diagram |
|
|
213
|
+
| `generateComponent(container)` | `container: Container` | `C4Diagram` | Generates Component diagram |
|
|
214
|
+
| `export(diagram, format)` | `diagram: C4Diagram, format: ExportFormat` | `string` | Exports to format |
|
|
215
|
+
|
|
216
|
+
**Export Formats:**
|
|
217
|
+
|
|
218
|
+
- `structurizr` - Structurizr DSL
|
|
219
|
+
- `plantuml` - PlantUML syntax
|
|
220
|
+
- `mermaid` - Mermaid diagram
|
|
221
|
+
- `json` - JSON structure
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
#### ADRGenerator
|
|
226
|
+
|
|
227
|
+
Generates Architecture Decision Records.
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
import { createADRGenerator } from '@nahisaho/musubix-core';
|
|
231
|
+
|
|
232
|
+
const generator = createADRGenerator({
|
|
233
|
+
template: 'madr',
|
|
234
|
+
outputFormat: 'markdown'
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
const adr = generator.generate(decision);
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Methods:**
|
|
241
|
+
|
|
242
|
+
| Method | Parameters | Returns | Description |
|
|
243
|
+
|--------|------------|---------|-------------|
|
|
244
|
+
| `generate(decision)` | `decision: ADRInput` | `ADR` | Generates ADR |
|
|
245
|
+
| `listAll()` | - | `ADR[]` | Lists all ADRs |
|
|
246
|
+
| `export(adr, format)` | `adr: ADR, format: OutputFormat` | `string` | Exports ADR |
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
### Codegen
|
|
251
|
+
|
|
252
|
+
#### TaskGenerator
|
|
253
|
+
|
|
254
|
+
Generates implementation tasks from requirements.
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
import { createTaskGenerator } from '@nahisaho/musubix-core';
|
|
258
|
+
|
|
259
|
+
const generator = createTaskGenerator({
|
|
260
|
+
estimateEffort: true,
|
|
261
|
+
includeTests: true
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
const tasks = generator.generate(requirements);
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Methods:**
|
|
268
|
+
|
|
269
|
+
| Method | Parameters | Returns | Description |
|
|
270
|
+
|--------|------------|---------|-------------|
|
|
271
|
+
| `generate(reqs)` | `reqs: Requirement[]` | `Task[]` | Generates tasks |
|
|
272
|
+
| `estimateEffort(task)` | `task: Task` | `number` | Estimates hours |
|
|
273
|
+
| `prioritize(tasks)` | `tasks: Task[]` | `Task[]` | Prioritizes tasks |
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
#### CodingStandardsChecker
|
|
278
|
+
|
|
279
|
+
Validates code against coding standards.
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
import { createCodingStandardsChecker } from '@nahisaho/musubix-core';
|
|
283
|
+
|
|
284
|
+
const checker = createCodingStandardsChecker({
|
|
285
|
+
rules: ['naming', 'formatting', 'documentation']
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
const violations = checker.check(code, 'typescript');
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Methods:**
|
|
292
|
+
|
|
293
|
+
| Method | Parameters | Returns | Description |
|
|
294
|
+
|--------|------------|---------|-------------|
|
|
295
|
+
| `check(code, lang)` | `code: string, lang: Language` | `Violation[]` | Checks code |
|
|
296
|
+
| `fix(code, violations)` | `code: string, violations: Violation[]` | `string` | Auto-fixes violations |
|
|
297
|
+
| `report(violations)` | `violations: Violation[]` | `Report` | Generates report |
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
### REPL
|
|
302
|
+
|
|
303
|
+
*(New in v1.5.0, Enhanced in v1.6.0)*
|
|
304
|
+
|
|
305
|
+
Interactive command-line interface components.
|
|
306
|
+
|
|
307
|
+
#### ReplEngine
|
|
308
|
+
|
|
309
|
+
Main REPL controller.
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
import { createReplEngine } from '@nahisaho/musubix-core';
|
|
313
|
+
|
|
314
|
+
const engine = createReplEngine({
|
|
315
|
+
history: { maxSize: 1000 },
|
|
316
|
+
prompt: { showProject: true, showPhase: true },
|
|
317
|
+
completion: { maxSuggestions: 10 },
|
|
318
|
+
output: { defaultFormat: 'auto' }
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
await engine.start();
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**Methods:**
|
|
325
|
+
|
|
326
|
+
| Method | Parameters | Returns | Description |
|
|
327
|
+
|--------|------------|---------|-------------|
|
|
328
|
+
| `start()` | - | `Promise<void>` | Starts REPL session |
|
|
329
|
+
| `stop()` | - | `Promise<void>` | Stops REPL session |
|
|
330
|
+
| `execute(command)` | `command: string` | `Promise<CommandResult>` | Executes command |
|
|
331
|
+
| `isRunning()` | - | `boolean` | Returns running state |
|
|
332
|
+
| `on(event, handler)` | `event: string, handler: Function` | `void` | Registers event handler |
|
|
333
|
+
|
|
334
|
+
#### CommandCompleter
|
|
335
|
+
|
|
336
|
+
TAB completion provider.
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
import { createCommandCompleter } from '@nahisaho/musubix-core';
|
|
340
|
+
|
|
341
|
+
const completer = createCommandCompleter({ maxSuggestions: 10 });
|
|
342
|
+
completer.registerCommands(commandDefinitions);
|
|
343
|
+
|
|
344
|
+
const result = completer.complete('req', 3);
|
|
345
|
+
// { completions: ['requirements'], prefix: 'req' }
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
#### HistoryManager
|
|
349
|
+
|
|
350
|
+
Command history persistence.
|
|
351
|
+
|
|
352
|
+
```typescript
|
|
353
|
+
import { createHistoryManager } from '@nahisaho/musubix-core';
|
|
354
|
+
|
|
355
|
+
const history = createHistoryManager({
|
|
356
|
+
maxSize: 1000,
|
|
357
|
+
filePath: '~/.musubix_history'
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
await history.load();
|
|
361
|
+
history.add('requirements analyze input.md');
|
|
362
|
+
await history.save();
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
#### SessionState
|
|
366
|
+
|
|
367
|
+
Session variable storage.
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
import { createSessionState } from '@nahisaho/musubix-core';
|
|
371
|
+
|
|
372
|
+
const session = createSessionState();
|
|
373
|
+
session.set('project', 'my-app');
|
|
374
|
+
const value = session.get('project'); // 'my-app'
|
|
375
|
+
const expanded = session.expand('design $project'); // 'design my-app'
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
#### OutputFormatter
|
|
379
|
+
|
|
380
|
+
Output formatting (JSON/YAML/Table).
|
|
381
|
+
|
|
382
|
+
```typescript
|
|
383
|
+
import { createOutputFormatter } from '@nahisaho/musubix-core';
|
|
384
|
+
|
|
385
|
+
const formatter = createOutputFormatter({ defaultFormat: 'auto' });
|
|
386
|
+
console.log(formatter.format(data));
|
|
387
|
+
console.log(formatter.formatTable(arrayOfObjects));
|
|
388
|
+
console.log(formatter.formatJson(object));
|
|
389
|
+
console.log(formatter.formatYaml(object));
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
### Validation
|
|
395
|
+
|
|
396
|
+
#### ConstitutionalValidator
|
|
397
|
+
|
|
398
|
+
Validates artifacts against 9 Constitutional Articles.
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
import { createConstitutionalValidator } from '@nahisaho/musubix-core';
|
|
402
|
+
|
|
403
|
+
const validator = createConstitutionalValidator({
|
|
404
|
+
strictMode: true,
|
|
405
|
+
articles: ['all']
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
const result = validator.validate(artifact);
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
**Methods:**
|
|
412
|
+
|
|
413
|
+
| Method | Parameters | Returns | Description |
|
|
414
|
+
|--------|------------|---------|-------------|
|
|
415
|
+
| `validate(artifact)` | `artifact: Artifact` | `ValidationResult` | Validates artifact |
|
|
416
|
+
| `checkArticle(artifact, article)` | `artifact: Artifact, article: Article` | `ArticleResult` | Checks specific article |
|
|
417
|
+
| `generateReport(results)` | `results: ValidationResult[]` | `Report` | Generates validation report |
|
|
418
|
+
|
|
419
|
+
**Constitutional Articles:**
|
|
420
|
+
|
|
421
|
+
| Article | Name | Description |
|
|
422
|
+
|---------|------|-------------|
|
|
423
|
+
| I | Project Memory | Maintain consistent project context |
|
|
424
|
+
| II | Requirements | Complete EARS specification |
|
|
425
|
+
| III | Design | C4 + ADR documentation |
|
|
426
|
+
| IV | Task Breakdown | Traceable task decomposition |
|
|
427
|
+
| V | Traceability | Bidirectional traceability |
|
|
428
|
+
| VI | Explainability | Transparent AI decisions |
|
|
429
|
+
| VII | Integration | Seamless workflow integration |
|
|
430
|
+
| VIII | Adaptability | Flexible methodologies |
|
|
431
|
+
| IX | Quality | Continuous quality assurance |
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
### Symbolic (v1.2.0)
|
|
436
|
+
|
|
437
|
+
The symbolic reasoning module provides formal verification and quality assurance capabilities.
|
|
438
|
+
|
|
439
|
+
#### SemanticCodeFilterPipeline
|
|
440
|
+
|
|
441
|
+
Filters and validates LLM-generated code semantically.
|
|
442
|
+
|
|
443
|
+
```typescript
|
|
444
|
+
import { createSemanticCodeFilterPipeline } from '@nahisaho/musubix-core';
|
|
445
|
+
|
|
446
|
+
const filter = createSemanticCodeFilterPipeline({
|
|
447
|
+
hallucinationDetector: new HallucinationDetector(),
|
|
448
|
+
constitutionRegistry: new ConstitutionRuleRegistry(),
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
const result = await filter.filter({
|
|
452
|
+
candidates: [{ code: 'function example() {}', language: 'typescript' }],
|
|
453
|
+
projectContext: { projectRoot: '/path/to/project' },
|
|
454
|
+
});
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
**Methods:**
|
|
458
|
+
|
|
459
|
+
| Method | Parameters | Returns | Description |
|
|
460
|
+
|--------|------------|---------|-------------|
|
|
461
|
+
| `filter(input)` | `input: FilterInput` | `Promise<FilterOutput>` | Filters code candidates |
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
#### HallucinationDetector
|
|
466
|
+
|
|
467
|
+
Detects hallucinations (undefined symbols, invalid imports) in generated code.
|
|
468
|
+
|
|
469
|
+
```typescript
|
|
470
|
+
import { createHallucinationDetector } from '@nahisaho/musubix-core';
|
|
471
|
+
|
|
472
|
+
const detector = createHallucinationDetector();
|
|
473
|
+
const result = detector.detect(code, projectContext);
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
**Methods:**
|
|
477
|
+
|
|
478
|
+
| Method | Parameters | Returns | Description |
|
|
479
|
+
|--------|------------|---------|-------------|
|
|
480
|
+
| `detect(code, context)` | `code: string, context: ProjectContext` | `HallucinationResult` | Detects hallucinations |
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
#### EarsToFormalSpecConverter
|
|
485
|
+
|
|
486
|
+
Converts EARS requirements to SMT-LIB format.
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
import { createEarsToFormalSpecConverter, parseEarsRequirement } from '@nahisaho/musubix-core';
|
|
490
|
+
|
|
491
|
+
const converter = createEarsToFormalSpecConverter();
|
|
492
|
+
const ast = parseEarsRequirement('THE system SHALL validate input');
|
|
493
|
+
const smtLib = converter.convert([ast]);
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
**Methods:**
|
|
497
|
+
|
|
498
|
+
| Method | Parameters | Returns | Description |
|
|
499
|
+
|--------|------------|---------|-------------|
|
|
500
|
+
| `convert(requirements)` | `requirements: EarsAstNode[]` | `SmtLibOutput` | Converts EARS to SMT-LIB |
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
#### Z3Adapter
|
|
505
|
+
|
|
506
|
+
Integrates with Z3 SMT solver for formal verification.
|
|
507
|
+
|
|
508
|
+
```typescript
|
|
509
|
+
import { createZ3Adapter } from '@nahisaho/musubix-core';
|
|
510
|
+
|
|
511
|
+
const z3 = createZ3Adapter({ timeoutMs: 5000 });
|
|
512
|
+
const result = await z3.verify(verificationConditions, smtLib);
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
**Methods:**
|
|
516
|
+
|
|
517
|
+
| Method | Parameters | Returns | Description |
|
|
518
|
+
|--------|------------|---------|-------------|
|
|
519
|
+
| `verify(vcs, smtLib)` | `vcs: VerificationCondition[], smtLib: string` | `Promise<FormalVerificationResult>` | Verifies conditions |
|
|
520
|
+
| `isAvailable()` | - | `Promise<boolean>` | Checks if Z3 is installed |
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
#### QualityGateValidator
|
|
525
|
+
|
|
526
|
+
Validates quality gates before phase transitions.
|
|
527
|
+
|
|
528
|
+
```typescript
|
|
529
|
+
import { QualityGateValidator, createComponentValidation } from '@nahisaho/musubix-core';
|
|
530
|
+
|
|
531
|
+
const validator = new QualityGateValidator();
|
|
532
|
+
const components = createComponentValidation({
|
|
533
|
+
performanceBudgetDefined: true,
|
|
534
|
+
auditLoggingDefined: true,
|
|
535
|
+
traceabilityCompliant: true,
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
const result = validator.validate(traceabilityData, components);
|
|
539
|
+
const report = validator.generateApprovalReport(result);
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
**Methods:**
|
|
543
|
+
|
|
544
|
+
| Method | Parameters | Returns | Description |
|
|
545
|
+
|--------|------------|---------|-------------|
|
|
546
|
+
| `validate(traceability, components)` | `traceability: TraceabilityCoverage[], components: ComponentValidation` | `QualityGateResult` | Validates quality gate |
|
|
547
|
+
| `generateApprovalReport(result)` | `result: QualityGateResult` | `string` | Generates Markdown report |
|
|
548
|
+
|
|
549
|
+
**Quality Gate Checks:**
|
|
550
|
+
|
|
551
|
+
| Category | Checks |
|
|
552
|
+
|----------|--------|
|
|
553
|
+
| Traceability | Design coverage, Task decomposition, Coverage gaps |
|
|
554
|
+
| Non-Functional | Performance budget, Extensibility, Explainability |
|
|
555
|
+
| Security | Sensitive data masking, Audit logging |
|
|
556
|
+
| Constitution | All 9 articles compliance |
|
|
557
|
+
|
|
558
|
+
---
|
|
559
|
+
|
|
560
|
+
### Inference (v1.4.5)
|
|
561
|
+
|
|
562
|
+
The inference module provides OWL 2 RL reasoning and Datalog evaluation capabilities.
|
|
563
|
+
|
|
564
|
+
#### OWL2RLReasoner
|
|
565
|
+
|
|
566
|
+
Performs OWL 2 RL profile reasoning with 20+ built-in entailment rules.
|
|
567
|
+
|
|
568
|
+
```typescript
|
|
569
|
+
import { OWL2RLReasoner } from '@nahisaho/musubix-ontology-mcp';
|
|
570
|
+
|
|
571
|
+
const reasoner = new OWL2RLReasoner({
|
|
572
|
+
maxIterations: 100,
|
|
573
|
+
enablePropertyChains: true,
|
|
574
|
+
enableInverseProperties: true
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
const result = await reasoner.reason(store, {
|
|
578
|
+
onProgress: (progress) => console.log(`Iteration ${progress.iteration}`)
|
|
579
|
+
});
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
**Methods:**
|
|
583
|
+
|
|
584
|
+
| Method | Parameters | Returns | Description |
|
|
585
|
+
|--------|------------|---------|-------------|
|
|
586
|
+
| `reason(store, options)` | `store: N3Store, options?: ReasonerOptions` | `Promise<ReasoningResult>` | Execute reasoning |
|
|
587
|
+
| `getProvenanceLog()` | - | `ProvenanceLog` | Get inference provenance |
|
|
588
|
+
| `getRulesApplied()` | - | `string[]` | Get list of applied rules |
|
|
589
|
+
|
|
590
|
+
**Built-in Rules:**
|
|
591
|
+
|
|
592
|
+
| Rule | Description |
|
|
593
|
+
|------|-------------|
|
|
594
|
+
| `prp-dom` | Property domain inference |
|
|
595
|
+
| `prp-rng` | Property range inference |
|
|
596
|
+
| `prp-inv1/2` | Inverse property inference |
|
|
597
|
+
| `prp-trp` | Transitive property chaining |
|
|
598
|
+
| `prp-symp` | Symmetric property inference |
|
|
599
|
+
| `cax-sco` | SubClassOf propagation |
|
|
600
|
+
| `scm-spo` | SubPropertyOf inference |
|
|
601
|
+
| `eq-rep-s/p/o` | SameAs replacement |
|
|
602
|
+
|
|
603
|
+
---
|
|
604
|
+
|
|
605
|
+
#### DatalogEngine
|
|
606
|
+
|
|
607
|
+
Evaluates Datalog rules with stratified negation support.
|
|
608
|
+
|
|
609
|
+
```typescript
|
|
610
|
+
import { DatalogEngine } from '@nahisaho/musubix-ontology-mcp';
|
|
611
|
+
|
|
612
|
+
const engine = new DatalogEngine();
|
|
613
|
+
|
|
614
|
+
const rules = [
|
|
615
|
+
{
|
|
616
|
+
head: { predicate: 'ancestor', args: ['?x', '?y'] },
|
|
617
|
+
body: [{ predicate: 'parent', args: ['?x', '?y'] }]
|
|
618
|
+
}
|
|
619
|
+
];
|
|
620
|
+
|
|
621
|
+
const result = await engine.evaluate(rules, facts);
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
**Methods:**
|
|
625
|
+
|
|
626
|
+
| Method | Parameters | Returns | Description |
|
|
627
|
+
|--------|------------|---------|-------------|
|
|
628
|
+
| `evaluate(rules, facts, options)` | `rules: Rule[], facts: Fact[], options?: EvalOptions` | `Promise<EvaluationResult>` | Evaluate rules |
|
|
629
|
+
| `stratify(rules)` | `rules: Rule[]` | `Rule[][]` | Stratify rules by dependency |
|
|
630
|
+
|
|
631
|
+
---
|
|
632
|
+
|
|
633
|
+
#### InferenceExplainer
|
|
634
|
+
|
|
635
|
+
Generates human-readable explanations for inferred facts.
|
|
636
|
+
|
|
637
|
+
```typescript
|
|
638
|
+
import { InferenceExplainer, ExplanationFormat } from '@nahisaho/musubix-ontology-mcp';
|
|
639
|
+
|
|
640
|
+
const explainer = new InferenceExplainer(provenanceLog);
|
|
641
|
+
|
|
642
|
+
const explanation = explainer.explain(
|
|
643
|
+
subject, predicate, object,
|
|
644
|
+
ExplanationFormat.TEXT
|
|
645
|
+
);
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
**Methods:**
|
|
649
|
+
|
|
650
|
+
| Method | Parameters | Returns | Description |
|
|
651
|
+
|--------|------------|---------|-------------|
|
|
652
|
+
| `explain(s, p, o, format)` | `s: string, p: string, o: string, format: ExplanationFormat` | `string` | Generate explanation |
|
|
653
|
+
| `getInferenceChain(s, p, o)` | `s: string, p: string, o: string` | `InferenceStep[]` | Get inference chain |
|
|
654
|
+
|
|
655
|
+
**Explanation Formats:**
|
|
656
|
+
|
|
657
|
+
| Format | Description |
|
|
658
|
+
|--------|-------------|
|
|
659
|
+
| `TEXT` | Plain text explanation |
|
|
660
|
+
| `MARKDOWN` | Markdown formatted |
|
|
661
|
+
| `HTML` | HTML with styling |
|
|
662
|
+
|
|
663
|
+
---
|
|
664
|
+
|
|
665
|
+
#### ProgressReporter
|
|
666
|
+
|
|
667
|
+
Reports real-time inference progress.
|
|
668
|
+
|
|
669
|
+
```typescript
|
|
670
|
+
import { createProgressReporter } from '@nahisaho/musubix-ontology-mcp';
|
|
671
|
+
|
|
672
|
+
const reporter = createProgressReporter({
|
|
673
|
+
onProgress: (info) => console.log(`${info.phase}: ${info.newInferences} new`),
|
|
674
|
+
throttleMs: 500
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
await reasoner.reason(store, { progressReporter: reporter });
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
**Configuration:**
|
|
681
|
+
|
|
682
|
+
| Option | Type | Description |
|
|
683
|
+
|--------|------|-------------|
|
|
684
|
+
| `onProgress` | `(info: ProgressInfo) => void` | Progress callback |
|
|
685
|
+
| `throttleMs` | `number` | Throttle interval (default: 500ms) |
|
|
686
|
+
|
|
687
|
+
---
|
|
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
|
+
|
|
1126
|
+
### Utils
|
|
1127
|
+
|
|
1128
|
+
#### I18nManager
|
|
1129
|
+
|
|
1130
|
+
Manages internationalization and localization.
|
|
1131
|
+
|
|
1132
|
+
```typescript
|
|
1133
|
+
import { createI18nManager, t } from '@nahisaho/musubix-core';
|
|
1134
|
+
|
|
1135
|
+
const i18n = createI18nManager({
|
|
1136
|
+
defaultLocale: 'en',
|
|
1137
|
+
fallbackLocale: 'en'
|
|
1138
|
+
});
|
|
1139
|
+
|
|
1140
|
+
i18n.setLocale('ja');
|
|
1141
|
+
console.log(t('common.save')); // 保存
|
|
1142
|
+
```
|
|
1143
|
+
|
|
1144
|
+
**Methods:**
|
|
1145
|
+
|
|
1146
|
+
| Method | Parameters | Returns | Description |
|
|
1147
|
+
|--------|------------|---------|-------------|
|
|
1148
|
+
| `t(key, options)` | `key: string, options?: object` | `string` | Translate key |
|
|
1149
|
+
| `tp(key, count)` | `key: string, count: number` | `string` | Translate with plural |
|
|
1150
|
+
| `setLocale(locale)` | `locale: Locale` | `void` | Set current locale |
|
|
1151
|
+
| `formatDate(date)` | `date: Date` | `string` | Format date |
|
|
1152
|
+
| `formatNumber(num)` | `num: number` | `string` | Format number |
|
|
1153
|
+
|
|
1154
|
+
**Supported Locales:**
|
|
1155
|
+
|
|
1156
|
+
`en`, `ja`, `zh`, `ko`, `de`, `fr`, `es`, `pt`
|
|
1157
|
+
|
|
1158
|
+
---
|
|
1159
|
+
|
|
1160
|
+
#### StructuredLogger
|
|
1161
|
+
|
|
1162
|
+
Provides structured logging with multiple transports.
|
|
1163
|
+
|
|
1164
|
+
```typescript
|
|
1165
|
+
import { createLogger } from '@nahisaho/musubix-core';
|
|
1166
|
+
|
|
1167
|
+
const logger = createLogger({
|
|
1168
|
+
level: 'info',
|
|
1169
|
+
format: 'json'
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
logger.info('Operation completed', { duration: 150 });
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
**Methods:**
|
|
1176
|
+
|
|
1177
|
+
| Method | Parameters | Returns | Description |
|
|
1178
|
+
|--------|------------|---------|-------------|
|
|
1179
|
+
| `debug(msg, meta)` | `msg: string, meta?: object` | `void` | Debug log |
|
|
1180
|
+
| `info(msg, meta)` | `msg: string, meta?: object` | `void` | Info log |
|
|
1181
|
+
| `warn(msg, meta)` | `msg: string, meta?: object` | `void` | Warning log |
|
|
1182
|
+
| `error(msg, meta)` | `msg: string, meta?: object` | `void` | Error log |
|
|
1183
|
+
| `child(context)` | `context: object` | `Logger` | Create child logger |
|
|
1184
|
+
|
|
1185
|
+
---
|
|
1186
|
+
|
|
1187
|
+
#### PerformanceProfiler
|
|
1188
|
+
|
|
1189
|
+
Profiles and measures performance.
|
|
1190
|
+
|
|
1191
|
+
```typescript
|
|
1192
|
+
import { createPerformanceProfiler } from '@nahisaho/musubix-core';
|
|
1193
|
+
|
|
1194
|
+
const profiler = createPerformanceProfiler();
|
|
1195
|
+
|
|
1196
|
+
profiler.start('operation');
|
|
1197
|
+
// ... operation ...
|
|
1198
|
+
const result = profiler.end('operation');
|
|
1199
|
+
```
|
|
1200
|
+
|
|
1201
|
+
**Methods:**
|
|
1202
|
+
|
|
1203
|
+
| Method | Parameters | Returns | Description |
|
|
1204
|
+
|--------|------------|---------|-------------|
|
|
1205
|
+
| `start(name)` | `name: string` | `void` | Start measurement |
|
|
1206
|
+
| `end(name)` | `name: string` | `ProfileResult` | End measurement |
|
|
1207
|
+
| `measure(name, fn)` | `name: string, fn: Function` | `ProfileResult` | Measure function |
|
|
1208
|
+
| `getStats(name)` | `name: string` | `Statistics` | Get statistics |
|
|
1209
|
+
|
|
1210
|
+
---
|
|
1211
|
+
|
|
1212
|
+
## MCP Server
|
|
1213
|
+
|
|
1214
|
+
### Starting the Server
|
|
1215
|
+
|
|
1216
|
+
```typescript
|
|
1217
|
+
import { createMCPServer } from '@nahisaho/musubix-mcp-server';
|
|
1218
|
+
|
|
1219
|
+
const server = createMCPServer({
|
|
1220
|
+
transport: 'stdio', // or 'sse'
|
|
1221
|
+
capabilities: ['requirements', 'design', 'tasks', 'validation']
|
|
1222
|
+
});
|
|
1223
|
+
|
|
1224
|
+
await server.start();
|
|
1225
|
+
```
|
|
1226
|
+
|
|
1227
|
+
### Available Tools
|
|
1228
|
+
|
|
1229
|
+
| Tool | Description |
|
|
1230
|
+
|------|-------------|
|
|
1231
|
+
| `analyze_requirements` | Analyze requirement text |
|
|
1232
|
+
| `generate_c4` | Generate C4 diagrams |
|
|
1233
|
+
| `generate_adr` | Generate ADR documents |
|
|
1234
|
+
| `generate_tasks` | Generate implementation tasks |
|
|
1235
|
+
| `validate_artifact` | Validate against constitution |
|
|
1236
|
+
| `query_knowledge` | Query YATA knowledge graph |
|
|
1237
|
+
|
|
1238
|
+
### Example Tool Call
|
|
1239
|
+
|
|
1240
|
+
```json
|
|
1241
|
+
{
|
|
1242
|
+
"tool": "analyze_requirements",
|
|
1243
|
+
"arguments": {
|
|
1244
|
+
"text": "The system shall...",
|
|
1245
|
+
"options": {
|
|
1246
|
+
"validateEARS": true
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
```
|
|
1251
|
+
|
|
1252
|
+
---
|
|
1253
|
+
|
|
1254
|
+
## YATA Client
|
|
1255
|
+
|
|
1256
|
+
### Connecting to YATA
|
|
1257
|
+
|
|
1258
|
+
```typescript
|
|
1259
|
+
import { createYATAClient } from '@nahisaho/musubix-yata-client';
|
|
1260
|
+
|
|
1261
|
+
const client = createYATAClient({
|
|
1262
|
+
endpoint: 'http://localhost:8000',
|
|
1263
|
+
apiKey: process.env.YATA_API_KEY
|
|
1264
|
+
});
|
|
1265
|
+
|
|
1266
|
+
await client.connect();
|
|
1267
|
+
```
|
|
1268
|
+
|
|
1269
|
+
### Operations
|
|
1270
|
+
|
|
1271
|
+
#### Query Knowledge
|
|
1272
|
+
|
|
1273
|
+
```typescript
|
|
1274
|
+
const results = await client.query({
|
|
1275
|
+
type: 'requirement',
|
|
1276
|
+
filters: {
|
|
1277
|
+
priority: 'must',
|
|
1278
|
+
status: 'approved'
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
```
|
|
1282
|
+
|
|
1283
|
+
#### Store Knowledge
|
|
1284
|
+
|
|
1285
|
+
```typescript
|
|
1286
|
+
await client.store({
|
|
1287
|
+
type: 'design',
|
|
1288
|
+
data: designDocument,
|
|
1289
|
+
relations: [
|
|
1290
|
+
{ type: 'implements', target: 'REQ-001' }
|
|
1291
|
+
]
|
|
1292
|
+
});
|
|
1293
|
+
```
|
|
1294
|
+
|
|
1295
|
+
#### Link Entities
|
|
1296
|
+
|
|
1297
|
+
```typescript
|
|
1298
|
+
await client.link({
|
|
1299
|
+
source: 'TSK-001',
|
|
1300
|
+
target: 'REQ-001',
|
|
1301
|
+
type: 'implements'
|
|
1302
|
+
});
|
|
1303
|
+
```
|
|
1304
|
+
|
|
1305
|
+
---
|
|
1306
|
+
|
|
1307
|
+
## Types Reference
|
|
1308
|
+
|
|
1309
|
+
### Requirement
|
|
1310
|
+
|
|
1311
|
+
```typescript
|
|
1312
|
+
interface Requirement {
|
|
1313
|
+
id: string;
|
|
1314
|
+
title: string;
|
|
1315
|
+
description: string;
|
|
1316
|
+
type: 'functional' | 'non-functional' | 'constraint';
|
|
1317
|
+
priority: 'must' | 'should' | 'could' | 'wont';
|
|
1318
|
+
status: 'draft' | 'approved' | 'implemented' | 'verified';
|
|
1319
|
+
acceptanceCriteria: string[];
|
|
1320
|
+
traceability: {
|
|
1321
|
+
designRefs: string[];
|
|
1322
|
+
taskRefs: string[];
|
|
1323
|
+
testRefs: string[];
|
|
1324
|
+
};
|
|
1325
|
+
}
|
|
1326
|
+
```
|
|
1327
|
+
|
|
1328
|
+
### Task
|
|
1329
|
+
|
|
1330
|
+
```typescript
|
|
1331
|
+
interface Task {
|
|
1332
|
+
id: string;
|
|
1333
|
+
title: string;
|
|
1334
|
+
description: string;
|
|
1335
|
+
status: 'pending' | 'in-progress' | 'completed' | 'blocked';
|
|
1336
|
+
requirementRef: string;
|
|
1337
|
+
designRef?: string;
|
|
1338
|
+
estimatedHours: number;
|
|
1339
|
+
actualHours?: number;
|
|
1340
|
+
assignee?: string;
|
|
1341
|
+
tags: string[];
|
|
1342
|
+
}
|
|
1343
|
+
```
|
|
1344
|
+
|
|
1345
|
+
### ValidationResult
|
|
1346
|
+
|
|
1347
|
+
```typescript
|
|
1348
|
+
interface ValidationResult {
|
|
1349
|
+
valid: boolean;
|
|
1350
|
+
score: number;
|
|
1351
|
+
errors: ValidationError[];
|
|
1352
|
+
warnings: ValidationWarning[];
|
|
1353
|
+
coverage: {
|
|
1354
|
+
requirements: number;
|
|
1355
|
+
design: number;
|
|
1356
|
+
tasks: number;
|
|
1357
|
+
tests: number;
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
```
|
|
1361
|
+
|
|
1362
|
+
### C4Diagram
|
|
1363
|
+
|
|
1364
|
+
```typescript
|
|
1365
|
+
interface C4Diagram {
|
|
1366
|
+
id: string;
|
|
1367
|
+
type: 'context' | 'container' | 'component' | 'code';
|
|
1368
|
+
title: string;
|
|
1369
|
+
elements: C4Element[];
|
|
1370
|
+
relationships: C4Relationship[];
|
|
1371
|
+
}
|
|
1372
|
+
```
|
|
1373
|
+
|
|
1374
|
+
---
|
|
1375
|
+
|
|
1376
|
+
## Error Handling
|
|
1377
|
+
|
|
1378
|
+
All MUSUBIX functions follow a consistent error handling pattern:
|
|
1379
|
+
|
|
1380
|
+
```typescript
|
|
1381
|
+
import { MUSUBIXError, ErrorCode } from '@nahisaho/musubix-core';
|
|
1382
|
+
|
|
1383
|
+
try {
|
|
1384
|
+
const result = analyzer.analyze(text);
|
|
1385
|
+
} catch (error) {
|
|
1386
|
+
if (error instanceof MUSUBIXError) {
|
|
1387
|
+
console.error(`Error ${error.code}: ${error.message}`);
|
|
1388
|
+
// Handle specific error codes
|
|
1389
|
+
switch (error.code) {
|
|
1390
|
+
case ErrorCode.INVALID_REQUIREMENT:
|
|
1391
|
+
// Handle invalid requirement
|
|
1392
|
+
break;
|
|
1393
|
+
case ErrorCode.VALIDATION_FAILED:
|
|
1394
|
+
// Handle validation failure
|
|
1395
|
+
break;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
```
|
|
1400
|
+
|
|
1401
|
+
### Error Codes
|
|
1402
|
+
|
|
1403
|
+
| Code | Description |
|
|
1404
|
+
|------|-------------|
|
|
1405
|
+
| `INVALID_REQUIREMENT` | Requirement format is invalid |
|
|
1406
|
+
| `VALIDATION_FAILED` | Validation did not pass |
|
|
1407
|
+
| `TRACEABILITY_BROKEN` | Traceability link is broken |
|
|
1408
|
+
| `YATA_CONNECTION_ERROR` | Cannot connect to YATA |
|
|
1409
|
+
| `MCP_TRANSPORT_ERROR` | MCP transport error |
|
|
1410
|
+
|
|
1411
|
+
---
|
|
1412
|
+
|
|
1413
|
+
## Contributing
|
|
1414
|
+
|
|
1415
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
|
|
1416
|
+
|
|
1417
|
+
## License
|
|
1418
|
+
|
|
1419
|
+
MIT License - see [LICENSE](./LICENSE) for details.
|
|
1420
|
+
|
|
1421
|
+
---
|
|
1422
|
+
|
|
1423
|
+
**Version:** 1.7.0
|
|
1424
|
+
**Generated:** 2026-01-06
|
|
1425
|
+
**MUSUBIX Core Package**
|