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
@@ -72,16 +72,16 @@ spec:
72
72
  app: my-api
73
73
  spec:
74
74
  containers:
75
- - name: api
76
- image: myregistry.azurecr.io/my-api:latest
77
- ports:
78
- - containerPort: 3000
79
- env:
80
- - name: DATABASE_URL
81
- valueFrom:
82
- secretKeyRef:
83
- name: db-secret
84
- key: connection-string
75
+ - name: api
76
+ image: myregistry.azurecr.io/my-api:latest
77
+ ports:
78
+ - containerPort: 3000
79
+ env:
80
+ - name: DATABASE_URL
81
+ valueFrom:
82
+ secretKeyRef:
83
+ name: db-secret
84
+ key: connection-string
85
85
  ```
86
86
 
87
87
  ---
@@ -216,30 +216,35 @@ resource keyVaultAccessPolicy 'Microsoft.KeyVault/vaults/accessPolicies@2021-04-
216
216
  ## Azure Well-Architected
217
217
 
218
218
  ### Reliability
219
+
219
220
  - [ ] Availability zones used
220
221
  - [ ] Traffic Manager/Front Door configured
221
222
  - [ ] Geo-replication enabled
222
223
  - [ ] Backup and restore tested
223
224
 
224
225
  ### Security
226
+
225
227
  - [ ] Azure AD authentication
226
228
  - [ ] Managed identities used
227
229
  - [ ] Key Vault for secrets
228
230
  - [ ] Private endpoints configured
229
231
 
230
232
  ### Cost Optimization
233
+
231
234
  - [ ] Reserved instances evaluated
232
235
  - [ ] Right-sized resources
233
236
  - [ ] Auto-scaling configured
234
237
  - [ ] Cost alerts set up
235
238
 
236
239
  ### Operational Excellence
240
+
237
241
  - [ ] ARM/Bicep templates
238
242
  - [ ] Azure DevOps pipelines
239
243
  - [ ] Application Insights
240
244
  - [ ] Log Analytics workspace
241
245
 
242
246
  ### Performance
247
+
243
248
  - [ ] CDN for static content
244
249
  - [ ] Redis Cache configured
245
250
  - [ ] Appropriate service tiers
@@ -285,16 +290,16 @@ module compute './modules/compute.bicep' = {
285
290
 
286
291
  ## Service Selection Guide
287
292
 
288
- | Need | Service |
289
- |------|---------|
290
- | Simple web app | App Service |
291
- | Containers | AKS or Container Apps |
292
- | Serverless | Functions |
293
- | SQL database | Azure SQL |
294
- | NoSQL database | Cosmos DB |
295
- | Messaging | Service Bus |
296
- | Events | Event Grid |
297
- | Storage | Blob Storage |
298
- | CDN | Azure CDN / Front Door |
299
- | Secrets | Key Vault |
300
- | Monitoring | Application Insights |
293
+ | Need | Service |
294
+ | -------------- | ---------------------- |
295
+ | Simple web app | App Service |
296
+ | Containers | AKS or Container Apps |
297
+ | Serverless | Functions |
298
+ | SQL database | Azure SQL |
299
+ | NoSQL database | Cosmos DB |
300
+ | Messaging | Service Bus |
301
+ | Events | Event Grid |
302
+ | Storage | Blob Storage |
303
+ | CDN | Azure CDN / Front Door |
304
+ | Secrets | Key Vault |
305
+ | Monitoring | Application Insights |
@@ -96,11 +96,13 @@ musubi-workflow next testing
96
96
  ### レビュー結果に応じたアクション
97
97
 
98
98
  **レビュー承認の場合**:
99
+
99
100
  ```bash
100
101
  musubi-workflow next testing
101
102
  ```
102
103
 
103
104
  **修正が必要な場合(フィードバックループ)**:
105
+
104
106
  ```bash
105
107
  musubi-workflow feedback review implementation -r "コード品質の問題を発見"
