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,7 +1,7 @@
1
1
  /**
2
2
  * Template Constraints Engine
3
3
  * LLM制約テンプレート構文と不確実性マーカー
4
- *
4
+ *
5
5
  * @module templates/template-constraints
6
6
  */
7
7
 
@@ -17,18 +17,18 @@ const CONSTRAINT_TYPE = {
17
17
  CONDITIONAL: 'conditional',
18
18
  PATTERN: 'pattern',
19
19
  RANGE: 'range',
20
- ENUM: 'enum'
20
+ ENUM: 'enum',
21
21
  };
22
22
 
23
23
  /**
24
24
  * Uncertainty levels
25
25
  */
26
26
  const UNCERTAINTY = {
27
- CERTAIN: 'certain', // 100% confidence
28
- HIGH: 'high', // 80-99%
29
- MEDIUM: 'medium', // 50-79%
30
- LOW: 'low', // 20-49%
31
- UNCERTAIN: 'uncertain' // <20%
27
+ CERTAIN: 'certain', // 100% confidence
28
+ HIGH: 'high', // 80-99%
29
+ MEDIUM: 'medium', // 50-79%
30
+ LOW: 'low', // 20-49%
31
+ UNCERTAIN: 'uncertain', // <20%
32
32
  };
33
33
 
34
34
  /**
@@ -41,45 +41,45 @@ const MARKER_TYPE = {
41
41
  TODO: 'todo',
42
42
  QUESTION: 'question',
43
43
  VERIFIED: 'verified',
44
- UNCERTAIN: 'uncertain'
44
+ UNCERTAIN: 'uncertain',
45
45
  };
46
46
 
47
47
  /**
48
48
  * Default constraint templates
49
49
  */
