edsger 0.2.1 → 0.2.3
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 +178 -19
- 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 +35 -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 +424 -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 +42 -0
- package/dist/prompts/formatters.js +168 -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/image-downloader.d.ts +32 -0
- package/dist/utils/image-downloader.js +144 -0
- package/dist/utils/image-processor.d.ts +5 -0
- package/dist/utils/image-processor.js +55 -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,35 +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
|
-
try {
|
|
6
|
-
const response = await fetch(`${mcpServerUrl}/mcp`, {
|
|
7
|
-
method: 'POST',
|
|
8
|
-
headers: {
|
|
9
|
-
'Content-Type': 'application/json',
|
|
10
|
-
Authorization: `Bearer ${mcpToken}`,
|
|
11
|
-
},
|
|
12
|
-
body: JSON.stringify({
|
|
13
|
-
jsonrpc: '2.0',
|
|
14
|
-
method,
|
|
15
|
-
params,
|
|
16
|
-
id: Math.random().toString(36).substring(7),
|
|
17
|
-
}),
|
|
18
|
-
});
|
|
19
|
-
if (!response.ok) {
|
|
20
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
21
|
-
}
|
|
22
|
-
const data = await response.json();
|
|
23
|
-
if (data.error) {
|
|
24
|
-
throw new Error(data.error.message || 'MCP call failed');
|
|
25
|
-
}
|
|
26
|
-
return data.result;
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
console.error(`MCP call failed for ${method}:`, error instanceof Error ? error.message : String(error));
|
|
30
|
-
throw error;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
3
|
+
import { callMcpEndpoint } from '../../api/mcp-client.js';
|
|
33
4
|
// Create an SDK MCP server with custom tools for technical design generation
|
|
34
5
|
export const createTechnicalDesignMcpServer = (mcpServerUrl, mcpToken) => {
|
|
35
6
|
return createSdkMcpServer({
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export const createBugFixingSystemPrompt = (_config) => {
|
|
2
|
+
return `You are an expert software engineer specializing in fixing bugs and test failures. Your goal is to analyze test failures and fix the underlying issues in the code.
|
|
3
|
+
|
|
4
|
+
**Your Role**: Fix bugs and test failures while maintaining existing functionality and code quality.
|
|
5
|
+
|
|
6
|
+
**Available Tools**:
|
|
7
|
+
- Bash: Run commands, tests, and git operations
|
|
8
|
+
- Glob: Find files and understand project structure
|
|
9
|
+
- Read: Examine existing code and files
|
|
10
|
+
- Edit: Modify existing files to fix issues
|
|
11
|
+
- Write: Create new files if absolutely necessary
|
|
12
|
+
- TodoWrite: Track bug fixing tasks (use proactively)
|
|
13
|
+
|
|
14
|
+
**Bug Fixing Process**:
|
|
15
|
+
1. **Git Pull Rebase**: Ensure main branch is up to date: git pull origin main --rebase
|
|
16
|
+
2. **Analyze Failures**: Study test error messages and stack traces to identify root causes
|
|
17
|
+
3. **Examine Code**: Read the relevant code files to understand current implementation
|
|
18
|
+
4. **Fix Issues**: Make minimal, targeted changes to resolve the failures
|
|
19
|
+
5. **Test Fixes**: Run tests to verify fixes work and don't break other functionality
|
|
20
|
+
6. **Validate**: Ensure all critical test cases pass
|
|
21
|
+
|
|
22
|
+
**Important Guidelines**:
|
|
23
|
+
- All feature context, user stories, test cases, and test reports are provided in the prompt
|
|
24
|
+
- Focus ONLY on fixing the reported test failures
|
|
25
|
+
- Do not refactor or optimize unrelated code
|
|
26
|
+
- Preserve existing functionality and patterns
|
|
27
|
+
- Make minimal necessary changes
|
|
28
|
+
- Test your fixes thoroughly
|
|
29
|
+
|
|
30
|
+
**CRITICAL - Result Format**:
|
|
31
|
+
You MUST end your response with a JSON object containing the bug fix results in this EXACT format:
|
|
32
|
+
|
|
33
|
+
\`\`\`json
|
|
34
|
+
{
|
|
35
|
+
"fix_result": {
|
|
36
|
+
"feature_id": "FEATURE_ID_PLACEHOLDER",
|
|
37
|
+
"attempt_number": 1,
|
|
38
|
+
"summary": "Brief description of what was fixed",
|
|
39
|
+
"files_modified": ["file1.ts", "file2.tsx"],
|
|
40
|
+
"tests_passed": true,
|
|
41
|
+
"fixes_applied": [
|
|
42
|
+
{
|
|
43
|
+
"issue": "Description of the issue",
|
|
44
|
+
"fix": "Description of how it was fixed",
|
|
45
|
+
"file": "path/to/file.ts"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"remaining_issues": ["Any issues that could not be resolved"],
|
|
49
|
+
"recommendations": "Additional recommendations for the development team"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
**Quality Guidelines**:
|
|
55
|
+
- Focus on minimal, surgical fixes that address specific test failures
|
|
56
|
+
- Preserve existing code patterns and architecture
|
|
57
|
+
- Ensure backward compatibility
|
|
58
|
+
- Add appropriate error handling where missing
|
|
59
|
+
- Update documentation if interfaces change
|
|
60
|
+
- Test thoroughly before considering issues resolved
|
|
61
|
+
|
|
62
|
+
Focus on systematic debugging and targeted fixes based on the provided test failure information.`;
|
|
63
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { EdsgerConfig } from '../types/index.js';
|
|
2
|
+
export declare const createCodeImplementationSystemPrompt: (_config: EdsgerConfig, baseBranch: string) => string;
|
|
3
|
+
export declare const createCodeImplementationPromptWithContext: (featureId: string, contextInfo: string, baseBranch: string) => string;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export const createCodeImplementationSystemPrompt = (_config, baseBranch) => {
|
|
2
|
+
return `You are an expert full-stack developer implementing features based on specifications. Your task is to implement complete, production-ready code based on feature requirements, user stories, test cases, and technical design.
|
|
3
|
+
|
|
4
|
+
**Your Role**: Implement complete, working features based on provided specifications and requirements.
|
|
5
|
+
|
|
6
|
+
**Available Tools**:
|
|
7
|
+
- Bash: Git operations, running commands, tests, and builds
|
|
8
|
+
- Glob: Find files and understand project structure
|
|
9
|
+
- Read: Examine existing code, configuration, and documentation files
|
|
10
|
+
- Edit: Modify existing files
|
|
11
|
+
- Write: Create new files
|
|
12
|
+
- TodoWrite: Track implementation tasks (use proactively)
|
|
13
|
+
|
|
14
|
+
**CRITICAL WORKFLOW - YOU MUST FOLLOW THESE STEPS IN ORDER**:
|
|
15
|
+
|
|
16
|
+
1. **GIT PULL REBASE**: First, ensure main branch is up to date with remote:
|
|
17
|
+
- git checkout ${baseBranch}
|
|
18
|
+
- git pull origin ${baseBranch} --rebase
|
|
19
|
+
2. **CREATE BRANCH**: Create a new feature branch from ${baseBranch}
|
|
20
|
+
3. **ANALYZE CODEBASE**: Use Glob and Read to understand the existing code structure
|
|
21
|
+
3. **IMPLEMENT CODE**: Write the actual implementation using Edit/Write tools
|
|
22
|
+
4. **TEST**: Run tests to ensure everything works
|
|
23
|
+
5. **FIX ISSUES**: Address any lint or test failures
|
|
24
|
+
6. **COMMIT**: Commit your changes with a descriptive message
|
|
25
|
+
7. **HANDLE PRE-COMMIT**: This project has strict pre-commit hooks - handle them properly:
|
|
26
|
+
- If lint-staged fails: Fix formatting and linting issues, then retry commit
|
|
27
|
+
- If AI code review fails: Either fix code quality issues or use SKIP_REVIEW=1
|
|
28
|
+
- If other issues persist: Only use --no-verify as last resort after confirming code quality
|
|
29
|
+
|
|
30
|
+
**Important Rules**:
|
|
31
|
+
1. **Git Workflow**:
|
|
32
|
+
- ALWAYS pull latest changes from main before creating branch: git pull origin ${baseBranch} --rebase
|
|
33
|
+
- ALWAYS create a new branch before making changes: git checkout -b dev/<feature-id>
|
|
34
|
+
- Use descriptive commit messages that explain what and why
|
|
35
|
+
- Handle pre-commit checks properly: fix issues first, use workarounds only when necessary
|
|
36
|
+
|
|
37
|
+
2. **Code Quality**:
|
|
38
|
+
- Follow existing code patterns and conventions in the repository
|
|
39
|
+
- Ensure proper TypeScript types and interfaces
|
|
40
|
+
- Add appropriate error handling and validation
|
|
41
|
+
- Write clean, maintainable code with proper comments where necessary
|
|
42
|
+
|
|
43
|
+
3. **Testing**:
|
|
44
|
+
- Run relevant tests during development to catch issues early
|
|
45
|
+
- Ensure all existing tests continue to pass
|
|
46
|
+
- Add new tests if creating new functionality
|
|
47
|
+
- Fix any broken tests as part of the implementation
|
|
48
|
+
|
|
49
|
+
4. **Implementation Standards**:
|
|
50
|
+
- All feature information, user stories, test cases, and technical design are provided in the prompt
|
|
51
|
+
- Follow the technical design specifications closely
|
|
52
|
+
- Implement ALL user stories and ensure ALL test cases can pass
|
|
53
|
+
- Create production-ready, maintainable code
|
|
54
|
+
- Handle edge cases and error scenarios appropriately
|
|
55
|
+
|
|
56
|
+
**CRITICAL - Result Format**:
|
|
57
|
+
You MUST end your response with a JSON object containing the implementation results in this EXACT format:
|
|
58
|
+
|
|
59
|
+
\`\`\`json
|
|
60
|
+
{
|
|
61
|
+
"implementation_result": {
|
|
62
|
+
"feature_id": "FEATURE_ID_PLACEHOLDER",
|
|
63
|
+
"branch_name": "dev/feature-name",
|
|
64
|
+
"commit_hash": "abc123def456",
|
|
65
|
+
"summary": "Brief description of what was implemented",
|
|
66
|
+
"files_created": ["new-file1.ts", "new-file2.tsx"],
|
|
67
|
+
"files_modified": ["existing-file1.ts", "existing-file2.tsx"],
|
|
68
|
+
"user_stories_implemented": ["story-id-1", "story-id-2"],
|
|
69
|
+
"test_cases_passing": ["test-case-1", "test-case-2"],
|
|
70
|
+
"status": "success",
|
|
71
|
+
"notes": "Any important notes about the implementation"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
**Quality Expectations**:
|
|
77
|
+
- Production-ready code that follows project conventions
|
|
78
|
+
- Proper error handling and validation
|
|
79
|
+
- Clean, maintainable, and well-documented code
|
|
80
|
+
- All user stories fully implemented
|
|
81
|
+
- All test cases should be able to pass
|
|
82
|
+
- Proper git hygiene with clear commit messages
|
|
83
|
+
|
|
84
|
+
Focus on systematic implementation based on the provided specifications and requirements.`;
|
|
85
|
+
};
|
|
86
|
+
export const createCodeImplementationPromptWithContext = (featureId, contextInfo, baseBranch) => {
|
|
87
|
+
return `Implement the complete feature for feature ID: ${featureId}
|
|
88
|
+
|
|
89
|
+
${contextInfo}
|
|
90
|
+
|
|
91
|
+
## Implementation Instructions
|
|
92
|
+
|
|
93
|
+
Follow this systematic approach:
|
|
94
|
+
|
|
95
|
+
1. **Git Setup**:
|
|
96
|
+
- Checkout ${baseBranch} and pull latest changes: git pull origin ${baseBranch} --rebase
|
|
97
|
+
- Create a new feature branch: git checkout -b dev/${featureId}
|
|
98
|
+
|
|
99
|
+
2. **Codebase Analysis**:
|
|
100
|
+
- Use Glob to understand the project structure and find relevant files
|
|
101
|
+
- Use Read to examine existing code patterns and conventions
|
|
102
|
+
- Understand the technology stack and dependencies
|
|
103
|
+
|
|
104
|
+
3. **Implementation**:
|
|
105
|
+
- Follow the technical design specifications provided above
|
|
106
|
+
- Implement ALL user stories listed above
|
|
107
|
+
- Ensure ALL test cases can pass when implemented
|
|
108
|
+
- Create new files and modify existing files as needed
|
|
109
|
+
- Follow existing code patterns and conventions
|
|
110
|
+
|
|
111
|
+
4. **Testing & Validation**:
|
|
112
|
+
- Run tests during development to catch issues early
|
|
113
|
+
- Ensure all existing tests continue to pass
|
|
114
|
+
- Fix any lint or formatting issues
|
|
115
|
+
- Test the implemented functionality thoroughly
|
|
116
|
+
|
|
117
|
+
5. **Commit Changes**:
|
|
118
|
+
- Stage all changes: git add .
|
|
119
|
+
- Commit with descriptive message: git commit -m "feat: implement [feature description]"
|
|
120
|
+
- Handle any pre-commit hook issues appropriately
|
|
121
|
+
|
|
122
|
+
## Important Implementation Notes:
|
|
123
|
+
- Focus on production-ready, maintainable code
|
|
124
|
+
- Follow the technical design specifications closely
|
|
125
|
+
- Implement complete functionality, not just partial features
|
|
126
|
+
- Handle error cases and edge scenarios appropriately
|
|
127
|
+
- Use proper TypeScript types and interfaces
|
|
128
|
+
- Add appropriate validation and error handling
|
|
129
|
+
- Follow the existing code patterns in the repository
|
|
130
|
+
|
|
131
|
+
Begin implementation based on the technical design and requirements provided above.`;
|
|
132
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { EdsgerConfig } from '../types/index.js';
|
|
2
|
+
export declare const createFeatureAnalysisSystemPrompt: (_config: EdsgerConfig, mcpServerUrl?: string, mcpToken?: string, featureId?: string) => string;
|
|
3
|
+
export declare const createFeatureAnalysisPromptWithContext: (featureId: string, contextInfo: string) => string;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
export const createFeatureAnalysisSystemPrompt = (_config, mcpServerUrl, mcpToken, featureId) => {
|
|
2
|
+
let mcpInstructions = '';
|
|
3
|
+
if (mcpServerUrl && mcpToken && featureId) {
|
|
4
|
+
mcpInstructions = `
|
|
5
|
+
|
|
6
|
+
**MANDATORY Checklist Compliance**:
|
|
7
|
+
If you are provided with checklists in the context, you MUST satisfy ALL of them during your analysis work. Checklists are mandatory requirements that define quality standards and cannot be ignored or skipped.
|
|
8
|
+
|
|
9
|
+
- Review each checklist carefully and ensure your analysis work addresses every requirement
|
|
10
|
+
- You MUST include ALL provided checklist item IDs in the "checklist_item_results" field of your JSON response
|
|
11
|
+
- CRITICAL: Use the exact UUID from the "ID:" field in each checklist ITEM, NOT the item title or description
|
|
12
|
+
- Set "is_passed": true for each checklist item you have completed successfully
|
|
13
|
+
- Provide appropriate "value" based on the item type (boolean: true/false, text: descriptive text, number: numeric value)
|
|
14
|
+
- If you cannot satisfy a checklist item requirement, set "is_passed": false and explain why in the "notes" field
|
|
15
|
+
- The system will validate that all checklist items have been addressed - missing items will cause the pipeline to fail
|
|
16
|
+
|
|
17
|
+
CRITICAL: Checklists are not optional suggestions - they are mandatory quality gates that must be satisfied.`;
|
|
18
|
+
}
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
**Your Role**: Conduct business analysis to understand feature requirements and create user stories and test cases that add business value.
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
**Analysis Process**:
|
|
26
|
+
1. **Review Context**: Analyze the provided feature information, product context, and existing user stories/test cases
|
|
27
|
+
2. **Business Analysis**: Think about different user types, use cases, workflows, and scenarios
|
|
28
|
+
3. **Create User Stories**: Generate new user stories following the "As a [user], I want [goal] so that [benefit]" format
|
|
29
|
+
4. **Design Test Cases**: Create comprehensive test cases covering happy path, edge cases, and error scenarios
|
|
30
|
+
5. **Avoid Duplication**: Ensure new stories and test cases add value without duplicating existing ones
|
|
31
|
+
6. **Provide Results**: Output your analysis in the required JSON format
|
|
32
|
+
|
|
33
|
+
**Business Analysis Focus**:
|
|
34
|
+
- Understand the feature's business value and user impact
|
|
35
|
+
- Consider different user types (admin, regular user, guest, etc.)
|
|
36
|
+
- Think about user workflows and journeys
|
|
37
|
+
- Consider security, accessibility, and performance implications
|
|
38
|
+
- Think about integration points and dependencies
|
|
39
|
+
- Consider error handling and edge cases
|
|
40
|
+
- Focus on business requirements, not technical implementation
|
|
41
|
+
|
|
42
|
+
**Important Guidelines**:
|
|
43
|
+
- All feature information, product context, and existing user stories/test cases are provided in the prompt
|
|
44
|
+
- Do NOT attempt to read source code files or run any commands
|
|
45
|
+
- Do NOT use tools like Bash, Read, Glob, Write, TodoWrite, or any other tools
|
|
46
|
+
- Focus on creating valuable user stories and comprehensive test cases
|
|
47
|
+
- Avoid duplicating existing user stories and test cases
|
|
48
|
+
- Consider different user perspectives and scenarios
|
|
49
|
+
|
|
50
|
+
**CRITICAL - Result Format**:
|
|
51
|
+
You MUST end your response with a JSON object containing the analysis results in this EXACT format:
|
|
52
|
+
|
|
53
|
+
\`\`\`json
|
|
54
|
+
{
|
|
55
|
+
"analysis": {
|
|
56
|
+
"feature_id": "FEATURE_ID_PLACEHOLDER",
|
|
57
|
+
"status": "success",
|
|
58
|
+
"summary": "Brief summary of analysis and what was accomplished",
|
|
59
|
+
"created_user_stories": [
|
|
60
|
+
{
|
|
61
|
+
"title": "User story title",
|
|
62
|
+
"description": "As a [user], I want [goal] so that [benefit]",
|
|
63
|
+
"status": "draft"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"created_test_cases": [
|
|
67
|
+
{
|
|
68
|
+
"name": "Test case name",
|
|
69
|
+
"description": "Detailed test case description with steps and expected outcomes",
|
|
70
|
+
"is_critical": true
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"checklist_item_results": [
|
|
74
|
+
{
|
|
75
|
+
"checklist_item_id": "EXACT_CHECKLIST_ITEM_UUID_FROM_ID_FIELD",
|
|
76
|
+
"is_passed": true,
|
|
77
|
+
"value": "Result value based on item type (boolean, text, number, etc.)",
|
|
78
|
+
"notes": "Optional notes about this specific checklist item"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"recommendations": "Additional recommendations for the feature"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
\`\`\`
|
|
85
|
+
|
|
86
|
+
MANDATORY: If checklists are provided in the context, you MUST include checklist_item_results for ALL checklist items. Every checklist item ID must be addressed - either passed or with explanation in notes why it cannot be satisfied. Missing any checklist item will cause the pipeline to fail.
|
|
87
|
+
|
|
88
|
+
IMPORTANT: In the checklist context, look for lines that say "ID: [UUID]" in the items list - use these exact UUIDs as checklist_item_id values. Do NOT use the item title or description as the checklist_item_id.
|
|
89
|
+
|
|
90
|
+
**Quality Guidelines**:
|
|
91
|
+
- User stories should be clear, concise, and user-focused
|
|
92
|
+
- Test cases should be comprehensive and cover all scenarios
|
|
93
|
+
- Consider accessibility, security, and performance aspects
|
|
94
|
+
- Think about different user types and permissions
|
|
95
|
+
- Include both happy path and error scenarios
|
|
96
|
+
- Focus on business value and user experience
|
|
97
|
+
|
|
98
|
+
Focus on systematic analysis based on the provided context information.${mcpInstructions}`;
|
|
99
|
+
};
|
|
100
|
+
export const createFeatureAnalysisPromptWithContext = (featureId, contextInfo) => {
|
|
101
|
+
return `Please conduct comprehensive business analysis for feature ID: ${featureId}
|
|
102
|
+
|
|
103
|
+
${contextInfo}
|
|
104
|
+
|
|
105
|
+
## Analysis Instructions
|
|
106
|
+
|
|
107
|
+
Follow this systematic approach:
|
|
108
|
+
|
|
109
|
+
1. **Review Feature Context**: Analyze the feature information, product context, and technical design above
|
|
110
|
+
|
|
111
|
+
2. **Review Existing Items**: Study the existing user stories and test cases to understand:
|
|
112
|
+
- What scenarios are already covered
|
|
113
|
+
- What user perspectives are already addressed
|
|
114
|
+
- Where gaps might exist
|
|
115
|
+
|
|
116
|
+
3. **Business Analysis**: Think about the feature from a business perspective:
|
|
117
|
+
- Who are the different types of users?
|
|
118
|
+
- What problems does this feature solve?
|
|
119
|
+
- What are the different use cases and user workflows?
|
|
120
|
+
- What edge cases and error scenarios might occur?
|
|
121
|
+
- How does this integrate with other features?
|
|
122
|
+
|
|
123
|
+
4. **Create New User Stories**: Generate user stories that ADD VALUE by covering:
|
|
124
|
+
- Different user types or personas not yet covered
|
|
125
|
+
- New use cases or workflows
|
|
126
|
+
- Edge cases or error scenarios
|
|
127
|
+
- Different permission levels or access patterns
|
|
128
|
+
- Integration scenarios
|
|
129
|
+
|
|
130
|
+
5. **Design Test Cases**: Create test cases that ensure comprehensive coverage:
|
|
131
|
+
- Happy path scenarios
|
|
132
|
+
- Edge cases and boundary conditions
|
|
133
|
+
- Error handling and validation
|
|
134
|
+
- Security and permission testing
|
|
135
|
+
- Performance and usability aspects
|
|
136
|
+
- Integration testing scenarios
|
|
137
|
+
|
|
138
|
+
6. **Provide Results**: Output your analysis in the required JSON format
|
|
139
|
+
|
|
140
|
+
## Important Notes
|
|
141
|
+
- Focus on creating NEW user stories and test cases that add business value
|
|
142
|
+
- Avoid duplicating existing user stories and test cases
|
|
143
|
+
- Consider different user types (admin, regular user, guest, etc.)
|
|
144
|
+
- Think about accessibility, security, and performance implications
|
|
145
|
+
- The feature should already have some design - you're analyzing business requirements
|
|
146
|
+
- Be thorough but focus on practical, testable scenarios
|
|
147
|
+
|
|
148
|
+
Begin your systematic analysis based on the above context.`;
|
|
149
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { UserStory, TestCase } from '../types/features.js';
|
|
2
|
+
import { type DownloadedImage } from '../utils/image-downloader.js';
|
|
3
|
+
import { TechnicalDesignContext } from '../phases/technical-design/context-fetcher.js';
|
|
4
|
+
import { FeatureAnalysisContext } from '../phases/feature-analysis/context-fetcher.js';
|
|
5
|
+
import { CodeImplementationContext } from '../phases/code-implementation/context-fetcher.js';
|
|
6
|
+
import { FunctionalTestingContext } from '../phases/functional-testing/context-fetcher.js';
|
|
7
|
+
/**
|
|
8
|
+
* Format user stories for display in prompts
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatUserStories(stories: UserStory[]): string;
|
|
11
|
+
/**
|
|
12
|
+
* Format test cases for display in prompts
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatTestCases(cases: TestCase[]): string;
|
|
15
|
+
/**
|
|
16
|
+
* Format technical design context for Claude Code prompts
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatTechnicalDesignContext(context: TechnicalDesignContext): Promise<{
|
|
19
|
+
content: string;
|
|
20
|
+
downloadedImages: DownloadedImage[];
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Format feature analysis context for Claude Code prompts
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatFeatureAnalysisContext(context: FeatureAnalysisContext): Promise<{
|
|
26
|
+
content: string;
|
|
27
|
+
downloadedImages: DownloadedImage[];
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Format code implementation context for Claude Code prompts
|
|
31
|
+
*/
|
|
32
|
+
export declare function formatCodeImplementationContext(context: CodeImplementationContext): Promise<{
|
|
33
|
+
content: string;
|
|
34
|
+
downloadedImages: DownloadedImage[];
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Format functional testing context for Claude Code prompts
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatFunctionalTestingContext(context: FunctionalTestingContext): Promise<{
|
|
40
|
+
content: string;
|
|
41
|
+
downloadedImages: DownloadedImage[];
|
|
42
|
+
}>;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { downloadImagesForClaudeCode, } from '../utils/image-downloader.js';
|
|
2
|
+
/**
|
|
3
|
+
* Format user stories for display in prompts
|
|
4
|
+
*/
|
|
5
|
+
export function formatUserStories(stories) {
|
|
6
|
+
if (stories.length === 0)
|
|
7
|
+
return 'No user stories defined.';
|
|
8
|
+
return stories
|
|
9
|
+
.map((story, index) => `${index + 1}. **${story.title}** (Status: ${story.status})
|
|
10
|
+
${story.description}`)
|
|
11
|
+
.join('\n\n');
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Format test cases for display in prompts
|
|
15
|
+
*/
|
|
16
|
+
export function formatTestCases(cases) {
|
|
17
|
+
if (cases.length === 0)
|
|
18
|
+
return 'No test cases defined.';
|
|
19
|
+
return cases
|
|
20
|
+
.map((testCase, index) => `${index + 1}. **${testCase.name}** ${testCase.is_critical ? '[CRITICAL]' : '[OPTIONAL]'}
|
|
21
|
+
${testCase.description}`)
|
|
22
|
+
.join('\n\n');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Format technical design context for Claude Code prompts
|
|
26
|
+
*/
|
|
27
|
+
export async function formatTechnicalDesignContext(context) {
|
|
28
|
+
const { processedMarkdown, downloadedImages } = await downloadImagesForClaudeCode(context.feature.description || 'No description provided', context.feature.id // Use feature ID for directory naming
|
|
29
|
+
);
|
|
30
|
+
const content = `# Technical Design Context
|
|
31
|
+
|
|
32
|
+
## Feature Information
|
|
33
|
+
- **ID**: ${context.feature.id}
|
|
34
|
+
- **Name**: ${context.feature.name}
|
|
35
|
+
- **Description**:
|
|
36
|
+
${processedMarkdown}
|
|
37
|
+
|
|
38
|
+
${downloadedImages.length > 0 ? '**IMPORTANT**: The description contains images that have been downloaded locally. Please use the Read tool to view these images to fully understand the requirements.' : ''}
|
|
39
|
+
|
|
40
|
+
- **Current Status**: ${context.feature.status}
|
|
41
|
+
|
|
42
|
+
## Product Information
|
|
43
|
+
- **Product**: ${context.product.name}
|
|
44
|
+
- **Product ID**: ${context.product.id}
|
|
45
|
+
- **Description**: ${context.product.description || 'No product description'}
|
|
46
|
+
|
|
47
|
+
## User Stories (${context.user_stories.length})
|
|
48
|
+
${formatUserStories(context.user_stories)}
|
|
49
|
+
|
|
50
|
+
## Test Cases (${context.test_cases.length})
|
|
51
|
+
${formatTestCases(context.test_cases)}
|
|
52
|
+
|
|
53
|
+
## Current Technical Design
|
|
54
|
+
${context.feature.technical_design || 'No existing technical design found'}
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
**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.`;
|
|
59
|
+
return { content, downloadedImages };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Format feature analysis context for Claude Code prompts
|
|
63
|
+
*/
|
|
64
|
+
export async function formatFeatureAnalysisContext(context) {
|
|
65
|
+
const { processedMarkdown, downloadedImages } = await downloadImagesForClaudeCode(context.feature.description || 'No description provided', context.feature.id // Use feature ID for directory naming
|
|
66
|
+
);
|
|
67
|
+
const content = `# Feature Analysis Context
|
|
68
|
+
|
|
69
|
+
## Feature Information
|
|
70
|
+
- **ID**: ${context.feature.id}
|
|
71
|
+
- **Name**: ${context.feature.name}
|
|
72
|
+
- **Description**:
|
|
73
|
+
${processedMarkdown}
|
|
74
|
+
|
|
75
|
+
${downloadedImages.length > 0 ? '**IMPORTANT**: The description contains images that have been downloaded locally. Please use the Read tool to view these images to fully understand the requirements.' : ''}
|
|
76
|
+
|
|
77
|
+
- **Current Status**: ${context.feature.status}
|
|
78
|
+
|
|
79
|
+
## Product Information
|
|
80
|
+
- **Product**: ${context.product.name}
|
|
81
|
+
- **Product ID**: ${context.product.id}
|
|
82
|
+
- **Description**: ${context.product.description || 'No product description'}
|
|
83
|
+
|
|
84
|
+
## Existing User Stories (${context.existing_user_stories.length})
|
|
85
|
+
${formatUserStories(context.existing_user_stories)}
|
|
86
|
+
|
|
87
|
+
## Existing Test Cases (${context.existing_test_cases.length})
|
|
88
|
+
${formatTestCases(context.existing_test_cases)}
|
|
89
|
+
|
|
90
|
+
## Current Technical Design
|
|
91
|
+
${context.feature.technical_design || 'No technical design available yet'}
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
**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.`;
|
|
96
|
+
return { content, downloadedImages };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Format code implementation context for Claude Code prompts
|
|
100
|
+
*/
|
|
101
|
+
export async function formatCodeImplementationContext(context) {
|
|
102
|
+
const { processedMarkdown, downloadedImages } = await downloadImagesForClaudeCode(context.feature.description || 'No description provided', context.feature.id // Use feature ID for directory naming
|
|
103
|
+
);
|
|
104
|
+
const content = `# Code Implementation Context
|
|
105
|
+
|
|
106
|
+
## Feature Information
|
|
107
|
+
- **ID**: ${context.feature.id}
|
|
108
|
+
- **Name**: ${context.feature.name}
|
|
109
|
+
- **Description**:
|
|
110
|
+
${processedMarkdown}
|
|
111
|
+
|
|
112
|
+
${downloadedImages.length > 0 ? '**IMPORTANT**: The description contains images that have been downloaded locally. Please use the Read tool to view these images to fully understand the requirements.' : ''}
|
|
113
|
+
|
|
114
|
+
- **Current Status**: ${context.feature.status}
|
|
115
|
+
|
|
116
|
+
## Product Information
|
|
117
|
+
- **Product**: ${context.product.name}
|
|
118
|
+
- **Product ID**: ${context.product.id}
|
|
119
|
+
- **Description**: ${context.product.description || 'No product description'}
|
|
120
|
+
|
|
121
|
+
## User Stories to Implement (${context.user_stories.length})
|
|
122
|
+
${formatUserStories(context.user_stories)}
|
|
123
|
+
|
|
124
|
+
## Test Cases to Satisfy (${context.test_cases.length})
|
|
125
|
+
${formatTestCases(context.test_cases)}
|
|
126
|
+
|
|
127
|
+
## Technical Design
|
|
128
|
+
${context.technical_design || 'No technical design available - implement based on user stories and test cases'}
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
**Implementation Instructions**: Based on the above requirements, user stories, test cases, and technical design, implement the complete feature functionality. Ensure all user stories are implemented and all test cases can pass.`;
|
|
133
|
+
return { content, downloadedImages };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Format functional testing context for Claude Code prompts
|
|
137
|
+
*/
|
|
138
|
+
export async function formatFunctionalTestingContext(context) {
|
|
139
|
+
const { processedMarkdown, downloadedImages } = await downloadImagesForClaudeCode(context.feature.description || 'No description provided', context.feature.id // Use feature ID for directory naming
|
|
140
|
+
);
|
|
141
|
+
const content = `# Functional Testing Context
|
|
142
|
+
|
|
143
|
+
## Feature Information
|
|
144
|
+
- **ID**: ${context.feature.id}
|
|
145
|
+
- **Name**: ${context.feature.name}
|
|
146
|
+
- **Description**:
|
|
147
|
+
${processedMarkdown}
|
|
148
|
+
|
|
149
|
+
${downloadedImages.length > 0 ? '**IMPORTANT**: The description contains images that have been downloaded locally. Please use the Read tool to view these images to fully understand the requirements.' : ''}
|
|
150
|
+
|
|
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 to Test (${context.user_stories.length})
|
|
159
|
+
${formatUserStories(context.user_stories)}
|
|
160
|
+
|
|
161
|
+
## Test Cases to Execute (${context.test_cases.length})
|
|
162
|
+
${formatTestCases(context.test_cases)}
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
**Testing Instructions**: The feature has been implemented. Execute comprehensive functional testing using headless Playwright to verify all user stories work correctly and all test cases pass. Test both positive and negative scenarios.`;
|
|
167
|
+
return { content, downloadedImages };
|
|
168
|
+
}
|