primitive-admin 1.0.49 → 1.0.51

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 (153) hide show
  1. package/README.md +129 -10
  2. package/assets/skill/skills/primitive-platform/SKILL.md +85 -30
  3. package/dist/bin/primitive.d.ts +2 -0
  4. package/dist/bin/primitive.js +66 -1
  5. package/dist/bin/primitive.js.map +1 -1
  6. package/dist/src/commands/admins.d.ts +2 -0
  7. package/dist/src/commands/admins.js +25 -27
  8. package/dist/src/commands/admins.js.map +1 -1
  9. package/dist/src/commands/analytics.d.ts +2 -0
  10. package/dist/src/commands/apps.d.ts +2 -0
  11. package/dist/src/commands/apps.js +28 -0
  12. package/dist/src/commands/apps.js.map +1 -1
  13. package/dist/src/commands/auth.d.ts +2 -0
  14. package/dist/src/commands/blob-buckets.d.ts +2 -0
  15. package/dist/src/commands/blob-buckets.js +30 -26
  16. package/dist/src/commands/blob-buckets.js.map +1 -1
  17. package/dist/src/commands/catalog.d.ts +2 -0
  18. package/dist/src/commands/catalog.js +17 -18
  19. package/dist/src/commands/catalog.js.map +1 -1
  20. package/dist/src/commands/collection-type-configs.d.ts +2 -0
  21. package/dist/src/commands/collection-type-configs.js +9 -9
  22. package/dist/src/commands/collection-type-configs.js.map +1 -1
  23. package/dist/src/commands/collections.d.ts +2 -0
  24. package/dist/src/commands/collections.js +33 -36
  25. package/dist/src/commands/collections.js.map +1 -1
  26. package/dist/src/commands/comparisons.d.ts +2 -0
  27. package/dist/src/commands/cron-triggers.d.ts +2 -0
  28. package/dist/src/commands/cron-triggers.js +8 -15
  29. package/dist/src/commands/cron-triggers.js.map +1 -1
  30. package/dist/src/commands/database-types.d.ts +2 -0
  31. package/dist/src/commands/database-types.js +17 -18
  32. package/dist/src/commands/database-types.js.map +1 -1
  33. package/dist/src/commands/databases.d.ts +2 -0
  34. package/dist/src/commands/databases.js +72 -45
  35. package/dist/src/commands/databases.js.map +1 -1
  36. package/dist/src/commands/documents.d.ts +2 -0
  37. package/dist/src/commands/documents.js +17 -18
  38. package/dist/src/commands/documents.js.map +1 -1
  39. package/dist/src/commands/email-templates.d.ts +2 -0
  40. package/dist/src/commands/email-templates.js +9 -9
  41. package/dist/src/commands/email-templates.js.map +1 -1
  42. package/dist/src/commands/env.d.ts +12 -0
  43. package/dist/src/commands/group-type-configs.d.ts +2 -0
  44. package/dist/src/commands/group-type-configs.js +9 -9
  45. package/dist/src/commands/group-type-configs.js.map +1 -1
  46. package/dist/src/commands/groups.d.ts +2 -0
  47. package/dist/src/commands/groups.js +17 -18
  48. package/dist/src/commands/groups.js.map +1 -1
  49. package/dist/src/commands/guides.d.ts +84 -0
  50. package/dist/src/commands/guides.js +201 -24
  51. package/dist/src/commands/guides.js.map +1 -1
  52. package/dist/src/commands/init.d.ts +17 -0
  53. package/dist/src/commands/init.js +63 -25
  54. package/dist/src/commands/init.js.map +1 -1
  55. package/dist/src/commands/integrations.d.ts +2 -0
  56. package/dist/src/commands/integrations.js +39 -23
  57. package/dist/src/commands/integrations.js.map +1 -1
  58. package/dist/src/commands/llm.d.ts +2 -0
  59. package/dist/src/commands/llm.js +4 -2
  60. package/dist/src/commands/llm.js.map +1 -1
  61. package/dist/src/commands/prompts.d.ts +2 -0
  62. package/dist/src/commands/prompts.js +33 -36
  63. package/dist/src/commands/prompts.js.map +1 -1
  64. package/dist/src/commands/rule-sets.d.ts +2 -0
  65. package/dist/src/commands/rule-sets.js +9 -9
  66. package/dist/src/commands/rule-sets.js.map +1 -1
  67. package/dist/src/commands/secrets.d.ts +2 -0
  68. package/dist/src/commands/skill.d.ts +2 -0
  69. package/dist/src/commands/sync.d.ts +99 -0
  70. package/dist/src/commands/sync.js +437 -31
  71. package/dist/src/commands/sync.js.map +1 -1
  72. package/dist/src/commands/tokens.d.ts +2 -0
  73. package/dist/src/commands/tokens.js +113 -10
  74. package/dist/src/commands/tokens.js.map +1 -1
  75. package/dist/src/commands/users.d.ts +2 -0
  76. package/dist/src/commands/users.js +41 -45
  77. package/dist/src/commands/users.js.map +1 -1
  78. package/dist/src/commands/waitlist.d.ts +2 -0
  79. package/dist/src/commands/waitlist.js +10 -10
  80. package/dist/src/commands/waitlist.js.map +1 -1
  81. package/dist/src/commands/webhooks.d.ts +2 -0
  82. package/dist/src/commands/webhooks.js +9 -9
  83. package/dist/src/commands/webhooks.js.map +1 -1
  84. package/dist/src/commands/workflows.d.ts +49 -0
  85. package/dist/src/commands/workflows.js +136 -57
  86. package/dist/src/commands/workflows.js.map +1 -1
  87. package/dist/src/lib/api-client.d.ts +1229 -0
  88. package/dist/src/lib/api-client.js +44 -11
  89. package/dist/src/lib/api-client.js.map +1 -1
  90. package/dist/src/lib/auth-flow.d.ts +8 -0
  91. package/dist/src/lib/cli-manifest.d.ts +60 -0
  92. package/dist/src/lib/cli-manifest.js +70 -0
  93. package/dist/src/lib/cli-manifest.js.map +1 -0
  94. package/dist/src/lib/config.d.ts +37 -0
  95. package/dist/src/lib/confirm-prompt.d.ts +83 -0
  96. package/dist/src/lib/confirm-prompt.js +110 -0
  97. package/dist/src/lib/confirm-prompt.js.map +1 -0
  98. package/dist/src/lib/constants.d.ts +2 -0
  99. package/dist/src/lib/crash-handlers.d.ts +20 -0
  100. package/dist/src/lib/crash-handlers.js +49 -0
  101. package/dist/src/lib/crash-handlers.js.map +1 -0
  102. package/dist/src/lib/credentials-store.d.ts +79 -0
  103. package/dist/src/lib/csv.d.ts +48 -0
  104. package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
  105. package/dist/src/lib/db-codegen/dbGenerator.d.ts +111 -0
  106. package/dist/src/lib/db-codegen/dbNaming.d.ts +45 -0
  107. package/dist/src/lib/db-codegen/dbTemplates.d.ts +97 -0
  108. package/dist/src/lib/db-codegen/dbTemplates.js +31 -10
  109. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  110. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +78 -0
  111. package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
  112. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  113. package/dist/src/lib/env-resolver.d.ts +62 -0
  114. package/dist/src/lib/fetch.d.ts +5 -0
  115. package/dist/src/lib/generated-allowlist.d.ts +28 -0
  116. package/dist/src/lib/generated-allowlist.js +181 -0
  117. package/dist/src/lib/generated-allowlist.js.map +1 -0
  118. package/dist/src/lib/init-config.d.ts +46 -0
  119. package/dist/src/lib/init-config.js +7 -0
  120. package/dist/src/lib/init-config.js.map +1 -1
  121. package/dist/src/lib/migration-nag.d.ts +49 -0
  122. package/dist/src/lib/output.d.ts +49 -0
  123. package/dist/src/lib/output.js +25 -1
  124. package/dist/src/lib/output.js.map +1 -1
  125. package/dist/src/lib/paginate.d.ts +33 -0
  126. package/dist/src/lib/project-config.d.ts +97 -0
  127. package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
  128. package/dist/src/lib/resolve-platform.d.ts +45 -0
  129. package/dist/src/lib/resolve-platform.js +43 -0
  130. package/dist/src/lib/resolve-platform.js.map +1 -0
  131. package/dist/src/lib/skill-installer.d.ts +23 -0
  132. package/dist/src/lib/snapshots.d.ts +99 -0
  133. package/dist/src/lib/snapshots.js +357 -0
  134. package/dist/src/lib/snapshots.js.map +1 -0
  135. package/dist/src/lib/sync-paths.d.ts +72 -0
  136. package/dist/src/lib/sync-paths.js +29 -1
  137. package/dist/src/lib/sync-paths.js.map +1 -1
  138. package/dist/src/lib/template.d.ts +93 -0
  139. package/dist/src/lib/token-inject.d.ts +56 -0
  140. package/dist/src/lib/token-inject.js +204 -0
  141. package/dist/src/lib/token-inject.js.map +1 -0
  142. package/dist/src/lib/toml-database-config.d.ts +132 -0
  143. package/dist/src/lib/toml-params-validator.d.ts +95 -0
  144. package/dist/src/lib/version-check.d.ts +10 -0
  145. package/dist/src/lib/workflow-fragments.d.ts +41 -0
  146. package/dist/src/lib/workflow-toml-validator.d.ts +95 -0
  147. package/dist/src/lib/workflow-toml-validator.js +71 -130
  148. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  149. package/dist/src/types/index.d.ts +513 -0
  150. package/dist/src/validators.d.ts +64 -0
  151. package/dist/src/validators.js +63 -0
  152. package/dist/src/validators.js.map +1 -0
  153. package/package.json +10 -1