50
50
  const DEFAULT_TEMPLATES = {
51
- 'requirements': {
51
+ requirements: {
52
52
  name: 'Requirements Template',
53
53
  sections: [
54
54
  { name: 'overview', required: true, minLength: 50 },
55
55
  { name: 'functional', required: true, format: 'ears' },
56
56
  { name: 'non-functional', required: false },
57
57
  { name: 'constraints', required: false },
58
- { name: 'assumptions', required: true }
58
+ { name: 'assumptions', required: true },
59
59
  ],
60
- markers: [MARKER_TYPE.ASSUMPTION, MARKER_TYPE.RISK]
60
+ markers: [MARKER_TYPE.ASSUMPTION, MARKER_TYPE.RISK],
61
61
  },
62
- 'design': {
62
+ design: {
63
63
  name: 'Design Template',
64
64
  sections: [
65
65
  { name: 'architecture', required: true },
66
66
  { name: 'components', required: true, format: 'c4' },
67
67
  { name: 'decisions', required: true, format: 'adr' },
68
68
  { name: 'interfaces', required: false },
69
- { name: 'data-model', required: false }
69
+ { name: 'data-model', required: false },
70
70
  ],
71
- markers: [MARKER_TYPE.DECISION, MARKER_TYPE.ASSUMPTION]
71
+ markers: [MARKER_TYPE.DECISION, MARKER_TYPE.ASSUMPTION],
72
72
  },
73
- 'implementation': {
73
+ implementation: {
74
74
  name: 'Implementation Template',
75
75
  sections: [
76
76
  { name: 'approach', required: true },
77
77
  { name: 'tasks', required: true, format: 'checklist' },
78
78
  { name: 'dependencies', required: false },
79
- { name: 'testing', required: true }
79
+ { name: 'testing', required: true },
80
80
  ],
81
- markers: [MARKER_TYPE.TODO, MARKER_TYPE.RISK]
82
- }
81
+ markers: [MARKER_TYPE.TODO, MARKER_TYPE.RISK],
82
+ },
83
83
  };
84
84
 
85
85
  /**
@@ -94,12 +94,12 @@ class TemplateConstraints extends EventEmitter {
94
94
  */
95
95
  constructor(options = {}) {
96
96
  super();
97
-
97
+
98
98
  this.templates = {
99
99
  ...DEFAULT_TEMPLATES,
100
- ...(options.templates || {})
100
+ ...(options.templates || {}),
101
101
  };
102
-
102
+
103
103
  this.strict = options.strict ?? false;
104
104
  this.trackUncertainty = options.trackUncertainty ?? true;
105
105
  this.customConstraints = new Map();
@@ -119,7 +119,7 @@ class TemplateConstraints extends EventEmitter {
119
119
  valid: false,
120
120
  errors: [{ type: 'unknown_template', message: `Unknown template: ${templateId}` }],
121
121
  warnings: [],
122
- score: 0
122
+ score: 0,
123
123
  };
124
124
  }
125
125
 
@@ -130,15 +130,13 @@ class TemplateConstraints extends EventEmitter {
130
130
 
131
131
  // Validate required sections
132
132
  for (const section of template.sections) {
133
- const found = sections.find(s =>
134
- s.name.toLowerCase().includes(section.name.toLowerCase())
135
- );
133
+ const found = sections.find(s => s.name.toLowerCase().includes(section.name.toLowerCase()));
136
134
 
137
135
  if (section.required && !found) {
138
136
  errors.push({
139
137
  type: 'missing_section',
140
138
  section: section.name,
141
- message: `Required section missing: ${section.name}`
139
+ message: `Required section missing: ${section.name}`,
142
140
  });
143
141
  } else if (found) {
144
142
  // Validate section content
@@ -146,7 +144,7 @@ class TemplateConstraints extends EventEmitter {
146
144
  warnings.push({
147
145
  type: 'short_section',
148
146
  section: section.name,
149
- message: `Section "${section.name}" is too short (${found.content.length} < ${section.minLength})`
147
+ message: `Section "${section.name}" is too short (${found.content.length} < ${section.minLength})`,
150
148
  });
151
149
  }
152
150
 
@@ -157,7 +155,7 @@ class TemplateConstraints extends EventEmitter {
157
155
  type: 'format_mismatch',
158
156
  section: section.name,
159
157
  format: section.format,
160
- message: `Section "${section.name}" doesn't match expected format: ${section.format}`
158
+ message: `Section "${section.name}" doesn't match expected format: ${section.format}`,
161
159
  });
162
160
  }
163
161
  }
@@ -172,7 +170,7 @@ class TemplateConstraints extends EventEmitter {
172
170
  warnings.push({
173
171
  type: 'missing_marker',
174
172
  markerType,
175
- message: `Expected marker type not found: ${markerType}`
173
+ message: `Expected marker type not found: ${markerType}`,
176
174
  });
177
175
  }
178
176
  }
@@ -202,7 +200,7 @@ class TemplateConstraints extends EventEmitter {
202
200
  markers,
203
201
  sections: sections.map(s => s.name),
204
202
  score,
205
- timestamp: new Date().toISOString()
203
+ timestamp: new Date().toISOString(),
206
204
  };
207
205
 
208
206
  this.validationHistory.push(result);
@@ -226,7 +224,7 @@ class TemplateConstraints extends EventEmitter {
226
224
  matches.push({
227
225
  level: match[1].length,
228
226
  name: match[2].trim(),
229
- index: match.index
227
+ index: match.index,
230
228
  });
231
229
  }
232
230
 
@@ -239,7 +237,7 @@ class TemplateConstraints extends EventEmitter {
239
237
  level: matches[i].level,
240
238
  name: matches[i].name,
241
239
  content: sectionContent,
242
- length: sectionContent.length
240
+ length: sectionContent.length,
243
241
  });
244
242
  }
245
243
 
@@ -260,7 +258,7 @@ class TemplateConstraints extends EventEmitter {
260
258
  [MARKER_TYPE.TODO]: /\[TODO\]:\s*(.+?)(?:\n|$)/gi,
261
259
  [MARKER_TYPE.QUESTION]: /\[QUESTION\]:\s*(.+?)(?:\n|$)/gi,
262
260
  [MARKER_TYPE.VERIFIED]: /\[VERIFIED\]:\s*(.+?)(?:\n|$)/gi,
263
- [MARKER_TYPE.UNCERTAIN]: /\[UNCERTAIN(?:\s*:\s*(\d+)%)?\]:\s*(.+?)(?:\n|$)/gi
261
+ [MARKER_TYPE.UNCERTAIN]: /\[UNCERTAIN(?:\s*:\s*(\d+)%)?\]:\s*(.+?)(?:\n|$)/gi,
264
262
  };
