@staff0rd/assist 0.158.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.
- package/dist/index.js +66 -46
- 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.158.
|
|
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
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
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";
|
|
@@ -602,6 +616,18 @@ async function runReview(item, plan2, spawnOptions) {
|
|
|
602
616
|
}
|
|
603
617
|
|
|
604
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
|
+
}
|
|
605
631
|
async function next(options2) {
|
|
606
632
|
while (true) {
|
|
607
633
|
const items = loadBacklog();
|
|
@@ -627,17 +653,7 @@ async function next(options2) {
|
|
|
627
653
|
console.log(chalk9.bold(`Starting #${only.id}: ${only.name}`));
|
|
628
654
|
id = String(only.id);
|
|
629
655
|
} else {
|
|
630
|
-
|
|
631
|
-
name: `${typeLabel(i.type)} #${i.id}: ${i.name}`,
|
|
632
|
-
value: String(i.id)
|
|
633
|
-
}));
|
|
634
|
-
const { selected } = await enquirer2.prompt({
|
|
635
|
-
type: "select",
|
|
636
|
-
name: "selected",
|
|
637
|
-
message: "Choose a backlog item to start:",
|
|
638
|
-
choices: choices.map((c) => c.name)
|
|
639
|
-
});
|
|
640
|
-
id = selected.match(/#(\d+)/)?.[1] ?? "";
|
|
656
|
+
id = await selectItem(todo);
|
|
641
657
|
}
|
|
642
658
|
const completed = await run(id, options2);
|
|
643
659
|
if (!completed) return;
|
|
@@ -1427,22 +1443,24 @@ import chalk33 from "chalk";
|
|
|
1427
1443
|
import chalk19 from "chalk";
|
|
1428
1444
|
import enquirer3 from "enquirer";
|
|
1429
1445
|
async function promptMultiselect(message, options2) {
|
|
1430
|
-
const { selected } = await
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
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
|
+
}
|
|
1443
1461
|
}
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1462
|
+
})
|
|
1463
|
+
);
|
|
1446
1464
|
return selected;
|
|
1447
1465
|
}
|
|
1448
1466
|
|
|
@@ -1667,17 +1685,19 @@ import chalk28 from "chalk";
|
|
|
1667
1685
|
// src/shared/promptConfirm.ts
|
|
1668
1686
|
import enquirer4 from "enquirer";
|
|
1669
1687
|
async function promptConfirm(message, initial = true) {
|
|
1670
|
-
const { confirmed } = await
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
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
|
+
);
|
|
1681
1701
|
return confirmed;
|
|
1682
1702
|
}
|
|
1683
1703
|
|
|
@@ -5942,10 +5962,10 @@ function saveJson(filename, data) {
|
|
|
5942
5962
|
import Enquirer from "enquirer";
|
|
5943
5963
|
var prompts = Enquirer;
|
|
5944
5964
|
async function promptInput(name, message, initial) {
|
|
5945
|
-
return new prompts.Input({ name, message, initial }).run();
|
|
5965
|
+
return exitOnCancel(new prompts.Input({ name, message, initial }).run());
|
|
5946
5966
|
}
|
|
5947
5967
|
async function promptPassword(name, message) {
|
|
5948
|
-
return new prompts.Password({ name, message }).run();
|
|
5968
|
+
return exitOnCancel(new prompts.Password({ name, message }).run());
|
|
5949
5969
|
}
|
|
5950
5970
|
|
|
5951
5971
|
// src/commands/jira/jiraAuth.ts
|