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,9 +1,9 @@
1
1
  /**
2
2
  * AdaptiveGoalModifier - 状況に応じた目標の動的調整
3
- *
3
+ *
4
4
  * Goal-Driven Replanning の完全実装 (Phase 2/3)
5
5
  * 目標の優先度・スコープ・タイムライン・成功基準を動的に調整
6
- *
6
+ *
7
7
  * @module orchestration/replanning/adaptive-goal-modifier
8
8
  */
9
9
 
@@ -13,32 +13,32 @@
13
13
  * 目標調整の理由を分類
14
14
  */
15
15
  const ModificationReason = {
16
- RESOURCE_CONSTRAINT: 'resource_constraint', // リソース制約
17
- TIME_CONSTRAINT: 'time_constraint', // 時間制約
18
- DEPENDENCY_FAILURE: 'dependency_failure', // 依存関係の失敗
19
- PRIORITY_SHIFT: 'priority_shift', // 優先度の変更
20
- SCOPE_CREEP: 'scope_creep', // スコープの拡大
21
- EXTERNAL_CHANGE: 'external_change', // 外部要因の変化
22
- PERFORMANCE_ISSUE: 'performance_issue', // パフォーマンス問題
23
- USER_REQUEST: 'user_request', // ユーザーリクエスト
24
- STRATEGIC_PIVOT: 'strategic_pivot' // 戦略的転換
16
+ RESOURCE_CONSTRAINT: 'resource_constraint', // リソース制約
17
+ TIME_CONSTRAINT: 'time_constraint', // 時間制約
18
+ DEPENDENCY_FAILURE: 'dependency_failure', // 依存関係の失敗
19
+ PRIORITY_SHIFT: 'priority_shift', // 優先度の変更
20
+ SCOPE_CREEP: 'scope_creep', // スコープの拡大
21
+ EXTERNAL_CHANGE: 'external_change', // 外部要因の変化
22
+ PERFORMANCE_ISSUE: 'performance_issue', // パフォーマンス問題
23
+ USER_REQUEST: 'user_request', // ユーザーリクエスト
24
+ STRATEGIC_PIVOT: 'strategic_pivot', // 戦略的転換
25
25
  };
26
26
 
27
27
  /**
28
28
  * 調整タイプ
29
29
  */
30
30
  const ModificationType = {
31
- PRIORITY_ADJUSTMENT: 'priority_adjustment', // 優先度調整
32
- SCOPE_REDUCTION: 'scope_reduction', // スコープ縮小
33
- SCOPE_EXPANSION: 'scope_expansion', // スコープ拡大
34
- TIMELINE_EXTENSION: 'timeline_extension', // タイムライン延長
35
- TIMELINE_COMPRESSION: 'timeline_compression', // タイムライン圧縮
31
+ PRIORITY_ADJUSTMENT: 'priority_adjustment', // 優先度調整
32
+ SCOPE_REDUCTION: 'scope_reduction', // スコープ縮小
33
+ SCOPE_EXPANSION: 'scope_expansion', // スコープ拡大
34
+ TIMELINE_EXTENSION: 'timeline_extension', // タイムライン延長
35
+ TIMELINE_COMPRESSION: 'timeline_compression', // タイムライン圧縮
36
36
  SUCCESS_CRITERIA_RELAXATION: 'criteria_relaxation', // 成功基準緩和
37
37
  SUCCESS_CRITERIA_TIGHTENING: 'criteria_tightening', // 成功基準厳格化
38
- GOAL_DECOMPOSITION: 'goal_decomposition', // 目標分解
39
- GOAL_MERGE: 'goal_merge', // 目標統合
40
- GOAL_DEFERRAL: 'goal_deferral', // 目標延期
41
- GOAL_CANCELLATION: 'goal_cancellation' // 目標キャンセル
38
+ GOAL_DECOMPOSITION: 'goal_decomposition', // 目標分解
39
+ GOAL_MERGE: 'goal_merge', // 目標統合
40
+ GOAL_DEFERRAL: 'goal_deferral', // 目標延期
41
+ GOAL_CANCELLATION: 'goal_cancellation', // 目標キャンセル
42
42
  };