106
108
  ```
@@ -118,6 +120,65 @@ musubi-workflow feedback review implementation -r "コード品質の問題を
118
120
 
119
121
  ---
120
122
 
123
+ ## MUSUBI ComplexityAnalyzer Module (v5.5.0+)
124
+
125
+ **Available Module**: `src/analyzers/complexity-analyzer.js`
126
+
127
+ The ComplexityAnalyzer module provides automated cyclomatic and cognitive complexity analysis.
128
+
129
+ ### Module Usage
130
+
131
+ ```javascript
132
+ const { ComplexityAnalyzer, THRESHOLDS } = require('musubi-sdd');
133
+
134
+ const analyzer = new ComplexityAnalyzer();
135
+
136
+ // Cyclomatic complexity (McCabe)
137
+ const cyclomatic = analyzer.calculateCyclomaticComplexity(code, 'javascript');
138
+
139
+ // Cognitive complexity (SonarSource method)
140
+ const cognitive = analyzer.calculateCognitiveComplexity(code, 'javascript');
141
+
142
+ // Analyze entire file
143
+ const fileAnalysis = await analyzer.analyzeFile('src/utils.js');
144
+ console.log(`Cyclomatic: ${fileAnalysis.cyclomatic}`);
145
+ console.log(`Cognitive: ${fileAnalysis.cognitive}`);
146
+ console.log(`Severity: ${fileAnalysis.severity}`);
147
+ ```
148
+
149
+ ### Complexity Thresholds
150
+
151
+ | Level | Cyclomatic | Cognitive | Action |
152
+ | ------------ | ---------- | --------- | -------------------- |
153
+ | **Ideal** | ≤10 | ≤15 | No action needed |
154
+ | **Warning** | 11-20 | 16-30 | Consider refactoring |
155
+ | **Critical** | 21-50 | 31-60 | Refactoring required |
156
+ | **Extreme** | >50 | >60 | Urgent refactoring |
157
+
158
+ ### Multi-Language Support
159
+
160
+ - JavaScript, TypeScript
161
+ - Python
162
+ - Java
163
+ - C, C++
164
+ - Go
165
+ - Rust
166
+
167
+ ### Integration with Code Review
168
+
169
+ 1. **Automated complexity check** before review
170
+ 2. **Identify complex functions** that need refactoring
171
+ 3. **Generate recommendations** for splitting functions
172
+ 4. **Track complexity trends** over time
173
+
174
+ ```javascript
175
+ // Get recommendations
176
+ const recommendations = analyzer.getRecommendations(fileAnalysis);
177
+ // Example: "Consider splitting function processData into smaller functions"
178
+ ```
179
+
180
+ ---
181
+
121
182
  ## 3. Documentation Language Policy
122
183
 
123
184
  **CRITICAL: 英語版と日本語版の両方を必ず作成**
@@ -9,28 +9,33 @@ Guidelines for conducting effective and constructive code reviews.
9
9
  ## For Reviewers
10
10
 
11
11
  ### Be Constructive
12
+
12
13
  - Focus on the code, not the author
13
14
  - Explain the "why" behind suggestions
14
15
  - Offer alternatives, not just criticism
15
16
  - Acknowledge good work with praise
16
17
 
17
18
  ### Be Specific
19
+
18
20
  ```
19
21
  ❌ "This is confusing"
20
22
  ✅ "This function is doing too much. Consider splitting authentication and session creation."
21
23
  ```
22
24
 
23
25
  ### Be Timely
26
+
24
27
  - Review within 24 hours when possible
25
28
  - Small PRs should be reviewed within hours
26
29
  - Don't let reviews become bottlenecks
27
30
 
28
31
  ### Ask Questions
32
+
29
33
  - "Could you explain the reasoning here?"
30
34
  - "Have you considered using X instead?"
31
35
  - Use questions instead of commands when appropriate
32
36
 
33
37
  ### Prioritize Issues
38
+
34
39
  - Focus on correctness and security first
35
40
  - Style issues are lower priority
36
41
  - Don't nitpick on preferences
@@ -40,33 +45,41 @@ Guidelines for conducting effective and constructive code reviews.
40
45
  ## For Authors
41
46
 
42
47
  ### Keep PRs Small
48
+
43
49
  - Aim for < 400 lines of code
44
50
  - Split large changes into logical chunks
45
51
  - One logical change per PR
46
52
 
47
53
  ### Write Good Descriptions
54
+
48
55
  ```markdown