265
263
 
266
264
  for (const [type, pattern] of Object.entries(markerPatterns)) {
@@ -271,13 +269,13 @@ class TemplateConstraints extends EventEmitter {
271
269
  type,
272
270
  confidence: match[1] ? parseInt(match[1]) : 50,
273
271
  text: match[2].trim(),
274
- index: match.index
272
+ index: match.index,
275
273
  });
276
274
  } else {
277
275
  markers.push({
278
276
  type,
279
277
  text: match[1].trim(),
280
- index: match.index
278
+ index: match.index,
281
279
  });
282
280
  }
283
281
  }
@@ -294,22 +292,22 @@ class TemplateConstraints extends EventEmitter {
294
292
  */
295
293
  validateFormat(content, format) {
296
294
  const formatValidators = {
297
- ears: (c) => {
295
+ ears: c => {
298
296
  // EARS format: When/While/If/Where patterns
299
297
  return /\b(when|while|if|where|shall|should|must)\b/i.test(c);
300
298
  },
301
- c4: (c) => {
299
+ c4: c => {
302
300
  // C4 model references
303
301
  return /\b(system|container|component|context|boundary)\b/i.test(c);
304
302
  },
305
- adr: (c) => {
303
+ adr: c => {
306
304
  // ADR format: Status, Context, Decision, Consequences
307
305
  return /\b(status|context|decision|consequences|accepted|proposed|deprecated)\b/i.test(c);
308
306
  },
309
- checklist: (c) => {
307
+ checklist: c => {
310
308
  // Checklist format
311
- return /^\s*[-*\[\]]\s+/m.test(c);
312
- }
309
+ return /^\s*[-*[\]]\s+/m.test(c);
310
+ },
313
311
  };
314
312
 
315
313
  const validator = formatValidators[format];
@@ -321,7 +319,7 @@ class TemplateConstraints extends EventEmitter {
321
319
  */
322
320
  calculateScore(template, errors, warnings) {
323
321
  let score = 100;
324
- const totalSections = template.sections.length;
322
+ const _totalSections = template.sections.length;
325
323
  const requiredSections = template.sections.filter(s => s.required).length;
326
324
 
327
325
  // Deduct for errors
@@ -375,7 +373,7 @@ class TemplateConstraints extends EventEmitter {
375
373
  }
376
374
  this.customConstraints.set(name, {
377
375
  severity: 'warning',
378
- ...constraint
376
+ ...constraint,
379
377
  });
380
378
  }
381
379
 
@@ -418,9 +416,8 @@ class TemplateConstraints extends EventEmitter {
418
416
  getStats() {
419
417
  const total = this.validationHistory.length;
420
418
  const valid = this.validationHistory.filter(h => h.valid).length;
421
- const avgScore = total > 0
422
- ? this.validationHistory.reduce((sum, h) => sum + h.score, 0) / total
423
- : 0;
419
+ const avgScore =
420
+ total > 0 ? this.validationHistory.reduce((sum, h) => sum + h.score, 0) / total : 0;
424
421
 
425
422
  const byTemplate = {};
426
423
  for (const h of this.validationHistory) {
@@ -445,7 +442,7 @@ class TemplateConstraints extends EventEmitter {
445
442
  avgScore: Math.round(avgScore),
446
443
  byTemplate,
447
444
  templateCount: Object.keys(this.templates).length,
448
- constraintCount: this.customConstraints.size
445
+ constraintCount: this.customConstraints.size,
449
446
  };
450
447
  }
451
448
 
@@ -459,7 +456,7 @@ class TemplateConstraints extends EventEmitter {
459
456
  name: template.name,
460
457
  sections: template.sections.length,
461
458
  requiredSections: template.sections.filter(s => s.required).length,
462
- markers: template.markers || []
459
+ markers: template.markers || [],
463
460
  }));
464
461
  }
465
462
 
@@ -483,7 +480,7 @@ class ThinkingChecklist extends EventEmitter {
483
480
  */
484
481
  constructor(options = {}) {
485
482
  super();
486
-
483
+
487
484
  this.name = options.name || 'Thinking Checklist';
488
485
  this.items = options.items || this.getDefaultItems();
489
486
  this.completedItems = new Set();
@@ -504,7 +501,7 @@ class ThinkingChecklist extends EventEmitter {
504
501
  { id: 'risks', category: 'Risk', text: 'What could go wrong?' },
505
502
  { id: 'dependencies', category: 'Risk', text: 'What are the dependencies?' },
506
503
  { id: 'testing', category: 'Quality', text: 'How will this be tested?' },
507
- { id: 'maintainability', category: 'Quality', text: 'Is this maintainable?' }
504
+ { id: 'maintainability', category: 'Quality', text: 'Is this maintainable?' },
508
505
  ];
509
506
  }
510
507
 
@@ -559,7 +556,7 @@ class ThinkingChecklist extends EventEmitter {
559
556
  remaining: remaining.map(i => i.id),
560
557
  percentage: Math.round((completed / total) * 100),
561
558
  byCategory,
562
- isComplete: completed === total
559
+ isComplete: completed === total,
563
560
  };
564
561
  }
565
562
 
@@ -606,7 +603,7 @@ class ThinkingChecklist extends EventEmitter {
606
603
  }
607
604
  this.items.push({
608
605
  category: 'Custom',
609
- ...item
606
+ ...item,
610
607
  });
611
608
  }
612
609
 
@@ -642,5 +639,5 @@ module.exports = {
642
639
  CONSTRAINT_TYPE,
643
640
  UNCERTAINTY,
644
641
  MARKER_TYPE,
645
- DEFAULT_TEMPLATES
642
+ DEFAULT_TEMPLATES,
646
643
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Advanced Validation Engine
3
3
  * クロスアーティファクト一貫性検証と仕様ギャップ検出
4
- *
4
+ *
5
5
  * @module validators/advanced-validation
6
6
  */
7
7
 
@@ -15,7 +15,7 @@ const VALIDATION_TYPE = {
15
15
  GAP_DETECTION: 'gap-detection',
16
16
  TRACEABILITY: 'traceability',
17
17
  CONSISTENCY: 'consistency',
18
- COMPLETENESS: 'completeness'
18
+ COMPLETENESS: 'completeness',
19
19
  };
20
20
 
21
21
  /**
@@ -27,7 +27,7 @@ const ARTIFACT_TYPE = {
27
27
  IMPLEMENTATION: 'implementation',
28
28
  TEST: 'test',
29
29
  STEERING: 'steering',
30
- DOCUMENTATION: 'documentation'
30
+ DOCUMENTATION: 'documentation',
31
31
  };
32
32
 
33
33
  /**
@@ -37,7 +37,7 @@ const GAP_SEVERITY = {
37
37
  CRITICAL: 'critical',
38
38
  MAJOR: 'major',
39
39
  MINOR: 'minor',
40
- INFO: 'info'
40
+ INFO: 'info',
41
41
  };
42
42
 
43
43
  /**
@@ -51,7 +51,7 @@ class AdvancedValidation extends EventEmitter {
51
51
  */
52
52
  constructor(options = {}) {
53
53
  super();
54
-
54
+
55
55
  this.strict = options.strict ?? false;
56
56
  this.customRules = new Map();
57
57
  this.artifacts = new Map();
@@ -79,7 +79,7 @@ class AdvancedValidation extends EventEmitter {
79
79
  this.artifacts.set(id, {
80
80
  id,
81
81
  ...artifact,
82
- registeredAt: new Date().toISOString()
82
+ registeredAt: new Date().toISOString(),
83
83
  });
84
84
 
85
85
  this.emit('artifact-registered', { id, artifact });
@@ -115,7 +115,7 @@ class AdvancedValidation extends EventEmitter {
115
115
  this.traceabilityMatrix.get(sourceId).push({
116
116
  target: targetId,
117
117
  type: linkType,
118
- createdAt: new Date().toISOString()
118
+ createdAt: new Date().toISOString(),
119
119
  });
120
120
  }
121
121
 
@@ -124,7 +124,7 @@ class AdvancedValidation extends EventEmitter {
124
124
  * @param {Object} options
125
125
  * @returns {Object}
126
126
  */
127
- validateCrossArtifact(options = {}) {
127
+ validateCrossArtifact(_options = {}) {
128
128
  const issues = [];
129
129
  const validated = [];
130
130
 
@@ -139,7 +139,7 @@ class AdvancedValidation extends EventEmitter {
139
139
  artifactId: id,
140
140
  artifactType: artifact.type,
141
141
  severity: GAP_SEVERITY.MAJOR,
142
- message: `Artifact "${id}" has no traceability links`
142
+ message: `Artifact "${id}" has no traceability links`,
143
143
  });
144
144
  }
145
145
 
@@ -155,7 +155,7 @@ class AdvancedValidation extends EventEmitter {
155
155
  sourceId,
156
156
  targetId: link.target,
157
157
  severity: GAP_SEVERITY.CRITICAL,
158
- message: `Broken link: ${sourceId} -> ${link.target}`
158
+ message: `Broken link: ${sourceId} -> ${link.target}`,
159
159
  });
160
160
  }
161
161
  }
@@ -175,7 +175,7 @@ class AdvancedValidation extends EventEmitter {
175
175
  targetId: link.target,
176
176
  linkType: link.type,
177
177
  severity: GAP_SEVERITY.MINOR,
178
- message: `Unusual link: ${sourceArtifact.type} -[${link.type}]-> ${targetArtifact.type}`
178
+ message: `Unusual link: ${sourceArtifact.type} -[${link.type}]-> ${targetArtifact.type}`,
179
179
  });
180
180
  }
181
181
  }
@@ -187,7 +187,7 @@ class AdvancedValidation extends EventEmitter {
187
187
  valid: issues.filter(i => i.severity === GAP_SEVERITY.CRITICAL).length === 0,
188
188
  issues,
189
189
  validated,
190
- timestamp: new Date().toISOString()
190
+ timestamp: new Date().toISOString(),
191
191
  };
192
192
 
193
193
  this.validationHistory.push(result);
@@ -216,7 +216,7 @@ class AdvancedValidation extends EventEmitter {
216
216
  'requirement-design': ['implements', 'addresses', 'derives'],
217
217
  'design-implementation': ['implements', 'realizes'],
218
218
  'implementation-test': ['tests', 'verifies'],
219
- 'requirement-test': ['verifies', 'validates']
219
+ 'requirement-test': ['verifies', 'validates'],
220
220
  };
221
221
 
222
222
  const key = `${sourceType}-${targetType}`;
@@ -231,7 +231,7 @@ class AdvancedValidation extends EventEmitter {
231
231
  * @param {Object} options
232
232
  * @returns {Object}
233
233
  */
234
- detectGaps(options = {}) {
234
+ detectGaps(_options = {}) {
235
235
  const gaps = [];
236
236
 
237
237
  // Requirements without design
@@ -247,7 +247,7 @@ class AdvancedValidation extends EventEmitter {
247
247
  type: 'missing-design',
248
248
  artifactId: req.id,
249
249
  severity: GAP_SEVERITY.MAJOR,
250
- message: `Requirement "${req.id}" has no associated design`
250
+ message: `Requirement "${req.id}" has no associated design`,
251
251
  });
252
252
  }
253
253
  }
@@ -260,7 +260,7 @@ class AdvancedValidation extends EventEmitter {
260
260
  type: 'missing-implementation',
261
261
  artifactId: design.id,
262
262
  severity: GAP_SEVERITY.MAJOR,
263
- message: `Design "${design.id}" has no associated implementation`
263
+ message: `Design "${design.id}" has no associated implementation`,
264
264
  });
265
265
  }