43
43
 
44
44
  /**
@@ -53,7 +53,7 @@ class ImpactAnalyzer {
53
53
  this.config = {
54
54
  cascadeDepth: options.cascadeDepth || 3,
55
55
  impactThreshold: options.impactThreshold || 0.3,
56
- ...options
56
+ ...options,
57
57
  };
58
58
  }
59
59
 
@@ -87,7 +87,7 @@ class ImpactAnalyzer {
87
87
  totalScore,
88
88
  riskLevel: this._categorizeRisk(totalScore),
89
89
  recommendations: this._generateRecommendations(totalScore, modification),
90
- timestamp: new Date().toISOString()
90
+ timestamp: new Date().toISOString(),
91
91
  };
92
92
  }
93
93
 
@@ -107,16 +107,16 @@ class ImpactAnalyzer {
107
107
  [ModificationType.GOAL_DECOMPOSITION]: 0.4,
108
108
  [ModificationType.GOAL_MERGE]: 0.5,
109
109
  [ModificationType.GOAL_DEFERRAL]: 0.6,
110
- [ModificationType.GOAL_CANCELLATION]: 1.0
110
+ [ModificationType.GOAL_CANCELLATION]: 1.0,
111
111
  };
112
112
 
113
113
  const baseImpact = impacts[modification.type] || 0.5;
114
- const priorityMultiplier = goal.priority === 'critical' ? 1.5 :
115
- goal.priority === 'high' ? 1.2 : 1.0;
114
+ const priorityMultiplier =
115
+ goal.priority === 'critical' ? 1.5 : goal.priority === 'high' ? 1.2 : 1.0;
116
116
 
117
117
  return {
118
118
  score: Math.min(1.0, baseImpact * priorityMultiplier),
119
- affectedAreas: this._identifyAffectedAreas(modification.type)
119
+ affectedAreas: this._identifyAffectedAreas(modification.type),
120
120
  };
121
121
  }
122
122
 
@@ -125,9 +125,7 @@ class ImpactAnalyzer {
125
125
  * @private
126
126
  */
127
127
  _analyzeCascadeImpact(goal, modification, context) {
128
- const dependentGoals = context.goals?.filter(g =>
129
- g.dependencies?.includes(goal.id)
130
- ) || [];
128
+ const dependentGoals = context.goals?.filter(g => g.dependencies?.includes(goal.id)) || [];
131
129
 
132
130
  let totalCascade = 0;
133
131
  const affectedGoals = [];
@@ -139,7 +137,7 @@ class ImpactAnalyzer {
139
137
  affectedGoals.push({
140
138
  goalId: depGoal.id,
141
139
  impact,
142
- requires: this._determineCascadeAction(impact)
140
+ requires: this._determineCascadeAction(impact),
143
141
  });
144
142
  }
145
143
  }
@@ -147,7 +145,7 @@ class ImpactAnalyzer {
147
145
  return {
148
146
  score: Math.min(1.0, totalCascade / Math.max(1, dependentGoals.length)),
149
147
  affectedGoals,
150
- depth: Math.min(affectedGoals.length, this.config.cascadeDepth)
148
+ depth: Math.min(affectedGoals.length, this.config.cascadeDepth),
151
149
  };
152
150
  }
153
151
 
