@ravshansbox/pi-next-issue 1.0.12 → 1.0.13

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
@@ -22,7 +22,7 @@ The run does not belong to a session: it goes on after `/new`, `/resume`, a fork
22
22
 
23
23
  ## What it does
24
24
 
25
- Each loop fetches the 200 oldest open issues with the `status:todo` label and none of `status:in-progress`, `status:done`, `status:needs-human` or `status:blocked`, and the open issues with saved state that it can read. It takes the oldest one with saved state, else the oldest one with the `status:todo` label and none of `status:in-progress`, `status:done`, `status:needs-human` or `status:blocked`. The run ends when no such issue is left, or at the first error. For each issue:
25
+ Each loop fetches the 200 oldest open issues with the `status:todo` label and none of `status:in-progress`, `status:done`, `status:needs-human` or `status:blocked`, and the open issues with saved state that it can read. It takes the oldest one with saved state and none of `status:done`, `status:needs-human` or `status:blocked`, else the oldest one with the `status:todo` label and none of `status:in-progress`, `status:done`, `status:needs-human` or `status:blocked`. The run ends when no such issue is left, or at the first error. For each issue:
26
26
 
27
27
  1. Swap `status:todo` for `status:in-progress`.
28
28
  2. Add a git worktree at `.worktrees/<n>` on the `<n>` branch, from the remote default branch.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ravshansbox/pi-next-issue",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Pi extension that works through GitHub issues in the background",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/runner.ts CHANGED
@@ -99,6 +99,10 @@ function ready(issue: Issue): boolean {
99
99
  );
100
100
  }
101
101
 
102
+ function resumable(issue: Issue): boolean {
103
+ return !issue.labels.some((label) => label !== LABELS.inProgress && STOP_LABELS.includes(label));
104
+ }
105
+
102
106
  export class Runner {
103
107
  progress: Progress = { status: 'idle', tools: 0, handled: [] };
104
108
  private readonly controller = new AbortController();
@@ -137,7 +141,8 @@ export class Runner {
137
141
  const saved = new Set(await this.ports.savedIssues());
138
142
  const fresh = issues.filter((item) => !seen.has(item.number));
139
143
  const next =
140
- fresh.find((item) => saved.has(item.number)) ?? fresh.find((item) => ready(item));
144
+ fresh.find((item) => saved.has(item.number) && resumable(item)) ??
145
+ fresh.find((item) => ready(item));
141
146
  if (next === undefined) {
142
147
  this.update({ status: 'finished', stage: undefined, issue: undefined, title: undefined });
143
148
  return;