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
@@ -1,18 +1,54 @@
1
1
  /**
2
2
  * Phase 5 Integration Module
3
3
  * Advanced Features統合エンジン
4
- *
4
+ *
5
5
  * @module phase5-integration
6
6
  */
7
7
 
8
8
  const EventEmitter = require('events');
9
9
 
10
10
  // Phase 5 modules
11
- const { SteeringAutoUpdate, createSteeringAutoUpdate, TRIGGER, STEERING_TYPE } = require('./steering/steering-auto-update');
12
- const { SteeringValidator, createSteeringValidator, SEVERITY, RULE_TYPE } = require('./steering/steering-validator');
13
- const { TemplateConstraints, ThinkingChecklist, createTemplateConstraints, createThinkingChecklist, CONSTRAINT_TYPE, UNCERTAINTY, MARKER_TYPE } = require('./templates/template-constraints');
14
- const { QualityDashboard, createQualityDashboard, METRIC_CATEGORY, HEALTH_STATUS, CONSTITUTIONAL_ARTICLES } = require('./monitoring/quality-dashboard');
15
- const { AdvancedValidation, createAdvancedValidation, VALIDATION_TYPE, ARTIFACT_TYPE, GAP_SEVERITY } = require('./validators/advanced-validation');
11
+ const {
12
+ SteeringAutoUpdate,
13
+ createSteeringAutoUpdate,
14
+ TRIGGER,
15
+ STEERING_TYPE,
16
+ } = require('./steering/steering-auto-update');
17
+ const {
18
+ SteeringValidator,
19
+ createSteeringValidator,
20
+ SEVERITY,
21
+ RULE_TYPE,
22
+ } = require('./steering/steering-validator');
23
+ const {
24
+ TemplateConstraints,
25
+ ThinkingChecklist,
26
+ createTemplateConstraints,
27
+ createThinkingChecklist,
28
+ CONSTRAINT_TYPE,
29
+ UNCERTAINTY,
30
+ MARKER_TYPE,
31
+ } = require('./templates/template-constraints');
32
+ const {
33
+ QualityDashboard,
34
+ createQualityDashboard,
35
+ METRIC_CATEGORY,
36
+ HEALTH_STATUS,
37
+ CONSTITUTIONAL_ARTICLES,
38
+ } = require('./monitoring/quality-dashboard');
39
+ const {
40
+ AdvancedValidation,
41
+ createAdvancedValidation,
42
+ VALIDATION_TYPE,
43
+ ARTIFACT_TYPE,
44
+ GAP_SEVERITY,
45
+ } = require('./validators/advanced-validation');
46
+ const {
47
+ CodeGraphAutoUpdate,
48
+ createCodeGraphAutoUpdate,
49
+ TRIGGER: CODEGRAPH_TRIGGER,
50
+ TARGET: CODEGRAPH_TARGET,
51
+ } = require('./analyzers/codegraph-auto-update');
16
52
 
17
53
  /**
18
54
  * Phase 5 integration status
@@ -22,7 +58,7 @@ const INTEGRATION_STATUS = {
22
58
  READY: 'ready',
23
59
  RUNNING: 'running',
24
60
  STOPPED: 'stopped',
25
- ERROR: 'error'
61
+ ERROR: 'error',
26
62
  };
27
63
 
28
64
  /**
@@ -37,6 +73,7 @@ class Phase5Integration extends EventEmitter {
37
73
  * @param {Object} options.templates - Template constraints options
38
74
  * @param {Object} options.dashboard - Quality dashboard options
39
75
  * @param {Object} options.validation - Advanced validation options
76
+ * @param {Object} options.codegraph - CodeGraph auto-update options
40
77
  */
