edsger 0.4.6 → 0.4.8
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/phases/bug-fixing/prompts.d.ts +2 -0
- package/dist/phases/bug-fixing/prompts.js +63 -0
- package/dist/phases/code-implementation/analyzer-helpers.js +1 -1
- package/dist/phases/code-implementation/prompts-improvement.d.ts +5 -0
- package/dist/phases/code-implementation/prompts-improvement.js +108 -0
- package/dist/phases/code-implementation/prompts.d.ts +3 -0
- package/dist/phases/code-implementation/prompts.js +132 -0
- package/dist/phases/code-implementation-verification/prompts.d.ts +3 -0
- package/dist/phases/code-implementation-verification/prompts.js +176 -0
- package/dist/phases/code-implementation-verification/verifier.js +1 -1
- package/dist/phases/code-refine-verification/verifier.d.ts +3 -1
- package/dist/phases/code-refine-verification/verifier.js +236 -41
- package/dist/phases/feature-analysis/analyzer-helpers.js +1 -1
- package/dist/phases/feature-analysis/analyzer.js +2 -2
- package/dist/phases/feature-analysis/improvement-prompts.d.ts +8 -0
- package/dist/phases/feature-analysis/improvement-prompts.js +109 -0
- package/dist/phases/feature-analysis/prompts-improvement.d.ts +8 -0
- package/dist/phases/feature-analysis/prompts-improvement.js +109 -0
- package/dist/phases/feature-analysis/prompts.d.ts +3 -0
- package/dist/phases/feature-analysis/prompts.js +149 -0
- package/dist/phases/feature-analysis-verification/prompts.d.ts +11 -0
- package/dist/phases/feature-analysis-verification/prompts.js +153 -0
- package/dist/phases/feature-analysis-verification/verifier.js +1 -1
- package/dist/phases/functional-testing/prompts.d.ts +3 -0
- package/dist/phases/functional-testing/prompts.js +126 -0
- package/dist/phases/technical-design/analyzer-helpers.js +1 -1
- package/dist/phases/technical-design/analyzer.js +2 -2
- package/dist/phases/technical-design/prompts-improment.d.ts +5 -0
- package/dist/phases/technical-design/prompts-improment.js +93 -0
- package/dist/phases/technical-design/prompts-improvement.d.ts +5 -0
- package/dist/phases/technical-design/prompts-improvement.js +93 -0
- package/dist/phases/technical-design/prompts.d.ts +3 -0
- package/dist/phases/technical-design/prompts.js +187 -0
- package/dist/phases/technical-design-verification/prompts.d.ts +13 -0
- package/dist/phases/technical-design-verification/prompts.js +214 -0
- package/dist/phases/technical-design-verification/verifier.js +1 -1
- package/dist/utils/formatters.d.ts +42 -0
- package/dist/utils/formatters.js +168 -0
- package/dist/workflow-runner/config/phase-configs.js +1 -0
- package/package.json +1 -1
|
@@ -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
|
+
};
|
|
@@ -2,7 +2,7 @@ import { logInfo, logError } from '../../utils/logger.js';
|
|
|
2
2
|
import { logFeatureVerificationEvent } from '../../services/audit-logs.js';
|
|
3
3
|
import { formatChecklistsForContext, processChecklistItemResultsFromResponse, } from '../../services/checklist.js';
|
|
4
4
|
import { verifyCodeImplementationCompliance, } from '../code-implementation-verification/index.js';
|
|
5
|
-
import { createCodeImplementationImprovementPrompt } from '
|
|
5
|
+
import { createCodeImplementationImprovementPrompt } from './prompts-improvement.js';
|
|
6
6
|
/**
|
|
7
7
|
* Perform a complete verification cycle:
|
|
8
8
|
* 1. Verify code implementation against checklist
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ChecklistVerificationResult } from '../code-implementation-verification/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a prompt for the implementation agent to improve code based on verification feedback
|
|
4
|
+
*/
|
|
5
|
+
export declare const createCodeImplementationImprovementPrompt: (verificationResult: ChecklistVerificationResult, branchName: string, baseBranch: string) => string;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a prompt for the implementation agent to improve code based on verification feedback
|
|
3
|
+
*/
|
|
4
|
+
export const createCodeImplementationImprovementPrompt = (verificationResult, branchName, baseBranch) => {
|
|
5
|
+
// Format rejected items with specific feedback and improvement suggestions
|
|
6
|
+
const rejectedItemsSection = verificationResult.item_verifications
|
|
7
|
+
.filter((v) => v.verification_status === 'rejected')
|
|
8
|
+
.map((v, index) => {
|
|
9
|
+
return `### Rejected Requirement ${index + 1}
|
|
10
|
+
**Checklist Item ID**: ${v.checklist_item_id}
|
|
11
|
+
**Satisfaction Status**: ${v.is_satisfied ? '✅ Satisfied' : '❌ Not Satisfied'}
|
|
12
|
+
**Verification Result**: ❌ REJECTED
|
|
13
|
+
**Reason**: ${v.verification_reason}
|
|
14
|
+
${v.concerns && v.concerns.length > 0 ? `**Specific Concerns**:\n${v.concerns.map((c) => `- ${c}`).join('\n')}` : ''}
|
|
15
|
+
${v.improvement_suggestions && v.improvement_suggestions.length > 0 ? `\n**💡 Improvement Suggestions**:\n${v.improvement_suggestions.map((s) => `- ${s}`).join('\n')}` : ''}
|
|
16
|
+
`;
|
|
17
|
+
})
|
|
18
|
+
.join('\n---\n');
|
|
19
|
+
// Format uncertain items with improvement suggestions
|
|
20
|
+
const uncertainItemsSection = verificationResult.item_verifications
|
|
21
|
+
.filter((v) => v.verification_status === 'uncertain')
|
|
22
|
+
.map((v, index) => {
|
|
23
|
+
return `### Uncertain Requirement ${index + 1}
|
|
24
|
+
**Checklist Item ID**: ${v.checklist_item_id}
|
|
25
|
+
**Satisfaction Status**: ${v.is_satisfied ? '✅ Satisfied' : '⚠️ Partially Satisfied'}
|
|
26
|
+
**Verification Result**: ⚠️ UNCERTAIN
|
|
27
|
+
**Reason**: ${v.verification_reason}
|
|
28
|
+
${v.concerns && v.concerns.length > 0 ? `**Specific Concerns**:\n${v.concerns.map((c) => `- ${c}`).join('\n')}` : ''}
|
|
29
|
+
${v.improvement_suggestions && v.improvement_suggestions.length > 0 ? `\n**💡 Improvement Suggestions**:\n${v.improvement_suggestions.map((s) => `- ${s}`).join('\n')}` : ''}
|
|
30
|
+
`;
|
|
31
|
+
})
|
|
32
|
+
.join('\n---\n');
|
|
33
|
+
return `# Code Review Feedback - Improvements Required
|
|
34
|
+
|
|
35
|
+
Your code implementation was reviewed by an independent code reviewer, and **${verificationResult.rejected_count} checklist requirements were NOT SATISFIED** and **${verificationResult.uncertain_count} requirements are PARTIALLY SATISFIED**.
|
|
36
|
+
|
|
37
|
+
## Code Review Summary
|
|
38
|
+
${verificationResult.summary}
|
|
39
|
+
|
|
40
|
+
## Results Breakdown
|
|
41
|
+
- ✅ Satisfied: ${verificationResult.confirmed_count}
|
|
42
|
+
- ❌ Not Satisfied: ${verificationResult.rejected_count}
|
|
43
|
+
- ⚠️ Partially Satisfied: ${verificationResult.uncertain_count}
|
|
44
|
+
|
|
45
|
+
${verificationResult.overall_suggestions && verificationResult.overall_suggestions.length > 0 ? `## 💡 Overall Improvement Suggestions\n\n${verificationResult.overall_suggestions.map((s) => `- ${s}`).join('\n')}\n\n` : ''}
|
|
46
|
+
|
|
47
|
+
${verificationResult.rejected_count > 0 ? `## ❌ Unsatisfied Requirements\n\n${rejectedItemsSection}` : ''}
|
|
48
|
+
|
|
49
|
+
${verificationResult.uncertain_count > 0 ? `## ⚠️ Partially Satisfied Requirements\n\n${uncertainItemsSection}` : ''}
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Your Task: Improve Your Code Implementation
|
|
54
|
+
|
|
55
|
+
You are currently on branch **${branchName}** (based on ${baseBranch}). You need to **improve your code** to satisfy the checklist requirements.
|
|
56
|
+
|
|
57
|
+
**What You Should Do**:
|
|
58
|
+
|
|
59
|
+
1. **Review the improvement suggestions** provided above for each rejected/uncertain requirement
|
|
60
|
+
2. **Follow the specific, actionable suggestions** from the code reviewer
|
|
61
|
+
3. **Modify your code** to address the concerns and implement the suggested improvements
|
|
62
|
+
4. **Fix code quality issues**, bugs, or security concerns identified
|
|
63
|
+
5. **Ensure all requirements are adequately satisfied** based on the feedback
|
|
64
|
+
6. **Commit your improvements** to the same branch
|
|
65
|
+
|
|
66
|
+
**IMPORTANT Guidelines**:
|
|
67
|
+
- **Pay close attention to the 💡 Improvement Suggestions** - these tell you exactly what to fix
|
|
68
|
+
- **Address all concerns** raised by the reviewer
|
|
69
|
+
- **Test your changes** to ensure they work correctly
|
|
70
|
+
- **Follow best practices** for code quality, security, and performance
|
|
71
|
+
- **Commit your improvements** with a clear message explaining what was fixed
|
|
72
|
+
- The code will be reviewed again after your improvements
|
|
73
|
+
|
|
74
|
+
**Git Workflow**:
|
|
75
|
+
1. You are already on branch ${branchName}
|
|
76
|
+
2. Make the necessary code changes based on feedback
|
|
77
|
+
3. Run tests to ensure everything works
|
|
78
|
+
4. Commit your improvements: \`git commit -m "fix: address code review feedback - <brief description>"\`
|
|
79
|
+
|
|
80
|
+
**CRITICAL - Output Format**:
|
|
81
|
+
You MUST return ONLY the JSON object below after completing your improvements. Do NOT include any explanatory text, commentary, or markdown before or after the JSON. Return ONLY the JSON in this exact format:
|
|
82
|
+
|
|
83
|
+
\`\`\`json
|
|
84
|
+
{
|
|
85
|
+
"implementation_result": {
|
|
86
|
+
"feature_id": "...",
|
|
87
|
+
"branch_name": "${branchName}",
|
|
88
|
+
"files_modified": ["list", "of", "modified", "files"],
|
|
89
|
+
"commit_hash": "new commit hash after improvements",
|
|
90
|
+
"summary": "Brief description of improvements made based on code review feedback",
|
|
91
|
+
"tests_passed": true,
|
|
92
|
+
"pre_commit_passed": true,
|
|
93
|
+
"checklist_item_results": [
|
|
94
|
+
{
|
|
95
|
+
"checklist_item_id": "EXACT_CHECKLIST_ITEM_UUID_FROM_ID_FIELD",
|
|
96
|
+
"is_passed": true,
|
|
97
|
+
"value": "Result value based on item type",
|
|
98
|
+
"notes": "Optional notes about this checklist item"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
\`\`\`
|
|
104
|
+
|
|
105
|
+
IMPORTANT: Return ONLY the JSON above. Do not add any text explaining what you did or how you improved the code. The JSON should be the complete and only content of your response.
|
|
106
|
+
|
|
107
|
+
Begin improving your code implementation based on the code review feedback.`;
|
|
108
|
+
};
|
|
@@ -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 createCodeImplementationVerificationSystemPrompt: (_config: EdsgerConfig) => string;
|
|
3
|
+
export declare const createCodeImplementationVerificationPrompt: (featureId: string, branchName: string, baseBranch: string, featureName: string, featureDescription: string, checklistContext: string) => string;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
export const createCodeImplementationVerificationSystemPrompt = (_config) => {
|
|
2
|
+
return `You are an independent senior code reviewer and quality assurance auditor specializing in verifying code implementations against requirements.
|
|
3
|
+
|
|
4
|
+
**Your Role**: Conduct thorough code review to verify that the implementation satisfies all checklist requirements.
|
|
5
|
+
|
|
6
|
+
**CRITICAL - You are NOT the implementer**: You are a separate, independent reviewer auditing someone else's work. Your job is to verify compliance, not to implement or fix code.
|
|
7
|
+
|
|
8
|
+
**Available Tools**:
|
|
9
|
+
- Bash: Git operations to review code changes (git diff, git show, git log)
|
|
10
|
+
- Read: Examine code files in detail
|
|
11
|
+
- Glob: Find files in the repository
|
|
12
|
+
|
|
13
|
+
**Verification Process**:
|
|
14
|
+
|
|
15
|
+
1. **Switch to Feature Branch**: The specific branch name (e.g., dev/feature-id) will be provided in the user prompt
|
|
16
|
+
\`git checkout [branch-name]\`
|
|
17
|
+
|
|
18
|
+
2. **Review Git Changes**: Use git diff to see what was changed compared to the base branch
|
|
19
|
+
\`git diff [base-branch]...[feature-branch]\`
|
|
20
|
+
\`git log [base-branch]..[feature-branch]\`
|
|
21
|
+
|
|
22
|
+
3. **Read Modified Files**: Use Read tool to examine the actual code implementation in detail
|
|
23
|
+
|
|
24
|
+
4. **Code Review**: Evaluate the code changes for:
|
|
25
|
+
- Code quality and best practices
|
|
26
|
+
- Proper error handling and validation
|
|
27
|
+
- Security considerations
|
|
28
|
+
- Performance implications
|
|
29
|
+
- Test coverage
|
|
30
|
+
- Documentation and comments
|
|
31
|
+
|
|
32
|
+
5. **Checklist Verification**: For each checklist item, determine if it is satisfied by the implementation:
|
|
33
|
+
- **CONFIRMED (✅)**: The code clearly satisfies the requirement with high quality
|
|
34
|
+
- **REJECTED (❌)**: The requirement is not implemented or implementation is inadequate
|
|
35
|
+
- **UNCERTAIN (⚠️)**: Partially implemented or quality concerns exist
|
|
36
|
+
|
|
37
|
+
6. **Provide Improvement Suggestions**: For rejected or uncertain items, give specific, actionable suggestions
|
|
38
|
+
|
|
39
|
+
**Verification Standards**:
|
|
40
|
+
|
|
41
|
+
- ✅ **CONFIRMED**: Code clearly implements the requirement with good quality
|
|
42
|
+
- Implementation is complete and functional
|
|
43
|
+
- Code follows best practices
|
|
44
|
+
- Proper error handling and validation
|
|
45
|
+
- Adequate test coverage
|
|
46
|
+
- Good documentation
|
|
47
|
+
|
|
48
|
+
- ❌ **REJECTED**: Requirement is not satisfied
|
|
49
|
+
- Requirement not implemented at all
|
|
50
|
+
- Implementation is fundamentally incorrect
|
|
51
|
+
- Critical quality issues or bugs
|
|
52
|
+
- Security vulnerabilities
|
|
53
|
+
- Missing essential error handling
|
|
54
|
+
|
|
55
|
+
- ⚠️ **UNCERTAIN**: Partial implementation or quality concerns
|
|
56
|
+
- Basic implementation exists but incomplete
|
|
57
|
+
- Code works but has quality issues
|
|
58
|
+
- Missing edge case handling
|
|
59
|
+
- Insufficient test coverage
|
|
60
|
+
- Poor documentation or code clarity
|
|
61
|
+
|
|
62
|
+
**Important Guidelines**:
|
|
63
|
+
- Base your verification on ACTUAL CODE CHANGES, not on claims or summaries
|
|
64
|
+
- Review the git diff to see exactly what was changed
|
|
65
|
+
- Read the modified files to understand the implementation
|
|
66
|
+
- Be thorough and objective in your assessment
|
|
67
|
+
- Provide specific, actionable improvement suggestions
|
|
68
|
+
- Consider integration with existing code
|
|
69
|
+
- Check for potential bugs, security issues, or performance problems
|
|
70
|
+
|
|
71
|
+
**CRITICAL - Result Format**:
|
|
72
|
+
You MUST return ONLY a JSON object with your verification results. Do NOT include any explanatory text before or after the JSON. Return ONLY the JSON in this EXACT format:
|
|
73
|
+
|
|
74
|
+
\`\`\`json
|
|
75
|
+
{
|
|
76
|
+
"verification_result": {
|
|
77
|
+
"overall_status": "passed" | "failed" | "partial",
|
|
78
|
+
"summary": "Brief summary of verification findings",
|
|
79
|
+
"confirmed_count": 0,
|
|
80
|
+
"rejected_count": 0,
|
|
81
|
+
"uncertain_count": 0,
|
|
82
|
+
"item_verifications": [
|
|
83
|
+
{
|
|
84
|
+
"checklist_item_id": "EXACT_CHECKLIST_ITEM_UUID",
|
|
85
|
+
"is_satisfied": true | false,
|
|
86
|
+
"verification_status": "confirmed" | "rejected" | "uncertain",
|
|
87
|
+
"verification_reason": "Detailed explanation of why this status was assigned",
|
|
88
|
+
"concerns": ["Specific concern 1", "Specific concern 2"],
|
|
89
|
+
"improvement_suggestions": ["Actionable suggestion 1", "Actionable suggestion 2"]
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"overall_suggestions": ["General improvement suggestion 1", "General improvement suggestion 2"]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
\`\`\`
|
|
96
|
+
|
|
97
|
+
IMPORTANT: Return ONLY the JSON above. Do not add any text explaining your verification process or findings. The JSON should be the complete and only content of your response.
|
|
98
|
+
|
|
99
|
+
Focus on objective, thorough code review based on actual implementation artifacts.`;
|
|
100
|
+
};
|
|
101
|
+
export const createCodeImplementationVerificationPrompt = (featureId, branchName, baseBranch, featureName, featureDescription, checklistContext) => {
|
|
102
|
+
return `# Code Implementation Verification Task
|
|
103
|
+
|
|
104
|
+
You are verifying the code implementation for feature: **${featureName}**
|
|
105
|
+
|
|
106
|
+
## Feature Information
|
|
107
|
+
- **Feature ID**: ${featureId}
|
|
108
|
+
- **Description**: ${featureDescription}
|
|
109
|
+
- **Implementation Branch**: ${branchName}
|
|
110
|
+
- **Base Branch**: ${baseBranch}
|
|
111
|
+
|
|
112
|
+
## Checklist Requirements to Verify
|
|
113
|
+
${checklistContext}
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Your Verification Process
|
|
118
|
+
|
|
119
|
+
Follow these steps systematically:
|
|
120
|
+
|
|
121
|
+
### Step 1: Switch to Feature Branch
|
|
122
|
+
\`\`\`bash
|
|
123
|
+
git checkout ${branchName}
|
|
124
|
+
\`\`\`
|
|
125
|
+
|
|
126
|
+
### Step 2: Review Code Changes
|
|
127
|
+
Compare the feature branch with the base branch to see what was changed:
|
|
128
|
+
\`\`\`bash
|
|
129
|
+
git diff ${baseBranch}...${branchName}
|
|
130
|
+
\`\`\`
|
|
131
|
+
|
|
132
|
+
Also review the commit history:
|
|
133
|
+
\`\`\`bash
|
|
134
|
+
git log ${baseBranch}..${branchName} --oneline
|
|
135
|
+
\`\`\`
|
|
136
|
+
|
|
137
|
+
### Step 3: Read Modified Files
|
|
138
|
+
Use the Read tool to examine the actual code implementation in detail. Look at:
|
|
139
|
+
- New files created
|
|
140
|
+
- Modified files
|
|
141
|
+
- Implementation logic
|
|
142
|
+
- Error handling
|
|
143
|
+
- Test coverage
|
|
144
|
+
|
|
145
|
+
### Step 4: Verify Against Checklist
|
|
146
|
+
For each checklist item, evaluate the implementation:
|
|
147
|
+
- Is the requirement implemented?
|
|
148
|
+
- Is the implementation complete and correct?
|
|
149
|
+
- Does it follow best practices?
|
|
150
|
+
- Are there quality concerns?
|
|
151
|
+
|
|
152
|
+
### Step 5: Assign Verification Status
|
|
153
|
+
For each checklist item:
|
|
154
|
+
- ✅ **CONFIRMED**: Code clearly satisfies the requirement with good quality
|
|
155
|
+
- ❌ **REJECTED**: Requirement not implemented or implementation inadequate
|
|
156
|
+
- ⚠️ **UNCERTAIN**: Partial implementation or quality concerns
|
|
157
|
+
|
|
158
|
+
### Step 6: Provide Improvement Suggestions
|
|
159
|
+
For rejected or uncertain items, provide specific, actionable suggestions on how to improve the implementation.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Important Notes
|
|
164
|
+
|
|
165
|
+
- **Review ACTUAL CODE**: Base your verification on the actual code changes in git diff, not on summaries
|
|
166
|
+
- **Be Thorough**: Read the modified files to understand the implementation
|
|
167
|
+
- **Be Objective**: Provide fair, evidence-based assessments
|
|
168
|
+
- **Be Specific**: Give concrete examples and actionable suggestions
|
|
169
|
+
- **Focus on Quality**: Consider code quality, security, performance, and maintainability
|
|
170
|
+
|
|
171
|
+
## Output Format
|
|
172
|
+
|
|
173
|
+
Return your verification results in the required JSON format. Include all checklist items with their verification status and improvement suggestions.
|
|
174
|
+
|
|
175
|
+
Begin your systematic code review now.`;
|
|
176
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { query } from '@anthropic-ai/claude-code';
|
|
2
2
|
import { logInfo, logError } from '../../utils/logger.js';
|
|
3
|
-
import { createCodeImplementationVerificationSystemPrompt, createCodeImplementationVerificationPrompt, } from '
|
|
3
|
+
import { createCodeImplementationVerificationSystemPrompt, createCodeImplementationVerificationPrompt, } from './prompts.js';
|
|
4
4
|
function userMessage(content) {
|
|
5
5
|
return {
|
|
6
6
|
type: 'user',
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
* Verifies that all PR review comments have been addressed and resolves them
|
|
4
4
|
* Uses GitHub GraphQL API to accurately detect unresolved review threads
|
|
5
5
|
*/
|
|
6
|
+
import { EdsgerConfig } from '../../types/index.js';
|
|
6
7
|
export interface CodeRefineVerificationOptions {
|
|
7
8
|
featureId: string;
|
|
8
9
|
mcpServerUrl: string;
|
|
9
10
|
mcpToken: string;
|
|
10
11
|
githubToken: string;
|
|
12
|
+
config: EdsgerConfig;
|
|
11
13
|
verbose?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export interface CodeRefineVerificationData {
|
|
@@ -42,7 +44,7 @@ export interface CodeRefineVerificationResult {
|
|
|
42
44
|
data: CodeRefineVerificationData;
|
|
43
45
|
}
|
|
44
46
|
/**
|
|
45
|
-
* Verify and resolve PR review comments using GraphQL API
|
|
47
|
+
* Verify and resolve PR review comments using GraphQL API and LLM analysis
|
|
46
48
|
*/
|
|
47
49
|
export declare function verifyAndResolveComments(options: CodeRefineVerificationOptions): Promise<CodeRefineVerificationResult>;
|
|
48
50
|
export declare function checkCodeRefineVerificationRequirements(): Promise<boolean>;
|