@roarkanalytics/cli 0.51.1 → 0.51.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.51.2](https://github.com/roarkhq/cli-roark-analytics/compare/v0.51.1...v0.51.2) (2026-10-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **confirm:** name the calls a batch delete will remove, not the command typed ([#133](https://github.com/roarkhq/cli-roark-analytics/issues/133)) ([e9a7d2f](https://github.com/roarkhq/cli-roark-analytics/commit/e9a7d2fab4fd074ce7be34e01f69c80e98aa09c2))
9
+
3
10
  ## [0.51.1](https://github.com/roarkhq/cli-roark-analytics/compare/v0.51.0...v0.51.1) (2026-10-22)
4
11
 
5
12
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@roarkanalytics/cli",
3
- "version": "0.51.1",
3
+ "version": "0.51.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@roarkanalytics/cli",
9
- "version": "0.51.1",
9
+ "version": "0.51.2",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@roarkanalytics/sdk": "^5.12.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roarkanalytics/cli",
3
- "version": "0.51.1",
3
+ "version": "0.51.2",
4
4
  "description": "The official command line interface for the Roark API",
5
5
  "author": "Roark <james@roark.ai>",
6
6
  "type": "commonjs",
@@ -17,6 +17,25 @@ export interface ProgramOptions {
17
17
  groups: Readonly<Record<string, string>>;
18
18
  completions: Readonly<Record<string, string>>;
19
19
  }
20
+ /**
21
+ * What the confirmation prompt names as the thing being deleted.
22
+ *
23
+ * A path parameter IS that thing, so a command with one reads it back:
24
+ * `call delete abc123` asks about `abc123`.
25
+ *
26
+ * A batch delete has no path parameter - its targets arrive in a required flag -
27
+ * and the fallback named the command instead, so `call batch delete` asked
28
+ * "Permanently delete call batch delete?". That sentence cannot help the one
29
+ * person the prompt exists for: someone who typed the wrong `--call-ids` and has
30
+ * a last chance to notice. It is also the only destructive command without a
31
+ * positional, and the only one that deletes in bulk, so the single worst place
32
+ * to say nothing useful.
33
+ *
34
+ * So the targets come from the required flags, which are what identifies them.
35
+ * The command path stays as the last resort, for a destructive command that one
36
+ * day identifies its target some other way - wrong, but never silent.
37
+ */
38
+ export declare const deletionTarget: (command: CliCommand, positionals: string[], options: Record<string, unknown>) => string;
20
39
  interface GlobalOptions {
21
40
  baseUrl?: string;
22
41
  project?: string;
@@ -9,7 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.run = exports.createProgram = exports.resolveOutput = exports.assertBaseUrlIsTrusted = void 0;
12
+ exports.run = exports.createProgram = exports.resolveOutput = exports.assertBaseUrlIsTrusted = exports.deletionTarget = void 0;
13
13
  const commander_1 = require("commander");
14
14
  const sdk_1 = __importDefault(require("@roarkanalytics/sdk"));
15
15
  const api_1 = require("./commands/api");
@@ -25,6 +25,46 @@ const output_1 = require("./output");
25
25
  /** Verbs whose effect a user cannot undo, so they get a confirmation prompt. */
26
26
  const DESTRUCTIVE_VERBS = new Set(['delete']);
27
27
  const isDestructive = (command) => DESTRUCTIVE_VERBS.has(command.commandPath.at(-1) ?? '');
28
+ /** Values beyond this are counted rather than listed; a prompt nobody reads is not a prompt. */
29
+ const MAX_LISTED_TARGETS = 5;
30
+ /**
31
+ * What the confirmation prompt names as the thing being deleted.
32
+ *
33
+ * A path parameter IS that thing, so a command with one reads it back:
34
+ * `call delete abc123` asks about `abc123`.
35
+ *
36
+ * A batch delete has no path parameter - its targets arrive in a required flag -
37
+ * and the fallback named the command instead, so `call batch delete` asked
38
+ * "Permanently delete call batch delete?". That sentence cannot help the one
39
+ * person the prompt exists for: someone who typed the wrong `--call-ids` and has
40
+ * a last chance to notice. It is also the only destructive command without a
41
+ * positional, and the only one that deletes in bulk, so the single worst place
42
+ * to say nothing useful.
43
+ *
44
+ * So the targets come from the required flags, which are what identifies them.
45
+ * The command path stays as the last resort, for a destructive command that one
46
+ * day identifies its target some other way - wrong, but never silent.
47
+ */
48
+ const deletionTarget = (command, positionals, options) => {
49
+ if (positionals.length > 0)
50
+ return positionals.join(' ');
51
+ const targets = command.flags
52
+ .filter((flag) => flag.required)
53
+ .flatMap((flag) => {
54
+ const raw = options[(0, input_1.optionKey)(flag.name)];
55
+ if (raw === undefined)
56
+ return [];
57
+ return (Array.isArray(raw) ? raw : [raw]).map((value) => String(value));
58
+ });
59
+ if (targets.length === 0)
60
+ return command.commandPath.join(' ');
61
+ // `call batch delete` -> `call`, so the count reads as the thing it counts.
62
+ const noun = command.commandPath[0] ?? 'record';
63
+ const listed = targets.slice(0, MAX_LISTED_TARGETS).join(', ');
64
+ const rest = targets.length - MAX_LISTED_TARGETS;
65
+ return `${targets.length} ${noun}${targets.length === 1 ? '' : 's'}: ${listed}${rest > 0 ? ` and ${rest} more` : ''}`;
66
+ };
67
+ exports.deletionTarget = deletionTarget;
28
68
  /**
29
69
  * Global flags are declared on every leaf as well as the root so they can be
30
70
  * written on either side of the verb. Commander does not inherit options down
@@ -212,7 +252,7 @@ const addApiCommand = (root, options, definition) => {
212
252
  const runApiCommand = async (definition, positionals, options, program) => {
213
253
  const output = (0, exports.resolveOutput)(options);
214
254
  if (isDestructive(definition)) {
215
- await (0, confirm_1.confirm)(`Permanently delete ${positionals.join(' ') || definition.commandPath.join(' ')}?`, {
255
+ await (0, confirm_1.confirm)(`Permanently delete ${(0, exports.deletionTarget)(definition, positionals, options)}?`, {
216
256
  assumeYes: options.yes === true,
217
257
  noInput: options.input === false,
218
258
  });
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "0.51.1";
1
+ export declare const version = "0.51.2";
package/version.js CHANGED
@@ -10,4 +10,4 @@ exports.version = void 0;
10
10
  //
11
11
  // Do not edit: an edit here is overwritten, and the published number is whatever
12
12
  // package.json says.
13
- exports.version = '0.51.1'; // x-release-please-version
13
+ exports.version = '0.51.2'; // x-release-please-version