49
56
  ## What
57
+
50
58
  Brief description of the change
51
59
 
52
60
  ## Why
61
+
53
62
  Link to issue/requirement: REQ-AUTH-001
54
63
 
55
64
  ## How
65
+
56
66
  Technical approach taken
57
67
 
58
68
  ## Testing
69
+
59
70
  How this was tested
60
71
 
61
72
  ## Screenshots (if UI change)
62
73
  ```
63
74
 
64
75
  ### Self-Review First
76
+
65
77
  - Review your own code before requesting review
66
78
  - Check for obvious issues
67
79
  - Ensure CI passes
68
80
 
69
81
  ### Respond Constructively
82
+
70
83
  - Don't take feedback personally
71
84
  - Ask for clarification if needed
72
85
  - Explain your reasoning if you disagree
@@ -76,26 +89,31 @@ How this was tested
76
89
  ## Review Anti-Patterns
77
90
 
78
91
  ### ❌ Rubber Stamping
92
+
79
93
  Quick approval without thorough review.
80
94
 
81
95
  **Impact**: Bugs and issues slip through.
82
96
 
83
97
  ### ❌ Gatekeeping
98
+
84
99
  Blocking PRs for minor style preferences.
85
100
 
86
101
  **Impact**: Slows development, frustrates team.
87
102
 
88
103
  ### ❌ Inconsistency
104
+
89
105
  Different standards for different people.
90
106
 
91
107
  **Impact**: Unfair treatment, unclear expectations.
92
108
 
93
109
  ### ❌ Delayed Reviews
110
+
94
111
  Letting PRs sit for days without attention.
95
112
 
96
113
  **Impact**: Context lost, merge conflicts increase.
97
114
 
98
115
  ### ❌ Personal Attacks
116
+
99
117
  Criticizing the author instead of the code.
100
118
 
101
119
  **Impact**: Toxic culture, reduced productivity.
@@ -105,25 +123,31 @@ Criticizing the author instead of the code.
105
123
  ## Effective Feedback Examples
106
124
 
107
125
  ### Instead of
126
+
108
127
  ❌ "This is wrong"
109
128
 
110
129
  ### Say
130
+
111
131
  ✅ "This approach might cause issues when X happens. Consider handling that case by..."
112
132
 
113
133
  ---
114
134
 
115
135
  ### Instead of
136
+
116
137
  ❌ "Why did you do it this way?"
117
138
 
118
139
  ### Say
140
+
119
141
  ✅ "I see you chose approach X. I'm curious about the reasoning - was there a specific constraint? I was thinking Y might also work because..."
120
142
 
121
143
  ---
122
144
 
123
145
  ### Instead of
146
+
124
147
  ❌ "This is unreadable"
125
148
 
126
149
  ### Say
150
+
127
151
  ✅ "I had trouble following the logic here. Would extracting this into a named function with a descriptive name help clarify the intent?"
128
152
 
129
153
  ---
@@ -131,6 +155,7 @@ Criticizing the author instead of the code.
131
155
  ## Review Metrics (Optional)
132
156
 
133
157
  Track to improve process:
158
+
134
159
  - Average review turnaround time
135
160
  - Average PR size
136
161
  - Review comments per PR
@@ -141,6 +166,7 @@ Track to improve process:
141
166
  ## Automation
142
167
 
143
168
  Let automation handle:
169
+
144
170
  - Code formatting (Prettier, Black)
145
171
  - Linting (ESLint, Pylint)
146
172
  - Type checking (TypeScript, mypy)
@@ -148,6 +174,7 @@ Let automation handle:
148
174
  - Test coverage
149
175
 
150
176
  Focus human review on:
177
+
151
178
  - Logic and correctness
152
179
  - Architecture decisions
153
180
  - Maintainability
@@ -9,6 +9,7 @@ A comprehensive checklist for conducting effective code reviews in MUSUBI SDD pr
9
9
  ## Pre-Review Checks
10
10
 
11
11
  ### Before Starting Review
12
+
12
13
  - [ ] PR/MR description clearly explains the change
13
14
  - [ ] Linked requirements/issues are referenced
14
15
  - [ ] CI/CD pipeline passes
@@ -20,6 +21,7 @@ A comprehensive checklist for conducting effective code reviews in MUSUBI SDD pr
20
21
  ## Code Quality Checklist
21
22
 
22
23
  ### 1. Functionality
24
+
23
25
  - [ ] Code implements the requirements correctly
24
26
  - [ ] Edge cases are handled
25
27
  - [ ] Error handling is appropriate
@@ -27,6 +29,7 @@ A comprehensive checklist for conducting effective code reviews in MUSUBI SDD pr
27
29
  - [ ] Code works as intended (manually verified if needed)
28
30
 
29
31
  ### 2. Design & Architecture
32
+
30
33
  - [ ] Follows existing architecture patterns (check `steering/structure.md`)
31
34
  - [ ] SOLID principles are applied appropriately
32
35
  - [ ] No unnecessary complexity (Article VII: Simplicity Gate)
@@ -34,6 +37,7 @@ A comprehensive checklist for conducting effective code reviews in MUSUBI SDD pr
34
37
  - [ ] Library-first principle followed (Article I)
35
38
 
36
39
  ### 3. Code Style
40
+
37
41
  - [ ] Consistent naming conventions
38
42
  - [ ] Proper indentation and formatting
39
43
  - [ ] Comments explain "why", not "what"
@@ -41,6 +45,7 @@ A comprehensive checklist for conducting effective code reviews in MUSUBI SDD pr
41
45
  - [ ] No debug/console statements left behind
42
46
 
43
47
  ### 4. Testing
48
+
44
49
  - [ ] Tests written before implementation (Article III)
45
50
  - [ ] Unit tests cover core logic
46
51
  - [ ] Integration tests verify component interaction
@@ -48,6 +53,7 @@ A comprehensive checklist for conducting effective code reviews in MUSUBI SDD pr
48
53
  - [ ] Edge cases and error paths are tested
49
54
 
50
55
  ### 5. Security
56
+
51
57
  - [ ] No hardcoded secrets or credentials
52
58
  - [ ] Input validation present
53
59
  - [ ] Output encoding for user-facing data
@@ -55,6 +61,7 @@ A comprehensive checklist for conducting effective code reviews in MUSUBI SDD pr
55
61
  - [ ] Authentication/authorization checked
56
62
 
57
63
  ### 6. Performance
64
+
58
65
  - [ ] No obvious performance issues
59
66
  - [ ] Database queries are optimized
60
67
  - [ ] No N+1 query problems
@@ -62,6 +69,7 @@ A comprehensive checklist for conducting effective code reviews in MUSUBI SDD pr
62
69
  - [ ] Large operations are async/background
63
70
 
64
71
  ### 7. Maintainability
72
+
65
73
  - [ ] Code is readable and self-documenting
66
74
  - [ ] Functions/methods are appropriately sized
67
75
  - [ ] No code duplication
@@ -72,21 +80,22 @@ A comprehensive checklist for conducting effective code reviews in MUSUBI SDD pr
72
80
 
73
81
  ## Review Severity Levels
74
82
 
75
- | Level | Description | Action |
76
- |-------|-------------|--------|
77
- | 🔴 **Blocker** | Critical issue, must fix | Request changes |
78
- | 🟠 **Major** | Significant issue, should fix | Request changes |
79
- | 🟡 **Minor** | Small issue, nice to fix | Approve with comments |
80
- | 🔵 **Suggestion** | Optional improvement | Approve with comments |
81
- | 💬 **Question** | Need clarification | Comment |
82
- | 👍 **Praise** | Good implementation | Comment |
83
+ | Level | Description | Action |
84
+ | ----------------- | ----------------------------- | --------------------- |
85
+ | 🔴 **Blocker** | Critical issue, must fix | Request changes |
86
+ | 🟠 **Major** | Significant issue, should fix | Request changes |
87
+ | 🟡 **Minor** | Small issue, nice to fix | Approve with comments |
88
+ | 🔵 **Suggestion** | Optional improvement | Approve with comments |
89
+ | 💬 **Question** | Need clarification | Comment |
90
+ | 👍 **Praise** | Good implementation | Comment |
83
91
 
84
92
  ---
85
93
 
86
94
  ## Review Comment Templates
87
95
 
88
96
  ### Blocker
89
- ```
97
+
98
+ ````
90
99
  🔴 **Blocker**: [Description]
