opensip-cli 0.1.5 → 0.1.7
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 +30 -5
- package/dist/bootstrap/admit-tool-package.js.map +1 -1
- package/dist/bootstrap/bind-tool-context.d.ts.map +1 -1
- package/dist/bootstrap/bind-tool-context.js +5 -3
- package/dist/bootstrap/bind-tool-context.js.map +1 -1
- package/dist/bootstrap/build-command-registration-input.d.ts +7 -0
- package/dist/bootstrap/build-command-registration-input.d.ts.map +1 -1
- package/dist/bootstrap/build-command-registration-input.js +11 -4
- package/dist/bootstrap/build-command-registration-input.js.map +1 -1
- package/dist/bootstrap/build-per-run-scope.d.ts +12 -0
- package/dist/bootstrap/build-per-run-scope.d.ts.map +1 -1
- package/dist/bootstrap/build-per-run-scope.js +84 -9
- package/dist/bootstrap/build-per-run-scope.js.map +1 -1
- package/dist/bootstrap/bundled-manifest.d.ts +5 -0
- package/dist/bootstrap/bundled-manifest.d.ts.map +1 -0
- package/dist/bootstrap/bundled-manifest.js +13 -0
- package/dist/bootstrap/bundled-manifest.js.map +1 -0
- package/dist/bootstrap/bundled-tools.manifest.json +19 -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 +10 -7
- package/dist/bootstrap/config-and-capabilities.js.map +1 -1
- package/dist/bootstrap/constants.d.ts +3 -0
- package/dist/bootstrap/constants.d.ts.map +1 -0
- package/dist/bootstrap/constants.js +3 -0
- package/dist/bootstrap/constants.js.map +1 -0
- package/dist/bootstrap/decorate-tool-primary.d.ts +50 -0
- package/dist/bootstrap/decorate-tool-primary.d.ts.map +1 -0
- package/dist/bootstrap/decorate-tool-primary.js +111 -0
- package/dist/bootstrap/decorate-tool-primary.js.map +1 -0
- 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 +12 -1
- package/dist/bootstrap/execute-post-bailout-bootstrap.js.map +1 -1
- package/dist/bootstrap/index.d.ts +1 -1
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +1 -4
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/bootstrap/io-plane.d.ts +47 -0
- package/dist/bootstrap/io-plane.d.ts.map +1 -0
- package/dist/bootstrap/io-plane.js +73 -0
- package/dist/bootstrap/io-plane.js.map +1 -0
- package/dist/bootstrap/load-tool-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/load-tool-capabilities.js +18 -2
- package/dist/bootstrap/load-tool-capabilities.js.map +1 -1
- package/dist/bootstrap/owning-tool-init.d.ts.map +1 -1
- package/dist/bootstrap/owning-tool-init.js +7 -4
- package/dist/bootstrap/owning-tool-init.js.map +1 -1
- package/dist/bootstrap/phase-map.d.ts +20 -0
- package/dist/bootstrap/phase-map.d.ts.map +1 -0
- package/dist/bootstrap/phase-map.js +108 -0
- package/dist/bootstrap/phase-map.js.map +1 -0
- 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 +23 -4
- package/dist/bootstrap/pre-action-hook.js.map +1 -1
- package/dist/bootstrap/register-tools-discovery.d.ts +38 -39
- package/dist/bootstrap/register-tools-discovery.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-discovery.js +134 -85
- package/dist/bootstrap/register-tools-discovery.js.map +1 -1
- package/dist/bootstrap/register-tools-mount.d.ts +18 -1
- package/dist/bootstrap/register-tools-mount.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-mount.js +118 -18
- package/dist/bootstrap/register-tools-mount.js.map +1 -1
- package/dist/bootstrap/register-tools.d.ts +58 -14
- package/dist/bootstrap/register-tools.d.ts.map +1 -1
- package/dist/bootstrap/register-tools.js +185 -14
- package/dist/bootstrap/register-tools.js.map +1 -1
- package/dist/bootstrap/root-version.d.ts +26 -0
- package/dist/bootstrap/root-version.d.ts.map +1 -0
- package/dist/bootstrap/root-version.js +36 -0
- package/dist/bootstrap/root-version.js.map +1 -0
- package/dist/bootstrap/scope-access.d.ts +11 -0
- package/dist/bootstrap/scope-access.d.ts.map +1 -1
- package/dist/bootstrap/scope-access.js +26 -0
- package/dist/bootstrap/scope-access.js.map +1 -1
- package/dist/bootstrap/tool-lifecycle.d.ts +0 -22
- package/dist/bootstrap/tool-lifecycle.d.ts.map +1 -1
- package/dist/bootstrap/tool-lifecycle.js +0 -23
- package/dist/bootstrap/tool-lifecycle.js.map +1 -1
- package/dist/bootstrap/validate-tool.d.ts +10 -4
- package/dist/bootstrap/validate-tool.d.ts.map +1 -1
- package/dist/bootstrap/validate-tool.js +76 -22
- package/dist/bootstrap/validate-tool.js.map +1 -1
- package/dist/cli-context.d.ts +2 -2
- package/dist/cli-context.d.ts.map +1 -1
- package/dist/cli-context.js +20 -35
- package/dist/cli-context.js.map +1 -1
- package/dist/commands/agent-catalog.d.ts +29 -0
- package/dist/commands/agent-catalog.d.ts.map +1 -1
- package/dist/commands/agent-catalog.js +77 -36
- package/dist/commands/agent-catalog.js.map +1 -1
- package/dist/commands/clear.d.ts.map +1 -1
- package/dist/commands/clear.js +0 -1
- package/dist/commands/clear.js.map +1 -1
- package/dist/commands/command-scope-index.d.ts +45 -0
- package/dist/commands/command-scope-index.d.ts.map +1 -0
- package/dist/commands/command-scope-index.js +51 -0
- package/dist/commands/command-scope-index.js.map +1 -0
- package/dist/commands/completion.d.ts +67 -6
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +84 -12
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/configure.d.ts.map +1 -1
- package/dist/commands/configure.js +0 -1
- package/dist/commands/configure.js.map +1 -1
- package/dist/commands/host-command-specs.d.ts +16 -9
- package/dist/commands/host-command-specs.d.ts.map +1 -1
- package/dist/commands/host-command-specs.js +47 -21
- package/dist/commands/host-command-specs.js.map +1 -1
- package/dist/commands/host-config-flag.d.ts +21 -0
- package/dist/commands/host-config-flag.d.ts.map +1 -0
- package/dist/commands/host-config-flag.js +21 -0
- package/dist/commands/host-config-flag.js.map +1 -0
- package/dist/commands/host-subcommand-groups.d.ts +46 -5
- package/dist/commands/host-subcommand-groups.d.ts.map +1 -1
- package/dist/commands/host-subcommand-groups.js +97 -65
- package/dist/commands/host-subcommand-groups.js.map +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/internal-command-visibility.d.ts +42 -0
- package/dist/commands/internal-command-visibility.d.ts.map +1 -0
- package/dist/commands/internal-command-visibility.js +54 -0
- package/dist/commands/internal-command-visibility.js.map +1 -0
- package/dist/commands/mount-command-action.d.ts +24 -0
- package/dist/commands/mount-command-action.d.ts.map +1 -0
- package/dist/commands/mount-command-action.js +78 -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 +9 -2
- package/dist/commands/mount-command-spec.d.ts.map +1 -1
- package/dist/commands/mount-command-spec.js +11 -135
- package/dist/commands/mount-command-spec.js.map +1 -1
- package/dist/commands/plugin/domain-resolution.d.ts +12 -13
- package/dist/commands/plugin/domain-resolution.d.ts.map +1 -1
- package/dist/commands/plugin/domain-resolution.js +12 -58
- package/dist/commands/plugin/domain-resolution.js.map +1 -1
- package/dist/commands/plugin/host-dir.d.ts +0 -1
- package/dist/commands/plugin/host-dir.d.ts.map +1 -1
- package/dist/commands/plugin/host-dir.js +1 -1
- package/dist/commands/plugin/host-dir.js.map +1 -1
- package/dist/commands/plugin.d.ts +20 -14
- package/dist/commands/plugin.d.ts.map +1 -1
- package/dist/commands/plugin.js +39 -47
- package/dist/commands/plugin.js.map +1 -1
- package/dist/commands/render-outcome.d.ts.map +1 -1
- package/dist/commands/render-outcome.js.map +1 -1
- package/dist/commands/shared.d.ts +9 -0
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/tools/create.d.ts +11 -0
- package/dist/commands/tools/create.d.ts.map +1 -0
- package/dist/commands/tools/create.js +84 -0
- package/dist/commands/tools/create.js.map +1 -0
- package/dist/commands/tools/index.d.ts.map +1 -1
- package/dist/commands/tools/index.js +31 -0
- package/dist/commands/tools/index.js.map +1 -1
- package/dist/commands/tools/runtime-probe-entry.d.ts.map +1 -1
- package/dist/commands/tools/runtime-probe-entry.js +4 -2
- package/dist/commands/tools/runtime-probe-entry.js.map +1 -1
- package/dist/commands/tools/validate.d.ts.map +1 -1
- package/dist/commands/tools/validate.js +12 -5
- package/dist/commands/tools/validate.js.map +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +0 -1
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/env/host-env-specs.d.ts +18 -0
- package/dist/env/host-env-specs.d.ts.map +1 -1
- package/dist/env/host-env-specs.js +36 -2
- package/dist/env/host-env-specs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -21
- package/dist/index.js.map +1 -1
- package/dist/report-compose.d.ts.map +1 -1
- package/dist/report-compose.js +2 -2
- package/dist/report-compose.js.map +1 -1
- package/dist/session-replay-registry.d.ts +1 -1
- package/dist/session-replay-registry.d.ts.map +1 -1
- package/dist/session-replay-registry.js +3 -1
- package/dist/session-replay-registry.js.map +1 -1
- package/dist/ui/result-to-view.d.ts +27 -7
- package/dist/ui/result-to-view.d.ts.map +1 -1
- package/dist/ui/result-to-view.js +68 -75
- package/dist/ui/result-to-view.js.map +1 -1
- package/dist/ui/views/misc-views.d.ts.map +1 -1
- package/dist/ui/views/misc-views.js +3 -1
- package/dist/ui/views/misc-views.js.map +1 -1
- package/dist/ui/views/tools-views.d.ts +2 -1
- package/dist/ui/views/tools-views.d.ts.map +1 -1
- package/dist/ui/views/tools-views.js +21 -0
- package/dist/ui/views/tools-views.js.map +1 -1
- package/package.json +32 -32
- package/dist/bootstrap/authored-tool-admission.d.ts +0 -23
- package/dist/bootstrap/authored-tool-admission.d.ts.map +0 -1
- package/dist/bootstrap/authored-tool-admission.js +0 -54
- package/dist/bootstrap/authored-tool-admission.js.map +0 -1
- package/dist/bootstrap/egress-plane.d.ts +0 -22
- package/dist/bootstrap/egress-plane.d.ts.map +0 -1
- package/dist/bootstrap/egress-plane.js +0 -37
- package/dist/bootstrap/egress-plane.js.map +0 -1
- package/dist/bootstrap/installed-tool-admission.d.ts +0 -20
- package/dist/bootstrap/installed-tool-admission.d.ts.map +0 -1
- package/dist/bootstrap/installed-tool-admission.js +0 -60
- package/dist/bootstrap/installed-tool-admission.js.map +0 -1
- package/dist/bootstrap/live-plane.d.ts +0 -51
- package/dist/bootstrap/live-plane.d.ts.map +0 -1
- package/dist/bootstrap/live-plane.js +0 -72
- package/dist/bootstrap/live-plane.js.map +0 -1
- package/dist/bootstrap/register-tools-bundled.d.ts +0 -28
- package/dist/bootstrap/register-tools-bundled.d.ts.map +0 -1
- package/dist/bootstrap/register-tools-bundled.js +0 -107
- package/dist/bootstrap/register-tools-bundled.js.map +0 -1
- package/dist/bootstrap/register-tools-shared.d.ts +0 -40
- package/dist/bootstrap/register-tools-shared.d.ts.map +0 -1
- package/dist/bootstrap/register-tools-shared.js +0 -98
- package/dist/bootstrap/register-tools-shared.js.map +0 -1
|
@@ -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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@ -72,12 +72,19 @@ export interface CommandMountContext extends RunActionHooks {
|
|
|
72
72
|
* 5. `cmd.action(...)` → run `spec.handler(opts, ctx)` → {@link dispatchOutput}
|
|
73
73
|
* → on a thrown {@link ToolError}, `mapToolErrorToExitCode` → `ctx.setExitCode`.
|
|
74
74
|
*
|
|
75
|
-
* @param program The
|
|
75
|
+
* @param program The Commander program to mount onto — the root `CliProgram`
|
|
76
|
+
* for a flat command, or a parent command (a host subcommand
|
|
77
|
+
* group, or a tool's primary command for a `CommandSpec.parent`
|
|
78
|
+
* nested child) when nesting. `program.command(...)` mounts onto
|
|
79
|
+
* whatever object it is called on, so nesting is purely a matter
|
|
80
|
+
* of which program is passed.
|
|
76
81
|
* @param spec The declarative command surface the tool/host exported.
|
|
77
82
|
* @param ctx The per-invocation host context (render/envelope/live-view
|
|
78
83
|
* emitters, exit-code setter) — today's `ToolCliContext`.
|
|
84
|
+
* @returns The mounted Commander command, so a caller nesting children
|
|
85
|
+
* (e.g. `mountOneTool`) can mount sub-subcommands onto it.
|
|
79
86
|
*/
|
|
80
|
-
export declare function mountCommandSpec<TCtx extends CommandMountContext>(program: CliProgram, spec: CommandSpec<unknown, TCtx>, ctx: TCtx):
|
|
87
|
+
export declare function mountCommandSpec<TCtx extends CommandMountContext>(program: CliProgram, spec: CommandSpec<unknown, TCtx>, ctx: TCtx): CliProgram;
|
|
81
88
|
/**
|
|
82
89
|
* The SINGLE output-dispatch seam. The launch `CommandOutcome` wrap is LANDED:
|
|
83
90
|
* the host emit seams this delegates to (`emitCommandResult`, `ctx.emitEnvelope`)
|
|
@@ -1 +1 @@
|
|
|
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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,CA6DZ;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
|
|
@@ -33,10 +34,17 @@ import { emitCommandResult } from './mount-result-command.js';
|
|
|
33
34
|
* 5. `cmd.action(...)` → run `spec.handler(opts, ctx)` → {@link dispatchOutput}
|
|
34
35
|
* → on a thrown {@link ToolError}, `mapToolErrorToExitCode` → `ctx.setExitCode`.
|
|
35
36
|
*
|
|
36
|
-
* @param program The
|
|
37
|
+
* @param program The Commander program to mount onto — the root `CliProgram`
|
|
38
|
+
* for a flat command, or a parent command (a host subcommand
|
|
39
|
+
* group, or a tool's primary command for a `CommandSpec.parent`
|
|
40
|
+
* nested child) when nesting. `program.command(...)` mounts onto
|
|
41
|
+
* whatever object it is called on, so nesting is purely a matter
|
|
42
|
+
* of which program is passed.
|
|
37
43
|
* @param spec The declarative command surface the tool/host exported.
|
|
38
44
|
* @param ctx The per-invocation host context (render/envelope/live-view
|
|
39
45
|
* emitters, exit-code setter) — today's `ToolCliContext`.
|
|
46
|
+
* @returns The mounted Commander command, so a caller nesting children
|
|
47
|
+
* (e.g. `mountOneTool`) can mount sub-subcommands onto it.
|
|
40
48
|
*/
|
|
41
49
|
export function mountCommandSpec(program, spec, ctx) {
|
|
42
50
|
const cmd = program.command(spec.name).description(spec.description);
|
|
@@ -95,6 +103,7 @@ export function mountCommandSpec(program, spec, ctx) {
|
|
|
95
103
|
throw error;
|
|
96
104
|
}
|
|
97
105
|
});
|
|
106
|
+
return cmd;
|
|
98
107
|
}
|
|
99
108
|
/**
|
|
100
109
|
* The SINGLE output-dispatch seam. The launch `CommandOutcome` wrap is LANDED:
|
|
@@ -174,137 +183,4 @@ export async function dispatchOutput(result, spec, opts, positionals, ctx) {
|
|
|
174
183
|
}
|
|
175
184
|
}
|
|
176
185
|
}
|
|
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
186
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAmB,EACnB,IAAgC,EAChC,GAAS;IAET,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrE,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACjC,CAAC;IAED,sEAAsE;IACtE,8EAA8E;IAC9E,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAA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MAAM,IAAI,KAAK,CACb,8BAA8B,IAAI,CAAC,IAAI,sCAAsC;wBAC3E,oEAAoE;wBACpE,wCAAwC,CAC3C,CAAC;gBACJ,CAAC;gBACD,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,CAAC,MAAM,CAAC,MAAuB,CAAC,CAAC;YAC5C,CAAC;YACD,OAAO;QACT,CAAC;QACD,KAAK,YAAY,CAAC,CAAC,CAAC;YAClB,wEAAwE;YACxE,qEAAqE;YACrE,+CAA+C;YAC/C,OAAO;QACT,CAAC;QACD,KAAK,WAAW,CAAC,CAAC,CAAC;YACjB,uEAAuE;YACvE,oEAAoE;YACpE,sEAAsE;YACtE,wEAAwE;YACxE,qEAAqE;YACrE,IAAI,GAAG,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;gBACjC,MAAM,IAAI,KAAK,CACb,8BAA8B,IAAI,CAAC,IAAI,gCAAgC;oBACrE,kEAAkE;oBAClE,wCAAwC,CAC3C,CAAC;YACJ,CAAC;YACD,qEAAqE;YACrE,qEAAqE;YACrE,sEAAsE;YACtE,kCAAkC;YAClC,MAAM,WAAW,GACf,GACD,CAAC,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"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* plugin/domain-resolution — pure validation + routing logic for the
|
|
3
|
-
*
|
|
3
|
+
* `<tool> plugin add/remove/sync` commands.
|
|
4
4
|
*
|
|
5
5
|
* Extracted from `commands/plugin.ts` to keep that file focused on the
|
|
6
|
-
* command bodies. Everything here decides WHICH host dir / domain a
|
|
7
|
-
* targets —
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* command bodies. Everything here decides WHICH host dir / domain a pack
|
|
7
|
+
* targets — no install. The plugin-supporting domains are NOT hardcoded:
|
|
8
|
+
* they come from the registered tools' `pluginLayout` descriptors (threaded
|
|
9
|
+
* in as `PluginLayout[]`), so the kernel stays tool-agnostic and the tools
|
|
10
|
+
* remain the single source of truth (ADR-0009 corollary 1). The pack ops are
|
|
11
|
+
* mounted under each pack-supporting tool primary (`opensip fit plugin …`),
|
|
12
|
+
* so the domain is bound from the tool rather than a `--domain` flag.
|
|
12
13
|
*/
|
|
13
14
|
import { type PluginLayout } from '@opensip-cli/core';
|
|
14
15
|
/**
|
|
@@ -19,6 +20,10 @@ import { type PluginLayout } from '@opensip-cli/core';
|
|
|
19
20
|
* user-global by default (`~/.opensip-cli/plugins/tool`) so the
|
|
20
21
|
* subcommand is available in every project — or project-local
|
|
21
22
|
* (`.runtime/plugins/tool`) with `--project`.
|
|
23
|
+
*
|
|
24
|
+
* Whole Tool plugins are managed by `opensip tools {install,uninstall,…}`
|
|
25
|
+
* (NOT the per-tool `plugin` group); this constant is the shared host-dir
|
|
26
|
+
* segment those commands resolve against.
|
|
22
27
|
*/
|
|
23
28
|
export declare const TOOL_DOMAIN = "tool";
|
|
24
29
|
/** The set of plugin-supporting domain names from the contributed layouts. */
|
|
@@ -29,10 +34,4 @@ export declare function domainNames(layouts: readonly PluginLayout[]): string[];
|
|
|
29
34
|
* construction outside opensip-cli/.runtime/.
|
|
30
35
|
*/
|
|
31
36
|
export declare function resolveDomain(override: string | undefined, packageName: string, domains: readonly string[]): string | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Decide whether `plugin add/remove <spec>` targets a Tool plugin:
|
|
34
|
-
* explicit `--domain tool`, or (when no `--domain` is given) a detected
|
|
35
|
-
* `kind: "tool"` marker. An explicit fit/sim `--domain` is honoured as-is.
|
|
36
|
-
*/
|
|
37
|
-
export declare function isToolTarget(domainOverride: string | undefined, spec: string, cwd: string): boolean;
|
|
38
37
|
//# sourceMappingURL=domain-resolution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-resolution.d.ts","sourceRoot":"","sources":["../../../src/commands/plugin/domain-resolution.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"domain-resolution.d.ts","sourceRoot":"","sources":["../../../src/commands/plugin/domain-resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,SAAS,CAAC;AAElC,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,EAAE,CAEtE;AAaD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,MAAM,GAAG,SAAS,CAGpB"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* plugin/domain-resolution — pure validation + routing logic for the
|
|
3
|
-
*
|
|
3
|
+
* `<tool> plugin add/remove/sync` commands.
|
|
4
4
|
*
|
|
5
5
|
* Extracted from `commands/plugin.ts` to keep that file focused on the
|
|
6
|
-
* command bodies. Everything here decides WHICH host dir / domain a
|
|
7
|
-
* targets —
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* command bodies. Everything here decides WHICH host dir / domain a pack
|
|
7
|
+
* targets — no install. The plugin-supporting domains are NOT hardcoded:
|
|
8
|
+
* they come from the registered tools' `pluginLayout` descriptors (threaded
|
|
9
|
+
* in as `PluginLayout[]`), so the kernel stays tool-agnostic and the tools
|
|
10
|
+
* remain the single source of truth (ADR-0009 corollary 1). The pack ops are
|
|
11
|
+
* mounted under each pack-supporting tool primary (`opensip fit plugin …`),
|
|
12
|
+
* so the domain is bound from the tool rather than a `--domain` flag.
|
|
12
13
|
*/
|
|
13
|
-
import { execFileSync } from 'node:child_process';
|
|
14
|
-
import { isAbsolute, join } from 'node:path';
|
|
15
|
-
import { readDeclaredKind } from '@opensip-cli/core';
|
|
16
|
-
import { extractNameFromSpec } from './host-dir.js';
|
|
17
14
|
/**
|
|
18
15
|
* Pseudo-domain for full Tool plugins (whole subcommands). Distinct from
|
|
19
16
|
* the fit/sim plugin DOMAINS (which are project-committed + listed in
|
|
@@ -22,6 +19,10 @@ import { extractNameFromSpec } from './host-dir.js';
|
|
|
22
19
|
* user-global by default (`~/.opensip-cli/plugins/tool`) so the
|
|
23
20
|
* subcommand is available in every project — or project-local
|
|
24
21
|
* (`.runtime/plugins/tool`) with `--project`.
|
|
22
|
+
*
|
|
23
|
+
* Whole Tool plugins are managed by `opensip tools {install,uninstall,…}`
|
|
24
|
+
* (NOT the per-tool `plugin` group); this constant is the shared host-dir
|
|
25
|
+
* segment those commands resolve against.
|
|
25
26
|
*/
|
|
26
27
|
export const TOOL_DOMAIN = 'tool';
|
|
27
28
|
/** The set of plugin-supporting domain names from the contributed layouts. */
|
|
@@ -48,51 +49,4 @@ export function resolveDomain(override, packageName, domains) {
|
|
|
48
49
|
return inferDomain(packageName, domains);
|
|
49
50
|
return domains.includes(override) ? override : undefined;
|
|
50
51
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Detect a package's `opensipTools.kind` BEFORE installing, so `plugin add`
|
|
53
|
-
* can route a Tool plugin to its host dir rather than a fit/sim domain.
|
|
54
|
-
*
|
|
55
|
-
* - Local-path specs (`.`/`/`/`file:`): read the target's package.json
|
|
56
|
-
* directly — free and offline.
|
|
57
|
-
* - Registry specs: `npm view <name> opensipTools.kind` (one network
|
|
58
|
-
* call; `plugin add` is already online for the install).
|
|
59
|
-
*
|
|
60
|
-
* Returns undefined when undetectable (offline, private registry, no
|
|
61
|
-
* marker) — the caller then falls back to fit/sim domain inference. The raw
|
|
62
|
-
* declared kind is returned as a string (the only thing the caller checks is
|
|
63
|
-
* `=== 'tool'`); domain markers are no longer a compiled-in host union.
|
|
64
|
-
*/
|
|
65
|
-
function detectPluginKind(spec, cwd) {
|
|
66
|
-
if (spec.startsWith('/') || spec.startsWith('.') || spec.startsWith('file:')) {
|
|
67
|
-
const raw = spec.startsWith('file:') ? spec.slice('file:'.length) : spec;
|
|
68
|
-
return readDeclaredKind(isAbsolute(raw) ? raw : join(cwd, raw));
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
const name = extractNameFromSpec(spec) ?? spec;
|
|
72
|
-
const out = execFileSync('npm', ['view', name, 'opensipTools.kind'], {
|
|
73
|
-
cwd,
|
|
74
|
-
encoding: 'utf8',
|
|
75
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
76
|
-
})
|
|
77
|
-
.toString()
|
|
78
|
-
.trim();
|
|
79
|
-
return out === '' ? undefined : out;
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
// @fitness-ignore-next-line error-handling-quality -- `npm view` failure (offline, private registry, or no such package) means the kind is undetectable; returning undefined routes the caller to fit/sim domain inference — the documented fallback, not a swallowed error.
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Decide whether `plugin add/remove <spec>` targets a Tool plugin:
|
|
88
|
-
* explicit `--domain tool`, or (when no `--domain` is given) a detected
|
|
89
|
-
* `kind: "tool"` marker. An explicit fit/sim `--domain` is honoured as-is.
|
|
90
|
-
*/
|
|
91
|
-
export function isToolTarget(domainOverride, spec, cwd) {
|
|
92
|
-
if (domainOverride === TOOL_DOMAIN)
|
|
93
|
-
return true;
|
|
94
|
-
if (domainOverride !== undefined)
|
|
95
|
-
return false;
|
|
96
|
-
return detectPluginKind(spec, cwd) === 'tool';
|
|
97
|
-
}
|
|
98
52
|
//# sourceMappingURL=domain-resolution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-resolution.js","sourceRoot":"","sources":["../../../src/commands/plugin/domain-resolution.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"domain-resolution.js","sourceRoot":"","sources":["../../../src/commands/plugin/domain-resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC;AAElC,8EAA8E;AAC9E,MAAM,UAAU,WAAW,CAAC,OAAgC;IAC1D,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,WAAmB,EAAE,OAA0B;IAClE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACtF,OAAO,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,QAA4B,EAC5B,WAAmB,EACnB,OAA0B;IAE1B,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,WAAW,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACrE,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3D,CAAC"}
|
|
@@ -38,5 +38,4 @@ export declare function ensureUserPluginHostDir(domain: string): string;
|
|
|
38
38
|
export declare function installMissingPeers(dir: string, requestedSpec: string, depsBefore: Set<string>): void;
|
|
39
39
|
export declare function findInstalledName(dir: string, requestedSpec: string, depsBefore: Set<string>): string | undefined;
|
|
40
40
|
export declare function readHostDependencies(dir: string): Set<string>;
|
|
41
|
-
export declare function extractNameFromSpec(spec: string): string | undefined;
|
|
42
41
|
//# sourceMappingURL=host-dir.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-dir.d.ts","sourceRoot":"","sources":["../../../src/commands/plugin/host-dir.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAQH,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAInD;AAED,uFAAuF;AACvF,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAoBjE;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,GACtB,IAAI,CAsBN;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,GACtB,MAAM,GAAG,SAAS,CAEpB;AA2BD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAG7D
|
|
1
|
+
{"version":3,"file":"host-dir.d.ts","sourceRoot":"","sources":["../../../src/commands/plugin/host-dir.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAQH,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAInD;AAED,uFAAuF;AACvF,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAoBjE;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,GACtB,IAAI,CAsBN;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,GACtB,MAAM,GAAG,SAAS,CAEpB;AA2BD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAG7D"}
|
|
@@ -118,7 +118,7 @@ export function readHostDependencies(dir) {
|
|
|
118
118
|
const hostPkg = readPackageJson(join(dir, HOST_PACKAGE_JSON));
|
|
119
119
|
return new Set(Object.keys(hostPkg?.dependencies ?? {}));
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
function extractNameFromSpec(spec) {
|
|
122
122
|
if (spec.startsWith('/') || spec.startsWith('.') || spec.startsWith('file:'))
|
|
123
123
|
return undefined;
|
|
124
124
|
if (spec.startsWith('@')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-dir.js","sourceR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CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* plugin command — manage project-local
|
|
2
|
+
* plugin command — manage a PACK-SUPPORTING tool's project-local
|
|
3
|
+
* npm-installed extension packs (fit/sim checks, recipes, scenarios).
|
|
4
|
+
*
|
|
5
|
+
* The pack ops are mounted UNDER each pack-supporting tool primary —
|
|
6
|
+
* `opensip fit plugin {add|list|remove|sync}` (domain pre-bound to `fit`),
|
|
7
|
+
* `opensip sim plugin {…}` (domain `sim`). There is no top-level
|
|
8
|
+
* `opensip plugin` command, and no `--domain`/`--type` flag: the tool the
|
|
9
|
+
* subcommand hangs off of IS the domain. Whole Tool plugins (platform
|
|
10
|
+
* subcommands) are installed/uninstalled with `opensip tools …`, never here.
|
|
3
11
|
*
|
|
4
12
|
* Layout (no user-global plugin dir):
|
|
5
13
|
*
|
|
@@ -17,17 +25,17 @@
|
|
|
17
25
|
* installed package (silent loads
|
|
18
26
|
* would surprise users).
|
|
19
27
|
*
|
|
20
|
-
*
|
|
28
|
+
* `<tool> plugin add <pkg>` is the one-step install: writes the package to
|
|
21
29
|
* .runtime/plugins/<domain>/node_modules AND adds it to plugins.<domain>
|
|
22
30
|
* in the project config. After: `opensip fit` loads it on next run.
|
|
23
31
|
*
|
|
24
|
-
*
|
|
32
|
+
* `<tool> plugin remove <pkg>` is the inverse: removes from node_modules AND
|
|
25
33
|
* deletes from plugins.<domain>.
|
|
26
34
|
*
|
|
27
|
-
*
|
|
35
|
+
* `<tool> plugin list` walks .runtime/plugins/<domain>/node_modules + the
|
|
28
36
|
* config to show what's installed and what's currently loaded.
|
|
29
37
|
*
|
|
30
|
-
*
|
|
38
|
+
* `<tool> plugin sync` is the post-clone bootstrap: reads plugins.<domain> from
|
|
31
39
|
* the config and `npm install`s everything declared. Used by CI and
|
|
32
40
|
* by users who clone a repo with custom plugins.
|
|
33
41
|
*
|
|
@@ -36,18 +44,13 @@
|
|
|
36
44
|
* - This file owns the `plugin {list,add,remove,sync}` command bodies.
|
|
37
45
|
* - `plugin/config-edit.ts` — YAML round-trip edits to plugins.<domain>.
|
|
38
46
|
* - `plugin/domain-resolution.ts` — TOOL_DOMAIN + the pure validation
|
|
39
|
-
* logic that routes a spec to a domain
|
|
47
|
+
* logic that routes a spec to a domain (no install).
|
|
40
48
|
* - `plugin/host-dir.ts` — host package.json creation + installed-
|
|
41
49
|
* package introspection (incl. peer-dependency auto-install).
|
|
42
50
|
*/
|
|
43
51
|
import { type PluginLayout, type ToolProvenance } from '@opensip-cli/core';
|
|
44
52
|
import { editPluginList } from './plugin-host-ops.js';
|
|
45
53
|
import type { PluginResult } from '@opensip-cli/contracts';
|
|
46
|
-
/** Options shared by `plugin add`/`remove` for Tool-plugin scope selection. */
|
|
47
|
-
export interface PluginScopeOpts {
|
|
48
|
-
/** Install/remove a Tool plugin in the project-local host dir instead of user-global. */
|
|
49
|
-
readonly project?: boolean;
|
|
50
|
-
}
|
|
51
54
|
/**
|
|
52
55
|
* Test-only export for the YAML-driven config edit so unit tests can
|
|
53
56
|
* exercise the round-trip behaviour without spawning npm. Intentionally
|
|
@@ -58,14 +61,17 @@ export declare const __test: {
|
|
|
58
61
|
};
|
|
59
62
|
export declare function pluginList(cwd?: string, layouts?: readonly PluginLayout[], toolProvenance?: readonly ToolProvenance[]): Promise<PluginResult>;
|
|
60
63
|
/**
|
|
61
|
-
* Install a
|
|
64
|
+
* Install a pack AND add it to the project config in one step, scoped to the
|
|
65
|
+
* caller's bound `domain` (the pack-supporting tool the subcommand hangs off
|
|
66
|
+
* of — `fit`/`sim`). Whole Tool plugins are NOT installable here; use
|
|
67
|
+
* `opensip tools install`.
|
|
62
68
|
*
|
|
63
69
|
* Without the config update, the package wouldn't get loaded — making
|
|
64
70
|
* "install" alone always incomplete. Single-step is the only sensible
|
|
65
71
|
* default.
|
|
66
72
|
*/
|
|
67
|
-
export declare function pluginAdd(packageName: string | undefined, cwd?: string, domainOverride?: string, layouts?: readonly PluginLayout[]
|
|
68
|
-
export declare function pluginRemove(packageName: string | undefined, cwd?: string, domainOverride?: string, layouts?: readonly PluginLayout[]
|
|
73
|
+
export declare function pluginAdd(packageName: string | undefined, cwd?: string, domainOverride?: string, layouts?: readonly PluginLayout[]): Promise<PluginResult>;
|
|
74
|
+
export declare function pluginRemove(packageName: string | undefined, cwd?: string, domainOverride?: string, layouts?: readonly PluginLayout[]): Promise<PluginResult>;
|
|
69
75
|
/**
|
|
70
76
|
* Install every plugin declared in `plugins.<domain>` for a given
|
|
71
77
|
* domain (or all domains when none specified). Idempotent — re-running
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/commands/plugin.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/commands/plugin.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAMH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,cAAc,EAA4C,MAAM,sBAAsB,CAAC;AAEhG,OAAO,KAAK,EAAc,YAAY,EAAa,MAAM,wBAAwB,CAAC;AAUlF;;;;GAIG;AACH,eAAO,MAAM,MAAM;;CAAqB,CAAC;AAMzC,wBAAsB,UAAU,CAC9B,GAAG,GAAE,MAAsB,EAC3B,OAAO,GAAE,SAAS,YAAY,EAAO,EAGrC,cAAc,GAAE,SAAS,cAAc,EAAO,GAC7C,OAAO,CAAC,YAAY,CAAC,CAgCvB;AAUD;;;;;;;;;GASG;AAEH,wBAAsB,SAAS,CAC7B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,GAAG,GAAE,MAAsB,EAC3B,cAAc,CAAC,EAAE,MAAM,EACvB,OAAO,GAAE,SAAS,YAAY,EAAO,GACpC,OAAO,CAAC,YAAY,CAAC,CAwCvB;AAOD,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,GAAG,GAAE,MAAsB,EAC3B,cAAc,CAAC,EAAE,MAAM,EACvB,OAAO,GAAE,SAAS,YAAY,EAAO,GACpC,OAAO,CAAC,YAAY,CAAC,CAqDvB;AAMD;;;;;;;;;;GAUG;AAKH,wBAAsB,UAAU,CAC9B,GAAG,GAAE,MAAsB,EAC3B,cAAc,CAAC,EAAE,MAAM,EACvB,OAAO,GAAE,SAAS,YAAY,EAAO,GACpC,OAAO,CAAC,YAAY,CAAC,CA4CvB"}
|