@staff0rd/assist 0.226.0 → 0.226.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/dist/index.js +106 -87
- 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.226.
|
|
9
|
+
version: "0.226.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1269,6 +1269,63 @@ function findUnblockedTodos(items) {
|
|
|
1269
1269
|
// src/commands/backlog/run.ts
|
|
1270
1270
|
import chalk12 from "chalk";
|
|
1271
1271
|
|
|
1272
|
+
// src/commands/backlog/prepareRun.ts
|
|
1273
|
+
import chalk9 from "chalk";
|
|
1274
|
+
|
|
1275
|
+
// src/commands/backlog/resolvePlan.ts
|
|
1276
|
+
function resolvePlan(item) {
|
|
1277
|
+
if (item.plan && item.plan.length > 0) {
|
|
1278
|
+
return item.plan;
|
|
1279
|
+
}
|
|
1280
|
+
return [
|
|
1281
|
+
{
|
|
1282
|
+
name: "Implement",
|
|
1283
|
+
tasks: item.acceptanceCriteria.map((ac) => ({ task: ac }))
|
|
1284
|
+
}
|
|
1285
|
+
];
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
// src/commands/backlog/prepareRun.ts
|
|
1289
|
+
async function prepareRun(id) {
|
|
1290
|
+
const result = await loadAndFindItem(id);
|
|
1291
|
+
if (!result) return void 0;
|
|
1292
|
+
const { item } = result;
|
|
1293
|
+
const plan2 = resolvePlan(item);
|
|
1294
|
+
const startPhase = (item.currentPhase ?? 1) - 1;
|
|
1295
|
+
if (item.status === "done") {
|
|
1296
|
+
console.log(chalk9.green(`Already done: #${id}: ${item.name}`));
|
|
1297
|
+
return void 0;
|
|
1298
|
+
}
|
|
1299
|
+
if (startPhase > plan2.length) {
|
|
1300
|
+
await setStatus(id, "done");
|
|
1301
|
+
console.log(
|
|
1302
|
+
chalk9.green(`All phases already complete for #${id}: ${item.name}`)
|
|
1303
|
+
);
|
|
1304
|
+
return void 0;
|
|
1305
|
+
}
|
|
1306
|
+
return { item, plan: plan2, startPhase };
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
// src/commands/backlog/executePhase.ts
|
|
1310
|
+
import chalk11 from "chalk";
|
|
1311
|
+
|
|
1312
|
+
// src/shared/spawnClaude.ts
|
|
1313
|
+
import { spawn } from "child_process";
|
|
1314
|
+
function spawnClaude(prompt, options2 = {}) {
|
|
1315
|
+
const args = [prompt];
|
|
1316
|
+
if (options2.allowEdits) {
|
|
1317
|
+
args.push("--permission-mode", "acceptEdits");
|
|
1318
|
+
}
|
|
1319
|
+
const child = spawn("claude", args, {
|
|
1320
|
+
stdio: "inherit"
|
|
1321
|
+
});
|
|
1322
|
+
const done2 = new Promise((resolve15, reject) => {
|
|
1323
|
+
child.on("close", (code) => resolve15(code ?? 0));
|
|
1324
|
+
child.on("error", reject);
|
|
1325
|
+
});
|
|
1326
|
+
return { child, done: done2 };
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1272
1329
|
// src/commands/backlog/buildCommentLines.ts
|
|
1273
1330
|
function buildCommentLines(comments2) {
|
|
1274
1331
|
if (!comments2?.length) return [];
|
|
@@ -1373,41 +1430,9 @@ function buildPhasePrompt(item, phaseNumber, phase) {
|
|
|
1373
1430
|
return buildAuthoredPhasePrompt(item, phaseNumber, phase);
|
|
1374
1431
|
}
|
|
1375
1432
|
|
|
1376
|
-
// src/commands/backlog/buildReviewPhase.ts
|
|
1377
|
-
function buildReviewPhase() {
|
|
1378
|
-
return {
|
|
1379
|
-
name: REVIEW_PHASE_NAME,
|
|
1380
|
-
tasks: [
|
|
1381
|
-
{
|
|
1382
|
-
task: "Verify acceptance criteria, confirm manual checks, mark done, commit, and signal phase-done."
|
|
1383
|
-
}
|
|
1384
|
-
]
|
|
1385
|
-
};
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1388
|
-
// src/commands/backlog/executePhase.ts
|
|
1389
|
-
import chalk10 from "chalk";
|
|
1390
|
-
|
|
1391
|
-
// src/shared/spawnClaude.ts
|
|
1392
|
-
import { spawn } from "child_process";
|
|
1393
|
-
function spawnClaude(prompt, options2 = {}) {
|
|
1394
|
-
const args = [prompt];
|
|
1395
|
-
if (options2.allowEdits) {
|
|
1396
|
-
args.push("--permission-mode", "acceptEdits");
|
|
1397
|
-
}
|
|
1398
|
-
const child = spawn("claude", args, {
|
|
1399
|
-
stdio: "inherit"
|
|
1400
|
-
});
|
|
1401
|
-
const done2 = new Promise((resolve15, reject) => {
|
|
1402
|
-
child.on("close", (code) => resolve15(code ?? 0));
|
|
1403
|
-
child.on("error", reject);
|
|
1404
|
-
});
|
|
1405
|
-
return { child, done: done2 };
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
1433
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
1409
1434
|
import { existsSync as existsSync9, unlinkSync as unlinkSync2 } from "fs";
|
|
1410
|
-
import
|
|
1435
|
+
import chalk10 from "chalk";
|
|
1411
1436
|
|
|
1412
1437
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
1413
1438
|
import enquirer from "enquirer";
|
|
@@ -1477,12 +1502,12 @@ async function resolvePhaseResult(phaseIndex, itemId) {
|
|
|
1477
1502
|
if (signal?.event === "rewind") {
|
|
1478
1503
|
const targetPhase = signal.targetPhase;
|
|
1479
1504
|
const targetPhaseNumber = targetPhase + 1;
|
|
1480
|
-
console.log(
|
|
1505
|
+
console.log(chalk10.yellow(`
|
|
1481
1506
|
Rewinding to phase ${targetPhaseNumber}.`));
|
|
1482
1507
|
return targetPhase;
|
|
1483
1508
|
}
|
|
1484
1509
|
const phaseNumber = phaseIndex + 1;
|
|
1485
|
-
console.log(
|
|
1510
|
+
console.log(chalk10.green(`
|
|
1486
1511
|
Phase ${phaseNumber} completed.`));
|
|
1487
1512
|
return phaseIndex + 1;
|
|
1488
1513
|
}
|
|
@@ -1509,7 +1534,7 @@ async function executePhase(item, phaseIndex, phases, spawnOptions) {
|
|
|
1509
1534
|
const phase = phases[phaseIndex];
|
|
1510
1535
|
const phaseNumber = phaseIndex + 1;
|
|
1511
1536
|
console.log(
|
|
1512
|
-
|
|
1537
|
+
chalk11.bold(
|
|
1513
1538
|
`
|
|
1514
1539
|
--- Phase ${phaseNumber}/${phases.length}: ${phase.name} ---
|
|
1515
1540
|
`
|
|
@@ -1526,41 +1551,54 @@ async function executePhase(item, phaseIndex, phases, spawnOptions) {
|
|
|
1526
1551
|
return await resolvePhaseResult(phaseIndex, item.id);
|
|
1527
1552
|
}
|
|
1528
1553
|
|
|
1529
|
-
// src/commands/backlog/
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
if (item.plan && item.plan.length > 0) {
|
|
1535
|
-
return item.plan;
|
|
1536
|
-
}
|
|
1537
|
-
return [
|
|
1538
|
-
{
|
|
1539
|
-
name: "Implement",
|
|
1540
|
-
tasks: item.acceptanceCriteria.map((ac) => ({ task: ac }))
|
|
1541
|
-
}
|
|
1542
|
-
];
|
|
1554
|
+
// src/commands/backlog/reloadPlan.ts
|
|
1555
|
+
async function reloadPlan(id) {
|
|
1556
|
+
const result = await loadAndFindItem(String(id));
|
|
1557
|
+
if (!result) return void 0;
|
|
1558
|
+
return resolvePlan(result.item);
|
|
1543
1559
|
}
|
|
1544
1560
|
|
|
1545
|
-
// src/commands/backlog/
|
|
1546
|
-
async function
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
}
|
|
1556
|
-
if (startPhase > plan2.length) {
|
|
1557
|
-
await setStatus(id, "done");
|
|
1558
|
-
console.log(
|
|
1559
|
-
chalk11.green(`All phases already complete for #${id}: ${item.name}`)
|
|
1561
|
+
// src/commands/backlog/runPhases.ts
|
|
1562
|
+
async function runPhases(item, startPhase, plan2, spawnOptions) {
|
|
1563
|
+
let phaseIndex = startPhase;
|
|
1564
|
+
let currentPlan = plan2;
|
|
1565
|
+
while (phaseIndex < currentPlan.length) {
|
|
1566
|
+
phaseIndex = await executePhase(
|
|
1567
|
+
item,
|
|
1568
|
+
phaseIndex,
|
|
1569
|
+
currentPlan,
|
|
1570
|
+
spawnOptions
|
|
1560
1571
|
);
|
|
1561
|
-
|
|
1572
|
+
if (phaseIndex < 0) return false;
|
|
1573
|
+
currentPlan = await reloadPlan(item.id) ?? currentPlan;
|
|
1562
1574
|
}
|
|
1563
|
-
return
|
|
1575
|
+
return true;
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
// src/commands/backlog/buildReviewPhase.ts
|
|
1579
|
+
function buildReviewPhase() {
|
|
1580
|
+
return {
|
|
1581
|
+
name: REVIEW_PHASE_NAME,
|
|
1582
|
+
tasks: [
|
|
1583
|
+
{
|
|
1584
|
+
task: "Verify acceptance criteria, confirm manual checks, mark done, commit, and signal phase-done."
|
|
1585
|
+
}
|
|
1586
|
+
]
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
// src/commands/backlog/runReview.ts
|
|
1591
|
+
async function runReview(item, fallbackPlan, spawnOptions) {
|
|
1592
|
+
const plan2 = await reloadPlan(item.id) ?? fallbackPlan;
|
|
1593
|
+
const reviewPhase = buildReviewPhase();
|
|
1594
|
+
const allPhases = [...plan2, reviewPhase];
|
|
1595
|
+
const reviewResult = await executePhase(
|
|
1596
|
+
item,
|
|
1597
|
+
plan2.length,
|
|
1598
|
+
allPhases,
|
|
1599
|
+
spawnOptions
|
|
1600
|
+
);
|
|
1601
|
+
return reviewResult >= 0;
|
|
1564
1602
|
}
|
|
1565
1603
|
|
|
1566
1604
|
// src/commands/backlog/run.ts
|
|
@@ -1603,25 +1641,6 @@ async function ensureDone(id) {
|
|
|
1603
1641
|
} catch {
|
|
1604
1642
|
}
|
|
1605
1643
|
}
|
|
1606
|
-
async function runPhases(item, startPhase, plan2, spawnOptions) {
|
|
1607
|
-
let phaseIndex = startPhase;
|
|
1608
|
-
while (phaseIndex < plan2.length) {
|
|
1609
|
-
phaseIndex = await executePhase(item, phaseIndex, plan2, spawnOptions);
|
|
1610
|
-
if (phaseIndex < 0) return false;
|
|
1611
|
-
}
|
|
1612
|
-
return true;
|
|
1613
|
-
}
|
|
1614
|
-
async function runReview(item, plan2, spawnOptions) {
|
|
1615
|
-
const reviewPhase = buildReviewPhase();
|
|
1616
|
-
const allPhases = [...plan2, reviewPhase];
|
|
1617
|
-
const reviewResult = await executePhase(
|
|
1618
|
-
item,
|
|
1619
|
-
plan2.length,
|
|
1620
|
-
allPhases,
|
|
1621
|
-
spawnOptions
|
|
1622
|
-
);
|
|
1623
|
-
return reviewResult >= 0;
|
|
1624
|
-
}
|
|
1625
1644
|
|
|
1626
1645
|
// src/commands/backlog/next.ts
|
|
1627
1646
|
function toChoice(item, items) {
|