edsger 0.21.11 → 0.22.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.
@@ -14,7 +14,7 @@ import { getGitHubConfig } from '../../../api/github.js';
14
14
  /**
15
15
  * Wrapper for code-refine phase to inject GitHub token
16
16
  */
17
- const executeCodeRefine = async (options, config) => {
17
+ const executeCodeRefine = async (options, config, checklistContext) => {
18
18
  const githubConfig = await getGitHubConfig(options.featureId, options.verbose);
19
19
  if (!githubConfig.configured || !githubConfig.token) {
20
20
  return {
@@ -27,7 +27,7 @@ const executeCodeRefine = async (options, config) => {
27
27
  featureId: options.featureId,
28
28
  githubToken: githubConfig.token,
29
29
  verbose: options.verbose,
30
- }, config);
30
+ }, config, checklistContext);
31
31
  };
32
32
  /**
33
33
  * Wrapper for code-refine-verification phase to inject GitHub token
@@ -51,7 +51,7 @@ const executeCodeRefineVerification = async (options, config) => {
51
51
  /**
52
52
  * Wrapper for code-review phase to inject GitHub token
53
53
  */
54
- const executeCodeReview = async (options, config) => {
54
+ const executeCodeReview = async (options, config, checklistContext) => {
55
55
  const githubConfig = await getGitHubConfig(options.featureId, options.verbose);
56
56
  if (!githubConfig.configured || !githubConfig.token) {
57
57
  return {
@@ -64,7 +64,7 @@ const executeCodeReview = async (options, config) => {
64
64
  featureId: options.featureId,
65
65
  githubToken: githubConfig.token,
66
66
  verbose: options.verbose,
67
- }, config);
67
+ }, config, checklistContext);
68
68
  };
69
69
  // Pipeline phase configurations
