musubix 1.0.0 → 1.0.2
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/README.ja.md +3 -2
- package/README.md +3 -1
- 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 +10 -3
- 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,250 @@
|
|
|
1
|
+
# MUSUBIX Design Command
|
|
2
|
+
|
|
3
|
+
Generate technical design from requirements using C4 model.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Instructions for AI Agent
|
|
8
|
+
|
|
9
|
+
You are executing the `musubix design [feature-name]` command to create a technical design specification.
|
|
10
|
+
|
|
11
|
+
### Command Format
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx musubix design generate requirements.md
|
|
15
|
+
npx musubix design patterns context
|
|
16
|
+
npx musubix design validate design.md
|
|
17
|
+
npx musubix design c4 design.md
|
|
18
|
+
npx musubix design adr decision
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Your Task
|
|
22
|
+
|
|
23
|
+
Generate a comprehensive technical design that implements the requirements while adhering to constitutional governance.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Process
|
|
28
|
+
|
|
29
|
+
### 1. Read Context (Article VI)
|
|
30
|
+
|
|
31
|
+
**CRITICAL**: Read these files BEFORE designing:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Steering Context
|
|
35
|
+
steering/structure.ja.md # Architecture patterns to follow
|
|
36
|
+
steering/tech.ja.md # Technology stack (TypeScript, Node.js 20+)
|
|
37
|
+
steering/product.ja.md # Product goals and users
|
|
38
|
+
|
|
39
|
+
# Requirements
|
|
40
|
+
storage/specs/REQ-{{FEATURE}}-001.md # What to implement
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### 2. Verify Requirements Exist
|
|
46
|
+
|
|
47
|
+
**If NOT found**:
|
|
48
|
+
|
|
49
|
+
```markdown
|
|
50
|
+
❌ **Requirements file not found**
|
|
51
|
+
|
|
52
|
+
Expected: storage/specs/REQ-{{FEATURE}}-001.md
|
|
53
|
+
|
|
54
|
+
Please run `npx musubix requirements analyze {{feature}}` first.
|
|
55
|
+
|
|
56
|
+
Design cannot proceed without requirements (Article V: Traceability).
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### 3. Generate Design Document (C4 Model)
|
|
62
|
+
|
|
63
|
+
**Output**: `storage/specs/DES-{{FEATURE}}-001.md`
|
|
64
|
+
|
|
65
|
+
#### A. Context Diagram (Level 1)
|
|
66
|
+
|
|
67
|
+
- System boundary
|
|
68
|
+
- External users
|
|
69
|
+
- External systems
|
|
70
|
+
|
|
71
|
+
#### B. Container Diagram (Level 2)
|
|
72
|
+
|
|
73
|
+
MUSUBIX architecture:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
┌─────────────────────────────────────────────────────────┐
|
|
77
|
+
│ MUSUBIX System │
|
|
78
|
+
│ │
|
|
79
|
+
│ ┌─────────────────┐ ┌─────────────────┐ │
|
|
80
|
+
│ │ @nahisaho/ │ │ @nahisaho/ │ │
|
|
81
|
+
│ │ musubix-core │←→│ musubix-mcp- │ │
|
|
82
|
+
│ │ │ │ server │ │
|
|
83
|
+
│ └────────┬────────┘ └────────┬────────┘ │
|
|
84
|
+
│ │ │ │
|
|
85
|
+
│ │ ┌───────────────┘ │
|
|
86
|
+
│ │ │ │
|
|
87
|
+
│ ▼ ▼ │
|
|
88
|
+
│ ┌─────────────────┐ │
|
|
89
|
+
│ │ @nahisaho/ │ │
|
|
90
|
+
│ │ musubix-yata- │ │
|
|
91
|
+
│ │ client │ │
|
|
92
|
+
│ └─────────────────┘ │
|
|
93
|
+
└─────────────────────────────────────────────────────────┘
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### C. Component Diagram (Level 3)
|
|
97
|
+
|
|
98
|
+
For packages/core/:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
packages/core/src/
|
|
102
|
+
├── auth/ # Authentication & Authorization
|
|
103
|
+
├── cli/ # CLI Interface (Article II)
|
|
104
|
+
├── codegen/ # Code Generation & Analysis
|
|
105
|
+
├── design/ # Design Patterns & C4 Models
|
|
106
|
+
├── error/ # Error Handling
|
|
107
|
+
├── explanation/ # Explanation Generation
|
|
108
|
+
├── requirements/ # Requirements Analysis
|
|
109
|
+
├── traceability/ # Traceability
|
|
110
|
+
├── types/ # Type Definitions
|
|
111
|
+
├── utils/ # Utilities
|
|
112
|
+
└── validators/ # EARS Validation
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### 4. Requirements Mapping (Article V)
|
|
118
|
+
|
|
119
|
+
**CRITICAL**: Map EVERY requirement to design decisions.
|
|
120
|
+
|
|
121
|
+
```markdown
|
|
122
|
+
| Component | Requirements | Design Rationale |
|
|
123
|
+
|-----------|--------------|------------------|
|
|
124
|
+
| CLI | REQ-CLI-001 | Command interface |
|
|
125
|
+
| Validator | REQ-EARS-001 | EARS pattern validation |
|
|
126
|
+
| MCP Server | REQ-MCP-001 | Tool/prompt exposure |
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### 5. API Design
|
|
132
|
+
|
|
133
|
+
For CLI commands:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// packages/core/src/cli/commands/{{feature}}.ts
|
|
137
|
+
|
|
138
|
+
export interface {{Feature}}Options {
|
|
139
|
+
input: string;
|
|
140
|
+
output?: string;
|
|
141
|
+
format?: 'json' | 'markdown';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export async function {{feature}}Command(options: {{Feature}}Options): Promise<void> {
|
|
145
|
+
// REQ-{{COMPONENT}}-001: [Requirement title]
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
For MCP tools:
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
// packages/mcp-server/src/tools/{{feature}}-tools.ts
|
|
153
|
+
|
|
154
|
+
export const {{feature}}Tool: ToolDefinition = {
|
|
155
|
+
name: 'sdd_{{feature}}',
|
|
156
|
+
description: '{{Feature description}}',
|
|
157
|
+
inputSchema: {
|
|
158
|
+
type: 'object',
|
|
159
|
+
properties: {
|
|
160
|
+
// ...
|
|
161
|
+
},
|
|
162
|
+
required: ['...'],
|
|
163
|
+
},
|
|
164
|
+
handler: async (args) => {
|
|
165
|
+
// REQ-{{COMPONENT}}-001
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### 6. Design Document Template
|
|
173
|
+
|
|
174
|
+
```markdown
|
|
175
|
+
# Design Document: {{FEATURE_NAME}}
|
|
176
|
+
|
|
177
|
+
**Document ID**: DES-{{FEATURE}}-001
|
|
178
|
+
**Version**: 1.0.0
|
|
179
|
+
**Date**: {{DATE}}
|
|
180
|
+
**Requirements**: REQ-{{FEATURE}}-001
|
|
181
|
+
|
|
182
|
+
## Overview
|
|
183
|
+
|
|
184
|
+
- **Purpose**: [Design purpose]
|
|
185
|
+
- **Package**: packages/core/ | packages/mcp-server/ | packages/yata-client/
|
|
186
|
+
|
|
187
|
+
## C4 Model
|
|
188
|
+
|
|
189
|
+
### Level 1: Context
|
|
190
|
+
[Context diagram]
|
|
191
|
+
|
|
192
|
+
### Level 2: Container
|
|
193
|
+
[Container diagram]
|
|
194
|
+
|
|
195
|
+
### Level 3: Component
|
|
196
|
+
[Component diagram]
|
|
197
|
+
|
|
198
|
+
## Requirements Traceability
|
|
199
|
+
|
|
200
|
+
| Requirement | Component | Implementation |
|
|
201
|
+
|-------------|-----------|----------------|
|
|
202
|
+
| REQ-XXX-001 | cli/commands/{{feature}}.ts | {{Feature}}Command |
|
|
203
|
+
|
|
204
|
+
## API Design
|
|
205
|
+
|
|
206
|
+
### CLI Interface (Article II)
|
|
207
|
+
|
|
208
|
+
\`\`\`bash
|
|
209
|
+
npx musubix {{feature}} [options]
|
|
210
|
+
\`\`\`
|
|
211
|
+
|
|
212
|
+
### TypeScript Interface
|
|
213
|
+
|
|
214
|
+
\`\`\`typescript
|
|
215
|
+
export interface {{Feature}}Options {
|
|
216
|
+
// ...
|
|
217
|
+
}
|
|
218
|
+
\`\`\`
|
|
219
|
+
|
|
220
|
+
## ADR (Architecture Decision Records)
|
|
221
|
+
|
|
222
|
+
### ADR-001: [Decision Title]
|
|
223
|
+
|
|
224
|
+
**Status**: Accepted
|
|
225
|
+
**Context**: [Why was this decision needed?]
|
|
226
|
+
**Decision**: [What was decided?]
|
|
227
|
+
**Consequences**: [What are the results?]
|
|
228
|
+
|
|
229
|
+
## Traceability
|
|
230
|
+
|
|
231
|
+
- **Requirements**: REQ-{{FEATURE}}-001
|
|
232
|
+
- **Tasks**: TSK-{{FEATURE}}-001
|
|
233
|
+
- **Tests**: packages/core/__tests__/unit/{{feature}}.test.ts
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
### 7. MCP Tool Integration
|
|
239
|
+
|
|
240
|
+
Use MUSUBIX MCP tools:
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
sdd_create_design - Create design document
|
|
244
|
+
sdd_validate_design - Validate traceability
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
**MUSUBIX**: https://github.com/nahisaho/MUSUBIX
|
|
250
|
+
**Version**: 1.0.0
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
# MUSUBIX Implement Command
|
|
2
|
+
|
|
3
|
+
Execute implementation tasks for a feature following Test-First principles.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Instructions for AI Agent
|
|
8
|
+
|
|
9
|
+
You are executing the `musubix implement [feature-name]` command to implement a feature following SDD workflow.
|
|
10
|
+
|
|
11
|
+
### Command Format
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx musubix implement authentication
|
|
15
|
+
npx musubix codegen generate design.md
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Your Task
|
|
19
|
+
|
|
20
|
+
Implement the feature by executing tasks from the task breakdown document, following Test-First principles (Article III) and constitutional governance.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Process
|
|
25
|
+
|
|
26
|
+
### 1. Read All Context
|
|
27
|
+
|
|
28
|
+
**CRITICAL**: Read these files first:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Task Breakdown
|
|
32
|
+
storage/specs/TSK-{{FEATURE}}-001.md
|
|
33
|
+
|
|
34
|
+
# Design
|
|
35
|
+
storage/specs/DES-{{FEATURE}}-001.md
|
|
36
|
+
|
|
37
|
+
# Requirements
|
|
38
|
+
storage/specs/REQ-{{FEATURE}}-001.md
|
|
39
|
+
|
|
40
|
+
# Steering Context
|
|
41
|
+
steering/structure.ja.md
|
|
42
|
+
steering/tech.ja.md
|
|
43
|
+
steering/product.ja.md
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### 2. Verify Prerequisites
|
|
49
|
+
|
|
50
|
+
**Check task breakdown exists**:
|
|
51
|
+
|
|
52
|
+
```markdown
|
|
53
|
+
❌ **Error**: Task breakdown not found
|
|
54
|
+
|
|
55
|
+
Expected: storage/specs/TSK-{{FEATURE}}-001.md
|
|
56
|
+
|
|
57
|
+
Please run `npx musubix tasks generate` first.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### 3. Use Todo Tracking
|
|
63
|
+
|
|
64
|
+
Track implementation progress:
|
|
65
|
+
|
|
66
|
+
```markdown
|
|
67
|
+
1. TSK-001: Set Up Package Structure
|
|
68
|
+
2. TSK-002: Write Tests (RED)
|
|
69
|
+
3. TSK-003: Implement Code (GREEN)
|
|
70
|
+
4. TSK-004: Refactor (BLUE)
|
|
71
|
+
5. TSK-005: CLI Interface (Article II)
|
|
72
|
+
6. TSK-006: MCP Tool (if needed)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### 4. Execute Tasks in Order
|
|
78
|
+
|
|
79
|
+
#### TSK-001: Set Up Package Structure
|
|
80
|
+
|
|
81
|
+
**Create structure in appropriate package**:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
packages/core/src/{{feature}}/
|
|
85
|
+
├── index.ts # Public API exports
|
|
86
|
+
├── service.ts # Business logic
|
|
87
|
+
├── types.ts # TypeScript types
|
|
88
|
+
└── errors.ts # Custom errors
|
|
89
|
+
|
|
90
|
+
packages/core/__tests__/
|
|
91
|
+
├── unit/
|
|
92
|
+
│ └── {{feature}}.test.ts
|
|
93
|
+
└── integration/
|
|
94
|
+
└── {{feature}}.integration.test.ts
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Create public API**:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
// packages/core/src/{{feature}}/index.ts
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* {{Feature}} Module
|
|
104
|
+
*
|
|
105
|
+
* @see REQ-{{COMPONENT}}-001
|
|
106
|
+
* @see DES-{{FEATURE}}-001
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
export { {{Feature}}Service } from './service.js';
|
|
110
|
+
export type { {{Feature}}Options, {{Feature}}Result } from './types.js';
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Create types**:
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
// packages/core/src/{{feature}}/types.ts
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @see REQ-{{COMPONENT}}-001
|
|
120
|
+
*/
|
|
121
|
+
export interface {{Feature}}Options {
|
|
122
|
+
input: string;
|
|
123
|
+
output?: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface {{Feature}}Result {
|
|
127
|
+
success: boolean;
|
|
128
|
+
data?: unknown;
|
|
129
|
+
error?: string;
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
#### TSK-002: Write Tests (RED Phase) 🔴
|
|
136
|
+
|
|
137
|
+
**CRITICAL (Article III)**: Tests BEFORE implementation.
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
// packages/core/__tests__/unit/{{feature}}.test.ts
|
|
141
|
+
|
|
142
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
143
|
+
import { {{Feature}}Service } from '../../src/{{feature}}/index.js';
|
|
144
|
+
|
|
145
|
+
describe('REQ-{{COMPONENT}}-001: {{Requirement Title}}', () => {
|
|
146
|
+
let service: {{Feature}}Service;
|
|
147
|
+
|
|
148
|
+
beforeEach(() => {
|
|
149
|
+
service = new {{Feature}}Service();
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// Acceptance Criterion 1
|
|
153
|
+
it('should [acceptance criterion 1]', async () => {
|
|
154
|
+
// Arrange
|
|
155
|
+
const input = { /* ... */ };
|
|
156
|
+
|
|
157
|
+
// Act
|
|
158
|
+
const result = await service.process(input);
|
|
159
|
+
|
|
160
|
+
// Assert
|
|
161
|
+
expect(result.success).toBe(true);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// Acceptance Criterion 2
|
|
165
|
+
it('should handle errors gracefully', async () => {
|
|
166
|
+
// Arrange
|
|
167
|
+
const invalidInput = { /* ... */ };
|
|
168
|
+
|
|
169
|
+
// Act & Assert
|
|
170
|
+
await expect(service.process(invalidInput)).rejects.toThrow();
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Run tests** (should FAIL):
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
npm test packages/core/__tests__/unit/{{feature}}.test.ts
|
|
179
|
+
# Expected: Tests FAIL (service.ts doesn't exist yet)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
#### TSK-003: Implement Code (GREEN Phase) 💚
|
|
185
|
+
|
|
186
|
+
**Create minimal implementation**:
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
// packages/core/src/{{feature}}/service.ts
|
|
190
|
+
|
|
191
|
+
import type { {{Feature}}Options, {{Feature}}Result } from './types.js';
|
|
192
|
+
import { ValidationError } from './errors.js';
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* {{Feature}} Service
|
|
196
|
+
*
|
|
197
|
+
* @see REQ-{{COMPONENT}}-001
|
|
198
|
+
* @see DES-{{FEATURE}}-001
|
|
199
|
+
*/
|
|
200
|
+
export class {{Feature}}Service {
|
|
201
|
+
/**
|
|
202
|
+
* Process {{feature}} request
|
|
203
|
+
*
|
|
204
|
+
* Acceptance Criteria:
|
|
205
|
+
* - [Criterion 1]
|
|
206
|
+
* - [Criterion 2]
|
|
207
|
+
*/
|
|
208
|
+
async process(options: {{Feature}}Options): Promise<{{Feature}}Result> {
|
|
209
|
+
// Validate input
|
|
210
|
+
this.validate(options);
|
|
211
|
+
|
|
212
|
+
// Process
|
|
213
|
+
const result = await this.execute(options);
|
|
214
|
+
|
|
215
|
+
return {
|
|
216
|
+
success: true,
|
|
217
|
+
data: result,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
private validate(options: {{Feature}}Options): void {
|
|
222
|
+
if (!options.input) {
|
|
223
|
+
throw new ValidationError('input is required');
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
private async execute(options: {{Feature}}Options): Promise<unknown> {
|
|
228
|
+
// Minimal implementation
|
|
229
|
+
return { processed: true };
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Run tests** (should PASS):
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npm test packages/core/__tests__/unit/{{feature}}.test.ts
|
|
238
|
+
# Expected: Tests PASS ✅
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
#### TSK-004: Refactor (BLUE Phase) 💙
|
|
244
|
+
|
|
245
|
+
**Improve code while keeping tests green**:
|
|
246
|
+
|
|
247
|
+
- Extract validators
|
|
248
|
+
- Add proper error handling
|
|
249
|
+
- Apply SOLID principles
|
|
250
|
+
- Improve naming
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
npm test packages/core/__tests__/unit/{{feature}}.test.ts
|
|
254
|
+
# Expected: Tests still PASS ✅
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
#### TSK-005: CLI Command (Article II)
|
|
260
|
+
|
|
261
|
+
**Create CLI command**:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
// packages/core/src/cli/commands/{{feature}}.ts
|
|
265
|
+
|
|
266
|
+
import type { Command } from 'commander';
|
|
267
|
+
import { {{Feature}}Service } from '../../{{feature}}/index.js';
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Register {{feature}} command
|
|
271
|
+
*
|
|
272
|
+
* @see REQ-CLI-001
|
|
273
|
+
* @see Article II: CLI Interface Mandate
|
|
274
|
+
*/
|
|
275
|
+
export function register{{Feature}}Command(program: Command): void {
|
|
276
|
+
program
|
|
277
|
+
.command('{{feature}}')
|
|
278
|
+
.description('{{Feature description}}')
|
|
279
|
+
.argument('<input>', 'Input file or value')
|
|
280
|
+
.option('-o, --output <path>', 'Output path')
|
|
281
|
+
.option('--json', 'Output as JSON')
|
|
282
|
+
.action(async (input, options) => {
|
|
283
|
+
const service = new {{Feature}}Service();
|
|
284
|
+
const result = await service.process({ input, ...options });
|
|
285
|
+
|
|
286
|
+
if (options.json) {
|
|
287
|
+
console.log(JSON.stringify(result, null, 2));
|
|
288
|
+
} else {
|
|
289
|
+
console.log(result);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Register in CLI**:
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
// packages/core/src/cli/index.ts
|
|
299
|
+
|
|
300
|
+
import { register{{Feature}}Command } from './commands/{{feature}}.js';
|
|
301
|
+
|
|
302
|
+
// In setupCommands function:
|
|
303
|
+
register{{Feature}}Command(program);
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
#### TSK-006: MCP Tool (if needed)
|
|
309
|
+
|
|
310
|
+
**Create MCP tool**:
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
// packages/mcp-server/src/tools/{{feature}}-tools.ts
|
|
314
|
+
|
|
315
|
+
import type { ToolDefinition, ToolResult } from '../types.js';
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* {{Feature}} Tool
|
|
319
|
+
*
|
|
320
|
+
* @see REQ-MCP-001
|
|
321
|
+
*/
|
|
322
|
+
export const {{feature}}Tool: ToolDefinition = {
|
|
323
|
+
name: 'sdd_{{feature}}',
|
|
324
|
+
description: '{{Feature description}}',
|
|
325
|
+
inputSchema: {
|
|
326
|
+
type: 'object',
|
|
327
|
+
properties: {
|
|
328
|
+
input: {
|
|
329
|
+
type: 'string',
|
|
330
|
+
description: 'Input value',
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
required: ['input'],
|
|
334
|
+
},
|
|
335
|
+
handler: async (args): Promise<ToolResult> => {
|
|
336
|
+
const { input } = args as { input: string };
|
|
337
|
+
|
|
338
|
+
// Implementation
|
|
339
|
+
return {
|
|
340
|
+
content: [{ type: 'text', text: `Processed: ${input}` }],
|
|
341
|
+
};
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
### 5. Validation Commands
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
# Run all tests
|
|
352
|
+
npm test
|
|
353
|
+
|
|
354
|
+
# Type check
|
|
355
|
+
npm run typecheck
|
|
356
|
+
|
|
357
|
+
# Lint
|
|
358
|
+
npm run lint
|
|
359
|
+
|
|
360
|
+
# Build
|
|
361
|
+
npm run build
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
### 6. Git Workflow
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
# RED phase
|
|
370
|
+
git add packages/core/__tests__/
|
|
371
|
+
git commit -m "test: add failing tests for REQ-{{COMPONENT}}-001"
|
|
372
|
+
|
|
373
|
+
# GREEN phase
|
|
374
|
+
git add packages/core/src/{{feature}}/
|
|
375
|
+
git commit -m "feat: implement REQ-{{COMPONENT}}-001"
|
|
376
|
+
|
|
377
|
+
# BLUE phase
|
|
378
|
+
git commit -m "refactor: improve {{feature}} implementation"
|
|
379
|
+
|
|
380
|
+
# CLI
|
|
381
|
+
git commit -m "feat: add {{feature}} CLI command (Article II)"
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
**MUSUBIX**: https://github.com/nahisaho/MUSUBIX
|
|
387
|
+
**Version**: 1.0.0
|