next-issue 2.2.0 → 2.3.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
@@ -445,7 +445,8 @@ workflow reads the commits since the last tag and picks the bump: `feat` gives a
445
445
  minor, `fix` gives a patch, and a `!` mark or a `BREAKING CHANGE` body gives a
446
446
  major. Any other type releases nothing.
447
447
 
448
- The workflow then bumps the version and publishes the package to npm with a
448
+ The workflow then gives `next-issue` and `@ravshansbox/pi-next-issue` the same
449
+ new version and publishes both packages to npm with a
449
450
  [trusted publish](https://docs.npmjs.com/trusted-publishers), so no token is
450
451
  stored. Only after the publish does it push the tag and make the GitHub release,
451
452
  so a failed publish leaves no half-release behind. A manual run of the workflow
package/dist/github.mjs CHANGED
@@ -145,23 +145,23 @@ export function prNumber(output) {
145
145
  const match = /\/pull\/(\d+)\b/.exec(output);
146
146
  return match === null ? undefined : Number(match[1]);
147
147
  }
148
- async function prHead(repo, branch) {
149
- return gh(repo, ["pr", "view", branch, "--json", "headRefOid", "--jq", ".headRefOid"]);
148
+ async function prHead(repo, pr) {
149
+ return gh(repo, ["pr", "view", String(pr), "--json", "headRefOid", "--jq", ".headRefOid"]);
150
150
  }
151
- async function readChecks(repo, branch) {
152
- const result = await run("gh", ["pr", "checks", branch, "--json", "name,bucket,link,description", "--repo", slug(repo)], { cwd: repo.root });
151
+ async function readChecks(repo, pr) {
152
+ const result = await run("gh", ["pr", "checks", String(pr), "--json", "name,bucket,link,description", "--repo", slug(repo)], { cwd: repo.root });
153
153
  const output = result.stdout.trim();
154
154
  if (output.length === 0) {
155
155
  if (NO_CHECKS.test(result.stderr)) {
156
156
  return "none";
157
157
  }
158
- throw new Error(`gh pr checks ${branch} failed with code ${result.code}: ${result.stderr.trim()}`);
158
+ throw new Error(`gh pr checks ${pr} failed with code ${result.code}: ${result.stderr.trim()}`);
159
159
  }
160
160
  const checks = JSON.parse(output);
161
161
  return checks.length === 0 ? "none" : checks;
162
162
  }
163
- async function watchOnce(repo, branch, intervalSeconds, timeoutMs, show) {
164
- const watch = await run("gh", ["pr", "checks", branch, "--watch", "--fail-fast", "--interval", String(intervalSeconds), "--repo", slug(repo)], { cwd: repo.root, show, timeoutMs });
163
+ async function watchOnce(repo, pr, intervalSeconds, timeoutMs, show) {
164
+ const watch = await run("gh", ["pr", "checks", String(pr), "--watch", "--fail-fast", "--interval", String(intervalSeconds), "--repo", slug(repo)], { cwd: repo.root, show, timeoutMs });
165
165
  if (watch.timedOut) {
166
166
  return "timeout";
167
167
  }
@@ -171,11 +171,11 @@ async function watchOnce(repo, branch, intervalSeconds, timeoutMs, show) {
171
171
  if (watch.code === CHECK_PENDING_CODE) {
172
172
  return "pending";
173
173
  }
174
- const checks = await readChecks(repo, branch);
174
+ const checks = await readChecks(repo, pr);
175
175
  if (checks !== "none" && checks.some((check) => check.bucket === "fail")) {
176
176
  return "fail";
177
177
  }
178
- throw new Error(`gh pr checks ${branch} --watch failed with code ${watch.code} and no check failed: ${watch.stderr.trim()}`);
178
+ throw new Error(`gh pr checks ${pr} --watch failed with code ${watch.code} and no check failed: ${watch.stderr.trim()}`);
179
179
  }
180
180
  const REAL_CLOCK = {
181
181
  now: () => Date.now(),
@@ -224,17 +224,17 @@ async function read(probe, head, timeoutMs, shown) {
224
224
  return error instanceof Error ? error : new Error(String(error));
225
225
  }
226
226
  }
227
- export function waitForChecks(repo, branch, options) {
227
+ export function waitForChecks(repo, pr, options) {
228
228
  return pollChecks({
229
- head: () => prHead(repo, branch),
230
- list: async () => ((await readChecks(repo, branch)) === "none" ? "none" : "some"),
231
- watch: (timeoutMs) => watchOnce(repo, branch, options.intervalSeconds, timeoutMs, options.show),
229
+ head: () => prHead(repo, pr),
230
+ list: async () => ((await readChecks(repo, pr)) === "none" ? "none" : "some"),
231
+ watch: (timeoutMs) => watchOnce(repo, pr, options.intervalSeconds, timeoutMs, options.show),
232
232
  }, options);
233
233
  }
234
- export async function failedCheckLogs(repo, branch, maxChars) {
235
- const checks = await readChecks(repo, branch);
234
+ export async function failedCheckLogs(repo, pr, maxChars) {
235
+ const checks = await readChecks(repo, pr);
236
236
  if (checks === "none") {
237
- return "The checks failed, but gh reports no check for the branch.";
237
+ return "The checks failed, but gh reports no check for the pull request.";
238
238
  }
239
239
  const failed = checks
240
240
  .filter((check) => check.bucket === "fail")
package/dist/pipeline.mjs CHANGED
@@ -256,10 +256,10 @@ async function openPr(job) {
256
256
  log.event("pull-request.ready", { pr }, "quiet");
257
257
  }
258
258
  async function checkGate(job) {
259
- const { context, log, state, branch, worktree } = job;
259
+ const { context, log, state, worktree } = job;
260
260
  const { repo, config, ports } = context;
261
261
  const head = await ports.revision(worktree);
262
- const checks = await log.step("checks", { pr: state.pr, head }, () => ports.waitForChecks(repo, branch, {
262
+ const checks = await log.step("checks", { pr: state.pr, head }, () => ports.waitForChecks(repo, state.pr, {
263
263
  head,
264
264
  intervalSeconds: config.checkIntervalSeconds,
265
265
  graceMs: job.noChecks ? 0 : config.checkGraceSeconds * 1000,
@@ -281,7 +281,7 @@ async function checkGate(job) {
281
281
  }
282
282
  state.ciFixes += 1;
283
283
  await writeState(repo, state);
284
- const logs = await ports.failedCheckLogs(repo, branch, config.logMaxChars);
284
+ const logs = await ports.failedCheckLogs(repo, state.pr, config.logMaxChars);
285
285
  log.event("checks.logs", { chars: logs.length });
286
286
  const fix = await fixRound(job, "The continuous integration checks failed.", logs, history(state.reviewLog), "checks");
287
287
  if (!fix.committed) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",
@@ -10,11 +10,12 @@
10
10
  "automation",
11
11
  "cli"
12
12
  ],
13
- "homepage": "https://github.com/ravshansbox/next-issue#readme",
13
+ "homepage": "https://github.com/ravshansbox/next-issue/tree/main/packages/next-issue#readme",
14
14
  "bugs": "https://github.com/ravshansbox/next-issue/issues",
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "git+https://github.com/ravshansbox/next-issue.git"
17
+ "url": "git+https://github.com/ravshansbox/next-issue.git",
18
+ "directory": "packages/next-issue"
18
19
  },
19
20
  "license": "MIT",
20
21
  "author": "ravshansbox",