@staff0rd/assist 0.245.3 → 0.246.0
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 +31 -17
- package/package.json +1 -1
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.
|
|
9
|
+
version: "0.246.0",
|
|
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
|
-
|
|
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
|
|
3736
|
+
const { item } = prepared;
|
|
3737
|
+
let { plan: plan2, startPhase } = prepared;
|
|
3733
3738
|
acquireLock(item.id);
|
|
3734
3739
|
try {
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
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
|
}
|
|
@@ -4313,9 +4327,9 @@ async function deleteComment(orm, itemId, commentId) {
|
|
|
4313
4327
|
// src/commands/backlog/web/shared.ts
|
|
4314
4328
|
async function listItems(req, res) {
|
|
4315
4329
|
applyCwdFromReq(req);
|
|
4316
|
-
const
|
|
4317
|
-
const
|
|
4318
|
-
respondJson(res, 200,
|
|
4330
|
+
const q = new URL(req.url ?? "/", "http://localhost").searchParams.get("q");
|
|
4331
|
+
const items2 = q ? await searchBacklog(q) : await loadBacklog();
|
|
4332
|
+
respondJson(res, 200, items2.slice().reverse());
|
|
4319
4333
|
}
|
|
4320
4334
|
async function findItemOr404(res, id) {
|
|
4321
4335
|
const { orm } = await getReady();
|