musubi-sdd 5.1.0 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/README.ja.md +106 -48
  2. package/README.md +110 -32
  3. package/bin/musubi-analyze.js +74 -67
  4. package/bin/musubi-browser.js +27 -26
  5. package/bin/musubi-change.js +48 -47
  6. package/bin/musubi-checkpoint.js +10 -7
  7. package/bin/musubi-convert.js +25 -25
  8. package/bin/musubi-costs.js +27 -10
  9. package/bin/musubi-gui.js +52 -46
  10. package/bin/musubi-init.js +1952 -10
  11. package/bin/musubi-orchestrate.js +327 -239
  12. package/bin/musubi-remember.js +69 -56
  13. package/bin/musubi-resolve.js +53 -45
  14. package/bin/musubi-trace.js +51 -22
  15. package/bin/musubi-validate.js +39 -30
  16. package/bin/musubi-workflow.js +33 -34
  17. package/bin/musubi.js +39 -2
  18. package/package.json +1 -1
  19. package/src/agents/agent-loop.js +94 -95
  20. package/src/agents/agentic/code-generator.js +119 -109
  21. package/src/agents/agentic/code-reviewer.js +105 -108
  22. package/src/agents/agentic/index.js +4 -4
  23. package/src/agents/browser/action-executor.js +13 -13
  24. package/src/agents/browser/ai-comparator.js +11 -10
  25. package/src/agents/browser/context-manager.js +6 -6
  26. package/src/agents/browser/index.js +5 -5
  27. package/src/agents/browser/nl-parser.js +31 -46
  28. package/src/agents/browser/screenshot.js +2 -2
  29. package/src/agents/browser/test-generator.js +6 -4
  30. package/src/agents/function-tool.js +71 -65
  31. package/src/agents/index.js +7 -7
  32. package/src/agents/schema-generator.js +98 -94
  33. package/src/analyzers/ast-extractor.js +158 -146
  34. package/src/analyzers/codegraph-auto-update.js +858 -0
  35. package/src/analyzers/complexity-analyzer.js +536 -0
  36. package/src/analyzers/context-optimizer.js +241 -126
  37. package/src/analyzers/impact-analyzer.js +1 -1
  38. package/src/analyzers/large-project-analyzer.js +766 -0
  39. package/src/analyzers/repository-map.js +77 -81
  40. package/src/analyzers/security-analyzer.js +19 -11
  41. package/src/analyzers/stuck-detector.js +19 -17
  42. package/src/converters/index.js +78 -57
  43. package/src/converters/ir/types.js +12 -12
  44. package/src/converters/parsers/musubi-parser.js +134 -126
  45. package/src/converters/parsers/openapi-parser.js +70 -53
  46. package/src/converters/parsers/speckit-parser.js +239 -175
  47. package/src/converters/writers/musubi-writer.js +123 -118
  48. package/src/converters/writers/speckit-writer.js +124 -113
  49. package/src/generators/rust-migration-generator.js +512 -0
  50. package/src/gui/public/index.html +1365 -1211
  51. package/src/gui/server.js +41 -40
  52. package/src/gui/services/file-watcher.js +23 -8
  53. package/src/gui/services/project-scanner.js +26 -20
  54. package/src/gui/services/replanning-service.js +27 -23
  55. package/src/gui/services/traceability-service.js +8 -8
  56. package/src/gui/services/workflow-service.js +14 -7
  57. package/src/index.js +151 -0
  58. package/src/integrations/cicd.js +90 -104
  59. package/src/integrations/codegraph-mcp.js +643 -0
  60. package/src/integrations/documentation.js +142 -103
  61. package/src/integrations/examples.js +95 -80
  62. package/src/integrations/github-client.js +17 -17
  63. package/src/integrations/index.js +5 -5
  64. package/src/integrations/mcp/index.js +21 -21
  65. package/src/integrations/mcp/mcp-context-provider.js +76 -78
  66. package/src/integrations/mcp/mcp-discovery.js +74 -72
  67. package/src/integrations/mcp/mcp-tool-registry.js +99 -94
  68. package/src/integrations/mcp-connector.js +70 -66
  69. package/src/integrations/platforms.js +50 -49
  70. package/src/integrations/tool-discovery.js +37 -31
  71. package/src/llm-providers/anthropic-provider.js +11 -11
  72. package/src/llm-providers/base-provider.js +16 -18
  73. package/src/llm-providers/copilot-provider.js +22 -19
  74. package/src/llm-providers/index.js +26 -25
  75. package/src/llm-providers/ollama-provider.js +11 -11
  76. package/src/llm-providers/openai-provider.js +12 -12
  77. package/src/managers/agent-memory.js +36 -24
  78. package/src/managers/checkpoint-manager.js +4 -8
  79. package/src/managers/delta-spec.js +19 -19
  80. package/src/managers/index.js +13 -4
  81. package/src/managers/memory-condenser.js +35 -45
  82. package/src/managers/repo-skill-manager.js +57 -31
  83. package/src/managers/skill-loader.js +25 -22
  84. package/src/managers/skill-tools.js +36 -72
  85. package/src/managers/workflow.js +30 -22
  86. package/src/monitoring/cost-tracker.js +48 -46
  87. package/src/monitoring/incident-manager.js +116 -106
  88. package/src/monitoring/index.js +144 -134
  89. package/src/monitoring/observability.js +75 -62
  90. package/src/monitoring/quality-dashboard.js +45 -41
  91. package/src/monitoring/release-manager.js +63 -53
  92. package/src/orchestration/agent-skill-binding.js +39 -47
  93. package/src/orchestration/error-handler.js +65 -107
  94. package/src/orchestration/guardrails/base-guardrail.js +26 -24
  95. package/src/orchestration/guardrails/guardrail-rules.js +50 -64
  96. package/src/orchestration/guardrails/index.js +5 -5
  97. package/src/orchestration/guardrails/input-guardrail.js +58 -45
  98. package/src/orchestration/guardrails/output-guardrail.js +104 -81
  99. package/src/orchestration/guardrails/safety-check.js +79 -79
  100. package/src/orchestration/index.js +38 -55
  101. package/src/orchestration/mcp-tool-adapters.js +96 -99
  102. package/src/orchestration/orchestration-engine.js +21 -21
  103. package/src/orchestration/pattern-registry.js +60 -45
  104. package/src/orchestration/patterns/auto.js +34 -47
  105. package/src/orchestration/patterns/group-chat.js +59 -65
  106. package/src/orchestration/patterns/handoff.js +67 -65
  107. package/src/orchestration/patterns/human-in-loop.js +51 -72
  108. package/src/orchestration/patterns/nested.js +25 -40
  109. package/src/orchestration/patterns/sequential.js +35 -34
  110. package/src/orchestration/patterns/swarm.js +63 -56
  111. package/src/orchestration/patterns/triage.js +150 -109
  112. package/src/orchestration/reasoning/index.js +9 -9
  113. package/src/orchestration/reasoning/planning-engine.js +143 -140
  114. package/src/orchestration/reasoning/reasoning-engine.js +206 -144
  115. package/src/orchestration/reasoning/self-correction.js +121 -128
  116. package/src/orchestration/replanning/adaptive-goal-modifier.js +107 -112
  117. package/src/orchestration/replanning/alternative-generator.js +37 -42
  118. package/src/orchestration/replanning/config.js +63 -59
  119. package/src/orchestration/replanning/goal-progress-tracker.js +98 -100
  120. package/src/orchestration/replanning/index.js +24 -20
  121. package/src/orchestration/replanning/plan-evaluator.js +49 -50
  122. package/src/orchestration/replanning/plan-monitor.js +32 -28
  123. package/src/orchestration/replanning/proactive-path-optimizer.js +175 -178
  124. package/src/orchestration/replanning/replan-history.js +33 -26
  125. package/src/orchestration/replanning/replanning-engine.js +106 -108
  126. package/src/orchestration/skill-executor.js +107 -109
  127. package/src/orchestration/skill-registry.js +85 -89
  128. package/src/orchestration/workflow-examples.js +228 -231
  129. package/src/orchestration/workflow-executor.js +65 -68
  130. package/src/orchestration/workflow-orchestrator.js +72 -73
  131. package/src/phase4-integration.js +47 -40
  132. package/src/phase5-integration.js +89 -30
  133. package/src/reporters/coverage-report.js +82 -30
  134. package/src/reporters/hierarchical-reporter.js +498 -0
  135. package/src/reporters/traceability-matrix-report.js +29 -20
  136. package/src/resolvers/issue-resolver.js +43 -31
  137. package/src/steering/advanced-validation.js +133 -124
  138. package/src/steering/auto-updater.js +60 -73
  139. package/src/steering/index.js +6 -6
  140. package/src/steering/quality-metrics.js +41 -35
  141. package/src/steering/steering-auto-update.js +83 -86
  142. package/src/steering/steering-validator.js +98 -106
  143. package/src/steering/template-constraints.js +53 -54
  144. package/src/templates/agents/claude-code/CLAUDE.md +32 -32
  145. package/src/templates/agents/claude-code/skills/agent-assistant/SKILL.md +13 -5
  146. package/src/templates/agents/claude-code/skills/ai-ml-engineer/mlops-guide.md +23 -23
  147. package/src/templates/agents/claude-code/skills/ai-ml-engineer/model-card-template.md +60 -41
  148. package/src/templates/agents/claude-code/skills/api-designer/api-patterns.md +27 -19
  149. package/src/templates/agents/claude-code/skills/api-designer/openapi-template.md +11 -7
  150. package/src/templates/agents/claude-code/skills/bug-hunter/SKILL.md +4 -3
  151. package/src/templates/agents/claude-code/skills/bug-hunter/root-cause-analysis.md +37 -15
  152. package/src/templates/agents/claude-code/skills/change-impact-analyzer/dependency-graph-patterns.md +36 -42
  153. package/src/templates/agents/claude-code/skills/change-impact-analyzer/impact-analysis-template.md +69 -60
  154. package/src/templates/agents/claude-code/skills/cloud-architect/aws-patterns.md +31 -38
  155. package/src/templates/agents/claude-code/skills/cloud-architect/azure-patterns.md +28 -23
  156. package/src/templates/agents/claude-code/skills/code-reviewer/SKILL.md +61 -0
  157. package/src/templates/agents/claude-code/skills/code-reviewer/best-practices.md +27 -0
  158. package/src/templates/agents/claude-code/skills/code-reviewer/review-checklist.md +29 -10
  159. package/src/templates/agents/claude-code/skills/code-reviewer/review-standards.md +29 -24
  160. package/src/templates/agents/claude-code/skills/constitution-enforcer/SKILL.md +8 -6
  161. package/src/templates/agents/claude-code/skills/constitution-enforcer/constitutional-articles.md +62 -26
  162. package/src/templates/agents/claude-code/skills/constitution-enforcer/phase-minus-one-gates.md +35 -16
  163. package/src/templates/agents/claude-code/skills/database-administrator/backup-recovery.md +27 -17
  164. package/src/templates/agents/claude-code/skills/database-administrator/tuning-guide.md +25 -20
  165. package/src/templates/agents/claude-code/skills/database-schema-designer/schema-patterns.md +39 -22
  166. package/src/templates/agents/claude-code/skills/devops-engineer/ci-cd-templates.md +25 -22
  167. package/src/templates/agents/claude-code/skills/issue-resolver/SKILL.md +24 -21
  168. package/src/templates/agents/claude-code/skills/orchestrator/SKILL.md +148 -63
  169. package/src/templates/agents/claude-code/skills/orchestrator/patterns.md +35 -16
  170. package/src/templates/agents/claude-code/skills/orchestrator/selection-matrix.md +69 -64
  171. package/src/templates/agents/claude-code/skills/performance-engineer/optimization-playbook.md +47 -47
  172. package/src/templates/agents/claude-code/skills/performance-optimizer/SKILL.md +69 -0
  173. package/src/templates/agents/claude-code/skills/performance-optimizer/benchmark-template.md +63 -45
  174. package/src/templates/agents/claude-code/skills/performance-optimizer/optimization-patterns.md +33 -35
  175. package/src/templates/agents/claude-code/skills/project-manager/SKILL.md +7 -6
  176. package/src/templates/agents/claude-code/skills/project-manager/agile-ceremonies.md +47 -28
  177. package/src/templates/agents/claude-code/skills/project-manager/project-templates.md +94 -78
  178. package/src/templates/agents/claude-code/skills/quality-assurance/SKILL.md +20 -17
  179. package/src/templates/agents/claude-code/skills/quality-assurance/qa-plan-template.md +63 -49
  180. package/src/templates/agents/claude-code/skills/release-coordinator/SKILL.md +5 -5
  181. package/src/templates/agents/claude-code/skills/release-coordinator/feature-flag-guide.md +30 -26
  182. package/src/templates/agents/claude-code/skills/release-coordinator/release-plan-template.md +67 -35
  183. package/src/templates/agents/claude-code/skills/requirements-analyst/ears-format.md +54 -42
  184. package/src/templates/agents/claude-code/skills/requirements-analyst/validation-rules.md +36 -33
  185. package/src/templates/agents/claude-code/skills/security-auditor/SKILL.md +77 -19
  186. package/src/templates/agents/claude-code/skills/security-auditor/audit-checklists.md +24 -24
  187. package/src/templates/agents/claude-code/skills/security-auditor/owasp-top-10.md +61 -20
  188. package/src/templates/agents/claude-code/skills/security-auditor/vulnerability-patterns.md +43 -11
  189. package/src/templates/agents/claude-code/skills/site-reliability-engineer/SKILL.md +1 -0
  190. package/src/templates/agents/claude-code/skills/site-reliability-engineer/incident-response-template.md +55 -25
  191. package/src/templates/agents/claude-code/skills/site-reliability-engineer/observability-patterns.md +78 -68
  192. package/src/templates/agents/claude-code/skills/site-reliability-engineer/slo-sli-guide.md +73 -53
  193. package/src/templates/agents/claude-code/skills/software-developer/solid-principles.md +83 -37
  194. package/src/templates/agents/claude-code/skills/software-developer/test-first-workflow.md +38 -31
  195. package/src/templates/agents/claude-code/skills/steering/SKILL.md +1 -0
  196. package/src/templates/agents/claude-code/skills/steering/auto-update-rules.md +31 -0
  197. package/src/templates/agents/claude-code/skills/system-architect/adr-template.md +25 -7
  198. package/src/templates/agents/claude-code/skills/system-architect/c4-model-guide.md +74 -61
  199. package/src/templates/agents/claude-code/skills/technical-writer/doc-templates/documentation-templates.md +70 -52
  200. package/src/templates/agents/claude-code/skills/test-engineer/SKILL.md +2 -0
  201. package/src/templates/agents/claude-code/skills/test-engineer/ears-test-mapping.md +75 -71
  202. package/src/templates/agents/claude-code/skills/test-engineer/test-types.md +85 -63
  203. package/src/templates/agents/claude-code/skills/traceability-auditor/coverage-matrix-template.md +39 -36
  204. package/src/templates/agents/claude-code/skills/traceability-auditor/gap-detection-rules.md +22 -17
  205. package/src/templates/agents/claude-code/skills/ui-ux-designer/SKILL.md +1 -0
  206. package/src/templates/agents/claude-code/skills/ui-ux-designer/accessibility-guidelines.md +49 -75
  207. package/src/templates/agents/claude-code/skills/ui-ux-designer/design-system-components.md +71 -59
  208. package/src/templates/agents/codex/AGENTS.md +74 -42
  209. package/src/templates/agents/cursor/AGENTS.md +74 -42
  210. package/src/templates/agents/gemini-cli/GEMINI.md +74 -42
  211. package/src/templates/agents/github-copilot/AGENTS.md +83 -51
  212. package/src/templates/agents/qwen-code/QWEN.md +74 -42
  213. package/src/templates/agents/windsurf/AGENTS.md +74 -42
  214. package/src/templates/architectures/README.md +41 -0
  215. package/src/templates/architectures/clean-architecture/README.md +113 -0
  216. package/src/templates/architectures/event-driven/README.md +162 -0
  217. package/src/templates/architectures/hexagonal/README.md +130 -0
  218. package/src/templates/index.js +6 -1
  219. package/src/templates/locale-manager.js +16 -16
  220. package/src/templates/shared/delta-spec-template.md +20 -13
  221. package/src/templates/shared/github-actions/musubi-issue-resolver.yml +5 -5
  222. package/src/templates/shared/github-actions/musubi-security-check.yml +3 -3
  223. package/src/templates/shared/github-actions/musubi-validate.yml +4 -4
  224. package/src/templates/shared/steering/structure.md +95 -0
  225. package/src/templates/skills/browser-agent.md +21 -16
  226. package/src/templates/skills/web-gui.md +8 -0
  227. package/src/templates/template-constraints.js +50 -53
  228. package/src/validators/advanced-validation.js +30 -36
  229. package/src/validators/constitutional-validator.js +77 -73
  230. package/src/validators/critic-system.js +49 -59
  231. package/src/validators/delta-format.js +59 -55
  232. package/src/validators/traceability-validator.js +7 -11
