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.
Files changed (87) hide show
  1. package/README.md +17 -0
  2. package/dist/api/features/batch-operations.d.ts +16 -0
  3. package/dist/api/features/batch-operations.js +100 -0
  4. package/dist/api/features/index.d.ts +1 -0
  5. package/dist/api/features/index.js +1 -0
  6. package/dist/api/features/test-cases.d.ts +8 -0
  7. package/dist/api/features/test-cases.js +45 -0
  8. package/dist/api/features/user-stories.d.ts +8 -0
  9. package/dist/api/features/user-stories.js +45 -0
  10. package/dist/cli/commands/refactor-command.d.ts +2 -0
  11. package/dist/cli/commands/refactor-command.js +107 -0
  12. package/dist/cli/index.js +7 -0
  13. package/dist/cli.d.ts +2 -2
  14. package/dist/cli.js +4 -99
  15. package/dist/phases/code-implementation/analyzer-helpers.d.ts +28 -0
  16. package/dist/phases/code-implementation/analyzer-helpers.js +177 -0
  17. package/dist/phases/code-implementation/analyzer.d.ts +2 -0
  18. package/dist/phases/code-implementation/analyzer.js +308 -179
  19. package/dist/phases/code-implementation-verification/index.d.ts +1 -0
  20. package/dist/phases/code-implementation-verification/index.js +1 -0
  21. package/dist/phases/code-implementation-verification/verifier.d.ts +31 -0
  22. package/dist/phases/code-implementation-verification/verifier.js +196 -0
  23. package/dist/phases/feature-analysis/analyzer-helpers.d.ts +62 -0
  24. package/dist/phases/feature-analysis/analyzer-helpers.js +450 -0
  25. package/dist/phases/feature-analysis/analyzer.d.ts +1 -0
  26. package/dist/phases/feature-analysis/analyzer.js +132 -213
  27. package/dist/phases/feature-analysis-verification/index.d.ts +1 -0
  28. package/dist/phases/feature-analysis-verification/index.js +1 -0
  29. package/dist/phases/feature-analysis-verification/verifier.d.ts +37 -0
  30. package/dist/phases/feature-analysis-verification/verifier.js +147 -0
  31. package/dist/phases/pull-request/creator.js +10 -9
  32. package/dist/phases/technical-design/analyzer-helpers.d.ts +37 -0
  33. package/dist/phases/technical-design/analyzer-helpers.js +144 -0
  34. package/dist/phases/technical-design/analyzer.d.ts +3 -0
  35. package/dist/phases/technical-design/analyzer.js +282 -312
  36. package/dist/phases/technical-design-verification/index.d.ts +1 -0
  37. package/dist/phases/technical-design-verification/index.js +1 -0
  38. package/dist/phases/technical-design-verification/verifier.d.ts +36 -0
  39. package/dist/phases/technical-design-verification/verifier.js +147 -0
  40. package/dist/prompts/checklist-verification.d.ts +11 -0
  41. package/dist/prompts/checklist-verification.js +153 -0
  42. package/dist/prompts/code-implementation-improvement.d.ts +5 -0
  43. package/dist/prompts/code-implementation-improvement.js +108 -0
  44. package/dist/prompts/code-implementation-verification.d.ts +3 -0
  45. package/dist/prompts/code-implementation-verification.js +176 -0
  46. package/dist/prompts/feature-analysis-improvement.d.ts +8 -0
  47. package/dist/prompts/feature-analysis-improvement.js +109 -0
  48. package/dist/prompts/feature-analysis.js +1 -1
  49. package/dist/prompts/formatters.d.ts +17 -4
  50. package/dist/prompts/formatters.js +41 -12
  51. package/dist/prompts/technical-design-improvement.d.ts +5 -0
  52. package/dist/prompts/technical-design-improvement.js +93 -0
  53. package/dist/prompts/technical-design-verification.d.ts +11 -0
  54. package/dist/prompts/technical-design-verification.js +134 -0
  55. package/dist/prompts/technical-design.js +1 -1
  56. package/dist/services/audit-logs.d.ts +60 -0
  57. package/dist/services/audit-logs.js +115 -0
  58. package/dist/services/checklist.d.ts +1 -0
  59. package/dist/types/index.d.ts +19 -0
  60. package/dist/utils/image-downloader.d.ts +32 -0
  61. package/dist/utils/image-downloader.js +144 -0
  62. package/dist/workflow-runner/executors/phase-executor.js +56 -12
  63. package/package.json +1 -1
  64. package/dist/api/features.d.ts +0 -100
  65. package/dist/api/features.js +0 -219
  66. package/dist/logger.d.ts +0 -19
  67. package/dist/logger.js +0 -52
  68. package/dist/types.d.ts +0 -99
  69. package/dist/types.js +0 -1
  70. package/dist/workflow-runner/config/stage-configs.d.ts +0 -5
  71. package/dist/workflow-runner/config/stage-configs.js +0 -34
  72. package/dist/workflow-runner/core/feature-filter.test.d.ts +0 -4
  73. package/dist/workflow-runner/core/feature-filter.test.js +0 -127
  74. package/dist/workflow-runner/executors/stage-executor.d.ts +0 -8
  75. package/dist/workflow-runner/executors/stage-executor.js +0 -49
  76. package/dist/workflow-runner/feature-fetcher.d.ts +0 -41
  77. package/dist/workflow-runner/feature-fetcher.js +0 -121
  78. package/dist/workflow-runner/feature-service.d.ts +0 -17
  79. package/dist/workflow-runner/feature-service.js +0 -60
  80. package/dist/workflow-runner/pipeline.d.ts +0 -18
  81. package/dist/workflow-runner/pipeline.js +0 -197
  82. package/dist/workflow-runner/processor.d.ts +0 -40
  83. package/dist/workflow-runner/processor.js +0 -191
  84. package/dist/workflow-runner/status-updater.d.ts +0 -27
  85. package/dist/workflow-runner/status-updater.js +0 -80
  86. package/dist/workflow-runner/types.d.ts +0 -48
  87. package/dist/workflow-runner/types.js +0 -4
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Create a prompt for the analysis agent to improve based on verification feedback
3
+ */
4
+ export const createImprovementPrompt = (verificationResult, previousAnalysis) => {
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 - Improvements Required
34
+
35
+ Your previous analysis 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 Work
52
+
53
+ ### User Stories You Created (${previousAnalysis.created_user_stories.length})
54
+ ${previousAnalysis.created_user_stories
55
+ .map((story, index) => `${index + 1}. **${story.title}**
56
+ ${story.description}
57
+ Status: ${story.status || 'draft'}`)
58
+ .join('\n\n')}
59
+
60
+ ### Test Cases You Created (${previousAnalysis.created_test_cases.length})
61
+ ${previousAnalysis.created_test_cases
62
+ .map((tc, index) => `${index + 1}. **${tc.name}** ${tc.is_critical ? '[CRITICAL]' : '[OPTIONAL]'}
63
+ ${tc.description}`)
64
+ .join('\n\n')}
65
+
66
+ ---
67
+
68
+ ## Your Task: Improve Your Artifacts
69
+
70
+ You need to **revise and improve** your user stories and test cases to satisfy the checklist requirements.
71
+
72
+ **What You Should Do**:
73
+
74
+ 1. **Review the improvement suggestions** provided above for each rejected/uncertain requirement
75
+ 2. **Follow the specific, actionable suggestions** - they tell you exactly what to add or modify
76
+ 3. **Add NEW user stories and test cases** as suggested by the verifier
77
+ 4. **Improve the quality and specificity** of your artifacts
78
+ 5. **Ensure each requirement is adequately covered** based on the feedback
79
+
80
+ **IMPORTANT Guidelines**:
81
+ - **Pay close attention to the 💡 Improvement Suggestions** - these are specific actions you should take
82
+ - You can **keep your existing user stories and test cases** that are good
83
+ - **Add NEW items** exactly as suggested to satisfy the unsatisfied requirements
84
+ - **Make your artifacts concrete and specific** - they will be verified again
85
+ - The suggestions are your roadmap - follow them to ensure verification passes
86
+ - Ensure your artifacts directly address the checklist requirements
87
+
88
+ **CRITICAL - Output Format**:
89
+ 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:
90
+
91
+ \`\`\`json
92
+ {
93
+ "analysis": {
94
+ "feature_id": "...",
95
+ "status": "success",
96
+ "summary": "Improved analysis based on verification feedback",
97
+ "created_user_stories": [
98
+ // Include ALL user stories (existing + new)
99
+ ],
100
+ "created_test_cases": [
101
+ // Include ALL test cases (existing + new)
102
+ ],
103
+ "recommendations": "..."
104
+ }
105
+ }
106
+ \`\`\`
107
+
108
+ IMPORTANT: Return ONLY the JSON above. Do not add any text explaining what you did or how you improved the analysis. The JSON should be the complete and only content of your response.`;
109
+ };
@@ -48,7 +48,7 @@ CRITICAL: You are NOT a software engineer. You should NEVER write code, build pr
48
48
  - Consider different user perspectives and scenarios
