next-issue 6.0.1 → 6.0.2

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
@@ -510,21 +510,23 @@ The watch stops:
510
510
 
511
511
  ## Hunt for bugs
512
512
 
513
- With `--hunt`, which turns on `--watch`, the harness runs a hunter agent at the same time as the issues. Before each hunt it reads the open issues with the `labels.ready` label and counts those that are ready to claim, have no open blocker and are not running. It hunts only while that count is less than `huntCap`, 1 by default. Otherwise it waits and checks again, with the same back-off as the watch: 1, 2, 3, 5, 10, then 10 minutes, back to 1 minute after a hunt. Each wait writes a `hunt.wait` event with the `minutes` to the run log. A hunt that files nothing does not stop the next one. The hunter:
513
+ With `--hunt`, which turns on `--watch`, the harness runs a hunter agent at the same time as the issues. Before each hunt it reads the open issues with the `labels.ready` label and counts those that are ready to claim, have no open blocker and are not running. It hunts only while that count is less than `huntCap`, 1 by default. Otherwise it waits and checks again, with the same back-off as the watch: 1, 2, 3, 5, 10, then 10 minutes, back to 1 minute after a hunt that succeeds. Each wait writes a `hunt.wait` event with the `minutes` to the run log. A hunt that files nothing does not stop the next one. The hunter:
514
514
 
515
515
  - works in its own worktree at `.worktrees/hunt`, at the remote base branch, which the harness fetches and resets before each hunt;
516
516
  - follows `next-issue.hunt.md` in the repository root, or a short built-in prompt when the file is missing;
517
517
  - 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;
518
518
  - runs no test suite and changes no file. It gets the tools of the reviewer.
519
519
 
520
- 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.
520
+ 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 hunter then waits before the next hunt, with a `hunt.wait` event and the same back-off, so a failure that repeats waits 1, 2, 3, 5, 10, then 10 minutes, and the back-off goes back to 1 minute after a hunt that succeeds. 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.
521
521
 
522
522
  ## Worker
523
523
 
524
524
  `next-issue serve` runs one worker for the repository it is run in. The
525
525
  [`@ravshansbox/pi-next-issue`](../pi-next-issue) extension starts it and talks
526
- to it. Each repository has its own worker, so the runs, restarts and upgrades
527
- of one repository never affect another. The worker:
526
+ to it. `serve` takes no flags apart from `--help` and refuses any other with
527
+ an error, because runs start from a client, not from `serve`. Each repository
528
+ has its own worker, so the runs, restarts and upgrades of one repository never
529
+ affect another. The worker:
528
530
 
529
531
  - listens with WebSocket on the socket file `.next-issue/worker.sock` in the
530
532
  repository. Only your user can open the file. It works on macOS and Linux.
package/dist/args.mjs CHANGED
@@ -42,8 +42,12 @@ export function parseArgs(argv) {
42
42
  hunt: false,
43
43
  level: 'normal',
44
44
  };
45
+ let flag;
45
46
  for (let index = 0; index < argv.length; index += 1) {
46
47
  const arg = argv[index];
48
+ if (index !== 0 && arg !== '--help') {
49
+ flag ??= arg;
50
+ }
47
51
  if (index === 0 && !arg.startsWith('-')) {
48
52
  args.command = command(arg);
49
53
  }
@@ -60,6 +64,9 @@ export function parseArgs(argv) {
60
64
  throw new Error(`Unknown argument: ${arg}`);
61
65
  }
62
66
  }
67
+ if (args.command === 'serve' && !args.help && flag !== undefined) {
68
+ throw new Error(`serve does not take ${flag}`);
69
+ }
63
70
  args.watch ||= args.hunt;
64
71
  return args;
65
72
  }
package/dist/hunt.mjs CHANGED
@@ -55,7 +55,11 @@ export function hunter(context) {
55
55
  hunt: async () => {
56
56
  hunting = true;
57
57
  try {
58
- await hunt(context).catch(() => undefined);
58
+ await hunt(context);
59
+ return true;
60
+ }
61
+ catch {
62
+ return false;
59
63
  }
60
64
  finally {
61
65
  hunting = false;
package/dist/watch.mjs CHANGED
@@ -31,9 +31,10 @@ async function huntIssues(hunter, running, stopped, signal) {
31
31
  const ready = await hunter.ready().catch(() => undefined);
32
32
  const waiting = ready?.filter((issue) => !running.has(issue.number)).length;
33
33
  if (waiting !== undefined && waiting < hunter.cap) {
34
- step = 0;
35
- await hunter.hunt();
36
- continue;
34
+ if (await hunter.hunt()) {
35
+ step = 0;
36
+ continue;
37
+ }
37
38
  }
38
39
  await hunter.wait(backOffMinutes(step), signal);
39
40
  step += 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",