opensip-cli 0.1.4 → 0.1.6
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/bootstrap/admit-tool-package.d.ts +15 -1
- package/dist/bootstrap/admit-tool-package.d.ts.map +1 -1
- package/dist/bootstrap/admit-tool-package.js +22 -2
- package/dist/bootstrap/admit-tool-package.js.map +1 -1
- package/dist/bootstrap/authored-tool-admission.d.ts +23 -0
- package/dist/bootstrap/authored-tool-admission.d.ts.map +1 -0
- package/dist/bootstrap/authored-tool-admission.js +54 -0
- package/dist/bootstrap/authored-tool-admission.js.map +1 -0
- package/dist/bootstrap/build-per-run-scope.d.ts.map +1 -1
- package/dist/bootstrap/build-per-run-scope.js +0 -14
- package/dist/bootstrap/build-per-run-scope.js.map +1 -1
- package/dist/bootstrap/config-and-capabilities.d.ts +5 -3
- package/dist/bootstrap/config-and-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/config-and-capabilities.js +11 -8
- package/dist/bootstrap/config-and-capabilities.js.map +1 -1
- package/dist/bootstrap/execute-post-bailout-bootstrap.d.ts +1 -0
- package/dist/bootstrap/execute-post-bailout-bootstrap.d.ts.map +1 -1
- package/dist/bootstrap/execute-post-bailout-bootstrap.js +3 -2
- package/dist/bootstrap/execute-post-bailout-bootstrap.js.map +1 -1
- package/dist/bootstrap/installed-tool-admission.d.ts +20 -0
- package/dist/bootstrap/installed-tool-admission.d.ts.map +1 -0
- package/dist/bootstrap/installed-tool-admission.js +60 -0
- package/dist/bootstrap/installed-tool-admission.js.map +1 -0
- package/dist/bootstrap/load-tool-capabilities.d.ts +2 -2
- package/dist/bootstrap/load-tool-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/load-tool-capabilities.js +2 -12
- package/dist/bootstrap/load-tool-capabilities.js.map +1 -1
- package/dist/bootstrap/plan-pre-action-bootstrap.d.ts +5 -5
- package/dist/bootstrap/plan-pre-action-bootstrap.d.ts.map +1 -1
- package/dist/bootstrap/plan-pre-action-bootstrap.js +3 -19
- package/dist/bootstrap/plan-pre-action-bootstrap.js.map +1 -1
- package/dist/bootstrap/pre-action-guards.d.ts +2 -1
- package/dist/bootstrap/pre-action-guards.d.ts.map +1 -1
- package/dist/bootstrap/pre-action-guards.js +3 -27
- package/dist/bootstrap/pre-action-guards.js.map +1 -1
- package/dist/bootstrap/pre-action-hook.d.ts +2 -1
- package/dist/bootstrap/pre-action-hook.d.ts.map +1 -1
- package/dist/bootstrap/pre-action-hook.js +4 -2
- package/dist/bootstrap/pre-action-hook.js.map +1 -1
- package/dist/bootstrap/register-tools-discovery.d.ts +0 -59
- package/dist/bootstrap/register-tools-discovery.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-discovery.js +6 -179
- package/dist/bootstrap/register-tools-discovery.js.map +1 -1
- package/dist/bootstrap/register-tools.d.ts +2 -1
- package/dist/bootstrap/register-tools.d.ts.map +1 -1
- package/dist/bootstrap/register-tools.js +2 -1
- package/dist/bootstrap/register-tools.js.map +1 -1
- package/dist/bootstrap/tool-admission-types.d.ts +12 -0
- package/dist/bootstrap/tool-admission-types.d.ts.map +1 -0
- package/dist/bootstrap/tool-admission-types.js +2 -0
- package/dist/bootstrap/tool-admission-types.js.map +1 -0
- package/dist/bootstrap/validate-tool.d.ts +1 -1
- package/dist/bootstrap/validate-tool.d.ts.map +1 -1
- package/dist/bootstrap/validate-tool.js +6 -2
- package/dist/bootstrap/validate-tool.js.map +1 -1
- package/dist/commands/command-scope-index.d.ts +31 -0
- package/dist/commands/command-scope-index.d.ts.map +1 -0
- package/dist/commands/command-scope-index.js +42 -0
- package/dist/commands/command-scope-index.js.map +1 -0
- package/dist/commands/host-command-specs.js +2 -2
- package/dist/commands/host-command-specs.js.map +1 -1
- package/dist/commands/mount-command-action.d.ts +19 -0
- package/dist/commands/mount-command-action.d.ts.map +1 -0
- package/dist/commands/mount-command-action.js +54 -0
- package/dist/commands/mount-command-action.js.map +1 -0
- package/dist/commands/mount-command-spec-wiring.d.ts +24 -0
- package/dist/commands/mount-command-spec-wiring.d.ts.map +1 -0
- package/dist/commands/mount-command-spec-wiring.js +71 -0
- package/dist/commands/mount-command-spec-wiring.js.map +1 -0
- package/dist/commands/mount-command-spec.d.ts.map +1 -1
- package/dist/commands/mount-command-spec.js +2 -134
- package/dist/commands/mount-command-spec.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -17
- package/dist/index.js.map +1 -1
- package/dist/telemetry/profiling.d.ts +1 -1
- package/dist/telemetry/profiling.d.ts.map +1 -1
- package/dist/telemetry/profiling.js +93 -35
- package/dist/telemetry/profiling.js.map +1 -1
- package/dist/ui/result-to-view.d.ts.map +1 -1
- package/dist/ui/result-to-view.js +4 -12
- package/dist/ui/result-to-view.js.map +1 -1
- package/package.json +32 -32
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ToolPluginManifest, ToolProvenance } from '@opensip-cli/core';
|
|
2
|
+
/**
|
|
3
|
+
* The outcome of admitting a tool — the recorded `ToolProvenance` plus the
|
|
4
|
+
* loaded `ToolPluginManifest`. The manifest is returned (not re-read) so the
|
|
5
|
+
* register step can run the drift guard against the imported runtime and seed
|
|
6
|
+
* the per-run capability registry without a second filesystem read.
|
|
7
|
+
*/
|
|
8
|
+
export interface ToolAdmission {
|
|
9
|
+
readonly provenance: ToolProvenance;
|
|
10
|
+
readonly manifest: ToolPluginManifest;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=tool-admission-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-admission-types.d.ts","sourceRoot":"","sources":["../../src/bootstrap/tool-admission-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-admission-types.js","sourceRoot":"","sources":["../../src/bootstrap/tool-admission-types.ts"],"names":[],"mappings":""}
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
* tool that is not allowlisted is fail-closed without its code ever running,
|
|
18
18
|
* and never reaches `isValidTool`.
|
|
19
19
|
*/
|
|
20
|
-
import type
|
|
20
|
+
import { type Tool } from '@opensip-cli/core';
|
|
21
21
|
export declare function isValidTool(value: unknown): value is Tool;
|
|
22
22
|
//# sourceMappingURL=validate-tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-tool.d.ts","sourceRoot":"","sources":["../../src/bootstrap/validate-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"validate-tool.d.ts","sourceRoot":"","sources":["../../src/bootstrap/validate-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAuB,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEnE,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAkBzD"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* tool that is not allowlisted is fail-closed without its code ever running,
|
|
18
18
|
* and never reaches `isValidTool`.
|
|
19
19
|
*/
|
|
20
|
+
import { validateCommandSpec } from '@opensip-cli/core';
|
|
20
21
|
export function isValidTool(value) {
|
|
21
22
|
if (typeof value !== 'object' || value === null)
|
|
22
23
|
return false;
|
|
@@ -30,9 +31,12 @@ export function isValidTool(value) {
|
|
|
30
31
|
// A tool must expose a command surface: a non-empty declarative `commandSpecs`
|
|
31
32
|
// array (the one command surface, launch — `register()` was removed). A tool
|
|
32
33
|
// with no commandSpecs cannot contribute any command and is rejected.
|
|
33
|
-
|
|
34
|
-
if (!hasSpecs)
|
|
34
|
+
if (!Array.isArray(candidate.commandSpecs) || candidate.commandSpecs.length === 0)
|
|
35
35
|
return false;
|
|
36
|
+
for (const spec of candidate.commandSpecs) {
|
|
37
|
+
if (!validateCommandSpec(spec))
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
36
40
|
return true;
|
|
37
41
|
}
|
|
38
42
|
//# sourceMappingURL=validate-tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-tool.js","sourceRoot":"","sources":["../../src/bootstrap/validate-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"validate-tool.js","sourceRoot":"","sources":["../../src/bootstrap/validate-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,mBAAmB,EAAa,MAAM,mBAAmB,CAAC;AAEnE,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,SAAS,GAAG,KAIjB,CAAC;IACF,IAAI,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ,IAAI,SAAS,CAAC,QAAQ,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACxF,IAAI,OAAQ,SAAS,CAAC,QAA6B,CAAC,EAAE,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAClF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IACrD,+EAA+E;IAC/E,6EAA6E;IAC7E,sEAAsE;IACtE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAChG,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,YAAY,EAAE,CAAC;QAC1C,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* command-scope-index — the runtime lookup used by pre-action bootstrap to
|
|
3
|
+
* decide whether a command may run without an opensip-cli project.
|
|
4
|
+
*
|
|
5
|
+
* The index is built from the same declarative CommandSpecs that are mounted
|
|
6
|
+
* into Commander: top-level host specs, grouped host leaves, and tool
|
|
7
|
+
* commandSpecs. This keeps `CommandSpec.scope` as the source of truth instead
|
|
8
|
+
* of a parallel allowlist.
|
|
9
|
+
*/
|
|
10
|
+
import type { HostSubcommandGroup } from './host-subcommand-groups.js';
|
|
11
|
+
import type { CommandScopeRequirement } from '@opensip-cli/core';
|
|
12
|
+
import type { Command } from 'commander';
|
|
13
|
+
export type CommandScopeIndex = ReadonlyMap<string, CommandScopeRequirement>;
|
|
14
|
+
export interface CommandScopeSpec {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly aliases?: readonly string[];
|
|
17
|
+
readonly scope: CommandScopeRequirement;
|
|
18
|
+
}
|
|
19
|
+
export interface CommandScopeIndexInput {
|
|
20
|
+
readonly hostSpecs: readonly CommandScopeSpec[];
|
|
21
|
+
readonly hostGroups: readonly HostSubcommandGroup[];
|
|
22
|
+
readonly toolSpecs: readonly CommandScopeSpec[];
|
|
23
|
+
}
|
|
24
|
+
export declare function buildCommandScopeIndex(input: CommandScopeIndexInput): CommandScopeIndex;
|
|
25
|
+
/**
|
|
26
|
+
* Commander exposes the invoked leaf as `actionCommand`; walk its parents back
|
|
27
|
+
* to the root program and keep only real subcommands. For `opensip tools list`,
|
|
28
|
+
* this returns `tools list`, not just `list`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function commandPath(actionCommand: Command): string;
|
|
31
|
+
//# sourceMappingURL=command-scope-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-scope-index.d.ts","sourceRoot":"","sources":["../../src/commands/command-scope-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAE7E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,uBAAuB,CAAC;CACzC;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAChD,QAAQ,CAAC,UAAU,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACjD;AAaD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,sBAAsB,GAAG,iBAAiB,CAUvF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,CAU1D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* command-scope-index — the runtime lookup used by pre-action bootstrap to
|
|
3
|
+
* decide whether a command may run without an opensip-cli project.
|
|
4
|
+
*
|
|
5
|
+
* The index is built from the same declarative CommandSpecs that are mounted
|
|
6
|
+
* into Commander: top-level host specs, grouped host leaves, and tool
|
|
7
|
+
* commandSpecs. This keeps `CommandSpec.scope` as the source of truth instead
|
|
8
|
+
* of a parallel allowlist.
|
|
9
|
+
*/
|
|
10
|
+
function addSpec(index, pathPrefix, spec) {
|
|
11
|
+
const names = [spec.name, ...(spec.aliases ?? [])];
|
|
12
|
+
names.forEach((name) => {
|
|
13
|
+
index.set(pathPrefix === undefined ? name : `${pathPrefix} ${name}`, spec.scope);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export function buildCommandScopeIndex(input) {
|
|
17
|
+
const index = new Map();
|
|
18
|
+
input.toolSpecs.forEach((spec) => addSpec(index, undefined, spec));
|
|
19
|
+
input.hostSpecs.forEach((spec) => addSpec(index, undefined, spec));
|
|
20
|
+
input.hostGroups.forEach((group) => {
|
|
21
|
+
group.leaves.forEach((leaf) => addSpec(index, group.name, leaf));
|
|
22
|
+
});
|
|
23
|
+
return index;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Commander exposes the invoked leaf as `actionCommand`; walk its parents back
|
|
27
|
+
* to the root program and keep only real subcommands. For `opensip tools list`,
|
|
28
|
+
* this returns `tools list`, not just `list`.
|
|
29
|
+
*/
|
|
30
|
+
export function commandPath(actionCommand) {
|
|
31
|
+
const parts = [];
|
|
32
|
+
let cursor = actionCommand;
|
|
33
|
+
while (cursor !== null) {
|
|
34
|
+
if (cursor.parent !== null)
|
|
35
|
+
parts.push(cursor.name());
|
|
36
|
+
cursor = cursor.parent;
|
|
37
|
+
}
|
|
38
|
+
const ordered = [...parts];
|
|
39
|
+
ordered.reverse();
|
|
40
|
+
return ordered.join(' ');
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=command-scope-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-scope-index.js","sourceRoot":"","sources":["../../src/commands/command-scope-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoBH,SAAS,OAAO,CACd,KAA2C,EAC3C,UAA8B,EAC9B,IAAsB;IAEtB,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC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AAC;IACzB,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAC3B,OAAO,CAAC,OAAO,EAAE,CAAC;IAClB,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -66,7 +66,7 @@ function buildInitSpec(ctx) {
|
|
|
66
66
|
default: false,
|
|
67
67
|
},
|
|
68
68
|
],
|
|
69
|
-
scope: '
|
|
69
|
+
scope: 'none',
|
|
70
70
|
output: COMMAND_RESULT,
|
|
71
71
|
handler: (rawOpts) => {
|
|
72
72
|
const opts = rawOpts;
|
|
@@ -206,7 +206,7 @@ function buildUninstallSpec() {
|
|
|
206
206
|
},
|
|
207
207
|
{ flag: '--json', description: 'Output structured JSON', default: false },
|
|
208
208
|
],
|
|
209
|
-
scope: '
|
|
209
|
+
scope: 'none',
|
|
210
210
|
output: COMMAND_RESULT,
|
|
211
211
|
handler: (rawOpts) => {
|
|
212
212
|
const opts = rawOpts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-command-specs.js","sourceRoot":"","sources":["../../src/commands/host-command-specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAuB,MAAM,mBAAmB,CAAC;AAE3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,GAItB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAiB,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKlD,kFAAkF;AAClF,MAAM,cAAc,GAAG,gBAAyB,CAAC;AAYjD,SAAS,aAAa,CAAC,GAAuB;IAC5C,OAAO,aAAa,CAA8B;QAChD,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,6EAA6E;QAC1F,0EAA0E;QAC1E,uEAAuE;QACvE,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;QACrC,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,QAAQ;gBACf,WAAW,EACT,6HAA6H;gBAC/H,YAAY,EAAE,EAAE;gBAChB,KAAK,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,GAAI,IAAiB,EAAE,GAAG,CAAC;aACnD;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uEAAuE;gBACpF,OAAO,EAAE,KAAK;aACf;YACD;gBACE,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,oDAAoD;gBACjE,OAAO,EAAE,KAAK;aACf;SACF;QACD,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"host-command-specs.js","sourceRoot":"","sources":["../../src/commands/host-command-specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAuB,MAAM,mBAAmB,CAAC;AAE3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,GAItB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAg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EAAE,yBAAyB,CAAC,GAAG,CAAC;KACvC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAuB;IAC5D,OAAO;QACL,aAAa,CAAC,GAAG,CAAC;QAClB,eAAe,EAAE;QACjB,kBAAkB,EAAE;QACpB,qBAAqB,EAAE;QACvB,mBAAmB,CAAC,GAAG,CAAC;QACxB,kBAAkB,EAAE;KACrB,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAmB,EAAE,GAAuB;IAC5E,KAAK,MAAM,IAAI,IAAI,sBAAsB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,yBAAyB,CAAC,GAAG,CAAC,EAAE,CAAC;QACnD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC1E,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAChC,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commander action callback helpers for the CommandSpec mount layer.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Split a Commander action callback's variadic arguments into the parsed-opts
|
|
6
|
+
* object and the trailing positional args.
|
|
7
|
+
*
|
|
8
|
+
* Commander calls `action((...positionalArgs, optsObject, command))`: the
|
|
9
|
+
* declared positionals come first, then the parsed-options object, then the
|
|
10
|
+
* `Command` instance.
|
|
11
|
+
*
|
|
12
|
+
* @throws {Error} When Commander does not provide a final Command argument, or
|
|
13
|
+
* when argument splitting would select the Command object as parsed options.
|
|
14
|
+
*/
|
|
15
|
+
export declare function splitActionArgs(actionArgs: readonly unknown[]): {
|
|
16
|
+
opts: Record<string, unknown>;
|
|
17
|
+
positionals: readonly unknown[];
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=mount-command-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-command-action.d.ts","sourceRoot":"","sources":["../../src/commands/mount-command-action.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,SAAS,OAAO,EAAE,GAAG;IAC/D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,WAAW,EAAE,SAAS,OAAO,EAAE,CAAC;CACjC,CAgCA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commander action callback helpers for the CommandSpec mount layer.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Best-effort guard: does `x` look like a Commander `Command` instance?
|
|
6
|
+
* Used defensively in splitActionArgs so we never treat the Command object
|
|
7
|
+
* as the parsed opts.
|
|
8
|
+
*/
|
|
9
|
+
function isLikelyCommanderCommand(x) {
|
|
10
|
+
if (!x || typeof x !== 'object')
|
|
11
|
+
return false;
|
|
12
|
+
const c = x;
|
|
13
|
+
return (typeof c.name === 'function' ||
|
|
14
|
+
typeof c.opts === 'function' ||
|
|
15
|
+
typeof c.command === 'function' ||
|
|
16
|
+
(typeof c.constructor === 'function' && /Command/i.test(c.constructor.name || '')));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Split a Commander action callback's variadic arguments into the parsed-opts
|
|
20
|
+
* object and the trailing positional args.
|
|
21
|
+
*
|
|
22
|
+
* Commander calls `action((...positionalArgs, optsObject, command))`: the
|
|
23
|
+
* declared positionals come first, then the parsed-options object, then the
|
|
24
|
+
* `Command` instance.
|
|
25
|
+
*
|
|
26
|
+
* @throws {Error} When Commander does not provide a final Command argument, or
|
|
27
|
+
* when argument splitting would select the Command object as parsed options.
|
|
28
|
+
*/
|
|
29
|
+
export function splitActionArgs(actionArgs) {
|
|
30
|
+
if (actionArgs.length === 0) {
|
|
31
|
+
return { opts: {}, positionals: [] };
|
|
32
|
+
}
|
|
33
|
+
const lastIdx = actionArgs.length - 1;
|
|
34
|
+
if (!isLikelyCommanderCommand(actionArgs[lastIdx])) {
|
|
35
|
+
throw new Error('mountCommandSpec: splitActionArgs could not locate Commander Command as the final action argument. ' +
|
|
36
|
+
'This indicates an incompatible Commander version or a wrapped dispatch. ' +
|
|
37
|
+
'Please report this with your Commander version.');
|
|
38
|
+
}
|
|
39
|
+
for (let i = lastIdx - 1; i >= 0; i--) {
|
|
40
|
+
const v = actionArgs[i];
|
|
41
|
+
if (v && typeof v === 'object' && !Array.isArray(v) && !isLikelyCommanderCommand(v)) {
|
|
42
|
+
const opts = v;
|
|
43
|
+
const positionals = actionArgs.slice(0, i);
|
|
44
|
+
if (isLikelyCommanderCommand(opts)) {
|
|
45
|
+
throw new Error('mountCommandSpec: splitActionArgs selected a Commander Command as the parsed opts. ' +
|
|
46
|
+
'Refusing to dispatch — this is a bug in argument splitting.');
|
|
47
|
+
}
|
|
48
|
+
return { opts, positionals };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const positionals = actionArgs.slice(0, lastIdx);
|
|
52
|
+
return { opts: {}, positionals };
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=mount-command-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-command-action.js","sourceRoot":"","sources":["../../src/commands/mount-command-action.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,SAAS,wBAAwB,CAAC,CAAU;IAC1C,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9C,MAAM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IAAI,KAAK,CACb,qFAAqF;oBACnF,6DAA6D,CAChE,CAAC;YACJ,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commander wiring helpers for declarative CommandSpec inputs.
|
|
3
|
+
*
|
|
4
|
+
* Kept out of mount-command-spec.ts so option/argument translation can evolve
|
|
5
|
+
* independently from the host-owned command lifecycle.
|
|
6
|
+
*/
|
|
7
|
+
import { Option } from 'commander';
|
|
8
|
+
import type { ArgSpec, OptionSpec } from '@opensip-cli/core';
|
|
9
|
+
/**
|
|
10
|
+
* Build a Commander {@link Option} from an {@link OptionSpec}, covering every
|
|
11
|
+
* shape in the first-party flag corpus: boolean / value, negatable `--no-`,
|
|
12
|
+
* literal `default` and repeatable `arrayDefault`, `choices`, the pure `parse`
|
|
13
|
+
* argParser, variadic, and `required` (mandatory).
|
|
14
|
+
*
|
|
15
|
+
* @throws {Error} When the spec marks a boolean (valueless) option `required`
|
|
16
|
+
* — only value options can be made mandatory.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildOption(spec: OptionSpec, commandName: string): Option;
|
|
19
|
+
/**
|
|
20
|
+
* Format an {@link ArgSpec} into Commander argument-usage syntax: `<name>`
|
|
21
|
+
* (required), `[name]` (optional), with `...` appended for variadic.
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatArgUsage(spec: ArgSpec): string;
|
|
24
|
+
//# sourceMappingURL=mount-command-spec-wiring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-command-spec-wiring.d.ts","sourceRoot":"","sources":["../../src/commands/mount-command-spec-wiring.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE7D;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CA+BzE;AAiBD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAGpD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commander wiring helpers for declarative CommandSpec inputs.
|
|
3
|
+
*
|
|
4
|
+
* Kept out of mount-command-spec.ts so option/argument translation can evolve
|
|
5
|
+
* independently from the host-owned command lifecycle.
|
|
6
|
+
*/
|
|
7
|
+
import { Option } from 'commander';
|
|
8
|
+
/**
|
|
9
|
+
* Build a Commander {@link Option} from an {@link OptionSpec}, covering every
|
|
10
|
+
* shape in the first-party flag corpus: boolean / value, negatable `--no-`,
|
|
11
|
+
* literal `default` and repeatable `arrayDefault`, `choices`, the pure `parse`
|
|
12
|
+
* argParser, variadic, and `required` (mandatory).
|
|
13
|
+
*
|
|
14
|
+
* @throws {Error} When the spec marks a boolean (valueless) option `required`
|
|
15
|
+
* — only value options can be made mandatory.
|
|
16
|
+
*/
|
|
17
|
+
export function buildOption(spec, commandName) {
|
|
18
|
+
const valuePlaceholder = resolveValuePlaceholder(spec);
|
|
19
|
+
const flags = valuePlaceholder === undefined ? spec.flag : `${spec.flag} ${valuePlaceholder}`;
|
|
20
|
+
const option = new Option(flags, spec.description);
|
|
21
|
+
if (spec.choices !== undefined && spec.choices.length > 0) {
|
|
22
|
+
option.choices([...spec.choices]);
|
|
23
|
+
}
|
|
24
|
+
if (spec.parse !== undefined) {
|
|
25
|
+
// Commander's argParser is `(value, previous) => next` — exactly the
|
|
26
|
+
// declared `OptionSpec.parse` reducer shape (Number coercion, repeatable
|
|
27
|
+
// accumulation, validated ints).
|
|
28
|
+
option.argParser(spec.parse);
|
|
29
|
+
}
|
|
30
|
+
// `arrayDefault` (repeatable accumulators) wins over a scalar `default`;
|
|
31
|
+
// Commander uses it as the seed the `parse` reducer accumulates onto.
|
|
32
|
+
if (spec.arrayDefault !== undefined) {
|
|
33
|
+
option.default([...spec.arrayDefault]);
|
|
34
|
+
}
|
|
35
|
+
else if (spec.default !== undefined) {
|
|
36
|
+
option.default(spec.default);
|
|
37
|
+
}
|
|
38
|
+
if (spec.required === true) {
|
|
39
|
+
if (valuePlaceholder === undefined) {
|
|
40
|
+
throw new Error(`mountCommandSpec: command '${commandName}' option '${spec.flag}' is required but takes no value; ` +
|
|
41
|
+
'only value options can be required.');
|
|
42
|
+
}
|
|
43
|
+
option.makeOptionMandatory(true);
|
|
44
|
+
}
|
|
45
|
+
return option;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolve the value placeholder for an option, applying variadic `...` when
|
|
49
|
+
* declared. Returns `undefined` for a boolean / negatable flag (no value).
|
|
50
|
+
*/
|
|
51
|
+
function resolveValuePlaceholder(spec) {
|
|
52
|
+
if (spec.negatable === true)
|
|
53
|
+
return undefined;
|
|
54
|
+
if (spec.value === undefined)
|
|
55
|
+
return undefined;
|
|
56
|
+
if (spec.variadic === true && !spec.value.includes('...')) {
|
|
57
|
+
// Inject the variadic ellipsis inside the existing bracket pair, e.g.
|
|
58
|
+
// `<slug>` -> `<slug...>`, `[path]` -> `[path...]`.
|
|
59
|
+
return spec.value.replace(/([>\]])$/, '...$1');
|
|
60
|
+
}
|
|
61
|
+
return spec.value;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Format an {@link ArgSpec} into Commander argument-usage syntax: `<name>`
|
|
65
|
+
* (required), `[name]` (optional), with `...` appended for variadic.
|
|
66
|
+
*/
|
|
67
|
+
export function formatArgUsage(spec) {
|
|
68
|
+
const inner = spec.variadic === true ? `${spec.name}...` : spec.name;
|
|
69
|
+
return spec.optional === true ? `[${inner}]` : `<${inner}>`;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=mount-command-spec-wiring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-command-spec-wiring.js","sourceRoot":"","sources":["../../src/commands/mount-command-spec-wiring.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,IAAgB,EAAE,WAAmB;IAC/D,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,gBAAgB,EAAE,CAAC;IAC9F,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC7B,qEAAqE;QACrE,yEAAyE;QACzE,iCAAiC;QACjC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,yEAAyE;IACzE,sEAAsE;IACtE,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACzC,CAAC;SAAM,IAAI,IAAI,CAAC,OAA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
|
1
|
-
{"version":3,"file":"mount-command-spec.d.ts","sourceRoot":"","sources":["../../src/commands/mount-command-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"mount-command-spec.d.ts","sourceRoot":"","sources":["../../src/commands/mount-command-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AAElG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACpD;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,OAAO,EACb,WAAW,CAAC,EAAE,eAAe,KAC1B,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,mBAAmB,EAC/D,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,EAChC,GAAG,EAAE,IAAI,GACR,IAAI,CA4DN;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,wBAAsB,cAAc,CAAC,IAAI,SAAS,mBAAmB,EACnE,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,EAChC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,WAAW,EAAE,SAAS,OAAO,EAAE,EAC/B,GAAG,EAAE,IAAI,GACR,OAAO,CAAC,IAAI,CAAC,CAyDf"}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { applyCommonFlags, mapToolErrorToExitCode, } from '@opensip-cli/contracts';
|
|
17
17
|
import { ToolError, currentScope, } from '@opensip-cli/core';
|
|
18
|
-
import {
|
|
18
|
+
import { splitActionArgs } from './mount-command-action.js';
|
|
19
|
+
import { buildOption, formatArgUsage } from './mount-command-spec-wiring.js';
|
|
19
20
|
import { emitCommandResult } from './mount-result-command.js';
|
|
20
21
|
/**
|
|
21
22
|
* Mount a declarative {@link CommandSpec} onto `program` as a fully wired
|
|
@@ -174,137 +175,4 @@ export async function dispatchOutput(result, spec, opts, positionals, ctx) {
|
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
|
-
/**
|
|
178
|
-
* Build a Commander {@link Option} from an {@link OptionSpec}, covering every
|
|
179
|
-
* shape in the first-party flag corpus: boolean / value, negatable `--no-`,
|
|
180
|
-
* literal `default` and repeatable `arrayDefault`, `choices`, the pure `parse`
|
|
181
|
-
* argParser, variadic, and `required` (mandatory).
|
|
182
|
-
*
|
|
183
|
-
* @throws {Error} When the spec marks a boolean (valueless) option `required`
|
|
184
|
-
* — only value options can be made mandatory.
|
|
185
|
-
*/
|
|
186
|
-
function buildOption(spec, commandName) {
|
|
187
|
-
const valuePlaceholder = resolveValuePlaceholder(spec);
|
|
188
|
-
const flags = valuePlaceholder === undefined ? spec.flag : `${spec.flag} ${valuePlaceholder}`;
|
|
189
|
-
const option = new Option(flags, spec.description);
|
|
190
|
-
if (spec.choices !== undefined && spec.choices.length > 0) {
|
|
191
|
-
option.choices([...spec.choices]);
|
|
192
|
-
}
|
|
193
|
-
if (spec.parse !== undefined) {
|
|
194
|
-
// Commander's argParser is `(value, previous) => next` — exactly the
|
|
195
|
-
// declared `OptionSpec.parse` reducer shape (Number coercion, repeatable
|
|
196
|
-
// accumulation, validated ints).
|
|
197
|
-
option.argParser(spec.parse);
|
|
198
|
-
}
|
|
199
|
-
// `arrayDefault` (repeatable accumulators) wins over a scalar `default`;
|
|
200
|
-
// Commander uses it as the seed the `parse` reducer accumulates onto.
|
|
201
|
-
if (spec.arrayDefault !== undefined) {
|
|
202
|
-
option.default([...spec.arrayDefault]);
|
|
203
|
-
}
|
|
204
|
-
else if (spec.default !== undefined) {
|
|
205
|
-
option.default(spec.default);
|
|
206
|
-
}
|
|
207
|
-
if (spec.required === true) {
|
|
208
|
-
if (valuePlaceholder === undefined) {
|
|
209
|
-
throw new Error(`mountCommandSpec: command '${commandName}' option '${spec.flag}' is required but takes no value; ` +
|
|
210
|
-
'only value options can be required.');
|
|
211
|
-
}
|
|
212
|
-
option.makeOptionMandatory(true);
|
|
213
|
-
}
|
|
214
|
-
return option;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Resolve the value placeholder for an option, applying variadic `...` when
|
|
218
|
-
* declared. Returns `undefined` for a boolean / negatable flag (no value).
|
|
219
|
-
*/
|
|
220
|
-
function resolveValuePlaceholder(spec) {
|
|
221
|
-
if (spec.negatable === true)
|
|
222
|
-
return undefined;
|
|
223
|
-
if (spec.value === undefined)
|
|
224
|
-
return undefined;
|
|
225
|
-
if (spec.variadic === true && !spec.value.includes('...')) {
|
|
226
|
-
// Inject the variadic ellipsis inside the existing bracket pair, e.g.
|
|
227
|
-
// `<slug>` → `<slug...>`, `[path]` → `[path...]`.
|
|
228
|
-
return spec.value.replace(/([>\]])$/, '...$1');
|
|
229
|
-
}
|
|
230
|
-
return spec.value;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Format an {@link ArgSpec} into Commander argument-usage syntax: `<name>`
|
|
234
|
-
* (required), `[name]` (optional), with `...` appended for variadic.
|
|
235
|
-
*/
|
|
236
|
-
function formatArgUsage(spec) {
|
|
237
|
-
const inner = spec.variadic === true ? `${spec.name}...` : spec.name;
|
|
238
|
-
return spec.optional === true ? `[${inner}]` : `<${inner}>`;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Best-effort guard: does `x` look like a Commander `Command` instance?
|
|
242
|
-
* Used defensively in splitActionArgs so we never treat the Command object
|
|
243
|
-
* as the parsed opts (which would silently give every handler a weird
|
|
244
|
-
* `opts` bag containing Commander internals and produce very confusing bugs).
|
|
245
|
-
*/
|
|
246
|
-
function isLikelyCommanderCommand(x) {
|
|
247
|
-
if (!x || typeof x !== 'object')
|
|
248
|
-
return false;
|
|
249
|
-
const c = x;
|
|
250
|
-
// Commander Command instances have these characteristic members.
|
|
251
|
-
return (typeof c.name === 'function' ||
|
|
252
|
-
typeof c.opts === 'function' ||
|
|
253
|
-
typeof c.command === 'function' ||
|
|
254
|
-
(typeof c.constructor === 'function' && /Command/i.test(c.constructor.name || '')));
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Split a Commander action callback's variadic arguments into the parsed-opts
|
|
258
|
-
* object and the trailing positional args.
|
|
259
|
-
*
|
|
260
|
-
* Commander calls `action((...positionalArgs, optsObject, command))`: the
|
|
261
|
-
* declared positionals come first, then the parsed-options object, then the
|
|
262
|
-
* `Command` instance. We locate the opts object by scanning left from the
|
|
263
|
-
* slot before the final Command for the rightmost plain (non-array, non-Command)
|
|
264
|
-
* object. Everything before that index is treated as positionals.
|
|
265
|
-
*
|
|
266
|
-
* This scan is robust: positionals (typically strings/paths for variadics) are
|
|
267
|
-
* never inspected for "object-ness" during the search, so a defensive walk
|
|
268
|
-
* cannot accidentally eat legitimate leading positionals when an intermediate
|
|
269
|
-
* value looks unusual (future Commander arity change, wrappers, etc.).
|
|
270
|
-
*
|
|
271
|
-
* If no plausible opts object is found, we treat the entire prefix before the
|
|
272
|
-
* Command as positionals and opts as {} (fail-closed paranoia below still applies).
|
|
273
|
-
*
|
|
274
|
-
* @throws {Error} On the defensive, normally-unreachable path where no opts object
|
|
275
|
-
* can be located among the action arguments (surfaced loudly so tests/CI catch it).
|
|
276
|
-
*/
|
|
277
|
-
function splitActionArgs(actionArgs) {
|
|
278
|
-
if (actionArgs.length === 0) {
|
|
279
|
-
return { opts: {}, positionals: [] };
|
|
280
|
-
}
|
|
281
|
-
const lastIdx = actionArgs.length - 1;
|
|
282
|
-
// The final argument is (per Commander contract) the Command instance.
|
|
283
|
-
if (!isLikelyCommanderCommand(actionArgs[lastIdx])) {
|
|
284
|
-
// Extremely unexpected — log via throw so tests/CI surface it loudly.
|
|
285
|
-
throw new Error('mountCommandSpec: splitActionArgs could not locate Commander Command as the final action argument. ' +
|
|
286
|
-
'This indicates an incompatible Commander version or a wrapped dispatch. ' +
|
|
287
|
-
'Please report this with your Commander version.');
|
|
288
|
-
}
|
|
289
|
-
// Scan left from the slot immediately before the Command. The first (rightmost)
|
|
290
|
-
// plain non-array non-Command object we encounter is the parsed opts.
|
|
291
|
-
for (let i = lastIdx - 1; i >= 0; i--) {
|
|
292
|
-
const v = actionArgs[i];
|
|
293
|
-
if (v && typeof v === 'object' && !Array.isArray(v) && !isLikelyCommanderCommand(v)) {
|
|
294
|
-
const opts = v;
|
|
295
|
-
const positionals = actionArgs.slice(0, i);
|
|
296
|
-
// Extra paranoia: if what we selected smells like Command, refuse.
|
|
297
|
-
if (isLikelyCommanderCommand(opts)) {
|
|
298
|
-
throw new Error('mountCommandSpec: splitActionArgs selected a Commander Command as the parsed opts. ' +
|
|
299
|
-
'Refusing to dispatch — this is a bug in argument splitting.');
|
|
300
|
-
}
|
|
301
|
-
return { opts, positionals };
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
// No plain opts object found before the Command (defensive). All prior args
|
|
305
|
-
// become positionals; the handler will see a bare {} for opts (still better
|
|
306
|
-
// than handing it a Command or corrupting _args).
|
|
307
|
-
const positionals = actionArgs.slice(0, lastIdx);
|
|
308
|
-
return { opts: {}, positionals };
|
|
309
|
-
}
|
|
310
178
|
//# sourceMappingURL=mount-command-spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount-command-spec.js","sourceRoot":"","sources":["../../src/commands/mount-command-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,gBAAgB,EAChB,sBAAsB,GAGvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,SAAS,EACT,YAAY,
|
|
1
|
+
{"version":3,"file":"mount-command-spec.js","sourceRoot":"","sources":["../../src/commands/mount-command-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,gBAAgB,EAChB,sBAAsB,GAGvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,SAAS,EACT,YAAY,GAMb,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAgD9D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAmB,EACnB,IAAgC,EAChC,GAAS;IAET,MAAM,GAAG,GAAG,OAAO,CAAC,OAA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,UAAU;gBACV,CAAC,CAAC,EAAE,UAAU,EAAG,GAAkD,CAAC,UAAU,EAAE;gBAChF,CAAC,CAAC,SAAS,CAAC;YACd,MAAM,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,WAAW,CAAC,CAAC;YAC9E,OAAO;QACT,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;GAiBG;AA+BH,cAAc,UAAU,CAAC"}
|