next-issue 7.7.0 → 7.8.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.
- package/README.md +12 -0
- package/dist/agent-reply.mjs +5 -0
- package/dist/github.mjs +3 -0
- package/dist/implement.mjs +14 -1
- package/dist/issue-format.mjs +19 -0
- package/dist/ports.mjs +2 -1
- package/dist/prompts.mjs +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,6 +95,16 @@ the run handles one issue. For each issue:
|
|
|
95
95
|
and the newest of them gives the subject of the landed commit. A lost state
|
|
96
96
|
file does not count, since an issue with no saved state resets its local
|
|
97
97
|
branch (step 3).
|
|
98
|
+
The implementer checks the issue first. When the scope, the expected
|
|
99
|
+
behaviour or the acceptance criteria are ambiguous, it makes no change and
|
|
100
|
+
asks instead of guessing, with each question on its own
|
|
101
|
+
`question: <n>. <question>` line, its options labelled by letters and one
|
|
102
|
+
option recommended. A reply with at least one `question:` line makes the
|
|
103
|
+
harness drop any change in the worktree, commit nothing and hand the issue
|
|
104
|
+
to a person with the reason `questions`. The hand-over comment lists the
|
|
105
|
+
questions in order, numbered by the harness. The harness reads the issue
|
|
106
|
+
again and adds the questions after any text under its `Open questions`
|
|
107
|
+
heading, or adds that heading at the end of the body when it has none.
|
|
98
108
|
5. Let the reviewer agent judge the diff, at most `diffMaxChars` of it. The
|
|
99
109
|
reviewer reads files and runs commands in the worktree, so it can prove a
|
|
100
110
|
finding with the tests or the type check. The harness then throws away every
|
|
@@ -340,6 +350,7 @@ and comments the reason on the issue, when:
|
|
|
340
350
|
broken, so the run claims no new issue and ends once the running issues
|
|
341
351
|
end. It halts this way even when the hand-over fails; the issue then ends
|
|
342
352
|
in error with both the reason and the hand-over error;
|
|
353
|
+
- the implementer asks questions about the issue (reason `questions`);
|
|
343
354
|
- an agent does not finish in `agentTimeoutMinutes`;
|
|
344
355
|
- the setup command fails, or does not finish in `setupTimeoutMinutes`. On a
|
|
345
356
|
resume whose state holds a landed commit, or a push or revert that may have
|
|
@@ -718,6 +729,7 @@ says so: a workflow rule in `AGENTS.md` about these, such as "push to main" or
|
|
|
718
729
|
|
|
719
730
|
When the implementer makes no change, the hand-over comment holds its full
|
|
720
731
|
reply after the note, so its reasons and questions can be answered on the issue.
|
|
732
|
+
When it asks questions on `question:` lines, the comment lists them instead.
|
|
721
733
|
Every hand-over comment is cut to fit a GitHub comment, whatever the reason, so a
|
|
722
734
|
long reply or a long run error does not lose it. A cut comment ends with a line
|
|
723
735
|
that says so.
|
package/dist/agent-reply.mjs
CHANGED
|
@@ -10,6 +10,11 @@ export function parseResolved(text) {
|
|
|
10
10
|
const note = lastMatch(text, /^resolved:[^\S\r\n]*(.+)$/gim);
|
|
11
11
|
return note === undefined || PLACEHOLDERS.has(note.toLowerCase()) ? undefined : note;
|
|
12
12
|
}
|
|
13
|
+
export function parseQuestions(text) {
|
|
14
|
+
return [...text.matchAll(/^question:[^\S\r\n]*(.+)$/gim)]
|
|
15
|
+
.map((match) => match[1].replace(/^\d+[.)]\s*/, '').trim())
|
|
16
|
+
.filter((question) => !PLACEHOLDERS.has(question.toLowerCase()));
|
|
17
|
+
}
|
|
13
18
|
const CLOSING_REFERENCE = /(\s*[,;]?\s*(?:and\s+)?)\b(close[sd]?|fix(?:e[sd])?|resolve[sd]?)(\s*:\s*|\s+)(?:[\w.-]+\/[\w.-]+#\d+|#\d+|https?:\/\/\S+\/(?:issues|pull)\/\d+)/gi;
|
|
14
19
|
const BARE_TYPE = /^\w+(?:\([^)]*\))?!?$/;
|
|
15
20
|
export function withoutClosingReferences(subject, fallback) {
|
package/dist/github.mjs
CHANGED
|
@@ -94,3 +94,6 @@ async function comment(repo, kind, number, body) {
|
|
|
94
94
|
export async function commentOnIssue(repo, issue, body) {
|
|
95
95
|
await comment(repo, 'issue', issue, body);
|
|
96
96
|
}
|
|
97
|
+
export async function editIssueBody(repo, issue, body) {
|
|
98
|
+
await ghOnce(repo, ['issue', 'edit', String(issue), '--body-file', '-'], body);
|
|
99
|
+
}
|
package/dist/implement.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { parseCommitSubject } from './agent-reply.mjs';
|
|
1
|
+
import { parseCommitSubject, parseQuestions } from './agent-reply.mjs';
|
|
2
2
|
import { CODING } from './agents.mjs';
|
|
3
3
|
import { commitWork } from './fix.mjs';
|
|
4
4
|
import { escalateAndFinish } from './handover.mjs';
|
|
5
|
+
import { numbered, withOpenQuestions } from './issue-format.mjs';
|
|
5
6
|
import { fallbackTitle, ROUND_CONTINUE, runRole } from './job.mjs';
|
|
6
7
|
import { implementPrompt } from './prompts.mjs';
|
|
7
8
|
import { writeState } from './state.mjs';
|
|
@@ -10,6 +11,10 @@ export async function implement(job) {
|
|
|
10
11
|
const before = await context.ports.revision(worktree);
|
|
11
12
|
const result = await log.step('implement', {}, () => runRole(job, 'implementer', implementPrompt(issue, comments, reply), CODING));
|
|
12
13
|
state.implementerReply = result.text;
|
|
14
|
+
const questions = parseQuestions(result.text);
|
|
15
|
+
if (questions.length > 0) {
|
|
16
|
+
return askQuestions(job, before, questions);
|
|
17
|
+
}
|
|
13
18
|
const subject = parseCommitSubject(result.text, fallbackTitle(issue));
|
|
14
19
|
if (!(await commitWork(job, before, subject, 'implementer'))) {
|
|
15
20
|
const escalated = await useEarlierCommit(job);
|
|
@@ -21,6 +26,14 @@ export async function implement(job) {
|
|
|
21
26
|
await writeState(context.repo, state);
|
|
22
27
|
return ROUND_CONTINUE;
|
|
23
28
|
}
|
|
29
|
+
async function askQuestions(job, before, questions) {
|
|
30
|
+
const { context, issue, worktree, branch } = job;
|
|
31
|
+
const { repo, ports } = context;
|
|
32
|
+
await ports.discardChanges(worktree, before, branch);
|
|
33
|
+
const fresh = await ports.viewIssue(repo, issue.number);
|
|
34
|
+
await ports.editIssueBody(repo, issue.number, withOpenQuestions(fresh.body, questions));
|
|
35
|
+
return escalateAndFinish(job, `The implementer has questions about the issue.\n\n${numbered(questions)}`, 'questions');
|
|
36
|
+
}
|
|
24
37
|
async function useEarlierCommit(job) {
|
|
25
38
|
const { context, log, state, worktree } = job;
|
|
26
39
|
const earlier = await context.ports.latestSubject(worktree, context.base, context.config.remote);
|
package/dist/issue-format.mjs
CHANGED
|
@@ -5,3 +5,22 @@ export const ISSUE_SECTIONS = [
|
|
|
5
5
|
'Out of scope',
|
|
6
6
|
'Open questions',
|
|
7
7
|
];
|
|
8
|
+
const OPEN_QUESTIONS = /^(#{1,6})[^\S\r\n]+Open questions[^\S\r\n]*$/im;
|
|
9
|
+
export function numbered(items) {
|
|
10
|
+
return items.map((item, index) => `${index + 1}. ${item}`).join('\n');
|
|
11
|
+
}
|
|
12
|
+
export function withOpenQuestions(body, questions) {
|
|
13
|
+
const list = numbered(questions);
|
|
14
|
+
const heading = OPEN_QUESTIONS.exec(body);
|
|
15
|
+
if (heading === null) {
|
|
16
|
+
const kept = body.trimEnd();
|
|
17
|
+
return `${kept === '' ? '' : `${kept}\n\n`}## Open questions\n\n${list}`;
|
|
18
|
+
}
|
|
19
|
+
const start = heading.index + heading[0].length;
|
|
20
|
+
const level = heading[1].length;
|
|
21
|
+
const next = new RegExp(`^#{1,${level}}[^\\S\\r\\n]`, 'm').exec(body.slice(start));
|
|
22
|
+
const end = next === null ? body.length : start + next.index;
|
|
23
|
+
const section = body.slice(start, end).trimEnd();
|
|
24
|
+
const rest = body.slice(end);
|
|
25
|
+
return `${body.slice(0, start)}${section}\n\n${list}${rest === '' ? '' : `\n\n${rest}`}`;
|
|
26
|
+
}
|
package/dist/ports.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { commitAll } from './git-commit.mjs';
|
|
|
5
5
|
import { pushToBase, reapplyRevert, revertOnBase, squashOnto } from './git-land.mjs';
|
|
6
6
|
import { abortMerge, commitMerge, startMerge } from './git-merge.mjs';
|
|
7
7
|
import { changedFiles, deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject, push, resetToBase, revision, saveEdits, setAside, } from './git.mjs';
|
|
8
|
-
import { canWrite, closeIssue, commentOnIssue, issueComments, openBlockers, openIssues, reopenIssue, repositorySlug, threadComments, viewIssue, } from './github.mjs';
|
|
8
|
+
import { canWrite, closeIssue, commentOnIssue, editIssueBody, issueComments, openBlockers, openIssues, reopenIssue, repositorySlug, threadComments, viewIssue, } from './github.mjs';
|
|
9
9
|
import { huntWorktree } from './hunt.mjs';
|
|
10
10
|
import { ensureLabel, setLabel } from './labels.mjs';
|
|
11
11
|
import { detectSetupCommand } from './setup.mjs';
|
|
@@ -32,6 +32,7 @@ export const PORTS = {
|
|
|
32
32
|
diff,
|
|
33
33
|
discardChanges,
|
|
34
34
|
disputeBranches,
|
|
35
|
+
editIssueBody,
|
|
35
36
|
ensureLabel,
|
|
36
37
|
failedBaseLogs,
|
|
37
38
|
fastForwardBase,
|
package/dist/prompts.mjs
CHANGED
|
@@ -17,6 +17,11 @@ const COMMIT_RULES = [
|
|
|
17
17
|
'Do not run git, gh or any push command. The harness commits for you.',
|
|
18
18
|
'End your final message with one line in the form `commit: <conventional commit subject>`.',
|
|
19
19
|
].join('\n');
|
|
20
|
+
const QUESTION_RULES = [
|
|
21
|
+
'Check the issue first. When the scope, the expected behaviour or the acceptance criteria are ambiguous, make no change and ask instead of guessing.',
|
|
22
|
+
'Write each question on its own line in the form `question: <n>. <question>`, numbered from 1. In each question, label its options with letters and recommend one.',
|
|
23
|
+
'The harness then hands the issue to a person with your questions.',
|
|
24
|
+
].join('\n');
|
|
20
25
|
function issueBlock(issue, comments) {
|
|
21
26
|
return paragraphs([
|
|
22
27
|
`# Issue #${issue.number}: ${issue.title}`,
|
|
@@ -40,6 +45,7 @@ export function implementPrompt(issue, comments, reply = []) {
|
|
|
40
45
|
replyBlock(reply),
|
|
41
46
|
'## Rules',
|
|
42
47
|
'Read the repository conventions first. Keep the change minimal and focused on the issue.',
|
|
48
|
+
QUESTION_RULES,
|
|
43
49
|
ENGINEERING_RULES,
|
|
44
50
|
'Add or update tests when the repository has a test suite.',
|
|
45
51
|
'For a behaviour change, write the test first and run it before the change. Then quote its failing output in your final message.',
|