next-issue 5.6.0 → 5.6.1

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
@@ -210,6 +210,9 @@ Press `Ctrl-C` to stop the run step by step:
210
210
  issue, but the issue keeps `status:in-progress` and the run writes no
211
211
  summary.
212
212
 
213
+ Signals that arrive within 100 ms of the last counted one count as one press,
214
+ because `npx` and `npm exec` pass on a press as a second signal.
215
+
213
216
  Each of the first two presses prints a line that says what happens next. The
214
217
  agents run inside the harness, and their commands and the harness commands run
215
218
  in a process group of their own, so a press reaches only the harness.
@@ -349,7 +352,8 @@ because no pull request is opened.
349
352
  "inReview": "status:in-review",
350
353
  "done": "status:done",
351
354
  "needsHuman": "status:needs-human",
352
- "skip": "status:blocked"
355
+ "skip": "status:blocked",
356
+ "hunt": "source:hunt"
353
357
  }
354
358
  }
355
359
  ```
@@ -376,6 +380,9 @@ because no pull request is opened.
376
380
  | `models` | `null` per role | The pi model per agent role, as `provider/model`: `implementer`, `reviewer`, `fixer` |
377
381
  | `labels` | see above | The names of the labels that the harness reads and sets |
378
382
 
383
+ The hunter adds `labels.hunt` to each issue it files, so you can tell those
384
+ issues apart from your own and filter them.
385
+
379
386
  An empty `labels.ready` turns the ready requirement off. The harness then
380
387
  claims every open issue that no other label holds back.
381
388
 
@@ -499,7 +506,7 @@ With `--hunt`, which turns on `--watch`, the harness runs a hunter agent at the
499
506
 
500
507
  - works in its own worktree at `.worktrees/hunt`, at the remote base branch, which the harness fetches and resets before each hunt;
501
508
  - follows `next-issue.hunt.md` in the repository root, or a short built-in prompt when the file is missing;
502
- - files one issue, for its most serious finding, with the `labels.ready` label and the sections of the [issue format](#issue-format), after a search for duplicates. It files nothing when it finds no real problem or a duplicate exists;
509
+ - files one issue, for its most serious finding, 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;
503
510
  - runs no test suite and changes no file. It gets the tools of the reviewer.
504
511
 
505
512
  The hunter ends its reply with an `issue:` line, and the run log holds it as a `hunt.issue` event with the `url`, or `none`. A hunt that fails writes a `hunt.error` event and the watch goes on. The next pass claims the new issue 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.
package/dist/config.mjs CHANGED
@@ -27,6 +27,7 @@ const DEFAULTS = {
27
27
  done: 'status:done',
28
28
  needsHuman: 'status:needs-human',
29
29
  skip: 'status:blocked',
30
+ hunt: 'source:hunt',
30
31
  },
31
32
  };
32
33
  function defaults() {
@@ -51,7 +52,15 @@ const WHOLE_FIELDS = [
51
52
  ['keepRunDays', 0],
52
53
  ];
53
54
  const MODEL_ROLES = ['implementer', 'reviewer', 'fixer'];
54
- const LABEL_NAMES = ['ready', 'inProgress', 'inReview', 'done', 'needsHuman', 'skip'];
55
+ const LABEL_NAMES = [
56
+ 'ready',
57
+ 'inProgress',
58
+ 'inReview',
59
+ 'done',
60
+ 'needsHuman',
61
+ 'skip',
62
+ 'hunt',
63
+ ];
55
64
  const FILE_DEFAULTS = {
56
65
  ...defaults(),
57
66
  models: Object.fromEntries(MODEL_ROLES.map((role) => [role, null])),
@@ -134,5 +143,5 @@ function parseLabels(value, defaultLabels) {
134
143
  return parsed;
135
144
  }
136
145
  export function managedLabels(config) {
137
- return LABEL_NAMES.filter((name) => name !== 'skip').map((name) => config.labels[name]);
146
+ return LABEL_NAMES.filter((name) => name !== 'skip' && name !== 'hunt').map((name) => config.labels[name]);
138
147
  }
package/dist/hunt.mjs CHANGED
@@ -28,11 +28,12 @@ export async function hunt(context) {
28
28
  const { repo, config, base, recorder, ports } = context;
29
29
  await recorder.step('hunt', {}, async () => {
30
30
  const cwd = await oneAtATime(repo.root, () => ports.huntWorktree(repo, base, config.remote));
31
+ await ports.ensureLabel(repo, config.labels.hunt);
31
32
  const instructions = await readTextIfPresent(join(repo.root, HUNT_FILE));
32
33
  const result = await ports.runAgent(recorder, {
33
34
  name: 'hunter',
34
35
  cwd,
35
- prompt: huntPrompt(instructions, config.labels.ready),
36
+ prompt: huntPrompt(instructions, config.labels.ready, config.labels.hunt),
36
37
  profile: REVIEWING,
37
38
  timeoutMs: minutesToMs(config.agentTimeoutMinutes),
38
39
  });
@@ -2,9 +2,15 @@ import { stopChildren } from './children.mjs';
2
2
  import { wakeableSleep } from './durations.mjs';
3
3
  export function listenForInterrupts(say) {
4
4
  let presses = 0;
5
+ let lastPress = -Infinity;
5
6
  const sleeper = {};
6
7
  let hunting = () => false;
7
8
  const press = () => {
9
+ const now = performance.now();
10
+ if (now - lastPress < 100) {
11
+ return;
12
+ }
13
+ lastPress = now;
8
14
  presses += 1;
9
15
  if (presses === 1 && sleeper.wake !== undefined) {
10
16
  say(hunting()
package/dist/labels.mjs CHANGED
@@ -20,6 +20,12 @@ export async function setLabel(repo, kind, number, add, remove) {
20
20
  await retryWithLabel(repo, args, add, error);
21
21
  }
22
22
  }
23
+ export async function ensureLabel(repo, label) {
24
+ const created = await createUnknownLabel(repo, label);
25
+ if (created instanceof Error) {
26
+ throw created;
27
+ }
28
+ }
23
29
  async function retryWithLabel(repo, args, label, error) {
24
30
  KNOWN_LABELS.delete(slug(repo));
25
31
  const created = await createUnknownLabel(repo, label);
package/dist/ports.mjs CHANGED
@@ -7,7 +7,7 @@ import { abortMerge, commitMerge, startMerge } from './git-merge.mjs';
7
7
  import { deleteBranch, diff, discardChanges, disputeBranches, isDirty, latestSubject, push, resetToBase, revision, setAside, } from './git.mjs';
8
8
  import { canWrite, closeIssue, commentOnIssue, issueComments, openBlockers, openIssues, reopenIssue, threadComments, viewIssue, } from './github.mjs';
9
9
  import { huntWorktree } from './hunt.mjs';
10
- import { setLabel } from './labels.mjs';
10
+ import { ensureLabel, setLabel } from './labels.mjs';
11
11
  import { detectSetupCommand } from './setup.mjs';
12
12
  import { addWorktree, findWorktree, removeWorktree } from './worktree.mjs';
13
13
  async function runSetup(command, cwd, timeoutMs) {
@@ -26,6 +26,7 @@ export const PORTS = {
26
26
  diff,
27
27
  discardChanges,
28
28
  disputeBranches,
29
+ ensureLabel,
29
30
  failedBaseLogs,
30
31
  findWorktree,
31
32
  huntWorktree,
package/dist/prompts.mjs CHANGED
@@ -154,9 +154,12 @@ const HUNT_DEFAULT = [
154
154
  'Read the whole repository and look for bugs: wrong results, unhandled errors, races, security holes and documentation that contradicts the code.',
155
155
  'Prove each finding from the code. A guess is not a finding.',
156
156
  ].join('\n');
157
- export function huntPrompt(instructions, ready) {
157
+ export function huntPrompt(instructions, ready, source) {
158
158
  const kept = instructions?.trim() ?? '';
159
- const label = ready === '' ? '' : ` --label "${ready}"`;
159
+ const label = [ready, source]
160
+ .filter((name) => name !== '')
161
+ .map((name) => ` --label "${name}"`)
162
+ .join('');
160
163
  return paragraphs([
161
164
  'You are the hunter. Find the most serious problem in this repository and file one issue for it.',
162
165
  `## Instructions\n${kept === '' ? HUNT_DEFAULT : kept}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "5.6.0",
3
+ "version": "5.6.1",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",