musubix 1.0.1 → 1.0.3
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 +242 -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-steering.prompt.md +269 -0
- package/.github/prompts/sdd-tasks.prompt.md +255 -0
- package/.github/prompts/sdd-validate.prompt.md +304 -0
- package/.github/skills/musubix-code-generation/SKILL.md +229 -0
- package/.github/skills/musubix-ears-validation/SKILL.md +161 -0
- package/.github/skills/musubix-sdd-workflow/SKILL.md +137 -0
- package/AGENTS.md +286 -0
- package/docs/API-REFERENCE.md +633 -0
- package/docs/GITHUB-ACTIONS-NPM-SETUP.md +132 -0
- package/docs/INSTALL-GUIDE.ja.md +442 -0
- package/docs/INSTALL-GUIDE.md +442 -0
- package/docs/USER-GUIDE.ja.md +824 -0
- package/docs/USER-GUIDE.md +664 -0
- package/docs/evolution-from-musubi-to-musubix.md +764 -0
- package/package.json +11 -6
- package/steering/.musubi-version +1 -0
- package/steering/product.ja.md +572 -0
- package/steering/project.yml +38 -0
- package/steering/rules/constitution.md +412 -0
- package/steering/structure.ja.md +503 -0
- package/steering/tech.ja.md +42 -0
|
@@ -0,0 +1,633 @@
|
|
|
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
|
+
- [Validation](#validation)
|
|
15
|
+
- [Utils](#utils)
|
|
16
|
+
- [MCP Server](#mcp-server)
|
|
17
|
+
- [YATA Client](#yata-client)
|
|
18
|
+
- [Types Reference](#types-reference)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Overview
|
|
23
|
+
|
|
24
|
+
MUSUBIX is a neuro-symbolic AI system combining:
|
|
25
|
+
- **MUSUBI**: LLM-powered specification-driven development
|
|
26
|
+
- **YATA**: Knowledge graph for contextual reasoning
|
|
27
|
+
|
|
28
|
+
### Architecture
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
┌─────────────────────────────────────────────┐
|
|
32
|
+
│ MUSUBIX Core │
|
|
33
|
+
├─────────────────────────────────────────────┤
|
|
34
|
+
│ Requirements → Design → Tasks → Validation │
|
|
35
|
+
├─────────────────────────────────────────────┤
|
|
36
|
+
│ MCP Server (stdio/SSE) │
|
|
37
|
+
├─────────────────────────────────────────────┤
|
|
38
|
+
│ YATA Knowledge Graph │
|
|
39
|
+
└─────────────────────────────────────────────┘
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install @nahisaho/musubix-core
|
|
48
|
+
# or
|
|
49
|
+
pnpm add @nahisaho/musubix-core
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import {
|
|
58
|
+
createRequirementsAnalyzer,
|
|
59
|
+
createC4ModelGenerator,
|
|
60
|
+
createTaskGenerator,
|
|
61
|
+
createConstitutionalValidator
|
|
62
|
+
} from '@nahisaho/musubix-core';
|
|
63
|
+
|
|
64
|
+
// 1. Analyze requirements
|
|
65
|
+
const analyzer = createRequirementsAnalyzer();
|
|
66
|
+
const analysis = analyzer.analyze(requirementText);
|
|
67
|
+
|
|
68
|
+
// 2. Generate design
|
|
69
|
+
const c4Generator = createC4ModelGenerator();
|
|
70
|
+
const diagram = c4Generator.generateContext(systemSpec);
|
|
71
|
+
|
|
72
|
+
// 3. Create tasks
|
|
73
|
+
const taskGenerator = createTaskGenerator();
|
|
74
|
+
const tasks = taskGenerator.generate(requirements);
|
|
75
|
+
|
|
76
|
+
// 4. Validate
|
|
77
|
+
const validator = createConstitutionalValidator();
|
|
78
|
+
const result = validator.validate(artifact);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Core Modules
|
|
84
|
+
|
|
85
|
+
### Requirements
|
|
86
|
+
|
|
87
|
+
#### RequirementsAnalyzer
|
|
88
|
+
|
|
89
|
+
Analyzes and structures requirement specifications.
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { createRequirementsAnalyzer } from '@nahisaho/musubix-core';
|
|
93
|
+
|
|
94
|
+
const analyzer = createRequirementsAnalyzer({
|
|
95
|
+
strictMode: true,
|
|
96
|
+
validateEARS: true
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Analyze requirement text
|
|
100
|
+
const result = analyzer.analyze(requirementText);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Methods:**
|
|
104
|
+
|
|
105
|
+
| Method | Parameters | Returns | Description |
|
|
106
|
+
|--------|------------|---------|-------------|
|
|
107
|
+
| `analyze(text)` | `text: string` | `AnalysisResult` | Analyzes requirement text |
|
|
108
|
+
| `validateEARS(req)` | `req: Requirement` | `ValidationResult` | Validates EARS compliance |
|
|
109
|
+
| `extractRequirements(text)` | `text: string` | `Requirement[]` | Extracts requirements from text |
|
|
110
|
+
|
|
111
|
+
**Configuration:**
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
interface AnalyzerConfig {
|
|
115
|
+
strictMode?: boolean; // Enable strict validation
|
|
116
|
+
validateEARS?: boolean; // Validate EARS format
|
|
117
|
+
autoClassify?: boolean; // Auto-classify requirement types
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
#### RequirementsDecomposer
|
|
124
|
+
|
|
125
|
+
Decomposes complex requirements into smaller units.
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
import { createRequirementsDecomposer } from '@nahisaho/musubix-core';
|
|
129
|
+
|
|
130
|
+
const decomposer = createRequirementsDecomposer({
|
|
131
|
+
maxDepth: 4,
|
|
132
|
+
targetUnitSize: 4
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const result = decomposer.decompose(requirement, 'functional');
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Methods:**
|
|
139
|
+
|
|
140
|
+
| Method | Parameters | Returns | Description |
|
|
141
|
+
|--------|------------|---------|-------------|
|
|
142
|
+
| `decompose(req, strategy)` | `req: Requirement, strategy?: DecompositionStrategy` | `DecompositionResult` | Decomposes requirement |
|
|
143
|
+
| `analyzeComplexity(req)` | `req: Requirement` | `ComplexityLevel` | Analyzes requirement complexity |
|
|
144
|
+
| `exportMarkdown(result)` | `result: DecompositionResult` | `string` | Exports as Markdown |
|
|
145
|
+
|
|
146
|
+
**Decomposition Strategies:**
|
|
147
|
+
|
|
148
|
+
- `functional` - By function/feature
|
|
149
|
+
- `behavioral` - By behavior/scenario
|
|
150
|
+
- `structural` - By component/module
|
|
151
|
+
- `temporal` - By phase/timeline
|
|
152
|
+
- `stakeholder` - By stakeholder needs
|
|
153
|
+
- `risk-based` - By risk priority
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
#### RelatedRequirementsFinder
|
|
158
|
+
|
|
159
|
+
Finds related requirements using semantic similarity.
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
import { createRelatedRequirementsFinder } from '@nahisaho/musubix-core';
|
|
163
|
+
|
|
164
|
+
const finder = createRelatedRequirementsFinder({
|
|
165
|
+
similarityThreshold: 0.7,
|
|
166
|
+
maxResults: 10
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const related = finder.findRelated(requirement, allRequirements);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Methods:**
|
|
173
|
+
|
|
174
|
+
| Method | Parameters | Returns | Description |
|
|
175
|
+
|--------|------------|---------|-------------|
|
|
176
|
+
| `findRelated(req, all)` | `req: Requirement, all: Requirement[]` | `RelatedResult[]` | Finds related requirements |
|
|
177
|
+
| `clusterRequirements(reqs)` | `reqs: Requirement[]` | `Cluster[]` | Clusters requirements |
|
|
178
|
+
| `findGaps(reqs)` | `reqs: Requirement[]` | `Gap[]` | Identifies coverage gaps |
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
### Design
|
|
183
|
+
|
|
184
|
+
#### C4ModelGenerator
|
|
185
|
+
|
|
186
|
+
Generates C4 architecture diagrams.
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import { createC4ModelGenerator } from '@nahisaho/musubix-core';
|
|
190
|
+
|
|
191
|
+
const generator = createC4ModelGenerator({
|
|
192
|
+
defaultFormat: 'mermaid'
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
const contextDiagram = generator.generateContext(systemSpec);
|
|
196
|
+
const containerDiagram = generator.generateContainer(systemSpec);
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Methods:**
|
|
200
|
+
|
|
201
|
+
| Method | Parameters | Returns | Description |
|
|
202
|
+
|--------|------------|---------|-------------|
|
|
203
|
+
| `generateContext(spec)` | `spec: SystemSpec` | `C4Diagram` | Generates Context diagram |
|
|
204
|
+
| `generateContainer(spec)` | `spec: SystemSpec` | `C4Diagram` | Generates Container diagram |
|
|
205
|
+
| `generateComponent(container)` | `container: Container` | `C4Diagram` | Generates Component diagram |
|
|
206
|
+
| `export(diagram, format)` | `diagram: C4Diagram, format: ExportFormat` | `string` | Exports to format |
|
|
207
|
+
|
|
208
|
+
**Export Formats:**
|
|
209
|
+
|
|
210
|
+
- `structurizr` - Structurizr DSL
|
|
211
|
+
- `plantuml` - PlantUML syntax
|
|
212
|
+
- `mermaid` - Mermaid diagram
|
|
213
|
+
- `json` - JSON structure
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
#### ADRGenerator
|
|
218
|
+
|
|
219
|
+
Generates Architecture Decision Records.
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
import { createADRGenerator } from '@nahisaho/musubix-core';
|
|
223
|
+
|
|
224
|
+
const generator = createADRGenerator({
|
|
225
|
+
template: 'madr',
|
|
226
|
+
outputFormat: 'markdown'
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
const adr = generator.generate(decision);
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Methods:**
|
|
233
|
+
|
|
234
|
+
| Method | Parameters | Returns | Description |
|
|
235
|
+
|--------|------------|---------|-------------|
|
|
236
|
+
| `generate(decision)` | `decision: ADRInput` | `ADR` | Generates ADR |
|
|
237
|
+
| `listAll()` | - | `ADR[]` | Lists all ADRs |
|
|
238
|
+
| `export(adr, format)` | `adr: ADR, format: OutputFormat` | `string` | Exports ADR |
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
### Codegen
|
|
243
|
+
|
|
244
|
+
#### TaskGenerator
|
|
245
|
+
|
|
246
|
+
Generates implementation tasks from requirements.
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
import { createTaskGenerator } from '@nahisaho/musubix-core';
|
|
250
|
+
|
|
251
|
+
const generator = createTaskGenerator({
|
|
252
|
+
estimateEffort: true,
|
|
253
|
+
includeTests: true
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
const tasks = generator.generate(requirements);
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
**Methods:**
|
|
260
|
+
|
|
261
|
+
| Method | Parameters | Returns | Description |
|
|
262
|
+
|--------|------------|---------|-------------|
|
|
263
|
+
| `generate(reqs)` | `reqs: Requirement[]` | `Task[]` | Generates tasks |
|
|
264
|
+
| `estimateEffort(task)` | `task: Task` | `number` | Estimates hours |
|
|
265
|
+
| `prioritize(tasks)` | `tasks: Task[]` | `Task[]` | Prioritizes tasks |
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
#### CodingStandardsChecker
|
|
270
|
+
|
|
271
|
+
Validates code against coding standards.
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
import { createCodingStandardsChecker } from '@nahisaho/musubix-core';
|
|
275
|
+
|
|
276
|
+
const checker = createCodingStandardsChecker({
|
|
277
|
+
rules: ['naming', 'formatting', 'documentation']
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
const violations = checker.check(code, 'typescript');
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Methods:**
|
|
284
|
+
|
|
285
|
+
| Method | Parameters | Returns | Description |
|
|
286
|
+
|--------|------------|---------|-------------|
|
|
287
|
+
| `check(code, lang)` | `code: string, lang: Language` | `Violation[]` | Checks code |
|
|
288
|
+
| `fix(code, violations)` | `code: string, violations: Violation[]` | `string` | Auto-fixes violations |
|
|
289
|
+
| `report(violations)` | `violations: Violation[]` | `Report` | Generates report |
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
### Validation
|
|
294
|
+
|
|
295
|
+
#### ConstitutionalValidator
|
|
296
|
+
|
|
297
|
+
Validates artifacts against 9 Constitutional Articles.
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
import { createConstitutionalValidator } from '@nahisaho/musubix-core';
|
|
301
|
+
|
|
302
|
+
const validator = createConstitutionalValidator({
|
|
303
|
+
strictMode: true,
|
|
304
|
+
articles: ['all']
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
const result = validator.validate(artifact);
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**Methods:**
|
|
311
|
+
|
|
312
|
+
| Method | Parameters | Returns | Description |
|
|
313
|
+
|--------|------------|---------|-------------|
|
|
314
|
+
| `validate(artifact)` | `artifact: Artifact` | `ValidationResult` | Validates artifact |
|
|
315
|
+
| `checkArticle(artifact, article)` | `artifact: Artifact, article: Article` | `ArticleResult` | Checks specific article |
|
|
316
|
+
| `generateReport(results)` | `results: ValidationResult[]` | `Report` | Generates validation report |
|
|
317
|
+
|
|
318
|
+
**Constitutional Articles:**
|
|
319
|
+
|
|
320
|
+
| Article | Name | Description |
|
|
321
|
+
|---------|------|-------------|
|
|
322
|
+
| I | Project Memory | Maintain consistent project context |
|
|
323
|
+
| II | Requirements | Complete EARS specification |
|
|
324
|
+
| III | Design | C4 + ADR documentation |
|
|
325
|
+
| IV | Task Breakdown | Traceable task decomposition |
|
|
326
|
+
| V | Traceability | Bidirectional traceability |
|
|
327
|
+
| VI | Explainability | Transparent AI decisions |
|
|
328
|
+
| VII | Integration | Seamless workflow integration |
|
|
329
|
+
| VIII | Adaptability | Flexible methodologies |
|
|
330
|
+
| IX | Quality | Continuous quality assurance |
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
### Utils
|
|
335
|
+
|
|
336
|
+
#### I18nManager
|
|
337
|
+
|
|
338
|
+
Manages internationalization and localization.
|
|
339
|
+
|
|
340
|
+
```typescript
|
|
341
|
+
import { createI18nManager, t } from '@nahisaho/musubix-core';
|
|
342
|
+
|
|
343
|
+
const i18n = createI18nManager({
|
|
344
|
+
defaultLocale: 'en',
|
|
345
|
+
fallbackLocale: 'en'
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
i18n.setLocale('ja');
|
|
349
|
+
console.log(t('common.save')); // 保存
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**Methods:**
|
|
353
|
+
|
|
354
|
+
| Method | Parameters | Returns | Description |
|
|
355
|
+
|--------|------------|---------|-------------|
|
|
356
|
+
| `t(key, options)` | `key: string, options?: object` | `string` | Translate key |
|
|
357
|
+
| `tp(key, count)` | `key: string, count: number` | `string` | Translate with plural |
|
|
358
|
+
| `setLocale(locale)` | `locale: Locale` | `void` | Set current locale |
|
|
359
|
+
| `formatDate(date)` | `date: Date` | `string` | Format date |
|
|
360
|
+
| `formatNumber(num)` | `num: number` | `string` | Format number |
|
|
361
|
+
|
|
362
|
+
**Supported Locales:**
|
|
363
|
+
|
|
364
|
+
`en`, `ja`, `zh`, `ko`, `de`, `fr`, `es`, `pt`
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
#### StructuredLogger
|
|
369
|
+
|
|
370
|
+
Provides structured logging with multiple transports.
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
import { createLogger } from '@nahisaho/musubix-core';
|
|
374
|
+
|
|
375
|
+
const logger = createLogger({
|
|
376
|
+
level: 'info',
|
|
377
|
+
format: 'json'
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
logger.info('Operation completed', { duration: 150 });
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
**Methods:**
|
|
384
|
+
|
|
385
|
+
| Method | Parameters | Returns | Description |
|
|
386
|
+
|--------|------------|---------|-------------|
|
|
387
|
+
| `debug(msg, meta)` | `msg: string, meta?: object` | `void` | Debug log |
|
|
388
|
+
| `info(msg, meta)` | `msg: string, meta?: object` | `void` | Info log |
|
|
389
|
+
| `warn(msg, meta)` | `msg: string, meta?: object` | `void` | Warning log |
|
|
390
|
+
| `error(msg, meta)` | `msg: string, meta?: object` | `void` | Error log |
|
|
391
|
+
| `child(context)` | `context: object` | `Logger` | Create child logger |
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
#### PerformanceProfiler
|
|
396
|
+
|
|
397
|
+
Profiles and measures performance.
|
|
398
|
+
|
|
399
|
+
```typescript
|
|
400
|
+
import { createPerformanceProfiler } from '@nahisaho/musubix-core';
|
|
401
|
+
|
|
402
|
+
const profiler = createPerformanceProfiler();
|
|
403
|
+
|
|
404
|
+
profiler.start('operation');
|
|
405
|
+
// ... operation ...
|
|
406
|
+
const result = profiler.end('operation');
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**Methods:**
|
|
410
|
+
|
|
411
|
+
| Method | Parameters | Returns | Description |
|
|
412
|
+
|--------|------------|---------|-------------|
|
|
413
|
+
| `start(name)` | `name: string` | `void` | Start measurement |
|
|
414
|
+
| `end(name)` | `name: string` | `ProfileResult` | End measurement |
|
|
415
|
+
| `measure(name, fn)` | `name: string, fn: Function` | `ProfileResult` | Measure function |
|
|
416
|
+
| `getStats(name)` | `name: string` | `Statistics` | Get statistics |
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## MCP Server
|
|
421
|
+
|
|
422
|
+
### Starting the Server
|
|
423
|
+
|
|
424
|
+
```typescript
|
|
425
|
+
import { createMCPServer } from '@nahisaho/musubix-mcp-server';
|
|
426
|
+
|
|
427
|
+
const server = createMCPServer({
|
|
428
|
+
transport: 'stdio', // or 'sse'
|
|
429
|
+
capabilities: ['requirements', 'design', 'tasks', 'validation']
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
await server.start();
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Available Tools
|
|
436
|
+
|
|
437
|
+
| Tool | Description |
|
|
438
|
+
|------|-------------|
|
|
439
|
+
| `analyze_requirements` | Analyze requirement text |
|
|
440
|
+
| `generate_c4` | Generate C4 diagrams |
|
|
441
|
+
| `generate_adr` | Generate ADR documents |
|
|
442
|
+
| `generate_tasks` | Generate implementation tasks |
|
|
443
|
+
| `validate_artifact` | Validate against constitution |
|
|
444
|
+
| `query_knowledge` | Query YATA knowledge graph |
|
|
445
|
+
|
|
446
|
+
### Example Tool Call
|
|
447
|
+
|
|
448
|
+
```json
|
|
449
|
+
{
|
|
450
|
+
"tool": "analyze_requirements",
|
|
451
|
+
"arguments": {
|
|
452
|
+
"text": "The system shall...",
|
|
453
|
+
"options": {
|
|
454
|
+
"validateEARS": true
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## YATA Client
|
|
463
|
+
|
|
464
|
+
### Connecting to YATA
|
|
465
|
+
|
|
466
|
+
```typescript
|
|
467
|
+
import { createYATAClient } from '@nahisaho/musubix-yata-client';
|
|
468
|
+
|
|
469
|
+
const client = createYATAClient({
|
|
470
|
+
endpoint: 'http://localhost:8000',
|
|
471
|
+
apiKey: process.env.YATA_API_KEY
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
await client.connect();
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
### Operations
|
|
478
|
+
|
|
479
|
+
#### Query Knowledge
|
|
480
|
+
|
|
481
|
+
```typescript
|
|
482
|
+
const results = await client.query({
|
|
483
|
+
type: 'requirement',
|
|
484
|
+
filters: {
|
|
485
|
+
priority: 'must',
|
|
486
|
+
status: 'approved'
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
#### Store Knowledge
|
|
492
|
+
|
|
493
|
+
```typescript
|
|
494
|
+
await client.store({
|
|
495
|
+
type: 'design',
|
|
496
|
+
data: designDocument,
|
|
497
|
+
relations: [
|
|
498
|
+
{ type: 'implements', target: 'REQ-001' }
|
|
499
|
+
]
|
|
500
|
+
});
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
#### Link Entities
|
|
504
|
+
|
|
505
|
+
```typescript
|
|
506
|
+
await client.link({
|
|
507
|
+
source: 'TSK-001',
|
|
508
|
+
target: 'REQ-001',
|
|
509
|
+
type: 'implements'
|
|
510
|
+
});
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
## Types Reference
|
|
516
|
+
|
|
517
|
+
### Requirement
|
|
518
|
+
|
|
519
|
+
```typescript
|
|
520
|
+
interface Requirement {
|
|
521
|
+
id: string;
|
|
522
|
+
title: string;
|
|
523
|
+
description: string;
|
|
524
|
+
type: 'functional' | 'non-functional' | 'constraint';
|
|
525
|
+
priority: 'must' | 'should' | 'could' | 'wont';
|
|
526
|
+
status: 'draft' | 'approved' | 'implemented' | 'verified';
|
|
527
|
+
acceptanceCriteria: string[];
|
|
528
|
+
traceability: {
|
|
529
|
+
designRefs: string[];
|
|
530
|
+
taskRefs: string[];
|
|
531
|
+
testRefs: string[];
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Task
|
|
537
|
+
|
|
538
|
+
```typescript
|
|
539
|
+
interface Task {
|
|
540
|
+
id: string;
|
|
541
|
+
title: string;
|
|
542
|
+
description: string;
|
|
543
|
+
status: 'pending' | 'in-progress' | 'completed' | 'blocked';
|
|
544
|
+
requirementRef: string;
|
|
545
|
+
designRef?: string;
|
|
546
|
+
estimatedHours: number;
|
|
547
|
+
actualHours?: number;
|
|
548
|
+
assignee?: string;
|
|
549
|
+
tags: string[];
|
|
550
|
+
}
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
### ValidationResult
|
|
554
|
+
|
|
555
|
+
```typescript
|
|
556
|
+
interface ValidationResult {
|
|
557
|
+
valid: boolean;
|
|
558
|
+
score: number;
|
|
559
|
+
errors: ValidationError[];
|
|
560
|
+
warnings: ValidationWarning[];
|
|
561
|
+
coverage: {
|
|
562
|
+
requirements: number;
|
|
563
|
+
design: number;
|
|
564
|
+
tasks: number;
|
|
565
|
+
tests: number;
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
### C4Diagram
|
|
571
|
+
|
|
572
|
+
```typescript
|
|
573
|
+
interface C4Diagram {
|
|
574
|
+
id: string;
|
|
575
|
+
type: 'context' | 'container' | 'component' | 'code';
|
|
576
|
+
title: string;
|
|
577
|
+
elements: C4Element[];
|
|
578
|
+
relationships: C4Relationship[];
|
|
579
|
+
}
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## Error Handling
|
|
585
|
+
|
|
586
|
+
All MUSUBIX functions follow a consistent error handling pattern:
|
|
587
|
+
|
|
588
|
+
```typescript
|
|
589
|
+
import { MUSUBIXError, ErrorCode } from '@nahisaho/musubix-core';
|
|
590
|
+
|
|
591
|
+
try {
|
|
592
|
+
const result = analyzer.analyze(text);
|
|
593
|
+
} catch (error) {
|
|
594
|
+
if (error instanceof MUSUBIXError) {
|
|
595
|
+
console.error(`Error ${error.code}: ${error.message}`);
|
|
596
|
+
// Handle specific error codes
|
|
597
|
+
switch (error.code) {
|
|
598
|
+
case ErrorCode.INVALID_REQUIREMENT:
|
|
599
|
+
// Handle invalid requirement
|
|
600
|
+
break;
|
|
601
|
+
case ErrorCode.VALIDATION_FAILED:
|
|
602
|
+
// Handle validation failure
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
### Error Codes
|
|
610
|
+
|
|
611
|
+
| Code | Description |
|
|
612
|
+
|------|-------------|
|
|
613
|
+
| `INVALID_REQUIREMENT` | Requirement format is invalid |
|
|
614
|
+
| `VALIDATION_FAILED` | Validation did not pass |
|
|
615
|
+
| `TRACEABILITY_BROKEN` | Traceability link is broken |
|
|
616
|
+
| `YATA_CONNECTION_ERROR` | Cannot connect to YATA |
|
|
617
|
+
| `MCP_TRANSPORT_ERROR` | MCP transport error |
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
## Contributing
|
|
622
|
+
|
|
623
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
|
|
624
|
+
|
|
625
|
+
## License
|
|
626
|
+
|
|
627
|
+
MIT License - see [LICENSE](./LICENSE) for details.
|
|
628
|
+
|
|
629
|
+
---
|
|
630
|
+
|
|
631
|
+
**Version:** 1.0.0
|
|
632
|
+
**Generated:** 2024
|
|
633
|
+
**MUSUBIX Core Package**
|