next-issue 6.6.62 → 6.6.63

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
@@ -619,7 +619,7 @@ With `--hunt`, which turns on `--watch`, the harness runs a hunter agent at the
619
619
  - 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. It files and searches with `gh --repo <owner>/<name>` of the configured `remote`, so another GitHub remote, such as `upstream` in a fork, never gets its issues. The `labels.hunt` label, `source:hunt` by default, marks the issue as one the hunter filed. The harness creates the `labels.ready` and `labels.hunt` labels before the hunt when they are missing. It compares label names without case, as GitHub does, so a label that exists in another case, such as `Source:Hunt`, counts as there and keeps its name. When the create fails, it reads the labels again, so a label that someone else created meanwhile counts as there too. It files nothing when it finds no real problem or a duplicate exists;
620
620
  - runs no test suite and changes no file. It gets the tools of the reviewer.
621
621
 
622
- 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; a url that is not an issue of the repository of `remote` does not count as filed, 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.
622
+ 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; a url that is not an issue of the repository of `remote` does not count as filed. When the `remote` url holds an old owner or name that GitHub redirects after a rename or transfer, the harness asks GitHub for the new one, so an issue url with the new name counts too. 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.
623
623
 
624
624
  ## Worker
625
625
 
package/dist/github.mjs CHANGED
@@ -74,6 +74,9 @@ export async function openBlockers(repo, issue) {
74
74
  return prefix === undefined ? ref : ref.slice(prefix.length - 1);
75
75
  });
76
76
  }
77
+ export async function repositorySlug(repo) {
78
+ return repeatable(repo, ['api', `repos/${slug(repo)}`, '--jq', '.full_name']);
79
+ }
77
80
  export async function reopenIssue(repo, issue) {
78
81
  await gh(repo, ['issue', 'reopen', String(issue)]);
79
82
  }
package/dist/hunt.mjs CHANGED
@@ -27,9 +27,22 @@ export async function huntWorktree(repo, base, remote) {
27
27
  }
28
28
  return path;
29
29
  }
30
- function isIssueOf(repo, url) {
31
- const issue = /^https:\/\/github\.com\/([^/]+\/[^/]+)\/issues\/\d+\/?$/i.exec(url);
32
- return issue?.[1]?.toLowerCase() === slug(repo).toLowerCase();
30
+ function issueSlug(url) {
31
+ return /^https:\/\/github\.com\/([^/]+\/[^/]+)\/issues\/\d+\/?$/i.exec(url)?.[1]?.toLowerCase();
32
+ }
33
+ async function issuesOf(context, urls) {
34
+ const found = urls.flatMap((url) => {
35
+ const repository = issueSlug(url);
36
+ return repository === undefined ? [] : [{ url, repository }];
37
+ });
38
+ const slugs = [slug(context.repo).toLowerCase()];
39
+ if (found.some(({ repository }) => !slugs.includes(repository))) {
40
+ const canonical = await context.ports.repositorySlug(context.repo).catch(() => undefined);
41
+ if (canonical !== undefined) {
42
+ slugs.push(canonical.trim().toLowerCase());
43
+ }
44
+ }
45
+ return found.filter(({ repository }) => slugs.includes(repository)).map(({ url }) => url);
33
46
  }
34
47
  export async function hunt(context, count) {
35
48
  const { repo, config, base, recorder, ports } = context;
@@ -48,9 +61,7 @@ export async function hunt(context, count) {
48
61
  profile: REVIEWING,
49
62
  timeoutMs: minutesToMs(config.agentTimeoutMinutes),
50
63
  });
51
- const urls = [...result.text.matchAll(FILED)]
52
- .map((match) => match[1])
53
- .filter((url) => isIssueOf(repo, url));
64
+ const urls = await issuesOf(context, [...result.text.matchAll(FILED)].map((match) => match[1]));
54
65
  for (const url of urls.length === 0 ? ['none'] : urls) {
55
66
  recorder.event('hunt.issue', { url }, 'quiet');
56
67
  }
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 { deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject, push, resetToBase, revision, setAside, } from './git.mjs';
8
- import { canWrite, closeIssue, commentOnIssue, issueComments, openBlockers, openIssues, reopenIssue, threadComments, viewIssue, } from './github.mjs';
8
+ import { canWrite, closeIssue, commentOnIssue, 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';
@@ -43,6 +43,7 @@ export const PORTS = {
43
43
  reapplyRevert,
44
44
  removeWorktree,
45
45
  reopenIssue,
46
+ repositorySlug,
46
47
  rerunFailedBase,
47
48
  resetToBase,
48
49
  revertOnBase,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.62",
3
+ "version": "6.6.63",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",