91
100
 
92
101
  This needs to be fixed before merge because [reason].
@@ -94,33 +103,42 @@ This needs to be fixed before merge because [reason].
94
103
  **Suggested fix:**
95
104
  ```code
96
105
  // Example fix
97
- ```
106
+ ````
107
+
98
108
  ```
99
109
 
100
110
  ### Major Issue
101
111
  ```
112
+
102
113
  🟠 **Major**: [Description]
103
114
 
104
115
  This could cause [problem]. Consider [alternative approach].
116
+
105
117
  ```
106
118
 
107
119
  ### Minor Issue
108
120
  ```
121
+
109
122
  🟡 **Minor**: [Description]
110
123
 
111
124
  Not critical, but would improve [aspect].
125
+
112
126
  ```
113
127
 
114
128
  ### Suggestion
115
129
  ```
130
+
116
131
  🔵 **Suggestion**: [Description]
117
132
 
118
133
  Optional: This could be improved by [suggestion].
134
+
119
135
  ```
120
136
 
121
137
  ### Praise
122
138
  ```
139
+
123
140
  👍 Nice implementation of [feature]. Clean and readable!
141
+
124
142
  ```
125
143
 
126
144
  ---
@@ -182,3 +200,4 @@ During review, verify:
182
200
  - Need more information
183
201
  - Questions about approach
184
202
  - Discussion needed before decision
203
+ ```
@@ -11,6 +11,7 @@ Guidelines and checklists for conducting effective code reviews.
11
11
  ### 1. Preparation