49
49
 
50
50
  **CRITICAL - Result Format**:
51
- You MUST end your response with a JSON object containing the analysis results in this EXACT format:
51
+ You MUST return ONLY a JSON object with your analysis results. Do NOT include any explanatory text before or after the JSON. Return ONLY the JSON in this EXACT format:
52
52
 
53
53
  \`\`\`json
54
54
  {
@@ -1,4 +1,5 @@
1
1
  import type { UserStory, TestCase } from '../types/features.js';
2
+ import { type DownloadedImage } from '../utils/image-downloader.js';
2
3
  import { TechnicalDesignContext } from '../phases/technical-design/context-fetcher.js';
3
4
  import { FeatureAnalysisContext } from '../phases/feature-analysis/context-fetcher.js';
4
5
  import { CodeImplementationContext } from '../phases/code-implementation/context-fetcher.js';
@@ -14,16 +15,28 @@ export declare function formatTestCases(cases: TestCase[]): string;
14
15
  /**
15
16
  * Format technical design context for Claude Code prompts
16
17
  */
17
- export declare function formatTechnicalDesignContext(context: TechnicalDesignContext): string;
18
+ export declare function formatTechnicalDesignContext(context: TechnicalDesignContext): Promise<{
19
+ content: string;
20
+ downloadedImages: DownloadedImage[];
21
+ }>;
18
22
  /**
19
23
  * Format feature analysis context for Claude Code prompts
20
24
  */
21
- export declare function formatFeatureAnalysisContext(context: FeatureAnalysisContext): string;
25
+ export declare function formatFeatureAnalysisContext(context: FeatureAnalysisContext): Promise<{
26
+ content: string;
27
+ downloadedImages: DownloadedImage[];
28
+ }>;
22
29
  /**
23
30
  * Format code implementation context for Claude Code prompts
24
31
  */
25
- export declare function formatCodeImplementationContext(context: CodeImplementationContext): string;
32
+ export declare function formatCodeImplementationContext(context: CodeImplementationContext): Promise<{
33
+ content: string;
34
+ downloadedImages: DownloadedImage[];
35
+ }>;
26
36
  /**
27
37
  * Format functional testing context for Claude Code prompts
28
38
  */
29
- export declare function formatFunctionalTestingContext(context: FunctionalTestingContext): string;
39
+ export declare function formatFunctionalTestingContext(context: FunctionalTestingContext): Promise<{
40
+ content: string;
41
+ downloadedImages: DownloadedImage[];
42
+ }>;
@@ -1,3 +1,4 @@
1
+ import { downloadImagesForClaudeCode, } from '../utils/image-downloader.js';
1
2
  /**
2
3
  * Format user stories for display in prompts
3
4
  */
@@ -23,13 +24,19 @@ export function formatTestCases(cases) {
23
24
  /**
24
25
  * Format technical design context for Claude Code prompts
25
26
  */
26
- export function formatTechnicalDesignContext(context) {
27
- return `# Technical Design Context
27
+ export async function formatTechnicalDesignContext(context) {
28
+ const { processedMarkdown, downloadedImages } = await downloadImagesForClaudeCode(context.feature.description || 'No description provided', context.feature.id // Use feature ID for directory naming
29
+ );
30
+ const content = `# Technical Design Context
28
31
 
29
32
  ## Feature Information
30
33
  - **ID**: ${context.feature.id}
31
34
  - **Name**: ${context.feature.name}
32
- - **Description**: ${context.feature.description || 'No description provided'}
35
+ - **Description**:
36
+ ${processedMarkdown}
37
+
38
+ ${downloadedImages.length > 0 ? '**IMPORTANT**: The description contains images that have been downloaded locally. Please use the Read tool to view these images to fully understand the requirements.' : ''}
39
+
33
40
  - **Current Status**: ${context.feature.status}
34
41
 
35
42
  ## Product Information
@@ -49,17 +56,24 @@ ${context.feature.technical_design || 'No existing technical design found'}
49
56
  ---
50
57
 
51
58
  **Design Instructions**: Based on the above feature requirements, user stories, and test cases, create or enhance the comprehensive technical design. Focus on system architecture, component design, database schema, API specifications, security considerations, and implementation strategy.`;
59
+ return { content, downloadedImages };
52
60
  }