266
266
  }
@@ -273,7 +273,7 @@ class AdvancedValidation extends EventEmitter {
273
273
  type: 'missing-test',
274
274
  artifactId: impl.id,
275
275
  severity: GAP_SEVERITY.MINOR,
276
- message: `Implementation "${impl.id}" has no associated tests`
276
+ message: `Implementation "${impl.id}" has no associated tests`,
277
277
  });
278
278
  }
279
279
  }
@@ -284,7 +284,7 @@ class AdvancedValidation extends EventEmitter {
284
284
  designs: designs.length,
285
285
  implementations: implementations.length,
286
286
  tests: tests.length,
287
- coverage: this.calculateCoverage()
287
+ coverage: this.calculateCoverage(),
288
288
  };
289
289
 
290
290
  const result = {
@@ -293,7 +293,7 @@ class AdvancedValidation extends EventEmitter {
293
293
  completeness,
294
294
  gapCount: gaps.length,
295
295
  criticalGaps: gaps.filter(g => g.severity === GAP_SEVERITY.CRITICAL).length,
296
- timestamp: new Date().toISOString()
296
+ timestamp: new Date().toISOString(),
297
297
  };
298
298
 
299
299
  this.validationHistory.push(result);
@@ -375,7 +375,7 @@ class AdvancedValidation extends EventEmitter {
375
375
  sourceId,
376
376
  targetId: link.target,
377
377
  severity: GAP_SEVERITY.INFO,
378
- message: `Unidirectional link: ${sourceId} -> ${link.target}`
378
+ message: `Unidirectional link: ${sourceId} -> ${link.target}`,
379
379
  });
