next-issue 6.6.28 → 6.6.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -117,9 +117,11 @@ the run handles one issue. For each issue:
117
117
  the change. When git merges the base cleanly, no agent runs. When git
118
118
  reports conflicted files, the fixer gets the list from the check budget,
119
119
  `maxCiFixes`, removes the conflict markers, and the harness commits the
120
- merge. With the budget used up, or when the fixer leaves a conflict marker
121
- or the merge unresolved, or the fixer fails, the harness undoes the merge
122
- and hands the issue to a person with the reason `merge conflict`. The
120
+ merge. A merge that the fixer commits itself counts only when the branch
121
+ then holds the base and the listed files hold no conflict marker. With the
122
+ budget used up, or when the fixer leaves a conflict marker or the merge
123
+ unresolved, aborts the merge, or fails, the harness undoes the merge and
124
+ hands the issue to a person with the reason `merge conflict`. The
123
125
  harness then pushes the commit to the base branch, without force. A push
124
126
  that the remote refuses, for example because the base moved, starts the
125
127
  rebase again, three times at most. When the push fails, the harness
package/dist/conflict.mjs CHANGED
@@ -48,7 +48,7 @@ async function resolve(job, before, files) {
48
48
  try {
49
49
  const text = files.length > 0 ? await fixConflict(job, files) : '';
50
50
  const subject = parseCommitSubject(text, `chore: merge ${config.remote}/${context.base}`);
51
- return await commitWork(job, before, subject, 'fixer', (cwd, message) => ports.commitMerge(cwd, files, message));
51
+ return await commitWork(job, before, subject, 'fixer', (cwd, message) => ports.commitMerge(cwd, { before, base: context.base, remote: config.remote, files }, message));
52
52
  }
53
53
  catch (error) {
54
54
  await ports.abortMerge(worktree, before);
package/dist/fix.mjs CHANGED
@@ -40,7 +40,7 @@ export async function fixRound(job, reason, detail, earlier, kind) {
40
40
  }
41
41
  export async function runFixer(job, reason, detail, earlier, kind) {
42
42
  const { issue, log } = job;
43
- const result = await log.step('fix', { reason, cause: kind, ...fixBudget(job, kind) }, () => runRole(job, 'fixer', fixPrompt(issue, reason, detail, earlier, kind, job.reply), CODING));
43
+ const result = await log.step('fix', { reason, cause: kind, ...fixBudget(job, kind) }, () => runRole(job, 'fixer', fixPrompt(issue, job.comments, reason, detail, earlier, kind, job.reply), CODING));
44
44
  return result.text;
45
45
  }
46
46
  function fixBudget(job, kind) {
@@ -2,7 +2,7 @@ import { join } from 'node:path';
2
2
  import { run, succeeded } from './exec.mjs';
3
3
  import { readTextOrEmpty } from './files.mjs';
4
4
  import { commitEverything } from './git-commit.mjs';
5
- import { fetchBase, git, resetHard, succeeds } from './git.mjs';
5
+ import { fetchBase, git, isAncestor, remoteRef, resetHard, succeeds } from './git.mjs';
6
6
  import { lines } from './text.mjs';
7
7
  export async function startMerge(cwd, base, remote) {
8
8
  const target = await fetchBase(cwd, base, remote);
@@ -21,13 +21,23 @@ async function merging(cwd) {
21
21
  return succeeds(cwd, ['rev-parse', '--quiet', '--verify', 'MERGE_HEAD']);
22
22
  }
23
23
  const CONFLICT_MARKER = /^(?:<{7}|>{7})(?: |$)/m;
24
- export async function commitMerge(cwd, files, message) {
25
- if (!(await merging(cwd)) || (await hasConflictMarkers(cwd, files))) {
24
+ export async function commitMerge(cwd, merge, message) {
25
+ if (!(await merging(cwd))) {
26
+ await refuseUnmerged(cwd, merge);
27
+ return false;
28
+ }
29
+ if (await hasConflictMarkers(cwd, merge.files)) {
26
30
  return false;
27
31
  }
28
32
  await commitEverything(cwd, message);
29
33
  return true;
30
34
  }
35
+ async function refuseUnmerged(cwd, merge) {
36
+ const holdsBase = await isAncestor(cwd, remoteRef(merge.remote, merge.base), 'HEAD');
37
+ if (!holdsBase || (await hasConflictMarkers(cwd, merge.files))) {
38
+ await resetHard(cwd, merge.before);
39
+ }
40
+ }
31
41
  async function hasConflictMarkers(cwd, files) {
32
42
  for (const file of files) {
33
43
  const text = await readTextOrEmpty(join(cwd, file));
package/dist/prompts.mjs CHANGED
@@ -135,9 +135,10 @@ function earlierBlock(earlier) {
135
135
  ].join('\n')
136
136
  : '';
137
137
  }
138
- export function fixPrompt(issue, reason, detail, earlier, kind, reply = []) {
138
+ export function fixPrompt(issue, comments, reason, detail, earlier, kind, reply = []) {
139
139
  return paragraphs([
140
- `You are the fixer. Correct the work for issue #${issue.number}: ${issue.title}.`,
140
+ 'You are the fixer. Correct the work for the issue below.',
141
+ issueBlock(issue, comments),
141
142
  `## Reason\n${reason}`,
142
143
  `## Detail\n${detail}`,
143
144
  earlierBlock(earlier),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.28",
3
+ "version": "6.6.30",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",