53
61
  /**
54
62
  * Format feature analysis context for Claude Code prompts
55
63
  */
56
- export function formatFeatureAnalysisContext(context) {
57
- return `# Feature Analysis Context
64
+ export async function formatFeatureAnalysisContext(context) {
65
+ const { processedMarkdown, downloadedImages } = await downloadImagesForClaudeCode(context.feature.description || 'No description provided', context.feature.id // Use feature ID for directory naming
66
+ );
67
+ const content = `# Feature Analysis Context
58
68
 
59
69
  ## Feature Information
60
70
  - **ID**: ${context.feature.id}
61
71
  - **Name**: ${context.feature.name}
62
- - **Description**: ${context.feature.description || 'No description provided'}
72
+ - **Description**:
73
+ ${processedMarkdown}
74
+
75
+ ${downloadedImages.length > 0 ? '**IMPORTANT**: The description contains images that have been downloaded locally. Please use the Read tool to view these images to fully understand the requirements.' : ''}
76
+
63
77
  - **Current Status**: ${context.feature.status}
64
78
 
65
79
  ## Product Information
@@ -79,17 +93,24 @@ ${context.feature.technical_design || 'No technical design available yet'}
79
93
  ---
80
94
 
81
95
  **Analysis Instructions**: Based on the above feature information and existing user stories/test cases, conduct comprehensive business analysis to identify gaps and create additional user stories and test cases that add business value.`;
96
+ return { content, downloadedImages };
82
97
  }
83
98
  /**
84
99
  * Format code implementation context for Claude Code prompts
85
100
  */
86
- export function formatCodeImplementationContext(context) {
87
- return `# Code Implementation Context
101
+ export async function formatCodeImplementationContext(context) {
102
+ const { processedMarkdown, downloadedImages } = await downloadImagesForClaudeCode(context.feature.description || 'No description provided', context.feature.id // Use feature ID for directory naming
103
+ );
104
+ const content = `# Code Implementation Context
88
105
 
89
106
  ## Feature Information
90
107
  - **ID**: ${context.feature.id}
91
108
  - **Name**: ${context.feature.name}
92
- - **Description**: ${context.feature.description || 'No description provided'}
109
+ - **Description**:
110
+ ${processedMarkdown}
111
+
112
+ ${downloadedImages.length > 0 ? '**IMPORTANT**: The description contains images that have been downloaded locally. Please use the Read tool to view these images to fully understand the requirements.' : ''}
113
+
93
114
  - **Current Status**: ${context.feature.status}
94
115
 
95
116
  ## Product Information
@@ -109,17 +130,24 @@ ${context.technical_design || 'No technical design available - implement based o
109
130
  ---
110
131
 
111
132
  **Implementation Instructions**: Based on the above requirements, user stories, test cases, and technical design, implement the complete feature functionality. Ensure all user stories are implemented and all test cases can pass.`;
133
+ return { content, downloadedImages };
112
134
  }
113
135
  /**
114
136
  * Format functional testing context for Claude Code prompts
115
137
  */
116
- export function formatFunctionalTestingContext(context) {
117
- return `# Functional Testing Context
138
+ export async function formatFunctionalTestingContext(context) {
139
+ const { processedMarkdown, downloadedImages } = await downloadImagesForClaudeCode(context.feature.description || 'No description provided', context.feature.id // Use feature ID for directory naming
140
+ );
141
+ const content = `# Functional Testing Context
118
142
 
119
143
  ## Feature Information
120
144
  - **ID**: ${context.feature.id}
121
145
  - **Name**: ${context.feature.name}
122
- - **Description**: ${context.feature.description || 'No description provided'}
146
+ - **Description**:
147
+ ${processedMarkdown}
148
+
149
+ ${downloadedImages.length > 0 ? '**IMPORTANT**: The description contains images that have been downloaded locally. Please use the Read tool to view these images to fully understand the requirements.' : ''}
150
+
123
151
  - **Current Status**: ${context.feature.status}
124
152
 
125
153
  ## Product Information
@@ -136,4 +164,5 @@ ${formatTestCases(context.test_cases)}
136
164
  ---
137
165
 
138
166
  **Testing Instructions**: The feature has been implemented. Execute comprehensive functional testing using headless Playwright to verify all user stories work correctly and all test cases pass. Test both positive and negative scenarios.`;
167
+ return { content, downloadedImages };
139
168
  }
@@ -0,0 +1,5 @@
1
+ import { ChecklistVerificationResult } from '../phases/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;
@@ -0,0 +1,93 @@
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
+ };
@@ -0,0 +1,11 @@
1
+ import { EdsgerConfig } from '../types/index.js';
2
+ import { ChecklistPhaseContext } from '../services/checklist.js';
3
+ export declare const createTechnicalDesignVerificationSystemPrompt: (_config: EdsgerConfig) => string;
4
+ export interface TechnicalDesignVerificationPromptOptions {
5
+ checklistContext: ChecklistPhaseContext;
6
+ featureId: string;
7
+ featureName: string;
8
+ featureDescription?: string;
9
+ technicalDesign: string;
10
+ }
11
+ export declare const createTechnicalDesignVerificationPrompt: (options: TechnicalDesignVerificationPromptOptions) => string;
@@ -0,0 +1,134 @@
1
+ export const createTechnicalDesignVerificationSystemPrompt = (_config) => {
2
+ return `You are an independent quality assurance auditor specializing in technical design review. Your role is to critically evaluate whether a technical design document satisfies checklist requirements.
3
+
4
+ **Your Mission**: Verify Technical Design Against Requirements
5
+ - Review the checklist requirements
6
+ - Examine the technical design document
7
+ - Determine if the design adequately addresses 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 Design**: Look at the technical design document content
14
+ 3. **Match Requirements to Design**: Determine if the design addresses the requirement
15
+ 4. **Assess Quality**: Ask yourself:
16
+ - Does the design directly address this requirement?
17
+ - Is the coverage specific and concrete, or vague and generic?
18
+ - Is there sufficient depth and technical detail?
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 design clearly and adequately satisfies the requirement
24
+ - ❌ **REJECTED**: The requirement is not addressed, or addressed insufficiently
25
+ - ⚠️ **UNCERTAIN**: The design partially addresses the requirement but with gaps or ambiguity
26
+
27
+ **Your Mindset**:
28
+ - Be thorough and systematic
29
+ - Focus on what the design actually contains, 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 design (if there are failures)"]
57
+ }
58
+ }
59
+ \`\`\`
60
+
61
+ **For rejected/uncertain items**: Provide specific, actionable improvement_suggestions such as:
62
+ - "Add architectural diagram showing component interactions"
63
+ - "Include detailed API specifications for X endpoint"
64
+ - "Expand security considerations to cover Y attack vector"
65
+ - "Add database schema design for Z table"
66
+
67
+ Be thorough, be critical, be fair. Your verification protects quality.`;
68
+ };
69
+ export const createTechnicalDesignVerificationPrompt = (options) => {
70
+ const { checklistContext, featureId, featureName, featureDescription, technicalDesign, } = options;
71
+ // Format all checklist items with their requirements
72
+ const checklistItemsSection = checklistContext.checklists
73
+ .flatMap((checklist) => checklist.items.map((item) => {
74
+ return `### Checklist Item: ${item.title}
75
+ **ID**: ${item.id}
76
+ **Checklist**: ${checklist.name} (${checklist.role})
77
+ **Requirement**: ${item.description}
78
+ **Required**: ${item.is_required ? 'Yes' : 'No'}
79
+ **Type**: ${item.item_type}
80
+ `;
81
+ }))
82
+ .join('\n---\n');
83
+ const totalChecklistItems = checklistContext.checklists.reduce((sum, checklist) => sum + checklist.items.length, 0);
84
+ return `# Technical Design Verification Task
85
+
86
+ You are verifying that a technical design document satisfies checklist requirements.
87
+
88
+ ## Feature Context
89
+
90
+ **Feature**: ${featureName}
91
+ **Feature ID**: ${featureId}
92
+ **Description**: ${featureDescription || 'No description'}
93
+
94
+ ## Technical Design Document
95
+
96
+ ${technicalDesign}
97
+
98
+ ## Checklist Requirements to Verify (${totalChecklistItems})
99
+
100
+ ${checklistItemsSection}
101
+
102
+ ---
103
+
104
+ ## Your Verification Task
105
+
106
+ For EACH checklist item above:
107
+
108
+ 1. **Understand the Requirement**: What does this checklist item require?
109
+
110
+ 2. **Examine the Design**: Look at the technical design document above
111
+
112
+ 3. **Determine Coverage**: Does the design adequately address this requirement?
113
+ - Does it directly address the requirement?
114
+ - Is the coverage concrete and specific?
115
+ - Is there sufficient technical depth and detail?
116
+ - Are there any gaps or missing elements?
117
+
118
+ 4. **Make Your Determination**:
119
+ - **CONFIRMED** (is_satisfied: true): The design clearly and adequately satisfies this requirement
120
+ - **REJECTED** (is_satisfied: false): The requirement is not addressed, or addressed insufficiently
121
+ - **UNCERTAIN** (is_satisfied: false): The design partially addresses the requirement but with gaps
122
+
123
+ 5. **Document Your Reasoning**: Provide specific, detailed reasons for your decision
124
+
125
+ 6. **Provide Improvement Suggestions** (for rejected/uncertain items):
126
+ - Be specific and actionable
127
+ - Suggest what sections or details should be added to the design
128
+ - Indicate what should be expanded or modified
129
+ - Give concrete examples when possible
130
+
131
+ Remember: Focus on what the design actually contains, not on claims. Be thorough and fair.
132
+
133
+ Provide your verification results in the required JSON format with improvement_suggestions for any rejected or uncertain items.`;
134
+ };
@@ -52,7 +52,7 @@ CRITICAL: You are NOT a software engineer who writes code. You are a technical a
52
52
  - Include clear implementation guidance
