@staff0rd/assist 0.245.2 → 0.245.4

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/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.245.2",
9
+ version: "0.245.4",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -3424,6 +3424,13 @@ async function prepareRun(id) {
3424
3424
  return { item, plan: plan2, startPhase };
3425
3425
  }
3426
3426
 
3427
+ // src/commands/backlog/reloadPlan.ts
3428
+ async function reloadPlan(id) {
3429
+ const found = await findOneItem(String(id));
3430
+ if (!found) return void 0;
3431
+ return resolvePlan(found.item);
3432
+ }
3433
+
3427
3434
  // src/commands/backlog/executePhase.ts
3428
3435
  import chalk34 from "chalk";
3429
3436
 
@@ -3669,13 +3676,6 @@ async function executePhase(item, phaseIndex, phases, spawnOptions) {
3669
3676
  return await resolvePhaseResult(phaseIndex, item.id);
3670
3677
  }
3671
3678
 
3672
- // src/commands/backlog/reloadPlan.ts
3673
- async function reloadPlan(id) {
3674
- const found = await findOneItem(String(id));
3675
- if (!found) return void 0;
3676
- return resolvePlan(found.item);
3677
- }
3678
-
3679
3679
  // src/commands/backlog/runPhases.ts
3680
3680
  async function runPhases(item, startPhase, plan2, spawnOptions) {
3681
3681
  let phaseIndex = startPhase;
@@ -3716,7 +3716,11 @@ async function runReview(item, fallbackPlan, spawnOptions) {
3716
3716
  allPhases,
3717
3717
  spawnOptions
3718
3718
  );
3719
- return reviewResult >= 0;
3719
+ if (reviewResult < 0) return { kind: "abort" };
3720
+ if (reviewResult < plan2.length) {
3721
+ return { kind: "rewind", targetPhase: reviewResult };
3722
+ }
3723
+ return { kind: "done" };
3720
3724
  }
3721
3725
 
3722
3726
  // src/commands/backlog/run.ts
@@ -3729,13 +3733,23 @@ async function run2(id, spawnOptions) {
3729
3733
  return runPrepared(id, prepared, spawnOptions);
3730
3734
  }
3731
3735
  async function runPrepared(id, prepared, spawnOptions) {
3732
- const { item, plan: plan2, startPhase } = prepared;
3736
+ const { item } = prepared;
3737
+ let { plan: plan2, startPhase } = prepared;
3733
3738
  acquireLock(item.id);
3734
3739
  try {
3735
- if (!await runPhases(item, startPhase, plan2, spawnOptions)) return false;
3736
- if (!await runReview(item, plan2, spawnOptions)) return false;
3737
- await ensureDone(id);
3738
- return true;
3740
+ while (true) {
3741
+ if (!await runPhases(item, startPhase, plan2, spawnOptions))
3742
+ return false;
3743
+ const review2 = await runReview(item, plan2, spawnOptions);
3744
+ if (review2.kind === "abort") return false;
3745
+ if (review2.kind === "rewind") {
3746
+ startPhase = review2.targetPhase;
3747
+ plan2 = await reloadPlan(item.id) ?? plan2;
3748
+ continue;
3749
+ }
3750
+ await ensureDone(id);
3751
+ return true;
3752
+ }
3739
3753
  } finally {
3740
3754
  releaseLock(item.id);
3741
3755
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.245.2",
3
+ "version": "0.245.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {