next-issue 12.4.1 → 12.4.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
@@ -231,7 +231,7 @@ With no file, every field keeps its default. A field that is not in the file kee
231
231
  | `diffMaxChars` | `60000` | The maximum length of the diff that the reviewer reads |
232
232
  | `huntCap` | `1` | With `--hunt on`, the hunter hunts only while fewer ready issues than this wait besides the running ones |
233
233
  | `ignoredChecks` | `[]` | Names of GitHub Actions jobs, check runs and commit statuses, such as `release`, that the checks on the base branch do not wait for and whose failure does not count, unless GitHub cancels or skips another job of its run |
234
- | `issueLimit` | `100` | The maximum number of open issues to read. With `labels.ready` set, only issues with the ready, in-progress or in-review label count |
234
+ | `issueLimit` | `100` | The most open issues to read, oldest first. With `labels.ready` set, only ready, in-progress or in-review issues with no needs-human or skip label count; ready issues that wait for a person are read apart |
235
235
  | `keepRunDays` | `7` | The number of days to keep the run files; `0` keeps them all |
236
236
  | `labels` | see above | The names of the labels that the harness reads and sets |
237
237
  | `logMaxChars` | `20000` | The maximum length of the failed job logs, shared between the failed GitHub Actions runs (failed external checks are listed by name and link only) |
package/dist/github.mjs CHANGED
@@ -15,19 +15,22 @@ function toIssue(item) {
15
15
  labels: names(item.labels),
16
16
  };
17
17
  }
18
- function labelFilter(labels) {
19
- return labels.length === 0
20
- ? ''
21
- : ` label:${labels.map((label) => `"${label.replace(/[\\"]/g, '\\$&')}"`).join(',')}`;
18
+ function quoted(label) {
19
+ return `"${label.replace(/[\\"]/g, '\\$&')}"`;
22
20
  }
23
- export async function openIssues(repo, limit, labels) {
21
+ function labelFilter(labels, without, every) {
22
+ const any = labels.length === 0 ? '' : ` label:${labels.map(quoted).join(',')}`;
23
+ const all = every.map((label) => ` label:${quoted(label)}`).join('');
24
+ return any + all + without.map((label) => ` -label:${quoted(label)}`).join('');
25
+ }
26
+ export async function openIssues(repo, limit, labels, without = [], every = []) {
24
27
  const parsed = await ghJson(repo, [
25
28
  'issue',
26
29
  'list',
27
30
  '--state',
28
31
  'open',
29
32
  '--search',
30
- `sort:created-asc${labelFilter(labels)}`,
33
+ `sort:created-asc${labelFilter(labels, without, every)}`,
31
34
  '--limit',
32
35
  String(limit),
33
36
  '--json',
package/dist/hunt.mjs CHANGED
@@ -9,7 +9,7 @@ import { git, gitFetch, remoteRef } from './git.mjs';
9
9
  import { withNotes } from './job.mjs';
10
10
  import { oneAtATime } from './lock.mjs';
11
11
  import { huntPrompt } from './prompts.mjs';
12
- import { skipReason } from './skip.mjs';
12
+ import { listedIssues, skipReason } from './skip.mjs';
13
13
  import { huntPath } from './worktree.mjs';
14
14
  export const HUNT_FILE = 'next-issue.hunt.md';
15
15
  const FILED = /^issue:[^\S\r\n]*(\S+)[^\S\r\n]*$/gm;
@@ -71,13 +71,11 @@ export async function hunt(context, count) {
71
71
  }
72
72
  export function hunter(context) {
73
73
  const { repo, config, recorder, ports } = context;
74
- const { ready } = config.labels;
75
- const labels = ready.length === 0 ? [] : [ready];
76
74
  let hunting = false;
77
75
  return {
78
76
  cap: config.huntCap,
79
77
  ready: async (running, failed) => {
80
- const open = (await ports.openIssues(repo, config.issueLimit, labels)).filter((issue) => !failed.has(issue.number) && skipReason(issue, config, false) === undefined);
78
+ const open = (await listedIssues(ports, repo, config, [])).filter((issue) => !failed.has(issue.number) && skipReason(issue, config, false) === undefined);
81
79
  const claimable = new Set(open.map((issue) => issue.number));
82
80
  const blockers = [];
83
81
  for (const issue of open) {
package/dist/pending.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { errorMatches, message } from './errors.mjs';
2
+ import { listedIssues, waitingIssues } from './skip.mjs';
2
3
  import { readState, savedIssues, writeState } from './state.mjs';
3
4
  import { blocksLanding, heldOnBase } from './unsettled.mjs';
4
5
  /**
@@ -8,10 +9,15 @@ import { blocksLanding, heldOnBase } from './unsettled.mjs';
8
9
  const ISSUE_GONE = /Could not resolve to an issue or pull request|HTTP 404/;
9
10
  export async function pendingIssues(context) {
10
11
  const { repo, config, ports } = context;
11
- const { ready, inProgress, inReview } = config.labels;
12
- const labels = ready.length === 0 ? [] : [ready, inProgress, inReview];
13
- const issues = await ports.openIssues(repo, config.issueLimit, labels);
12
+ const { inProgress, inReview } = config.labels;
13
+ const issues = await listedIssues(ports, repo, config, [inProgress, inReview]);
14
14
  const listed = new Set(issues.map((issue) => issue.number));
15
+ for (const issue of await waitingIssues(ports, repo, config)) {
16
+ if (!listed.has(issue.number)) {
17
+ listed.add(issue.number);
18
+ issues.push(issue);
19
+ }
20
+ }
15
21
  let openCount = issues.length;
16
22
  const saved = await savedIssues(repo);
17
23
  for (const number of saved) {
package/dist/skip.mjs CHANGED
@@ -6,6 +6,19 @@ import { stopNow } from './handover.mjs';
6
6
  import { hasLabel } from './labels.mjs';
7
7
  import { heldByPerson, writeState } from './state.mjs';
8
8
  import { heldOnBase } from './unsettled.mjs';
9
+ export function listedIssues(ports, repo, config, labels) {
10
+ const { ready, needsHuman, skip } = config.labels;
11
+ return ready.length === 0
12
+ ? ports.openIssues(repo, config.issueLimit, [])
13
+ : ports.openIssues(repo, config.issueLimit, [ready, ...labels], [needsHuman, skip]);
14
+ }
15
+ export function waitingIssues(ports, repo, config) {
16
+ const { ready, needsHuman, skip } = config.labels;
17
+ if (ready.length === 0) {
18
+ return Promise.resolve([]);
19
+ }
20
+ return ports.openIssues(repo, config.issueLimit, [needsHuman], [skip], [ready]);
21
+ }
9
22
  export function skipReason(issue, config, resuming, answered = false) {
10
23
  const has = (name) => hasLabel(issue.labels, name);
11
24
  const names = config.labels;
package/dist/upcoming.mjs CHANGED
@@ -3,12 +3,11 @@ import { message } from './errors.mjs';
3
3
  import { detectRepo } from './git.mjs';
4
4
  import { PORTS } from './ports.mjs';
5
5
  import { send } from './questions.mjs';
6
- import { skipReason } from './skip.mjs';
6
+ import { listedIssues, skipReason } from './skip.mjs';
7
7
  import { savedIssues } from './state.mjs';
8
8
  /** The fresh issues the worker would claim, oldest first as it claims them; issues with saved state resume instead. */
9
9
  export async function upcomingIssues(repo, config, ports) {
10
- const { ready } = config.labels;
11
- const issues = await ports.openIssues(repo, config.issueLimit, ready.length === 0 ? [] : [ready]);
10
+ const issues = await listedIssues(ports, repo, config, []);
12
11
  const saved = new Set(await savedIssues(repo));
13
12
  const upcoming = { claimable: [], blocked: [] };
14
13
  for (const issue of issues) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "12.4.1",
3
+ "version": "12.4.2",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",