edsger 0.2.2 ā 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 +308 -179
- 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 -213
- 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 +10 -9
- 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 -312
- 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/formatters.d.ts +17 -4
- package/dist/prompts/formatters.js +41 -12
- 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/utils/image-downloader.d.ts +32 -0
- package/dist/utils/image-downloader.js +144 -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/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,177 @@
|
|
|
1
|
+
import { logInfo, logError } from '../../utils/logger.js';
|
|
2
|
+
import { logFeatureVerificationEvent } from '../../services/audit-logs.js';
|
|
3
|
+
import { formatChecklistsForContext, processChecklistItemResultsFromResponse, } from '../../services/checklist.js';
|
|
4
|
+
import { verifyCodeImplementationCompliance, } from '../code-implementation-verification/index.js';
|
|
5
|
+
import { createCodeImplementationImprovementPrompt } from '../../prompts/code-implementation-improvement.js';
|
|
6
|
+
/**
|
|
7
|
+
* Perform a complete verification cycle:
|
|
8
|
+
* 1. Verify code implementation against checklist
|
|
9
|
+
* 2. Log results to audit logs
|
|
10
|
+
* 3. Create improvement prompt if verification failed
|
|
11
|
+
*/
|
|
12
|
+
export async function performVerificationCycle(branchName, baseBranch, checklistContext, featureId, featureName, featureDescription, config, currentIteration, maxIterations, mcpServerUrl, mcpToken, verbose) {
|
|
13
|
+
// If no checklist, verification passes automatically
|
|
14
|
+
if (!checklistContext || checklistContext.checklists.length === 0) {
|
|
15
|
+
if (verbose) {
|
|
16
|
+
logInfo('ā¹ļø No checklists to verify - skipping verification');
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
passed: true,
|
|
20
|
+
verificationResult: null,
|
|
21
|
+
nextPrompt: null,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
if (verbose) {
|
|
25
|
+
logInfo(`\nš Verifying code implementation (iteration ${currentIteration}/${maxIterations})...`);
|
|
26
|
+
}
|
|
27
|
+
// Format checklist context for verification
|
|
28
|
+
const checklistInfo = formatChecklistsForContext(checklistContext);
|
|
29
|
+
// Perform verification
|
|
30
|
+
const verificationResult = await verifyCodeImplementationCompliance({
|
|
31
|
+
featureId,
|
|
32
|
+
branchName,
|
|
33
|
+
baseBranch,
|
|
34
|
+
featureName,
|
|
35
|
+
featureDescription,
|
|
36
|
+
checklistContext: checklistInfo,
|
|
37
|
+
verbose,
|
|
38
|
+
}, config);
|
|
39
|
+
// Determine if verification passed
|
|
40
|
+
const verificationPassed = verificationResult.rejected_count === 0;
|
|
41
|
+
// Log verification result
|
|
42
|
+
if (verificationPassed) {
|
|
43
|
+
if (verbose) {
|
|
44
|
+
logInfo(`ā
Code verification passed: ${verificationResult.confirmed_count} confirmed, ${verificationResult.uncertain_count} uncertain`);
|
|
45
|
+
}
|
|
46
|
+
await logFeatureVerificationEvent(mcpServerUrl, mcpToken, {
|
|
47
|
+
featureId,
|
|
48
|
+
phase: 'code_implementation',
|
|
49
|
+
iteration: currentIteration,
|
|
50
|
+
result: 'success',
|
|
51
|
+
verificationData: {
|
|
52
|
+
confirmed_count: verificationResult.confirmed_count,
|
|
53
|
+
rejected_count: verificationResult.rejected_count,
|
|
54
|
+
uncertain_count: verificationResult.uncertain_count,
|
|
55
|
+
summary: verificationResult.summary,
|
|
56
|
+
},
|
|
57
|
+
}, verbose);
|
|
58
|
+
// Create checklist results based on verification result
|
|
59
|
+
const checklistItemResults = verificationResult.item_verifications.map((item) => ({
|
|
60
|
+
checklist_item_id: item.checklist_item_id,
|
|
61
|
+
is_passed: item.is_satisfied && item.verification_status === 'confirmed',
|
|
62
|
+
value: item.verification_status,
|
|
63
|
+
notes: item.verification_reason || undefined,
|
|
64
|
+
}));
|
|
65
|
+
await processChecklistItemResultsFromResponse({ featureId, mcpServerUrl, mcpToken }, 'code_implementation', checklistItemResults, verbose);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
logError(`ā Iteration ${currentIteration}: Code verification FAILED - ${verificationResult.rejected_count} items rejected, ${verificationResult.uncertain_count} uncertain`);
|
|
69
|
+
await logFeatureVerificationEvent(mcpServerUrl, mcpToken, {
|
|
70
|
+
featureId,
|
|
71
|
+
phase: 'code_implementation',
|
|
72
|
+
iteration: currentIteration,
|
|
73
|
+
result: 'error',
|
|
74
|
+
verificationData: {
|
|
75
|
+
confirmed_count: verificationResult.confirmed_count,
|
|
76
|
+
rejected_count: verificationResult.rejected_count,
|
|
77
|
+
uncertain_count: verificationResult.uncertain_count,
|
|
78
|
+
rejected_items: verificationResult.item_verifications
|
|
79
|
+
.filter((item) => item.verification_status === 'rejected')
|
|
80
|
+
.map((item) => ({
|
|
81
|
+
checklist_item_id: item.checklist_item_id,
|
|
82
|
+
reason: item.verification_reason || 'No reason provided',
|
|
83
|
+
concerns: item.concerns || [],
|
|
84
|
+
improvement_suggestions: item.improvement_suggestions || [],
|
|
85
|
+
})),
|
|
86
|
+
uncertain_items: verificationResult.item_verifications
|
|
87
|
+
.filter((item) => item.verification_status === 'uncertain')
|
|
88
|
+
.map((item) => ({
|
|
89
|
+
checklist_item_id: item.checklist_item_id,
|
|
90
|
+
reason: item.verification_reason || 'No reason provided',
|
|
91
|
+
concerns: item.concerns || [],
|
|
92
|
+
improvement_suggestions: item.improvement_suggestions || [],
|
|
93
|
+
})),
|
|
94
|
+
summary: verificationResult.summary,
|
|
95
|
+
overall_suggestions: verificationResult.overall_suggestions || [],
|
|
96
|
+
},
|
|
97
|
+
}, verbose);
|
|
98
|
+
}
|
|
99
|
+
// If verification failed and we have iterations left, create improvement prompt
|
|
100
|
+
let nextPrompt = null;
|
|
101
|
+
if (!verificationPassed && currentIteration < maxIterations) {
|
|
102
|
+
nextPrompt = createCodeImplementationImprovementPrompt(verificationResult, branchName, baseBranch);
|
|
103
|
+
if (verbose) {
|
|
104
|
+
logInfo(`\nš Created improvement prompt for next iteration (${maxIterations - currentIteration} attempts remaining)`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else if (!verificationPassed) {
|
|
108
|
+
// Max iterations reached - create checklist results based on final verification
|
|
109
|
+
if (verbose) {
|
|
110
|
+
logInfo(`\nš Creating checklist results for final iteration (max iterations reached)`);
|
|
111
|
+
}
|
|
112
|
+
// Create checklist results for all items (both passed and failed)
|
|
113
|
+
const checklistItemResults = verificationResult.item_verifications.map((item) => ({
|
|
114
|
+
checklist_item_id: item.checklist_item_id,
|
|
115
|
+
is_passed: item.is_satisfied && item.verification_status === 'confirmed',
|
|
116
|
+
value: item.verification_status,
|
|
117
|
+
notes: item.verification_reason || undefined,
|
|
118
|
+
}));
|
|
119
|
+
await processChecklistItemResultsFromResponse({ featureId, mcpServerUrl, mcpToken }, 'code_implementation', checklistItemResults, verbose);
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
passed: verificationPassed,
|
|
123
|
+
verificationResult,
|
|
124
|
+
nextPrompt,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Build successful implementation result
|
|
129
|
+
*/
|
|
130
|
+
export function buildImplementationResult(featureId, branchName, implementationSummary, filesModified, commitHash, iterations, checklistResults, checklistItemResults) {
|
|
131
|
+
return {
|
|
132
|
+
featureId,
|
|
133
|
+
branchName,
|
|
134
|
+
implementationSummary,
|
|
135
|
+
status: 'success',
|
|
136
|
+
message: 'Code implementation completed successfully',
|
|
137
|
+
filesModified,
|
|
138
|
+
commitHash,
|
|
139
|
+
data: {
|
|
140
|
+
checklist_results: checklistResults,
|
|
141
|
+
checklist_item_results: checklistItemResults,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Build verification failure result
|
|
147
|
+
*/
|
|
148
|
+
export function buildVerificationFailureResult(featureId, branchName, implementationSummary, filesModified, commitHash, verificationResult, iterations) {
|
|
149
|
+
return {
|
|
150
|
+
featureId,
|
|
151
|
+
branchName,
|
|
152
|
+
implementationSummary,
|
|
153
|
+
status: 'error',
|
|
154
|
+
message: `Code implementation verification failed after ${iterations} iterations. Code committed for manual review.`,
|
|
155
|
+
filesModified,
|
|
156
|
+
commitHash,
|
|
157
|
+
data: {
|
|
158
|
+
verification_failed: true,
|
|
159
|
+
verification_summary: verificationResult.summary,
|
|
160
|
+
rejected_count: verificationResult.rejected_count,
|
|
161
|
+
uncertain_count: verificationResult.uncertain_count,
|
|
162
|
+
improvement_suggestions: verificationResult.overall_suggestions || [],
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Build error result for no implementation
|
|
168
|
+
*/
|
|
169
|
+
export function buildNoResultsError(featureId, branchName) {
|
|
170
|
+
return {
|
|
171
|
+
featureId,
|
|
172
|
+
branchName,
|
|
173
|
+
implementationSummary: null,
|
|
174
|
+
status: 'error',
|
|
175
|
+
message: 'Code implementation failed - no results produced',
|
|
176
|
+
};
|
|
177
|
+
}
|
|
@@ -6,6 +6,7 @@ export interface CodeImplementationOptions {
|
|
|
6
6
|
mcpToken: string;
|
|
7
7
|
verbose?: boolean;
|
|
8
8
|
baseBranch?: string;
|
|
9
|
+
maxVerificationIterations?: number;
|
|
9
10
|
}
|
|
10
11
|
export interface CodeImplementationResult {
|
|
11
12
|
featureId: string;
|
|
@@ -27,6 +28,7 @@ export interface CodeImplementationResult {
|
|
|
27
28
|
value?: any;
|
|
28
29
|
notes?: string;
|
|
29
30
|
}>;
|
|
31
|
+
[key: string]: any;
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
export declare const implementFeatureCode: (options: CodeImplementationOptions, config: EdsgerConfig, checklistContext?: ChecklistPhaseContext | null) => Promise<CodeImplementationResult>;
|