380
380
  }
381
381
  }
@@ -391,7 +391,7 @@ class AdvancedValidation extends EventEmitter {
391
391
  coverage,
392
392
  artifactCount: this.artifacts.size,
393
393
  linkCount: this.countLinks(),
394
- timestamp: new Date().toISOString()
394
+ timestamp: new Date().toISOString(),
395
395
  };
396
396
 
397
397
  this.validationHistory.push(result);
@@ -420,7 +420,7 @@ class AdvancedValidation extends EventEmitter {
420
420
  }
421
421
  this.customRules.set(name, {
422
422
  severity: GAP_SEVERITY.MINOR,
423
- ...rule
423
+ ...rule,
424
424
  });
425
425
  }
426
426
 
@@ -440,32 +440,26 @@ class AdvancedValidation extends EventEmitter {
440
440
  const result = rule.validate(this.artifacts, this.traceabilityMatrix);
441
441
  customResults.push({
442
442
  name,
443
- ...result
443
+ ...result,
444
444
  });
445
445
  } catch (error) {
446
446
  customResults.push({
447
447
  name,
448
- error: error.message
448
+ error: error.message,
449
449
  });
450
450
  }
451
451
  }
452
452
 
453
- const allIssues = [
454
- ...crossArtifact.issues,
455
- ...gaps.gaps,
456
- ...traceability.issues
457
- ];
453
+ const allIssues = [...crossArtifact.issues, ...gaps.gaps, ...traceability.issues];
458
454
 