12
12
 
13
13
  Before starting review:
14
+
14
15
  - [ ] Understand the context (ticket/issue)
15
16
  - [ ] Review related documentation
16
17
  - [ ] Check if tests are included
@@ -27,13 +28,13 @@ Before starting review:
27
28
 
28
29
  ### 3. Time Guidelines
29
30
 
30
- | PR Size | Max Review Time |
31
- |---------|-----------------|
32
- | XS (< 50 lines) | 10 minutes |
33
- | S (50-200 lines) | 30 minutes |
34
- | M (200-500 lines) | 1 hour |
35
- | L (500-1000 lines) | 2 hours |
36
- | XL (> 1000 lines) | Request split |
31
+ | PR Size | Max Review Time |
32
+ | ------------------ | --------------- |
33
+ | XS (< 50 lines) | 10 minutes |
34
+ | S (50-200 lines) | 30 minutes |
35
+ | M (200-500 lines) | 1 hour |
36
+ | L (500-1000 lines) | 2 hours |
37
+ | XL (> 1000 lines) | Request split |
37
38
 
38
39
  ---
39
40
 
@@ -115,28 +116,28 @@ Before starting review:
115
116
 
116
117
  Use prefixes for clarity:
117
118
 
118
- | Prefix | Meaning |
119
- |--------|---------|
120
- | `[blocking]` | Must fix before merge |
121
- | `[suggestion]` | Optional improvement |
122
- | `[question]` | Seeking understanding |
123
- | `[nit]` | Minor style issue |
124
- | `[praise]` | Positive feedback |
119
+ | Prefix | Meaning |
120
+ | -------------- | --------------------- |
121
+ | `[blocking]` | Must fix before merge |
122
+ | `[suggestion]` | Optional improvement |
123
+ | `[question]` | Seeking understanding |
124
+ | `[nit]` | Minor style issue |
125
+ | `[praise]` | Positive feedback |
125
126
 
126
127
  ### Examples
127
128
 