@@ -0,0 +1,49 @@
1
+ import { Command } from "commander";
2
+ /**
3
+ * Render the `Step Results` section of `workflows runs status`. Pure
4
+ * formatting helper — returns lines as strings so it's unit-testable
5
+ * (the caller console.logs them). For each step, emits:
6
+ *
7
+ * ` <id>: <status-label> <duration>`
8
+ *
9
+ * and, when applicable, indented follow-up lines:
10
+ *
11
+ * - `error_captured` step with `error` → ` error: <truncated message>`
12
+ * - forEach output with `errors[]` non-empty →
13
+ * ` forEach errors: <N/M> - first: <truncated message>`
14
+ *
15
+ * The truncation length matches `runs steps` ERROR column (80 chars,
16
+ * trailing "..." when truncated). See #688.
17
+ */
18
+ /**
19
+ * Terminal-status predicate for the `workflows preview --wait` poll loop
20
+ * (issue #941). A status is terminal when the run has reached an end state and
21
+ * the wait should stop polling — as opposed to a still-in-flight status
22
+ * ("running"/"queued"/"waiting") that should keep the loop going until the cap.
23
+ *
24
+ * The admin preview-status endpoint emits these terminal values (see
25
+ * `mapWorkflowStatus` / the server-side `isEnded` set in admin-api.ts):
26
+ * - "completed" (Cloudflare "complete" normalized)
27
+ * - "failed" (Cloudflare "errored" normalized)
28
+ * - "terminated" (an aborted preview — Codex P2: previously NOT treated as
29
+ * terminal, so an aborted preview was misreported as a wait timeout)
30
+ *
31
+ * We accept the un-normalized Cloudflare spellings too ("complete"/"errored")
32
+ * defensively, in case a status slips through un-normalized.
33
+ */
34
+ export declare function isPreviewWaitTerminalStatus(s: unknown): boolean;
35
+ export declare function renderRunStatusStepResults(stepResults: any[]): string[];
36
+ /**
37
+ * Issue #687 (review feedback): render an unambiguous label for a workflow
38
+ * config slot ("active config", "draft config", etc.) when the slot may be
39
+ * unnamed. Falls back to a short ID prefix so users staging multiple unnamed
40
+ * configs can still tell them apart.
41
+ *
42
+ * formatConfigSlotLabel("active config", "v2", "01KRT...") → 'active config "v2"'
43
+ * formatConfigSlotLabel("active config", null, "01KRTABCDXYZ...") → 'active config (01KRTABCDXYZ…)'
44
+ * formatConfigSlotLabel("active config", null, null) → 'active config'
45
+ *
46
+ * Exported for testability.
47
+ */
48
+ export declare function formatConfigSlotLabel(slot: string, configName: string | null | undefined, configId: string | null | undefined, prefixLength?: number): string;
49
+ export declare function registerWorkflowsCommands(program: Command): void;
@@ -6,6 +6,7 @@ import { ApiClient } from "../lib/api-client.js";
6
6
  import { resolveAppId } from "../lib/config.js";
