mcp-adr-analysis-server 2.0.21 → 2.1.0
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.
- package/README.md +94 -839
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/config/ai-config.d.ts.map +1 -1
- package/dist/src/config/ai-config.js +9 -9
- package/dist/src/config/ai-config.js.map +1 -1
- package/dist/src/index.d.ts +15 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1594 -837
- package/dist/src/index.js.map +1 -1
- package/dist/src/prompts/analysis-prompts.d.ts +4 -1
- package/dist/src/prompts/analysis-prompts.d.ts.map +1 -1
- package/dist/src/prompts/analysis-prompts.js +61 -30
- package/dist/src/prompts/analysis-prompts.js.map +1 -1
- package/dist/src/prompts/index.d.ts +17 -1
- package/dist/src/prompts/index.d.ts.map +1 -1
- package/dist/src/prompts/index.js +325 -1
- package/dist/src/prompts/index.js.map +1 -1
- package/dist/src/prompts/rule-generation-prompts.d.ts +5 -1
- package/dist/src/prompts/rule-generation-prompts.d.ts.map +1 -1
- package/dist/src/prompts/rule-generation-prompts.js +5 -1
- package/dist/src/prompts/rule-generation-prompts.js.map +1 -1
- package/dist/src/prompts/security-prompts.d.ts +6 -1
- package/dist/src/prompts/security-prompts.d.ts.map +1 -1
- package/dist/src/prompts/security-prompts.js +6 -1
- package/dist/src/prompts/security-prompts.js.map +1 -1
- package/dist/src/prompts/todo-prompts.d.ts +49 -0
- package/dist/src/prompts/todo-prompts.d.ts.map +1 -0
- package/dist/src/prompts/todo-prompts.js +824 -0
- package/dist/src/prompts/todo-prompts.js.map +1 -0
- package/dist/src/resources/index.d.ts.map +1 -1
- package/dist/src/resources/index.js +9 -7
- package/dist/src/resources/index.js.map +1 -1
- package/dist/src/tools/adr-bootstrap-validation-tool.d.ts +47 -0
- package/dist/src/tools/adr-bootstrap-validation-tool.d.ts.map +1 -0
- package/dist/src/tools/adr-bootstrap-validation-tool.js +979 -0
- package/dist/src/tools/adr-bootstrap-validation-tool.js.map +1 -0
- package/dist/src/tools/adr-suggestion-tool.d.ts +1 -0
- package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.js +330 -32
- package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
- package/dist/src/tools/content-masking-tool.d.ts +5 -0
- package/dist/src/tools/content-masking-tool.d.ts.map +1 -1
- package/dist/src/tools/content-masking-tool.js +631 -28
- package/dist/src/tools/content-masking-tool.js.map +1 -1
- package/dist/src/tools/deployment-readiness-tool.d.ts +8 -5
- package/dist/src/tools/deployment-readiness-tool.d.ts.map +1 -1
- package/dist/src/tools/deployment-readiness-tool.js +1017 -93
- package/dist/src/tools/deployment-readiness-tool.js.map +1 -1
- package/dist/src/tools/environment-analysis-tool.d.ts +4 -0
- package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
- package/dist/src/tools/environment-analysis-tool.js +568 -24
- package/dist/src/tools/environment-analysis-tool.js.map +1 -1
- package/dist/src/tools/interactive-adr-planning-tool.d.ts.map +1 -1
- package/dist/src/tools/interactive-adr-planning-tool.js +270 -108
- package/dist/src/tools/interactive-adr-planning-tool.js.map +1 -1
- package/dist/src/tools/mcp-planning-tool.d.ts.map +1 -1
- package/dist/src/tools/mcp-planning-tool.js +316 -183
- package/dist/src/tools/mcp-planning-tool.js.map +1 -1
- package/dist/src/tools/memory-loading-tool.d.ts +60 -0
- package/dist/src/tools/memory-loading-tool.d.ts.map +1 -0
- package/dist/src/tools/memory-loading-tool.js +457 -0
- package/dist/src/tools/memory-loading-tool.js.map +1 -0
- package/dist/src/tools/research-integration-tool.d.ts +4 -1
- package/dist/src/tools/research-integration-tool.d.ts.map +1 -1
- package/dist/src/tools/research-integration-tool.js +5 -1
- package/dist/src/tools/research-integration-tool.js.map +1 -1
- package/dist/src/tools/review-existing-adrs-tool.d.ts +19 -0
- package/dist/src/tools/review-existing-adrs-tool.d.ts.map +1 -0
- package/dist/src/tools/review-existing-adrs-tool.js +1204 -0
- package/dist/src/tools/review-existing-adrs-tool.js.map +1 -0
- package/dist/src/tools/rule-generation-tool.d.ts +2 -0
- package/dist/src/tools/rule-generation-tool.d.ts.map +1 -1
- package/dist/src/tools/rule-generation-tool.js +274 -33
- package/dist/src/tools/rule-generation-tool.js.map +1 -1
- package/dist/src/tools/smart-git-push-tool-v2.d.ts +4 -0
- package/dist/src/tools/smart-git-push-tool-v2.d.ts.map +1 -1
- package/dist/src/tools/smart-git-push-tool-v2.js +423 -229
- package/dist/src/tools/smart-git-push-tool-v2.js.map +1 -1
- package/dist/src/tools/smart-git-push-tool.d.ts +3 -0
- package/dist/src/tools/smart-git-push-tool.d.ts.map +1 -1
- package/dist/src/tools/smart-git-push-tool.js +241 -235
- package/dist/src/tools/smart-git-push-tool.js.map +1 -1
- package/dist/src/tools/tool-chain-orchestrator.d.ts +2 -2
- package/dist/src/tools/tool-chain-orchestrator.d.ts.map +1 -1
- package/dist/src/tools/tool-chain-orchestrator.js +152 -93
- package/dist/src/tools/tool-chain-orchestrator.js.map +1 -1
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts +22 -13
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts.map +1 -1
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js +660 -28
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js.map +1 -1
- package/dist/src/types/ape-framework.d.ts +93 -0
- package/dist/src/types/ape-framework.d.ts.map +1 -1
- package/dist/src/types/ape-framework.js +10 -10
- package/dist/src/types/ape-framework.js.map +1 -1
- package/dist/src/types/enhanced-errors.d.ts +173 -0
- package/dist/src/types/enhanced-errors.d.ts.map +1 -0
- package/dist/src/types/enhanced-errors.js +668 -0
- package/dist/src/types/enhanced-errors.js.map +1 -0
- package/dist/src/types/index.d.ts +129 -3
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +15 -0
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/knowledge-generation.d.ts +78 -0
- package/dist/src/types/knowledge-generation.d.ts.map +1 -1
- package/dist/src/types/knowledge-generation.js +10 -6
- package/dist/src/types/knowledge-generation.js.map +1 -1
- package/dist/src/types/knowledge-graph-schemas.d.ts +92 -0
- package/dist/src/types/knowledge-graph-schemas.d.ts.map +1 -1
- package/dist/src/types/knowledge-graph-schemas.js +45 -17
- package/dist/src/types/knowledge-graph-schemas.js.map +1 -1
- package/dist/src/types/memory-entities.d.ts +7209 -0
- package/dist/src/types/memory-entities.d.ts.map +1 -0
- package/dist/src/types/memory-entities.js +395 -0
- package/dist/src/types/memory-entities.js.map +1 -0
- package/dist/src/types/reflexion-framework.d.ts +44 -0
- package/dist/src/types/reflexion-framework.d.ts.map +1 -1
- package/dist/src/types/reflexion-framework.js +7 -7
- package/dist/src/types/reflexion-framework.js.map +1 -1
- package/dist/src/types/todo-json-schemas.d.ts +7 -653
- package/dist/src/types/todo-json-schemas.d.ts.map +1 -1
- package/dist/src/types/todo-json-schemas.js +6 -110
- package/dist/src/types/todo-json-schemas.js.map +1 -1
- package/dist/src/types/tool-arguments.d.ts +224 -0
- package/dist/src/types/tool-arguments.d.ts.map +1 -0
- package/dist/src/types/tool-arguments.js +6 -0
- package/dist/src/types/tool-arguments.js.map +1 -0
- package/dist/src/utils/actual-file-operations.d.ts.map +1 -1
- package/dist/src/utils/actual-file-operations.js +25 -9
- package/dist/src/utils/actual-file-operations.js.map +1 -1
- package/dist/src/utils/adr-discovery.d.ts +33 -1
- package/dist/src/utils/adr-discovery.d.ts.map +1 -1
- package/dist/src/utils/adr-discovery.js +14 -9
- package/dist/src/utils/adr-discovery.js.map +1 -1
- package/dist/src/utils/adr-suggestions.d.ts +72 -0
- package/dist/src/utils/adr-suggestions.d.ts.map +1 -1
- package/dist/src/utils/adr-suggestions.js +6 -0
- package/dist/src/utils/adr-suggestions.js.map +1 -1
- package/dist/src/utils/cache.d.ts.map +1 -1
- package/dist/src/utils/cache.js +22 -19
- package/dist/src/utils/cache.js.map +1 -1
- package/dist/src/utils/chain-of-thought-template.d.ts +13 -1
- package/dist/src/utils/chain-of-thought-template.d.ts.map +1 -1
- package/dist/src/utils/chain-of-thought-template.js +31 -22
- package/dist/src/utils/chain-of-thought-template.js.map +1 -1
- package/dist/src/utils/config.d.ts.map +1 -1
- package/dist/src/utils/config.js +1 -0
- package/dist/src/utils/config.js.map +1 -1
- package/dist/src/utils/directory-compat.js +1 -1
- package/dist/src/utils/directory-compat.js.map +1 -1
- package/dist/src/utils/enhanced-logging.d.ts +195 -0
- package/dist/src/utils/enhanced-logging.d.ts.map +1 -0
- package/dist/src/utils/enhanced-logging.js +449 -0
- package/dist/src/utils/enhanced-logging.js.map +1 -0
- package/dist/src/utils/file-system.d.ts +182 -34
- package/dist/src/utils/file-system.d.ts.map +1 -1
- package/dist/src/utils/file-system.js +648 -774
- package/dist/src/utils/file-system.js.map +1 -1
- package/dist/src/utils/gitleaks-detector.d.ts +50 -0
- package/dist/src/utils/gitleaks-detector.d.ts.map +1 -0
- package/dist/src/utils/gitleaks-detector.js +334 -0
- package/dist/src/utils/gitleaks-detector.js.map +1 -0
- package/dist/src/utils/interactive-approval.d.ts +1 -1
- package/dist/src/utils/interactive-approval.d.ts.map +1 -1
- package/dist/src/utils/interactive-approval.js +22 -17
- package/dist/src/utils/interactive-approval.js.map +1 -1
- package/dist/src/utils/json-safe.d.ts.map +1 -1
- package/dist/src/utils/json-safe.js +9 -6
- package/dist/src/utils/json-safe.js.map +1 -1
- package/dist/src/utils/knowledge-graph-manager.d.ts +37 -1
- package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -1
- package/dist/src/utils/knowledge-graph-manager.js +315 -70
- package/dist/src/utils/knowledge-graph-manager.js.map +1 -1
- package/dist/src/utils/location-filter.d.ts +35 -10
- package/dist/src/utils/location-filter.d.ts.map +1 -1
- package/dist/src/utils/location-filter.js +360 -94
- package/dist/src/utils/location-filter.js.map +1 -1
- package/dist/src/utils/mcp-response-validator.d.ts.map +1 -1
- package/dist/src/utils/mcp-response-validator.js +34 -19
- package/dist/src/utils/mcp-response-validator.js.map +1 -1
- package/dist/src/utils/memory-entity-manager.d.ts +134 -0
- package/dist/src/utils/memory-entity-manager.d.ts.map +1 -0
- package/dist/src/utils/memory-entity-manager.js +851 -0
- package/dist/src/utils/memory-entity-manager.js.map +1 -0
- package/dist/src/utils/memory-health-scoring.d.ts +125 -0
- package/dist/src/utils/memory-health-scoring.d.ts.map +1 -0
- package/dist/src/utils/memory-health-scoring.js +277 -0
- package/dist/src/utils/memory-health-scoring.js.map +1 -0
- package/dist/src/utils/memory-migration-manager.d.ts +93 -0
- package/dist/src/utils/memory-migration-manager.d.ts.map +1 -0
- package/dist/src/utils/memory-migration-manager.js +842 -0
- package/dist/src/utils/memory-migration-manager.js.map +1 -0
- package/dist/src/utils/memory-relationship-mapper.d.ts +87 -0
- package/dist/src/utils/memory-relationship-mapper.d.ts.map +1 -0
- package/dist/src/utils/memory-relationship-mapper.js +482 -0
- package/dist/src/utils/memory-relationship-mapper.js.map +1 -0
- package/dist/src/utils/memory-rollback-manager.d.ts +105 -0
- package/dist/src/utils/memory-rollback-manager.d.ts.map +1 -0
- package/dist/src/utils/memory-rollback-manager.js +575 -0
- package/dist/src/utils/memory-rollback-manager.js.map +1 -0
- package/dist/src/utils/memory-transformation.d.ts +59 -0
- package/dist/src/utils/memory-transformation.d.ts.map +1 -0
- package/dist/src/utils/memory-transformation.js +742 -0
- package/dist/src/utils/memory-transformation.js.map +1 -0
- package/dist/src/utils/output-masking.d.ts +12 -0
- package/dist/src/utils/output-masking.d.ts.map +1 -1
- package/dist/src/utils/output-masking.js +5 -0
- package/dist/src/utils/output-masking.js.map +1 -1
- package/dist/src/utils/prompt-execution.d.ts.map +1 -1
- package/dist/src/utils/prompt-execution.js +72 -51
- package/dist/src/utils/prompt-execution.js.map +1 -1
- package/dist/src/utils/release-readiness-detector.d.ts.map +1 -1
- package/dist/src/utils/release-readiness-detector.js +43 -42
- package/dist/src/utils/release-readiness-detector.js.map +1 -1
- package/dist/src/utils/research-integration.d.ts.map +1 -1
- package/dist/src/utils/research-integration.js +73 -44
- package/dist/src/utils/research-integration.js.map +1 -1
- package/dist/src/utils/research-questions.d.ts.map +1 -1
- package/dist/src/utils/research-questions.js +40 -14
- package/dist/src/utils/research-questions.js.map +1 -1
- package/dist/src/utils/ripgrep-wrapper.d.ts +84 -0
- package/dist/src/utils/ripgrep-wrapper.d.ts.map +1 -0
- package/dist/src/utils/ripgrep-wrapper.js +255 -0
- package/dist/src/utils/ripgrep-wrapper.js.map +1 -0
- package/dist/src/utils/rule-generation.d.ts.map +1 -1
- package/dist/src/utils/rule-generation.js +26 -15
- package/dist/src/utils/rule-generation.js.map +1 -1
- package/dist/src/utils/todo-file-watcher.d.ts +11 -23
- package/dist/src/utils/todo-file-watcher.d.ts.map +1 -1
- package/dist/src/utils/todo-file-watcher.js +18 -156
- package/dist/src/utils/todo-file-watcher.js.map +1 -1
- package/dist/src/utils/tree-sitter-analyzer.d.ts +185 -0
- package/dist/src/utils/tree-sitter-analyzer.d.ts.map +1 -0
- package/dist/src/utils/tree-sitter-analyzer.js +885 -0
- package/dist/src/utils/tree-sitter-analyzer.js.map +1 -0
- package/package.json +51 -10
- package/dist/src/tools/smart-score-tool.d.ts +0 -173
- package/dist/src/tools/smart-score-tool.d.ts.map +0 -1
- package/dist/src/tools/smart-score-tool.js +0 -681
- package/dist/src/tools/smart-score-tool.js.map +0 -1
- package/dist/src/tools/todo-management-tool-v2.d.ts +0 -368
- package/dist/src/tools/todo-management-tool-v2.d.ts.map +0 -1
- package/dist/src/tools/todo-management-tool-v2.js +0 -922
- package/dist/src/tools/todo-management-tool-v2.js.map +0 -1
- package/dist/src/utils/enhanced-sensitive-detector.d.ts +0 -61
- package/dist/src/utils/enhanced-sensitive-detector.d.ts.map +0 -1
- package/dist/src/utils/enhanced-sensitive-detector.js +0 -437
- package/dist/src/utils/enhanced-sensitive-detector.js.map +0 -1
- package/dist/src/utils/project-health-scoring.d.ts +0 -177
- package/dist/src/utils/project-health-scoring.d.ts.map +0 -1
- package/dist/src/utils/project-health-scoring.js +0 -370
- package/dist/src/utils/project-health-scoring.js.map +0 -1
- package/dist/src/utils/todo-json-manager.d.ts +0 -71
- package/dist/src/utils/todo-json-manager.d.ts.map +0 -1
- package/dist/src/utils/todo-json-manager.js +0 -396
- package/dist/src/utils/todo-json-manager.js.map +0 -1
- package/dist/src/utils/todo-markdown-converter.d.ts +0 -16
- package/dist/src/utils/todo-markdown-converter.d.ts.map +0 -1
- package/dist/src/utils/todo-markdown-converter.js +0 -362
- package/dist/src/utils/todo-markdown-converter.js.map +0 -1
- package/dist/src/utils/todo-migration.d.ts +0 -47
- package/dist/src/utils/todo-migration.d.ts.map +0 -1
- package/dist/src/utils/todo-migration.js +0 -261
- package/dist/src/utils/todo-migration.js.map +0 -1
|
@@ -34,8 +34,10 @@
|
|
|
34
34
|
*/
|
|
35
35
|
import { z } from 'zod';
|
|
36
36
|
import { promises as fs } from 'fs';
|
|
37
|
-
import { join } from 'path';
|
|
37
|
+
import { join, basename } from 'path';
|
|
38
|
+
import * as os from 'os';
|
|
38
39
|
import { McpAdrError } from '../types/index.js';
|
|
40
|
+
import { findFiles, findRelatedCode } from '../utils/file-system.js';
|
|
39
41
|
// Planning session schema
|
|
40
42
|
const PlanningSessionSchema = z.object({
|
|
41
43
|
sessionId: z.string(),
|
|
@@ -47,57 +49,69 @@ const PlanningSessionSchema = z.object({
|
|
|
47
49
|
'impact_assessment',
|
|
48
50
|
'implementation_planning',
|
|
49
51
|
'adr_generation',
|
|
50
|
-
'completed'
|
|
52
|
+
'completed',
|
|
51
53
|
]),
|
|
52
54
|
context: z.object({
|
|
53
55
|
projectPath: z.string(),
|
|
54
56
|
adrDirectory: z.string().default('docs/adrs'),
|
|
55
57
|
problemStatement: z.string().optional(),
|
|
56
|
-
researchFindings: z
|
|
58
|
+
researchFindings: z
|
|
59
|
+
.array(z.object({
|
|
57
60
|
source: z.string(),
|
|
58
61
|
insight: z.string(),
|
|
59
|
-
relevance: z.string()
|
|
60
|
-
}))
|
|
61
|
-
|
|
62
|
+
relevance: z.string(),
|
|
63
|
+
}))
|
|
64
|
+
.default([]),
|
|
65
|
+
options: z
|
|
66
|
+
.array(z.object({
|
|
62
67
|
name: z.string(),
|
|
63
68
|
description: z.string(),
|
|
64
69
|
pros: z.array(z.string()),
|
|
65
70
|
cons: z.array(z.string()),
|
|
66
71
|
risks: z.array(z.string()),
|
|
67
72
|
effort: z.enum(['low', 'medium', 'high']),
|
|
68
|
-
confidence: z.number().min(0).max(100)
|
|
69
|
-
}))
|
|
70
|
-
|
|
73
|
+
confidence: z.number().min(0).max(100),
|
|
74
|
+
}))
|
|
75
|
+
.default([]),
|
|
76
|
+
selectedOption: z
|
|
77
|
+
.object({
|
|
71
78
|
name: z.string(),
|
|
72
79
|
rationale: z.string(),
|
|
73
|
-
tradeoffs: z.array(z.string())
|
|
74
|
-
})
|
|
75
|
-
|
|
80
|
+
tradeoffs: z.array(z.string()),
|
|
81
|
+
})
|
|
82
|
+
.optional(),
|
|
83
|
+
impacts: z
|
|
84
|
+
.object({
|
|
76
85
|
technical: z.array(z.string()).default([]),
|
|
77
86
|
business: z.array(z.string()).default([]),
|
|
78
87
|
team: z.array(z.string()).default([]),
|
|
79
88
|
risks: z.array(z.string()).default([]),
|
|
80
|
-
dependencies: z.array(z.string()).default([])
|
|
81
|
-
})
|
|
82
|
-
|
|
89
|
+
dependencies: z.array(z.string()).default([]),
|
|
90
|
+
})
|
|
91
|
+
.optional(),
|
|
92
|
+
implementation: z
|
|
93
|
+
.object({
|
|
83
94
|
phases: z.array(z.string()).default([]),
|
|
84
|
-
tasks: z
|
|
95
|
+
tasks: z
|
|
96
|
+
.array(z.object({
|
|
85
97
|
description: z.string(),
|
|
86
98
|
priority: z.enum(['low', 'medium', 'high', 'critical']),
|
|
87
99
|
effort: z.string(),
|
|
88
|
-
assignee: z.string().optional()
|
|
89
|
-
}))
|
|
100
|
+
assignee: z.string().optional(),
|
|
101
|
+
}))
|
|
102
|
+
.default([]),
|
|
90
103
|
timeline: z.string().optional(),
|
|
91
|
-
successCriteria: z.array(z.string()).default([])
|
|
92
|
-
})
|
|
93
|
-
|
|
104
|
+
successCriteria: z.array(z.string()).default([]),
|
|
105
|
+
})
|
|
106
|
+
.optional(),
|
|
107
|
+
adrContent: z.string().optional(),
|
|
94
108
|
}),
|
|
95
109
|
metadata: z.object({
|
|
96
110
|
createdAt: z.string(),
|
|
97
111
|
updatedAt: z.string(),
|
|
98
112
|
lastAction: z.string(),
|
|
99
|
-
nextSteps: z.array(z.string()).default([])
|
|
100
|
-
})
|
|
113
|
+
nextSteps: z.array(z.string()).default([]),
|
|
114
|
+
}),
|
|
101
115
|
});
|
|
102
116
|
// Input schema for tool operations
|
|
103
117
|
const InteractiveAdrPlanningSchema = z.object({
|
|
@@ -114,13 +128,16 @@ const InteractiveAdrPlanningSchema = z.object({
|
|
|
114
128
|
'update_todos',
|
|
115
129
|
'get_guidance',
|
|
116
130
|
'save_session',
|
|
117
|
-
'complete_session'
|
|
131
|
+
'complete_session',
|
|
118
132
|
]),
|
|
119
133
|
sessionId: z.string().optional(),
|
|
120
134
|
input: z.any().optional(),
|
|
121
135
|
projectPath: z.string(),
|
|
122
136
|
autoResearch: z.boolean().default(true).describe('Automatically trigger research when needed'),
|
|
123
|
-
generateTodos: z
|
|
137
|
+
generateTodos: z
|
|
138
|
+
.boolean()
|
|
139
|
+
.default(true)
|
|
140
|
+
.describe('Automatically generate TODO items from decisions'),
|
|
124
141
|
});
|
|
125
142
|
// Session storage
|
|
126
143
|
const sessions = new Map();
|
|
@@ -128,7 +145,8 @@ const sessions = new Map();
|
|
|
128
145
|
* Get or create cache directory
|
|
129
146
|
*/
|
|
130
147
|
async function getCacheDir(projectPath) {
|
|
131
|
-
const
|
|
148
|
+
const projectName = basename(projectPath);
|
|
149
|
+
const cacheDir = join(os.tmpdir(), projectName, 'cache');
|
|
132
150
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
133
151
|
return cacheDir;
|
|
134
152
|
}
|
|
@@ -166,7 +184,7 @@ async function startSession(args) {
|
|
|
166
184
|
projectPath: args.projectPath,
|
|
167
185
|
adrDirectory: 'docs/adrs',
|
|
168
186
|
researchFindings: [],
|
|
169
|
-
options: []
|
|
187
|
+
options: [],
|
|
170
188
|
},
|
|
171
189
|
metadata: {
|
|
172
190
|
createdAt: new Date().toISOString(),
|
|
@@ -175,9 +193,9 @@ async function startSession(args) {
|
|
|
175
193
|
nextSteps: [
|
|
176
194
|
'Define the architectural problem or decision point',
|
|
177
195
|
'Identify key stakeholders and constraints',
|
|
178
|
-
'Determine success criteria'
|
|
179
|
-
]
|
|
180
|
-
}
|
|
196
|
+
'Determine success criteria',
|
|
197
|
+
],
|
|
198
|
+
},
|
|
181
199
|
};
|
|
182
200
|
sessions.set(sessionId, session);
|
|
183
201
|
await saveSession(session);
|
|
@@ -202,7 +220,7 @@ Please provide:
|
|
|
202
220
|
${session.metadata.nextSteps.map(step => `- ${step}`).join('\n')}
|
|
203
221
|
|
|
204
222
|
Use \`provide_input\` with your problem statement to continue.`,
|
|
205
|
-
nextAction: 'provide_input'
|
|
223
|
+
nextAction: 'provide_input',
|
|
206
224
|
};
|
|
207
225
|
}
|
|
208
226
|
/**
|
|
@@ -229,7 +247,7 @@ async function continueSession(args) {
|
|
|
229
247
|
impact_assessment: 'Analyze the impacts and risks of the decision',
|
|
230
248
|
implementation_planning: 'Plan the implementation with tasks and timeline',
|
|
231
249
|
adr_generation: 'Generate the final ADR document',
|
|
232
|
-
completed: 'Session completed - ADR has been generated'
|
|
250
|
+
completed: 'Session completed - ADR has been generated',
|
|
233
251
|
};
|
|
234
252
|
return {
|
|
235
253
|
success: true,
|
|
@@ -238,7 +256,7 @@ async function continueSession(args) {
|
|
|
238
256
|
context: session.context,
|
|
239
257
|
guidance: phaseGuidance[session.phase],
|
|
240
258
|
nextSteps: session.metadata.nextSteps,
|
|
241
|
-
progress: getSessionProgress(session)
|
|
259
|
+
progress: getSessionProgress(session),
|
|
242
260
|
};
|
|
243
261
|
}
|
|
244
262
|
/**
|
|
@@ -292,7 +310,7 @@ async function handleProblemDefinition(session, input) {
|
|
|
292
310
|
session.metadata.nextSteps = [
|
|
293
311
|
'Research existing solutions',
|
|
294
312
|
'Analyze current architecture',
|
|
295
|
-
'Identify relevant patterns and practices'
|
|
313
|
+
'Identify relevant patterns and practices',
|
|
296
314
|
];
|
|
297
315
|
return {
|
|
298
316
|
success: true,
|
|
@@ -314,7 +332,7 @@ Would you like me to:
|
|
|
314
332
|
- Automatically research this topic? (use \`request_research\`)
|
|
315
333
|
- Or provide your own research findings? (use \`provide_input\` with findings)`,
|
|
316
334
|
nextAction: 'request_research',
|
|
317
|
-
autoResearch: true
|
|
335
|
+
autoResearch: true,
|
|
318
336
|
};
|
|
319
337
|
}
|
|
320
338
|
/**
|
|
@@ -329,7 +347,7 @@ async function handleResearchAnalysis(session, input) {
|
|
|
329
347
|
session.metadata.nextSteps = [
|
|
330
348
|
'Identify possible solutions',
|
|
331
349
|
'Evaluate pros and cons',
|
|
332
|
-
'Assess implementation effort'
|
|
350
|
+
'Assess implementation effort',
|
|
333
351
|
];
|
|
334
352
|
return {
|
|
335
353
|
success: true,
|
|
@@ -363,7 +381,7 @@ Please provide options in this format:
|
|
|
363
381
|
\`\`\`
|
|
364
382
|
|
|
365
383
|
Or use \`evaluate_options\` to have me help generate options based on the research.`,
|
|
366
|
-
nextAction: 'evaluate_options'
|
|
384
|
+
nextAction: 'evaluate_options',
|
|
367
385
|
};
|
|
368
386
|
}
|
|
369
387
|
/**
|
|
@@ -378,14 +396,16 @@ async function handleOptionExploration(session, input) {
|
|
|
378
396
|
session.metadata.nextSteps = [
|
|
379
397
|
'Compare options against criteria',
|
|
380
398
|
'Select best approach',
|
|
381
|
-
'Document rationale'
|
|
399
|
+
'Document rationale',
|
|
382
400
|
];
|
|
383
|
-
const optionComparison = session.context.options
|
|
401
|
+
const optionComparison = session.context.options
|
|
402
|
+
.map(opt => `### ${opt.name} (Confidence: ${opt.confidence}%)
|
|
384
403
|
**Description:** ${opt.description}
|
|
385
404
|
**Pros:** ${opt.pros.join(', ')}
|
|
386
405
|
**Cons:** ${opt.cons.join(', ')}
|
|
387
406
|
**Effort:** ${opt.effort}
|
|
388
|
-
**Risks:** ${opt.risks.join(', ')}`)
|
|
407
|
+
**Risks:** ${opt.risks.join(', ')}`)
|
|
408
|
+
.join('\n\n');
|
|
389
409
|
return {
|
|
390
410
|
success: true,
|
|
391
411
|
sessionId: session.sessionId,
|
|
@@ -412,7 +432,7 @@ Provide your decision with:
|
|
|
412
432
|
\`\`\`
|
|
413
433
|
|
|
414
434
|
Use \`make_decision\` to proceed.`,
|
|
415
|
-
nextAction: 'make_decision'
|
|
435
|
+
nextAction: 'make_decision',
|
|
416
436
|
};
|
|
417
437
|
}
|
|
418
438
|
/**
|
|
@@ -427,7 +447,7 @@ async function handleDecisionMaking(session, input) {
|
|
|
427
447
|
session.metadata.nextSteps = [
|
|
428
448
|
'Assess technical impacts',
|
|
429
449
|
'Evaluate business impacts',
|
|
430
|
-
'Identify risks and dependencies'
|
|
450
|
+
'Identify risks and dependencies',
|
|
431
451
|
];
|
|
432
452
|
return {
|
|
433
453
|
success: true,
|
|
@@ -457,7 +477,7 @@ Provide impact analysis:
|
|
|
457
477
|
\`\`\`
|
|
458
478
|
|
|
459
479
|
Use \`assess_impact\` to continue.`,
|
|
460
|
-
nextAction: 'assess_impact'
|
|
480
|
+
nextAction: 'assess_impact',
|
|
461
481
|
};
|
|
462
482
|
}
|
|
463
483
|
/**
|
|
@@ -472,7 +492,7 @@ async function handleImpactAssessment(session, input) {
|
|
|
472
492
|
session.metadata.nextSteps = [
|
|
473
493
|
'Define implementation phases',
|
|
474
494
|
'Create task list',
|
|
475
|
-
'Set timeline and milestones'
|
|
495
|
+
'Set timeline and milestones',
|
|
476
496
|
];
|
|
477
497
|
return {
|
|
478
498
|
success: true,
|
|
@@ -512,7 +532,7 @@ Provide implementation details:
|
|
|
512
532
|
\`\`\`
|
|
513
533
|
|
|
514
534
|
Use \`plan_implementation\` to continue.`,
|
|
515
|
-
nextAction: 'plan_implementation'
|
|
535
|
+
nextAction: 'plan_implementation',
|
|
516
536
|
};
|
|
517
537
|
}
|
|
518
538
|
/**
|
|
@@ -527,7 +547,7 @@ async function handleImplementationPlanning(session, input) {
|
|
|
527
547
|
session.metadata.nextSteps = [
|
|
528
548
|
'Generate ADR document',
|
|
529
549
|
'Create TODO items',
|
|
530
|
-
'Update project plan'
|
|
550
|
+
'Update project plan',
|
|
531
551
|
];
|
|
532
552
|
return {
|
|
533
553
|
success: true,
|
|
@@ -555,7 +575,7 @@ The ADR will include:
|
|
|
555
575
|
|
|
556
576
|
Use \`generate_adr\` to create the ADR document.`,
|
|
557
577
|
nextAction: 'generate_adr',
|
|
558
|
-
readyToGenerate: true
|
|
578
|
+
readyToGenerate: true,
|
|
559
579
|
};
|
|
560
580
|
}
|
|
561
581
|
/**
|
|
@@ -597,7 +617,7 @@ You can:
|
|
|
597
617
|
- Use \`complete_session\` to finish and clean up
|
|
598
618
|
- Make manual edits to the ADR file as needed`,
|
|
599
619
|
nextAction: 'update_todos',
|
|
600
|
-
completed: true
|
|
620
|
+
completed: true,
|
|
601
621
|
};
|
|
602
622
|
}
|
|
603
623
|
/**
|
|
@@ -611,23 +631,50 @@ async function requestResearch(args) {
|
|
|
611
631
|
if (!session) {
|
|
612
632
|
throw new McpAdrError(`Session ${args.sessionId} not found`, 'SESSION_NOT_FOUND');
|
|
613
633
|
}
|
|
614
|
-
//
|
|
634
|
+
// Smart Code Linking - discover relevant code and architecture files for the problem
|
|
635
|
+
const problemContext = session.context.problemStatement || 'architectural decision';
|
|
636
|
+
const relatedCodeResult = await findRelatedCode('adr-problem-research', problemContext, session.context.projectPath, {
|
|
637
|
+
useAI: true,
|
|
638
|
+
useRipgrep: true,
|
|
639
|
+
maxFiles: 20,
|
|
640
|
+
includeContent: false,
|
|
641
|
+
});
|
|
642
|
+
// Smart Code Linking - discover project structure and documentation
|
|
643
|
+
const projectFilesResult = await findFiles(session.context.projectPath, ['*.md', '*.json', '*.yaml', '*.yml', '*.txt', '*.rst'], {
|
|
644
|
+
limit: 100,
|
|
645
|
+
});
|
|
646
|
+
// Enhanced research findings with actual code context
|
|
615
647
|
const researchFindings = [
|
|
616
648
|
{
|
|
617
649
|
source: 'Industry Best Practices',
|
|
618
|
-
insight: `For ${
|
|
619
|
-
relevance: 'High -
|
|
650
|
+
insight: `For architectural decisions like "${problemContext}", common patterns include layered architecture, microservices, and domain-driven design`,
|
|
651
|
+
relevance: 'High - Provides proven solution patterns',
|
|
620
652
|
},
|
|
621
653
|
{
|
|
622
654
|
source: 'Current Codebase Analysis',
|
|
623
|
-
insight:
|
|
624
|
-
|
|
655
|
+
insight: `Found ${relatedCodeResult.relatedFiles.length} files potentially related to the problem. Key areas: ${relatedCodeResult.relatedFiles
|
|
656
|
+
.slice(0, 5)
|
|
657
|
+
.map(f => f.path.split('/').pop())
|
|
658
|
+
.join(', ')}`,
|
|
659
|
+
relevance: 'High - Shows current implementation context',
|
|
625
660
|
},
|
|
626
661
|
{
|
|
627
|
-
source: '
|
|
628
|
-
insight:
|
|
629
|
-
relevance: '
|
|
630
|
-
}
|
|
662
|
+
source: 'Project Structure Analysis',
|
|
663
|
+
insight: `Project contains ${projectFilesResult.files.length} documentation/config files. Architecture appears to use ${detectArchitecturalPatterns(projectFilesResult.files.map(f => f.path))}`,
|
|
664
|
+
relevance: 'High - Indicates current architectural style',
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
source: 'Related Code Context',
|
|
668
|
+
insight: relatedCodeResult.relatedFiles.length > 0
|
|
669
|
+
? `Found relevant code in: ${relatedCodeResult.relatedFiles
|
|
670
|
+
.slice(0, 3)
|
|
671
|
+
.map(f => f.path)
|
|
672
|
+
.join(', ')}`
|
|
673
|
+
: 'No directly related code files found - this may be a greenfield decision',
|
|
674
|
+
relevance: relatedCodeResult.relatedFiles.length > 0
|
|
675
|
+
? 'High - Direct code impact'
|
|
676
|
+
: 'Medium - New implementation area',
|
|
677
|
+
},
|
|
631
678
|
];
|
|
632
679
|
session.context.researchFindings = researchFindings;
|
|
633
680
|
session.phase = 'option_exploration';
|
|
@@ -637,8 +684,13 @@ async function requestResearch(args) {
|
|
|
637
684
|
success: true,
|
|
638
685
|
sessionId: args.sessionId,
|
|
639
686
|
researchFindings,
|
|
640
|
-
|
|
641
|
-
|
|
687
|
+
codeContext: {
|
|
688
|
+
relatedFiles: relatedCodeResult.relatedFiles.length,
|
|
689
|
+
projectFiles: projectFilesResult.files.length,
|
|
690
|
+
keyFiles: relatedCodeResult.relatedFiles.slice(0, 5).map(f => f.path),
|
|
691
|
+
},
|
|
692
|
+
guidance: `Research complete with actual code context analysis. Found ${relatedCodeResult.relatedFiles.length} related files. Moving to option exploration phase.`,
|
|
693
|
+
nextAction: 'evaluate_options',
|
|
642
694
|
};
|
|
643
695
|
}
|
|
644
696
|
/**
|
|
@@ -652,46 +704,89 @@ async function evaluateOptions(args) {
|
|
|
652
704
|
if (!session) {
|
|
653
705
|
throw new McpAdrError(`Session ${args.sessionId} not found`, 'SESSION_NOT_FOUND');
|
|
654
706
|
}
|
|
655
|
-
//
|
|
656
|
-
const
|
|
707
|
+
// Smart Code Linking - find implementation examples and patterns in the codebase
|
|
708
|
+
const problemContext = session.context.problemStatement || 'architectural decision';
|
|
709
|
+
const patternContext = [
|
|
710
|
+
'architectural patterns',
|
|
711
|
+
'design patterns',
|
|
712
|
+
'implementation examples',
|
|
713
|
+
problemContext,
|
|
714
|
+
'configuration',
|
|
715
|
+
'setup',
|
|
716
|
+
'structure',
|
|
717
|
+
].join(' ');
|
|
718
|
+
const patternFiles = await findRelatedCode('adr-pattern-analysis', patternContext, session.context.projectPath, {
|
|
719
|
+
useAI: true,
|
|
720
|
+
useRipgrep: true,
|
|
721
|
+
maxFiles: 15,
|
|
722
|
+
includeContent: false,
|
|
723
|
+
});
|
|
724
|
+
// Smart Code Linking - find similar architectural decisions or configurations
|
|
725
|
+
const configFilesResult = await findFiles(session.context.projectPath, [
|
|
726
|
+
'*.config.*',
|
|
727
|
+
'package.json',
|
|
728
|
+
'tsconfig.json',
|
|
729
|
+
'*.dockerfile',
|
|
730
|
+
'docker-compose.*',
|
|
731
|
+
'*.yaml',
|
|
732
|
+
'*.yml',
|
|
733
|
+
], {
|
|
734
|
+
limit: 50,
|
|
735
|
+
});
|
|
736
|
+
// Generate contextual options based on actual codebase analysis
|
|
737
|
+
const baseOptions = [
|
|
657
738
|
{
|
|
658
|
-
name: '
|
|
659
|
-
description: '
|
|
660
|
-
pros: ['
|
|
661
|
-
cons: ['
|
|
662
|
-
risks: ['
|
|
663
|
-
effort: '
|
|
664
|
-
confidence:
|
|
739
|
+
name: 'Incremental Refactoring',
|
|
740
|
+
description: 'Gradually improve the existing architecture with minimal disruption',
|
|
741
|
+
pros: ['Low risk', 'Continuous delivery', 'Builds on existing patterns'],
|
|
742
|
+
cons: ['Slower progress', 'Technical debt accumulation', 'May not address root issues'],
|
|
743
|
+
risks: ['Incomplete transformation', 'Legacy constraints'],
|
|
744
|
+
effort: 'low',
|
|
745
|
+
confidence: 90,
|
|
665
746
|
},
|
|
666
747
|
{
|
|
667
|
-
name: '
|
|
668
|
-
description: '
|
|
669
|
-
pros: ['
|
|
670
|
-
cons: ['
|
|
671
|
-
risks: ['
|
|
748
|
+
name: 'Targeted Modernization',
|
|
749
|
+
description: 'Focus on specific components or areas identified through code analysis',
|
|
750
|
+
pros: ['Focused impact', 'Measurable improvements', 'Leverages existing structure'],
|
|
751
|
+
cons: ['Partial solution', 'Integration complexity'],
|
|
752
|
+
risks: ['Component boundaries', 'Data consistency'],
|
|
672
753
|
effort: 'medium',
|
|
673
|
-
confidence:
|
|
754
|
+
confidence: 85,
|
|
674
755
|
},
|
|
675
756
|
{
|
|
676
|
-
name: '
|
|
677
|
-
description: '
|
|
678
|
-
pros: ['
|
|
679
|
-
cons: ['
|
|
680
|
-
risks: ['
|
|
681
|
-
effort: '
|
|
682
|
-
confidence:
|
|
683
|
-
}
|
|
757
|
+
name: 'Comprehensive Redesign',
|
|
758
|
+
description: 'Complete architectural overhaul based on modern patterns',
|
|
759
|
+
pros: ['Clean slate approach', 'Modern best practices', 'Long-term maintainability'],
|
|
760
|
+
cons: ['High risk', 'Significant effort', 'Team learning curve'],
|
|
761
|
+
risks: ['Project timeline', 'Resource requirements', 'Knowledge transfer'],
|
|
762
|
+
effort: 'high',
|
|
763
|
+
confidence: 60,
|
|
764
|
+
},
|
|
684
765
|
];
|
|
685
|
-
|
|
766
|
+
// Enhance options with code context insights
|
|
767
|
+
const enhancedOptions = baseOptions.map(option => ({
|
|
768
|
+
...option,
|
|
769
|
+
codeContext: {
|
|
770
|
+
relatedFiles: patternFiles.relatedFiles.slice(0, 3).map(f => f.path),
|
|
771
|
+
configFiles: configFilesResult.files.slice(0, 3).map(f => f.path),
|
|
772
|
+
feasibilityNotes: generateFeasibilityNotes(option, patternFiles.relatedFiles, configFilesResult.files.map(f => f.path)),
|
|
773
|
+
},
|
|
774
|
+
}));
|
|
775
|
+
session.context.options = enhancedOptions;
|
|
686
776
|
session.phase = 'decision_making';
|
|
687
777
|
session.metadata.updatedAt = new Date().toISOString();
|
|
688
778
|
await saveSession(session);
|
|
689
779
|
return {
|
|
690
780
|
success: true,
|
|
691
781
|
sessionId: args.sessionId,
|
|
692
|
-
options,
|
|
693
|
-
|
|
694
|
-
|
|
782
|
+
options: enhancedOptions,
|
|
783
|
+
codeAnalysis: {
|
|
784
|
+
patternFiles: patternFiles.relatedFiles.length,
|
|
785
|
+
configFiles: configFilesResult.files.length,
|
|
786
|
+
keyPatterns: patternFiles.relatedFiles.slice(0, 5).map(f => f.path),
|
|
787
|
+
},
|
|
788
|
+
guidance: `Options evaluated with codebase context. Found ${patternFiles.relatedFiles.length} pattern-related files and ${configFilesResult.files.length} configuration files. Ready for decision making.`,
|
|
789
|
+
nextAction: 'make_decision',
|
|
695
790
|
};
|
|
696
791
|
}
|
|
697
792
|
/**
|
|
@@ -716,14 +811,14 @@ async function updateTodos(args) {
|
|
|
716
811
|
effort: task.effort,
|
|
717
812
|
assignee: task.assignee,
|
|
718
813
|
adrLink: session.context.adrContent ? 'Generated ADR' : undefined,
|
|
719
|
-
status: 'pending'
|
|
814
|
+
status: 'pending',
|
|
720
815
|
}));
|
|
721
816
|
return {
|
|
722
817
|
success: true,
|
|
723
818
|
sessionId: args.sessionId,
|
|
724
819
|
todosGenerated: todos.length,
|
|
725
820
|
todos,
|
|
726
|
-
guidance: `Generated ${todos.length} TODO items from the implementation plan
|
|
821
|
+
guidance: `Generated ${todos.length} TODO items from the implementation plan.`,
|
|
727
822
|
};
|
|
728
823
|
}
|
|
729
824
|
/**
|
|
@@ -743,52 +838,52 @@ async function getGuidance(args) {
|
|
|
743
838
|
'Be specific about the problem',
|
|
744
839
|
'Include quantifiable metrics if possible',
|
|
745
840
|
'Identify all stakeholders',
|
|
746
|
-
'Define clear success criteria'
|
|
841
|
+
'Define clear success criteria',
|
|
747
842
|
],
|
|
748
843
|
questions: [
|
|
749
844
|
'What specific problem are we solving?',
|
|
750
845
|
'Why does this need to be addressed now?',
|
|
751
846
|
'What happens if we do nothing?',
|
|
752
|
-
'How will we measure success?'
|
|
847
|
+
'How will we measure success?',
|
|
753
848
|
],
|
|
754
849
|
examples: [
|
|
755
850
|
'Application response time exceeds 3 seconds under load',
|
|
756
851
|
'Cannot deploy services independently',
|
|
757
|
-
'Database becoming a bottleneck for scaling'
|
|
758
|
-
]
|
|
852
|
+
'Database becoming a bottleneck for scaling',
|
|
853
|
+
],
|
|
759
854
|
},
|
|
760
855
|
research_analysis: {
|
|
761
856
|
tips: [
|
|
762
857
|
'Look for industry patterns',
|
|
763
858
|
'Analyze similar problems in your codebase',
|
|
764
859
|
'Consider team capabilities',
|
|
765
|
-
'Research tooling and frameworks'
|
|
860
|
+
'Research tooling and frameworks',
|
|
766
861
|
],
|
|
767
862
|
questions: [
|
|
768
863
|
'What solutions have others used?',
|
|
769
864
|
'What patterns apply to our context?',
|
|
770
865
|
'What are the technical constraints?',
|
|
771
|
-
'What skills does the team have?'
|
|
772
|
-
]
|
|
866
|
+
'What skills does the team have?',
|
|
867
|
+
],
|
|
773
868
|
},
|
|
774
869
|
option_exploration: {
|
|
775
870
|
tips: [
|
|
776
871
|
'Consider at least 3 options',
|
|
777
872
|
'Include a "do nothing" option if relevant',
|
|
778
873
|
'Be honest about pros and cons',
|
|
779
|
-
'Estimate effort realistically'
|
|
874
|
+
'Estimate effort realistically',
|
|
780
875
|
],
|
|
781
876
|
questions: [
|
|
782
877
|
'What are all possible approaches?',
|
|
783
878
|
'What are the tradeoffs?',
|
|
784
879
|
'How much effort is each option?',
|
|
785
|
-
'What are the risks?'
|
|
786
|
-
]
|
|
787
|
-
}
|
|
880
|
+
'What are the risks?',
|
|
881
|
+
],
|
|
882
|
+
},
|
|
788
883
|
};
|
|
789
884
|
const currentGuidance = phaseGuidance[session.phase] || {
|
|
790
885
|
tips: ['Follow the structured process'],
|
|
791
|
-
questions: ['What do you need help with?']
|
|
886
|
+
questions: ['What do you need help with?'],
|
|
792
887
|
};
|
|
793
888
|
return {
|
|
794
889
|
success: true,
|
|
@@ -796,7 +891,7 @@ async function getGuidance(args) {
|
|
|
796
891
|
phase: session.phase,
|
|
797
892
|
guidance: currentGuidance,
|
|
798
893
|
progress: getSessionProgress(session),
|
|
799
|
-
nextSteps: session.metadata.nextSteps
|
|
894
|
+
nextSteps: session.metadata.nextSteps,
|
|
800
895
|
};
|
|
801
896
|
}
|
|
802
897
|
/**
|
|
@@ -830,9 +925,9 @@ async function completeSession(args) {
|
|
|
830
925
|
decision: session.context.selectedOption?.name,
|
|
831
926
|
adrGenerated: !!session.context.adrContent,
|
|
832
927
|
tasksCreated: session.context.implementation?.tasks.length || 0,
|
|
833
|
-
duration: calculateDuration(session.metadata.createdAt, session.metadata.updatedAt)
|
|
928
|
+
duration: calculateDuration(session.metadata.createdAt, session.metadata.updatedAt),
|
|
834
929
|
},
|
|
835
|
-
message: 'Planning session completed successfully!'
|
|
930
|
+
message: 'Planning session completed successfully!',
|
|
836
931
|
};
|
|
837
932
|
}
|
|
838
933
|
/**
|
|
@@ -869,7 +964,8 @@ ${session.context.selectedOption?.tradeoffs.map(t => `- ${t}`).join('\n')}
|
|
|
869
964
|
|
|
870
965
|
## Considered Options
|
|
871
966
|
|
|
872
|
-
${session.context.options
|
|
967
|
+
${session.context.options
|
|
968
|
+
.map(opt => `
|
|
873
969
|
### ${opt.name}
|
|
874
970
|
|
|
875
971
|
${opt.description}
|
|
@@ -882,7 +978,8 @@ ${opt.cons.map(c => `- ${c}`).join('\n')}
|
|
|
882
978
|
|
|
883
979
|
**Effort:** ${opt.effort}
|
|
884
980
|
**Confidence:** ${opt.confidence}%
|
|
885
|
-
`)
|
|
981
|
+
`)
|
|
982
|
+
.join('\n')}
|
|
886
983
|
|
|
887
984
|
## Consequences
|
|
888
985
|
|
|
@@ -907,7 +1004,9 @@ ${session.context.impacts?.dependencies.map(d => `- ${d}`).join('\n')}
|
|
|
907
1004
|
${session.context.implementation?.phases.map((p, i) => `${i + 1}. ${p}`).join('\n')}
|
|
908
1005
|
|
|
909
1006
|
### Tasks
|
|
910
|
-
${session.context.implementation?.tasks
|
|
1007
|
+
${session.context.implementation?.tasks
|
|
1008
|
+
.map(t => `- [ ] ${t.description} (Priority: ${t.priority}, Effort: ${t.effort}${t.assignee ? `, Assignee: ${t.assignee}` : ''})`)
|
|
1009
|
+
.join('\n')}
|
|
911
1010
|
|
|
912
1011
|
### Timeline
|
|
913
1012
|
${session.context.implementation?.timeline}
|
|
@@ -953,7 +1052,7 @@ function getSessionProgress(session) {
|
|
|
953
1052
|
'decision_making',
|
|
954
1053
|
'impact_assessment',
|
|
955
1054
|
'implementation_planning',
|
|
956
|
-
'adr_generation'
|
|
1055
|
+
'adr_generation',
|
|
957
1056
|
];
|
|
958
1057
|
const currentIndex = phases.indexOf(session.phase);
|
|
959
1058
|
if (currentIndex === -1)
|
|
@@ -974,6 +1073,68 @@ function calculateDuration(start, end) {
|
|
|
974
1073
|
}
|
|
975
1074
|
return `${minutes}m`;
|
|
976
1075
|
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Helper function to detect architectural patterns from project files
|
|
1078
|
+
*/
|
|
1079
|
+
function detectArchitecturalPatterns(projectFiles) {
|
|
1080
|
+
const patterns = [];
|
|
1081
|
+
const filenames = projectFiles.map(f => f.toLowerCase());
|
|
1082
|
+
// Check for common architectural patterns
|
|
1083
|
+
if (filenames.some(f => f.includes('microservice') || f.includes('service'))) {
|
|
1084
|
+
patterns.push('microservices');
|
|
1085
|
+
}
|
|
1086
|
+
if (filenames.some(f => f.includes('docker') || f.includes('container'))) {
|
|
1087
|
+
patterns.push('containerization');
|
|
1088
|
+
}
|
|
1089
|
+
if (filenames.some(f => f.includes('api') || f.includes('rest') || f.includes('graphql'))) {
|
|
1090
|
+
patterns.push('API-driven');
|
|
1091
|
+
}
|
|
1092
|
+
if (filenames.some(f => f.includes('module') || f.includes('component'))) {
|
|
1093
|
+
patterns.push('modular architecture');
|
|
1094
|
+
}
|
|
1095
|
+
if (filenames.some(f => f.includes('config') || f.includes('env'))) {
|
|
1096
|
+
patterns.push('configuration management');
|
|
1097
|
+
}
|
|
1098
|
+
if (filenames.some(f => f.includes('test') || f.includes('spec'))) {
|
|
1099
|
+
patterns.push('test-driven development');
|
|
1100
|
+
}
|
|
1101
|
+
return patterns.length > 0 ? patterns.join(', ') : 'standard architecture';
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Helper function to generate feasibility notes based on code context
|
|
1105
|
+
*/
|
|
1106
|
+
function generateFeasibilityNotes(option, relatedFiles, configFiles) {
|
|
1107
|
+
const notes = [];
|
|
1108
|
+
// Analyze based on option effort level
|
|
1109
|
+
if (option.effort === 'low') {
|
|
1110
|
+
if (relatedFiles.length > 0) {
|
|
1111
|
+
notes.push(`Existing code patterns can be leveraged for gradual improvements`);
|
|
1112
|
+
}
|
|
1113
|
+
if (configFiles.length > 0) {
|
|
1114
|
+
notes.push(`Current configuration structure supports incremental changes`);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
else if (option.effort === 'medium') {
|
|
1118
|
+
if (relatedFiles.length > 5) {
|
|
1119
|
+
notes.push(`Substantial existing code base provides good foundation for targeted changes`);
|
|
1120
|
+
}
|
|
1121
|
+
else {
|
|
1122
|
+
notes.push(`Limited existing code may require more new development than expected`);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
else if (option.effort === 'high') {
|
|
1126
|
+
if (configFiles.length > 3) {
|
|
1127
|
+
notes.push(`Complex configuration setup indicates significant integration work`);
|
|
1128
|
+
}
|
|
1129
|
+
if (relatedFiles.length > 10) {
|
|
1130
|
+
notes.push(`Large codebase will require careful migration planning and phased approach`);
|
|
1131
|
+
}
|
|
1132
|
+
else {
|
|
1133
|
+
notes.push(`Smaller codebase may allow for more rapid comprehensive changes`);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
return notes.length > 0 ? notes.join('. ') : 'Standard implementation approach recommended';
|
|
1137
|
+
}
|
|
977
1138
|
/**
|
|
978
1139
|
* Main entry point for the interactive ADR planning tool
|
|
979
1140
|
*/
|
|
@@ -1006,12 +1167,13 @@ export async function interactiveAdrPlanning(args) {
|
|
|
1006
1167
|
return await updateTodos(input);
|
|
1007
1168
|
case 'get_guidance':
|
|
1008
1169
|
return await getGuidance(input);
|
|
1009
|
-
case 'save_session':
|
|
1170
|
+
case 'save_session': {
|
|
1010
1171
|
const session = sessions.get(input.sessionId);
|
|
1011
1172
|
if (!session)
|
|
1012
1173
|
throw new McpAdrError('Session not found', 'SESSION_NOT_FOUND');
|
|
1013
1174
|
await saveSession(session);
|
|
1014
1175
|
return { success: true, message: 'Session saved' };
|
|
1176
|
+
}
|
|
1015
1177
|
case 'complete_session':
|
|
1016
1178
|
return await completeSession(input);
|
|
1017
1179
|
default:
|