@@ -159,14 +157,18 @@ class ImpactAnalyzer {
159
157
  const resourceChanges = {
160
158
  freed: [],
161
159
  required: [],
162
- conflicting: []
160
+ conflicting: [],
163
161
  };
164
162
 
165
- if (modification.type === ModificationType.SCOPE_REDUCTION ||
166
- modification.type === ModificationType.GOAL_CANCELLATION) {
163
+ if (
164
+ modification.type === ModificationType.SCOPE_REDUCTION ||
165
+ modification.type === ModificationType.GOAL_CANCELLATION
166
+ ) {
167
167
  resourceChanges.freed = goal.resources || [];
168
- } else if (modification.type === ModificationType.SCOPE_EXPANSION ||
169
- modification.type === ModificationType.TIMELINE_COMPRESSION) {
168
+ } else if (
169
+ modification.type === ModificationType.SCOPE_EXPANSION ||
170
+ modification.type === ModificationType.TIMELINE_COMPRESSION
171
+ ) {
170
172
  resourceChanges.required = this._estimateAdditionalResources(goal, modification);
171
173
  }
172
174
 
@@ -181,7 +183,7 @@ class ImpactAnalyzer {
181
183
  return {
182
184
  score: resourceChanges.conflicting.length > 0 ? 0.7 : 0.3,
183
185
  changes: resourceChanges,
184
- feasibility: resourceChanges.conflicting.length === 0
186
+ feasibility: resourceChanges.conflicting.length === 0,
185
187
  };
186
188
  }
187
189
 
@@ -209,8 +211,8 @@ class ImpactAnalyzer {
209
211
  }
210
212
 
211
213
  if (context.milestones) {
212
- affectedMilestones = context.milestones.filter(m =>
213
- new Date(m.dueDate) >= new Date(goal.targetDate)
214
+ affectedMilestones = context.milestones.filter(
215
+ m => new Date(m.dueDate) >= new Date(goal.targetDate)
214
216
  );
215
217
  }
216
218
 
@@ -218,7 +220,7 @@ class ImpactAnalyzer {
218
220
  score: Math.min(1.0, Math.abs(shift) / 14), // 2週間を基準
219
221
  shiftDays: shift,
220
222
  direction: shift > 0 ? 'delay' : 'accelerate',
221
- affectedMilestones: affectedMilestones.length
223
+ affectedMilestones: affectedMilestones.length,
222
224
  };
223
225
  }
224
226
 
@@ -227,12 +229,7 @@ class ImpactAnalyzer {
227
229
  * @private
228
230
  */
229
231
  _calculateTotalImpact(direct, cascade, resource, timeline) {
230
- return (
231
- direct.score * 0.3 +
232
- cascade.score * 0.25 +
233
- resource.score * 0.25 +
234
- timeline.score * 0.2
235
- );
232
+ return direct.score * 0.3 + cascade.score * 0.25 + resource.score * 0.25 + timeline.score * 0.2;
236
233
  }
237
234
 
238
235
  /**
@@ -262,7 +259,7 @@ class ImpactAnalyzer {
262
259
  [ModificationType.GOAL_DECOMPOSITION]: ['tracking', 'dependencies'],
263
260
  [ModificationType.GOAL_MERGE]: ['tracking', 'dependencies', 'scope'],
264
261
  [ModificationType.GOAL_DEFERRAL]: ['milestones', 'dependencies'],
265
- [ModificationType.GOAL_CANCELLATION]: ['all']
262
+ [ModificationType.GOAL_CANCELLATION]: ['all'],
266
263
  };
267
264
  return areaMap[modificationType] || ['unknown'];
268
265
  }
@@ -273,10 +270,12 @@ class ImpactAnalyzer {
273
270
  */
274
271
  _calculateDependencyImpact(depGoal, modification) {
275
272
  const baseImpact = depGoal.dependencyStrength || 0.5;
276
- const typeMultiplier =
277
- modification.type === ModificationType.GOAL_CANCELLATION ? 1.0 :
278
- modification.type === ModificationType.TIMELINE_EXTENSION ? 0.7 :
279
- 0.4;
273
+ const typeMultiplier =
274
+ modification.type === ModificationType.GOAL_CANCELLATION
275
+ ? 1.0
276
+ : modification.type === ModificationType.TIMELINE_EXTENSION
277
+ ? 0.7
278
+ : 0.4;
280
279
  return baseImpact * typeMultiplier;
281
280
  }
282
281
 
@@ -299,7 +298,7 @@ class ImpactAnalyzer {
299
298
  const expansionFactor = modification.expansionFactor || 1.5;
300
299
  return currentResources.map(r => ({
301
300
  ...r,
302
- amount: Math.ceil(r.amount * (expansionFactor - 1))
301
+ amount: Math.ceil(r.amount * (expansionFactor - 1)),
303
302
  }));
304
303
  }
305
304
 
@@ -320,12 +319,12 @@ class ImpactAnalyzer {
320
319
  */
321
320
  _generateRecommendations(totalScore, modification) {
322
321
  const recommendations = [];
323
-
322
+
324
323
  if (totalScore >= 0.7) {
325
324
  recommendations.push({
326
325
  priority: 'high',
327
326
  action: 'Conduct stakeholder review before proceeding',
328
- rationale: 'High impact modification requires approval'
327
+ rationale: 'High impact modification requires approval',
329
328
  });
330
329
  }
331
330
 
@@ -333,7 +332,7 @@ class ImpactAnalyzer {
333
332
  recommendations.push({
334
333
  priority: 'medium',
335
334
  action: 'Review resource allocation',
336
- rationale: 'Scope expansion typically requires additional resources'
335
+ rationale: 'Scope expansion typically requires additional resources',
337
336
  });
338
337
  }
339
338
 
@@ -341,7 +340,7 @@ class ImpactAnalyzer {
341
340
  recommendations.push({
342
341
  priority: 'high',
343
342
  action: 'Assess quality risks',
344
- rationale: 'Compressed timelines may affect deliverable quality'
343
+ rationale: 'Compressed timelines may affect deliverable quality',
345
344
  });
346
345
  }
347
346
 
@@ -361,7 +360,7 @@ class ModificationStrategy {
361
360
  this.config = {
362
361
  conservativeMode: options.conservativeMode || false,
363
362
  autoApproveThreshold: options.autoApproveThreshold || 0.3,
364
- ...options
363
+ ...options,
365
364
  };
366
365
  }
367
366
 
@@ -376,7 +375,7 @@ class ModificationStrategy {
376
375
  const strategies = this._generateCandidateStrategies(goal, trigger, context);
377
376
  const evaluated = strategies.map(s => ({
378
377
  ...s,
379
- score: this._evaluateStrategy(s, goal, context)
378
+ score: this._evaluateStrategy(s, goal, context),
380
379
  }));
381
380
 
382
381
  evaluated.sort((a, b) => b.score - a.score);
@@ -385,7 +384,7 @@ class ModificationStrategy {
385
384
  recommended: evaluated[0],
386
385
  alternatives: evaluated.slice(1, 3),
387
386
  confidence: evaluated[0]?.score || 0,
388
- autoApprovable: evaluated[0]?.score >= (1 - this.config.autoApproveThreshold)
387
+ autoApprovable: evaluated[0]?.score >= 1 - this.config.autoApproveThreshold,
389
388
  };
390
389
  }
391
390
 
@@ -393,7 +392,7 @@ class ModificationStrategy {
393
392
  * 候補戦略を生成
394
393
  * @private
395
394
  */
396
- _generateCandidateStrategies(goal, trigger, context) {
395
+ _generateCandidateStrategies(goal, trigger, _context) {
397
396
  const strategies = [];
398
397
 
399
398
  switch (trigger.reason) {
@@ -459,7 +458,7 @@ class ModificationStrategy {
459
458
  * 戦略を評価
460
459
  * @private
461
460
  */
462
- _evaluateStrategy(strategy, goal, context) {
461
+ _evaluateStrategy(strategy, goal, _context) {
463
462
  let score = 0.5; // ベーススコア
464
463
 
465
464
  // 目標優先度との整合性
@@ -473,8 +472,7 @@ class ModificationStrategy {
473
472
  }
474
473
 
475
474
  // リスクレベル
476
- score -= strategy.riskLevel === 'high' ? 0.2 :
477
- strategy.riskLevel === 'medium' ? 0.1 : 0;
475
+ score -= strategy.riskLevel === 'high' ? 0.2 : strategy.riskLevel === 'medium' ? 0.1 : 0;
478
476
 
479
477
  // 保守的モードの場合
480
478
  if (this.config.conservativeMode && strategy.conservative) {
@@ -488,7 +486,7 @@ class ModificationStrategy {
488
486
  }
489
487
 
490
488
  // 戦略生成メソッド群
491
- _createScopeReductionStrategy(goal, trigger) {
489
+ _createScopeReductionStrategy(goal, _trigger) {
492
490
  return {
493
491
  type: ModificationType.SCOPE_REDUCTION,
494
492
  description: 'Reduce scope to meet constraints',
@@ -497,7 +495,7 @@ class ModificationStrategy {
497
495
  resourceEfficiency: 'high',
498
496
  riskLevel: 'medium',
499
497
  conservative: true,
500
- feasibility: 0.8
498
+ feasibility: 0.8,
501
499
  };
502
500
  }
503
501
 
@@ -510,7 +508,7 @@ class ModificationStrategy {
510
508
  resourceEfficiency: 'medium',
511
509
  riskLevel: 'low',
512
510
  conservative: true,
513
- feasibility: 0.9
511
+ feasibility: 0.9,
514
512
  };
515
513
  }
516
514
 
@@ -523,11 +521,11 @@ class ModificationStrategy {
523
521
  resourceEfficiency: 'low',
524
522
  riskLevel: 'high',
525
523
  conservative: false,
526
- feasibility: 0.6
524
+ feasibility: 0.6,
527
525
  };
528
526
  }
529
527
 
530
- _createCriteriaRelaxationStrategy(goal, trigger) {
528
+ _createCriteriaRelaxationStrategy(_goal, _trigger) {
531
529
  return {
532
530
  type: ModificationType.SUCCESS_CRITERIA_RELAXATION,
533
531
  description: 'Relax success criteria to achievable levels',
@@ -536,11 +534,11 @@ class ModificationStrategy {
536
534
  resourceEfficiency: 'high',
537
535
  riskLevel: 'medium',
538
536
  conservative: false,
539
- feasibility: 0.7
537
+ feasibility: 0.7,
540
538
  };
541
539
  }
542
540
 
543
- _createGoalDecompositionStrategy(goal, trigger) {
541
+ _createGoalDecompositionStrategy(goal, _trigger) {
544
542
  return {
545
543
  type: ModificationType.GOAL_DECOMPOSITION,
546
544
  description: 'Decompose goal into smaller, manageable sub-goals',
@@ -549,7 +547,7 @@ class ModificationStrategy {
549
547
  resourceEfficiency: 'medium',
550
548
  riskLevel: 'low',
551
549
  conservative: true,
552
- feasibility: 0.85
550
+ feasibility: 0.85,
553
551
  };
554
552
  }
555
553
 
@@ -562,7 +560,7 @@ class ModificationStrategy {
562
560
  resourceEfficiency: 'high',
563
561
  riskLevel: 'medium',
564
562
  conservative: true,
565
- feasibility: 0.9
563
+ feasibility: 0.9,
566
564
  };
567
565
  }
568
566
 
@@ -575,7 +573,7 @@ class ModificationStrategy {
575
573
  resourceEfficiency: 'medium',
576
574
  riskLevel: 'low',
577
575
  conservative: true,
578
- feasibility: 0.95
576
+ feasibility: 0.95,
579
577
  };
580
578
  }
581
579
 
@@ -588,7 +586,7 @@ class ModificationStrategy {
588
586
  resourceEfficiency: 'low',
589
587
  riskLevel: 'medium',
590
588
  conservative: false,
591
- feasibility: 0.7
589
+ feasibility: 0.7,
592
590
  };
593
591
  }
594
592
 
@@ -603,7 +601,7 @@ class ModificationStrategy {
603
601
  .map(d => ({
604
602
  id: d.id,
605
603
  name: d.name,
606
- estimatedSavings: d.effort || 1
604
+ estimatedSavings: d.effort || 1,
607
605
  }));
608
606
  }
609
607
 
@@ -617,7 +615,7 @@ class ModificationStrategy {
617
615
  id: `${goal.id}-${phase}`,
618
616
  name: `${goal.name} - ${phase.charAt(0).toUpperCase() + phase.slice(1)} Phase`,
619
617
  priority: index === 0 ? goal.priority : 'normal',
620
- estimatedEffort: Math.ceil((goal.estimatedEffort || 10) / 3)
618
+ estimatedEffort: Math.ceil((goal.estimatedEffort || 10) / 3),
621
619
  }));
622
620
  }
623
621
  }
@@ -634,7 +632,7 @@ class ModificationHistoryManager {
634
632
  this.history = new Map();
635
633
  this.config = {
636
634
  maxHistoryPerGoal: options.maxHistoryPerGoal || 50,
637
- ...options
635
+ ...options,
638
636
  };
639
637
  }
640
638
 
@@ -655,7 +653,7 @@ class ModificationHistoryManager {
655
653
  modification,
656
654
  impact,
657
655
  timestamp: new Date().toISOString(),
658
- status: 'applied'
656
+ status: 'applied',
659
657
  });
660
658
 
661
659
  // 履歴サイズ制限
@@ -697,18 +695,16 @@ class ModificationHistoryManager {
697
695
  totalImpact += entry.impact?.totalScore || 0;
698
696
  }
699
697
 
700
- const dominantType = Object.entries(typeCounts)
701
- .sort((a, b) => b[1] - a[1])[0];
702
- const dominantReason = Object.entries(reasonCounts)
703
- .sort((a, b) => b[1] - a[1])[0];
698
+ const dominantType = Object.entries(typeCounts).sort((a, b) => b[1] - a[1])[0];
699
+ const dominantReason = Object.entries(reasonCounts).sort((a, b) => b[1] - a[1])[0];
704
700
 
705
701
  const insights = [];
706
-
702
+
707
703
  if (history.length > 5) {
708
704
  insights.push({
709
705
  type: 'volatility',
710
706
  message: 'Goal has been modified frequently - consider stabilization',
711
- severity: 'warning'
707
+ severity: 'warning',
712
708
  });
713
709
  }
714
710
 
@@ -716,7 +712,7 @@ class ModificationHistoryManager {
716
712
  insights.push({
717
713
  type: 'pattern',
718
714
  message: `Recurring ${dominantType[0]} modifications detected`,
719
- suggestion: `Address root cause of ${dominantReason?.[0] || 'unknown'}`
715
+ suggestion: `Address root cause of ${dominantReason?.[0] || 'unknown'}`,
720
716
  });
721
717
  }
722
718
 
@@ -727,7 +723,7 @@ class ModificationHistoryManager {
727
723
  reasonDistribution: reasonCounts,
728
724
  dominantType: dominantType?.[0],
729
725
  dominantReason: dominantReason?.[0],
730
- insights
726
+ insights,
731
727
  };
732
728
  }
733
729
 
@@ -764,12 +760,12 @@ class AdaptiveGoalModifier {
764
760
  this.impactAnalyzer = new ImpactAnalyzer(options.impact);
765
761
  this.strategy = new ModificationStrategy(options.strategy);
766
762
  this.historyManager = new ModificationHistoryManager(options.history);
767
-
763
+
768
764
  this.config = {
769
765
  requireApproval: options.requireApproval ?? true,
770
766
  autoModifyThreshold: options.autoModifyThreshold || 0.3,
771
767
  notifyOnModification: options.notifyOnModification ?? true,
772
- ...options
768
+ ...options,
773
769
  };
774
770
 
775
771
  this.goals = new Map();
@@ -796,7 +792,7 @@ class AdaptiveGoalModifier {
796
792
  estimatedEffort: goal.estimatedEffort,
797
793
  status: 'active',
798
794
  createdAt: new Date().toISOString(),
799
- modificationCount: 0
795
+ modificationCount: 0,
800
796
  };
801
797
 
802
798
  this.goals.set(normalizedGoal.id, normalizedGoal);
@@ -837,12 +833,14 @@ class AdaptiveGoalModifier {
837
833
  impact,
838
834
  confidence: strategyResult.confidence,
839
835
  status: 'pending',
840
- createdAt: new Date().toISOString()
836
+ createdAt: new Date().toISOString(),
841
837
  };
842
838
 
843
839
  // 自動承認チェック
844
- if (!this.config.requireApproval ||
845
- (strategyResult.autoApprovable && impact.totalScore < this.config.autoModifyThreshold)) {
840
+ if (
841
+ !this.config.requireApproval ||
842
+ (strategyResult.autoApprovable && impact.totalScore < this.config.autoModifyThreshold)
843
+ ) {
846
844
  return this._applyModification(modification);
847
845
  }
848
846
 
@@ -853,7 +851,7 @@ class AdaptiveGoalModifier {
853
851
  return {
854
852
  status: 'pending_approval',
855
853
  modification,
856
- message: 'Modification requires approval before application'
854
+ message: 'Modification requires approval before application',
857
855
  };
858
856
  }
859
857
 
@@ -894,7 +892,7 @@ class AdaptiveGoalModifier {
894
892
  return {
895
893
  status: 'rejected',
896
894
  modification,
897
- message: `Modification rejected: ${reason}`
895
+ message: `Modification rejected: ${reason}`,
898
896
  };
899
897
  }
900
898
 
@@ -918,16 +916,13 @@ class AdaptiveGoalModifier {
918
916
  break;
919
917
 
920
918
  case ModificationType.SCOPE_REDUCTION:
921
- goal.deliverables = goal.deliverables.filter(d =>
922
- !strategy.reductionTargets?.some(t => t.id === d.id)
919
+ goal.deliverables = goal.deliverables.filter(
920
+ d => !strategy.reductionTargets?.some(t => t.id === d.id)
923
921
  );
924
922
  break;
925
923
 
926
924
  case ModificationType.SCOPE_EXPANSION:
927
- goal.deliverables = [
928
- ...goal.deliverables,
929
- ...(strategy.expansionItems || [])
930
- ];
925
+ goal.deliverables = [...goal.deliverables, ...(strategy.expansionItems || [])];
931
926
  break;
932
927
 
933
928
  case ModificationType.TIMELINE_EXTENSION:
@@ -949,14 +944,14 @@ class AdaptiveGoalModifier {
949
944
  case ModificationType.SUCCESS_CRITERIA_RELAXATION:
950
945
  goal.successCriteria = goal.successCriteria.map(c => ({
951
946
  ...c,
952
- threshold: c.threshold ? c.threshold * 0.8 : c.threshold
947
+ threshold: c.threshold ? c.threshold * 0.8 : c.threshold,
953
948
  }));
954
949
  break;
955
950
 
956
951
  case ModificationType.SUCCESS_CRITERIA_TIGHTENING:
957
952
  goal.successCriteria = goal.successCriteria.map(c => ({
958
953
  ...c,
959
- threshold: c.threshold ? c.threshold * 1.2 : c.threshold
954
+ threshold: c.threshold ? c.threshold * 1.2 : c.threshold,
960
955
  }));
961
956
  break;
962
957
 
@@ -965,7 +960,7 @@ class AdaptiveGoalModifier {
965
960
  for (const subGoal of strategy.suggestedSubGoals || []) {
966
961
  this.registerGoal({
967
962
  ...subGoal,
968
- parentGoalId: goal.id
963
+ parentGoalId: goal.id,
969
964
  });
970
965
  }
971
966
  goal.status = 'decomposed';
@@ -1000,7 +995,7 @@ class AdaptiveGoalModifier {
1000
995
  this._emit('modification_applied', {
1001
996
  modification,
1002
997
  goal,
1003
- previousState
998
+ previousState,
1004
999
  });
1005
1000
 
1006
1001
  return {
@@ -1008,7 +1003,7 @@ class AdaptiveGoalModifier {
1008
1003
  modification,
1009
1004
  goal,
1010
1005
  previousState,
1011
- message: `Successfully applied ${strategy.type} to goal ${goal.id}`
1006
+ message: `Successfully applied ${strategy.type} to goal ${goal.id}`,
1012
1007
  };
1013
1008
  }
1014
1009
 
@@ -1021,7 +1016,7 @@ class AdaptiveGoalModifier {
1021
1016
  goals: Array.from(this.goals.values()),
1022
1017
  currentGoal: this.goals.get(goalId),
1023
1018
  history: this.historyManager.getHistory(goalId),
1024
- patterns: this.historyManager.analyzePatterns(goalId)
1019
+ patterns: this.historyManager.analyzePatterns(goalId),
1025
1020
  };
1026
1021
  }
1027
1022
 
@@ -1050,7 +1045,7 @@ class AdaptiveGoalModifier {
1050
1045
  getGoalHistory(goalId) {
1051
1046
  return {
1052
1047
  history: this.historyManager.getHistory(goalId),
1053
- patterns: this.historyManager.analyzePatterns(goalId)
1048
+ patterns: this.historyManager.analyzePatterns(goalId),
1054
1049
  };
1055
1050
  }
1056
1051
 
@@ -1109,7 +1104,7 @@ class AdaptiveGoalModifier {
1109
1104
  suggestions.push({
1110
1105
  trigger: { reason: ModificationReason.TIME_CONSTRAINT, gap: 0.2 },
1111
1106
  urgency: 'high',
1112
- description: 'Progress behind schedule - consider scope reduction or timeline extension'
1107
+ description: 'Progress behind schedule - consider scope reduction or timeline extension',
1113
1108
  });
1114
1109
  }
1115
1110
 
@@ -1118,7 +1113,7 @@ class AdaptiveGoalModifier {
1118
1113
  suggestions.push({
1119
1114
  trigger: { reason: ModificationReason.RESOURCE_CONSTRAINT },
1120
1115
  urgency: 'medium',
1121
- description: 'High resource utilization - consider prioritization'
1116
+ description: 'High resource utilization - consider prioritization',
1122
1117
  });
1123
1118
  }
1124
1119
 
@@ -1127,7 +1122,7 @@ class AdaptiveGoalModifier {
1127
1122
  suggestions.push({
1128
1123
  trigger: { reason: ModificationReason.SCOPE_CREEP },
1129
1124
  urgency: 'medium',
1130
- description: 'Goal volatility detected - consider stabilization or decomposition'
1125
+ description: 'Goal volatility detected - consider stabilization or decomposition',
1131
1126
  });
1132
1127
  }
1133
1128
 
@@ -1135,7 +1130,7 @@ class AdaptiveGoalModifier {
1135
1130
  goalId,
1136
1131
  suggestions,
1137
1132
  patterns,
1138
- generatedAt: new Date().toISOString()
1133
+ generatedAt: new Date().toISOString(),
1139
1134
  };
1140
1135
  }
1141
1136
  }
@@ -1146,5 +1141,5 @@ module.exports = {
1146
1141
  ModificationStrategy,
1147
1142
  ModificationHistoryManager,
1148
1143
  ModificationReason,
1149
- ModificationType
1144
+ ModificationType,
1150
1145
  };