7
7
  import { validateWorkflowToml, formatWorkflowTomlErrors, } from "../lib/workflow-toml-validator.js";
8
8
  import { expandWorkflow } from "../lib/workflow-fragments.js";
9
+ import { confirmPrompt } from "../lib/confirm-prompt.js";
9
10
  import chalk from "chalk";
10
11
  import { success, error, info, warn, keyValue, result as printResult, formatTable, formatId, formatDate, formatStatus, formatDuration, json, divider, progress, progressEnd, } from "../lib/output.js";
11
12
  /**
@@ -24,6 +25,29 @@ import { success, error, info, warn, keyValue, result as printResult, formatTabl
24
25
  * The truncation length matches `runs steps` ERROR column (80 chars,
25
26
  * trailing "..." when truncated). See #688.
26
27
  */
28
+ /**
29
+ * Terminal-status predicate for the `workflows preview --wait` poll loop
30
+ * (issue #941). A status is terminal when the run has reached an end state and
31
+ * the wait should stop polling — as opposed to a still-in-flight status
32
+ * ("running"/"queued"/"waiting") that should keep the loop going until the cap.
33
+ *
34
+ * The admin preview-status endpoint emits these terminal values (see
35
+ * `mapWorkflowStatus` / the server-side `isEnded` set in admin-api.ts):
36
+ * - "completed" (Cloudflare "complete" normalized)
37
+ * - "failed" (Cloudflare "errored" normalized)
38
+ * - "terminated" (an aborted preview — Codex P2: previously NOT treated as
39
+ * terminal, so an aborted preview was misreported as a wait timeout)
40
+ *
41
+ * We accept the un-normalized Cloudflare spellings too ("complete"/"errored")
42
+ * defensively, in case a status slips through un-normalized.
43
+ */
44
+ export function isPreviewWaitTerminalStatus(s) {
45
+ return (s === "completed" ||
46
+ s === "complete" ||
47
+ s === "failed" ||
48
+ s === "errored" ||
49
+ s === "terminated");
50
+ }
27
51
  export function renderRunStatusStepResults(stepResults) {
28
52
  const lines = [];
29
53
  for (const step of stepResults || []) {
@@ -375,24 +399,16 @@ Examples:
375
399
  .option("-y, --yes", "Skip confirmation prompt")
376
400
  .action(async (workflowId, options) => {
377
401
  const resolvedAppId = resolveAppId(undefined, options);
378
- if (!options.yes) {
379
- const action = options.hard ? "permanently delete" : "archive";
380
- const inquirer = await import("inquirer");
381
- const { confirm } = await inquirer.default.prompt([
382
- {
383
- type: "confirm",
384
- name: "confirm",
385
- message: `Are you sure you want to ${action} workflow ${workflowId}?`,
386
- default: false,
387
- },
388
- ]);
389
- if (!confirm) {
390
- info("Cancelled.");
391
- return;
392
- }
393
- }
394
402
  const client = new ApiClient();
395
403
  try {
404
+ if (!options.yes) {
405
+ const action = options.hard ? "permanently delete" : "archive";
406
+ const confirmed = await confirmPrompt(`Are you sure you want to ${action} workflow ${workflowId}?`);
407
+ if (!confirmed) {
408
+ info("Cancelled.");
409
+ return;
410
+ }
411
+ }
396
412
  if (options.hard) {
397
413
  await client.deleteWorkflow(resolvedAppId, workflowId);
398
414
  success("Workflow deleted.");
@@ -486,6 +502,21 @@ Examples:
486
502
  }
487
503
  }
488
504
  catch (err) {
505
+ // Issue #987: config-model workflows reject the legacy draft slot with
506
+ // a 409 (the draft never executes). Surface the actionable config path
507
+ // cleanly instead of dumping a raw API error.
508
+ if (err?.statusCode === 409 && err?.code === "WORKFLOW_CONFIG_MODEL") {
509
+ error("This workflow has an active configuration, so the legacy draft slot is inert " +
510
+ "(it won't change what runs). For dev-loop edits, use 'sync push' — it writes the\n" +
511
+ "active config directly and activates the workflow end-to-end:\n" +
512
+ " primitive sync push\n" +
513
+ "For staged rollouts, create + activate a config, then flip the status to active\n" +
514
+ "(configs activate only sets the active config; it does not change the workflow status):\n" +
515
+ " primitive workflows configs create <workflow-id> --name <name> --from-file <path>\n" +
516
+ " primitive workflows configs activate <workflow-id> <config-id>\n" +
517
+ " primitive workflows update <workflow-id> --status active");
518
+ process.exit(1);
519
+ }
489
520
  error(err.message);
490
521
  process.exit(1);
491
522
  }
@@ -515,6 +546,21 @@ Examples:
515
546
  }
516
547
  }
517
548
  catch (err) {
549
+ // Issue #987: 'publish' is inert on config-model workflows (production
550
+ // runs read the active config), so the server rejects with a 409.
551
+ // Point the user at the config primitives instead of a raw API error.
552
+ if (err?.statusCode === 409 && err?.code === "WORKFLOW_CONFIG_MODEL") {
553
+ error("This workflow has an active configuration, so 'publish' is inert " +
554
+ "(it bumps a legacy pointer that doesn't change what runs). For dev-loop edits, use\n" +
555
+ "'sync push' — it writes the active config directly and activates the workflow end-to-end:\n" +
556
+ " primitive sync push\n" +
557
+ "For staged rollouts, create + activate a config, then flip the status to active\n" +
558
+ "(configs activate only sets the active config; it does not change the workflow status):\n" +
559
+ " primitive workflows configs create <workflow-id> --name <name> --from-file <path>\n" +
560
+ " primitive workflows configs activate <workflow-id> <config-id>\n" +
561
+ " primitive workflows update <workflow-id> --status active");
562
+ process.exit(1);
563
+ }
518
564
  error(err.message);
519
565
  process.exit(1);
520
566
  }
@@ -588,21 +634,49 @@ Examples:
588
634
  info("Use 'workflows runs status' to check progress.");
589
635
  return;
590
636
  }
591
- // Poll for completion
637
+ // Poll for completion. Issue #941: track whether the loop broke on a
638
+ // terminal state vs. ran to exhaustion, so a timed-out wait is
639
+ // distinguishable from a workflow that legitimately reported "running".
592
640
  info("Waiting for completion...");
593
641
  let status;
594
- const maxAttempts = 60;
642
+ // Fixed ~60s cap (60 × 1s sleep + RTT). PRIMITIVE_PREVIEW_WAIT_ATTEMPTS
643
+ // overrides the iteration count for tests that exercise the
644
+ // poll-loop-exhaustion path without a full 60s wait; unset in normal use.
645
+ const maxAttempts = (() => {
646
+ const raw = process.env.PRIMITIVE_PREVIEW_WAIT_ATTEMPTS;
647
+ const parsed = raw ? parseInt(raw, 10) : NaN;
648
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : 60;
649
+ })();
650
+ let reachedTerminal = false;
595
651
  for (let i = 0; i < maxAttempts; i++) {
596
652
  await new Promise((r) => setTimeout(r, 1000));
597
653
  const statusResult = await client.getPreviewStatus(resolvedAppId, workflowId, result.instanceId);
598
654
  status = statusResult.status;
599
655
  const s = status?.status;
600
- if (s === "completed" || s === "complete" || s === "failed" || s === "errored") {
656
+ // Issue #941 (Codex P2): an aborted preview reports
657
+ // status:"terminated" from the admin preview-status endpoint, which
658
+ // is a real terminal state — the wait did NOT time out. The shared
659
+ // predicate includes it so the loop breaks and `waitTimedOut` stays
660
+ // false (vs. the prior check that omitted "terminated" and let the
661
+ // loop run to the cap, misreporting an abort as a timeout).
662
+ if (isPreviewWaitTerminalStatus(s)) {
663
+ reachedTerminal = true;
601
664
  break;
602
665
  }
603
666
  }
667
+ // Issue #941: on poll-loop exhaustion with a still-non-terminal run,
668
+ // emit an explicit timeout signal and exit non-zero (124, the GNU
669
+ // `timeout` convention) instead of silently returning the bare
670
+ // non-terminal status as if the wait succeeded.
671
+ const waitTimedOut = !reachedTerminal;
604
672
  if (options.json) {
605
- json({ instanceId: result.instanceId, status });
673
+ // Additive field only — `status` is preserved so existing parsers
674
+ // don't break; `waitTimedOut` lets automation tell "still running,
675
+ // wait gave up" from "finished".
676
+ json({ instanceId: result.instanceId, status, waitTimedOut });
677
+ if (waitTimedOut) {
678
+ process.exit(124);
679
+ }
606
680
  return;
607
681
  }
608
682
  if (status?.status === "completed" || status?.status === "complete") {
@@ -626,8 +700,17 @@ Examples:
626
700
  console.log(JSON.stringify(status.error, null, 2));
627
701
  }
628
702
  }
703
+ else if (status?.status === "terminated") {
704
+ // Issue #941 (Codex P2): the preview was aborted (e.g. via
705
+ // `workflows preview ... abort`, or an external terminate). This is a
706
+ // real terminal state — NOT a timeout — so render it distinctly and
707
+ // exit 0 (the wait succeeded in observing a terminal result).
708
+ warn("Preview was terminated (aborted before completion).");
709
+ }
629
710
  else {
630
- info("Preview still running. Check status with 'workflows runs status'.");
711
+ // Timed out without ever reaching a terminal state (issue #941).
712
+ error(`Wait timed out after ${maxAttempts}s; preview still running. Check status with 'workflows runs status'.`);
713
+ process.exit(124);
631
714
  }
632
715
  }
