edsger 0.41.2 → 0.42.0

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.
Files changed (139) hide show
  1. package/.claude/settings.local.json +3 -23
  2. package/dist/commands/pr-resolve/index.d.ts +1 -0
  3. package/dist/commands/pr-resolve/index.js +1 -0
  4. package/dist/commands/workflow/executors/phase-executor.js +1 -3
  5. package/dist/commands/workflow/phase-orchestrator.js +1 -3
  6. package/dist/index.js +3 -2
  7. package/dist/phases/app-store-generation/index.js +1 -3
  8. package/dist/phases/branch-planning/index.js +1 -3
  9. package/dist/phases/bug-fixing/analyzer.js +1 -3
  10. package/dist/phases/code-implementation/index.js +1 -3
  11. package/dist/phases/code-refine/index.js +1 -3
  12. package/dist/phases/code-review/index.js +1 -3
  13. package/dist/phases/code-testing/analyzer.js +1 -3
  14. package/dist/phases/feature-analysis/index.js +1 -3
  15. package/dist/phases/functional-testing/analyzer.js +1 -3
  16. package/dist/phases/growth-analysis/index.js +1 -3
  17. package/dist/phases/pr-execution/index.js +59 -1
  18. package/dist/phases/pr-resolve/__tests__/checklist-learner.test.d.ts +1 -0
  19. package/dist/phases/pr-resolve/__tests__/checklist-learner.test.js +157 -0
  20. package/dist/phases/pr-resolve/__tests__/types.test.d.ts +1 -0
  21. package/dist/phases/pr-resolve/__tests__/types.test.js +43 -0
  22. package/dist/phases/pr-resolve/checklist-learner.d.ts +28 -0
  23. package/dist/phases/pr-resolve/checklist-learner.js +128 -0
  24. package/dist/phases/pr-resolve/index.d.ts +4 -0
  25. package/dist/phases/pr-resolve/index.js +23 -5
  26. package/dist/phases/pr-resolve/prompts.js +2 -1
  27. package/dist/phases/pr-resolve/types.d.ts +18 -0
  28. package/dist/phases/pr-resolve/types.js +14 -0
  29. package/dist/phases/pr-resolve/workspace.d.ts +1 -1
  30. package/dist/phases/pr-resolve/workspace.js +1 -1
  31. package/dist/phases/pr-review/__tests__/review-comments.test.js +4 -2
  32. package/dist/phases/pr-review/index.js +1 -3
  33. package/dist/phases/pr-shared/agent-utils.js +0 -1
  34. package/dist/phases/pr-shared/context.d.ts +1 -1
  35. package/dist/phases/pr-splitting/context.js +20 -15
  36. package/dist/phases/pr-splitting/index.js +1 -3
  37. package/dist/phases/technical-design/index.js +1 -3
  38. package/dist/phases/test-cases-analysis/index.js +1 -3
  39. package/dist/phases/user-stories-analysis/index.js +1 -3
  40. package/dist/services/lifecycle-agent/__tests__/phase-criteria.test.d.ts +4 -0
  41. package/dist/services/lifecycle-agent/__tests__/phase-criteria.test.js +133 -0
  42. package/dist/services/lifecycle-agent/__tests__/transition-rules.test.d.ts +4 -0
  43. package/dist/services/lifecycle-agent/__tests__/transition-rules.test.js +336 -0
  44. package/dist/services/lifecycle-agent/index.d.ts +24 -0
  45. package/dist/services/lifecycle-agent/index.js +25 -0
  46. package/dist/services/lifecycle-agent/phase-criteria.d.ts +57 -0
  47. package/dist/services/lifecycle-agent/phase-criteria.js +335 -0
  48. package/dist/services/lifecycle-agent/transition-rules.d.ts +60 -0
  49. package/dist/services/lifecycle-agent/transition-rules.js +184 -0
  50. package/dist/services/lifecycle-agent/types.d.ts +190 -0
  51. package/dist/services/lifecycle-agent/types.js +12 -0
  52. package/package.json +1 -1
  53. package/.env.local +0 -12
  54. package/dist/api/features/__tests__/regression-prevention.test.d.ts +0 -5
  55. package/dist/api/features/__tests__/regression-prevention.test.js +0 -338
  56. package/dist/api/features/__tests__/status-updater.integration.test.d.ts +0 -5
  57. package/dist/api/features/__tests__/status-updater.integration.test.js +0 -497
  58. package/dist/commands/workflow/pipeline-runner.d.ts +0 -17
  59. package/dist/commands/workflow/pipeline-runner.js +0 -393
  60. package/dist/commands/workflow/runner.d.ts +0 -26
  61. package/dist/commands/workflow/runner.js +0 -119
  62. package/dist/commands/workflow/workflow-runner.d.ts +0 -26
  63. package/dist/commands/workflow/workflow-runner.js +0 -119
  64. package/dist/phases/code-implementation/analyzer-helpers.d.ts +0 -28
  65. package/dist/phases/code-implementation/analyzer-helpers.js +0 -177
  66. package/dist/phases/code-implementation/analyzer.d.ts +0 -32
  67. package/dist/phases/code-implementation/analyzer.js +0 -629
  68. package/dist/phases/code-implementation/context-fetcher.d.ts +0 -17
  69. package/dist/phases/code-implementation/context-fetcher.js +0 -86
  70. package/dist/phases/code-implementation/mcp-server.d.ts +0 -1
  71. package/dist/phases/code-implementation/mcp-server.js +0 -93
  72. package/dist/phases/code-implementation/prompts-improvement.d.ts +0 -5
  73. package/dist/phases/code-implementation/prompts-improvement.js +0 -108
  74. package/dist/phases/code-implementation-verification/verifier.d.ts +0 -31
  75. package/dist/phases/code-implementation-verification/verifier.js +0 -196
  76. package/dist/phases/code-refine/analyzer.d.ts +0 -41
  77. package/dist/phases/code-refine/analyzer.js +0 -561
  78. package/dist/phases/code-refine/context-fetcher.d.ts +0 -94
  79. package/dist/phases/code-refine/context-fetcher.js +0 -423
  80. package/dist/phases/code-refine-verification/analysis/llm-analyzer.d.ts +0 -22
  81. package/dist/phases/code-refine-verification/analysis/llm-analyzer.js +0 -134
  82. package/dist/phases/code-refine-verification/verifier.d.ts +0 -47
  83. package/dist/phases/code-refine-verification/verifier.js +0 -597
  84. package/dist/phases/code-review/analyzer.d.ts +0 -29
  85. package/dist/phases/code-review/analyzer.js +0 -363
  86. package/dist/phases/code-review/context-fetcher.d.ts +0 -92
  87. package/dist/phases/code-review/context-fetcher.js +0 -296
  88. package/dist/phases/feature-analysis/analyzer-helpers.d.ts +0 -10
  89. package/dist/phases/feature-analysis/analyzer-helpers.js +0 -47
  90. package/dist/phases/feature-analysis/analyzer.d.ts +0 -11
  91. package/dist/phases/feature-analysis/analyzer.js +0 -208
  92. package/dist/phases/feature-analysis/context-fetcher.d.ts +0 -26
  93. package/dist/phases/feature-analysis/context-fetcher.js +0 -134
  94. package/dist/phases/feature-analysis/http-fallback.d.ts +0 -20
  95. package/dist/phases/feature-analysis/http-fallback.js +0 -95
  96. package/dist/phases/feature-analysis/mcp-server.d.ts +0 -1
  97. package/dist/phases/feature-analysis/mcp-server.js +0 -144
  98. package/dist/phases/feature-analysis/prompts-improvement.d.ts +0 -8
  99. package/dist/phases/feature-analysis/prompts-improvement.js +0 -109
  100. package/dist/phases/feature-analysis-verification/verifier.d.ts +0 -37
  101. package/dist/phases/feature-analysis-verification/verifier.js +0 -147
  102. package/dist/phases/technical-design/analyzer-helpers.d.ts +0 -25
  103. package/dist/phases/technical-design/analyzer-helpers.js +0 -39
  104. package/dist/phases/technical-design/analyzer.d.ts +0 -21
  105. package/dist/phases/technical-design/analyzer.js +0 -461
  106. package/dist/phases/technical-design/context-fetcher.d.ts +0 -12
  107. package/dist/phases/technical-design/context-fetcher.js +0 -39
  108. package/dist/phases/technical-design/http-fallback.d.ts +0 -17
  109. package/dist/phases/technical-design/http-fallback.js +0 -151
  110. package/dist/phases/technical-design/mcp-server.d.ts +0 -1
  111. package/dist/phases/technical-design/mcp-server.js +0 -157
  112. package/dist/phases/technical-design/prompts-improvement.d.ts +0 -5
  113. package/dist/phases/technical-design/prompts-improvement.js +0 -93
  114. package/dist/phases/technical-design-verification/verifier.d.ts +0 -53
  115. package/dist/phases/technical-design-verification/verifier.js +0 -170
  116. package/dist/services/feature-branches.d.ts +0 -77
  117. package/dist/services/feature-branches.js +0 -205
  118. package/dist/workflow-runner/config/phase-configs.d.ts +0 -5
  119. package/dist/workflow-runner/config/phase-configs.js +0 -120
  120. package/dist/workflow-runner/core/feature-filter.d.ts +0 -16
  121. package/dist/workflow-runner/core/feature-filter.js +0 -46
  122. package/dist/workflow-runner/core/index.d.ts +0 -8
  123. package/dist/workflow-runner/core/index.js +0 -12
  124. package/dist/workflow-runner/core/pipeline-evaluator.d.ts +0 -24
  125. package/dist/workflow-runner/core/pipeline-evaluator.js +0 -32
  126. package/dist/workflow-runner/core/state-manager.d.ts +0 -24
  127. package/dist/workflow-runner/core/state-manager.js +0 -42
  128. package/dist/workflow-runner/core/workflow-logger.d.ts +0 -20
  129. package/dist/workflow-runner/core/workflow-logger.js +0 -65
  130. package/dist/workflow-runner/executors/phase-executor.d.ts +0 -8
  131. package/dist/workflow-runner/executors/phase-executor.js +0 -248
  132. package/dist/workflow-runner/feature-workflow-runner.d.ts +0 -26
  133. package/dist/workflow-runner/feature-workflow-runner.js +0 -119
  134. package/dist/workflow-runner/index.d.ts +0 -2
  135. package/dist/workflow-runner/index.js +0 -2
  136. package/dist/workflow-runner/pipeline-runner.d.ts +0 -17
  137. package/dist/workflow-runner/pipeline-runner.js +0 -393
  138. package/dist/workflow-runner/workflow-processor.d.ts +0 -54
  139. package/dist/workflow-runner/workflow-processor.js +0 -170
