edsger 0.2.1 → 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.js +1 -1
- 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 +1 -1
- 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/{functional-testing → phases/functional-testing}/test-report-creator.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,7 +1,12 @@
|
|
|
1
1
|
import { query } from '@anthropic-ai/claude-code';
|
|
2
|
-
import { logInfo, logError } from '
|
|
2
|
+
import { logInfo, logError } from '../../utils/logger.js';
|
|
3
3
|
import { saveDataViaHttp } from './http-fallback.js';
|
|
4
|
-
import { fetchFeatureAnalysisContext,
|
|
4
|
+
import { fetchFeatureAnalysisContext, } from './context-fetcher.js';
|
|
5
|
+
import { createUserStories } from '../../api/features/index.js';
|
|
6
|
+
import { createTestCases } from '../../api/features/index.js';
|
|
7
|
+
import { formatFeatureAnalysisContext } from '../../prompts/formatters.js';
|
|
8
|
+
import { createFeatureAnalysisSystemPrompt, createFeatureAnalysisPromptWithContext, } from '../../prompts/feature-analysis.js';
|
|
9
|
+
import { formatChecklistsForContext, } from '../../services/checklist.js';
|
|
5
10
|
function userMessage(content) {
|
|
6
11
|
return {
|
|
7
12
|
type: 'user',
|
|
@@ -12,7 +17,7 @@ async function* prompt(analysisPrompt) {
|
|
|
12
17
|
yield userMessage(analysisPrompt);
|
|
13
18
|
await new Promise((res) => setTimeout(res, 10000));
|
|
14
19
|
}
|
|
15
|
-
export const analyzeFeatureWithMCP = async (options, config) => {
|
|
20
|
+
export const analyzeFeatureWithMCP = async (options, config, checklistContext) => {
|
|
16
21
|
const { featureId, mcpServerUrl, mcpToken, verbose } = options;
|
|
17
22
|
if (verbose) {
|
|
18
23
|
logInfo(`Starting feature analysis for feature ID: ${featureId}`);
|
|
@@ -24,8 +29,18 @@ export const analyzeFeatureWithMCP = async (options, config) => {
|
|
|
24
29
|
logInfo('Fetching feature analysis context via MCP endpoints...');
|
|
25
30
|
}
|
|
26
31
|
const context = await fetchFeatureAnalysisContext(mcpServerUrl, mcpToken, featureId, verbose);
|
|
27
|
-
const systemPrompt =
|
|
28
|
-
const
|
|
32
|
+
const systemPrompt = createFeatureAnalysisSystemPrompt(config, mcpServerUrl, mcpToken, featureId);
|
|
33
|
+
const contextInfo = formatFeatureAnalysisContext(context);
|
|
34
|
+
// Add checklist context to the analysis prompt
|
|
35
|
+
let finalContextInfo = contextInfo;
|
|
36
|
+
if (checklistContext && checklistContext.checklists.length > 0) {
|
|
37
|
+
const checklistInfo = formatChecklistsForContext(checklistContext);
|
|
38
|
+
finalContextInfo = contextInfo + '\n\n' + checklistInfo;
|
|
39
|
+
if (verbose) {
|
|
40
|
+
logInfo(`Added ${checklistContext.checklists.length} checklists to analysis context`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const analysisPrompt = createFeatureAnalysisPromptWithContext(featureId, finalContextInfo);
|
|
29
44
|
let lastAssistantResponse = '';
|
|
30
45
|
let structuredAnalysisResult = null;
|
|
31
46
|
if (verbose) {
|
|
@@ -120,7 +135,7 @@ export const analyzeFeatureWithMCP = async (options, config) => {
|
|
|
120
135
|
}
|
|
121
136
|
// Save the analysis results if we have them
|
|
122
137
|
if (structuredAnalysisResult) {
|
|
123
|
-
const { created_user_stories, created_test_cases, status } = structuredAnalysisResult;
|
|
138
|
+
const { created_user_stories, created_test_cases, status, checklist_results, checklist_item_results, } = structuredAnalysisResult;
|
|
124
139
|
if (created_user_stories && created_user_stories.length > 0) {
|
|
125
140
|
if (verbose) {
|
|
126
141
|
logInfo('Saving created user stories...');
|
|
@@ -197,6 +212,10 @@ export const analyzeFeatureWithMCP = async (options, config) => {
|
|
|
197
212
|
})),
|
|
198
213
|
summary: structuredAnalysisResult.summary || 'Analysis completed',
|
|
199
214
|
status: structuredAnalysisResult.status === 'success' ? 'success' : 'error',
|
|
215
|
+
data: {
|
|
216
|
+
checklist_results,
|
|
217
|
+
checklist_item_results,
|
|
218
|
+
},
|
|
200
219
|
};
|
|
201
220
|
}
|
|
202
221
|
return {
|
|
@@ -218,6 +237,10 @@ export const analyzeFeatureWithMCP = async (options, config) => {
|
|
|
218
237
|
createdTestCases: [],
|
|
219
238
|
summary: 'No analysis results received',
|
|
220
239
|
status: 'error',
|
|
240
|
+
data: {
|
|
241
|
+
checklist_results: undefined,
|
|
242
|
+
checklist_item_results: undefined,
|
|
243
|
+
},
|
|
221
244
|
};
|
|
222
245
|
}
|
|
223
246
|
catch (error) {
|
|
@@ -235,127 +258,6 @@ export const analyzeFeatureWithMCP = async (options, config) => {
|
|
|
235
258
|
};
|
|
236
259
|
}
|
|
237
260
|
};
|
|
238
|
-
const createSystemPrompt = (_config) => {
|
|
239
|
-
return `You are an expert product manager and business analyst specializing in feature analysis. Your task is to analyze a feature and generate comprehensive user stories and test cases.
|
|
240
|
-
|
|
241
|
-
**Your Role**: Conduct business analysis to understand feature requirements and create user stories and test cases that add business value.
|
|
242
|
-
|
|
243
|
-
CRITICAL: You are NOT a software engineer. You should NEVER write code, build projects, or modify files. Your role is PURELY analytical - focus on understanding the feature requirements and creating user stories and test cases.
|
|
244
|
-
|
|
245
|
-
**Analysis Process**:
|
|
246
|
-
1. **Review Context**: Analyze the provided feature information, product context, and existing user stories/test cases
|
|
247
|
-
2. **Business Analysis**: Think about different user types, use cases, workflows, and scenarios
|
|
248
|
-
3. **Create User Stories**: Generate new user stories following the "As a [user], I want [goal] so that [benefit]" format
|
|
249
|
-
4. **Design Test Cases**: Create comprehensive test cases covering happy path, edge cases, and error scenarios
|
|
250
|
-
5. **Avoid Duplication**: Ensure new stories and test cases add value without duplicating existing ones
|
|
251
|
-
6. **Provide Results**: Output your analysis in the required JSON format
|
|
252
|
-
|
|
253
|
-
**Business Analysis Focus**:
|
|
254
|
-
- Understand the feature's business value and user impact
|
|
255
|
-
- Consider different user types (admin, regular user, guest, etc.)
|
|
256
|
-
- Think about user workflows and journeys
|
|
257
|
-
- Consider security, accessibility, and performance implications
|
|
258
|
-
- Think about integration points and dependencies
|
|
259
|
-
- Consider error handling and edge cases
|
|
260
|
-
- Focus on business requirements, not technical implementation
|
|
261
|
-
|
|
262
|
-
**Important Guidelines**:
|
|
263
|
-
- All feature information, product context, and existing user stories/test cases are provided in the prompt
|
|
264
|
-
- Do NOT attempt to read source code files or run any commands
|
|
265
|
-
- Do NOT use tools like Bash, Read, Glob, Write, TodoWrite, or any other tools
|
|
266
|
-
- Focus on creating valuable user stories and comprehensive test cases
|
|
267
|
-
- Avoid duplicating existing user stories and test cases
|
|
268
|
-
- Consider different user perspectives and scenarios
|
|
269
|
-
|
|
270
|
-
**CRITICAL - Result Format**:
|
|
271
|
-
You MUST end your response with a JSON object containing the analysis results in this EXACT format:
|
|
272
|
-
|
|
273
|
-
\`\`\`json
|
|
274
|
-
{
|
|
275
|
-
"analysis": {
|
|
276
|
-
"feature_id": "FEATURE_ID_PLACEHOLDER",
|
|
277
|
-
"status": "success",
|
|
278
|
-
"summary": "Brief summary of analysis and what was accomplished",
|
|
279
|
-
"created_user_stories": [
|
|
280
|
-
{
|
|
281
|
-
"title": "User story title",
|
|
282
|
-
"description": "As a [user], I want [goal] so that [benefit]",
|
|
283
|
-
"status": "draft"
|
|
284
|
-
}
|
|
285
|
-
],
|
|
286
|
-
"created_test_cases": [
|
|
287
|
-
{
|
|
288
|
-
"name": "Test case name",
|
|
289
|
-
"description": "Detailed test case description with steps and expected outcomes",
|
|
290
|
-
"is_critical": true
|
|
291
|
-
}
|
|
292
|
-
],
|
|
293
|
-
"recommendations": "Additional recommendations for the feature"
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
\`\`\`
|
|
297
|
-
|
|
298
|
-
**Quality Guidelines**:
|
|
299
|
-
- User stories should be clear, concise, and user-focused
|
|
300
|
-
- Test cases should be comprehensive and cover all scenarios
|
|
301
|
-
- Consider accessibility, security, and performance aspects
|
|
302
|
-
- Think about different user types and permissions
|
|
303
|
-
- Include both happy path and error scenarios
|
|
304
|
-
- Focus on business value and user experience
|
|
305
|
-
|
|
306
|
-
Focus on systematic analysis based on the provided context information.`;
|
|
307
|
-
};
|
|
308
|
-
const createAnalysisPromptWithContext = (featureId, context) => {
|
|
309
|
-
const contextInfo = formatContextForPrompt(context);
|
|
310
|
-
return `Please conduct comprehensive business analysis for feature ID: ${featureId}
|
|
311
|
-
|
|
312
|
-
${contextInfo}
|
|
313
|
-
|
|
314
|
-
## Analysis Instructions
|
|
315
|
-
|
|
316
|
-
Follow this systematic approach:
|
|
317
|
-
|
|
318
|
-
1. **Review Feature Context**: Analyze the feature information, product context, and technical design above
|
|
319
|
-
|
|
320
|
-
2. **Review Existing Items**: Study the existing user stories and test cases to understand:
|
|
321
|
-
- What scenarios are already covered
|
|
322
|
-
- What user perspectives are already addressed
|
|
323
|
-
- Where gaps might exist
|
|
324
|
-
|
|
325
|
-
3. **Business Analysis**: Think about the feature from a business perspective:
|
|
326
|
-
- Who are the different types of users?
|
|
327
|
-
- What problems does this feature solve?
|
|
328
|
-
- What are the different use cases and user workflows?
|
|
329
|
-
- What edge cases and error scenarios might occur?
|
|
330
|
-
- How does this integrate with other features?
|
|
331
|
-
|
|
332
|
-
4. **Create New User Stories**: Generate user stories that ADD VALUE by covering:
|
|
333
|
-
- Different user types or personas not yet covered
|
|
334
|
-
- New use cases or workflows
|
|
335
|
-
- Edge cases or error scenarios
|
|
336
|
-
- Different permission levels or access patterns
|
|
337
|
-
- Integration scenarios
|
|
338
|
-
|
|
339
|
-
5. **Design Test Cases**: Create test cases that ensure comprehensive coverage:
|
|
340
|
-
- Happy path scenarios
|
|
341
|
-
- Edge cases and boundary conditions
|
|
342
|
-
- Error handling and validation
|
|
343
|
-
- Security and permission testing
|
|
344
|
-
- Performance and usability aspects
|
|
345
|
-
- Integration testing scenarios
|
|
346
|
-
|
|
347
|
-
6. **Provide Results**: Output your analysis in the required JSON format
|
|
348
|
-
|
|
349
|
-
## Important Notes
|
|
350
|
-
- Focus on creating NEW user stories and test cases that add business value
|
|
351
|
-
- Avoid duplicating existing user stories and test cases
|
|
352
|
-
- Consider different user types (admin, regular user, guest, etc.)
|
|
353
|
-
- Think about accessibility, security, and performance implications
|
|
354
|
-
- The feature should already have some design - you're analyzing business requirements
|
|
355
|
-
- Be thorough but focus on practical, testable scenarios
|
|
356
|
-
|
|
357
|
-
Begin your systematic analysis based on the above context.`;
|
|
358
|
-
};
|
|
359
261
|
export const checkFeatureAnalysisRequirements = async () => {
|
|
360
262
|
try {
|
|
361
263
|
// Check if Claude Code SDK is available
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createUserStories, createTestCases } from '../../api/features/index.js';
|
|
2
|
+
import type { FeatureInfo, UserStory, TestCase } from '../../types/features.js';
|
|
3
|
+
import { type ProductInfo } from '../../api/products.js';
|
|
4
|
+
export interface FeatureAnalysisContext {
|
|
5
|
+
feature: FeatureInfo;
|
|
6
|
+
product: ProductInfo;
|
|
7
|
+
existing_user_stories: UserStory[];
|
|
8
|
+
existing_test_cases: TestCase[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Fetch all feature analysis context information via MCP endpoints
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchFeatureAnalysisContext(mcpServerUrl: string, mcpToken: string, featureId: string, verbose?: boolean): Promise<FeatureAnalysisContext>;
|
|
14
|
+
export { createUserStories, createTestCases };
|
|
15
|
+
/**
|
|
16
|
+
* Format the context into a readable string for Claude Code
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatContextForPrompt(context: FeatureAnalysisContext): string;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { logInfo, logError } from '../../utils/logger.js';
|
|
2
|
+
import { getFeature, getUserStories, createUserStories, getTestCases, createTestCases, } from '../../api/features/index.js';
|
|
3
|
+
import { getProduct } from '../../api/products.js';
|
|
4
|
+
/**
|
|
5
|
+
* Fetch all feature analysis context information via MCP endpoints
|
|
6
|
+
*/
|
|
7
|
+
export async function fetchFeatureAnalysisContext(mcpServerUrl, mcpToken, featureId, verbose) {
|
|
8
|
+
try {
|
|
9
|
+
if (verbose) {
|
|
10
|
+
logInfo(`Fetching complete feature analysis context for feature: ${featureId}`);
|
|
11
|
+
}
|
|
12
|
+
// Fetch all required data in parallel for better performance
|
|
13
|
+
const [feature, existing_user_stories, existing_test_cases] = await Promise.all([
|
|
14
|
+
getFeature(mcpServerUrl, mcpToken, featureId, verbose),
|
|
15
|
+
getUserStories(mcpServerUrl, mcpToken, featureId, verbose),
|
|
16
|
+
getTestCases(mcpServerUrl, mcpToken, featureId, verbose),
|
|
17
|
+
]);
|
|
18
|
+
const product = await getProduct(mcpServerUrl, mcpToken, feature.product_id, verbose);
|
|
19
|
+
if (verbose) {
|
|
20
|
+
logInfo(`✅ Feature analysis context fetched successfully:`);
|
|
21
|
+
logInfo(` Feature: ${feature.name}`);
|
|
22
|
+
logInfo(` Product: ${product.name}`);
|
|
23
|
+
logInfo(` Existing User Stories: ${existing_user_stories.length}`);
|
|
24
|
+
logInfo(` Existing Test Cases: ${existing_test_cases.length}`);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
feature,
|
|
28
|
+
product,
|
|
29
|
+
existing_user_stories,
|
|
30
|
+
existing_test_cases,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
35
|
+
logError(`Failed to fetch feature analysis context: ${errorMessage}`);
|
|
36
|
+
throw new Error(`Context fetch failed: ${errorMessage}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Re-export the create functions for convenience
|
|
40
|
+
export { createUserStories, createTestCases };
|
|
41
|
+
/**
|
|
42
|
+
* Format the context into a readable string for Claude Code
|
|
43
|
+
*/
|
|
44
|
+
export function formatContextForPrompt(context) {
|
|
45
|
+
const formatUserStories = (stories) => {
|
|
46
|
+
if (stories.length === 0)
|
|
47
|
+
return 'No user stories defined.';
|
|
48
|
+
return stories
|
|
49
|
+
.map((story, index) => `${index + 1}. **${story.title}** (Status: ${story.status})
|
|
50
|
+
${story.description}`)
|
|
51
|
+
.join('\n\n');
|
|
52
|
+
};
|
|
53
|
+
const formatTestCases = (cases) => {
|
|
54
|
+
if (cases.length === 0)
|
|
55
|
+
return 'No test cases defined.';
|
|
56
|
+
return cases
|
|
57
|
+
.map((testCase, index) => `${index + 1}. **${testCase.name}** ${testCase.is_critical ? '[CRITICAL]' : '[OPTIONAL]'}
|
|
58
|
+
${testCase.description}`)
|
|
59
|
+
.join('\n\n');
|
|
60
|
+
};
|
|
61
|
+
return `# Feature Analysis Context
|
|
62
|
+
|
|
63
|
+
## Feature Information
|
|
64
|
+
- **ID**: ${context.feature.id}
|
|
65
|
+
- **Name**: ${context.feature.name}
|
|
66
|
+
- **Description**: ${context.feature.description || 'No description provided'}
|
|
67
|
+
- **Current Status**: ${context.feature.status}
|
|
68
|
+
|
|
69
|
+
## Product Information
|
|
70
|
+
- **Product**: ${context.product.name}
|
|
71
|
+
- **Product ID**: ${context.product.id}
|
|
72
|
+
- **Description**: ${context.product.description || 'No product description'}
|
|
73
|
+
|
|
74
|
+
## Existing User Stories (${context.existing_user_stories.length})
|
|
75
|
+
${formatUserStories(context.existing_user_stories)}
|
|
76
|
+
|
|
77
|
+
## Existing Test Cases (${context.existing_test_cases.length})
|
|
78
|
+
${formatTestCases(context.existing_test_cases)}
|
|
79
|
+
|
|
80
|
+
## Current Technical Design
|
|
81
|
+
${context.feature.technical_design || 'No technical design available yet'}
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
**Analysis Instructions**: Based on the above feature information and existing user stories/test cases, conduct comprehensive business analysis to identify gaps and create additional user stories and test cases that add business value.`;
|
|
86
|
+
}
|
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
import { createSdkMcpServer, tool } from '@anthropic-ai/claude-code';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
async function callMcpEndpoint(mcpServerUrl, mcpToken, method, params) {
|
|
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
|
-
}
|
|
3
|
+
import { callMcpEndpoint } from '../../api/mcp-client.js';
|
|
27
4
|
// Create an SDK MCP server with custom tools for product management
|
|
28
5
|
export const createProductMcpServer = (mcpServerUrl, mcpToken) => {
|
|
29
6
|
return createSdkMcpServer({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { EdsgerConfig } from '
|
|
1
|
+
import { EdsgerConfig } from '../../types/index.js';
|
|
2
|
+
import { ChecklistPhaseContext } from '../../services/checklist.js';
|
|
2
3
|
import { type TestReportResult } from './test-report-creator.js';
|
|
3
4
|
export interface FunctionalTestingOptions {
|
|
4
5
|
mcpServerUrl: string;
|
|
@@ -21,6 +22,12 @@ export interface StructuredTestResult {
|
|
|
21
22
|
}>;
|
|
22
23
|
execution_details?: string;
|
|
23
24
|
timestamp: string;
|
|
25
|
+
checklist_item_results?: Array<{
|
|
26
|
+
checklist_item_id: string;
|
|
27
|
+
is_passed: boolean;
|
|
28
|
+
value?: any;
|
|
29
|
+
notes?: string;
|
|
30
|
+
}>;
|
|
24
31
|
}
|
|
25
32
|
export interface FunctionalTestingResult {
|
|
26
33
|
featureId: string;
|
|
@@ -29,6 +36,14 @@ export interface FunctionalTestingResult {
|
|
|
29
36
|
testReport?: TestReportResult;
|
|
30
37
|
status: 'success' | 'error';
|
|
31
38
|
message: string;
|
|
39
|
+
data?: {
|
|
40
|
+
checklist_item_results?: Array<{
|
|
41
|
+
checklist_item_id: string;
|
|
42
|
+
is_passed: boolean;
|
|
43
|
+
value?: any;
|
|
44
|
+
notes?: string;
|
|
45
|
+
}>;
|
|
46
|
+
};
|
|
32
47
|
}
|
|
33
|
-
export declare const runFunctionalTesting: (options: FunctionalTestingOptions, config: EdsgerConfig) => Promise<FunctionalTestingResult>;
|
|
48
|
+
export declare const runFunctionalTesting: (options: FunctionalTestingOptions, config: EdsgerConfig, checklistContext?: ChecklistPhaseContext | null) => Promise<FunctionalTestingResult>;
|
|
34
49
|
export declare function checkFunctionalTestingRequirements(): Promise<boolean>;
|