edsger 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/api/features/batch-operations.d.ts +16 -0
- package/dist/api/features/batch-operations.js +100 -0
- package/dist/api/features/index.d.ts +1 -0
- package/dist/api/features/index.js +1 -0
- package/dist/api/features/test-cases.d.ts +8 -0
- package/dist/api/features/test-cases.js +45 -0
- package/dist/api/features/user-stories.d.ts +8 -0
- package/dist/api/features/user-stories.js +45 -0
- package/dist/cli/commands/refactor-command.d.ts +2 -0
- package/dist/cli/commands/refactor-command.js +107 -0
- package/dist/cli/index.js +7 -0
- package/dist/cli.d.ts +2 -2
- package/dist/cli.js +4 -99
- package/dist/phases/code-implementation/analyzer-helpers.d.ts +28 -0
- package/dist/phases/code-implementation/analyzer-helpers.js +177 -0
- package/dist/phases/code-implementation/analyzer.d.ts +2 -0
- package/dist/phases/code-implementation/analyzer.js +304 -175
- package/dist/phases/code-implementation-verification/index.d.ts +1 -0
- package/dist/phases/code-implementation-verification/index.js +1 -0
- package/dist/phases/code-implementation-verification/verifier.d.ts +31 -0
- package/dist/phases/code-implementation-verification/verifier.js +196 -0
- package/dist/phases/feature-analysis/analyzer-helpers.d.ts +62 -0
- package/dist/phases/feature-analysis/analyzer-helpers.js +450 -0
- package/dist/phases/feature-analysis/analyzer.d.ts +1 -0
- package/dist/phases/feature-analysis/analyzer.js +132 -219
- package/dist/phases/feature-analysis-verification/index.d.ts +1 -0
- package/dist/phases/feature-analysis-verification/index.js +1 -0
- package/dist/phases/feature-analysis-verification/verifier.d.ts +37 -0
- package/dist/phases/feature-analysis-verification/verifier.js +147 -0
- package/dist/phases/pull-request/creator.js +2 -1
- package/dist/phases/technical-design/analyzer-helpers.d.ts +37 -0
- package/dist/phases/technical-design/analyzer-helpers.js +144 -0
- package/dist/phases/technical-design/analyzer.d.ts +3 -0
- package/dist/phases/technical-design/analyzer.js +282 -318
- package/dist/phases/technical-design-verification/index.d.ts +1 -0
- package/dist/phases/technical-design-verification/index.js +1 -0
- package/dist/phases/technical-design-verification/verifier.d.ts +36 -0
- package/dist/phases/technical-design-verification/verifier.js +147 -0
- package/dist/prompts/checklist-verification.d.ts +11 -0
- package/dist/prompts/checklist-verification.js +153 -0
- package/dist/prompts/code-implementation-improvement.d.ts +5 -0
- package/dist/prompts/code-implementation-improvement.js +108 -0
- package/dist/prompts/code-implementation-verification.d.ts +3 -0
- package/dist/prompts/code-implementation-verification.js +176 -0
- package/dist/prompts/feature-analysis-improvement.d.ts +8 -0
- package/dist/prompts/feature-analysis-improvement.js +109 -0
- package/dist/prompts/feature-analysis.js +1 -1
- package/dist/prompts/technical-design-improvement.d.ts +5 -0
- package/dist/prompts/technical-design-improvement.js +93 -0
- package/dist/prompts/technical-design-verification.d.ts +11 -0
- package/dist/prompts/technical-design-verification.js +134 -0
- package/dist/prompts/technical-design.js +1 -1
- package/dist/services/audit-logs.d.ts +60 -0
- package/dist/services/audit-logs.js +115 -0
- package/dist/services/checklist.d.ts +1 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/workflow-runner/executors/phase-executor.js +56 -12
- package/package.json +1 -1
- package/dist/api/features.d.ts +0 -100
- package/dist/api/features.js +0 -219
- package/dist/logger.d.ts +0 -19
- package/dist/logger.js +0 -52
- package/dist/types.d.ts +0 -99
- package/dist/types.js +0 -1
- package/dist/utils/image-processor.d.ts +0 -5
- package/dist/utils/image-processor.js +0 -55
- package/dist/workflow-runner/config/stage-configs.d.ts +0 -5
- package/dist/workflow-runner/config/stage-configs.js +0 -34
- package/dist/workflow-runner/core/feature-filter.test.d.ts +0 -4
- package/dist/workflow-runner/core/feature-filter.test.js +0 -127
- package/dist/workflow-runner/executors/stage-executor.d.ts +0 -8
- package/dist/workflow-runner/executors/stage-executor.js +0 -49
- package/dist/workflow-runner/feature-fetcher.d.ts +0 -41
- package/dist/workflow-runner/feature-fetcher.js +0 -121
- package/dist/workflow-runner/feature-service.d.ts +0 -17
- package/dist/workflow-runner/feature-service.js +0 -60
- package/dist/workflow-runner/pipeline.d.ts +0 -18
- package/dist/workflow-runner/pipeline.js +0 -197
- package/dist/workflow-runner/processor.d.ts +0 -40
- package/dist/workflow-runner/processor.js +0 -191
- package/dist/workflow-runner/status-updater.d.ts +0 -27
- package/dist/workflow-runner/status-updater.js +0 -80
- package/dist/workflow-runner/types.d.ts +0 -48
- package/dist/workflow-runner/types.js +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { verifyTechnicalDesignCompliance, type ChecklistItemVerificationResult, type ChecklistVerificationResult, type VerifyTechnicalDesignOptions, } from './verifier.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { verifyTechnicalDesignCompliance, } from './verifier.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checklist verification agent for technical design
|
|
3
|
+
* This agent independently reviews checklist compliance to ensure quality
|
|
4
|
+
*/
|
|
5
|
+
import { EdsgerConfig } from '../../types/index.js';
|
|
6
|
+
import { ChecklistPhaseContext } from '../../services/checklist.js';
|
|
7
|
+
export interface ChecklistItemVerificationResult {
|
|
8
|
+
checklist_item_id: string;
|
|
9
|
+
is_satisfied: boolean;
|
|
10
|
+
verification_status: 'confirmed' | 'rejected' | 'uncertain';
|
|
11
|
+
verification_reason: string;
|
|
12
|
+
concerns?: string[];
|
|
13
|
+
improvement_suggestions?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface ChecklistVerificationResult {
|
|
16
|
+
all_verified: boolean;
|
|
17
|
+
total_items: number;
|
|
18
|
+
confirmed_count: number;
|
|
19
|
+
rejected_count: number;
|
|
20
|
+
uncertain_count: number;
|
|
21
|
+
item_verifications: ChecklistItemVerificationResult[];
|
|
22
|
+
summary: string;
|
|
23
|
+
overall_suggestions?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface VerifyTechnicalDesignOptions {
|
|
26
|
+
checklistContext: ChecklistPhaseContext;
|
|
27
|
+
featureId: string;
|
|
28
|
+
featureName: string;
|
|
29
|
+
featureDescription?: string;
|
|
30
|
+
technicalDesign: string;
|
|
31
|
+
verbose?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Verify checklist compliance for technical design using an independent AI agent
|
|
35
|
+
*/
|
|
36
|
+
export declare function verifyTechnicalDesignCompliance(options: VerifyTechnicalDesignOptions, config: EdsgerConfig): Promise<ChecklistVerificationResult>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checklist verification agent for technical design
|
|
3
|
+
* This agent independently reviews checklist compliance to ensure quality
|
|
4
|
+
*/
|
|
5
|
+
import { query } from '@anthropic-ai/claude-code';
|
|
6
|
+
import { logInfo, logError } from '../../utils/logger.js';
|
|
7
|
+
import { createTechnicalDesignVerificationPrompt, createTechnicalDesignVerificationSystemPrompt, } from '../../prompts/technical-design-verification.js';
|
|
8
|
+
function userMessage(content) {
|
|
9
|
+
return {
|
|
10
|
+
type: 'user',
|
|
11
|
+
message: { role: 'user', content: content },
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
async function* prompt(verificationPrompt) {
|
|
15
|
+
yield userMessage(verificationPrompt);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Verify checklist compliance for technical design using an independent AI agent
|
|
19
|
+
*/
|
|
20
|
+
export async function verifyTechnicalDesignCompliance(options, config) {
|
|
21
|
+
const { checklistContext, featureId, featureName, featureDescription, technicalDesign, verbose, } = options;
|
|
22
|
+
const totalChecklistItems = checklistContext.checklists.reduce((sum, checklist) => sum + checklist.items.length, 0);
|
|
23
|
+
if (verbose) {
|
|
24
|
+
logInfo('🔍 Starting technical design verification...');
|
|
25
|
+
logInfo(` Verifying ${totalChecklistItems} checklist items`);
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const systemPrompt = createTechnicalDesignVerificationSystemPrompt(config);
|
|
29
|
+
const verificationPrompt = createTechnicalDesignVerificationPrompt({
|
|
30
|
+
checklistContext,
|
|
31
|
+
featureId,
|
|
32
|
+
featureName,
|
|
33
|
+
featureDescription,
|
|
34
|
+
technicalDesign,
|
|
35
|
+
});
|
|
36
|
+
let lastAssistantResponse = '';
|
|
37
|
+
let verificationResult = null;
|
|
38
|
+
if (verbose) {
|
|
39
|
+
logInfo('🤖 Starting verification agent query...');
|
|
40
|
+
}
|
|
41
|
+
// Use Claude Code SDK for verification
|
|
42
|
+
for await (const message of query({
|
|
43
|
+
prompt: prompt(verificationPrompt),
|
|
44
|
+
options: {
|
|
45
|
+
appendSystemPrompt: systemPrompt,
|
|
46
|
+
model: config.claude.model || 'sonnet',
|
|
47
|
+
maxTurns: 100,
|
|
48
|
+
permissionMode: 'bypassPermissions',
|
|
49
|
+
},
|
|
50
|
+
})) {
|
|
51
|
+
if (verbose) {
|
|
52
|
+
logInfo(` Received message type: ${message.type}`);
|
|
53
|
+
}
|
|
54
|
+
// Capture assistant responses
|
|
55
|
+
if (message.type === 'assistant' && message.message?.content) {
|
|
56
|
+
for (const content of message.message.content) {
|
|
57
|
+
if (content.type === 'text') {
|
|
58
|
+
lastAssistantResponse += content.text + '\n';
|
|
59
|
+
if (verbose) {
|
|
60
|
+
console.log(`\n🔍 ${content.text}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (message.type === 'result') {
|
|
66
|
+
if (message.subtype === 'success') {
|
|
67
|
+
logInfo('\n✅ Verification completed, parsing results...');
|
|
68
|
+
try {
|
|
69
|
+
const responseText = message.result || lastAssistantResponse;
|
|
70
|
+
// Try to extract JSON from markdown code block
|
|
71
|
+
const jsonBlockMatch = responseText.match(/```json\s*\n([\s\S]*?)\n\s*```/);
|
|
72
|
+
let jsonResult = null;
|
|
73
|
+
if (jsonBlockMatch) {
|
|
74
|
+
jsonResult = JSON.parse(jsonBlockMatch[1]);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
jsonResult = JSON.parse(responseText);
|
|
78
|
+
}
|
|
79
|
+
if (jsonResult && jsonResult.verification) {
|
|
80
|
+
verificationResult = jsonResult.verification;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
throw new Error('Invalid verification JSON structure');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
logError(`Failed to parse verification result: ${error}`);
|
|
88
|
+
// Return default "uncertain" result
|
|
89
|
+
verificationResult = createUncertainVerificationResult(checklistContext, 'Failed to parse verification response');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
logError(`\n⚠️ Verification incomplete: ${message.subtype}`);
|
|
94
|
+
verificationResult = createUncertainVerificationResult(checklistContext, `Verification incomplete: ${message.subtype}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (!verificationResult) {
|
|
99
|
+
verificationResult = createUncertainVerificationResult(checklistContext, 'No verification result received');
|
|
100
|
+
}
|
|
101
|
+
if (verbose) {
|
|
102
|
+
logInfo('\n📊 Verification Summary:');
|
|
103
|
+
logInfo(` Total items: ${verificationResult.total_items}`);
|
|
104
|
+
logInfo(` ✅ Confirmed: ${verificationResult.confirmed_count}`);
|
|
105
|
+
logInfo(` ❌ Rejected: ${verificationResult.rejected_count}`);
|
|
106
|
+
logInfo(` ⚠️ Uncertain: ${verificationResult.uncertain_count}`);
|
|
107
|
+
logInfo(` Summary: ${verificationResult.summary}`);
|
|
108
|
+
if (verificationResult.rejected_count > 0) {
|
|
109
|
+
logInfo('\n❌ Rejected items:');
|
|
110
|
+
verificationResult.item_verifications
|
|
111
|
+
.filter((v) => v.verification_status === 'rejected')
|
|
112
|
+
.forEach((v) => {
|
|
113
|
+
logInfo(` - ${v.checklist_item_id}`);
|
|
114
|
+
logInfo(` Reason: ${v.verification_reason}`);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return verificationResult;
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
logError(`Technical design verification failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
122
|
+
return createUncertainVerificationResult(checklistContext, `Verification error: ${error instanceof Error ? error.message : String(error)}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create a default "uncertain" verification result when verification fails
|
|
127
|
+
*/
|
|
128
|
+
function createUncertainVerificationResult(checklistContext, reason) {
|
|
129
|
+
// Get all checklist items
|
|
130
|
+
const allItems = checklistContext.checklists.flatMap((checklist) => checklist.items.map((item) => ({
|
|
131
|
+
checklist_item_id: item.id,
|
|
132
|
+
})));
|
|
133
|
+
return {
|
|
134
|
+
all_verified: false,
|
|
135
|
+
total_items: allItems.length,
|
|
136
|
+
confirmed_count: 0,
|
|
137
|
+
rejected_count: 0,
|
|
138
|
+
uncertain_count: allItems.length,
|
|
139
|
+
item_verifications: allItems.map((item) => ({
|
|
140
|
+
checklist_item_id: item.checklist_item_id,
|
|
141
|
+
is_satisfied: false,
|
|
142
|
+
verification_status: 'uncertain',
|
|
143
|
+
verification_reason: reason,
|
|
144
|
+
})),
|
|
145
|
+
summary: `Verification could not be completed: ${reason}`,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EdsgerConfig } from '../types/index.js';
|
|
2
|
+
import { ChecklistPhaseContext } from '../services/checklist.js';
|
|
3
|
+
import { FeatureAnalysisContext } from '../phases/feature-analysis/context-fetcher.js';
|
|
4
|
+
export declare const createChecklistVerificationSystemPrompt: (_config: EdsgerConfig) => string;
|
|
5
|
+
export interface ChecklistVerificationPromptOptions {
|
|
6
|
+
checklistContext: ChecklistPhaseContext;
|
|
7
|
+
analysisContext: FeatureAnalysisContext;
|
|
8
|
+
createdUserStories: any[];
|
|
9
|
+
createdTestCases: any[];
|
|
10
|
+
}
|
|
11
|
+
export declare const createChecklistVerificationPrompt: (options: ChecklistVerificationPromptOptions) => string;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
export const createChecklistVerificationSystemPrompt = (_config) => {
|
|
2
|
+
return `You are an independent quality assurance auditor specializing in requirements verification. Your role is to critically evaluate whether generated artifacts (user stories and test cases) satisfy checklist requirements.
|
|
3
|
+
|
|
4
|
+
**Your Mission**: Verify Artifacts Against Requirements
|
|
5
|
+
- Review the checklist requirements
|
|
6
|
+
- Examine the generated user stories and test cases
|
|
7
|
+
- Determine if the artifacts satisfy each requirement
|
|
8
|
+
- Be CRITICAL and look for gaps, inconsistencies, or missing elements
|
|
9
|
+
- Quality matters - don't accept bare minimum
|
|
10
|
+
|
|
11
|
+
**Verification Approach**:
|
|
12
|
+
1. **Understand the Requirement**: Read each checklist item and understand what it requires
|
|
13
|
+
2. **Examine the Artifacts**: Look at the user stories and test cases that were created
|
|
14
|
+
3. **Match Requirements to Artifacts**: Determine if the artifacts address the requirement
|
|
15
|
+
4. **Assess Quality**: Ask yourself:
|
|
16
|
+
- Do the artifacts directly address this requirement?
|
|
17
|
+
- Is the coverage specific and concrete, or vague and generic?
|
|
18
|
+
- Is there sufficient depth and quality?
|
|
19
|
+
- Are there any gaps or missing elements?
|
|
20
|
+
- Does it meet the standard expected for this requirement?
|
|
21
|
+
|
|
22
|
+
**Verification Standards**:
|
|
23
|
+
- ✅ **CONFIRMED**: The artifacts clearly and adequately satisfy the requirement
|
|
24
|
+
- ❌ **REJECTED**: The requirement is not addressed, or addressed insufficiently
|
|
25
|
+
- ⚠️ **UNCERTAIN**: The artifacts partially address the requirement but with gaps or ambiguity
|
|
26
|
+
|
|
27
|
+
**Your Mindset**:
|
|
28
|
+
- Be thorough and systematic
|
|
29
|
+
- Focus on what the artifacts actually contain, not what was claimed
|
|
30
|
+
- Quality matters - ensure requirements are truly met
|
|
31
|
+
- Look for what's MISSING, not just what's present
|
|
32
|
+
- Be fair but rigorous
|
|
33
|
+
|
|
34
|
+
**CRITICAL - Output Format**:
|
|
35
|
+
You MUST respond with a JSON object in this EXACT format:
|
|
36
|
+
|
|
37
|
+
\`\`\`json
|
|
38
|
+
{
|
|
39
|
+
"verification": {
|
|
40
|
+
"all_verified": true/false,
|
|
41
|
+
"total_items": number,
|
|
42
|
+
"confirmed_count": number,
|
|
43
|
+
"rejected_count": number,
|
|
44
|
+
"uncertain_count": number,
|
|
45
|
+
"item_verifications": [
|
|
46
|
+
{
|
|
47
|
+
"checklist_item_id": "uuid",
|
|
48
|
+
"is_satisfied": true/false,
|
|
49
|
+
"verification_status": "confirmed|rejected|uncertain",
|
|
50
|
+
"verification_reason": "Detailed explanation of your verification decision",
|
|
51
|
+
"concerns": ["Optional array of specific concerns or gaps found"],
|
|
52
|
+
"improvement_suggestions": ["Specific, actionable suggestions for improvement (for rejected/uncertain items)"]
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"summary": "Overall summary of verification findings",
|
|
56
|
+
"overall_suggestions": ["High-level suggestions for improving the overall analysis (if there are failures)"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
**For rejected/uncertain items**: Provide specific, actionable improvement_suggestions such as:
|
|
62
|
+
- "Add a user story for X functionality"
|
|
63
|
+
- "Create a test case to verify Y behavior"
|
|
64
|
+
- "Expand test case Z to cover edge case A"
|
|
65
|
+
|
|
66
|
+
Be thorough, be critical, be fair. Your verification protects quality.`;
|
|
67
|
+
};
|
|
68
|
+
export const createChecklistVerificationPrompt = (options) => {
|
|
69
|
+
const { checklistContext, analysisContext, createdUserStories, createdTestCases, } = options;
|
|
70
|
+
// Format all checklist items with their requirements
|
|
71
|
+
const checklistItemsSection = checklistContext.checklists
|
|
72
|
+
.flatMap((checklist) => checklist.items.map((item) => {
|
|
73
|
+
return `### Checklist Item: ${item.title}
|
|
74
|
+
**ID**: ${item.id}
|
|
75
|
+
**Checklist**: ${checklist.name} (${checklist.role})
|
|
76
|
+
**Requirement**: ${item.description}
|
|
77
|
+
**Required**: ${item.is_required ? 'Yes' : 'No'}
|
|
78
|
+
**Type**: ${item.item_type}
|
|
79
|
+
`;
|
|
80
|
+
}))
|
|
81
|
+
.join('\n---\n');
|
|
82
|
+
// Format created user stories
|
|
83
|
+
const userStoriesSection = createdUserStories.length > 0
|
|
84
|
+
? createdUserStories
|
|
85
|
+
.map((story, index) => `${index + 1}. **${story.title}**
|
|
86
|
+
${story.description}
|
|
87
|
+
Status: ${story.status || 'draft'}`)
|
|
88
|
+
.join('\n\n')
|
|
89
|
+
: 'No user stories were created';
|
|
90
|
+
// Format created test cases
|
|
91
|
+
const testCasesSection = createdTestCases.length > 0
|
|
92
|
+
? createdTestCases
|
|
93
|
+
.map((testCase, index) => `${index + 1}. **${testCase.name}** ${testCase.is_critical ? '[CRITICAL]' : '[OPTIONAL]'}
|
|
94
|
+
${testCase.description}`)
|
|
95
|
+
.join('\n\n')
|
|
96
|
+
: 'No test cases were created';
|
|
97
|
+
const totalChecklistItems = checklistContext.checklists.reduce((sum, checklist) => sum + checklist.items.length, 0);
|
|
98
|
+
return `# Checklist Verification Task
|
|
99
|
+
|
|
100
|
+
You are verifying that generated artifacts (user stories and test cases) satisfy checklist requirements.
|
|
101
|
+
|
|
102
|
+
## Feature Context
|
|
103
|
+
|
|
104
|
+
**Feature**: ${analysisContext.feature.name}
|
|
105
|
+
**Feature ID**: ${analysisContext.feature.id}
|
|
106
|
+
**Description**: ${analysisContext.feature.description || 'No description'}
|
|
107
|
+
**Product**: ${analysisContext.product.name}
|
|
108
|
+
|
|
109
|
+
## Generated Artifacts
|
|
110
|
+
|
|
111
|
+
### User Stories (${createdUserStories.length})
|
|
112
|
+
${userStoriesSection}
|
|
113
|
+
|
|
114
|
+
### Test Cases (${createdTestCases.length})
|
|
115
|
+
${testCasesSection}
|
|
116
|
+
|
|
117
|
+
## Checklist Requirements to Verify (${totalChecklistItems})
|
|
118
|
+
|
|
119
|
+
${checklistItemsSection}
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Your Verification Task
|
|
124
|
+
|
|
125
|
+
For EACH checklist item above:
|
|
126
|
+
|
|
127
|
+
1. **Understand the Requirement**: What does this checklist item require?
|
|
128
|
+
|
|
129
|
+
2. **Examine the Artifacts**: Look at the user stories and test cases above
|
|
130
|
+
|
|
131
|
+
3. **Determine Coverage**: Do the artifacts adequately address this requirement?
|
|
132
|
+
- Do they directly address the requirement?
|
|
133
|
+
- Is the coverage concrete and specific?
|
|
134
|
+
- Is there sufficient quality and depth?
|
|
135
|
+
- Are there any gaps or missing elements?
|
|
136
|
+
|
|
137
|
+
4. **Make Your Determination**:
|
|
138
|
+
- **CONFIRMED** (is_satisfied: true): The artifacts clearly and adequately satisfy this requirement
|
|
139
|
+
- **REJECTED** (is_satisfied: false): The requirement is not addressed, or addressed insufficiently
|
|
140
|
+
- **UNCERTAIN** (is_satisfied: false): The artifacts partially address the requirement but with gaps
|
|
141
|
+
|
|
142
|
+
5. **Document Your Reasoning**: Provide specific, detailed reasons for your decision
|
|
143
|
+
|
|
144
|
+
6. **Provide Improvement Suggestions** (for rejected/uncertain items):
|
|
145
|
+
- Be specific and actionable
|
|
146
|
+
- Suggest what user stories or test cases should be added
|
|
147
|
+
- Indicate what should be expanded or modified
|
|
148
|
+
- Give concrete examples when possible
|
|
149
|
+
|
|
150
|
+
Remember: Focus on what the artifacts actually contain, not on claims. Be thorough and fair.
|
|
151
|
+
|
|
152
|
+
Provide your verification results in the required JSON format with improvement_suggestions for any rejected or uncertain items.`;
|
|
153
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ChecklistVerificationResult } from '../phases/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 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
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChecklistVerificationResult } from '../phases/feature-analysis-verification/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a prompt for the analysis agent to improve based on verification feedback
|
|
4
|
+
*/
|
|
5
|
+
export declare const createImprovementPrompt: (verificationResult: ChecklistVerificationResult, previousAnalysis: {
|
|
6
|
+
created_user_stories: any[];
|
|
7
|
+
created_test_cases: any[];
|
|
8
|
+
}) => string;
|