opensip-cli 0.1.6 → 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.map +1 -1
- package/dist/bootstrap/admit-tool-package.js +8 -3
- 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.map +1 -1
- package/dist/bootstrap/config-and-capabilities.js +5 -4
- 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.map +1 -1
- package/dist/bootstrap/execute-post-bailout-bootstrap.js +10 -0
- 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/pre-action-hook.d.ts.map +1 -1
- package/dist/bootstrap/pre-action-hook.js +19 -2
- 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 +132 -83
- 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 +15 -1
- package/dist/commands/command-scope-index.d.ts.map +1 -1
- package/dist/commands/command-scope-index.js +10 -1
- package/dist/commands/command-scope-index.js.map +1 -1
- 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 +45 -19
- 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 +5 -0
- package/dist/commands/mount-command-action.d.ts.map +1 -1
- package/dist/commands/mount-command-action.js +26 -2
- package/dist/commands/mount-command-action.js.map +1 -1
- 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 +9 -1
- 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 +24 -6
- 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
|
@@ -15,6 +15,21 @@ function isLikelyCommanderCommand(x) {
|
|
|
15
15
|
typeof c.command === 'function' ||
|
|
16
16
|
(typeof c.constructor === 'function' && /Command/i.test(c.constructor.name || '')));
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Read a command's options INCLUDING inherited globals from its parent chain.
|
|
20
|
+
*
|
|
21
|
+
* For a `<tool> <verb>` nested child (taxonomy Task 0.4), a common flag the
|
|
22
|
+
* child shares with its parent primary (e.g. `--json` on both `fit` and
|
|
23
|
+
* `fit list`) is resolved by Commander onto the PARENT scope, so the child's
|
|
24
|
+
* local `cmd.opts()` is `{}` for that flag. `cmd.optsWithGlobals()` merges the
|
|
25
|
+
* parent chain's options under the child's locals (locals win), which is the
|
|
26
|
+
* value the dispatch + handler must see so `fit list --json` actually emits JSON.
|
|
27
|
+
* For a flat (un-nested) command this is identical to `cmd.opts()`.
|
|
28
|
+
*/
|
|
29
|
+
function optsWithGlobals(command) {
|
|
30
|
+
const c = command;
|
|
31
|
+
return typeof c.optsWithGlobals === 'function' ? c.optsWithGlobals() : undefined;
|
|
32
|
+
}
|
|
18
33
|
/**
|
|
19
34
|
* Split a Commander action callback's variadic arguments into the parsed-opts
|
|
20
35
|
* object and the trailing positional args.
|
|
@@ -23,6 +38,11 @@ function isLikelyCommanderCommand(x) {
|
|
|
23
38
|
* declared positionals come first, then the parsed-options object, then the
|
|
24
39
|
* `Command` instance.
|
|
25
40
|
*
|
|
41
|
+
* The returned `opts` are sourced from the final `Command`'s `optsWithGlobals()`
|
|
42
|
+
* when available (so a nested `<tool> <verb>` child inherits common flags its
|
|
43
|
+
* parent primary resolved — see {@link optsWithGlobals}), falling back to the
|
|
44
|
+
* options object Commander passed positionally (identical for a flat command).
|
|
45
|
+
*
|
|
26
46
|
* @throws {Error} When Commander does not provide a final Command argument, or
|
|
27
47
|
* when argument splitting would select the Command object as parsed options.
|
|
28
48
|
*/
|
|
@@ -36,10 +56,14 @@ export function splitActionArgs(actionArgs) {
|
|
|
36
56
|
'This indicates an incompatible Commander version or a wrapped dispatch. ' +
|
|
37
57
|
'Please report this with your Commander version.');
|
|
38
58
|
}
|
|
59
|
+
// Prefer the globally-resolved options off the Command so nested children see
|
|
60
|
+
// common flags (e.g. `--json`) their parent primary resolved. Falls back to
|
|
61
|
+
// the positional opts object below for any Commander shape lacking the method.
|
|
62
|
+
const globalsResolved = optsWithGlobals(actionArgs[lastIdx]);
|
|
39
63
|
for (let i = lastIdx - 1; i >= 0; i--) {
|
|
40
64
|
const v = actionArgs[i];
|
|
41
65
|
if (v && typeof v === 'object' && !Array.isArray(v) && !isLikelyCommanderCommand(v)) {
|
|
42
|
-
const opts = v;
|
|
66
|
+
const opts = globalsResolved ?? v;
|
|
43
67
|
const positionals = actionArgs.slice(0, i);
|
|
44
68
|
if (isLikelyCommanderCommand(opts)) {
|
|
45
69
|
throw new Error('mountCommandSpec: splitActionArgs selected a Commander Command as the parsed opts. ' +
|
|
@@ -49,6 +73,6 @@ export function splitActionArgs(actionArgs) {
|
|
|
49
73
|
}
|
|
50
74
|
}
|
|
51
75
|
const positionals = actionArgs.slice(0, lastIdx);
|
|
52
|
-
return { opts: {}, positionals };
|
|
76
|
+
return { opts: globalsResolved ?? {}, positionals };
|
|
53
77
|
}
|
|
54
78
|
//# sourceMappingURL=mount-command-action.js.map
|
|
@@ -1 +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,CAAC,GAAG,CAA4B,CAAC;IACvC,OAAO,CACL,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU;QAC5B,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU;QAC5B,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU;QAC/B,CAAC,OAAO,CAAC,CAAC,WAAW,KAAK,UAAU,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CACnF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,UAA8B;IAI5D,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IACvC,CAAC;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IACtC,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,O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AC,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,EAAE,IAAI,EAAE,eAAe,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -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;;;;;;;;;;;;;;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@ -34,10 +34,17 @@ import { emitCommandResult } from './mount-result-command.js';
|
|
|
34
34
|
* 5. `cmd.action(...)` → run `spec.handler(opts, ctx)` → {@link dispatchOutput}
|
|
35
35
|
* → on a thrown {@link ToolError}, `mapToolErrorToExitCode` → `ctx.setExitCode`.
|
|
36
36
|
*
|
|
37
|
-
* @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.
|
|
38
43
|
* @param spec The declarative command surface the tool/host exported.
|
|
39
44
|
* @param ctx The per-invocation host context (render/envelope/live-view
|
|
40
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.
|
|
41
48
|
*/
|
|
42
49
|
export function mountCommandSpec(program, spec, ctx) {
|
|
43
50
|
const cmd = program.command(spec.name).description(spec.description);
|
|
@@ -96,6 +103,7 @@ export function mountCommandSpec(program, spec, ctx) {
|
|
|
96
103
|
throw error;
|
|
97
104
|
}
|
|
98
105
|
});
|
|
106
|
+
return cmd;
|
|
99
107
|
}
|
|
100
108
|
/**
|
|
101
109
|
* The SINGLE output-dispatch seam. The launch `CommandOutcome` wrap is LANDED:
|
|
@@ -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,GAMb,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,eAAe,E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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","sourceRoot":"","sources":["../../../src/comm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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"}
|