41
78
  constructor(options = {}) {
42
79
  super();
@@ -50,6 +87,7 @@ class Phase5Integration extends EventEmitter {
50
87
  this.templateConstraints = createTemplateConstraints(options.templates || {});
51
88
  this.qualityDashboard = createQualityDashboard(options.dashboard || {});
52
89
  this.advancedValidation = createAdvancedValidation(options.validation || {});
90
+ this.codeGraphAutoUpdate = createCodeGraphAutoUpdate(options.codegraph || {});
53
91
 
54
92
  // Thinking checklist
55
93
  this.thinkingChecklist = createThinkingChecklist();
@@ -66,12 +104,12 @@ class Phase5Integration extends EventEmitter {
66
104
  */
67
105
  setupEventHandlers() {
68
106
  // When steering is updated, validate it
69
- this.steeringAutoUpdate.on('update-applied', (update) => {
107
+ this.steeringAutoUpdate.on('update-applied', update => {
70
108
  this.emit('steering-updated', update);
71
109
  });
72
110
 
73
111
  // When quality is collected, check thresholds
74
- this.qualityDashboard.on('collected', (snapshot) => {
112
+ this.qualityDashboard.on('collected', snapshot => {
75
113
  const health = this.qualityDashboard.getHealthSummary();
76
114
  if (health.status === HEALTH_STATUS.CRITICAL || health.status === HEALTH_STATUS.FAILING) {
77
115
  this.emit('health-alert', { status: health.status, snapshot });
@@ -79,18 +117,28 @@ class Phase5Integration extends EventEmitter {
79
117
  });
80
118
 
81
119
  // When validation finds issues, emit alerts
82
- this.advancedValidation.on('validated', (result) => {
120
+ this.advancedValidation.on('validated', result => {
83
121
  if (!result.valid) {
84
122
  this.emit('validation-alert', result);
85
123
  }
86
124
  });
87
125
 
88
126
  // When gaps are detected, emit alerts
89
- this.advancedValidation.on('gaps-detected', (result) => {
127
+ this.advancedValidation.on('gaps-detected', result => {
90
128
  if (result.criticalGaps > 0) {
91
129
  this.emit('gap-alert', result);
92
130
  }
93
131
  });
132
+
133
+ // When codegraph is updated, emit events
134
+ this.codeGraphAutoUpdate.on('update-complete', result => {
135
+ this.emit('codegraph-updated', result);
136
+ });
137
+
138
+ // When codegraph has errors, emit alerts
139
+ this.codeGraphAutoUpdate.on('update-error', error => {
140
+ this.emit('codegraph-error', error);
141
+ });
94
142
  }
95
143
 
96
144
  /**
@@ -105,7 +153,8 @@ class Phase5Integration extends EventEmitter {
105
153
  templateConstraints: this.templateConstraints,
106
154
  qualityDashboard: this.qualityDashboard,
107
155
  advancedValidation: this.advancedValidation,
108
- thinkingChecklist: this.thinkingChecklist
156
+ thinkingChecklist: this.thinkingChecklist,
157
+ codeGraphAutoUpdate: this.codeGraphAutoUpdate,
109
158
  };
110
159
  return components[name] || null;
111
160
  }
@@ -139,7 +188,7 @@ class Phase5Integration extends EventEmitter {
139
188
  metrics,
140
189
  validation,
141
190
  overallScore,
142
- recommendations: this.generateRecommendations(health, validation)
191
+ recommendations: this.generateRecommendations(health, validation),
143
192
  };
144
193
 
145
194
  this.status = INTEGRATION_STATUS.READY;
@@ -158,8 +207,9 @@ class Phase5Integration extends EventEmitter {
158
207
  */
159
208
  calculateOverallScore(metrics, validation) {
160
209
  const healthScore = metrics.health?.overall ?? 0;
161
- const validationScore = validation.valid ? 100 :
162
- Math.max(0, 100 - (validation.criticalIssues * 20) - (validation.totalIssues * 5));
210
+ const validationScore = validation.valid
211
+ ? 100
212
+ : Math.max(0, 100 - validation.criticalIssues * 20 - validation.totalIssues * 5);
163
213
 
164
214
  return Math.round((healthScore + validationScore) / 2);
165
215
  }
@@ -176,7 +226,7 @@ class Phase5Integration extends EventEmitter {
176
226
  type: 'coverage',
177
227
  priority: 'high',
178
228
  message: 'Increase test coverage to improve project health',
179
- currentScore: health.breakdown.coverage.score
229
+ currentScore: health.breakdown.coverage.score,
180
230
  });
181
231
  }
182
232
 
@@ -185,7 +235,7 @@ class Phase5Integration extends EventEmitter {
185
235
  type: 'constitutional',
186
236
  priority: 'high',
187
237
  message: 'Review constitutional compliance for all articles',
188
- currentScore: health.breakdown.constitutional.score
238
+ currentScore: health.breakdown.constitutional.score,
189
239
  });
190
240
  }
191
241
 
@@ -195,7 +245,7 @@ class Phase5Integration extends EventEmitter {
195
245
  type: 'gaps',
196
246
  priority: validation.gaps.criticalGaps > 0 ? 'critical' : 'medium',
197
247
  message: `Address ${validation.gaps.gapCount} specification gaps`,
198
- details: validation.gaps.gaps.slice(0, 5)
248
+ details: validation.gaps.gaps.slice(0, 5),
199
249
  });
200
250
  }
201
251
 
@@ -204,7 +254,7 @@ class Phase5Integration extends EventEmitter {
204
254
  type: 'traceability',
205
255
  priority: 'medium',
206
256
  message: 'Improve traceability coverage between artifacts',
207
- currentCoverage: validation.traceability.coverage
257
+ currentCoverage: validation.traceability.coverage,
208
258
  });
209
259
  }
210
260
 
@@ -224,13 +274,14 @@ class Phase5Integration extends EventEmitter {
224
274
  }
225
275
 
226
276
  const overallValid = Object.values(results).every(r => r.valid);
227
- const avgScore = Object.values(results).reduce((sum, r) => sum + r.score, 0) / Object.keys(results).length;
277
+ const avgScore =
278
+ Object.values(results).reduce((sum, r) => sum + r.score, 0) / Object.keys(results).length;
228
279
 
229
280
  return {
230
281
  valid: overallValid,
231
282
  files: results,
232
283
  avgScore: Math.round(avgScore),
233
- timestamp: new Date().toISOString()
284
+ timestamp: new Date().toISOString(),
234
285
  };
235
286
  }
236
287
 
@@ -254,26 +305,26 @@ class Phase5Integration extends EventEmitter {
254
305
  components: {
255
306
  steeringAutoUpdate: {
256
307
  rules: this.steeringAutoUpdate.rules?.length ?? 0,
257
- history: this.steeringAutoUpdate.updateHistory?.length ?? 0
308
+ history: this.steeringAutoUpdate.updateHistory?.length ?? 0,
258
309
  },
259
310
  steeringValidator: {
260
311
  rules: this.steeringValidator.rules?.size ?? 0,
261
- history: this.steeringValidator.history?.length ?? 0
312
+ history: this.steeringValidator.history?.length ?? 0,
262
313
  },
263
314
  templateConstraints: {
264
315
  templates: Object.keys(this.templateConstraints.templates).length,
265
- history: this.templateConstraints.validationHistory?.length ?? 0
316
+ history: this.templateConstraints.validationHistory?.length ?? 0,
266
317
  },
267
318
  qualityDashboard: {
268
319
  metrics: this.qualityDashboard.metrics?.size ?? 0,
269
- history: this.qualityDashboard.history?.length ?? 0
320
+ history: this.qualityDashboard.history?.length ?? 0,
270
321
  },
271
322
  advancedValidation: {
272
323
  artifacts: this.advancedValidation.artifacts?.size ?? 0,
273
- links: this.advancedValidation.countLinks?.() ?? 0
274
- }
324
+ links: this.advancedValidation.countLinks?.() ?? 0,
325
+ },
275
326
  },
276
- timestamp: new Date().toISOString()
327
+ timestamp: new Date().toISOString(),
277
328
  };
278
329
  }
279
330
 
@@ -328,7 +379,7 @@ class Phase5Integration extends EventEmitter {
328
379
  this.qualityDashboard.clear();
329
380
  this.advancedValidation.clear();
330
381
  this.thinkingChecklist.reset();
331
-
382
+
332
383
  this.status = INTEGRATION_STATUS.READY;
333
384
  this.emit('reset');
334
385
  }
@@ -338,6 +389,7 @@ class Phase5Integration extends EventEmitter {
338
389
  */
339
390
  start() {
340
391
  this.qualityDashboard.startAutoCollection();
392
+ this.codeGraphAutoUpdate.start();
341
393
  this.status = INTEGRATION_STATUS.RUNNING;
342
394
  this.emit('started');
343
395
  }
@@ -347,6 +399,7 @@ class Phase5Integration extends EventEmitter {
347
399
  */
348
400
  stop() {
349
401
  this.qualityDashboard.stopAutoCollection();
402
+ this.codeGraphAutoUpdate.stop();
350
403
  this.status = INTEGRATION_STATUS.STOPPED;
351
404
  this.emit('stopped');
352
405
  }
@@ -398,5 +451,11 @@ module.exports = {
398
451
  createAdvancedValidation,
399
452
  VALIDATION_TYPE,
400
453
  ARTIFACT_TYPE,
401
- GAP_SEVERITY
454
+ GAP_SEVERITY,
455
+
456
+ // Re-export Sprint 5.5: CodeGraph Auto-Update
457
+ CodeGraphAutoUpdate,
458
+ createCodeGraphAutoUpdate,
459
+ CODEGRAPH_TRIGGER,
460
+ CODEGRAPH_TARGET,
402
461
  };
@@ -90,10 +90,18 @@ class CoverageReporter {
90
90
  lines.push('-'.repeat(30));
91
91
  lines.push(`Total Requirements: ${coverage.totalRequirements}`);
92
92
  lines.push('');
93
- lines.push(`Design Coverage: ${this.formatBar(coverage.designCoverage)} ${coverage.designCoverage}%`);
94
- lines.push(`Tasks Coverage: ${this.formatBar(coverage.tasksCoverage)} ${coverage.tasksCoverage}%`);
95
- lines.push(`Code Coverage: ${this.formatBar(coverage.codeCoverage)} ${coverage.codeCoverage}%`);
96
- lines.push(`Test Coverage: ${this.formatBar(coverage.testsCoverage)} ${coverage.testsCoverage}%`);
93
+ lines.push(
94
+ `Design Coverage: ${this.formatBar(coverage.designCoverage)} ${coverage.designCoverage}%`
95
+ );
96
+ lines.push(
97
+ `Tasks Coverage: ${this.formatBar(coverage.tasksCoverage)} ${coverage.tasksCoverage}%`
98
+ );
99
+ lines.push(
100
+ `Code Coverage: ${this.formatBar(coverage.codeCoverage)} ${coverage.codeCoverage}%`
101
+ );
102
+ lines.push(
103
+ `Test Coverage: ${this.formatBar(coverage.testsCoverage)} ${coverage.testsCoverage}%`
104
+ );
97
105
  lines.push('-'.repeat(30));
98
106
  lines.push(`OVERALL: ${this.formatBar(coverage.overall)} ${coverage.overall}%`);
99
107
  lines.push('');
@@ -129,7 +137,7 @@ class CoverageReporter {
129
137
  */
130
138
  formatMarkdown(data) {
131
139
  const lines = [];
132
- const { coverage, gaps, matrix } = data;
140
+ const { coverage, gaps, matrix: _matrix } = data;
133
141
 
134
142
  lines.push('# Traceability Coverage Report');
135
143
  lines.push('');
@@ -137,7 +145,12 @@ class CoverageReporter {
137
145
  lines.push('');
138
146
 
139
147
  // Overall status
140
- const status = coverage.overall >= 80 ? '✅ Good' : coverage.overall >= 60 ? '⚠️ Needs Improvement' : '❌ Critical';
148
+ const status =
149
+ coverage.overall >= 80
150
+ ? '✅ Good'
151
+ : coverage.overall >= 60
152
+ ? '⚠️ Needs Improvement'
153
+ : '❌ Critical';
141
154
  lines.push(`## Overall Status: ${status}`);
142
155
  lines.push('');
143
156
 
@@ -146,32 +159,55 @@ class CoverageReporter {
146
159
  lines.push('');
147
160
  lines.push('| Category | Covered | Total | Coverage |');
148
161
  lines.push('|----------|---------|-------|----------|');
149
- lines.push(`| Design | ${coverage.withDesign} | ${coverage.totalRequirements} | ${this.formatProgressBar(coverage.designCoverage)} ${coverage.designCoverage}% |`);
150
- lines.push(`| Tasks | ${coverage.withTasks} | ${coverage.totalRequirements} | ${this.formatProgressBar(coverage.tasksCoverage)} ${coverage.tasksCoverage}% |`);
151
- lines.push(`| Code | ${coverage.withCode} | ${coverage.totalRequirements} | ${this.formatProgressBar(coverage.codeCoverage)} ${coverage.codeCoverage}% |`);
152
- lines.push(`| Tests | ${coverage.withTests} | ${coverage.totalRequirements} | ${this.formatProgressBar(coverage.testsCoverage)} ${coverage.testsCoverage}% |`);
153
- lines.push(`| **Overall** | - | - | ${this.formatProgressBar(coverage.overall)} **${coverage.overall}%** |`);
162
+ lines.push(
163
+ `| Design | ${coverage.withDesign} | ${coverage.totalRequirements} | ${this.formatProgressBar(coverage.designCoverage)} ${coverage.designCoverage}% |`
164
+ );
165
+ lines.push(
166
+ `| Tasks | ${coverage.withTasks} | ${coverage.totalRequirements} | ${this.formatProgressBar(coverage.tasksCoverage)} ${coverage.tasksCoverage}% |`
167
+ );
168
+ lines.push(
169
+ `| Code | ${coverage.withCode} | ${coverage.totalRequirements} | ${this.formatProgressBar(coverage.codeCoverage)} ${coverage.codeCoverage}% |`
170
+ );
171
+ lines.push(
172
+ `| Tests | ${coverage.withTests} | ${coverage.totalRequirements} | ${this.formatProgressBar(coverage.testsCoverage)} ${coverage.testsCoverage}% |`
173
+ );
174
+ lines.push(
175
+ `| **Overall** | - | - | ${this.formatProgressBar(coverage.overall)} **${coverage.overall}%** |`
176
+ );
154
177
  lines.push('');
155
178
 
156
179
  // Gaps
157
180
  if (gaps) {
158
181
  lines.push('## Gaps Analysis');
159
182
  lines.push('');
160
-
161
- const totalGaps = gaps.orphanedRequirements.length + gaps.orphanedDesign.length +
162
- gaps.orphanedTasks.length + gaps.untestedCode.length +
163
- gaps.missingTests.length;
164
-
183
+
184
+ const totalGaps =
185
+ gaps.orphanedRequirements.length +
186
+ gaps.orphanedDesign.length +
187
+ gaps.orphanedTasks.length +
188
+ gaps.untestedCode.length +
189
+ gaps.missingTests.length;
190
+
165
191
  lines.push(`**Total Gaps Found**: ${totalGaps}`);
166
192
  lines.push('');
167
193
 
168
194
  lines.push('| Gap Type | Count | Status |');
169
195
  lines.push('|----------|-------|--------|');
170
- lines.push(`| Orphaned Requirements | ${gaps.orphanedRequirements.length} | ${gaps.orphanedRequirements.length === 0 ? '✅' : '⚠️'} |`);
171
- lines.push(`| Orphaned Design | ${gaps.orphanedDesign.length} | ${gaps.orphanedDesign.length === 0 ? '✅' : '⚠️'} |`);
172
- lines.push(`| Orphaned Tasks | ${gaps.orphanedTasks.length} | ${gaps.orphanedTasks.length === 0 ? '✅' : '⚠️'} |`);
173
- lines.push(`| Untested Code | ${gaps.untestedCode.length} | ${gaps.untestedCode.length === 0 ? '✅' : '⚠️'} |`);
174
- lines.push(`| Missing Tests | ${gaps.missingTests.length} | ${gaps.missingTests.length === 0 ? '✅' : ''} |`);
196
+ lines.push(
197
+ `| Orphaned Requirements | ${gaps.orphanedRequirements.length} | ${gaps.orphanedRequirements.length === 0 ? '✅' : '⚠️'} |`
198
+ );
199
+ lines.push(
200
+ `| Orphaned Design | ${gaps.orphanedDesign.length} | ${gaps.orphanedDesign.length === 0 ? '✅' : '⚠️'} |`
201
+ );
202
+ lines.push(
203
+ `| Orphaned Tasks | ${gaps.orphanedTasks.length} | ${gaps.orphanedTasks.length === 0 ? '✅' : '⚠️'} |`
204
+ );
205
+ lines.push(
206
+ `| Untested Code | ${gaps.untestedCode.length} | ${gaps.untestedCode.length === 0 ? '✅' : '⚠️'} |`
207
+ );
208
+ lines.push(
209
+ `| Missing Tests | ${gaps.missingTests.length} | ${gaps.missingTests.length === 0 ? '✅' : '❌'} |`
210
+ );
175
211
  lines.push('');
176
212
 
177
213
  // Show details for each gap type
@@ -217,19 +253,27 @@ class CoverageReporter {
217
253
  // Recommendations
218
254
  lines.push('## Recommendations');
219
255
  lines.push('');
220
-
256
+
221
257
  if (coverage.overall < 100) {
222
258
  if (coverage.testsCoverage < 80) {
223
- lines.push('1. 🧪 **Increase test coverage**: Add tests for requirements that are missing test links');
259
+ lines.push(
260
+ '1. 🧪 **Increase test coverage**: Add tests for requirements that are missing test links'
261
+ );
224
262
  }
225
263
  if (coverage.designCoverage < 80) {
226
- lines.push('2. 📐 **Complete design documentation**: Link requirements to design documents');
264
+ lines.push(
265
+ '2. 📐 **Complete design documentation**: Link requirements to design documents'
266
+ );
227
267
  }
228
268
  if (coverage.codeCoverage < 80) {
229
- lines.push('3. 💻 **Link code to requirements**: Add requirement references in code comments');
269
+ lines.push(
270
+ '3. 💻 **Link code to requirements**: Add requirement references in code comments'
271
+ );
230
272
  }
231
273
  if (gaps && gaps.orphanedRequirements.length > 0) {
232
- lines.push('4. 🔗 **Address orphaned requirements**: Link them to design, tasks, or remove if obsolete');
274
+ lines.push(
275
+ '4. 🔗 **Address orphaned requirements**: Link them to design, tasks, or remove if obsolete'
276
+ );
233
277
  }
234
278
  } else {
235
279
  lines.push('✅ Excellent! Full traceability coverage achieved.');
@@ -360,7 +404,9 @@ class CoverageReporter {
360
404
  </table>
361
405
  </div>
362
406
 
363
- ${gaps ? `
407
+ ${
408
+ gaps
409
+ ? `
364
410
  <div class="card">
365
411
  <h2>Gaps Analysis</h2>
366
412
  <table>
@@ -396,17 +442,23 @@ class CoverageReporter {
396
442
  </tr>
397
443
  </table>
398
444
  </div>
399
- ` : ''}
445
+ `
446
+ : ''
447
+ }
400
448
 
401
449
  <div class="card">
402
450
  <h2>Recommendations</h2>
403
451
  <ul>
404
- ${coverage.overall < 100 ? `
452
+ ${
453
+ coverage.overall < 100
454
+ ? `
405
455
  ${coverage.testsCoverage < 80 ? '<li>🧪 <strong>Increase test coverage</strong>: Add tests for requirements that are missing test links</li>' : ''}
406
456
  ${coverage.designCoverage < 80 ? '<li>📐 <strong>Complete design documentation</strong>: Link requirements to design documents</li>' : ''}
407
457
  ${coverage.codeCoverage < 80 ? '<li>💻 <strong>Link code to requirements</strong>: Add requirement references in code comments</li>' : ''}
408
458
  ${gaps && gaps.orphanedRequirements.length > 0 ? '<li>🔗 <strong>Address orphaned requirements</strong>: Link them to design, tasks, or remove if obsolete</li>' : ''}
409
- ` : '<li>✅ Excellent! Full traceability coverage achieved.</li>'}
459
+ `
460
+ : '<li>✅ Excellent! Full traceability coverage achieved.</li>'
461
+ }
410
462
  </ul>
411
463
  </div>
412
464