@thinkingai/ae-cli 6.1.18 → 6.1.19

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 (96) hide show
  1. package/README.md +2 -0
  2. package/README.zh.md +6 -0
  3. package/dist/{auth-ROB2EDYV.js → auth-QPEVVBKT.js} +13 -7
  4. package/dist/auth-UMJAA72O.js +15 -0
  5. package/dist/{capability-DKMYUTLC.js → capability-ASI62I4A.js} +11 -10
  6. package/dist/{chunk-UW5UN47B.js → chunk-533JK3YX.js} +2 -0
  7. package/dist/{chunk-4XXOWOTA.js → chunk-6QK7SYYY.js} +5 -4
  8. package/dist/{chunk-TUKQZTMI.js → chunk-7K24F7T2.js} +2 -0
  9. package/dist/{chunk-OO6XR6LK.js → chunk-AMBFK2K3.js} +2 -0
  10. package/dist/{sync-HKIOZXQE.js → chunk-B5HMQAOM.js} +31 -540
  11. package/dist/{chunk-Y3LOALAV.js → chunk-DKEXH6Q5.js} +4 -3
  12. package/dist/{chunk-VTWMIC5L.js → chunk-E2JKXMVO.js} +2 -0
  13. package/dist/{chunk-JHENBQ5B.js → chunk-FR2EDAQM.js} +1 -0
  14. package/dist/{chunk-ZQ47LWTI.js → chunk-GJXRF7Y6.js} +6 -5
  15. package/dist/{chunk-DWO43OIB.js → chunk-JQ3ENZZH.js} +2 -0
  16. package/dist/chunk-JYMGHGCE.js +191 -0
  17. package/dist/{chunk-BYYS3ANB.js → chunk-KEWVSO64.js} +5 -4
  18. package/dist/{chunk-3FY3RJ26.js → chunk-KZ6ZHF5J.js} +2 -1
  19. package/dist/{chunk-ZQKDZXDO.js → chunk-O6K2ODUE.js} +3 -2
  20. package/dist/chunk-QL6R6TSK.js +25215 -0
  21. package/dist/{chunk-J2DEBMRF.js → chunk-RWXIXOZG.js} +22 -9
  22. package/dist/{chunk-QZ3AS4KK.js → chunk-S5PONFBM.js} +5 -4
  23. package/dist/{chunk-4NN5IWVN.js → chunk-T6OSFQZD.js} +2 -0
  24. package/dist/{chunk-3KWQYGYI.js → chunk-TKHSULJT.js} +2 -0
  25. package/dist/{chunk-6EIJSNBD.js → chunk-Y74WTIKJ.js} +2 -0
  26. package/dist/{client-L2YDMHQ6.js → client-N7NGZUNI.js} +4 -3
  27. package/dist/{community-report-client-C7WDGET3.js → community-report-client-6OL6GBQW.js} +3 -2
  28. package/dist/{config-BMYZX2UE.js → config-XNMACCKX.js} +8 -7
  29. package/dist/{data-integration-QEKDWQDY.js → data-integration-4NZGZ45E.js} +913 -92
  30. package/dist/index.js +38 -36
  31. package/dist/{local-data-upload-client-4YYHSYD6.js → local-data-upload-client-EFHDLXFG.js} +3 -2
  32. package/dist/{memory-I2WXDTV2.js → memory-HBJQ2GC5.js} +8 -7
  33. package/dist/{metadata-I4C2EWUN.js → metadata-62EWBEIG.js} +12 -11
  34. package/dist/{model-HLHIEFMU.js → model-BHLJ2QMT.js} +10 -9
  35. package/dist/{personal-semantic-preference-LIPACBDX.js → personal-semantic-preference-JBVMAI7L.js} +11 -10
  36. package/dist/{project-semantic-RT3R2VQD.js → project-semantic-BQ4MPUS5.js} +12 -11
  37. package/dist/sync-MUWPRM5I.js +522 -0
  38. package/dist/{te-agent-BR6VDBNX.js → te-agent-WQZTMEK4.js} +10 -9
  39. package/dist/{te-analysis-7VUNUYWZ.js → te-analysis-MNCG65LU.js} +107 -20
  40. package/dist/{te-community-5DMNKJWY.js → te-community-BNE6KREL.js} +8 -7
  41. package/dist/{te-dataops-6P5IKWNJ.js → te-dataops-TXLKM2W6.js} +467 -67
  42. package/dist/{te-engage-KZPR5R22.js → te-engage-TPKLRVTL.js} +84 -10
  43. package/dist/{te-experiment-6BITX4RD.js → te-experiment-6BYKTCY7.js} +85 -12
  44. package/dist/{te-kb-RCLSSH2Q.js → te-kb-BUD6N3NI.js} +311 -24
  45. package/dist/{te-system-FXITO2JG.js → te-system-44LZJDTQ.js} +573 -37
  46. package/dist/{te-team-ADOC2ROP.js → te-team-XMP47YXE.js} +10 -7
  47. package/dist/{update-YCYCKJOO.js → update-UODFOZ4P.js} +7 -6
  48. package/package.json +18 -9
  49. package/skills/ae-analysis/references/analysis_gateway_assets.md +1 -1
  50. package/skills/ae-analysis/references/audience_models.md +18 -0
  51. package/skills/ae-analysis/references/command_index.md +2 -2
  52. package/skills/ae-analysis/references/project_timezone_update.md +13 -4
  53. package/skills/ae-analysis/references/property_create.md +2 -0
  54. package/skills/ae-analysis/references/super_metadata_batch_create.md +2 -0
  55. package/skills/ae-analysis/references/user_cluster_models.md +2 -0
  56. package/skills/ae-analysis/references/user_cluster_update.md +8 -4
  57. package/skills/ae-analysis/references/user_tag_create.md +7 -1
  58. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  59. package/skills/ae-data-integration/SKILL.md +1 -0
  60. package/skills/ae-data-integration/references/error-handling.md +54 -1
  61. package/skills/ae-data-integration/references/source-inspect.md +18 -2
  62. package/skills/ae-data-integration/references/transform.md +3 -1
  63. package/skills/ae-data-integration/references/ue-routing.md +23 -0
  64. package/skills/ae-dataops/SKILL.md +11 -1
  65. package/skills/ae-dataops/references/dataops-backfill.md +135 -0
  66. package/skills/ae-engage/SKILL.md +5 -0
  67. package/skills/ae-engage/references/build-task-save-guide.md +5 -1
  68. package/skills/ae-engage/references/save-flow.md +37 -1
  69. package/skills/ae-engage/references/save-task.md +6 -0
  70. package/skills/ae-experiment/SKILL.md +6 -2
  71. package/skills/ae-experiment/references/save_metric.md +20 -8
  72. package/skills/ae-kb/SKILL.md +120 -9
  73. package/skills/ae-system/SKILL.md +28 -30
  74. package/skills/ae-system/references/channel-management.md +303 -0
  75. package/dist/auth-GBMV6TEJ.js +0 -14
  76. package/dist/capability-HYVVPG25.js +0 -352
  77. package/dist/chunk-EFH4XWYC.js +0 -556
  78. package/dist/chunk-JRJY5DMJ.js +0 -71
  79. package/dist/chunk-OMPRXM3V.js +0 -349
  80. package/dist/chunk-QNOLN2LJ.js +0 -509
  81. package/dist/chunk-RJDU7NYP.js +0 -1198
  82. package/dist/chunk-RNAALWJK.js +0 -98
  83. package/dist/chunk-SERWF6G5.js +0 -13
  84. package/dist/memory-3ORCR7JH.js +0 -893
  85. package/dist/metadata-VUOQJE26.js +0 -339
  86. package/dist/model-UGRDX4MW.js +0 -139
  87. package/dist/personal-semantic-preference-OEISBRHM.js +0 -239
  88. package/dist/project-semantic-FFPWFPIW.js +0 -1114
  89. package/dist/sync-TFHU2UTG.js +0 -10261
  90. package/dist/te-agent-VLYOV7S4.js +0 -3894
  91. package/dist/te-analysis-4YGQL5RC.js +0 -9357
  92. package/dist/te-community-ISDQWJU7.js +0 -1859
  93. package/dist/te-dataops-CVULXNVB.js +0 -2209
  94. package/dist/te-engage-N5WI32H6.js +0 -4898
  95. package/dist/te-experiment-UVR4HLND.js +0 -988
  96. package/dist/te-system-K2GYMCTB.js +0 -2213
