@staff0rd/assist 0.157.0 → 0.158.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.
Files changed (2) hide show
  1. package/dist/index.js +100 -75
  2. 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.157.0",
9
+ version: "0.158.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -244,6 +244,18 @@ async function done(id, summary) {
244
244
  import chalk9 from "chalk";
245
245
  import enquirer2 from "enquirer";
246
246
 
247
+ // src/shared/exitOnCancel.ts
248
+ async function exitOnCancel(promise) {
249
+ try {
250
+ return await promise;
251
+ } catch (err) {
252
+ if (err === "" || err === void 0) {
253
+ process.exit(0);
254
+ }
255
+ throw err;
256
+ }
257
+ }
258
+
247
259
  // src/commands/backlog/list/shared.ts
248
260
  import chalk4 from "chalk";
249
261
  function statusIcon(status2) {
@@ -400,12 +412,14 @@ import chalk5 from "chalk";
400
412
  // src/commands/backlog/handleIncompletePhase.ts
401
413
  import enquirer from "enquirer";
402
414
  async function handleIncompletePhase() {
403
- const { action } = await enquirer.prompt({
404
- type: "select",
405
- name: "action",
406
- message: "Phase was not marked complete. What would you like to do?",
407
- choices: ["Retry this phase", "Skip to next phase", "Abort"]
408
- });
415
+ const { action } = await exitOnCancel(
416
+ enquirer.prompt({
417
+ type: "select",
418
+ name: "action",
419
+ message: "Phase was not marked complete. What would you like to do?",
420
+ choices: ["Retry this phase", "Skip to next phase", "Abort"]
421
+ })
422
+ );
409
423
  if (action === "Retry this phase") return "retry";
410
424
  if (action === "Skip to next phase") return "skip";
411
425
  return "abort";
@@ -554,15 +568,16 @@ function prepareRun(id) {
554
568
  // src/commands/backlog/run.ts
555
569
  async function run(id, spawnOptions) {
556
570
  const prepared = prepareRun(id);
557
- if (!prepared) return;
571
+ if (!prepared) return false;
558
572
  const { item, plan: plan2, startPhase } = prepared;
559
573
  setStatus(id, "in-progress");
560
574
  logProgress(id, item.name, startPhase, plan2.length);
561
- if (!await runPhases(item, startPhase, plan2, spawnOptions)) return;
562
- if (!await runReview(item, plan2, spawnOptions)) return;
575
+ if (!await runPhases(item, startPhase, plan2, spawnOptions)) return false;
576
+ if (!await runReview(item, plan2, spawnOptions)) return false;
563
577
  ensureDone(id);
564
578
  console.log(chalk8.green(`
565
579
  All phases complete for #${id}: ${item.name}`));
580
+ return true;
566
581
  }
567
582
  function logProgress(id, name, startPhase, total) {
568
583
  console.log(chalk8.bold(`Running plan for #${id}: ${name}`));
@@ -601,42 +616,48 @@ async function runReview(item, plan2, spawnOptions) {
601
616
  }
602
617
 
603
618
  // src/commands/backlog/next.ts
619
+ async function selectItem(todo) {
620
+ const choices = todo.map((i) => `${typeLabel(i.type)} #${i.id}: ${i.name}`);
621
+ const { selected } = await exitOnCancel(
622
+ enquirer2.prompt({
623
+ type: "select",
624
+ name: "selected",
625
+ message: "Choose a backlog item to start:",
626
+ choices
627
+ })
628
+ );
629
+ return selected.match(/#(\d+)/)?.[1] ?? "";
630
+ }
604
631
  async function next(options2) {
605
- const items = loadBacklog();
606
- const inProgress = items.find((i) => i.status === "in-progress" && i.plan);
607
- if (inProgress) {
608
- console.log(
609
- chalk9.bold(
610
- `Resuming in-progress item #${inProgress.id}: ${inProgress.name}`
611
- )
612
- );
613
- await run(String(inProgress.id), options2);
614
- return;
615
- }
616
- const todo = items.filter((i) => i.status === "todo");
617
- if (todo.length === 0) {
618
- console.log(chalk9.dim("No incomplete backlog items. Opening /draft..."));
619
- await spawnClaude("/draft", options2);
620
- return;
621
- }
622
- if (todo.length === 1) {
623
- const only = todo[0];
624
- console.log(chalk9.bold(`Starting #${only.id}: ${only.name}`));
625
- await run(String(only.id), options2);
626
- return;
632
+ while (true) {
633
+ const items = loadBacklog();
634
+ const inProgress = items.find((i) => i.status === "in-progress" && i.plan);
635
+ if (inProgress) {
636
+ console.log(
637
+ chalk9.bold(
638
+ `Resuming in-progress item #${inProgress.id}: ${inProgress.name}`
639
+ )
640
+ );
641
+ const completed2 = await run(String(inProgress.id), options2);
642
+ if (!completed2) return;
643
+ continue;
644
+ }
645
+ const todo = items.filter((i) => i.status === "todo");
646
+ if (todo.length === 0) {
647
+ console.log(chalk9.green("All backlog items complete."));
648
+ return;
649
+ }
650
+ let id;
651
+ if (todo.length === 1) {
652
+ const only = todo[0];
653
+ console.log(chalk9.bold(`Starting #${only.id}: ${only.name}`));
654
+ id = String(only.id);
655
+ } else {
656
+ id = await selectItem(todo);
657
+ }
658
+ const completed = await run(id, options2);
659
+ if (!completed) return;
627
660
  }
628
- const choices = todo.map((i) => ({
629
- name: `${typeLabel(i.type)} #${i.id}: ${i.name}`,
630
- value: String(i.id)
631
- }));
632
- const { selected } = await enquirer2.prompt({
633
- type: "select",
634
- name: "selected",
635
- message: "Choose a backlog item to start:",
636
- choices: choices.map((c) => c.name)
637
- });
638
- const id = selected.match(/#(\d+)/)?.[1] ?? "";
639
- await run(id, options2);
640
661
  }
641
662
 
642
663
  // src/commands/backlog/phaseDone.ts
@@ -1422,22 +1443,24 @@ import chalk33 from "chalk";
1422
1443
  import chalk19 from "chalk";
1423
1444
  import enquirer3 from "enquirer";
1424
1445
  async function promptMultiselect(message, options2) {
1425
- const { selected } = await enquirer3.prompt({
1426
- type: "multiselect",
1427
- name: "selected",
1428
- message,
1429
- choices: options2.map((opt) => ({
1430
- name: opt.value,
1431
- message: `${opt.name} - ${chalk19.dim(opt.description)}`
1432
- })),
1433
- // @ts-expect-error - enquirer types don't include symbols but it's supported
1434
- symbols: {
1435
- indicator: {
1436
- on: "[x]",
1437
- off: "[ ]"
1446
+ const { selected } = await exitOnCancel(
1447
+ enquirer3.prompt({
1448
+ type: "multiselect",
1449
+ name: "selected",
1450
+ message,
1451
+ choices: options2.map((opt) => ({
1452
+ name: opt.value,
1453
+ message: `${opt.name} - ${chalk19.dim(opt.description)}`
1454
+ })),
1455
+ // @ts-expect-error - enquirer types don't include symbols but it's supported
1456
+ symbols: {
1457
+ indicator: {
1458
+ on: "[x]",
1459
+ off: "[ ]"
1460
+ }
1438
1461
  }
1439
- }
1440
- });
1462
+ })
1463
+ );
1441
1464
  return selected;
1442
1465
  }
1443
1466
 
@@ -1662,17 +1685,19 @@ import chalk28 from "chalk";
1662
1685
  // src/shared/promptConfirm.ts
1663
1686
  import enquirer4 from "enquirer";
1664
1687
  async function promptConfirm(message, initial = true) {
1665
- const { confirmed } = await enquirer4.prompt({
1666
- type: "confirm",
1667
- name: "confirmed",
1668
- message,
1669
- initial,
1670
- // @ts-expect-error - enquirer types don't include symbols but it's supported
1671
- symbols: {
1672
- on: "[x]",
1673
- off: "[ ]"
1674
- }
1675
- });
1688
+ const { confirmed } = await exitOnCancel(
1689
+ enquirer4.prompt({
1690
+ type: "confirm",
1691
+ name: "confirmed",
1692
+ message,
1693
+ initial,
1694
+ // @ts-expect-error - enquirer types don't include symbols but it's supported
1695
+ symbols: {
1696
+ on: "[x]",
1697
+ off: "[ ]"
1698
+ }
1699
+ })
1700
+ );
1676
1701
  return confirmed;
1677
1702
  }
1678
1703
 
@@ -3456,9 +3481,9 @@ function registerNextCommand(cmd) {
3456
3481
  );
3457
3482
  }
3458
3483
  function registerRunCommand(cmd) {
3459
- cmd.command("run <id>").description("Run a backlog item's plan phase-by-phase with Claude").option("-w, --write", "Run Claude with acceptEdits permission mode").action(
3460
- (id, opts) => run(id, { allowEdits: opts.write })
3461
- );
3484
+ cmd.command("run <id>").description("Run a backlog item's plan phase-by-phase with Claude").option("-w, --write", "Run Claude with acceptEdits permission mode").action(async (id, opts) => {
3485
+ await run(id, { allowEdits: opts.write });
3486
+ });
3462
3487
  }
3463
3488
  function registerBacklog(program2) {
3464
3489
  const cmd = program2.command("backlog").description("Manage a backlog of work items").action(() => web({ port: "3000" }));
@@ -5937,10 +5962,10 @@ function saveJson(filename, data) {
5937
5962
  import Enquirer from "enquirer";
5938
5963
  var prompts = Enquirer;
5939
5964
  async function promptInput(name, message, initial) {
5940
- return new prompts.Input({ name, message, initial }).run();
5965
+ return exitOnCancel(new prompts.Input({ name, message, initial }).run());
5941
5966
  }
5942
5967
  async function promptPassword(name, message) {
5943
- return new prompts.Password({ name, message }).run();
5968
+ return exitOnCancel(new prompts.Password({ name, message }).run());
5944
5969
  }
5945
5970
 
5946
5971
  // src/commands/jira/jiraAuth.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.157.0",
3
+ "version": "0.158.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {