@uluops/cli 0.12.10 → 0.15.0
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 +154 -0
- package/README.md +99 -22
- package/dist/cli.js +8 -14
- package/dist/cli.js.map +1 -1
- package/dist/commands/analytics.d.ts.map +1 -1
- package/dist/commands/analytics.js +12 -11
- package/dist/commands/analytics.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +15 -14
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/definitions.d.ts.map +1 -1
- package/dist/commands/definitions.js +14 -17
- package/dist/commands/definitions.js.map +1 -1
- package/dist/commands/deps.d.ts.map +1 -1
- package/dist/commands/deps.js +58 -43
- package/dist/commands/deps.js.map +1 -1
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/exec.js +10 -9
- package/dist/commands/exec.js.map +1 -1
- package/dist/commands/executions.d.ts.map +1 -1
- package/dist/commands/executions.js +3 -2
- package/dist/commands/executions.js.map +1 -1
- package/dist/commands/forks.d.ts.map +1 -1
- package/dist/commands/forks.js +5 -4
- package/dist/commands/forks.js.map +1 -1
- package/dist/commands/issues.d.ts.map +1 -1
- package/dist/commands/issues.js +133 -33
- package/dist/commands/issues.js.map +1 -1
- package/dist/commands/languages.d.ts.map +1 -1
- package/dist/commands/languages.js +3 -2
- package/dist/commands/languages.js.map +1 -1
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +6 -5
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/projects.d.ts.map +1 -1
- package/dist/commands/projects.js +15 -20
- package/dist/commands/projects.js.map +1 -1
- package/dist/commands/runs.d.ts.map +1 -1
- package/dist/commands/runs.js +13 -18
- package/dist/commands/runs.js.map +1 -1
- package/dist/commands/taxonomy.d.ts.map +1 -1
- package/dist/commands/taxonomy.js +2 -1
- package/dist/commands/taxonomy.js.map +1 -1
- package/dist/commands/translation.d.ts.map +1 -1
- package/dist/commands/translation.js +4 -3
- package/dist/commands/translation.js.map +1 -1
- package/dist/commands/versions.d.ts.map +1 -1
- package/dist/commands/versions.js +6 -2
- package/dist/commands/versions.js.map +1 -1
- package/dist/formatters/json.d.ts +151 -0
- package/dist/formatters/json.d.ts.map +1 -0
- package/dist/formatters/json.js +183 -0
- package/dist/formatters/json.js.map +1 -0
- package/dist/utils.d.ts +32 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +57 -6
- package/dist/utils.js.map +1 -1
- package/dist/version.d.ts +11 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +31 -0
- package/dist/version.js.map +1 -0
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createOpsContext, handleOpsError, } from '../context.js';
|
|
2
|
+
import { emitJson } from '../formatters/json.js';
|
|
2
3
|
import { withSpinner } from '../utils.js';
|
|
3
4
|
/**
|
|
4
5
|
* Register taxonomy commands
|
|
@@ -25,7 +26,7 @@ Examples:
|
|
|
25
26
|
failure: 'Failed to fetch taxonomy',
|
|
26
27
|
}, () => ctx.client.taxonomy.get());
|
|
27
28
|
if (ctx.json) {
|
|
28
|
-
|
|
29
|
+
emitJson(ctx, schema, 'taxonomy.get');
|
|
29
30
|
}
|
|
30
31
|
else {
|
|
31
32
|
console.log('Failure Domains:');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taxonomy.js","sourceRoot":"","sources":["../../src/commands/taxonomy.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAEhB,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,MAAM,QAAQ,GAAG,OAAO;SACrB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,qCAAqC,CAAC;SAClD,WAAW,CACV,OAAO,EACP;;;;CAIL,CACI,CAAC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E,CAAC,CAAC;gBAC3D,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../src/commands/translation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../src/commands/translation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiIlE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRegistryContext, handleRegistryError, } from '../context.js';
|
|
2
|
+
import { emitJson } from '../formatters/json.js';
|
|
2
3
|
import { readFileOption, withSpinner } from '../utils.js';
|
|
3
4
|
/**
|
|
4
5
|
* Register translation commands
|
|
@@ -26,7 +27,7 @@ Examples:
|
|
|
26
27
|
failure: 'Failed to fetch translator version',
|
|
27
28
|
}, () => ctx.client.translation.getVersion());
|
|
28
29
|
if (ctx.json) {
|
|
29
|
-
|
|
30
|
+
emitJson(ctx, info, 'translation.version');
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
32
33
|
console.log(`Translator version: ${info.translatorVersion}`);
|
|
@@ -57,7 +58,7 @@ Examples:
|
|
|
57
58
|
createNewVersion: options.newVersion ?? false,
|
|
58
59
|
}));
|
|
59
60
|
if (ctx.json) {
|
|
60
|
-
|
|
61
|
+
emitJson(ctx, result, 'translation.retranslate');
|
|
61
62
|
}
|
|
62
63
|
else {
|
|
63
64
|
console.log(`Re-translated: ${result.type}/${result.name}@${result.version}`);
|
|
@@ -85,7 +86,7 @@ Examples:
|
|
|
85
86
|
failure: 'Failed to upgrade',
|
|
86
87
|
}, () => ctx.client.translation.upgradeDefinition(type, name, { yaml }));
|
|
87
88
|
if (ctx.json) {
|
|
88
|
-
|
|
89
|
+
emitJson(ctx, result, 'translation.upgrade');
|
|
89
90
|
}
|
|
90
91
|
else {
|
|
91
92
|
console.log(`Upgraded: ${type}/${name}@${result.version}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.js","sourceRoot":"","sources":["../../src/commands/translation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EAErB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAgB;IAC1D,MAAM,WAAW,GAAG,OAAO;SACxB,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,0CAA0C,CAAC;SACvD,WAAW,CACV,OAAO,EACP;;;;;CAKL,CACI,CAAC;IAEJ,0BAA0B;IAC1B,WAAW;SACR,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,6BAA6B,CAAC;SAC1C,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE;QACvB,MAAM,UAAU,GAAG,GAAG,CAAC,eAAe,EAAmB,CAAC;QAC1D,MAAM,GAAG,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAE9C,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,WAAW,CAC5B,GAAG,EACH;gBACE,KAAK,EAAE,gCAAgC;gBACvC,OAAO,EAAE,oCAAoC;aAC9C,EACD,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,CAC1C,CAA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AAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC7D,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,mBAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/commands/versions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/commands/versions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUzC;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqF9D"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRegistryContext, handleRegistryError, } from '../context.js';
|
|
2
|
+
import { emitJson } from '../formatters/json.js';
|
|
2
3
|
import { formatVersionDiff, formatVersions } from '../formatters/registry.js';
|
|
3
4
|
import { withSpinner } from '../utils.js';
|
|
4
5
|
/**
|
|
@@ -26,7 +27,7 @@ Examples:
|
|
|
26
27
|
failure: 'Failed to fetch versions',
|
|
27
28
|
}, () => ctx.client.versions.list(type, name));
|
|
28
29
|
if (ctx.json) {
|
|
29
|
-
|
|
30
|
+
emitJson(ctx, data, 'version.list');
|
|
30
31
|
}
|
|
31
32
|
else if (!data.versions || data.versions.length === 0) {
|
|
32
33
|
console.log('No versions found');
|
|
@@ -53,13 +54,16 @@ Examples:
|
|
|
53
54
|
failure: 'Failed to compare versions',
|
|
54
55
|
}, () => ctx.client.versions.diff(type, name, from, to));
|
|
55
56
|
if (ctx.json) {
|
|
56
|
-
|
|
57
|
+
emitJson(ctx, result, 'version.diff');
|
|
57
58
|
}
|
|
58
59
|
else {
|
|
59
60
|
if ('fromYaml' in result || 'sectionsModified' in result) {
|
|
60
61
|
console.log(formatVersionDiff(result));
|
|
61
62
|
}
|
|
62
63
|
else {
|
|
64
|
+
// Human-mode fallback dump for an unrecognized diff shape — not a
|
|
65
|
+
// --json contract surface, so it stays a raw console.log (emitJson
|
|
66
|
+
// would suppress it here because ctx.json is false in this branch).
|
|
63
67
|
console.log(JSON.stringify(result, null, 2));
|
|
64
68
|
}
|
|
65
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../src/commands/versions.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,qBAAqB,EAErB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,QAAQ,GAAG,OAAO;SACrB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,4BAA4B,CAAC;SACzC,WAAW,CACV,OAAO,EACP;;;;CAIL,CACI,CAAC;IAEJ,kCAAkC;IAClC,QAAQ;SACL,OAAO,CAAC,oBAAoB,CAAC;SAC7B,WAAW,CAAC,uCAAuC,CAAC;SACpD,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,IAAY,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE;QACnD,MAAM,UAAU,GAAG,GAAG,CAAC,eAAe,EAAmB,CAAC;QAC1D,MAAM,GAAG,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAE9C,IAAI,CAAC;YACH,MAAM,IAAI,GAA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AEF,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;gBACb,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;YACxC,CAAC;iBAAM,CAAC;gBACN,IAAI,UAAU,IAAI,MAAM,IAAI,kBAAkB,IAAI,MAAM,EAAE,CAAC;oBACzD,OAAO,CAAC,GAAG,CACT,iBAAiB,CAAC,MAA0C,CAAC,CAC9D,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,kEAAkE;oBAClE,mEAAmE;oBACnE,oEAAoE;oBACpE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,mBAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single chokepoint for all machine-readable `--json` output.
|
|
3
|
+
*
|
|
4
|
+
* Every `--json` emission in the CLI flows through {@link emitJson}. In default
|
|
5
|
+
* mode it prints the payload byte-for-byte identically to the historical
|
|
6
|
+
* `console.log(JSON.stringify(value, null, 2))` — the default contract is
|
|
7
|
+
* frozen. When the caller opts in (`ULU_JSON_SCHEMA=1` or `--json-envelope`),
|
|
8
|
+
* the payload is wrapped in a uniform versioned envelope so automated consumers
|
|
9
|
+
* can detect shape changes at runtime instead of breaking silently.
|
|
10
|
+
*
|
|
11
|
+
* ## Stability contract
|
|
12
|
+
* `--json` output shapes are part of the CLI's public API. A change to any
|
|
13
|
+
* default `--json` shape is a BREAKING change and requires a MAJOR version bump.
|
|
14
|
+
* Each logical output owns a `schemaVersion` in {@link SCHEMA_VERSIONS} — the
|
|
15
|
+
* source of truth. When you change a payload shape you MUST bump its
|
|
16
|
+
* `schemaVersion`, add a CHANGELOG `BREAKING` entry, and update its
|
|
17
|
+
* contract-anchor test. See the README "JSON Output Stability Contract" section.
|
|
18
|
+
*/
|
|
19
|
+
/** Identifier of the envelope wrapper format. Bumps only if the wrapper itself changes. */
|
|
20
|
+
export declare const ENVELOPE_SCHEMA = "uluops.cli/v1";
|
|
21
|
+
/**
|
|
22
|
+
* Per-kind output shape versions — the source of truth for `--json` stability.
|
|
23
|
+
*
|
|
24
|
+
* Most kinds are at `1`. `issue.history` and `deps.get` start at `2` to record
|
|
25
|
+
* the breaking shape change they already shipped in CLI v0.13.0 (the regression
|
|
26
|
+
* this contract was built to prevent recurring silently).
|
|
27
|
+
*
|
|
28
|
+
* A `kind` is a stable logical name for one output shape — usually one per
|
|
29
|
+
* command, but a command that emits a different shape under a flag (e.g.
|
|
30
|
+
* `exec describe` with vs. without a name) gets a distinct kind so the
|
|
31
|
+
* difference is visible to consumers.
|
|
32
|
+
*/
|
|
33
|
+
export declare const SCHEMA_VERSIONS: {
|
|
34
|
+
readonly 'analytics.agents': 1;
|
|
35
|
+
readonly 'analytics.reliability': 1;
|
|
36
|
+
readonly 'analytics.hotspots': 1;
|
|
37
|
+
readonly 'analytics.burndown': 1;
|
|
38
|
+
readonly 'analytics.velocity': 1;
|
|
39
|
+
readonly 'analytics.discovery': 1;
|
|
40
|
+
readonly 'analytics.matrix': 1;
|
|
41
|
+
readonly 'analytics.resolution': 1;
|
|
42
|
+
readonly 'analytics.taxonomy': 1;
|
|
43
|
+
readonly 'analytics.fullTaxonomy': 1;
|
|
44
|
+
readonly 'analytics.trends': 1;
|
|
45
|
+
readonly 'auth.login': 1;
|
|
46
|
+
readonly 'auth.logout': 1;
|
|
47
|
+
readonly 'auth.whoami': 1;
|
|
48
|
+
readonly 'auth.register': 1;
|
|
49
|
+
readonly 'auth.forgotPassword': 1;
|
|
50
|
+
readonly 'auth.resetPassword': 1;
|
|
51
|
+
readonly 'auth.changePassword': 1;
|
|
52
|
+
readonly 'auth.profile': 1;
|
|
53
|
+
readonly 'auth.updateProfile': 1;
|
|
54
|
+
readonly 'auth.sessions.list': 1;
|
|
55
|
+
readonly 'auth.sessions.revoke': 1;
|
|
56
|
+
readonly 'auth.apiKeys.list': 1;
|
|
57
|
+
readonly 'auth.apiKeys.create': 1;
|
|
58
|
+
readonly 'auth.apiKeys.revoke': 1;
|
|
59
|
+
readonly 'definition.list': 1;
|
|
60
|
+
readonly 'definition.getRendered': 1;
|
|
61
|
+
readonly 'definition.get': 1;
|
|
62
|
+
readonly 'definition.create': 1;
|
|
63
|
+
readonly 'definition.update': 1;
|
|
64
|
+
readonly 'definition.publish': 1;
|
|
65
|
+
readonly 'definition.deprecate': 1;
|
|
66
|
+
readonly 'definition.validate': 1;
|
|
67
|
+
readonly 'definition.render': 1;
|
|
68
|
+
readonly 'definition.delete': 1;
|
|
69
|
+
readonly 'deps.get': 2;
|
|
70
|
+
readonly 'deps.dependents': 1;
|
|
71
|
+
readonly 'exec.run': 1;
|
|
72
|
+
readonly 'exec.agent': 1;
|
|
73
|
+
readonly 'exec.agentBatch': 1;
|
|
74
|
+
readonly 'exec.command': 1;
|
|
75
|
+
readonly 'exec.workflow': 1;
|
|
76
|
+
readonly 'exec.pipeline': 1;
|
|
77
|
+
readonly 'exec.list': 1;
|
|
78
|
+
readonly 'exec.describeList': 1;
|
|
79
|
+
readonly 'exec.describe': 1;
|
|
80
|
+
readonly 'execution.record': 1;
|
|
81
|
+
readonly 'execution.stats': 1;
|
|
82
|
+
readonly 'fork.list': 1;
|
|
83
|
+
readonly 'fork.create': 1;
|
|
84
|
+
readonly 'fork.check': 1;
|
|
85
|
+
readonly 'fork.lineage': 1;
|
|
86
|
+
readonly 'issue.list': 1;
|
|
87
|
+
readonly 'issue.getFull': 1;
|
|
88
|
+
readonly 'issue.get': 1;
|
|
89
|
+
readonly 'issue.search': 1;
|
|
90
|
+
readonly 'issue.update': 1;
|
|
91
|
+
readonly 'issue.close': 1;
|
|
92
|
+
readonly 'issue.addNote': 1;
|
|
93
|
+
readonly 'issue.historyList': 1;
|
|
94
|
+
readonly 'issue.history': 2;
|
|
95
|
+
readonly 'issue.undo': 1;
|
|
96
|
+
readonly 'issue.create': 1;
|
|
97
|
+
readonly 'issue.edit': 1;
|
|
98
|
+
readonly 'issue.restore': 1;
|
|
99
|
+
readonly 'issue.bulkUpdate': 1;
|
|
100
|
+
readonly 'issue.byFingerprint': 1;
|
|
101
|
+
readonly 'issue.updateByFingerprint': 1;
|
|
102
|
+
readonly 'language.list': 1;
|
|
103
|
+
readonly 'language.get': 1;
|
|
104
|
+
readonly 'model.list': 1;
|
|
105
|
+
readonly 'model.get': 1;
|
|
106
|
+
readonly 'model.providers': 1;
|
|
107
|
+
readonly 'model.aliases': 1;
|
|
108
|
+
readonly 'model.resolve': 1;
|
|
109
|
+
readonly 'project.list': 1;
|
|
110
|
+
readonly 'project.get': 1;
|
|
111
|
+
readonly 'project.create': 1;
|
|
112
|
+
readonly 'project.delete': 1;
|
|
113
|
+
readonly 'project.restore': 1;
|
|
114
|
+
readonly 'project.summary': 1;
|
|
115
|
+
readonly 'project.trends': 1;
|
|
116
|
+
readonly 'project.rename': 1;
|
|
117
|
+
readonly 'project.bulkUpdateIssues': 1;
|
|
118
|
+
readonly 'project.mergeIssues': 1;
|
|
119
|
+
readonly 'run.list': 1;
|
|
120
|
+
readonly 'run.get': 1;
|
|
121
|
+
readonly 'run.latest': 1;
|
|
122
|
+
readonly 'run.details': 1;
|
|
123
|
+
readonly 'run.save': 1;
|
|
124
|
+
readonly 'run.validate': 1;
|
|
125
|
+
readonly 'run.diff': 1;
|
|
126
|
+
readonly 'run.archive': 1;
|
|
127
|
+
readonly 'run.update': 1;
|
|
128
|
+
readonly 'run.delete': 1;
|
|
129
|
+
readonly 'taxonomy.get': 1;
|
|
130
|
+
readonly 'translation.version': 1;
|
|
131
|
+
readonly 'translation.retranslate': 1;
|
|
132
|
+
readonly 'translation.upgrade': 1;
|
|
133
|
+
readonly 'version.list': 1;
|
|
134
|
+
readonly 'version.diff': 1;
|
|
135
|
+
};
|
|
136
|
+
/** Stable logical name of a `--json` output shape. Derived from the registry. */
|
|
137
|
+
export type JsonKind = keyof typeof SCHEMA_VERSIONS;
|
|
138
|
+
/**
|
|
139
|
+
* Emit `data` as `--json` output when `ctx.json` is set.
|
|
140
|
+
*
|
|
141
|
+
* Returns `true` if it emitted (so the caller can `return` and skip the
|
|
142
|
+
* human-readable branch), `false` if `ctx.json` was not set.
|
|
143
|
+
*
|
|
144
|
+
* Default mode is byte-for-byte identical to `console.log(JSON.stringify(data,
|
|
145
|
+
* null, 2))`. Envelope mode wraps as
|
|
146
|
+
* `{ schema, cliVersion, kind, schemaVersion, data }`.
|
|
147
|
+
*/
|
|
148
|
+
export declare function emitJson(ctx: {
|
|
149
|
+
json: boolean;
|
|
150
|
+
}, data: unknown, kind: JsonKind): boolean;
|
|
151
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/formatters/json.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,2FAA2F;AAC3F,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqHlB,CAAC;AAEX,iFAAiF;AACjF,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,eAAe,CAAC;AAOpD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,EACtB,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,QAAQ,GACb,OAAO,CAoBT"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { getCliVersion } from '../version.js';
|
|
2
|
+
/**
|
|
3
|
+
* The single chokepoint for all machine-readable `--json` output.
|
|
4
|
+
*
|
|
5
|
+
* Every `--json` emission in the CLI flows through {@link emitJson}. In default
|
|
6
|
+
* mode it prints the payload byte-for-byte identically to the historical
|
|
7
|
+
* `console.log(JSON.stringify(value, null, 2))` — the default contract is
|
|
8
|
+
* frozen. When the caller opts in (`ULU_JSON_SCHEMA=1` or `--json-envelope`),
|
|
9
|
+
* the payload is wrapped in a uniform versioned envelope so automated consumers
|
|
10
|
+
* can detect shape changes at runtime instead of breaking silently.
|
|
11
|
+
*
|
|
12
|
+
* ## Stability contract
|
|
13
|
+
* `--json` output shapes are part of the CLI's public API. A change to any
|
|
14
|
+
* default `--json` shape is a BREAKING change and requires a MAJOR version bump.
|
|
15
|
+
* Each logical output owns a `schemaVersion` in {@link SCHEMA_VERSIONS} — the
|
|
16
|
+
* source of truth. When you change a payload shape you MUST bump its
|
|
17
|
+
* `schemaVersion`, add a CHANGELOG `BREAKING` entry, and update its
|
|
18
|
+
* contract-anchor test. See the README "JSON Output Stability Contract" section.
|
|
19
|
+
*/
|
|
20
|
+
/** Identifier of the envelope wrapper format. Bumps only if the wrapper itself changes. */
|
|
21
|
+
export const ENVELOPE_SCHEMA = 'uluops.cli/v1';
|
|
22
|
+
/**
|
|
23
|
+
* Per-kind output shape versions — the source of truth for `--json` stability.
|
|
24
|
+
*
|
|
25
|
+
* Most kinds are at `1`. `issue.history` and `deps.get` start at `2` to record
|
|
26
|
+
* the breaking shape change they already shipped in CLI v0.13.0 (the regression
|
|
27
|
+
* this contract was built to prevent recurring silently).
|
|
28
|
+
*
|
|
29
|
+
* A `kind` is a stable logical name for one output shape — usually one per
|
|
30
|
+
* command, but a command that emits a different shape under a flag (e.g.
|
|
31
|
+
* `exec describe` with vs. without a name) gets a distinct kind so the
|
|
32
|
+
* difference is visible to consumers.
|
|
33
|
+
*/
|
|
34
|
+
export const SCHEMA_VERSIONS = {
|
|
35
|
+
// analytics — kind = `analytics.<subcommand>`
|
|
36
|
+
'analytics.agents': 1,
|
|
37
|
+
'analytics.reliability': 1,
|
|
38
|
+
'analytics.hotspots': 1,
|
|
39
|
+
'analytics.burndown': 1,
|
|
40
|
+
'analytics.velocity': 1,
|
|
41
|
+
'analytics.discovery': 1,
|
|
42
|
+
'analytics.matrix': 1,
|
|
43
|
+
'analytics.resolution': 1,
|
|
44
|
+
'analytics.taxonomy': 1,
|
|
45
|
+
'analytics.fullTaxonomy': 1,
|
|
46
|
+
'analytics.trends': 1,
|
|
47
|
+
// auth
|
|
48
|
+
'auth.login': 1,
|
|
49
|
+
'auth.logout': 1,
|
|
50
|
+
'auth.whoami': 1,
|
|
51
|
+
'auth.register': 1,
|
|
52
|
+
'auth.forgotPassword': 1,
|
|
53
|
+
'auth.resetPassword': 1,
|
|
54
|
+
'auth.changePassword': 1,
|
|
55
|
+
'auth.profile': 1,
|
|
56
|
+
'auth.updateProfile': 1,
|
|
57
|
+
'auth.sessions.list': 1,
|
|
58
|
+
'auth.sessions.revoke': 1,
|
|
59
|
+
'auth.apiKeys.list': 1,
|
|
60
|
+
'auth.apiKeys.create': 1,
|
|
61
|
+
'auth.apiKeys.revoke': 1,
|
|
62
|
+
// definitions
|
|
63
|
+
'definition.list': 1,
|
|
64
|
+
'definition.getRendered': 1,
|
|
65
|
+
'definition.get': 1,
|
|
66
|
+
'definition.create': 1,
|
|
67
|
+
'definition.update': 1,
|
|
68
|
+
'definition.publish': 1,
|
|
69
|
+
'definition.deprecate': 1,
|
|
70
|
+
'definition.validate': 1,
|
|
71
|
+
'definition.render': 1,
|
|
72
|
+
'definition.delete': 1,
|
|
73
|
+
// deps
|
|
74
|
+
'deps.get': 2,
|
|
75
|
+
'deps.dependents': 1,
|
|
76
|
+
// exec
|
|
77
|
+
'exec.run': 1,
|
|
78
|
+
'exec.agent': 1,
|
|
79
|
+
'exec.agentBatch': 1,
|
|
80
|
+
'exec.command': 1,
|
|
81
|
+
'exec.workflow': 1,
|
|
82
|
+
'exec.pipeline': 1,
|
|
83
|
+
'exec.list': 1,
|
|
84
|
+
'exec.describeList': 1,
|
|
85
|
+
'exec.describe': 1,
|
|
86
|
+
// executions
|
|
87
|
+
'execution.record': 1,
|
|
88
|
+
'execution.stats': 1,
|
|
89
|
+
// forks
|
|
90
|
+
'fork.list': 1,
|
|
91
|
+
'fork.create': 1,
|
|
92
|
+
'fork.check': 1,
|
|
93
|
+
'fork.lineage': 1,
|
|
94
|
+
// issues
|
|
95
|
+
'issue.list': 1,
|
|
96
|
+
'issue.getFull': 1,
|
|
97
|
+
'issue.get': 1,
|
|
98
|
+
'issue.search': 1,
|
|
99
|
+
'issue.update': 1,
|
|
100
|
+
'issue.close': 1,
|
|
101
|
+
'issue.addNote': 1,
|
|
102
|
+
'issue.historyList': 1,
|
|
103
|
+
'issue.history': 2,
|
|
104
|
+
'issue.undo': 1,
|
|
105
|
+
'issue.create': 1,
|
|
106
|
+
'issue.edit': 1,
|
|
107
|
+
'issue.restore': 1,
|
|
108
|
+
'issue.bulkUpdate': 1,
|
|
109
|
+
'issue.byFingerprint': 1,
|
|
110
|
+
'issue.updateByFingerprint': 1,
|
|
111
|
+
// languages
|
|
112
|
+
'language.list': 1,
|
|
113
|
+
'language.get': 1,
|
|
114
|
+
// models
|
|
115
|
+
'model.list': 1,
|
|
116
|
+
'model.get': 1,
|
|
117
|
+
'model.providers': 1,
|
|
118
|
+
'model.aliases': 1,
|
|
119
|
+
'model.resolve': 1,
|
|
120
|
+
// projects
|
|
121
|
+
'project.list': 1,
|
|
122
|
+
'project.get': 1,
|
|
123
|
+
'project.create': 1,
|
|
124
|
+
'project.delete': 1,
|
|
125
|
+
'project.restore': 1,
|
|
126
|
+
'project.summary': 1,
|
|
127
|
+
'project.trends': 1,
|
|
128
|
+
'project.rename': 1,
|
|
129
|
+
'project.bulkUpdateIssues': 1,
|
|
130
|
+
'project.mergeIssues': 1,
|
|
131
|
+
// runs
|
|
132
|
+
'run.list': 1,
|
|
133
|
+
'run.get': 1,
|
|
134
|
+
'run.latest': 1,
|
|
135
|
+
'run.details': 1,
|
|
136
|
+
'run.save': 1,
|
|
137
|
+
'run.validate': 1,
|
|
138
|
+
'run.diff': 1,
|
|
139
|
+
'run.archive': 1,
|
|
140
|
+
'run.update': 1,
|
|
141
|
+
'run.delete': 1,
|
|
142
|
+
// taxonomy
|
|
143
|
+
'taxonomy.get': 1,
|
|
144
|
+
// translation
|
|
145
|
+
'translation.version': 1,
|
|
146
|
+
'translation.retranslate': 1,
|
|
147
|
+
'translation.upgrade': 1,
|
|
148
|
+
// versions
|
|
149
|
+
'version.list': 1,
|
|
150
|
+
'version.diff': 1,
|
|
151
|
+
};
|
|
152
|
+
/** True when the versioned envelope is opted into via env var or `--json-envelope`. */
|
|
153
|
+
function envelopeEnabled() {
|
|
154
|
+
return process.env['ULU_JSON_SCHEMA'] === '1';
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Emit `data` as `--json` output when `ctx.json` is set.
|
|
158
|
+
*
|
|
159
|
+
* Returns `true` if it emitted (so the caller can `return` and skip the
|
|
160
|
+
* human-readable branch), `false` if `ctx.json` was not set.
|
|
161
|
+
*
|
|
162
|
+
* Default mode is byte-for-byte identical to `console.log(JSON.stringify(data,
|
|
163
|
+
* null, 2))`. Envelope mode wraps as
|
|
164
|
+
* `{ schema, cliVersion, kind, schemaVersion, data }`.
|
|
165
|
+
*/
|
|
166
|
+
export function emitJson(ctx, data, kind) {
|
|
167
|
+
if (!ctx.json)
|
|
168
|
+
return false;
|
|
169
|
+
if (envelopeEnabled()) {
|
|
170
|
+
console.log(JSON.stringify({
|
|
171
|
+
schema: ENVELOPE_SCHEMA,
|
|
172
|
+
cliVersion: getCliVersion(),
|
|
173
|
+
kind,
|
|
174
|
+
schemaVersion: SCHEMA_VERSIONS[kind],
|
|
175
|
+
data,
|
|
176
|
+
}, null, 2));
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
console.log(JSON.stringify(data, null, 2));
|
|
180
|
+
}
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/formatters/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AAEH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,8CAA8C;IAC9C,kBAAkB,EAAE,CAAC;IACrB,uBAAuB,EAAE,CAAC;IAC1B,oBAAoB,EAAE,CAAC;IACvB,oBAAoB,EAAE,CAAC;IACvB,oBAAoB,EAAE,CAAC;IACvB,qBAAqB,EAAE,CAAC;IACxB,kBAAkB,EAAE,CAAC;IACrB,sBAAsB,EAAE,CAAC;IACzB,oBAAoB,EAAE,CAAC;IACvB,wBAAwB,EAAE,CAAC;IAC3B,kBAAkB,EAAE,CAAC;IACrB,OAAO;IACP,YAAY,EAAE,CAAC;IACf,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;IAChB,eAAe,EAAE,CAAC;IAClB,qBAAqB,EAAE,CAAC;IACxB,oBAAoB,EAAE,CAAC;IACvB,qBAAqB,EAAE,CAAC;IACxB,cAAc,EAAE,CAAC;IACjB,oBAAoB,EAAE,CAAC;IACvB,oBAAoB,EAAE,CAAC;IACvB,sBAAsB,EAAE,CAAC;IACzB,mBAAmB,EAAE,CAAC;IACtB,qBAAqB,EAAE,CAAC;IACxB,qBAAqB,EAAE,CAAC;IACxB,cAAc;IACd,iBAAiB,EAAE,CAAC;IACpB,wBAAwB,EAAE,CAAC;IAC3B,gBAAgB,EAAE,CAAC;IACnB,mBAAmB,EAAE,CAAC;IACtB,mBAAmB,EAAE,CAAC;IACtB,oBAAoB,EAAE,CAAC;IACvB,sBAA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E,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -29,6 +29,22 @@ export declare function formatDisplayDate(date: string | Date | undefined | null
|
|
|
29
29
|
* Truncate a string with ellipsis
|
|
30
30
|
*/
|
|
31
31
|
export declare function truncate(str: string, maxLength: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Strip ANSI escape sequences from server-controlled strings before they
|
|
34
|
+
* reach the user's terminal (post-impl r2, CWE-116).
|
|
35
|
+
*
|
|
36
|
+
* The SDK schemas constrain string lengths but do NOT strip control bytes.
|
|
37
|
+
* A compromised or adversarial registry/tracker API could return a name,
|
|
38
|
+
* version, context, title, or content value containing:
|
|
39
|
+
* - `\x1b[2J\x1b[H` to clear the terminal + reset cursor
|
|
40
|
+
* - `\x1b]0;{title}\x07` to spoof the window title (OSC)
|
|
41
|
+
* - `\x1b[6n` to probe cursor position (RIS)
|
|
42
|
+
* Pass any string sourced from a remote response through this before
|
|
43
|
+
* `console.log` to neutralize the vector. Compliant servers never include
|
|
44
|
+
* these sequences; an attack chain produces visibly-stripped text instead
|
|
45
|
+
* of an injection event.
|
|
46
|
+
*/
|
|
47
|
+
export declare function stripAnsi(str: string): string;
|
|
32
48
|
/**
|
|
33
49
|
* Print error message and exit
|
|
34
50
|
*/
|
|
@@ -121,10 +137,23 @@ export declare function promptInput(question: string, options?: {
|
|
|
121
137
|
hidden?: boolean;
|
|
122
138
|
}): Promise<string>;
|
|
123
139
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
140
|
+
* Gate a destructive action behind confirmation, failing closed when it cannot
|
|
141
|
+
* prompt.
|
|
142
|
+
*
|
|
143
|
+
* Behavior:
|
|
144
|
+
* - `skip` (from --yes/-y): proceed immediately, no prompt.
|
|
145
|
+
* - Interactive TTY: prompt; a non-"yes" answer cancels cleanly (exit 0) — the
|
|
146
|
+
* user made a deliberate choice not to proceed.
|
|
147
|
+
* - Non-interactive (no TTY) WITHOUT --yes: there is no one to answer, so the
|
|
148
|
+
* absence of a "yes" is not a deliberate decline. Fail closed — write an
|
|
149
|
+
* actionable message to stderr and exit non-zero — instead of silently
|
|
150
|
+
* skipping the action with a success code. A captive CI/automation caller
|
|
151
|
+
* cannot distinguish a silent exit-0 skip from a successful deletion, so the
|
|
152
|
+
* skip path must be loud and non-zero.
|
|
153
|
+
*
|
|
154
|
+
* Never returns when it cancels or fails closed (it calls process.exit).
|
|
126
155
|
*/
|
|
127
|
-
export declare function
|
|
156
|
+
export declare function confirmOrExit(message: string, skip?: boolean): Promise<void>;
|
|
128
157
|
/** Strip UTF-8 BOM (byte order mark) that some editors prepend */
|
|
129
158
|
export declare function stripBom(content: string): string;
|
|
130
159
|
/**
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AASA,OAAY,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAEpC;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAK/C;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,GAAG,EAAE;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,EACvC,OAAO,EAAE,kBAAkB,EAC3B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAYZ;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GAAG,IAAI,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AAE,OAAO,CAAC,CAG1E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAcrD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAC9D,GAAG,EAAE,CAAC,EACN,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,CAAC,GACd,CAAC,CAYH;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAMnE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7B,OAAO,CAAC,MAAM,CAAC,CA4CjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,IAAI,UAAQ,GACX,OAAO,CAAC,IAAI,CAAC,CAcf;AAKD,kEAAkE;AAClE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC,OAAO,CAAC,CAyDnB"}
|
package/dist/utils.js
CHANGED
|
@@ -44,6 +44,36 @@ export function truncate(str, maxLength) {
|
|
|
44
44
|
return str;
|
|
45
45
|
return str.slice(0, maxLength - 3) + '...';
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Strip ANSI escape sequences from server-controlled strings before they
|
|
49
|
+
* reach the user's terminal (post-impl r2, CWE-116).
|
|
50
|
+
*
|
|
51
|
+
* The SDK schemas constrain string lengths but do NOT strip control bytes.
|
|
52
|
+
* A compromised or adversarial registry/tracker API could return a name,
|
|
53
|
+
* version, context, title, or content value containing:
|
|
54
|
+
* - `\x1b[2J\x1b[H` to clear the terminal + reset cursor
|
|
55
|
+
* - `\x1b]0;{title}\x07` to spoof the window title (OSC)
|
|
56
|
+
* - `\x1b[6n` to probe cursor position (RIS)
|
|
57
|
+
* Pass any string sourced from a remote response through this before
|
|
58
|
+
* `console.log` to neutralize the vector. Compliant servers never include
|
|
59
|
+
* these sequences; an attack chain produces visibly-stripped text instead
|
|
60
|
+
* of an injection event.
|
|
61
|
+
*/
|
|
62
|
+
export function stripAnsi(str) {
|
|
63
|
+
// Biome flags control bytes in regexes as suspicious because they're
|
|
64
|
+
// usually accidental — here they're load-bearing for the CWE-116 strip,
|
|
65
|
+
// explicitly documented in the JSDoc above, and confined to this helper.
|
|
66
|
+
return (str
|
|
67
|
+
// CSI sequence: ESC [ ... letter
|
|
68
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: CSI ESC (0x1b)
|
|
69
|
+
.replace(/\x1b\[[0-9;?]*[a-zA-Z]/g, '')
|
|
70
|
+
// OSC sequence: ESC ] ... BEL
|
|
71
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: OSC framed by ESC (0x1b) ... BEL (0x07)
|
|
72
|
+
.replace(/\x1b\][^\x07]*\x07/g, '')
|
|
73
|
+
// Bare control chars below 0x20 (except tab/newline/cr) + DEL.
|
|
74
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: stripping bare control bytes is the point
|
|
75
|
+
.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, ''));
|
|
76
|
+
}
|
|
47
77
|
/**
|
|
48
78
|
* Print error message and exit
|
|
49
79
|
*/
|
|
@@ -299,14 +329,35 @@ export function promptInput(question, options) {
|
|
|
299
329
|
});
|
|
300
330
|
}
|
|
301
331
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
332
|
+
* Gate a destructive action behind confirmation, failing closed when it cannot
|
|
333
|
+
* prompt.
|
|
334
|
+
*
|
|
335
|
+
* Behavior:
|
|
336
|
+
* - `skip` (from --yes/-y): proceed immediately, no prompt.
|
|
337
|
+
* - Interactive TTY: prompt; a non-"yes" answer cancels cleanly (exit 0) — the
|
|
338
|
+
* user made a deliberate choice not to proceed.
|
|
339
|
+
* - Non-interactive (no TTY) WITHOUT --yes: there is no one to answer, so the
|
|
340
|
+
* absence of a "yes" is not a deliberate decline. Fail closed — write an
|
|
341
|
+
* actionable message to stderr and exit non-zero — instead of silently
|
|
342
|
+
* skipping the action with a success code. A captive CI/automation caller
|
|
343
|
+
* cannot distinguish a silent exit-0 skip from a successful deletion, so the
|
|
344
|
+
* skip path must be loud and non-zero.
|
|
345
|
+
*
|
|
346
|
+
* Never returns when it cancels or fails closed (it calls process.exit).
|
|
304
347
|
*/
|
|
305
|
-
export async function
|
|
306
|
-
if (
|
|
307
|
-
return
|
|
348
|
+
export async function confirmOrExit(message, skip = false) {
|
|
349
|
+
if (skip)
|
|
350
|
+
return;
|
|
351
|
+
if (!process.stdin.isTTY) {
|
|
352
|
+
console.error('Confirmation required, but stdin is not an interactive terminal.');
|
|
353
|
+
console.error('Re-run with --yes (-y) to proceed non-interactively.');
|
|
354
|
+
process.exit(1);
|
|
355
|
+
}
|
|
308
356
|
const answer = await promptInput(`${message} [y/N] `);
|
|
309
|
-
|
|
357
|
+
if (answer.toLowerCase() !== 'y' && answer.toLowerCase() !== 'yes') {
|
|
358
|
+
console.log('Cancelled');
|
|
359
|
+
process.exit(0);
|
|
360
|
+
}
|
|
310
361
|
}
|
|
311
362
|
/** Timeout for reading from stdin (30 seconds) */
|
|
312
363
|
const STDIN_TIMEOUT_MS = 30_000;
|