@@ -30,21 +30,25 @@ Confidence: ◀── High ───────────────── L
30
30
  ## Unit Tests
31
31
 
32
32
  ### Purpose
33
+
33
34
  Test individual units (functions, methods, classes) in isolation.
34
35
 
35
36
  ### Characteristics
37
+
36
38
  - Fast execution (milliseconds)
37
39
  - Dependencies are mocked
38
40
  - Test single behavior per test
39
41
  - High code coverage
40
42
 
41
43
  ### When to Use
44
+
42
45
  - Testing business logic
43
46
  - Testing algorithms
44
47
  - Testing edge cases
45
48
  - Testing error handling
46
49
 
47
50
  ### Example
51
+
48
52
  ```typescript
49
53
  // tests/services/calculator.test.ts
50
54
  describe('Calculator', () => {
@@ -53,12 +57,12 @@ describe('Calculator', () => {
53
57
  const calc = new Calculator();
54
58
  expect(calc.add(2, 3)).toBe(5);
55
59
  });
56
-
60
+
57
61
  it('should handle negative numbers', () => {
58
62
  const calc = new Calculator();
59
63
  expect(calc.add(-2, 3)).toBe(1);
60
64
  });
61
-
65
+
62
66
  it('should return 0 when adding number to its negative', () => {
63
67
  const calc = new Calculator();
64
68
  expect(calc.add(5, -5)).toBe(0);
@@ -68,6 +72,7 @@ describe('Calculator', () => {
68
72
  ```