128
129
  ```markdown
129
- [blocking] This SQL query is vulnerable to injection.
130
+ [blocking] This SQL query is vulnerable to injection.
130
131
  Please use parameterized queries.
131
132
 
132
- [suggestion] Consider extracting this into a separate function
133
+ [suggestion] Consider extracting this into a separate function
133
134
  for reusability.
134
135
 
135
136
  [question] What's the expected behavior when `userId` is null?
136
137
 
137
138
  [nit] Extra whitespace on line 42.
138
139
 
139
- [praise] Great use of the strategy pattern here!
140
+ [praise] Great use of the strategy pattern here!
140
141
  Makes the code very extensible.
141
142
  ```
142
143
 
@@ -221,32 +222,36 @@ with open('file.txt') as f:
221
222
 
222
223
  ### Automated Checks
223
224
 
224
- | Check | Tool |
225
- |-------|------|
226
- | Formatting | Prettier, Black |
227
- | Linting | ESLint, Ruff |
228
- | Type checking | TypeScript, mypy |
229
- | Security | npm audit, Bandit |
230
- | Test coverage | Jest, pytest-cov |
225
+ | Check | Tool |
226
+ | ------------- | ----------------- |
227
+ | Formatting | Prettier, Black |
228
+ | Linting | ESLint, Ruff |
229
+ | Type checking | TypeScript, mypy |
230
+ | Security | npm audit, Bandit |
231
+ | Test coverage | Jest, pytest-cov |
231
232
 
232
233
  ### GitHub PR Template
233
234
 
234
235
  ```markdown
235
236
  ## Description
237
+
236
238
  [Describe changes]
237
239
 
238
240
  ## Type of Change
241
+
239
242
  - [ ] Bug fix
240
243
  - [ ] New feature
241
244
  - [ ] Breaking change
242
245
  - [ ] Documentation
243
246
 
244
247
  ## Testing
248
+
245
249
  - [ ] Unit tests added/updated
246
250
  - [ ] Integration tests added/updated
247
251
  - [ ] Manual testing completed
248
252
 
249
253
  ## Checklist
254
+
250
255
  - [ ] Self-review completed
251
256
  - [ ] Code follows style guidelines
252
257
  - [ ] Documentation updated
@@ -575,20 +575,22 @@ Once all gates pass:
575
575
 
576
576
  Use these commands to enforce constitutional compliance programmatically:
577
577
 
578
- | Command | Purpose | Example |
579
- |---------|---------|---------|
580
- | `musubi-validate guardrails --type safety` | Validate content against safety rules | `npx musubi-validate guardrails "content" --type safety` |
581
- | `musubi-validate guardrails --type safety --constitutional` | Full constitutional validation | `npx musubi-validate guardrails "code" --type safety --constitutional` |
582
- | `musubi-validate guardrails --type input` | Validate input against injection attacks | `npx musubi-validate guardrails "input" --type input` |
583
- | `musubi-validate guardrails-chain` | Run full guardrail chain | `npx musubi-validate guardrails-chain "content" --parallel` |
578
+ | Command | Purpose | Example |
579
+ | ----------------------------------------------------------- | ---------------------------------------- | ---------------------------------------------------------------------- |
580
+ | `musubi-validate guardrails --type safety` | Validate content against safety rules | `npx musubi-validate guardrails "content" --type safety` |
581
+ | `musubi-validate guardrails --type safety --constitutional` | Full constitutional validation | `npx musubi-validate guardrails "code" --type safety --constitutional` |
582
+ | `musubi-validate guardrails --type input` | Validate input against injection attacks | `npx musubi-validate guardrails "input" --type input` |
583
+ | `musubi-validate guardrails-chain` | Run full guardrail chain | `npx musubi-validate guardrails-chain "content" --parallel` |
584
584
 
585
585
  **Constitutional Safety Levels**:
586
+
586
587
  - `--level low` - Permissive (development)
587
588
  - `--level medium` - Balanced (default)
588
589
  - `--level high` - Strict (production)
589
590
  - `--level critical` - Maximum (security-critical)
590
591
 
591
592
  **Use with Constitution Validation**:
593
+
592
594
  ```bash
593
595
  # Validate code against constitutional articles
594
596
  npx musubi-validate guardrails "$(cat src/feature.js)" --type safety --constitutional --level high