@@ -1 +0,0 @@
1
- export declare const createTechnicalDesignMcpServer: () => import("@anthropic-ai/claude-code").McpSdkServerConfigWithInstance;
@@ -1,157 +0,0 @@
1
- import { createSdkMcpServer, tool } from '@anthropic-ai/claude-code';
2
- import { z } from 'zod';
3
- import { callMcpEndpoint } from '../../api/mcp-client.js';
4
- // Create an SDK MCP server with custom tools for technical design generation
5
- export const createTechnicalDesignMcpServer = () => {
6
- return createSdkMcpServer({
7
- name: 'edsger-technical-design-mcp',
8
- version: '1.0.0',
9
- tools: [
10
- tool('get_feature_info', 'Get comprehensive feature and product information for technical design', {
11
- feature_id: z.string().describe('Feature ID to analyze'),
12
- }, async (args) => {
13
- try {
14
- // Get feature details using the features/get endpoint
15
- const featureResult = (await callMcpEndpoint('features/get', {
16
- feature_id: args.feature_id,
17
- }));
18
- if (!featureResult.features ||
19
- featureResult.features.length === 0) {
20
- throw new Error('Feature not found');
21
- }
22
- const feature = featureResult.features[0];
23
- // Get product details
24
- const productResult = (await callMcpEndpoint('resources/read', {
25
- uri: `product://${feature.product_id}`,
26
- }));
27
- const productText = productResult.contents?.[0]?.text || '{}';
28
- let productInfo;
29
- try {
30
- productInfo = JSON.parse(productText);
31
- }
32
- catch {
33
- productInfo = {
34
- id: feature.product_id,
35
- name: 'Unknown Product',
36
- };
37
- }
38
- const featureInfo = {
39
- feature,
40
- product: productInfo,
41
- };
42
- return {
43
- content: [
44
- {
45
- type: 'text',
46
- text: JSON.stringify(featureInfo, null, 2),
47
- },
48
- ],
49
- };
50
- }
51
- catch (error) {
52
- console.error('Error in get_feature_info:', error);
53
- throw error;
54
- }
55
- }),
56
- tool('get_existing_user_stories', 'Get existing user stories for a feature to understand requirements', {
57
- feature_id: z.string().describe('Feature ID to get user stories for'),
58
- }, async (args) => {
59
- const result = await callMcpEndpoint('user_stories/list', {
60
- feature_id: args.feature_id,
61
- });
62
- return {
63
- content: [
64
- {
65
- type: 'text',
66
- text: JSON.stringify(result, null, 2),
67
- },
68
- ],
69
- };
70
- }),
71
- tool('get_existing_test_cases', 'Get existing test cases for a feature to understand testing requirements', {
72
- feature_id: z.string().describe('Feature ID to get test cases for'),
73
- }, async (args) => {
74
- const result = await callMcpEndpoint('test_cases/list', {
75
- feature_id: args.feature_id,
76
- });
77
- return {
78
- content: [
79
- {
80
- type: 'text',
81
- text: JSON.stringify(result, null, 2),
82
- },
83
- ],
84
- };
85
- }),
86
- tool('get_current_technical_design', 'Get the current technical design for a feature if it exists', {
87
- feature_id: z
88
- .string()
89
- .describe('Feature ID to get technical design for'),
90
- }, async (args) => {
91
- try {
92
- const result = (await callMcpEndpoint('features/get', {
93
- feature_id: args.feature_id,
94
- }));
95
- const currentDesign = result.features?.[0]?.technical_design || null;
96
- return {
97
- content: [
98
- {
99
- type: 'text',
100
- text: JSON.stringify({
101
- has_existing_design: !!currentDesign,
102
- current_technical_design: currentDesign,
103
- }, null, 2),
104
- },
105
- ],
106
- };
107
- }
108
- catch (error) {
109
- console.error('Error getting current technical design:', error);
110
- return {
111
- content: [
112
- {
113
- type: 'text',
114
- text: JSON.stringify({
115
- has_existing_design: false,
116
- current_technical_design: null,
117
- error: 'Failed to retrieve current design',
118
- }, null, 2),
119
- },
120
- ],
121
- };
122
- }
123
- }),
124
- tool('save_technical_design', 'Save the generated technical design for a feature', {
125
- feature_id: z
126
- .string()
127
- .describe('Feature ID to save technical design for'),
128
- technical_design: z
129
- .string()
130
- .describe('Technical design content to save'),
131
- }, async (args) => {
132
- try {
133
- const result = await callMcpEndpoint('features/update', {
134
- feature_id: args.feature_id,
135
- technical_design: args.technical_design,
136
- });
137
- return {
138
- content: [
139
- {
140
- type: 'text',
141
- text: JSON.stringify({
142
- success: true,
143
- message: 'Technical design saved successfully',
144
- result,
145
- }, null, 2),
146
- },
147
- ],
148
- };
149
- }
150
- catch (error) {
151
- console.error('Error saving technical design:', error);
152
- throw error;
153
- }
154
- }),
155
- ],
156
- });
157
- };
@@ -1,5 +0,0 @@
1
- import { ChecklistVerificationResult } from '../technical-design-verification/index.js';
2
- /**
3
- * Create a prompt for the technical design agent to improve based on verification feedback
4
- */
5
- export declare const createTechnicalDesignImprovementPrompt: (verificationResult: ChecklistVerificationResult, previousDesign: string) => string;
@@ -1,93 +0,0 @@
1
- /**
2
- * Create a prompt for the technical design agent to improve based on verification feedback
3
- */
4
- export const createTechnicalDesignImprovementPrompt = (verificationResult, previousDesign) => {
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 `# Verification Feedback - Design Improvements Required
34
-
35
- Your previous technical design was verified, and **${verificationResult.rejected_count} checklist requirements were NOT SATISFIED** and **${verificationResult.uncertain_count} requirements are PARTIALLY SATISFIED**.
36
-
37
- ## Verification 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
- ## Your Previous Technical Design
52
-
53
- ${previousDesign}
54
-
55
- ---
56
-
57
- ## Your Task: Improve Your Technical Design
58
-
59
- You need to **revise and improve** your technical design document to satisfy the checklist requirements.
60
-
61
- **What You Should Do**:
62
-
63
- 1. **Review the improvement suggestions** provided above for each rejected/uncertain requirement
64
- 2. **Follow the specific, actionable suggestions** - they tell you exactly what to add or modify
65
- 3. **Expand and enhance** the technical design document as suggested by the verifier
66
- 4. **Add missing sections, diagrams, or specifications** as indicated
67
- 5. **Ensure each requirement is adequately covered** based on the feedback
68
-
69
- **IMPORTANT Guidelines**:
70
- - **Pay close attention to the šŸ’” Improvement Suggestions** - these are specific actions you should take
71
- - You can **keep the good parts** of your existing design
72
- - **Add NEW sections and details** exactly as suggested to satisfy the unsatisfied requirements
73
- - **Be specific and technical** - your design will be verified again
74
- - The suggestions are your roadmap - follow them to ensure verification passes
75
- - Ensure your design directly addresses the checklist requirements with sufficient technical depth
76
-
77
- **CRITICAL - Output Format**:
78
- You MUST return ONLY the JSON object below. Do NOT include any explanatory text, commentary, or markdown before or after the JSON. Return ONLY the JSON in this exact format:
79
-
80
- \`\`\`json
81
- {
82
- "technical_design_result": {
83
- "feature_id": "...",
84
- "status": "success",
85
- "summary": "Improved technical design based on verification feedback",
86
- "technical_design": "The COMPLETE improved technical design document in markdown format",
87
- "recommendations": "..."
88
- }
89
- }
90
- \`\`\`
91
-
92
- IMPORTANT: Return ONLY the JSON above. Do not add any text explaining what you did or how you improved the design. The JSON should be the complete and only content of your response.`;
93
- };
@@ -1,53 +0,0 @@
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
- import { FeedbacksContext } from '../../services/feedbacks.js';
8
- export interface ChecklistItemVerificationResult {
9
- checklist_item_id: string;
10
- is_satisfied: boolean;
11
- verification_status: 'confirmed' | 'rejected' | 'uncertain';
12
- verification_reason: string;
13
- concerns?: string[];
14
- improvement_suggestions?: string[];
15
- }
16
- export interface FeedbackVerificationResult {
17
- feedback_id: string;
18
- feedback_title: string;
19
- is_addressed: boolean;
20
- verification_status: 'confirmed' | 'rejected' | 'uncertain';
21
- verification_reason: string;
22
- concerns?: string[];
23
- improvement_suggestions?: string[];
24
- }
25
- export interface ChecklistVerificationResult {
26
- all_verified: boolean;
27
- total_items: number;
28
- confirmed_count: number;
29
- rejected_count: number;
30
- uncertain_count: number;
31
- item_verifications: ChecklistItemVerificationResult[];
32
- feedbacks_verified?: boolean;
33
- total_feedbacks?: number;
34
- feedbacks_confirmed_count?: number;
35
- feedbacks_rejected_count?: number;
36
- feedbacks_uncertain_count?: number;
37
- feedback_verifications?: FeedbackVerificationResult[];
38
- summary: string;
39
- overall_suggestions?: string[];
40
- }
41
- export interface VerifyTechnicalDesignOptions {
42
- checklistContext: ChecklistPhaseContext;
43
- feedbacksContext?: FeedbacksContext | null;
44
- featureId: string;
45
- featureName: string;
46
- featureDescription?: string;
47
- technicalDesign: string;
48
- verbose?: boolean;
49
- }
50
- /**
51
- * Verify checklist compliance for technical design using an independent AI agent
52
- */
53
- export declare function verifyTechnicalDesignCompliance(options: VerifyTechnicalDesignOptions, config: EdsgerConfig): Promise<ChecklistVerificationResult>;
@@ -1,170 +0,0 @@
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.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, feedbacksContext, featureId, featureName, featureDescription, technicalDesign, verbose, } = options;
22
- const totalChecklistItems = checklistContext.checklists.reduce((sum, checklist) => sum + checklist.items.length, 0);
23
- const totalFeedbacks = feedbacksContext?.feedbacks?.length || 0;
24
- const hasFeedbacks = totalFeedbacks > 0;
25
- if (verbose) {
26
- logInfo('šŸ” Starting technical design verification...');
27
- logInfo(` Verifying ${totalChecklistItems} checklist items`);
28
- if (hasFeedbacks) {
29
- logInfo(` Verifying ${totalFeedbacks} human feedbacks`);
30
- }
31
- }
32
- try {
33
- const systemPrompt = createTechnicalDesignVerificationSystemPrompt(config);
34
- const verificationPrompt = createTechnicalDesignVerificationPrompt({
35
- checklistContext,
36
- feedbacksContext: feedbacksContext || undefined,
37
- featureId,
38
- featureName,
39
- featureDescription,
40
- technicalDesign,
41
- });
42
- let lastAssistantResponse = '';
43
- let verificationResult = null;
44
- if (verbose) {
45
- logInfo('šŸ¤– Starting verification agent query...');
46
- }
47
- // Use Claude Code SDK for verification
48
- for await (const message of query({
49
- prompt: prompt(verificationPrompt),
50
- options: {
51
- appendSystemPrompt: systemPrompt,
52
- model: config.claude.model || 'sonnet',
53
- maxTurns: 100,
54
- permissionMode: 'bypassPermissions',
55
- },
56
- })) {
57
- if (verbose) {
58
- logInfo(` Received message type: ${message.type}`);
59
- }
60
- // Capture assistant responses
61
- if (message.type === 'assistant' && message.message?.content) {
62
- for (const content of message.message.content) {
63
- if (content.type === 'text') {
64
- lastAssistantResponse += content.text + '\n';
65
- if (verbose) {
66
- console.log(`\nšŸ” ${content.text}`);
67
- }
68
- }
69
- }
70
- }
71
- if (message.type === 'result') {
72
- if (message.subtype === 'success') {
73
- logInfo('\nāœ… Verification completed, parsing results...');
74
- try {
75
- const responseText = message.result || lastAssistantResponse;
76
- // Try to extract JSON from markdown code block
77
- const jsonBlockMatch = responseText.match(/```json\s*\n([\s\S]*?)\n\s*```/);
78
- let jsonResult = null;
79
- if (jsonBlockMatch) {
80
- jsonResult = JSON.parse(jsonBlockMatch[1]);
81
- }
82
- else {
83
- jsonResult = JSON.parse(responseText);
84
- }
85
- if (jsonResult && jsonResult.verification) {
86
- verificationResult = jsonResult.verification;
87
- }
88
- else {
89
- throw new Error('Invalid verification JSON structure');
90
- }
91
- }
92
- catch (error) {
93
- logError(`Failed to parse verification result: ${error}`);
94
- // Return default "uncertain" result
95
- verificationResult = createUncertainVerificationResult(checklistContext, 'Failed to parse verification response');
96
- }
97
- }
98
- else {
99
- logError(`\nāš ļø Verification incomplete: ${message.subtype}`);
100
- verificationResult = createUncertainVerificationResult(checklistContext, `Verification incomplete: ${message.subtype}`);
101
- }
102
- }
103
- }
104
- if (!verificationResult) {
105
- verificationResult = createUncertainVerificationResult(checklistContext, 'No verification result received');
106
- }
107
- if (verbose) {
108
- logInfo('\nšŸ“Š Verification Summary:');
109
- logInfo(` Total checklist items: ${verificationResult.total_items}`);
110
- logInfo(` āœ… Confirmed: ${verificationResult.confirmed_count}`);
111
- logInfo(` āŒ Rejected: ${verificationResult.rejected_count}`);
112
- logInfo(` āš ļø Uncertain: ${verificationResult.uncertain_count}`);
113
- if (verificationResult.total_feedbacks &&
114
- verificationResult.total_feedbacks > 0) {
115
- logInfo(`\n Total feedbacks: ${verificationResult.total_feedbacks}`);
116
- logInfo(` āœ… Confirmed: ${verificationResult.feedbacks_confirmed_count || 0}`);
117
- logInfo(` āŒ Rejected: ${verificationResult.feedbacks_rejected_count || 0}`);
118
- logInfo(` āš ļø Uncertain: ${verificationResult.feedbacks_uncertain_count || 0}`);
119
- }
120
- logInfo(`\n Summary: ${verificationResult.summary}`);
121
- if (verificationResult.rejected_count > 0) {
122
- logInfo('\nāŒ Rejected checklist items:');
123
- verificationResult.item_verifications
124
- .filter((v) => v.verification_status === 'rejected')
125
- .forEach((v) => {
126
- logInfo(` - ${v.checklist_item_id}`);
127
- logInfo(` Reason: ${v.verification_reason}`);
128
- });
129
- }
130
- if (verificationResult.feedbacks_rejected_count &&
131
- verificationResult.feedbacks_rejected_count > 0) {
132
- logInfo('\nāŒ Rejected feedbacks:');
133
- verificationResult.feedback_verifications
134
- ?.filter((v) => v.verification_status === 'rejected')
135
- .forEach((v) => {
136
- logInfo(` - ${v.feedback_title}`);
137
- logInfo(` Reason: ${v.verification_reason}`);
138
- });
139
- }
140
- }
141
- return verificationResult;
142
- }
143
- catch (error) {
144
- logError(`Technical design verification failed: ${error instanceof Error ? error.message : String(error)}`);
145
- return createUncertainVerificationResult(checklistContext, `Verification error: ${error instanceof Error ? error.message : String(error)}`);
146
- }
147
- }
148
- /**
149
- * Create a default "uncertain" verification result when verification fails
150
- */
151
- function createUncertainVerificationResult(checklistContext, reason) {
152
- // Get all checklist items
153
- const allItems = checklistContext.checklists.flatMap((checklist) => checklist.items.map((item) => ({
154
- checklist_item_id: item.id,
155
- })));
156
- return {
157
- all_verified: false,
158
- total_items: allItems.length,
159
- confirmed_count: 0,
160
- rejected_count: 0,
161
- uncertain_count: allItems.length,
162
- item_verifications: allItems.map((item) => ({
163
- checklist_item_id: item.checklist_item_id,
164
- is_satisfied: false,
165
- verification_status: 'uncertain',
166
- verification_reason: reason,
167
- })),
168
- summary: `Verification could not be completed: ${reason}`,
169
- };
170
- }
@@ -1,77 +0,0 @@
1
- /**
2
- * Feature Branches service for pipeline integration
3
- * Allows phases to manage feature branches via MCP
4
- */
5
- import { PipelinePhaseOptions } from '../types/pipeline.js';
6
- export interface FeatureBranch {
7
- id: string;
8
- feature_id: string;
9
- name: string;
10
- description: string | null;
11
- branch_name: string | null;
12
- base_branch_id: string | null;
13
- pull_request_url: string | null;
14
- pull_request_number: number | null;
15
- status: 'pending' | 'in_progress' | 'ready_for_review' | 'merged' | 'closed';
16
- created_at: string;
17
- updated_at: string;
18
- }
19
- export interface CreateBranchInput {
20
- name: string;
21
- description?: string;
22
- branch_name?: string;
23
- base_branch_id?: string;
24
- status?: FeatureBranch['status'];
25
- }
26
- /**
27
- * List all branches for a feature
28
- */
29
- export declare function getFeatureBranches(options: PipelinePhaseOptions): Promise<FeatureBranch[]>;
30
- /**
31
- * Get the current active branch for a feature
32
- */
33
- export declare function getCurrentBranch(options: PipelinePhaseOptions): Promise<FeatureBranch | null>;
34
- /**
35
- * Create feature branches
36
- */
37
- export declare function createFeatureBranches(options: PipelinePhaseOptions, branches: CreateBranchInput[]): Promise<FeatureBranch[]>;
38
- /**
39
- * Update a feature branch
40
- */
41
- export declare function updateFeatureBranch(branchId: string, updates: Partial<Omit<FeatureBranch, 'id' | 'feature_id' | 'created_at' | 'updated_at'>>, verbose?: boolean): Promise<FeatureBranch>;
42
- /**
43
- * Clear all branches for a feature (used before re-planning)
44
- */
45
- export declare function clearFeatureBranches(options: PipelinePhaseOptions, force?: boolean): Promise<number>;
46
- /**
47
- * Format feature branches for context (to include in prompts)
48
- */
49
- export declare function formatBranchesForContext(branches: FeatureBranch[]): string;
50
- /**
51
- * Check if feature has multiple branches planned
52
- */
53
- export declare function hasMultipleBranches(options: PipelinePhaseOptions): Promise<boolean>;
54
- /**
55
- * Get next pending branch to work on
56
- */
57
- export declare function getNextPendingBranch(options: PipelinePhaseOptions): Promise<FeatureBranch | null>;
58
- /**
59
- * Check if all branches are completed
60
- */
61
- export declare function allBranchesCompleted(options: PipelinePhaseOptions): Promise<boolean>;
62
- /**
63
- * Get the base branch information for a feature branch.
64
- * Returns:
65
- * - If base_branch_id is set and that branch is merged: use main
66
- * - If base_branch_id is set and that branch is not merged: use that branch's branch_name
67
- * - If base_branch_id is null: use main
68
- */
69
- export declare function getBaseBranchInfo(branch: FeatureBranch, allBranches: FeatureBranch[], mainBranch?: string): Promise<{
70
- baseBranch: string;
71
- needsRebase: boolean;
72
- baseBranchMerged: boolean;
73
- }>;
74
- /**
75
- * Get branch by ID
76
- */
77
- export declare function getBranchById(branchId: string, verbose?: boolean): Promise<FeatureBranch | null>;