next-issue 6.4.0 → 6.5.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 +2 -2
- package/dist/hunt.mjs +12 -8
- package/dist/prompts.mjs +7 -6
- package/dist/watch.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -526,10 +526,10 @@ With `--hunt`, which turns on `--watch`, the harness runs a hunter agent at the
|
|
|
526
526
|
|
|
527
527
|
- works in its own worktree at `.worktrees/hunt`, at the remote base branch, which the harness fetches and resets before each hunt;
|
|
528
528
|
- follows `next-issue.hunt.md` in the repository root, or a short built-in prompt when the file is missing;
|
|
529
|
-
- files
|
|
529
|
+
- files up to `huntCap` less that count, worked out just before the hunt, its most serious findings first, each with the `labels.ready` label, the `labels.hunt` label and the sections of the [issue format](#issue-format), after a search for duplicates. The `labels.hunt` label, `source:hunt` by default, marks the issue as one the hunter filed, and the harness creates it before the hunt when it is missing. It files nothing when it finds no real problem or a duplicate exists;
|
|
530
530
|
- runs no test suite and changes no file. It gets the tools of the reviewer.
|
|
531
531
|
|
|
532
|
-
The hunter ends its reply with
|
|
532
|
+
With `huntCap` at 1 and no ready issue, a hunt files at most one issue. The hunter ends its reply with one `issue:` line for each issue it filed, or one `issue: none` line, and the run log holds one `hunt.issue` event with the `url` for each, or one with `none`. A hunt that fails writes a `hunt.error` event and the watch goes on. The hunter then waits before the next hunt, with a `hunt.wait` event and the same back-off, so a failure, or a hunt that files nothing, that repeats waits 1, 2, 3, 5, 10, then 10 minutes, and the back-off goes back to 1 minute after a hunt that files at least one issue. The next pass claims the new issues like any other. At the first `Ctrl-C` the hunter stops after its current hunt, and the watch ends once the hunt and the running issues end. A first `Ctrl-C` during the watch wait tells you so while a hunt runs, and the third press stops the hunter at once. The hunter stops too when the watch ends for another reason.
|
|
533
533
|
|
|
534
534
|
## Worker
|
|
535
535
|
|
package/dist/hunt.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { huntPrompt } from './prompts.mjs';
|
|
|
10
10
|
import { skipReason } from './skip.mjs';
|
|
11
11
|
import { WORKTREE_DIR } from './worktree.mjs';
|
|
12
12
|
export const HUNT_FILE = 'next-issue.hunt.md';
|
|
13
|
-
const FILED = /^issue:\s*(\S+)\s*$/
|
|
13
|
+
const FILED = /^issue:\s*(\S+)\s*$/gm;
|
|
14
14
|
export async function huntWorktree(repo, base, remote) {
|
|
15
15
|
const path = join(repo.root, WORKTREE_DIR, 'hunt');
|
|
16
16
|
const target = remoteRef(remote, base);
|
|
@@ -24,7 +24,7 @@ export async function huntWorktree(repo, base, remote) {
|
|
|
24
24
|
}
|
|
25
25
|
return path;
|
|
26
26
|
}
|
|
27
|
-
export async function hunt(context) {
|
|
27
|
+
export async function hunt(context, count) {
|
|
28
28
|
const { repo, config, base, recorder, ports } = context;
|
|
29
29
|
return recorder.step('hunt', {}, async () => {
|
|
30
30
|
const cwd = await oneAtATime(repo.root, () => ports.huntWorktree(repo, base, config.remote));
|
|
@@ -33,13 +33,17 @@ export async function hunt(context) {
|
|
|
33
33
|
const result = await ports.runAgent(recorder, {
|
|
34
34
|
name: 'hunter',
|
|
35
35
|
cwd,
|
|
36
|
-
prompt: huntPrompt(instructions, config.labels.ready, config.labels.hunt),
|
|
36
|
+
prompt: huntPrompt(instructions, config.labels.ready, config.labels.hunt, count),
|
|
37
37
|
profile: REVIEWING,
|
|
38
38
|
timeoutMs: minutesToMs(config.agentTimeoutMinutes),
|
|
39
39
|
});
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const urls = [...result.text.matchAll(FILED)]
|
|
41
|
+
.map((match) => match[1])
|
|
42
|
+
.filter((url) => /^https?:\/\//.test(url));
|
|
43
|
+
for (const url of urls.length === 0 ? ['none'] : urls) {
|
|
44
|
+
recorder.event('hunt.issue', { url }, 'quiet');
|
|
45
|
+
}
|
|
46
|
+
return urls.length > 0;
|
|
43
47
|
});
|
|
44
48
|
}
|
|
45
49
|
export function hunter(context) {
|
|
@@ -54,10 +58,10 @@ export function hunter(context) {
|
|
|
54
58
|
const blockers = await Promise.all(open.map((issue) => ports.openBlockers(repo, issue.number)));
|
|
55
59
|
return open.filter((_issue, index) => blockers[index].length === 0);
|
|
56
60
|
},
|
|
57
|
-
hunt: async () => {
|
|
61
|
+
hunt: async (count) => {
|
|
58
62
|
hunting = true;
|
|
59
63
|
try {
|
|
60
|
-
return await hunt(context);
|
|
64
|
+
return await hunt(context, count);
|
|
61
65
|
}
|
|
62
66
|
catch {
|
|
63
67
|
return false;
|
package/dist/prompts.mjs
CHANGED
|
@@ -163,24 +163,25 @@ const HUNT_DEFAULT = [
|
|
|
163
163
|
'Read the whole repository and look for bugs: wrong results, unhandled errors, races, security holes and documentation that contradicts the code.',
|
|
164
164
|
'Prove each finding from the code. A guess is not a finding.',
|
|
165
165
|
].join('\n');
|
|
166
|
-
export function huntPrompt(instructions, ready, source) {
|
|
166
|
+
export function huntPrompt(instructions, ready, source, count) {
|
|
167
|
+
const issues = count === 1 ? '1 issue' : `${count} issues`;
|
|
167
168
|
const kept = instructions?.trim() ?? '';
|
|
168
169
|
const label = [ready, source]
|
|
169
170
|
.filter((name) => name !== '')
|
|
170
171
|
.map((name) => ` --label "${name}"`)
|
|
171
172
|
.join('');
|
|
172
173
|
return paragraphs([
|
|
173
|
-
|
|
174
|
+
`You are the hunter. Find the most serious problems in this repository and file up to ${issues} for them.`,
|
|
174
175
|
`## Instructions\n${kept === '' ? HUNT_DEFAULT : kept}`,
|
|
175
176
|
'## Rules',
|
|
176
177
|
[
|
|
177
178
|
'Run no test suite and no build. Change no file. Do not commit or push.',
|
|
178
|
-
|
|
179
|
-
'Before you file
|
|
180
|
-
`File
|
|
179
|
+
`File up to ${issues}, your most serious findings first. File nothing when you find no real problem.`,
|
|
180
|
+
'Before you file an issue, search the open and closed issues for a duplicate, for example with `gh issue list --state all --search "<words>"`. Do not file a finding when a duplicate exists.',
|
|
181
|
+
`File each issue with \`gh issue create${label} --title "<conventional commit subject>" --body-file -\`.`,
|
|
181
182
|
`The body holds these sections as \`##\` headings, in this order: ${ISSUE_SECTIONS.map((section) => `\`## ${section}\``).join(', ')}.`,
|
|
182
183
|
'Give the file and line of each piece of evidence. Leave the Open questions section empty.',
|
|
183
|
-
'End your final message with one line in the form `issue: <url
|
|
184
|
+
'End your final message with one line in the form `issue: <url>` for each issue you filed, or one `issue: none` line when you filed nothing.',
|
|
184
185
|
].join('\n'),
|
|
185
186
|
]);
|
|
186
187
|
}
|
package/dist/watch.mjs
CHANGED
|
@@ -53,7 +53,7 @@ async function huntIssues(hunter, running, claims, stopped, signal) {
|
|
|
53
53
|
claims.take();
|
|
54
54
|
const waiting = ready?.filter((issue) => !running.has(issue.number)).length;
|
|
55
55
|
if (waiting !== undefined && waiting < hunter.cap) {
|
|
56
|
-
if (await hunter.hunt()) {
|
|
56
|
+
if (await hunter.hunt(hunter.cap - waiting)) {
|
|
57
57
|
step = 0;
|
|
58
58
|
continue;
|
|
59
59
|
}
|