69
73
 
70
74
  ### Best Practices
75
+
71
76
  - One assertion per test (when practical)
72
77
  - Use descriptive test names
73
78
  - Follow AAA pattern (Arrange, Act, Assert)
@@ -78,66 +83,66 @@ describe('Calculator', () => {
78
83
  ## Integration Tests
79
84
 
80
85
  ### Purpose
86
+
81
87
  Test how multiple components work together.
82
88
 
83
89
  ### Characteristics
90
+
84
91
  - Medium speed (seconds)
85
92
  - Uses real or test databases
86
93
  - Tests component interactions
87
94
  - Validates data flow
88
95
 
89
96
  ### When to Use
97
+
90
98
  - Testing API endpoints
91
99
  - Testing database operations
92
100
  - Testing service interactions
93
101
  - Testing middleware chains
94
102
 
95
103
  ### Example
104
+
96
105
  ```typescript
97
106
  // tests/integration/auth.test.ts
98
107
  describe('Authentication Flow', () => {
99
108
  let app: Express;
100
109
  let db: TestDatabase;
101
-
110
+
102
111
  beforeAll(async () => {
103
112
  db = await TestDatabase.connect();
104
113
  app = createApp({ database: db });
105
114
  });
106
-
115
+
107
116
  afterAll(async () => {
108
117
  await db.disconnect();
109
118
  });
110
-
119
+
111
120
  describe('POST /api/auth/login', () => {
112
121
  it('should authenticate user and return token', async () => {
113
122
  // Arrange
114
123
  await db.createUser({
115
124
  email: 'test@example.com',
116
- password: 'hashed_password'
125
+ password: 'hashed_password',
117
126
  });
118
-
127
+
119
128
  // Act
120
- const response = await request(app)
121
- .post('/api/auth/login')
122
- .send({
123
- email: 'test@example.com',
124
- password: 'password123'
125
- });
126
-
129
+ const response = await request(app).post('/api/auth/login').send({
130
+ email: 'test@example.com',
131
+ password: 'password123',
132
+ });
133
+
127
134
  // Assert
128
135
  expect(response.status).toBe(200);
129
136
  expect(response.body.token).toBeDefined();
130
137
  expect(response.body.user.email).toBe('test@example.com');
131
138
  });
132
-
139
+
133
140
  it('should reject invalid credentials', async () => {
134
- const response = await request(app)
135
- .post('/api/auth/login')
136
- .send({
137
- email: 'test@example.com',
138
- password: 'wrongpassword'
139
- });
140
-
141
+ const response = await request(app).post('/api/auth/login').send({
142
+ email: 'test@example.com',
143
+ password: 'wrongpassword',
144
+ });
145
+
141
146
  expect(response.status).toBe(401);
142
147
  expect(response.body.error).toBe('Invalid credentials');
143
148
  });
@@ -146,6 +151,7 @@ describe('Authentication Flow', () => {
146
151
  ```
147
152
 
148
153
  ### Best Practices
154
+
149
155
  - Use test database (not production)
150
156
  - Clean database between tests
151
157
  - Test both success and error paths
@@ -156,51 +162,55 @@ describe('Authentication Flow', () => {
156
162
  ## End-to-End (E2E) Tests
157
163
 
158
164
  ### Purpose
165
+
159
166
  Test complete user journeys through the application.
160
167
 
161
168
  ### Characteristics
169
+
162
170
  - Slow execution (minutes)
163
171
  - Uses real browser/environment
164
172
  - Tests full system
165
173
  - Highest confidence
166
174
 
167
175
  ### When to Use
176
+
168
177
  - Critical user journeys
169
178
  - Happy path validation
170
179
  - Regression testing
171
180
  - Pre-release verification
172
181
 
173
182
  ### Example
183
+
174
184
  ```typescript
175
185
  // tests/e2e/checkout.test.ts
176
186
  describe('Checkout Flow', () => {
177
187
  it('should complete purchase successfully', async () => {
178
188
  // Navigate to product
179
189
  await page.goto('/products/123');
180
-
190
+
181
191
  // Add to cart
182
192
  await page.click('[data-testid="add-to-cart"]');
183
-
193
+
184
194
  // Go to cart
185
195
  await page.click('[data-testid="cart-icon"]');
186
196
  expect(await page.textContent('.cart-count')).toBe('1');
187
-
197
+
188
198
  // Proceed to checkout
189
199
  await page.click('[data-testid="checkout-button"]');
190
-
200
+
191
201
  // Fill shipping info
192
202
  await page.fill('[name="address"]', '123 Main St');
193
203
  await page.fill('[name="city"]', 'New York');
194
204
  await page.fill('[name="zip"]', '10001');
195
-
205
+
196
206
  // Fill payment info
197
207
  await page.fill('[name="cardNumber"]', '4111111111111111');
198
208
  await page.fill('[name="expiry"]', '12/25');
199
209
  await page.fill('[name="cvv"]', '123');
200
-
210
+
201
211
  // Complete order
202
212
  await page.click('[data-testid="place-order"]');
203
-
213
+
204
214
  // Verify success
205
215
  await page.waitForSelector('.order-confirmation');
206
216
  expect(await page.textContent('.order-number')).toMatch(/ORD-\d+/);
@@ -209,6 +219,7 @@ describe('Checkout Flow', () => {
209
219
  ```
210
220
 
211
221
  ### Best Practices
222
+
212
223
  - Focus on critical paths
213
224
  - Keep tests minimal (expensive to run)
214
225
  - Use stable selectors (data-testid)
@@ -219,15 +230,18 @@ describe('Checkout Flow', () => {
219
230
  ## Component Tests (Frontend)
220
231
 
221
232
  ### Purpose
233
+
222
234
  Test React/Vue/Angular components in isolation.
223
235
 
224
236
  ### Characteristics
237
+
225
238
  - Fast execution
226
239
  - Tests rendering and interactions
227
240
  - Mocks external services
228
241
  - Uses testing library
229
242
 
230
243
  ### Example
244
+
231
245
  ```typescript
232
246
  // tests/components/LoginForm.test.tsx
233
247
  import { render, screen, fireEvent } from '@testing-library/react';
@@ -236,16 +250,16 @@ import { LoginForm } from './LoginForm';
236
250
  describe('LoginForm', () => {
237
251
  it('should render email and password fields', () => {
238
252
  render(<LoginForm onSubmit={jest.fn()} />);
239
-
253
+
240
254
  expect(screen.getByLabelText('Email')).toBeInTheDocument();
241
255
  expect(screen.getByLabelText('Password')).toBeInTheDocument();
242
256
  expect(screen.getByRole('button', { name: 'Login' })).toBeInTheDocument();
243
257
  });
244
-
258
+
245
259
  it('should call onSubmit with form data', async () => {
246
260
  const handleSubmit = jest.fn();
247
261
  render(<LoginForm onSubmit={handleSubmit} />);
248
-
262
+
249
263
  fireEvent.change(screen.getByLabelText('Email'), {
250
264
  target: { value: 'test@example.com' }
251
265
  });
@@ -253,21 +267,21 @@ describe('LoginForm', () => {
253
267
  target: { value: 'password123' }
254
268
  });
255
269
  fireEvent.click(screen.getByRole('button', { name: 'Login' }));
256
-
270
+
257
271
  expect(handleSubmit).toHaveBeenCalledWith({
258
272
  email: 'test@example.com',
259
273
  password: 'password123'
260
274
  });
261
275
  });
262
-
276
+
263
277
  it('should show validation error for invalid email', async () => {
264
278
  render(<LoginForm onSubmit={jest.fn()} />);
265
-
279
+
266
280
  fireEvent.change(screen.getByLabelText('Email'), {
267
281
  target: { value: 'invalid-email' }
268
282
  });
269
283
  fireEvent.blur(screen.getByLabelText('Email'));
270
-
284
+
271
285
  expect(await screen.findByText('Invalid email format')).toBeInTheDocument();
272
286
  });
273
287
  });
@@ -278,26 +292,29 @@ describe('LoginForm', () => {
278
292
  ## Contract Tests
279
293
 
280
294
  ### Purpose
295
+
281
296
  Verify API contracts between services.
282
297
 
283
298
  ### Characteristics
299
+
284
300
  - Tests API schema compliance
285
301
  - Uses Pact or similar
286
302
  - Consumer-driven contracts
287
303
  - Prevents breaking changes
288
304
 
289
305
  ### Example
306
+
290
307
  ```typescript
291
308
  // tests/contracts/user-api.pact.ts
292
309
  describe('User API Contract', () => {
293
310
  const provider = new Pact({
294
311
  consumer: 'WebApp',
295
- provider: 'UserService'
312
+ provider: 'UserService',
296
313
  });
297
-
314
+
298
315
  beforeAll(() => provider.setup());
299
316
  afterAll(() => provider.finalize());
300
-
317
+
301
318
  describe('GET /users/:id', () => {
302
319
  it('should return user by ID', async () => {
303
320
  // Define expected interaction
@@ -306,21 +323,21 @@ describe('User API Contract', () => {
306
323
  uponReceiving: 'a request for user 123',
307
324
  withRequest: {
308
325
  method: 'GET',
309
- path: '/users/123'
326
+ path: '/users/123',
310
327
  },
311
328
  willRespondWith: {
312
329
  status: 200,
313
330
  body: {
314
331
  id: '123',
315
332
  name: like('John Doe'),
316
- email: like('john@example.com')
317
- }
318
- }
333
+ email: like('john@example.com'),
334
+ },
335
+ },
319
336
  });
320
-
337
+
321
338
  // Execute request
322
339
  const response = await userClient.getUser('123');
323
-
340
+
324
341
  // Verify
325
342
  expect(response.id).toBe('123');
326
343
  await provider.verify();
@@ -334,15 +351,18 @@ describe('User API Contract', () => {
334
351
  ## Performance Tests
335
352
 
336
353
  ### Purpose
354
+
337
355
  Verify system performance under load.
338
356
 
339
357
  ### Characteristics
358
+
340
359
  - Tests response times
341
360
  - Tests throughput
342
361
  - Tests under stress
343
362
  - Identifies bottlenecks
344
363
 
345
364
  ### Example (k6)
365
+
346
366
  ```javascript
347
367
  // tests/performance/api-load.js
348
368
  import http from 'k6/http';
@@ -350,26 +370,26 @@ import { check, sleep } from 'k6';
350
370
 
351
371
  export const options = {
352
372
  stages: [
353
- { duration: '30s', target: 20 }, // Ramp up
354
- { duration: '1m', target: 20 }, // Stay at 20
355
- { duration: '30s', target: 50 }, // Ramp up more
356
- { duration: '1m', target: 50 }, // Stay at 50
357
- { duration: '30s', target: 0 }, // Ramp down
373
+ { duration: '30s', target: 20 }, // Ramp up
374
+ { duration: '1m', target: 20 }, // Stay at 20
375
+ { duration: '30s', target: 50 }, // Ramp up more
376
+ { duration: '1m', target: 50 }, // Stay at 50
377
+ { duration: '30s', target: 0 }, // Ramp down
358
378
  ],
359
379
  thresholds: {
360
- http_req_duration: ['p(95)<200'], // 95% < 200ms
361
- http_req_failed: ['rate<0.01'], // <1% errors
380
+ http_req_duration: ['p(95)<200'], // 95% < 200ms
381
+ http_req_failed: ['rate<0.01'], // <1% errors
362
382
  },
363
383
  };
364
384
 
365
- export default function() {
385
+ export default function () {
366
386
  const response = http.get('http://api.example.com/users');
367
-
387
+
368
388
  check(response, {
369
- 'status is 200': (r) => r.status === 200,
370
- 'response time < 200ms': (r) => r.timings.duration < 200,
389
+ 'status is 200': r => r.status === 200,
390
+ 'response time < 200ms': r => r.timings.duration < 200,
371
391
  });
372
-
392
+
373
393
  sleep(1);
374
394
  }
375
395
  ```
@@ -379,6 +399,7 @@ export default function() {
379
399
  ## Test Naming Convention
380
400
 
381
401
  ### Format
402
+
382
403
  ```
383
404
  describe('[Subject]', () => {
384
405
  describe('[Method/Action]', () => {
@@ -388,16 +409,17 @@ describe('[Subject]', () => {
388
409
  ```
389
410
 
390
411
  ### Examples
412
+
391
413
  ```typescript
392
414
  // Good names
393
- it('should return user when credentials are valid')
394
- it('should throw InvalidCredentialsError when password is wrong')
395
- it('should send welcome email when user registers')
415
+ it('should return user when credentials are valid');
416
+ it('should throw InvalidCredentialsError when password is wrong');
417
+ it('should send welcome email when user registers');
396
418
 
397
419
  // Bad names
398
- it('test login')
399
- it('works')
400
- it('should work correctly')
420
+ it('test login');
421
+ it('works');
422
+ it('should work correctly');
401
423
  ```
402
424
 
403
425
  ---
@@ -17,42 +17,45 @@ Template for creating traceability coverage matrices that ensure 100% compliance
17
17
 
18
18
  ## Forward Traceability (Requirements → Implementation)
19
19
 
20
- | REQ ID | Description | Design Ref | Task ID | Code Files | Test Files | Status |
21
- |--------|-------------|------------|---------|------------|------------|--------|
22
- | REQ-001 | User login | AUTH-SVC | P1-001 | auth/login.ts | auth/login.test.ts | ✅ |
23
- | REQ-002 | Password reset | AUTH-SVC | P1-002 | auth/reset.ts | auth/reset.test.ts | ✅ |
24
- | REQ-003 | 2FA support | AUTH-SVC | - | - | - | ❌ |
20
+ | REQ ID | Description | Design Ref | Task ID | Code Files | Test Files | Status |
21
+ | ------- | -------------- | ---------- | ------- | ------------- | ------------------ | ------ |
22
+ | REQ-001 | User login | AUTH-SVC | P1-001 | auth/login.ts | auth/login.test.ts | ✅ |
23
+ | REQ-002 | Password reset | AUTH-SVC | P1-002 | auth/reset.ts | auth/reset.test.ts | ✅ |
24
+ | REQ-003 | 2FA support | AUTH-SVC | - | - | - | ❌ |
25
25
 
26
26
  ## Backward Traceability (Tests → Requirements)
27
27
 
28
- | Test ID | Test Description | Code File | REQ ID | Status |
29
- |---------|-----------------|-----------|--------|--------|
30
- | T-001 | Login success | auth/login.ts | REQ-001 | ✅ |
31
- | T-002 | Login failure | auth/login.ts | REQ-001 | ✅ |
32
- | T-003 | Session timeout | auth/session.ts | - | ⚠️ Orphan |
28
+ | Test ID | Test Description | Code File | REQ ID | Status |
29
+ | ------- | ---------------- | --------------- | ------- | --------- |
30
+ | T-001 | Login success | auth/login.ts | REQ-001 | ✅ |
31
+ | T-002 | Login failure | auth/login.ts | REQ-001 | ✅ |
32
+ | T-003 | Session timeout | auth/session.ts | - | ⚠️ Orphan |
33
33
 
34
34
  ## Coverage Summary
35
35
 
36
- | Metric | Current | Target | Status |
37
- |--------|---------|--------|--------|
38
- | Requirements with Design | 100% | 100% | ✅ |
39
- | Requirements with Code | 67% | 100% | ❌ |
40
- | Requirements with Tests | 67% | 100% | ❌ |
41
- | Overall Traceability | 67% | 100% | ❌ |
36
+ | Metric | Current | Target | Status |
37
+ | ------------------------ | ------- | ------ | ------ |
38
+ | Requirements with Design | 100% | 100% | ✅ |
39
+ | Requirements with Code | 67% | 100% | ❌ |
40
+ | Requirements with Tests | 67% | 100% | ❌ |
41
+ | Overall Traceability | 67% | 100% | ❌ |
42
42
 
43
43
  ## Gaps Identified
44
44
 
45
45
  ### Missing Implementations
46
- | REQ ID | Description | Action Required |
47
- |--------|-------------|-----------------|
46
+
47
+ | REQ ID | Description | Action Required |
48
+ | ------- | ----------- | --------------------- |
48
49
  | REQ-003 | 2FA support | Create design & tasks |
49
50
 
50
51
  ### Orphaned Tests
51
- | Test ID | Description | Action Required |
52
- |---------|-------------|-----------------|
53
- | T-003 | Session timeout | Add requirement or remove |
52
+
53
+ | Test ID | Description | Action Required |
54
+ | ------- | --------------- | ------------------------- |
55
+ | T-003 | Session timeout | Add requirement or remove |
54
56
 
55
57
  ## Recommendations
58
+
56
59
  1. Implement REQ-003 or mark as deferred
57
60
  2. Create requirement for session timeout test
58
61
  ```
@@ -68,12 +71,12 @@ Template for creating traceability coverage matrices that ensure 100% compliance
68
71
 
69
72
  📊 **Overall: 67%** ❌ (Target: 100%)
70
73
 
71
- | Stage | Coverage |
72
- |-------|----------|
73
- | REQ → Design | ████████░░ 80% |
74
+ | Stage | Coverage |
75
+ | -------------- | --------------- |
76
+ | REQ → Design | ████████░░ 80% |
74
77
  | Design → Tasks | ██████████ 100% |
75
- | Tasks → Code | ██████░░░░ 60% |
76
- | Code → Tests | ████████░░ 80% |
78
+ | Tasks → Code | ██████░░░░ 60% |
79
+ | Code → Tests | ████████░░ 80% |
77
80
 
78
81
  ## Critical Gaps
79
82
 
@@ -95,13 +98,13 @@ Template for creating traceability coverage matrices that ensure 100% compliance
95
98
 
96
99
  def generate_traceability_matrix(feature_name):
97
100
  """Generate traceability matrix for a feature."""
98
-
101
+
99
102
  requirements = parse_requirements(f"storage/features/{feature_name}/requirements.md")
100
103
  design = parse_design(f"storage/features/{feature_name}/design.md")
101
104
  tasks = parse_tasks(f"storage/features/{feature_name}/tasks.md")
102
105
  code_files = find_code_files(f"src/{feature_name}/")
103
106
  test_files = find_test_files(f"tests/{feature_name}/")
104
-
107
+
105
108
  matrix = []
106
109
  for req in requirements:
107
110
  row = {
@@ -114,7 +117,7 @@ def generate_traceability_matrix(feature_name):
114
117
  'status': calculate_status(row)
115
118
  }
116
119
  matrix.append(row)
117
-
120
+
118
121
  return matrix
119
122
  ```
120
123
 
@@ -122,10 +125,10 @@ def generate_traceability_matrix(feature_name):
122
125
 
123
126
  ## Status Indicators
124
127
 
125
- | Icon | Meaning |
126
- |------|---------|
127
- | ✅ | Fully traced |
128
- | ⚠️ | Partially traced |
129
- | ❌ | Not traced |
130
- | 🔄 | In progress |
131
- | ⏸️ | Deferred |
128
+ | Icon | Meaning |
129
+ | ---- | ---------------- |
130
+ | ✅ | Fully traced |
131
+ | ⚠️ | Partially traced |
132
+ | ❌ | Not traced |
133
+ | 🔄 | In progress |
134
+ | ⏸️ | Deferred |
@@ -13,10 +13,11 @@ Rules for detecting traceability gaps in MUSUBI SDD projects.
13
13
  **Definition**: Requirements with no design, code, or tests.
14
14
 
15
15
  **Detection Rule**:
16
+
16
17
  ```python
17
18
  for req in requirements:
18
19
  if req.id not in design.references:
19
- report_gap("orphaned_requirement", req.id,
20
+ report_gap("orphaned_requirement", req.id,
20
21
  "Requirement not referenced in design")
21
22
  ```
22
23
 
@@ -27,6 +28,7 @@ for req in requirements:
27
28
  **Definition**: Tests with no corresponding requirement.
28
29
 
29
30
  **Detection Rule**:
31
+
30
32
  ```python
31
33
  for test in tests:
32
34
  if not has_requirement_reference(test):
@@ -41,6 +43,7 @@ for test in tests:
41
43
  **Definition**: Source files with no test coverage.
42
44
 
43
45
  **Detection Rule**:
46
+
44
47
  ```python
45
48
  for src_file in source_files:
46
49
  test_file = get_corresponding_test(src_file)
@@ -56,6 +59,7 @@ for src_file in source_files:
56
59
  **Definition**: Tasks with no code.
57
60
 
58
61
  **Detection Rule**:
62
+
59
63
  ```python
60
64
  for task in tasks:
61
65
  if not exists(task.target_file):
@@ -70,6 +74,7 @@ for task in tasks:
70
74
  **Definition**: References to non-existent items.
71
75
 
72
76
  **Detection Rule**:
77
+
73
78
  ```python
74
79
  for ref in all_references:
75
80
  if not exists(ref.target):
@@ -112,7 +117,7 @@ done < /tmp/reqs.txt
112
117
  for src_file in src/**/*.ts; do
113
118
  test_file="${src_file/src\//tests/}"
114
119
  test_file="${test_file/.ts/.test.ts}"
115
-
120
+
116
121
  if [ ! -f "$test_file" ]; then
117
122
  echo "UNTESTED: $src_file"
118
123
  fi
@@ -132,27 +137,27 @@ done
132
137
 
133
138
  ## Summary
134
139
 
135
- | Gap Type | Count | Severity |
136
- |----------|-------|----------|
137
- | Orphaned Requirements | 2 | 🔴 Critical |
138
- | Orphaned Tests | 1 | 🟠 Warning |
139
- | Untested Code | 3 | 🔴 Critical |
140
- | Broken References | 0 | - |
140
+ | Gap Type | Count | Severity |
141
+ | --------------------- | ----- | ----------- |
142
+ | Orphaned Requirements | 2 | 🔴 Critical |
143
+ | Orphaned Tests | 1 | 🟠 Warning |
144
+ | Untested Code | 3 | 🔴 Critical |
145
+ | Broken References | 0 | - |
141
146
 
142
147
  ## Detailed Gaps
143
148
 
144
149
  ### Orphaned Requirements
145
150
 
146
- | REQ ID | Description | Recommended Action |
147
- |--------|-------------|-------------------|
148
- | REQ-003 | 2FA login | Add to design or defer |
149
- | REQ-007 | Email notify | Add to design |
151
+ | REQ ID | Description | Recommended Action |
152
+ | ------- | ------------ | ---------------------- |
153
+ | REQ-003 | 2FA login | Add to design or defer |
154
+ | REQ-007 | Email notify | Add to design |
150
155
 
151
156
  ### Untested Code
152
157
 
153
- | File | Functions | Action |
154
- |------|-----------|--------|
155
- | src/auth/otp.ts | generateOTP | Create tests |
158
+ | File | Functions | Action |
159
+ | ------------------- | ------------ | ------------ |
160
+ | src/auth/otp.ts | generateOTP | Create tests |
156
161
  | src/user/profile.ts | updateAvatar | Create tests |
157
162
 
158
163
  ## Resolution Plan
@@ -178,14 +183,14 @@ class GapDetector:
178
183
  def __init__(self, feature_path):
179
184
  self.feature_path = feature_path
180
185
  self.gaps = []
181
-
186
+
182
187
  def detect_all(self):
183
188
  self.detect_orphaned_requirements()
184
189
  self.detect_orphaned_tests()
185
190
  self.detect_untested_code()
186
191
  self.detect_broken_references()
187
192
  return self.gaps
188
-
193
+
189
194
  def get_report(self):
190
195
  return {
191
196
  "feature": self.feature_path,
@@ -50,6 +50,7 @@ musubi-browser generate-test --history ./user-flow.json --output tests/e2e/user-
50
50
  ```
51
51
 
52
52
  **UI/UXテストに活用**:
53
+
53
54
  - ワイヤーフレーム → 実装の視覚的比較
54
55
  - ユーザーフロー操作の自動化
55
56
  - レスポンシブデザインの確認(複数画面サイズ)