53
53
 
54
54
  **CRITICAL - Result Format**:
55
- You MUST end your response with a JSON object containing the technical design results in this EXACT format:
55
+ You MUST return ONLY a JSON object with your technical design results. Do NOT include any explanatory text before or after the JSON. Return ONLY the JSON in this EXACT format:
56
56
 
57
57
  \`\`\`json
58
58
  {
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Feature Audit Logs Service
3
+ * Provides functions to log feature lifecycle events to the database
4
+ */
5
+ export interface LogPhaseEventParams {
6
+ featureId: string;
7
+ eventType: 'phase_started' | 'phase_completed' | 'phase_failed';
8
+ phase: 'feature_analysis' | 'technical_design' | 'code_implementation' | 'functional_testing';
9
+ result?: 'success' | 'error' | 'warning' | 'info';
10
+ metadata?: Record<string, any>;
11
+ errorMessage?: string;
12
+ }
13
+ export interface LogChecklistEventParams {
14
+ featureId: string;
15
+ eventType: 'checklist_validated' | 'checklist_verified';
16
+ checklistId: string;
17
+ result?: 'success' | 'error' | 'warning' | 'info';
18
+ metadata?: Record<string, any>;
19
+ }
20
+ export interface LogVerificationEventParams {
21
+ featureId: string;
22
+ phase: 'feature_analysis' | 'technical_design' | 'code_implementation' | 'functional_testing';
23
+ iteration: number;
24
+ result: 'success' | 'error';
25
+ verificationData: {
26
+ confirmed_count: number;
27
+ rejected_count: number;
28
+ uncertain_count: number;
29
+ rejected_items?: Array<{
30
+ checklist_item_id: string;
31
+ reason: string;
32
+ concerns?: string[];
33
+ improvement_suggestions?: string[];
34
+ }>;
35
+ uncertain_items?: Array<{
36
+ checklist_item_id: string;
37
+ reason: string;
38
+ concerns?: string[];
39
+ improvement_suggestions?: string[];
40
+ }>;
41
+ summary?: string;
42
+ overall_suggestions?: string[];
43
+ };
44
+ }
45
+ /**
46
+ * Log a phase event (start, completion, or failure)
47
+ */
48
+ export declare function logFeaturePhaseEvent(mcpServerUrl: string, mcpToken: string, params: LogPhaseEventParams, verbose?: boolean): Promise<string | null>;
49
+ /**
50
+ * Log a checklist validation event
51
+ */
52
+ export declare function logFeatureChecklistEvent(mcpServerUrl: string, mcpToken: string, params: LogChecklistEventParams, verbose?: boolean): Promise<string | null>;
53
+ /**
54
+ * Log a verification event (dual-agent verification result)
55
+ */
56
+ export declare function logFeatureVerificationEvent(mcpServerUrl: string, mcpToken: string, params: LogVerificationEventParams, verbose?: boolean): Promise<string | null>;
57
+ /**
58
+ * Get feature timeline (all audit logs)
59
+ */
60
+ export declare function getFeatureTimeline(mcpServerUrl: string, mcpToken: string, featureId: string, verbose?: boolean): Promise<any[]>;