@qelos/aidev 0.5.2 → 0.5.3

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.
@@ -352,111 +352,111 @@ function printGhSuggestion(remote) {
352
352
  console.log(` PRs will be created automatically after pushing branches.`);
353
353
  console.log();
354
354
  }
355
- const HOOKS_BOILERPLATE = `// aidev hooks — customize the AI task automation pipeline
356
- //
357
- // Each export below is an async (context, vm) hook. Return a new/updated context object to
358
- // change prompts, subtasks, etc.; return nothing to keep the incoming context. Throw to abort
359
- // the current step (whole run, single task, conflict resolution, etc., depending on the hook).
360
- //
361
- // vm: run AI (first available agent), postComment, updateStatus, getComments, log.info/warn/error
362
- //
363
- // .ts files are loaded via jiti — no TypeScript compiler or toolchain needed.
364
-
365
- // ─── Context types (mirror aidev's internal shapes — tweak here for editor hints) ─
366
-
367
- interface RunContext {
368
- config: Record<string, unknown>;
369
- filter: string;
370
- taskCount: number;
371
- }
372
-
373
- interface TaskContext {
374
- task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
375
- config: Record<string, unknown>;
376
- branchName: string;
377
- prompt: string;
378
- }
379
-
380
- interface ResolveConflictsContext {
381
- task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
382
- config: Record<string, unknown>;
383
- branchName: string;
384
- conflictFiles: string[];
385
- prompt: string;
386
- }
387
-
388
- interface NonCodeTaskContext {
389
- task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
390
- config: Record<string, unknown>;
391
- prompt: string;
392
- }
393
-
394
- interface ThinkingTaskContext {
395
- task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
396
- config: Record<string, unknown>;
397
- branchName: string;
398
- subtasks: Array<{ id: number; title: string; description: string; status: string }>;
399
- }
400
-
401
- interface HookVM {
402
- runAI(prompt: string): Promise<{ success: boolean; output: string; error: string }>;
403
- postComment(taskId: string, text: string): Promise<void>;
404
- updateStatus(taskId: string, status: string): Promise<void>;
405
- getComments(taskId: string): Promise<Array<{ id: string; text: string; author: string }>>;
406
- log: { info(msg: string): void; warn(msg: string): void; error(msg: string): void };
407
- }
408
-
409
- // ─── Hooks (fill in — ask an AI: "implement beforeEachTask to append X to the prompt") ─
410
-
411
- /** Once before any task. AI idea: log counts, or throw if CI env var is missing. */
412
- export async function beforeRun(_context: RunContext, _vm: HookVM): Promise<RunContext | void> {
413
- return;
414
- }
415
-
416
- /** After all tasks in this run. AI idea: post a summary comment or call an external webhook. */
417
- export async function afterRun(_context: RunContext & { processed: number; skipped: number }, _vm: HookVM): Promise<void> {
418
- return;
419
- }
420
-
421
- /** Before each code task AI run. AI idea: append coding standards or repo-specific rules to context.prompt. */
422
- export async function beforeEachTask(_context: TaskContext, _vm: HookVM): Promise<TaskContext | void> {
423
- return;
424
- }
425
-
426
- /** After a code task completes the success path (push + review). */
427
- export async function afterEachTask(_context: TaskContext & { success: boolean }, _vm: HookVM): Promise<void> {
428
- return;
429
- }
430
-
431
- /** Before AI-driven merge conflict resolution. AI idea: tighten context.prompt for your stack. */
432
- export async function beforeResolveConflicts(_context: ResolveConflictsContext, _vm: HookVM): Promise<ResolveConflictsContext | void> {
433
- return;
434
- }
435
-
436
- /** After conflict resolution; context.resolved is false when all runners failed. */
437
- export async function afterResolveConflicts(_context: ResolveConflictsContext & { resolved: boolean }, _vm: HookVM): Promise<void> {
438
- return;
439
- }
440
-
441
- /** Before non-code task AI run. AI idea: format context.prompt for ticket-style replies. */
442
- export async function beforeNonCodeTask(_context: NonCodeTaskContext, _vm: HookVM): Promise<NonCodeTaskContext | void> {
443
- return;
444
- }
445
-
446
- /** After non-code task; context.output is the agent response text posted to the ticket. */
447
- export async function afterNonCodeTask(_context: NonCodeTaskContext & { success: boolean; output: string }, _vm: HookVM): Promise<void> {
448
- return;
449
- }
450
-
451
- /** After the plan exists, before subtasks run. AI idea: rewrite subtask descriptions for clarity. */
452
- export async function beforeThinkingTask(_context: ThinkingTaskContext, _vm: HookVM): Promise<ThinkingTaskContext | void> {
453
- return;
454
- }
455
-
456
- /** After all thinking-task subtasks complete. AI idea: notify or archive artifacts. */
457
- export async function afterThinkingTask(_context: ThinkingTaskContext & { success: boolean }, _vm: HookVM): Promise<void> {
458
- return;
459
- }
355
+ const HOOKS_BOILERPLATE = `// aidev hooks — customize the AI task automation pipeline
356
+ //
357
+ // Each export below is an async (context, vm) hook. Return a new/updated context object to
358
+ // change prompts, subtasks, etc.; return nothing to keep the incoming context. Throw to abort
359
+ // the current step (whole run, single task, conflict resolution, etc., depending on the hook).
360
+ //
361
+ // vm: run AI (first available agent), postComment, updateStatus, getComments, log.info/warn/error
362
+ //
363
+ // .ts files are loaded via jiti — no TypeScript compiler or toolchain needed.
364
+
365
+ // ─── Context types (mirror aidev's internal shapes — tweak here for editor hints) ─
366
+
367
+ interface RunContext {
368
+ config: Record<string, unknown>;
369
+ filter: string;
370
+ taskCount: number;
371
+ }
372
+
373
+ interface TaskContext {
374
+ task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
375
+ config: Record<string, unknown>;
376
+ branchName: string;
377
+ prompt: string;
378
+ }
379
+
380
+ interface ResolveConflictsContext {
381
+ task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
382
+ config: Record<string, unknown>;
383
+ branchName: string;
384
+ conflictFiles: string[];
385
+ prompt: string;
386
+ }
387
+
388
+ interface NonCodeTaskContext {
389
+ task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
390
+ config: Record<string, unknown>;
391
+ prompt: string;
392
+ }
393
+
394
+ interface ThinkingTaskContext {
395
+ task: { id: string; name: string; description: string; status: string; url: string; tags: string[] };
396
+ config: Record<string, unknown>;
397
+ branchName: string;
398
+ subtasks: Array<{ id: number; title: string; description: string; status: string }>;
399
+ }
400
+
401
+ interface HookVM {
402
+ runAI(prompt: string): Promise<{ success: boolean; output: string; error: string }>;
403
+ postComment(taskId: string, text: string): Promise<void>;
404
+ updateStatus(taskId: string, status: string): Promise<void>;
405
+ getComments(taskId: string): Promise<Array<{ id: string; text: string; author: string }>>;
406
+ log: { info(msg: string): void; warn(msg: string): void; error(msg: string): void };
407
+ }
408
+
409
+ // ─── Hooks (fill in — ask an AI: "implement beforeEachTask to append X to the prompt") ─
410
+
411
+ /** Once before any task. AI idea: log counts, or throw if CI env var is missing. */
412
+ export async function beforeRun(_context: RunContext, _vm: HookVM): Promise<RunContext | void> {
413
+ return;
414
+ }
415
+
416
+ /** After all tasks in this run. AI idea: post a summary comment or call an external webhook. */
417
+ export async function afterRun(_context: RunContext & { processed: number; skipped: number }, _vm: HookVM): Promise<void> {
418
+ return;
419
+ }
420
+
421
+ /** Before each code task AI run. AI idea: append coding standards or repo-specific rules to context.prompt. */
422
+ export async function beforeEachTask(_context: TaskContext, _vm: HookVM): Promise<TaskContext | void> {
423
+ return;
424
+ }
425
+
426
+ /** After a code task completes the success path (push + review). */
427
+ export async function afterEachTask(_context: TaskContext & { success: boolean }, _vm: HookVM): Promise<void> {
428
+ return;
429
+ }
430
+
431
+ /** Before AI-driven merge conflict resolution. AI idea: tighten context.prompt for your stack. */
432
+ export async function beforeResolveConflicts(_context: ResolveConflictsContext, _vm: HookVM): Promise<ResolveConflictsContext | void> {
433
+ return;
434
+ }
435
+
436
+ /** After conflict resolution; context.resolved is false when all runners failed. */
437
+ export async function afterResolveConflicts(_context: ResolveConflictsContext & { resolved: boolean }, _vm: HookVM): Promise<void> {
438
+ return;
439
+ }
440
+
441
+ /** Before non-code task AI run. AI idea: format context.prompt for ticket-style replies. */
442
+ export async function beforeNonCodeTask(_context: NonCodeTaskContext, _vm: HookVM): Promise<NonCodeTaskContext | void> {
443
+ return;
444
+ }
445
+
446
+ /** After non-code task; context.output is the agent response text posted to the ticket. */
447
+ export async function afterNonCodeTask(_context: NonCodeTaskContext & { success: boolean; output: string }, _vm: HookVM): Promise<void> {
448
+ return;
449
+ }
450
+
451
+ /** After the plan exists, before subtasks run. AI idea: rewrite subtask descriptions for clarity. */
452
+ export async function beforeThinkingTask(_context: ThinkingTaskContext, _vm: HookVM): Promise<ThinkingTaskContext | void> {
453
+ return;
454
+ }
455
+
456
+ /** After all thinking-task subtasks complete. AI idea: notify or archive artifacts. */
457
+ export async function afterThinkingTask(_context: ThinkingTaskContext & { success: boolean }, _vm: HookVM): Promise<void> {
458
+ return;
459
+ }
460
460
  `;
461
461
  function ensureHooksBoilerplate(dir = process.cwd()) {
462
462
  const aidevDir = path.join(dir, '.aidev');
@@ -403,16 +403,16 @@ async function checkNeedsClarification(task, config, provider, runners) {
403
403
  logger_1.logger.warn('No AI runner available — skipping clarification check');
404
404
  return null;
405
405
  }
406
- const clarificationPrompt = `You are a senior software developer reviewing a task.
407
- Determine if the following task has enough information to implement without further clarification.
408
-
409
- Task name: ${task.name}
410
- Task description: ${task.description || '(no description)'}
411
-
412
- Respond with valid JSON only:
413
- {
414
- "clear": true|false,
415
- "question": "question to ask if not clear, or null"
406
+ const clarificationPrompt = `You are a senior software developer reviewing a task.
407
+ Determine if the following task has enough information to implement without further clarification.
408
+
409
+ Task name: ${task.name}
410
+ Task description: ${task.description || '(no description)'}
411
+
412
+ Respond with valid JSON only:
413
+ {
414
+ "clear": true|false,
415
+ "question": "question to ask if not clear, or null"
416
416
  }`;
417
417
  for (const runner of availableRunners) {
418
418
  const result = await runner.run(clarificationPrompt);
@@ -440,30 +440,30 @@ Respond with valid JSON only:
440
440
  return null;
441
441
  }
442
442
  function buildConflictResolutionPrompt(task, conflictFiles, context) {
443
- return `You are resolving merge conflicts in a software development task branch.
444
-
445
- The task branch has fallen behind the base branch and has merge conflicts that need to be resolved.
446
-
447
- ## Task context (DO NOT break this — the task must still work after conflict resolution)
448
-
449
- Task: ${task.name}
450
-
451
- Description:
452
- ${task.description || '(no description provided)'}
453
- ${context}
454
-
455
- ## Merge conflicts
456
-
457
- The following files have merge conflicts with conflict markers (<<<<<<< HEAD, =======, >>>>>>> ...):
458
- ${conflictFiles.map((f) => `- ${f}`).join('\n')}
459
-
460
- ## Instructions
461
-
462
- 1. Open each conflicting file and resolve the conflict markers
463
- 2. Keep BOTH the task's changes AND the base branch updates where possible
464
- 3. If the base branch changed something the task also changed, prefer the task's intent but make sure it works with the new base branch code
465
- 4. Remove all conflict markers (<<<<<<< HEAD, =======, >>>>>>> ...)
466
- 5. Make sure the code compiles and is consistent after resolution
443
+ return `You are resolving merge conflicts in a software development task branch.
444
+
445
+ The task branch has fallen behind the base branch and has merge conflicts that need to be resolved.
446
+
447
+ ## Task context (DO NOT break this — the task must still work after conflict resolution)
448
+
449
+ Task: ${task.name}
450
+
451
+ Description:
452
+ ${task.description || '(no description provided)'}
453
+ ${context}
454
+
455
+ ## Merge conflicts
456
+
457
+ The following files have merge conflicts with conflict markers (<<<<<<< HEAD, =======, >>>>>>> ...):
458
+ ${conflictFiles.map((f) => `- ${f}`).join('\n')}
459
+
460
+ ## Instructions
461
+
462
+ 1. Open each conflicting file and resolve the conflict markers
463
+ 2. Keep BOTH the task's changes AND the base branch updates where possible
464
+ 3. If the base branch changed something the task also changed, prefer the task's intent but make sure it works with the new base branch code
465
+ 4. Remove all conflict markers (<<<<<<< HEAD, =======, >>>>>>> ...)
466
+ 5. Make sure the code compiles and is consistent after resolution
467
467
  6. Do NOT make any changes beyond what is needed to resolve the conflicts`;
468
468
  }
469
469
  async function resolveConflictsWithAI(task, config, provider, runners, context, hooks, vm, branchName) {
@@ -731,14 +731,14 @@ async function implementTask(task, branchName, branchExists, config, provider, r
731
731
  logger_1.logger.success(`Task implemented: branch ${branchName} pushed`);
732
732
  }
733
733
  function buildImplementPrompt(task, context) {
734
- return `You are implementing a software development task. Make the necessary code changes to complete the task described below.
735
-
736
- Task: ${task.name}
737
-
738
- Description:
739
- ${task.description || '(no description provided)'}
740
- ${context}
741
-
734
+ return `You are implementing a software development task. Make the necessary code changes to complete the task described below.
735
+
736
+ Task: ${task.name}
737
+
738
+ Description:
739
+ ${task.description || '(no description provided)'}
740
+ ${context}
741
+
742
742
  Please implement the required changes. Focus on correctness and follow the existing code style in the project.`;
743
743
  }
744
744
  async function analyzeAndPlan(task, context, runners) {
@@ -747,28 +747,28 @@ async function analyzeAndPlan(task, context, runners) {
747
747
  logger_1.logger.error('No AI runner available for task analysis');
748
748
  return null;
749
749
  }
750
- const analysisPrompt = `You are a senior software architect breaking down a development task into smaller, sequential implementation steps.
751
-
752
- Task name: ${task.name}
753
-
754
- Description:
755
- ${task.description || '(no description provided)'}
756
- ${context}
757
-
758
- Analyze this task and break it into smaller, independently implementable sub-tasks that should be executed sequentially. Each sub-task should be a coherent unit of work that can be committed separately.
759
-
760
- Respond with valid JSON only — no markdown fences, no extra text:
761
- {
762
- "instructions": "Detailed implementation instructions in markdown covering the full task — architecture decisions, key files to modify, edge cases to handle, testing approach",
763
- "subtasks": [
764
- {
765
- "id": 1,
766
- "title": "Short title for the sub-task",
767
- "description": "Detailed description of what to implement in this step, including specific files and functions to change"
768
- }
769
- ]
770
- }
771
-
750
+ const analysisPrompt = `You are a senior software architect breaking down a development task into smaller, sequential implementation steps.
751
+
752
+ Task name: ${task.name}
753
+
754
+ Description:
755
+ ${task.description || '(no description provided)'}
756
+ ${context}
757
+
758
+ Analyze this task and break it into smaller, independently implementable sub-tasks that should be executed sequentially. Each sub-task should be a coherent unit of work that can be committed separately.
759
+
760
+ Respond with valid JSON only — no markdown fences, no extra text:
761
+ {
762
+ "instructions": "Detailed implementation instructions in markdown covering the full task — architecture decisions, key files to modify, edge cases to handle, testing approach",
763
+ "subtasks": [
764
+ {
765
+ "id": 1,
766
+ "title": "Short title for the sub-task",
767
+ "description": "Detailed description of what to implement in this step, including specific files and functions to change"
768
+ }
769
+ ]
770
+ }
771
+
772
772
  Keep sub-tasks focused: 2-6 sub-tasks is ideal. Order them by dependency (foundation first).`;
773
773
  logger_1.logger.info('Analyzing task and creating implementation plan...');
774
774
  const result = await runner.run(analysisPrompt);
@@ -820,31 +820,31 @@ async function splitFailedSubtask(parentTask, plan, failedSubtask, runners) {
820
820
  const diagnostics = failedSubtask.lastError && failedSubtask.lastError !== '__git__'
821
821
  ? failedSubtask.lastError
822
822
  : '(no diagnostics captured)';
823
- const splitPrompt = `You are a senior software architect helping recover a stalled implementation step by splitting it into exactly two smaller, sequential sub-tasks.
824
-
825
- Overall task: ${parentTask.name}
826
- ${parentTask.description ? `\nTask description:\n${parentTask.description}\n` : ''}
827
- ## Surrounding plan
828
- ${siblings || '(no sibling sub-tasks)'}
829
-
830
- ## Failed sub-task
831
- ID: ${formatSubtaskId(failedSubtask.id)}
832
- Title: ${failedSubtask.title}
833
- Description: ${failedSubtask.description}
834
-
835
- ## Previous failure diagnostics
836
- ${diagnostics}
837
-
838
- Split the failed sub-task above into exactly two smaller, independently implementable sub-tasks that together achieve the original goal. Each new sub-task should be a coherent unit of work that can be committed separately, ordered by dependency (foundation first). Take the diagnostics into account so the split actually addresses what broke.
839
-
840
- Respond with valid JSON only — no markdown fences, no extra text:
841
- {
842
- "subtasks": [
843
- { "title": "Short title for the first new sub-task", "description": "Detailed description of what to implement in this step" },
844
- { "title": "Short title for the second new sub-task", "description": "Detailed description of what to implement in this step" }
845
- ]
846
- }
847
-
823
+ const splitPrompt = `You are a senior software architect helping recover a stalled implementation step by splitting it into exactly two smaller, sequential sub-tasks.
824
+
825
+ Overall task: ${parentTask.name}
826
+ ${parentTask.description ? `\nTask description:\n${parentTask.description}\n` : ''}
827
+ ## Surrounding plan
828
+ ${siblings || '(no sibling sub-tasks)'}
829
+
830
+ ## Failed sub-task
831
+ ID: ${formatSubtaskId(failedSubtask.id)}
832
+ Title: ${failedSubtask.title}
833
+ Description: ${failedSubtask.description}
834
+
835
+ ## Previous failure diagnostics
836
+ ${diagnostics}
837
+
838
+ Split the failed sub-task above into exactly two smaller, independently implementable sub-tasks that together achieve the original goal. Each new sub-task should be a coherent unit of work that can be committed separately, ordered by dependency (foundation first). Take the diagnostics into account so the split actually addresses what broke.
839
+
840
+ Respond with valid JSON only — no markdown fences, no extra text:
841
+ {
842
+ "subtasks": [
843
+ { "title": "Short title for the first new sub-task", "description": "Detailed description of what to implement in this step" },
844
+ { "title": "Short title for the second new sub-task", "description": "Detailed description of what to implement in this step" }
845
+ ]
846
+ }
847
+
848
848
  Exactly two entries — no more, no fewer.`;
849
849
  logger_1.logger.info(`Splitting failed sub-task ${formatSubtaskId(failedSubtask.id)} into two smaller steps...`);
850
850
  const result = await runner.run(splitPrompt);
@@ -899,20 +899,20 @@ async function executeSubTask(subtask, task, plan, config, runners, reviewContex
899
899
  const retrySection = previousError && previousError !== '__git__'
900
900
  ? `\n## Previous attempt failure diagnostics\nThis step failed on a previous attempt. Diagnostics below — please take them into account and avoid repeating the same failure.\n\n${previousError}\n`
901
901
  : '';
902
- const prompt = `You are implementing step ${subtask.id} of a multi-step task.
903
-
904
- Overall task: ${task.name}
905
- ${task.description ? `\nTask description:\n${task.description}` : ''}
906
-
907
- ## Full implementation instructions
908
- ${instructions}
909
- ${reviewContext || ''}${retrySection}
910
- ## Progress
911
- ${completedSteps || '(no steps completed yet)'}
912
-
913
- ## Current step: ${subtask.id}. ${subtask.title}
914
- ${subtask.description}
915
-
902
+ const prompt = `You are implementing step ${subtask.id} of a multi-step task.
903
+
904
+ Overall task: ${task.name}
905
+ ${task.description ? `\nTask description:\n${task.description}` : ''}
906
+
907
+ ## Full implementation instructions
908
+ ${instructions}
909
+ ${reviewContext || ''}${retrySection}
910
+ ## Progress
911
+ ${completedSteps || '(no steps completed yet)'}
912
+
913
+ ## Current step: ${subtask.id}. ${subtask.title}
914
+ ${subtask.description}
915
+
916
916
  Implement ONLY this step. Focus on correctness and follow the existing code style.`;
917
917
  let implemented = false;
918
918
  let previousNotes = '';
@@ -1191,29 +1191,29 @@ function buildCompletionComment(branch, prUrl, config) {
1191
1191
  function buildNonCodePrompt(task, context) {
1192
1192
  const hasComments = context.trim().length > 0;
1193
1193
  if (hasComments) {
1194
- return `Task: ${task.name}
1195
-
1196
- Original description:
1197
- ${task.description || '(no description provided)'}
1198
- ${context}
1199
-
1200
- ⚠️ CRITICAL: This is a FOLLOW-UP request. The conversation above contains new comments from the user.
1201
- YOUR PRIMARY TASK is to address the LATEST comment at the bottom of the conversation - this is the user's current request.
1202
- The latest comment may:
1203
- - Ask for something completely different from the original task
1204
- - Request modifications to what was already done
1205
- - Add new requirements
1206
-
1207
- DO NOT repeat what was already done. DO NOT re-execute the original task unless explicitly asked.
1208
- Focus ENTIRELY on addressing the latest comment as your main instruction.
1209
-
1194
+ return `Task: ${task.name}
1195
+
1196
+ Original description:
1197
+ ${task.description || '(no description provided)'}
1198
+ ${context}
1199
+
1200
+ ⚠️ CRITICAL: This is a FOLLOW-UP request. The conversation above contains new comments from the user.
1201
+ YOUR PRIMARY TASK is to address the LATEST comment at the bottom of the conversation - this is the user's current request.
1202
+ The latest comment may:
1203
+ - Ask for something completely different from the original task
1204
+ - Request modifications to what was already done
1205
+ - Add new requirements
1206
+
1207
+ DO NOT repeat what was already done. DO NOT re-execute the original task unless explicitly asked.
1208
+ Focus ENTIRELY on addressing the latest comment as your main instruction.
1209
+
1210
1210
  Please provide a clear, detailed response to the LATEST comment. Your response will be posted as a comment on the task ticket, so write it as a direct answer or explanation addressed to the person who wrote the latest comment.`;
1211
1211
  }
1212
- return `Task: ${task.name}
1213
-
1214
- Description:
1215
- ${task.description || '(no description provided)'}
1216
-
1212
+ return `Task: ${task.name}
1213
+
1214
+ Description:
1215
+ ${task.description || '(no description provided)'}
1216
+
1217
1217
  Please provide a clear, detailed response to this task. Your response will be posted as a comment on the task ticket, so write it as a direct answer or explanation addressed to the person who created the task.`;
1218
1218
  }
1219
1219
  function buildNonCodeCompletionComment(config, agentResponse) {
@@ -1523,22 +1523,22 @@ async function implementReviewTask(task, branchName, config, provider, runners,
1523
1523
  logger_1.logger.success(`Review comments addressed for: ${task.name}`);
1524
1524
  }
1525
1525
  function buildReviewPrompt(task, threads) {
1526
- let prompt = `You are addressing code review comments on a pull request for a software development task.
1527
-
1528
- Task: ${task.name}
1529
-
1530
- Description:
1531
- ${task.description || '(no description provided)'}
1532
-
1533
- ## Unresolved Code Review Threads
1534
-
1535
- The following review threads need to be addressed. For each thread, either:
1536
- - Fix the code as requested (make the changes directly in the files)
1537
- - Or, if it's a discussion/question that doesn't require code changes, output a REPLY block:
1538
- <!-- AIDEV-REPLY thread_id -->Your reply here<!-- /AIDEV-REPLY -->
1539
-
1540
- Replace "thread_id" with the actual thread ID shown below.
1541
-
1526
+ let prompt = `You are addressing code review comments on a pull request for a software development task.
1527
+
1528
+ Task: ${task.name}
1529
+
1530
+ Description:
1531
+ ${task.description || '(no description provided)'}
1532
+
1533
+ ## Unresolved Code Review Threads
1534
+
1535
+ The following review threads need to be addressed. For each thread, either:
1536
+ - Fix the code as requested (make the changes directly in the files)
1537
+ - Or, if it's a discussion/question that doesn't require code changes, output a REPLY block:
1538
+ <!-- AIDEV-REPLY thread_id -->Your reply here<!-- /AIDEV-REPLY -->
1539
+
1540
+ Replace "thread_id" with the actual thread ID shown below.
1541
+
1542
1542
  `;
1543
1543
  for (const thread of threads) {
1544
1544
  const location = thread.line
@@ -1550,12 +1550,12 @@ Replace "thread_id" with the actual thread ID shown below.
1550
1550
  }
1551
1551
  prompt += '\n';
1552
1552
  }
1553
- prompt += `## Instructions
1554
-
1555
- 1. Read each review thread carefully
1556
- 2. For code change requests: make the fix directly in the relevant file(s)
1557
- 3. For questions or discussions: output a REPLY block with a clear, helpful response
1558
- 4. You may handle multiple threads — some with code fixes, others with replies
1553
+ prompt += `## Instructions
1554
+
1555
+ 1. Read each review thread carefully
1556
+ 2. For code change requests: make the fix directly in the relevant file(s)
1557
+ 3. For questions or discussions: output a REPLY block with a clear, helpful response
1558
+ 4. You may handle multiple threads — some with code fixes, others with replies
1559
1559
  5. Focus on correctness and follow the existing code style`;
1560
1560
  return prompt;
1561
1561
  }
package/dist/github.js CHANGED
@@ -85,25 +85,25 @@ function getPrNumberForBranch(branch) {
85
85
  }
86
86
  }
87
87
  function fetchUnresolvedReviewThreads(owner, repo, prNumber) {
88
- const query = `query($owner: String!, $repo: String!, $prNumber: Int!) {
89
- repository(owner: $owner, name: $repo) {
90
- pullRequest(number: $prNumber) {
91
- reviewThreads(first: 100) {
92
- nodes {
93
- id
94
- isResolved
95
- path
96
- line
97
- comments(first: 50) {
98
- nodes {
99
- body
100
- author { login }
101
- }
102
- }
103
- }
104
- }
105
- }
106
- }
88
+ const query = `query($owner: String!, $repo: String!, $prNumber: Int!) {
89
+ repository(owner: $owner, name: $repo) {
90
+ pullRequest(number: $prNumber) {
91
+ reviewThreads(first: 100) {
92
+ nodes {
93
+ id
94
+ isResolved
95
+ path
96
+ line
97
+ comments(first: 50) {
98
+ nodes {
99
+ body
100
+ author { login }
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
107
  }`;
108
108
  const result = gh([
109
109
  'api', 'graphql',
@@ -149,10 +149,10 @@ function mergePullRequest(branch) {
149
149
  return { success: true, error: '' };
150
150
  }
151
151
  function replyToReviewThread(threadId, body) {
152
- const mutation = `mutation($threadId: ID!, $body: String!) {
153
- addPullRequestReviewThreadReply(input: { pullRequestReviewThreadId: $threadId, body: $body }) {
154
- comment { id }
155
- }
152
+ const mutation = `mutation($threadId: ID!, $body: String!) {
153
+ addPullRequestReviewThreadReply(input: { pullRequestReviewThreadId: $threadId, body: $body }) {
154
+ comment { id }
155
+ }
156
156
  }`;
157
157
  const result = gh([
158
158
  'api', 'graphql',
@@ -175,10 +175,10 @@ function filterUnresolvedByNonAidev(threads, commentPrefix) {
175
175
  });
176
176
  }
177
177
  function resolveReviewThread(threadId) {
178
- const mutation = `mutation($threadId: ID!) {
179
- resolveReviewThread(input: { threadId: $threadId }) {
180
- thread { isResolved }
181
- }
178
+ const mutation = `mutation($threadId: ID!) {
179
+ resolveReviewThread(input: { threadId: $threadId }) {
180
+ thread { isResolved }
181
+ }
182
182
  }`;
183
183
  const result = gh([
184
184
  'api', 'graphql',