edsger 0.26.0 ā 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +28 -0
- package/.env.local +12 -0
- package/dist/api/features/__tests__/regression-prevention.test.d.ts +5 -0
- package/dist/api/features/__tests__/regression-prevention.test.js +338 -0
- package/dist/api/features/__tests__/status-updater.integration.test.d.ts +5 -0
- package/dist/api/features/__tests__/status-updater.integration.test.js +497 -0
- package/dist/commands/workflow/config/phase-configs.js +5 -0
- package/dist/commands/workflow/executors/phase-executor.d.ts +2 -2
- package/dist/commands/workflow/executors/phase-executor.js +2 -2
- package/dist/commands/workflow/feature-coordinator.js +3 -1
- package/dist/commands/workflow/phase-orchestrator.js +66 -3
- package/dist/commands/workflow/pipeline-runner.d.ts +17 -0
- package/dist/commands/workflow/pipeline-runner.js +393 -0
- package/dist/commands/workflow/runner.d.ts +26 -0
- package/dist/commands/workflow/runner.js +119 -0
- package/dist/commands/workflow/workflow-runner.d.ts +26 -0
- package/dist/commands/workflow/workflow-runner.js +119 -0
- package/dist/config/feature-status.js +3 -0
- package/dist/index.js +0 -0
- 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 +32 -0
- package/dist/phases/code-implementation/analyzer.js +629 -0
- package/dist/phases/code-implementation/context-fetcher.d.ts +17 -0
- package/dist/phases/code-implementation/context-fetcher.js +86 -0
- package/dist/phases/code-implementation/mcp-server.d.ts +1 -0
- package/dist/phases/code-implementation/mcp-server.js +93 -0
- 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-verification/verifier.d.ts +31 -0
- package/dist/phases/code-implementation-verification/verifier.js +196 -0
- package/dist/phases/code-refine/analyzer.d.ts +41 -0
- package/dist/phases/code-refine/analyzer.js +561 -0
- package/dist/phases/code-refine/context-fetcher.d.ts +94 -0
- package/dist/phases/code-refine/context-fetcher.js +423 -0
- package/dist/phases/code-refine-verification/analysis/llm-analyzer.d.ts +22 -0
- package/dist/phases/code-refine-verification/analysis/llm-analyzer.js +134 -0
- package/dist/phases/code-refine-verification/verifier.d.ts +47 -0
- package/dist/phases/code-refine-verification/verifier.js +597 -0
- package/dist/phases/code-review/analyzer.d.ts +29 -0
- package/dist/phases/code-review/analyzer.js +363 -0
- package/dist/phases/code-review/context-fetcher.d.ts +92 -0
- package/dist/phases/code-review/context-fetcher.js +296 -0
- package/dist/phases/feature-analysis/analyzer-helpers.d.ts +10 -0
- package/dist/phases/feature-analysis/analyzer-helpers.js +47 -0
- package/dist/phases/feature-analysis/analyzer.d.ts +11 -0
- package/dist/phases/feature-analysis/analyzer.js +208 -0
- package/dist/phases/feature-analysis/context-fetcher.d.ts +26 -0
- package/dist/phases/feature-analysis/context-fetcher.js +134 -0
- package/dist/phases/feature-analysis/http-fallback.d.ts +20 -0
- package/dist/phases/feature-analysis/http-fallback.js +95 -0
- package/dist/phases/feature-analysis/mcp-server.d.ts +1 -0
- package/dist/phases/feature-analysis/mcp-server.js +144 -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-verification/verifier.d.ts +37 -0
- package/dist/phases/feature-analysis-verification/verifier.js +147 -0
- package/dist/phases/pr-execution/context.d.ts +26 -0
- package/dist/phases/pr-execution/context.js +156 -0
- package/dist/phases/pr-execution/index.d.ts +20 -0
- package/dist/phases/pr-execution/index.js +287 -0
- package/dist/phases/pr-execution/outcome.d.ts +26 -0
- package/dist/phases/pr-execution/outcome.js +34 -0
- package/dist/phases/pr-execution/pr-executor.d.ts +28 -0
- package/dist/phases/pr-execution/pr-executor.js +152 -0
- package/dist/phases/pr-execution/prompts.d.ts +17 -0
- package/dist/phases/pr-execution/prompts.js +208 -0
- package/dist/phases/pr-splitting/context.d.ts +16 -2
- package/dist/phases/pr-splitting/context.js +127 -4
- package/dist/phases/pr-splitting/index.d.ts +7 -0
- package/dist/phases/pr-splitting/index.js +58 -52
- package/dist/phases/pr-splitting/prompts.d.ts +4 -4
- package/dist/phases/pr-splitting/prompts.js +42 -30
- package/dist/phases/technical-design/analyzer-helpers.d.ts +25 -0
- package/dist/phases/technical-design/analyzer-helpers.js +39 -0
- package/dist/phases/technical-design/analyzer.d.ts +21 -0
- package/dist/phases/technical-design/analyzer.js +461 -0
- package/dist/phases/technical-design/context-fetcher.d.ts +12 -0
- package/dist/phases/technical-design/context-fetcher.js +39 -0
- package/dist/phases/technical-design/http-fallback.d.ts +17 -0
- package/dist/phases/technical-design/http-fallback.js +151 -0
- package/dist/phases/technical-design/mcp-server.d.ts +1 -0
- package/dist/phases/technical-design/mcp-server.js +157 -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-verification/verifier.d.ts +53 -0
- package/dist/phases/technical-design-verification/verifier.js +170 -0
- package/dist/services/audit-logs.d.ts +2 -2
- package/dist/services/feature-branches.d.ts +77 -0
- package/dist/services/feature-branches.js +205 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/pipeline.d.ts +1 -1
- package/dist/utils/github-repo-info.d.ts +14 -0
- package/dist/utils/github-repo-info.js +19 -0
- package/dist/workflow-runner/config/phase-configs.d.ts +5 -0
- package/dist/workflow-runner/config/phase-configs.js +120 -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/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 +248 -0
- package/dist/workflow-runner/feature-workflow-runner.d.ts +26 -0
- package/dist/workflow-runner/feature-workflow-runner.js +119 -0
- package/dist/workflow-runner/index.d.ts +2 -0
- package/dist/workflow-runner/index.js +2 -0
- package/dist/workflow-runner/pipeline-runner.d.ts +17 -0
- package/dist/workflow-runner/pipeline-runner.js +393 -0
- package/dist/workflow-runner/workflow-processor.d.ts +54 -0
- package/dist/workflow-runner/workflow-processor.js +170 -0
- package/package.json +1 -1
- package/dist/services/lifecycle-agent/__tests__/phase-criteria.test.d.ts +0 -4
- package/dist/services/lifecycle-agent/__tests__/phase-criteria.test.js +0 -133
- package/dist/services/lifecycle-agent/__tests__/transition-rules.test.d.ts +0 -4
- package/dist/services/lifecycle-agent/__tests__/transition-rules.test.js +0 -336
- package/dist/services/lifecycle-agent/index.d.ts +0 -24
- package/dist/services/lifecycle-agent/index.js +0 -25
- package/dist/services/lifecycle-agent/phase-criteria.d.ts +0 -57
- package/dist/services/lifecycle-agent/phase-criteria.js +0 -335
- package/dist/services/lifecycle-agent/transition-rules.d.ts +0 -60
- package/dist/services/lifecycle-agent/transition-rules.js +0 -184
- package/dist/services/lifecycle-agent/types.d.ts +0 -190
- package/dist/services/lifecycle-agent/types.js +0 -12
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature workflow runner with execution mode support
|
|
3
|
+
* Main entry point for running workflow pipelines with different execution modes
|
|
4
|
+
*/
|
|
5
|
+
import { runPipelineByMode } from './pipeline-runner.js';
|
|
6
|
+
import { getFeature } from '../../api/features/get-feature.js';
|
|
7
|
+
import { logError, logInfo } from '../../utils/logger.js';
|
|
8
|
+
/**
|
|
9
|
+
* Run workflow for a feature based on its execution_mode configuration
|
|
10
|
+
*/
|
|
11
|
+
export async function runFeatureWorkflow(options, config) {
|
|
12
|
+
const { featureId, mcpServerUrl, mcpToken, verbose } = options;
|
|
13
|
+
try {
|
|
14
|
+
// 1. Get feature details to check execution_mode
|
|
15
|
+
if (verbose) {
|
|
16
|
+
logInfo(`š Fetching feature configuration for: ${featureId}`);
|
|
17
|
+
}
|
|
18
|
+
const feature = await getFeature(mcpServerUrl, mcpToken, featureId, verbose);
|
|
19
|
+
// Debug log raw feature data
|
|
20
|
+
if (verbose) {
|
|
21
|
+
logInfo(`š Feature data from API:`);
|
|
22
|
+
logInfo(` - execution_mode (raw): ${feature.execution_mode}`);
|
|
23
|
+
logInfo(` - execution_mode (type): ${typeof feature.execution_mode}`);
|
|
24
|
+
logInfo(` - is valid: ${isValidExecutionMode(feature.execution_mode || '')}`);
|
|
25
|
+
}
|
|
26
|
+
// 2. Determine execution mode (default to full_pipeline if not set)
|
|
27
|
+
const executionMode = isValidExecutionMode(feature.execution_mode || '')
|
|
28
|
+
? feature.execution_mode
|
|
29
|
+
: 'full_pipeline';
|
|
30
|
+
if (verbose) {
|
|
31
|
+
logInfo(`š Selected execution mode: ${executionMode}`);
|
|
32
|
+
logInfo(`š Mode description: ${getExecutionModeDescription(executionMode)}`);
|
|
33
|
+
}
|
|
34
|
+
// 3. Run pipeline based on execution mode
|
|
35
|
+
return await runPipelineByMode(options, config, executionMode);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
39
|
+
logError(`Failed to run feature workflow: ${errorMessage}`);
|
|
40
|
+
// Return error result
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
featureId,
|
|
44
|
+
phase: 'workflow-initialization',
|
|
45
|
+
status: 'error',
|
|
46
|
+
message: `Workflow initialization failed: ${errorMessage}`,
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Run workflow for a feature with explicit execution mode override
|
|
53
|
+
*/
|
|
54
|
+
export async function runFeatureWorkflowWithMode(options, config, executionMode) {
|
|
55
|
+
const { featureId, verbose } = options;
|
|
56
|
+
if (verbose) {
|
|
57
|
+
logInfo(`š Running workflow with explicit mode: ${executionMode} for feature: ${featureId}`);
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
return await runPipelineByMode(options, config, executionMode);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
64
|
+
logError(`Failed to run feature workflow with mode ${executionMode}: ${errorMessage}`);
|
|
65
|
+
return [
|
|
66
|
+
{
|
|
67
|
+
featureId,
|
|
68
|
+
phase: 'workflow-execution',
|
|
69
|
+
status: 'error',
|
|
70
|
+
message: `Workflow execution failed: ${errorMessage}`,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get available execution modes
|
|
77
|
+
*/
|
|
78
|
+
export function getAvailableExecutionModes() {
|
|
79
|
+
return [
|
|
80
|
+
'full_pipeline',
|
|
81
|
+
'only_feature_analysis',
|
|
82
|
+
'only_technical_design',
|
|
83
|
+
'only_code_implementation',
|
|
84
|
+
'only_functional_testing',
|
|
85
|
+
'only_code_refine',
|
|
86
|
+
'only_code_review',
|
|
87
|
+
'from_feature_analysis',
|
|
88
|
+
'from_technical_design',
|
|
89
|
+
'from_code_implementation',
|
|
90
|
+
'from_functional_testing',
|
|
91
|
+
'from_code_review',
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Validate execution mode
|
|
96
|
+
*/
|
|
97
|
+
export function isValidExecutionMode(mode) {
|
|
98
|
+
return getAvailableExecutionModes().includes(mode);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get execution mode description
|
|
102
|
+
*/
|
|
103
|
+
export function getExecutionModeDescription(mode) {
|
|
104
|
+
const descriptions = {
|
|
105
|
+
full_pipeline: 'Execute complete workflow: analysis ā design ā implementation ā testing',
|
|
106
|
+
only_feature_analysis: 'Execute only: feature analysis',
|
|
107
|
+
only_technical_design: 'Execute only: technical design',
|
|
108
|
+
only_code_implementation: 'Execute only: code implementation',
|
|
109
|
+
only_functional_testing: 'Execute only: functional testing',
|
|
110
|
+
only_code_refine: 'Execute only: code refine (address PR review feedback and verify resolution)',
|
|
111
|
+
only_code_review: 'Execute only: code review (review PR code and create review comments)',
|
|
112
|
+
from_feature_analysis: 'Execute from feature analysis to end: analysis ā design ā implementation ā testing',
|
|
113
|
+
from_technical_design: 'Execute from technical design to end: design ā implementation ā testing',
|
|
114
|
+
from_code_implementation: 'Execute from code implementation to end: implementation ā testing',
|
|
115
|
+
from_functional_testing: 'Execute from functional testing to end: testing',
|
|
116
|
+
from_code_review: 'Execute from code review to end: code-review ā code-refine ā code-refine-verification',
|
|
117
|
+
};
|
|
118
|
+
return descriptions[mode] || 'Unknown execution mode';
|
|
119
|
+
}
|
|
@@ -38,6 +38,7 @@ export const STATUS_PROGRESSION_ORDER = [
|
|
|
38
38
|
'code_implementation_verification',
|
|
39
39
|
'pr_splitting',
|
|
40
40
|
'pr_splitting_verification',
|
|
41
|
+
'pr_execution',
|
|
41
42
|
'code_refine',
|
|
42
43
|
'code_refine_verification',
|
|
43
44
|
'bug_fixing',
|
|
@@ -77,6 +78,7 @@ export const PHASE_STATUS_MAP = {
|
|
|
77
78
|
'code-implementation-verification': 'code_implementation_verification',
|
|
78
79
|
'pr-splitting': 'pr_splitting',
|
|
79
80
|
'pr-splitting-verification': 'pr_splitting_verification',
|
|
81
|
+
'pr-execution': 'pr_execution',
|
|
80
82
|
'code-refine': 'code_refine',
|
|
81
83
|
'code-refine-verification': 'code_refine_verification',
|
|
82
84
|
'bug-fixing': 'bug_fixing',
|
|
@@ -110,6 +112,7 @@ export const HUMAN_SELECTABLE_STATUSES = [
|
|
|
110
112
|
'branch_planning',
|
|
111
113
|
'code_implementation',
|
|
112
114
|
'pr_splitting',
|
|
115
|
+
'pr_execution',
|
|
113
116
|
'code_refine',
|
|
114
117
|
'bug_fixing',
|
|
115
118
|
'code_review',
|
package/dist/index.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EdsgerConfig } from '../../types/index.js';
|
|
2
|
+
import { ChecklistPhaseContext } from '../../services/checklist.js';
|
|
3
|
+
import { ChecklistVerificationResult } from '../code-implementation-verification/agent.js';
|
|
4
|
+
import { CodeImplementationResult } from './index.js';
|
|
5
|
+
export interface VerificationCycleResult {
|
|
6
|
+
passed: boolean;
|
|
7
|
+
verificationResult: ChecklistVerificationResult | null;
|
|
8
|
+
nextPrompt: string | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Perform a complete verification cycle:
|
|
12
|
+
* 1. Verify code implementation against checklist
|
|
13
|
+
* 2. Log results to audit logs
|
|
14
|
+
* 3. Create improvement prompt if verification failed
|
|
15
|
+
*/
|
|
16
|
+
export declare function performVerificationCycle(branchName: string, baseBranch: string, checklistContext: ChecklistPhaseContext | null, featureId: string, featureName: string, featureDescription: string | undefined, config: EdsgerConfig, currentIteration: number, maxIterations: number, verbose?: boolean): Promise<VerificationCycleResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Build successful implementation result
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildImplementationResult(featureId: string, branchName: string, implementationSummary: string, filesModified: string[], commitHash: string, iterations: number, checklistResults?: any[], checklistItemResults?: any[]): CodeImplementationResult;
|
|
21
|
+
/**
|
|
22
|
+
* Build verification failure result
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildVerificationFailureResult(featureId: string, branchName: string, implementationSummary: string, filesModified: string[], commitHash: string, verificationResult: ChecklistVerificationResult, iterations: number): CodeImplementationResult;
|
|
25
|
+
/**
|
|
26
|
+
* Build error result for no implementation
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildNoResultsError(featureId: string, branchName: string): CodeImplementationResult;
|
|
@@ -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/agent.js';
|
|
5
|
+
import { createCodeImplementationImprovementPrompt } from './prompts.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, 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({
|
|
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 }, '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({
|
|
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 }, '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
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EdsgerConfig } from '../../types/index.js';
|
|
2
|
+
import { ChecklistPhaseContext } from '../../services/checklist.js';
|
|
3
|
+
export interface CodeImplementationOptions {
|
|
4
|
+
featureId: string;
|
|
5
|
+
verbose?: boolean;
|
|
6
|
+
baseBranch?: string;
|
|
7
|
+
maxVerificationIterations?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface CodeImplementationResult {
|
|
10
|
+
featureId: string;
|
|
11
|
+
branchName: string;
|
|
12
|
+
implementationSummary: string | null;
|
|
13
|
+
status: 'success' | 'error';
|
|
14
|
+
message: string;
|
|
15
|
+
filesModified?: string[];
|
|
16
|
+
commitHash?: string;
|
|
17
|
+
data?: {
|
|
18
|
+
checklist_results?: Array<{
|
|
19
|
+
checklist_id: string;
|
|
20
|
+
satisfied: boolean;
|
|
21
|
+
notes?: string;
|
|
22
|
+
}>;
|
|
23
|
+
checklist_item_results?: Array<{
|
|
24
|
+
checklist_item_id: string;
|
|
25
|
+
is_passed: boolean;
|
|
26
|
+
value?: any;
|
|
27
|
+
notes?: string;
|
|
28
|
+
}>;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export declare const implementFeatureCode: (options: CodeImplementationOptions, config: EdsgerConfig, checklistContext?: ChecklistPhaseContext | null) => Promise<CodeImplementationResult>;
|