633
716
  catch (err) {
@@ -1339,15 +1422,14 @@ Examples:
1339
1422
  .action(async (workflowId, configId, options) => {
1340
1423
  const resolvedAppId = resolveAppId(undefined, options);
1341
1424
  if (!options.yes) {
1342
- const inquirer = await import("inquirer");
1343
- const { confirm } = await inquirer.default.prompt([
1344
- {
1345
- type: "confirm",
1346
- name: "confirm",
1347
- message: `Are you sure you want to archive configuration ${configId}?`,
1348
- default: false,
1349
- },
1350
- ]);
1425
+ let confirm;
1426
+ try {
1427
+ confirm = await confirmPrompt(`Are you sure you want to archive configuration ${configId}?`);
1428
+ }
1429
+ catch (err) {
1430
+ error(err.message);
1431
+ process.exit(1);
1432
+ }
1351
1433
  if (!confirm) {
1352
1434
  info("Cancelled.");
1353
1435
  return;
@@ -1631,15 +1713,14 @@ Examples:
1631
1713
  .action(async (workflowId, testCaseId, options) => {
1632
1714
  const resolvedAppId = resolveAppId(undefined, options);
1633
1715
  if (!options.yes) {
1634
- const inquirer = await import("inquirer");
1635
- const { confirm } = await inquirer.default.prompt([
1636
- {
1637
- type: "confirm",
1638
- name: "confirm",
1639
- message: `Are you sure you want to delete test case ${testCaseId}?`,
1640
- default: false,
1641
- },
1642
- ]);
1716
+ let confirm;
1717
+ try {
1718
+ confirm = await confirmPrompt(`Are you sure you want to delete test case ${testCaseId}?`);
1719
+ }
1720
+ catch (err) {
1721
+ error(err.message);
1722
+ process.exit(1);
1723
+ }
1643
1724
  if (!confirm) {
1644
1725
  info("Cancelled.");
1645
1726
  return;
@@ -1959,15 +2040,14 @@ Examples:
1959
2040
  .action(async (workflowId, batchId, options) => {
1960
2041
  const resolvedAppId = resolveAppId(undefined, options);
1961
2042
  if (!options.yes) {
1962
- const inquirer = await import("inquirer");
1963
- const { confirm } = await inquirer.default.prompt([
1964
- {
1965
- type: "confirm",
1966
- name: "confirm",
1967
- message: `Are you sure you want to cancel batch ${batchId}?`,
1968
- default: false,
1969
- },
1970
- ]);
2043
+ let confirm;
2044
+ try {
2045
+ confirm = await confirmPrompt(`Are you sure you want to cancel batch ${batchId}?`);
2046
+ }
2047
+ catch (err) {
2048
+ error(err.message);
2049
+ process.exit(1);
2050
+ }
1971
2051
  if (!confirm) {
1972
2052
  info("Cancelled.");
1973
2053
  return;
@@ -2131,15 +2211,14 @@ Examples:
2131
2211
  .action(async (workflowId, testCaseId, filename, options) => {
2132
2212
  const resolvedAppId = resolveAppId(undefined, options);
2133
2213
  if (!options.yes) {
2134
- const inquirer = await import("inquirer");
2135
- const { confirm } = await inquirer.default.prompt([
2136
- {
2137
- type: "confirm",
2138
- name: "confirm",
2139
- message: `Are you sure you want to delete attachment "${filename}"?`,
2140
- default: false,
2141
- },
2142
- ]);
2214
+ let confirm;
2215
+ try {
2216
+ confirm = await confirmPrompt(`Are you sure you want to delete attachment "${filename}"?`);
2217
+ }
2218
+ catch (err) {
2219
+ error(err.message);
2220
+ process.exit(1);
2221
+ }
2143
2222
  if (!confirm) {
2144
2223
  info("Cancelled.");
2145
2224
  return;