edsger 0.2.0 → 0.2.2
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/dist/api/features/feature-utils.d.ts +13 -0
- package/dist/api/features/feature-utils.js +46 -0
- package/dist/api/features/get-feature.d.ts +5 -0
- package/dist/api/features/get-feature.js +19 -0
- package/dist/api/features/index.d.ts +7 -0
- package/dist/api/features/index.js +9 -0
- package/dist/api/features/status-updater.d.ts +27 -0
- package/dist/api/features/status-updater.js +64 -0
- package/dist/api/features/test-cases.d.ts +21 -0
- package/dist/api/features/test-cases.js +63 -0
- package/dist/api/features/update-feature.d.ts +13 -0
- package/dist/api/features/update-feature.js +31 -0
- package/dist/api/features/user-stories.d.ts +21 -0
- package/dist/api/features/user-stories.js +63 -0
- package/dist/api/features.d.ts +100 -0
- package/dist/api/features.js +219 -0
- package/dist/api/mcp-client.d.ts +18 -0
- package/dist/api/mcp-client.js +58 -0
- package/dist/api/products.d.ts +10 -0
- package/dist/api/products.js +22 -0
- package/dist/api/test-reports.d.ts +9 -0
- package/dist/api/test-reports.js +25 -0
- package/dist/cli/commands/code-implementation-command.d.ts +2 -0
- package/dist/cli/commands/code-implementation-command.js +36 -0
- package/dist/cli/commands/code-review-command.d.ts +2 -0
- package/dist/cli/commands/code-review-command.js +39 -0
- package/dist/cli/commands/feature-analysis-command.d.ts +2 -0
- package/dist/cli/commands/feature-analysis-command.js +36 -0
- package/dist/cli/commands/functional-testing-command.d.ts +2 -0
- package/dist/cli/commands/functional-testing-command.js +36 -0
- package/dist/cli/commands/technical-design-command.d.ts +2 -0
- package/dist/cli/commands/technical-design-command.js +36 -0
- package/dist/cli/commands/workflow-command.d.ts +2 -0
- package/dist/cli/commands/workflow-command.js +34 -0
- package/dist/cli/formatters/code-implementation-formatter.d.ts +9 -0
- package/dist/cli/formatters/code-implementation-formatter.js +27 -0
- package/dist/cli/formatters/feature-analysis-formatter.d.ts +2 -0
- package/dist/cli/formatters/feature-analysis-formatter.js +27 -0
- package/dist/cli/formatters/functional-testing-formatter.d.ts +15 -0
- package/dist/cli/formatters/functional-testing-formatter.js +37 -0
- package/dist/cli/formatters/technical-design-formatter.d.ts +7 -0
- package/dist/cli/formatters/technical-design-formatter.js +30 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +99 -0
- package/dist/cli/utils/validation.d.ts +25 -0
- package/dist/cli/utils/validation.js +58 -0
- package/dist/cli/utils/workflow-utils.d.ts +21 -0
- package/dist/cli/utils/workflow-utils.js +47 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +11 -466
- package/dist/config.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{bug-fixing → phases/bug-fixing}/analyzer.d.ts +1 -1
- package/dist/{bug-fixing → phases/bug-fixing}/analyzer.js +1 -1
- package/dist/{bug-fixing → phases/bug-fixing}/context-fetcher.d.ts +4 -22
- package/dist/{bug-fixing → phases/bug-fixing}/context-fetcher.js +14 -58
- package/dist/{bug-fixing → phases/bug-fixing}/mcp-server.js +1 -30
- package/dist/phases/code-implementation/analyzer.d.ts +33 -0
- package/dist/{code-implementation → phases/code-implementation}/analyzer.js +174 -15
- package/dist/phases/code-implementation/context-fetcher.d.ts +17 -0
- package/dist/phases/code-implementation/context-fetcher.js +86 -0
- package/dist/{code-implementation → phases/code-implementation}/mcp-server.js +1 -30
- package/dist/{code-review → phases/code-review}/reviewer.d.ts +1 -1
- package/dist/{feature-analysis → phases/feature-analysis}/analyzer.d.ts +3 -2
- package/dist/{feature-analysis → phases/feature-analysis}/analyzer.js +29 -127
- package/dist/phases/feature-analysis/context-fetcher.d.ts +18 -0
- package/dist/phases/feature-analysis/context-fetcher.js +86 -0
- package/dist/{feature-analysis → phases/feature-analysis}/http-fallback.js +1 -1
- package/dist/{feature-analysis → phases/feature-analysis}/mcp-server.js +1 -24
- package/dist/{functional-testing → phases/functional-testing}/analyzer.d.ts +17 -2
- package/dist/{functional-testing → phases/functional-testing}/analyzer.js +225 -31
- package/dist/phases/functional-testing/context-fetcher.d.ts +16 -0
- package/dist/phases/functional-testing/context-fetcher.js +81 -0
- package/dist/{functional-testing → phases/functional-testing}/http-fallback.js +1 -1
- package/dist/{functional-testing → phases/functional-testing}/index.d.ts +1 -1
- package/dist/{functional-testing → phases/functional-testing}/index.js +1 -1
- package/dist/{functional-testing → phases/functional-testing}/mcp-server.js +1 -30
- package/dist/{functional-testing → phases/functional-testing}/test-report-creator.d.ts +26 -0
- package/dist/{functional-testing → phases/functional-testing}/test-report-creator.js +87 -5
- package/dist/phases/functional-testing/test-retry-handler.d.ts +16 -0
- package/dist/phases/functional-testing/test-retry-handler.js +75 -0
- package/dist/{pull-request → phases/pull-request}/creator.js +47 -6
- package/dist/phases/pull-request/handler.d.ts +16 -0
- package/dist/phases/pull-request/handler.js +60 -0
- package/dist/{technical-design → phases/technical-design}/analyzer.d.ts +7 -2
- package/dist/phases/technical-design/analyzer.js +418 -0
- package/dist/phases/technical-design/context-fetcher.d.ts +12 -0
- package/dist/phases/technical-design/context-fetcher.js +39 -0
- package/dist/{technical-design → phases/technical-design}/http-fallback.js +1 -1
- package/dist/{technical-design → phases/technical-design}/mcp-server.js +1 -30
- package/dist/prompts/bug-fixing.d.ts +2 -0
- package/dist/prompts/bug-fixing.js +63 -0
- package/dist/prompts/code-implementation.d.ts +3 -0
- package/dist/prompts/code-implementation.js +132 -0
- package/dist/prompts/feature-analysis.d.ts +3 -0
- package/dist/prompts/feature-analysis.js +149 -0
- package/dist/prompts/formatters.d.ts +29 -0
- package/dist/prompts/formatters.js +139 -0
- package/dist/prompts/functional-testing.d.ts +3 -0
- package/dist/prompts/functional-testing.js +126 -0
- package/dist/prompts/index.d.ts +6 -0
- package/dist/prompts/index.js +7 -0
- package/dist/prompts/technical-design.d.ts +3 -0
- package/dist/prompts/technical-design.js +130 -0
- package/dist/services/checklist.d.ts +99 -0
- package/dist/services/checklist.js +337 -0
- package/dist/types/features.d.ts +29 -0
- package/dist/types/features.js +1 -0
- package/dist/types/index.d.ts +112 -0
- package/dist/types/index.js +1 -0
- package/dist/types/pipeline.d.ts +25 -0
- package/dist/types/pipeline.js +4 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.js +52 -0
- package/dist/utils/pipeline-logger.d.ts +8 -0
- package/dist/utils/pipeline-logger.js +35 -0
- package/dist/workflow-runner/config/phase-configs.d.ts +5 -0
- package/dist/workflow-runner/config/phase-configs.js +34 -0
- package/dist/workflow-runner/config/stage-configs.d.ts +5 -0
- package/dist/workflow-runner/config/stage-configs.js +34 -0
- package/dist/workflow-runner/core/feature-filter.d.ts +16 -0
- package/dist/workflow-runner/core/feature-filter.js +46 -0
- package/dist/workflow-runner/core/feature-filter.test.d.ts +4 -0
- package/dist/workflow-runner/core/feature-filter.test.js +127 -0
- package/dist/workflow-runner/core/index.d.ts +8 -0
- package/dist/workflow-runner/core/index.js +12 -0
- package/dist/workflow-runner/core/pipeline-evaluator.d.ts +24 -0
- package/dist/workflow-runner/core/pipeline-evaluator.js +32 -0
- package/dist/workflow-runner/core/state-manager.d.ts +24 -0
- package/dist/workflow-runner/core/state-manager.js +42 -0
- package/dist/workflow-runner/core/workflow-logger.d.ts +20 -0
- package/dist/workflow-runner/core/workflow-logger.js +65 -0
- package/dist/workflow-runner/executors/phase-executor.d.ts +8 -0
- package/dist/workflow-runner/executors/phase-executor.js +183 -0
- package/dist/workflow-runner/executors/stage-executor.d.ts +8 -0
- package/dist/workflow-runner/executors/stage-executor.js +49 -0
- package/dist/workflow-runner/feature-service.d.ts +17 -0
- package/dist/workflow-runner/feature-service.js +60 -0
- package/dist/workflow-runner/feature-workflow-runner.d.ts +26 -0
- package/dist/workflow-runner/feature-workflow-runner.js +113 -0
- package/dist/workflow-runner/index.d.ts +0 -1
- package/dist/workflow-runner/index.js +0 -1
- package/dist/workflow-runner/pipeline-runner.d.ts +9 -19
- package/dist/workflow-runner/pipeline-runner.js +247 -256
- package/dist/workflow-runner/pipeline.d.ts +18 -0
- package/dist/workflow-runner/pipeline.js +197 -0
- package/dist/workflow-runner/processor.d.ts +40 -0
- package/dist/workflow-runner/processor.js +191 -0
- package/dist/workflow-runner/types.d.ts +48 -0
- package/dist/workflow-runner/types.js +4 -0
- package/dist/workflow-runner/workflow-processor.d.ts +6 -23
- package/dist/workflow-runner/workflow-processor.js +38 -100
- package/package.json +2 -2
- package/dist/code-implementation/analyzer.d.ts +0 -19
- package/dist/code-implementation/context-fetcher.d.ts +0 -38
- package/dist/code-implementation/context-fetcher.js +0 -147
- package/dist/feature-analysis/context-fetcher.d.ts +0 -54
- package/dist/feature-analysis/context-fetcher.js +0 -193
- package/dist/functional-testing/context-fetcher.d.ts +0 -47
- package/dist/functional-testing/context-fetcher.js +0 -192
- package/dist/technical-design/analyzer.js +0 -338
- package/dist/technical-design/context-fetcher.d.ts +0 -42
- package/dist/technical-design/context-fetcher.js +0 -170
- /package/dist/{bug-fixing → phases/bug-fixing}/index.d.ts +0 -0
- /package/dist/{bug-fixing → phases/bug-fixing}/index.js +0 -0
- /package/dist/{bug-fixing → phases/bug-fixing}/mcp-server.d.ts +0 -0
- /package/dist/{code-implementation → phases/code-implementation}/mcp-server.d.ts +0 -0
- /package/dist/{code-review → phases/code-review}/reviewer.js +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/http-fallback.d.ts +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/index.d.ts +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/index.js +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/mcp-server.d.ts +0 -0
- /package/dist/{functional-testing → phases/functional-testing}/http-fallback.d.ts +0 -0
- /package/dist/{functional-testing → phases/functional-testing}/mcp-server.d.ts +0 -0
- /package/dist/{pull-request → phases/pull-request}/creator.d.ts +0 -0
- /package/dist/{technical-design → phases/technical-design}/http-fallback.d.ts +0 -0
- /package/dist/{technical-design → phases/technical-design}/mcp-server.d.ts +0 -0
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
import { query } from '@anthropic-ai/claude-code';
|
|
2
|
-
import { logInfo, logError } from '../logger.js';
|
|
3
|
-
import { saveTechnicalDesignViaHttp } from './http-fallback.js';
|
|
4
|
-
import { fetchTechnicalDesignContext, updateTechnicalDesign, formatContextForPrompt, } from './context-fetcher.js';
|
|
5
|
-
function userMessage(content) {
|
|
6
|
-
return {
|
|
7
|
-
type: 'user',
|
|
8
|
-
message: { role: 'user', content: content },
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
async function* prompt(analysisPrompt) {
|
|
12
|
-
yield userMessage(analysisPrompt);
|
|
13
|
-
await new Promise((res) => setTimeout(res, 10000));
|
|
14
|
-
}
|
|
15
|
-
export const generateTechnicalDesign = async (options, config) => {
|
|
16
|
-
const { featureId, mcpServerUrl, mcpToken, verbose } = options;
|
|
17
|
-
if (verbose) {
|
|
18
|
-
logInfo(`Starting technical design generation for feature ID: ${featureId}`);
|
|
19
|
-
logInfo(`Using MCP server: ${mcpServerUrl}`);
|
|
20
|
-
}
|
|
21
|
-
try {
|
|
22
|
-
// Fetch all required context information via MCP endpoints
|
|
23
|
-
if (verbose) {
|
|
24
|
-
logInfo('Fetching technical design context via MCP endpoints...');
|
|
25
|
-
}
|
|
26
|
-
const context = await fetchTechnicalDesignContext(mcpServerUrl, mcpToken, featureId, verbose);
|
|
27
|
-
const systemPrompt = createSystemPrompt(config);
|
|
28
|
-
const designPrompt = createTechnicalDesignPromptWithContext(featureId, context);
|
|
29
|
-
let lastAssistantResponse = '';
|
|
30
|
-
let structuredDesignResult = null;
|
|
31
|
-
if (verbose) {
|
|
32
|
-
logInfo('Starting Claude Code query with pre-fetched information...');
|
|
33
|
-
}
|
|
34
|
-
// Use Claude Code SDK without MCP servers - all info is pre-fetched
|
|
35
|
-
for await (const message of query({
|
|
36
|
-
prompt: prompt(designPrompt),
|
|
37
|
-
options: {
|
|
38
|
-
appendSystemPrompt: systemPrompt,
|
|
39
|
-
model: config.claude.model || 'sonnet',
|
|
40
|
-
maxTurns: 1000,
|
|
41
|
-
permissionMode: 'bypassPermissions',
|
|
42
|
-
},
|
|
43
|
-
})) {
|
|
44
|
-
if (verbose) {
|
|
45
|
-
logInfo(`Received message type: ${message.type}`);
|
|
46
|
-
}
|
|
47
|
-
// Stream the technical design generation process
|
|
48
|
-
if (message.type === 'assistant' && message.message?.content) {
|
|
49
|
-
for (const content of message.message.content) {
|
|
50
|
-
if (content.type === 'text') {
|
|
51
|
-
lastAssistantResponse += content.text + '\n';
|
|
52
|
-
if (verbose) {
|
|
53
|
-
console.log(`\n🤖 ${content.text}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else if (content.type === 'tool_use') {
|
|
57
|
-
if (verbose) {
|
|
58
|
-
console.log(`\n🔧 ${content.name}: ${content.input.description || 'Running...'}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (message.type === 'result') {
|
|
64
|
-
if (message.subtype === 'success') {
|
|
65
|
-
logInfo('\n🎨 Technical design generation completed, parsing results...');
|
|
66
|
-
try {
|
|
67
|
-
// Try to extract JSON from markdown code block or parse directly
|
|
68
|
-
const responseText = message.result || lastAssistantResponse;
|
|
69
|
-
let jsonResult = null;
|
|
70
|
-
// First try to extract JSON from markdown code block
|
|
71
|
-
const jsonBlockMatch = responseText.match(/```json\s*\n([\s\S]*?)\n\s*```/);
|
|
72
|
-
if (jsonBlockMatch) {
|
|
73
|
-
jsonResult = JSON.parse(jsonBlockMatch[1]);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
// Try to parse the entire response as JSON
|
|
77
|
-
jsonResult = JSON.parse(responseText);
|
|
78
|
-
}
|
|
79
|
-
if (jsonResult && jsonResult.technical_design_result) {
|
|
80
|
-
structuredDesignResult = jsonResult.technical_design_result;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
throw new Error('Invalid JSON structure');
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
logError(`Failed to parse structured design result: ${error}`);
|
|
88
|
-
// Extract technical design from response if JSON parsing fails
|
|
89
|
-
const extractedDesign = extractTechnicalDesignFromResponse(message.result || lastAssistantResponse);
|
|
90
|
-
structuredDesignResult = {
|
|
91
|
-
status: extractedDesign ? 'success' : 'error',
|
|
92
|
-
technical_design: extractedDesign,
|
|
93
|
-
summary: extractedDesign
|
|
94
|
-
? 'Technical design generated successfully'
|
|
95
|
-
: 'Failed to generate technical design',
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
logError(`\n⚠️ Technical design generation incomplete: ${message.subtype}`);
|
|
101
|
-
if (message.subtype === 'error_max_turns') {
|
|
102
|
-
logError('💡 Try increasing timeout or reducing complexity');
|
|
103
|
-
}
|
|
104
|
-
// Try to parse results from the last assistant response
|
|
105
|
-
if (lastAssistantResponse) {
|
|
106
|
-
try {
|
|
107
|
-
const responseText = lastAssistantResponse;
|
|
108
|
-
let jsonResult = null;
|
|
109
|
-
const jsonBlockMatch = responseText.match(/```json\s*\n([\s\S]*?)\n\s*```/);
|
|
110
|
-
if (jsonBlockMatch) {
|
|
111
|
-
jsonResult = JSON.parse(jsonBlockMatch[1]);
|
|
112
|
-
if (jsonResult && jsonResult.technical_design_result) {
|
|
113
|
-
structuredDesignResult = jsonResult.technical_design_result;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
const extractedDesign = extractTechnicalDesignFromResponse(lastAssistantResponse);
|
|
118
|
-
if (extractedDesign) {
|
|
119
|
-
structuredDesignResult = {
|
|
120
|
-
status: 'success',
|
|
121
|
-
technical_design: extractedDesign,
|
|
122
|
-
summary: 'Technical design generated successfully',
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
logError(`Failed to parse assistant response: ${error}`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
// Save the technical design if we have it
|
|
135
|
-
if (structuredDesignResult?.technical_design) {
|
|
136
|
-
if (verbose) {
|
|
137
|
-
logInfo('Saving technical design...');
|
|
138
|
-
}
|
|
139
|
-
const designSaved = await updateTechnicalDesign(mcpServerUrl, mcpToken, featureId, structuredDesignResult.technical_design, verbose);
|
|
140
|
-
// Try HTTP fallback if direct update failed
|
|
141
|
-
if (!designSaved) {
|
|
142
|
-
if (verbose) {
|
|
143
|
-
logInfo('Direct update failed, trying HTTP fallback...');
|
|
144
|
-
}
|
|
145
|
-
const fallbackSaved = await saveTechnicalDesignViaHttp({
|
|
146
|
-
mcpServerUrl,
|
|
147
|
-
mcpToken,
|
|
148
|
-
featureId,
|
|
149
|
-
technicalDesign: structuredDesignResult.technical_design,
|
|
150
|
-
verbose,
|
|
151
|
-
});
|
|
152
|
-
if (!fallbackSaved && verbose) {
|
|
153
|
-
logError('⚠️ Both direct update and HTTP fallback failed');
|
|
154
|
-
}
|
|
155
|
-
return {
|
|
156
|
-
featureId,
|
|
157
|
-
technicalDesign: structuredDesignResult.technical_design,
|
|
158
|
-
status: fallbackSaved ? 'success' : 'error',
|
|
159
|
-
summary: fallbackSaved
|
|
160
|
-
? 'Technical design generated and saved via HTTP fallback'
|
|
161
|
-
: 'Technical design generated but failed to save',
|
|
162
|
-
savedViaHttp: fallbackSaved,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
return {
|
|
166
|
-
featureId,
|
|
167
|
-
technicalDesign: structuredDesignResult.technical_design,
|
|
168
|
-
status: 'success',
|
|
169
|
-
summary: 'Technical design generated and saved successfully',
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
return {
|
|
173
|
-
featureId,
|
|
174
|
-
technicalDesign: null,
|
|
175
|
-
status: 'error',
|
|
176
|
-
summary: 'No technical design was generated',
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
logError(`Technical design generation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
181
|
-
return {
|
|
182
|
-
featureId,
|
|
183
|
-
technicalDesign: null,
|
|
184
|
-
status: 'error',
|
|
185
|
-
summary: `Generation failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
const createSystemPrompt = (_config) => {
|
|
190
|
-
return `You are a senior software architect and technical lead specializing in creating comprehensive technical design documents. Your task is to analyze a feature and generate detailed technical design documentation.
|
|
191
|
-
|
|
192
|
-
**Your Role**: Create detailed architectural design documents based on feature requirements, user stories, and test cases.
|
|
193
|
-
|
|
194
|
-
CRITICAL: You are NOT a software engineer who writes code. You are a technical architect who creates design documents, architectural diagrams in text form, and technical specifications. Your role is PURELY design-focused.
|
|
195
|
-
|
|
196
|
-
**Available Tools**:
|
|
197
|
-
- Glob: Find files and understand project structure
|
|
198
|
-
- Read: Examine existing code, configuration, and documentation files
|
|
199
|
-
- Bash: For repository analysis (read-only commands only)
|
|
200
|
-
|
|
201
|
-
**Technical Design Process**:
|
|
202
|
-
1. **Repository Analysis**: Analyze the current codebase to understand technology stack and architecture:
|
|
203
|
-
- Find configuration files: package.json, tsconfig.json, next.config.js, tailwind.config.js
|
|
204
|
-
- Examine dependencies and tech stack
|
|
205
|
-
- Understand project structure: src/app/**, src/components/**, src/services/**
|
|
206
|
-
- Look for database schema files, migration files, and configuration
|
|
207
|
-
- Examine documentation files (README.md, CLAUDE.md)
|
|
208
|
-
|
|
209
|
-
2. **Context Analysis**: All feature information, user stories, test cases, and existing technical design are provided in the prompt
|
|
210
|
-
|
|
211
|
-
3. **Design Creation**: Generate comprehensive technical design documentation that includes:
|
|
212
|
-
- Architecture overview and system integration
|
|
213
|
-
- Component design and data flow
|
|
214
|
-
- Database schema changes and API specifications
|
|
215
|
-
- Security, performance, and scalability considerations
|
|
216
|
-
- Testing strategy and deployment approach
|
|
217
|
-
|
|
218
|
-
**Important Guidelines**:
|
|
219
|
-
- All feature information is provided in the prompt - do NOT attempt to fetch additional context
|
|
220
|
-
- Focus on creating comprehensive technical specifications
|
|
221
|
-
- Consider integration with existing systems and architecture
|
|
222
|
-
- Address scalability, maintainability, and performance
|
|
223
|
-
- Include clear implementation guidance
|
|
224
|
-
|
|
225
|
-
**CRITICAL - Result Format**:
|
|
226
|
-
You MUST end your response with a JSON object containing the technical design results in this EXACT format:
|
|
227
|
-
|
|
228
|
-
\`\`\`json
|
|
229
|
-
{
|
|
230
|
-
"technical_design_result": {
|
|
231
|
-
"feature_id": "FEATURE_ID_PLACEHOLDER",
|
|
232
|
-
"status": "success",
|
|
233
|
-
"summary": "Brief summary of what was accomplished",
|
|
234
|
-
"technical_design": "The complete technical design document in markdown format",
|
|
235
|
-
"recommendations": "Additional recommendations for implementation"
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
\`\`\`
|
|
239
|
-
|
|
240
|
-
**Technical Design Quality Guidelines**:
|
|
241
|
-
- Be specific and detailed in architectural decisions
|
|
242
|
-
- Consider scalability, maintainability, and performance
|
|
243
|
-
- Address security, accessibility, and error handling
|
|
244
|
-
- Include clear diagrams and flows (in text/ASCII format)
|
|
245
|
-
- Consider integration with existing systems
|
|
246
|
-
- Address deployment and monitoring requirements
|
|
247
|
-
- Think about future extensibility and maintenance
|
|
248
|
-
|
|
249
|
-
Focus on systematic technical design based on the provided context information.`;
|
|
250
|
-
};
|
|
251
|
-
const createTechnicalDesignPromptWithContext = (featureId, context) => {
|
|
252
|
-
const contextInfo = formatContextForPrompt(context);
|
|
253
|
-
return `Generate a comprehensive technical design for feature ID: ${featureId}
|
|
254
|
-
|
|
255
|
-
${contextInfo}
|
|
256
|
-
|
|
257
|
-
## Technical Design Instructions
|
|
258
|
-
|
|
259
|
-
Follow this systematic approach:
|
|
260
|
-
|
|
261
|
-
1. **Repository Analysis**: First, analyze the current codebase to understand the technology stack and architecture:
|
|
262
|
-
- Use Glob to find configuration files: package.json, tsconfig.json, next.config.js, tailwind.config.js
|
|
263
|
-
- Use Read to examine package.json to understand dependencies and tech stack
|
|
264
|
-
- Use Glob to understand project structure: src/app/**, src/components/**, src/services/**
|
|
265
|
-
- Look for database schema files, migration files, and configuration
|
|
266
|
-
- Examine README.md, CLAUDE.md or other documentation files if they exist
|
|
267
|
-
|
|
268
|
-
2. **Technical Design Creation**: Create comprehensive technical design documentation that addresses:
|
|
269
|
-
- **Architecture Overview**: How the feature integrates with the existing system
|
|
270
|
-
- **Component Design**: Frontend components, backend services, database changes needed
|
|
271
|
-
- **Data Flow**: How data moves through the system for this feature
|
|
272
|
-
- **API Design**: Endpoints, request/response formats, error handling
|
|
273
|
-
- **Database Design**: Schema changes, indexes, relationships, migration strategy
|
|
274
|
-
- **Security**: Authentication, authorization, data validation requirements
|
|
275
|
-
- **Performance**: Caching strategies, optimization, scalability considerations
|
|
276
|
-
- **Testing Strategy**: Unit, integration, and end-to-end testing approaches
|
|
277
|
-
- **Deployment**: How the feature will be deployed and monitored
|
|
278
|
-
|
|
279
|
-
3. **Implementation Guidance**: Provide specific implementation recommendations and considerations
|
|
280
|
-
|
|
281
|
-
## Important Notes
|
|
282
|
-
- Focus on creating detailed architectural specifications
|
|
283
|
-
- Consider the user stories to understand what needs to be built
|
|
284
|
-
- Use test cases to inform testing strategy and validation approaches
|
|
285
|
-
- Build upon existing technical design if available, or create from scratch
|
|
286
|
-
- Consider integration with existing systems and architecture
|
|
287
|
-
- Address scalability, maintainability, and performance requirements
|
|
288
|
-
|
|
289
|
-
Begin by analyzing the repository structure to understand the current technology stack, then create the comprehensive technical design.`;
|
|
290
|
-
};
|
|
291
|
-
const extractTechnicalDesignFromResponse = (response) => {
|
|
292
|
-
// Try to extract technical design content from the response
|
|
293
|
-
// Look for markdown sections that contain technical design
|
|
294
|
-
const lines = response.split('\n');
|
|
295
|
-
let inTechnicalDesign = false;
|
|
296
|
-
const technicalDesignLines = [];
|
|
297
|
-
for (let i = 0; i < lines.length; i++) {
|
|
298
|
-
const line = lines[i].toLowerCase();
|
|
299
|
-
// Look for technical design section headers
|
|
300
|
-
if (line.includes('technical design') ||
|
|
301
|
-
line.includes('architecture') ||
|
|
302
|
-
line.includes('# design') ||
|
|
303
|
-
line.includes('## technical')) {
|
|
304
|
-
inTechnicalDesign = true;
|
|
305
|
-
technicalDesignLines.push(lines[i]);
|
|
306
|
-
continue;
|
|
307
|
-
}
|
|
308
|
-
if (inTechnicalDesign) {
|
|
309
|
-
// Continue until we hit another major section or JSON
|
|
310
|
-
if (line.startsWith('{') && line.includes('"technical_design_result"')) {
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
technicalDesignLines.push(lines[i]);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
if (technicalDesignLines.length > 0) {
|
|
317
|
-
return technicalDesignLines.join('\n').trim();
|
|
318
|
-
}
|
|
319
|
-
// Ultimate fallback: return the whole response if it seems to contain design content
|
|
320
|
-
if (response.length > 100 &&
|
|
321
|
-
(response.toLowerCase().includes('architecture') ||
|
|
322
|
-
response.toLowerCase().includes('component') ||
|
|
323
|
-
response.toLowerCase().includes('database'))) {
|
|
324
|
-
return response.trim();
|
|
325
|
-
}
|
|
326
|
-
return null;
|
|
327
|
-
};
|
|
328
|
-
export const checkTechnicalDesignRequirements = async () => {
|
|
329
|
-
try {
|
|
330
|
-
// Check if Claude Code SDK is available
|
|
331
|
-
const claudeCode = await import('@anthropic-ai/claude-code');
|
|
332
|
-
return claudeCode && typeof claudeCode.query === 'function';
|
|
333
|
-
}
|
|
334
|
-
catch (error) {
|
|
335
|
-
console.log('Technical design requirements check failed:', error instanceof Error ? error.message : error);
|
|
336
|
-
return false;
|
|
337
|
-
}
|
|
338
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export interface TechnicalDesignContext {
|
|
2
|
-
feature: {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
technical_design?: string;
|
|
7
|
-
status: string;
|
|
8
|
-
product_id: string;
|
|
9
|
-
};
|
|
10
|
-
product: {
|
|
11
|
-
id: string;
|
|
12
|
-
name: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
};
|
|
16
|
-
user_stories: Array<{
|
|
17
|
-
id: string;
|
|
18
|
-
title: string;
|
|
19
|
-
description: string;
|
|
20
|
-
status: string;
|
|
21
|
-
[key: string]: any;
|
|
22
|
-
}>;
|
|
23
|
-
test_cases: Array<{
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
description: string;
|
|
27
|
-
is_critical: boolean;
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
}>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Fetch all technical design context information via MCP endpoints
|
|
33
|
-
*/
|
|
34
|
-
export declare function fetchTechnicalDesignContext(mcpServerUrl: string, mcpToken: string, featureId: string, verbose?: boolean): Promise<TechnicalDesignContext>;
|
|
35
|
-
/**
|
|
36
|
-
* Update the technical design of a feature via MCP endpoint
|
|
37
|
-
*/
|
|
38
|
-
export declare function updateTechnicalDesign(mcpServerUrl: string, mcpToken: string, featureId: string, technicalDesign: string, verbose?: boolean): Promise<boolean>;
|
|
39
|
-
/**
|
|
40
|
-
* Format the context into a readable string for Claude Code
|
|
41
|
-
*/
|
|
42
|
-
export declare function formatContextForPrompt(context: TechnicalDesignContext): string;
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { logInfo, logError } from '../logger.js';
|
|
2
|
-
// Helper function to make HTTP requests to the MCP server
|
|
3
|
-
async function callMcpEndpoint(mcpServerUrl, mcpToken, method, params) {
|
|
4
|
-
try {
|
|
5
|
-
const response = await fetch(`${mcpServerUrl}/mcp`, {
|
|
6
|
-
method: 'POST',
|
|
7
|
-
headers: {
|
|
8
|
-
'Content-Type': 'application/json',
|
|
9
|
-
Authorization: `Bearer ${mcpToken}`,
|
|
10
|
-
},
|
|
11
|
-
body: JSON.stringify({
|
|
12
|
-
jsonrpc: '2.0',
|
|
13
|
-
method,
|
|
14
|
-
params,
|
|
15
|
-
id: Math.random().toString(36).substring(7),
|
|
16
|
-
}),
|
|
17
|
-
});
|
|
18
|
-
if (!response.ok) {
|
|
19
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
20
|
-
}
|
|
21
|
-
const data = await response.json();
|
|
22
|
-
if (data.error) {
|
|
23
|
-
throw new Error(data.error.message || 'MCP call failed');
|
|
24
|
-
}
|
|
25
|
-
return data.result;
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
console.error(`MCP call failed for ${method}:`, error instanceof Error ? error.message : String(error));
|
|
29
|
-
throw error;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Fetch all technical design context information via MCP endpoints
|
|
34
|
-
*/
|
|
35
|
-
export async function fetchTechnicalDesignContext(mcpServerUrl, mcpToken, featureId, verbose) {
|
|
36
|
-
try {
|
|
37
|
-
if (verbose) {
|
|
38
|
-
logInfo(`Fetching complete technical design context for feature: ${featureId}`);
|
|
39
|
-
}
|
|
40
|
-
// Step 1: Get feature details
|
|
41
|
-
if (verbose) {
|
|
42
|
-
logInfo('1/4 Fetching feature details...');
|
|
43
|
-
}
|
|
44
|
-
const featureResult = (await callMcpEndpoint(mcpServerUrl, mcpToken, 'features/get', { feature_id: featureId }));
|
|
45
|
-
if (!featureResult.features || featureResult.features.length === 0) {
|
|
46
|
-
throw new Error(`Feature not found: ${featureId}`);
|
|
47
|
-
}
|
|
48
|
-
const feature = featureResult.features[0];
|
|
49
|
-
// Step 2: Get product details
|
|
50
|
-
if (verbose) {
|
|
51
|
-
logInfo('2/4 Fetching product details...');
|
|
52
|
-
}
|
|
53
|
-
const productResult = (await callMcpEndpoint(mcpServerUrl, mcpToken, 'resources/read', {
|
|
54
|
-
uri: `product://${feature.product_id}`,
|
|
55
|
-
}));
|
|
56
|
-
const productText = productResult.contents?.[0]?.text || '{}';
|
|
57
|
-
let product;
|
|
58
|
-
try {
|
|
59
|
-
product = JSON.parse(productText);
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
product = {
|
|
63
|
-
id: feature.product_id,
|
|
64
|
-
name: 'Unknown Product',
|
|
65
|
-
description: 'Product information could not be loaded',
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
// Step 3: Get user stories
|
|
69
|
-
if (verbose) {
|
|
70
|
-
logInfo('3/4 Fetching user stories...');
|
|
71
|
-
}
|
|
72
|
-
const userStoriesResult = (await callMcpEndpoint(mcpServerUrl, mcpToken, 'user_stories/list', { feature_id: featureId }));
|
|
73
|
-
const user_stories = (userStoriesResult.user_stories || []);
|
|
74
|
-
// Step 4: Get test cases
|
|
75
|
-
if (verbose) {
|
|
76
|
-
logInfo('4/4 Fetching test cases...');
|
|
77
|
-
}
|
|
78
|
-
const testCasesResult = (await callMcpEndpoint(mcpServerUrl, mcpToken, 'test_cases/list', { feature_id: featureId }));
|
|
79
|
-
const test_cases = (testCasesResult.test_cases || []);
|
|
80
|
-
// Log summary if verbose
|
|
81
|
-
if (verbose) {
|
|
82
|
-
logInfo(`✅ Context fetched successfully:`);
|
|
83
|
-
logInfo(` Feature: ${feature.name}`);
|
|
84
|
-
logInfo(` Product: ${product.name}`);
|
|
85
|
-
logInfo(` User Stories: ${user_stories.length}`);
|
|
86
|
-
logInfo(` Test Cases: ${test_cases.length} (${test_cases.filter((tc) => tc.is_critical).length} critical)`);
|
|
87
|
-
logInfo(` Existing Technical Design: ${feature.technical_design ? 'Yes' : 'No'}`);
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
feature,
|
|
91
|
-
product,
|
|
92
|
-
user_stories,
|
|
93
|
-
test_cases,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
98
|
-
logError(`Failed to fetch technical design context: ${errorMessage}`);
|
|
99
|
-
throw new Error(`Context fetch failed: ${errorMessage}`);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Update the technical design of a feature via MCP endpoint
|
|
104
|
-
*/
|
|
105
|
-
export async function updateTechnicalDesign(mcpServerUrl, mcpToken, featureId, technicalDesign, verbose) {
|
|
106
|
-
try {
|
|
107
|
-
if (verbose) {
|
|
108
|
-
logInfo(`Saving technical design for feature: ${featureId}`);
|
|
109
|
-
}
|
|
110
|
-
await callMcpEndpoint(mcpServerUrl, mcpToken, 'features/update', {
|
|
111
|
-
feature_id: featureId,
|
|
112
|
-
technical_design: technicalDesign,
|
|
113
|
-
});
|
|
114
|
-
if (verbose) {
|
|
115
|
-
logInfo(`✅ Technical design saved successfully`);
|
|
116
|
-
}
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
121
|
-
logError(`Failed to save technical design: ${errorMessage}`);
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Format the context into a readable string for Claude Code
|
|
127
|
-
*/
|
|
128
|
-
export function formatContextForPrompt(context) {
|
|
129
|
-
const formatUserStories = (stories) => {
|
|
130
|
-
if (stories.length === 0)
|
|
131
|
-
return 'No user stories defined.';
|
|
132
|
-
return stories
|
|
133
|
-
.map((story, index) => `${index + 1}. **${story.title}** (Status: ${story.status})
|
|
134
|
-
${story.description}`)
|
|
135
|
-
.join('\n\n');
|
|
136
|
-
};
|
|
137
|
-
const formatTestCases = (cases) => {
|
|
138
|
-
if (cases.length === 0)
|
|
139
|
-
return 'No test cases defined.';
|
|
140
|
-
return cases
|
|
141
|
-
.map((testCase, index) => `${index + 1}. **${testCase.name}** ${testCase.is_critical ? '[CRITICAL]' : '[OPTIONAL]'}
|
|
142
|
-
${testCase.description}`)
|
|
143
|
-
.join('\n\n');
|
|
144
|
-
};
|
|
145
|
-
return `# Technical Design Context
|
|
146
|
-
|
|
147
|
-
## Feature Information
|
|
148
|
-
- **ID**: ${context.feature.id}
|
|
149
|
-
- **Name**: ${context.feature.name}
|
|
150
|
-
- **Description**: ${context.feature.description || 'No description provided'}
|
|
151
|
-
- **Current Status**: ${context.feature.status}
|
|
152
|
-
|
|
153
|
-
## Product Information
|
|
154
|
-
- **Product**: ${context.product.name}
|
|
155
|
-
- **Product ID**: ${context.product.id}
|
|
156
|
-
- **Description**: ${context.product.description || 'No product description'}
|
|
157
|
-
|
|
158
|
-
## User Stories (${context.user_stories.length})
|
|
159
|
-
${formatUserStories(context.user_stories)}
|
|
160
|
-
|
|
161
|
-
## Test Cases (${context.test_cases.length})
|
|
162
|
-
${formatTestCases(context.test_cases)}
|
|
163
|
-
|
|
164
|
-
## Current Technical Design
|
|
165
|
-
${context.feature.technical_design || 'No existing technical design found'}
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
**Design Instructions**: Based on the above feature requirements, user stories, and test cases, create or enhance the comprehensive technical design. Focus on system architecture, component design, database schema, API specifications, security considerations, and implementation strategy.`;
|
|
170
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|