459
- const overallValid = allIssues.filter(i =>
460
- i.severity === GAP_SEVERITY.CRITICAL
461
- ).length === 0;
455
+ const overallValid = allIssues.filter(i => i.severity === GAP_SEVERITY.CRITICAL).length === 0;
462
456
 
463
457
  return {
464
458
  valid: overallValid,
465
459
  summary: {
466
460
  crossArtifact: crossArtifact.valid,
467
461
  gaps: gaps.gapCount === 0,
468
- traceability: traceability.valid
462
+ traceability: traceability.valid,
469
463
  },
470
464
  crossArtifact,
471
465
  gaps,
@@ -473,7 +467,7 @@ class AdvancedValidation extends EventEmitter {
473
467
  customRules: customResults,
474
468
  totalIssues: allIssues.length,
475
469
  criticalIssues: allIssues.filter(i => i.severity === GAP_SEVERITY.CRITICAL).length,
476
- timestamp: new Date().toISOString()
470
+ timestamp: new Date().toISOString(),
477
471
  };
478
472
  }
479
473
 
@@ -549,7 +543,7 @@ class AdvancedValidation extends EventEmitter {
549
543
  linkCount: this.countLinks(),
550
544
  ruleCount: this.customRules.size,
551
545
  historyCount: this.validationHistory.length,
552
- coverage: this.calculateCoverage()
546
+ coverage: this.calculateCoverage(),
553
547
  };
554
548
  }
555
549
 
@@ -576,5 +570,5 @@ module.exports = {
576
570
  createAdvancedValidation,
577
571
  VALIDATION_TYPE,
578
572
  ARTIFACT_TYPE,
579
- GAP_SEVERITY
573
+ GAP_SEVERITY,
580
574
  };