70
70
  export const phaseConfigs = [
@@ -4,12 +4,14 @@
4
4
  * Includes built-in verification loop that resolves PR comments and dismisses reviews
5
5
  */
6
6
  import { EdsgerConfig } from '../../types/index.js';
7
+ import { ChecklistPhaseContext } from '../../services/checklist.js';
7
8
  import { type CodeRefineVerificationResult } from '../code-refine-verification/index.js';
8
9
  export declare const MAX_REFINE_ITERATIONS = 10;
9
10
  export interface CodeRefineOptions {
10
11
  featureId: string;
11
12
  githubToken: string;
12
13
  verbose?: boolean;
14
+ checklistContext?: ChecklistPhaseContext | null;
13
15
  verificationFailureContext?: {
14
16
  attempt: number;
15
17
  suggestions: string[];
@@ -39,10 +41,19 @@ export interface CodeRefineResult {
39
41
  commitsCreated?: number;
40
42
  iterations?: number;
41
43
  verificationResult?: CodeRefineVerificationResult;
44
+ data?: {
45
+ checklist_item_results?: Array<{
46
+ checklist_item_id: string;
47
+ is_passed: boolean;
48
+ value?: any;
49
+ notes?: string;
50
+ }>;
51
+ [key: string]: any;
52
+ };
42
53
  }
43
54
  /**
44
55
  * Main code refine function with built-in verification loop
45
56
  * Similar to technical-design, this includes an iterative improvement cycle:
46
57
  * refine → verification → improve → re-refine (if needed)
47
58
  */
48
- export declare const refineCodeFromPRFeedback: (options: CodeRefineOptions, config: EdsgerConfig) => Promise<CodeRefineResult>;
59
+ export declare const refineCodeFromPRFeedback: (options: CodeRefineOptions, config: EdsgerConfig, checklistContext?: ChecklistPhaseContext | null) => Promise<CodeRefineResult>;
@@ -66,7 +66,7 @@ const pushChanges = (verbose) => {
66
66
  * Similar to technical-design, this includes an iterative improvement cycle:
67
67
  * refine → verification → improve → re-refine (if needed)
68
68
  */
69
- export const refineCodeFromPRFeedback = async (options, config) => {
69
+ export const refineCodeFromPRFeedback = async (options, config, checklistContext) => {
70
70
  const { featureId, githubToken, verbose } = options;
71
71
  if (verbose) {
72
72
  logInfo(`Starting code refine for feature ID: ${featureId}`);
@@ -226,7 +226,7 @@ export const refineCodeFromPRFeedback = async (options, config) => {
226
226
  }
227
227
  }
228
228
  // Execute refine for this iteration
229
- const refineResult = await executeRefineIteration(featureId, githubToken, config, pullRequestUrl || undefined, currentBranch, verificationFailureContext, verbose);
229
+ const refineResult = await executeRefineIteration(featureId, githubToken, config, pullRequestUrl || undefined, currentBranch, verificationFailureContext, checklistContext, verbose);
230
230
  if (refineResult.status === 'error') {
231
231
  // Refine failed - return error
232
232
  return {
@@ -302,6 +302,9 @@ Please ensure Claude Code commits all changes before completing the refine phase
302
302
  commitsCreated: lastRefineResult.commits_created || 1,
303
303
  iterations: currentIteration,
304
304
  verificationResult,
305
+ data: {
306
+ checklist_item_results: lastRefineResult.checklist_item_results,
307
+ },
305
308
  };
306
309
  }
307
310
  // Verification failed - prepare context for retry
@@ -364,7 +367,7 @@ Please ensure Claude Code commits all changes before completing the refine phase
364
367
  /**
365
368
  * Execute a single refine iteration
366
369
  */
367
- async function executeRefineIteration(featureId, githubToken, config, pullRequestUrl, currentBranch, verificationFailureContext, verbose) {
370
+ async function executeRefineIteration(featureId, githubToken, config, pullRequestUrl, currentBranch, verificationFailureContext, checklistContext, verbose) {
368
371
  // Fetch code refine context (PR reviews and comments)
369
372
  const context = await fetchCodeRefineContext(featureId, githubToken, verbose, pullRequestUrl);
370
373
  // Fetch additional feedbacks for code-refine phase
@@ -384,8 +387,8 @@ async function executeRefineIteration(featureId, githubToken, config, pullReques
384
387
  }
385
388
  }
386
389
  // Create prompt for code refine
387
- const systemPrompt = createSystemPrompt();
388
- const refinePrompt = createCodeRefinePrompt(featureId, context, feedbacksInfo, verificationFailureContext);
390
+ const systemPrompt = createSystemPrompt(checklistContext);
391
+ const refinePrompt = createCodeRefinePrompt(featureId, context, feedbacksInfo, verificationFailureContext, checklistContext);
389
392
  let lastAssistantResponse = '';
390
393
  let structuredRefineResult = null;
391
394
  if (verbose) {
@@ -482,6 +485,7 @@ async function executeRefineIteration(featureId, githubToken, config, pullReques
482
485
  summary: structuredRefineResult.summary,
483
486
  files_modified: structuredRefineResult.files_modified,
484
487
  commits_created: structuredRefineResult.commits_created,
488
+ checklist_item_results: structuredRefineResult.checklist_item_results,
485
489
  };
486
490
  }
487
491
  else {
@@ -1,4 +1,5 @@
1
1
  import { type CodeRefineContext } from './context.js';
2
2
  import { CodeRefineOptions } from './index.js';
3
- export declare function createSystemPrompt(): string;
4
- export declare function createCodeRefinePrompt(featureId: string, context: CodeRefineContext, feedbacksInfo?: string, verificationFailureContext?: CodeRefineOptions['verificationFailureContext']): string;
3
+ import { ChecklistPhaseContext } from '../../services/checklist.js';
4
+ export declare function createSystemPrompt(checklistContext?: ChecklistPhaseContext | null): string;
5
+ export declare function createCodeRefinePrompt(featureId: string, context: CodeRefineContext, feedbacksInfo?: string, verificationFailureContext?: CodeRefineOptions['verificationFailureContext'], checklistContext?: ChecklistPhaseContext | null): string;
@@ -1,5 +1,35 @@
1
1
  import { formatContextForPrompt } from './context.js';
2
- export function createSystemPrompt() {
2
+ import { formatChecklistsForContext, } from '../../services/checklist.js';
3
+ export function createSystemPrompt(checklistContext) {
4
+ const checklistInstructions = checklistContext &&
5
+ checklistContext.checklists &&
6
+ checklistContext.checklists.length > 0
7
+ ? `
8
+
9
+ **MANDATORY Checklist Compliance**:
10
+ If you are provided with checklists in the context, you MUST satisfy ALL of them during your code refinement work. Checklists are mandatory requirements that define quality standards and cannot be ignored or skipped.
11
+
12
+ - Review each checklist carefully and ensure your refinements address every requirement
13
+ - You MUST include ALL provided checklist item IDs in the "checklist_item_results" field of your JSON response
14
+ - CRITICAL: Use the exact UUID from the "ID:" field in each checklist ITEM, NOT the item title or description
15
+ - Set "is_passed": true for each checklist item you have completed successfully
16
+ - Provide appropriate "value" based on the item type (boolean: true/false, text: descriptive text, number: numeric value)
17
+ - If you cannot satisfy a checklist item requirement, set "is_passed": false and explain why in the "notes" field
18
+ - The system will validate that all checklists have been addressed - missing checklists will cause the pipeline to fail`
19
+ : '';
20
+ const checklistJsonField = checklistContext &&
21
+ checklistContext.checklists &&
22
+ checklistContext.checklists.length > 0
23
+ ? `,
24
+ "checklist_item_results": [
25
+ {
26
+ "checklist_item_id": "EXACT_CHECKLIST_ITEM_UUID_FROM_ID_FIELD",
27
+ "is_passed": true,
28
+ "value": "Result value based on item type (boolean, text, number, etc.)",
29
+ "notes": "Optional notes about this specific checklist item"
30
+ }
31
+ ]`
32
+ : '';
3
33
  return `You are an expert software engineer specializing in addressing code review feedback. Your goal is to carefully analyze review comments and refine the code to address all concerns raised by human reviewers.
4
34
 
5
35
  **Your Role**: Refine code based on PR review feedback while maintaining code quality and functionality.
@@ -35,6 +65,7 @@ export function createSystemPrompt() {
35
65
  - DO NOT leave any uncommitted changes in the working directory
36
66
  - Verification will fail if there are uncommitted changes
37
67
  - Use clear, descriptive commit messages that explain what feedback was addressed
68
+ ${checklistInstructions}
38
69
 
39
70
  **CRITICAL - Result Format**:
40
71
  You MUST end your response with a JSON object containing the code refine results in this EXACT format:
@@ -53,18 +84,22 @@ You MUST end your response with a JSON object containing the code refine results
53
84
  "resolution": "Description of how it was addressed",
54
85
  "files": ["path/to/file.ts"]
55
86
  }
56
- ]
87
+ ]${checklistJsonField}
57
88
  }
58
89
  }
59
90
  \`\`\`
60
91
 
61
92
  Focus on systematic code refinement based on the provided PR review feedback.`;
62
93
  }
63
- export function createCodeRefinePrompt(featureId, context, feedbacksInfo, verificationFailureContext) {
94
+ export function createCodeRefinePrompt(featureId, context, feedbacksInfo, verificationFailureContext, checklistContext) {
64
95
  let contextInfo = formatContextForPrompt(context);
65
96
  if (feedbacksInfo) {
66
97
  contextInfo = contextInfo + '\n\n' + feedbacksInfo;
67
98
  }
99
+ if (checklistContext && checklistContext.checklists.length > 0) {
100
+ const checklistInfo = formatChecklistsForContext(checklistContext);
101
+ contextInfo = contextInfo + '\n\n' + checklistInfo;
102
+ }
68
103
  // Add verification failure context if this is a retry
69
104
  let verificationSection = '';
70
105
  if (verificationFailureContext) {
@@ -183,7 +218,17 @@ BEFORE you generate the final JSON result, you MUST complete this checklist:
183
218
  - All review feedback has been addressed
184
219
 
185
220
  **FAILURE TO COMMIT ALL CHANGES WILL CAUSE THE PIPELINE TO FAIL**
186
-
221
+ ${checklistContext && checklistContext.checklists.length > 0
222
+ ? `
223
+ ## MANDATORY - Checklist Compliance
224
+ You MUST satisfy ALL checklist items provided in the context and include results in your JSON response.
225
+ - Use the exact UUID from each checklist item's "ID:" field as the "checklist_item_id"
226
+ - Ensure your code refinements satisfy each checklist requirement
227
+ - Set "is_passed" to true if the requirement is met, false otherwise
228
+ - Provide detailed "notes" for any items that are not passed
229
+ - ALL checklist items must be included - missing items will cause pipeline failure
230
+ `
231
+ : ''}
187
232
  You are currently on the \`dev/${featureId}\` branch. Make your changes, commit them, and they will be pushed to the remote repository.
188
233
 
189
234
  Begin by analyzing all the review feedback and creating a plan to address each comment.`;
@@ -3,10 +3,12 @@
3
3
  * Reviews GitHub PR code and creates review comments with REQUEST_CHANGES
4
4
  */
5
5
  import { EdsgerConfig } from '../../types/index.js';
6
+ import { ChecklistPhaseContext } from '../../services/checklist.js';
6
7
  export interface CodeReviewOptions {
7
8
  featureId: string;
8
9
  githubToken: string;
9
10
  verbose?: boolean;
11
+ checklistContext?: ChecklistPhaseContext | null;
10
12
  }
11
13
  export interface ReviewComment {
12
14
  path: string;
@@ -22,8 +24,17 @@ export interface CodeReviewResult {
22
24
  reviewUrl?: string;
23
25
  commentsCount?: number;
24
26
  summary?: string;
27
+ data?: {
28
+ checklist_item_results?: Array<{
29
+ checklist_item_id: string;
30
+ is_passed: boolean;
31
+ value?: any;
32
+ notes?: string;
33
+ }>;
34
+ [key: string]: any;
35
+ };
25
36
  }
26
37
  /**
27
38
  * Main code review function
28
39
  */
29
- export declare const reviewPullRequest: (options: CodeReviewOptions, config: EdsgerConfig) => Promise<CodeReviewResult>;
40
+ export declare const reviewPullRequest: (options: CodeReviewOptions, config: EdsgerConfig, checklistContext?: ChecklistPhaseContext | null) => Promise<CodeReviewResult>;
@@ -8,6 +8,7 @@ import { logInfo, logError } from '../../utils/logger.js';
8
8
  import { Octokit } from '@octokit/rest';
9
9
  import { fetchCodeReviewContext, formatContextForPrompt, } from './context.js';
10
10
  import { getFeedbacksForPhase, formatFeedbacksForContext, } from '../../services/feedbacks.js';
11
+ import { formatChecklistsForContext, } from '../../services/checklist.js';
11
12
  import { preparePhaseGitEnvironmentAsync, prepareCustomBranchGitEnvironmentAsync, syncFeatBranchWithMain, } from '../../utils/git-branch-manager.js';
12
13
  import { getBranches, getBaseBranchInfo, updateBranch, } from '../../services/branches.js';
13
14
  import { getGitHubConfig } from '../../api/github.js';
@@ -118,7 +119,7 @@ function findClosestPosition(targetLine, lineToPosition) {
118
119
  /**
119
120
  * Main code review function
120
121
  */
121
- export const reviewPullRequest = async (options, config) => {
122
+ export const reviewPullRequest = async (options, config, checklistContext) => {
122
123
  const { featureId, githubToken, verbose } = options;
123
124
  if (verbose) {
124
125
  logInfo(`Starting code review for feature ID: ${featureId}`);
@@ -280,8 +281,8 @@ export const reviewPullRequest = async (options, config) => {
280
281
  }
281
282
  }
282
283
  // Create prompt for code review
283
- const systemPrompt = createSystemPrompt(config);
284
- const reviewPrompt = createCodeReviewPrompt(featureId, context, feedbacksInfo);
284
+ const systemPrompt = createSystemPrompt(config, checklistContext);
285
+ const reviewPrompt = createCodeReviewPrompt(featureId, context, feedbacksInfo, checklistContext);
285
286
  let lastAssistantResponse = '';
286
287
  let structuredReviewResult = null;
287
288
  if (verbose) {
@@ -370,7 +371,7 @@ export const reviewPullRequest = async (options, config) => {
370
371
  }
371
372
  // Create GitHub review with comments
372
373
  if (structuredReviewResult) {
373
- const { summary, comments, overall_assessment } = structuredReviewResult;
374
+ const { summary, comments, overall_assessment, checklist_item_results } = structuredReviewResult;
374
375
  // Initialize Octokit
375
376
  const octokit = new Octokit({ auth: githubToken });
376
377
  if (!comments || comments.length === 0) {
@@ -405,6 +406,7 @@ export const reviewPullRequest = async (options, config) => {
405
406
  reviewUrl: review.data.html_url,
406
407
  commentsCount: 0,
407
408
  summary: summary || 'No issues found',
409
+ data: { checklist_item_results },
408
410
  };
409
411
  }
410
412
  if (verbose) {
@@ -482,6 +484,7 @@ export const reviewPullRequest = async (options, config) => {
482
484
  reviewUrl: review.data.html_url,
483
485
  commentsCount: 0,
484
486
  summary: summary || 'Code review completed (comments filtered)',
487
+ data: { checklist_item_results },
485
488
  };
486
489
  }
487
490
  if (verbose) {
@@ -518,6 +521,7 @@ export const reviewPullRequest = async (options, config) => {
518
521
  reviewUrl: review.data.html_url,
519
522
  commentsCount: comments.length,
520
523
  summary: summary || 'Code review completed',
524
+ data: { checklist_item_results },
521
525
  };
522
526
  }
523
527
  else {
@@ -542,7 +546,36 @@ export const reviewPullRequest = async (options, config) => {
542
546
  cleanupGit();
543
547
  }
544
548
  };
545
- function createSystemPrompt(_config) {
549
+ function createSystemPrompt(_config, checklistContext) {
550
+ const checklistInstructions = checklistContext &&
551
+ checklistContext.checklists &&
552
+ checklistContext.checklists.length > 0
553
+ ? `
554
+
555
+ **MANDATORY Checklist Compliance**:
556
+ If you are provided with checklists in the context, you MUST evaluate ALL of them during your code review. Checklists are mandatory requirements that define quality standards and cannot be ignored or skipped.
557
+
558
+ - Review each checklist carefully and evaluate whether the code satisfies every requirement
559
+ - You MUST include ALL provided checklist item IDs in the "checklist_item_results" field of your JSON response
560
+ - CRITICAL: Use the exact UUID from the "ID:" field in each checklist ITEM, NOT the item title or description
561
+ - Set "is_passed": true for each checklist item the code satisfies
562
+ - Provide appropriate "value" based on the item type (boolean: true/false, text: descriptive text, number: numeric value)
563
+ - If the code does not satisfy a checklist item requirement, set "is_passed": false and explain why in the "notes" field
564
+ - The system will validate that all checklists have been addressed - missing checklists will cause the pipeline to fail`
565
+ : '';
566
+ const checklistJsonField = checklistContext &&
567
+ checklistContext.checklists &&
568
+ checklistContext.checklists.length > 0
569
+ ? `,
570
+ "checklist_item_results": [
571
+ {
572
+ "checklist_item_id": "EXACT_CHECKLIST_ITEM_UUID_FROM_ID_FIELD",
573
+ "is_passed": true,
574
+ "value": "Result value based on item type (boolean, text, number, etc.)",
575
+ "notes": "Optional notes about this specific checklist item"
576
+ }
577
+ ]`
578
+ : '';
546
579
  return `You are an expert code reviewer specializing in thorough, constructive code reviews. Your goal is to analyze pull request code and identify issues, potential bugs, code quality concerns, and areas for improvement.
547
580
 
548
581
  **Your Role**: Review pull request code and provide detailed, actionable feedback.
@@ -565,6 +598,7 @@ function createSystemPrompt(_config) {
565
598
  - Be respectful and professional
566
599
  - Focus on issues that truly matter, not nitpicks
567
600
  - If code looks good overall, provide positive feedback
601
+ ${checklistInstructions}
568
602
 
569
603
  **CRITICAL - Result Format**:
570
604
  You MUST end your response with a JSON object containing the review results in this EXACT format:
@@ -586,7 +620,7 @@ You MUST end your response with a JSON object containing the review results in t
586
620
  "critical": 0,
587
621
  "major": 0,
588
622
  "minor": 0
589
- }
623
+ }${checklistJsonField}
590
624
  }
591
625
  }
592
626
  \`\`\`
@@ -604,11 +638,15 @@ You MUST end your response with a JSON object containing the review results in t
604
638
 
605
639
  Focus on providing valuable, actionable code review feedback.`;
606
640
  }
607
- function createCodeReviewPrompt(featureId, context, feedbacksInfo) {
641
+ function createCodeReviewPrompt(featureId, context, feedbacksInfo, checklistContext) {
608
642
  let contextInfo = formatContextForPrompt(context);
609
643
  if (feedbacksInfo) {
610
644
  contextInfo = contextInfo + '\n\n' + feedbacksInfo;
611
645
  }
646
+ if (checklistContext && checklistContext.checklists.length > 0) {
647
+ const checklistInfo = formatChecklistsForContext(checklistContext);
648
+ contextInfo = contextInfo + '\n\n' + checklistInfo;
649
+ }
612
650
  return `Review the pull request code for feature: ${featureId}
613
651
 
614
652
  ${contextInfo}
@@ -656,7 +694,17 @@ Follow this systematic approach:
656
694
  - Consider the context and requirements
657
695
  - Be professional and constructive
658
696
  - If code is good, say so!
659
-
697
+ ${checklistContext && checklistContext.checklists.length > 0
698
+ ? `
699
+ ## MANDATORY - Checklist Compliance
700
+ You MUST evaluate ALL checklist items provided in the context and include results in your JSON response.
701
+ - Use the exact UUID from each checklist item's "ID:" field as the "checklist_item_id"
702
+ - Evaluate whether the code satisfies each checklist requirement
703
+ - Set "is_passed" to true if the requirement is met, false otherwise
704
+ - Provide detailed "notes" for any items that are not passed
705
+ - ALL checklist items must be included - missing items will cause pipeline failure
706
+ `
707
+ : ''}
660
708
  Begin by analyzing the changed files and identifying any issues or improvements.`;
661
709
  }
662
710
  function parseCodeReviewResponse(response) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edsger",
3
- "version": "0.21.11",
3
+ "version": "0.22.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "edsger": "dist/index.js"