@@ -1,352 +0,0 @@
1
- import {
2
- normalizeRiskLevel,
3
- requiresConfirmation
4
- } from "./chunk-OO6XR6LK.js";
5
- import {
6
- findGatewayDomain,
7
- listRegisteredCapabilityDomains,
8
- resolveGatewayDomain
9
- } from "./chunk-3KWQYGYI.js";
10
- import {
11
- printError,
12
- printOutput
13
- } from "./chunk-BYYS3ANB.js";
14
- import {
15
- CapabilityGatewayError,
16
- dryRunCapability,
17
- executeCapability,
18
- inspectCapability,
19
- listCapabilities,
20
- validateCapability
21
- } from "./chunk-OMPRXM3V.js";
22
- import "./chunk-6EIJSNBD.js";
23
- import "./chunk-J2DEBMRF.js";
24
- import {
25
- SecureStoreAuthError,
26
- resolveHost
27
- } from "./chunk-ZQKDZXDO.js";
28
- import {
29
- safeJsonParse
30
- } from "./chunk-3FY3RJ26.js";
31
- import {
32
- PermissionError
33
- } from "./chunk-UW5UN47B.js";
34
- import "./chunk-JHENBQ5B.js";
35
-
36
- // src/commands/capability/index.ts
37
- import * as readline from "readline";
38
-
39
- // src/commands/capability/helpers.ts
40
- import { readFileSync } from "fs";
41
- var CapabilityCommandValidationError = class extends Error {
42
- constructor(message, hint, code) {
43
- super(message);
44
- this.hint = hint;
45
- this.code = code;
46
- this.name = "CapabilityCommandValidationError";
47
- }
48
- hint;
49
- code;
50
- };
51
- function capabilityNamespace(capabilityId) {
52
- return capabilityId.split(".")[0] ?? "";
53
- }
54
- function resolveCapabilityGatewayDomain(capabilityId, domainOverride) {
55
- const cliDomain = domainOverride?.trim() || capabilityNamespace(capabilityId);
56
- if (!cliDomain) {
57
- throw new CapabilityCommandValidationError(
58
- "Cannot determine the capability domain.",
59
- "Pass --domain <domain>."
60
- );
61
- }
62
- return resolveGatewayDomain(cliDomain, findGatewayDomain(cliDomain) ?? cliDomain);
63
- }
64
- function resolveCapabilityListDomain(cliDomain) {
65
- if (!cliDomain) {
66
- throw new CapabilityCommandValidationError(
67
- "Cannot determine the capability domain.",
68
- "Pass --domain <domain>."
69
- );
70
- }
71
- const gatewayDomain = findGatewayDomain(cliDomain);
72
- if (gatewayDomain === void 0) {
73
- const registeredDomains = listRegisteredCapabilityDomains();
74
- const registeredHint = registeredDomains.length > 0 ? `Registered domains: ${registeredDomains.join(", ")}.` : "No capability domains are registered in this ae-cli process.";
75
- throw new CapabilityCommandValidationError(
76
- `Capability domain '${cliDomain}' is not registered.`,
77
- `${registeredHint} Do not guess domain names.`,
78
- "CAPABILITY_DOMAIN_NOT_REGISTERED"
79
- );
80
- }
81
- return resolveGatewayDomain(cliDomain, gatewayDomain);
82
- }
83
- function emptyCapabilityCatalogWarning(capabilities) {
84
- if (capabilities.length > 0) {
85
- return void 0;
86
- }
87
- return "No capabilities were returned. This does not prove that the project permission is missing. Stop discovery instead of guessing other domains or retrying. If capabilities are expected, verify the capability deployment, enabled features, and permissions.";
88
- }
89
- function parseOptionalProjectId(raw) {
90
- if (raw === void 0) {
91
- return void 0;
92
- }
93
- const value = raw.trim();
94
- if (!/^[1-9]\d*$/.test(value)) {
95
- throw new CapabilityCommandValidationError(
96
- "--project-id must be a positive integer.",
97
- "Example: --project-id 1"
98
- );
99
- }
100
- const projectId = Number(value);
101
- if (!Number.isSafeInteger(projectId)) {
102
- throw new CapabilityCommandValidationError(
103
- "--project-id is outside the supported integer range.",
104
- "Pass a positive safe integer."
105
- );
106
- }
107
- return projectId;
108
- }
109
- function normalizeCapabilityList(value) {
110
- if (!Array.isArray(value)) {
111
- throw new Error("Capability gateway returned an invalid catalog: expected an array.");
112
- }
113
- return value.filter((item) => {
114
- return item !== null && typeof item === "object" && typeof item.id === "string";
115
- });
116
- }
117
- function filterCapabilities(capabilities, domain, query) {
118
- const prefix = `${domain.toLowerCase()}.`;
119
- const terms = query?.trim().toLowerCase().split(/\s+/).filter(Boolean) ?? [];
120
- return capabilities.filter((capability) => {
121
- if (!capability.id.toLowerCase().startsWith(prefix)) {
122
- return false;
123
- }
124
- if (terms.length === 0) {
125
- return true;
126
- }
127
- const searchable = `${capability.id} ${capability.description ?? ""}`.toLowerCase();
128
- return terms.every((term) => searchable.includes(term));
129
- });
130
- }
131
- function parseCapabilityInput(raw) {
132
- if (!raw) {
133
- return {};
134
- }
135
- const trimmed = raw.trim();
136
- let parsed;
137
- try {
138
- if (trimmed === "-") {
139
- parsed = safeJsonParse(readFileSync(0, "utf8"));
140
- } else if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
141
- parsed = safeJsonParse(trimmed);
142
- } else {
143
- const path = trimmed.startsWith("@") ? trimmed.slice(1) : trimmed;
144
- parsed = safeJsonParse(readFileSync(path, "utf8"));
145
- }
146
- } catch (error) {
147
- const message = error instanceof Error ? error.message : String(error);
148
- throw new CapabilityCommandValidationError(
149
- `Invalid capability input: ${message}`,
150
- "Pass an inline JSON object, a JSON file path, @<path>, or - for stdin."
151
- );
152
- }
153
- if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
154
- throw new CapabilityCommandValidationError(
155
- "Capability input must be a JSON object.",
156
- `Example: --input '{"project_id":1}'`
157
- );
158
- }
159
- const input = parsed;
160
- if (Object.prototype.hasOwnProperty.call(input, "projectId")) {
161
- throw new CapabilityCommandValidationError(
162
- "Unsupported capability input field: projectId.",
163
- "Use the canonical snake_case field project_id.",
164
- "UNSUPPORTED_INPUT_FIELDS"
165
- );
166
- }
167
- return input;
168
- }
169
-
170
- // src/commands/capability/index.ts
171
- function registerCapability(program) {
172
- const capability = program.command("capability").description("Discover and invoke capability gateway operations").action(() => {
173
- printError("validation", "Missing subcommand.", "Run: ae-cli capability --help");
174
- process.exitCode = 1;
175
- });
176
- capability.command("list").description("List capability summaries in a domain").requiredOption("--domain <domain>", "Capability namespace, such as analysis or metadata").option("--project-id <project-id>", "Filter by project membership, permissions, and enabled features").action(async (opts) => {
177
- await executeAndPrint(program, async (host) => {
178
- const gatewayDomain = resolveCapabilityListDomain(opts.domain);
179
- const projectId = parseOptionalProjectId(opts.projectId);
180
- const catalog = normalizeCapabilityList(await listCapabilities(host, gatewayDomain, projectId));
181
- const capabilities = filterCapabilities(catalog, opts.domain);
182
- const warning = emptyCapabilityCatalogWarning(catalog);
183
- return {
184
- domain: opts.domain,
185
- count: capabilities.length,
186
- capabilities,
187
- ...warning ? { warning } : {}
188
- };
189
- });
190
- }).addHelpText(
191
- "after",
192
- "\nExamples:\n ae-cli capability list --domain analysis\n ae-cli capability list --domain analysis --project-id 1"
193
- );
194
- capability.command("search").description("Search capability IDs and descriptions in a domain").argument("<query>", "Case-insensitive search terms").requiredOption(
195
- "--domain <domain>",
196
- "Capability namespace. One of: analysis, project, system, tracking, metadata, experiment, engage-flow, engage-task, engage-setting, engage-scene, engage-activity, engage-workbench, community"
197
- ).option("--project-id <project-id>", "Filter by project membership, permissions, and enabled features").action(async (query, opts) => {
198
- await executeAndPrint(program, async (host) => {
199
- const gatewayDomain = resolveCapabilityListDomain(opts.domain);
200
- const projectId = parseOptionalProjectId(opts.projectId);
201
- const catalog = normalizeCapabilityList(await listCapabilities(host, gatewayDomain, projectId));
202
- const capabilities = filterCapabilities(catalog, opts.domain, query);
203
- const warning = emptyCapabilityCatalogWarning(catalog);
204
- return {
205
- domain: opts.domain,
206
- query,
207
- count: capabilities.length,
208
- capabilities,
209
- ...warning ? { warning } : {}
210
- };
211
- });
212
- }).addHelpText(
213
- "after",
214
- '\nDomains (--domain):\n analysis, project, system, tracking, metadata,\n experiment, engage-flow, engage-task, engage-setting,\n engage-scene, engage-activity, engage-workbench, community\n\nExamples:\n ae-cli capability search "dashboard list" --domain analysis\n ae-cli capability search "dashboard list" --domain analysis --project-id 1\n ae-cli capability search "info list" --domain project\n ae-cli capability search "usage" --domain system\n ae-cli capability search "plan" --domain tracking\n ae-cli capability search "data_table" --domain metadata\n ae-cli capability search "report" --domain experiment\n ae-cli capability search "flow" --domain engage-flow\n ae-cli capability search "task" --domain engage-task\n ae-cli capability search "channel" --domain engage-setting\n ae-cli capability search "strategy" --domain engage-scene\n ae-cli capability search "topic" --domain engage-activity\n ae-cli capability search "workbench" --domain engage-workbench\n ae-cli capability search "post" --domain community'
215
- );
216
- capability.command("inspect").description("Inspect one capability schema, risk, auth, and output metadata").argument("<capability-id>", "Capability ID, such as analysis.report.list").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--project-id <project-id>", "Check availability in a project before returning metadata").action(async (capabilityId, opts) => {
217
- await executeAndPrint(program, async (host) => {
218
- const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
219
- return inspectCapability(host, gatewayDomain, capabilityId, parseOptionalProjectId(opts.projectId));
220
- });
221
- }).addHelpText(
222
- "after",
223
- "\nExamples:\n ae-cli capability inspect analysis.dashboard.list\n ae-cli capability inspect analysis.dashboard.list --project-id 1"
224
- );
225
- capability.command("validate").description(
226
- "Validate and normalize capability input only (schema/params). Does not execute business logic. Use when crafting complex payloads (nested objects, qp, share/member payloads) before dry-run/run. Success data: valid, capability_id, normalized_input. Unlike dry-run, does not return risk/output_mode/supports_cancel preview."
227
- ).argument("<capability-id>", "Capability ID, such as metadata.data_table.sql_write").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--input <json-or-path>", "Input JSON object, file path, @<path>, or - for stdin").action(async (capabilityId, opts) => {
228
- await executeAndPrint(program, async (host) => {
229
- const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
230
- return validateCapability(host, gatewayDomain, capabilityId, parseCapabilityInput(opts.input));
231
- });
232
- }).addHelpText(
233
- "after",
234
- `
235
- When to use:
236
- Prefer validate while iterating complex input (required fields, types, qp shape), then run.
237
- Prefer dry-run alone when you need risk / output mode / cancelability or a delete gate.
238
- Motto: validate = fix params; dry-run = confirm ready to run.
239
- Do not stack validate + dry-run on the same final input by default (dry-run already validates params).
240
- Neither mutates business data. Curated gateway commands: global --validate / --dry-run.
241
-
242
- Examples:
243
- ae-cli capability validate metadata.data_table.sql_write --input '{"project_id":1,"operation":"create",...}'
244
- ae-cli metadata data-table sql-write --project-id 1 ... --validate
245
- ae-cli capability validate analysis.project_space.create --input input.json`
246
- );
247
- capability.command("dry-run").description(
248
- "Full pre-execution confirmation without running business logic: validates/normalizes input and returns risk, output_mode, and supports_cancel. Use alone when you need that preview or a delete gate (do not stack after validate on the same final input by default). Global --dry-run on curated/capability run also hits this endpoint."
249
- ).argument("<capability-id>", "Capability ID, such as analysis.query.export").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--input <json-or-path>", "Input JSON object, file path, @<path>, or - for stdin").action(async (capabilityId, opts) => {
250
- await executeAndPrint(program, async (host) => {
251
- const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
252
- return dryRunCapability(host, gatewayDomain, capabilityId, parseCapabilityInput(opts.input));
253
- });
254
- }).addHelpText(
255
- "after",
256
- `
257
- Examples:
258
- ae-cli capability dry-run analysis.dashboard.list --input '{"project_id":1}'
259
- ae-cli capability dry-run analysis.dashboard.list --input input.json`
260
- );
261
- capability.command("run").description("Execute one capability by ID").argument("<capability-id>", "Capability ID, such as analysis.report.list").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--input <json-or-path>", "Input JSON object, file path, @<path>, or - for stdin").action(async (capabilityId, opts) => {
262
- await executeAndPrint(program, async (host, globalOpts) => {
263
- const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
264
- const input = parseCapabilityInput(opts.input);
265
- if (globalOpts.validate && globalOpts.dryRun) {
266
- throw new CapabilityCommandValidationError(
267
- "Cannot combine --validate and --dry-run.",
268
- "Use --validate to fix parameters; use --dry-run as the pre-execution confirmation."
269
- );
270
- }
271
- if (globalOpts.validate) {
272
- return validateCapability(host, gatewayDomain, capabilityId, input);
273
- }
274
- if (globalOpts.dryRun) {
275
- return dryRunCapability(host, gatewayDomain, capabilityId, input);
276
- }
277
- if (!globalOpts.yes) {
278
- const metadata = await inspectCapability(host, gatewayDomain, capabilityId);
279
- const risk = normalizeRiskLevel(typeof metadata?.risk === "string" ? metadata.risk : void 0);
280
- if (requiresConfirmation(risk)) {
281
- const confirmed = await confirm(`This capability is marked ${risk} (${capabilityId}). Continue?`);
282
- if (!confirmed) {
283
- process.stderr.write("Aborted.\n");
284
- return void 0;
285
- }
286
- }
287
- }
288
- return executeCapability(host, gatewayDomain, capabilityId, input);
289
- });
290
- }).addHelpText(
291
- "after",
292
- `
293
- Examples:
294
- ae-cli capability run analysis.dashboard.list --input '{"project_id":1}'
295
- ae-cli capability run analysis.dashboard.list --input input.json`
296
- );
297
- }
298
- async function executeAndPrint(program, action) {
299
- const globalOpts = program.opts();
300
- const host = resolveHost(globalOpts.host);
301
- if (!host) {
302
- printError("config", "No AE host configured.", "Run: ae-cli config set-host <url>");
303
- process.exitCode = 1;
304
- return;
305
- }
306
- try {
307
- const result = await action(host, globalOpts);
308
- if (result !== void 0) {
309
- await printOutput(result, globalOpts.format ?? "json", globalOpts.jq);
310
- }
311
- } catch (error) {
312
- if (error?.type === "validation" && String(error?.message || "").includes("--jq")) {
313
- printError("validation", error.message, error.hint);
314
- process.exitCode = 1;
315
- return;
316
- }
317
- printCapabilityError(error);
318
- process.exitCode = 1;
319
- }
320
- }
321
- function printCapabilityError(error) {
322
- if (error instanceof CapabilityCommandValidationError) {
323
- printError("validation", error.message, error.hint, error.code);
324
- return;
325
- }
326
- if (error instanceof SecureStoreAuthError) {
327
- printError("auth", error.message, "Run: ae-cli auth login");
328
- return;
329
- }
330
- if (error instanceof PermissionError) {
331
- printError("permission", error.message, void 0, error.code);
332
- return;
333
- }
334
- if (error instanceof CapabilityGatewayError) {
335
- printError("api", error.message, error.hint, error.code);
336
- return;
337
- }
338
- const message = error instanceof Error ? error.message : String(error);
339
- printError("api", message);
340
- }
341
- async function confirm(message) {
342
- const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
343
- return new Promise((resolve) => {
344
- rl.question(`${message} [y/N] `, (answer) => {
345
- rl.close();
346
- resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
347
- });
348
- });
349
- }
350
- export {
351
- registerCapability
352
- };