opensip-cli 0.1.6 → 0.1.8
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 +92 -10
- 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 +7 -1
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +15 -6
- 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 +24 -2
- package/dist/bootstrap/pre-action-hook.js.map +1 -1
- package/dist/bootstrap/register-tools-discovery.d.ts +42 -59
- package/dist/bootstrap/register-tools-discovery.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-discovery.js +175 -97
- 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 +26 -1
- package/dist/bootstrap/scope-access.d.ts.map +1 -1
- package/dist/bootstrap/scope-access.js +38 -1
- package/dist/bootstrap/scope-access.js.map +1 -1
- package/dist/bootstrap/skip-installed-plugins.d.ts +23 -0
- package/dist/bootstrap/skip-installed-plugins.d.ts.map +1 -0
- package/dist/bootstrap/skip-installed-plugins.js +30 -0
- package/dist/bootstrap/skip-installed-plugins.js.map +1 -0
- 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/tool-trust.d.ts +22 -2
- package/dist/bootstrap/tool-trust.d.ts.map +1 -1
- package/dist/bootstrap/tool-trust.js +25 -2
- package/dist/bootstrap/tool-trust.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 +58 -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 +33 -11
- 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/telemetry/command-label.d.ts +19 -0
- package/dist/telemetry/command-label.d.ts.map +1 -0
- package/dist/telemetry/command-label.js +26 -0
- package/dist/telemetry/command-label.js.map +1 -0
- package/dist/telemetry/sdk-init.d.ts +9 -0
- package/dist/telemetry/sdk-init.d.ts.map +1 -1
- package/dist/telemetry/sdk-init.js +32 -0
- package/dist/telemetry/sdk-init.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 +29 -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
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
// @fitness-ignore-file file-length-limit -- deliberate single cycle-free leaf module: it houses BOTH host subcommand groups' leaf specs (sessions +
|
|
1
|
+
// @fitness-ignore-file file-length-limit -- deliberate single cycle-free leaf module: it houses BOTH host subcommand groups' leaf specs (sessions + tools) AND the per-tool `plugin` group leaves + the completion inventory together specifically because it must import neither completion.ts nor host-command-specs.ts (see header — splitting would reintroduce the module cycle this file exists to break). Cohesive by design; grew past the 400-line soft limit with the per-leaf CommandSpec builders.
|
|
2
2
|
/**
|
|
3
3
|
* host-subcommand-groups — the action-less Commander subcommand GROUPS
|
|
4
|
-
* (`sessions`, `
|
|
5
|
-
* Phase 6
|
|
4
|
+
* (`sessions`, `tools`) and their leaf {@link CommandSpec}s, PLUS the
|
|
5
|
+
* DOMAIN-BOUND per-tool `plugin` group leaves (launch Phase 6 + the
|
|
6
|
+
* command-surface-taxonomy "packs under the tool" refinement).
|
|
6
7
|
*
|
|
7
8
|
* Split out of `host-command-specs.ts` for ONE reason: to break a module cycle.
|
|
8
|
-
* The completion-script generator (`completion.ts`) sources its `
|
|
9
|
-
* `
|
|
9
|
+
* The completion-script generator (`completion.ts`) sources its `sessions` /
|
|
10
|
+
* `tools` sub-subcommand NAME lists from the live leaf specs (single source —
|
|
10
11
|
* Phase 6 Task 6.2), so it must import the group inventory. The
|
|
11
12
|
* `host-command-specs.ts` module, in turn, imports `printCompletionScript` from
|
|
12
13
|
* `completion.ts` for the `completion` command's handler. Housing the GROUP
|
|
@@ -17,11 +18,18 @@
|
|
|
17
18
|
* a single mountable `CommandSpec`, so it stays a raw `program.command(name)`
|
|
18
19
|
* shell (the FINITE, NAMED documented exceptions for the Phase 7
|
|
19
20
|
* `command-surface-parity` guardrail's allow-list, see {@link HOST_SUBCOMMAND_GROUPS}).
|
|
20
|
-
* Their LEAVES (`sessions list|purge`, `
|
|
21
|
+
* Their LEAVES (`sessions list|purge`, `tools list|install|…`) ARE specs.
|
|
22
|
+
*
|
|
23
|
+
* The PACK-management `plugin {add,list,remove,sync}` ops are NO LONGER a
|
|
24
|
+
* top-level group: they mount as a `plugin` group UNDER each pack-supporting
|
|
25
|
+
* tool primary (`opensip fit plugin …`, `opensip sim plugin …`) via
|
|
26
|
+
* `mountToolPluginGroups`, with the domain pre-bound from the tool (no
|
|
27
|
+
* `--domain` flag). Whole Tool plugins remain `opensip tools …`.
|
|
21
28
|
*/
|
|
22
29
|
import { currentScope, defineCommand, } from '@opensip-cli/core';
|
|
23
30
|
import { executeClear } from './clear.js';
|
|
24
31
|
import { showHistory } from './history.js';
|
|
32
|
+
import { mountCommandSpec } from './mount-command-spec.js';
|
|
25
33
|
import { pluginAdd, pluginList, pluginRemove, pluginSync } from './plugin.js';
|
|
26
34
|
import { executeSessionShow } from './session-show.js';
|
|
27
35
|
import { buildToolsGroupLeaves } from './tools/index.js';
|
|
@@ -190,8 +198,15 @@ function buildSessionsPurgeSpec(ctx) {
|
|
|
190
198
|
});
|
|
191
199
|
}
|
|
192
200
|
// ---------------------------------------------------------------------------
|
|
193
|
-
// plugin list
|
|
201
|
+
// <tool> plugin {list,add,remove,sync} — DOMAIN-BOUND extension-pack ops
|
|
194
202
|
// ---------------------------------------------------------------------------
|
|
203
|
+
//
|
|
204
|
+
// The pack ops are mounted UNDER each pack-supporting tool primary
|
|
205
|
+
// (`opensip fit plugin …`, `opensip sim plugin …`) by `mountToolPluginGroups`,
|
|
206
|
+
// with the `domain` PRE-BOUND from that tool. There is no top-level
|
|
207
|
+
// `opensip plugin` command and no `--domain`/`--type` flag: the tool the
|
|
208
|
+
// subcommand hangs off of IS the domain. Whole Tool plugins are managed by
|
|
209
|
+
// `opensip tools …`, never here.
|
|
195
210
|
/** The shared `--cwd <path>` option for the plugin leaves. Its description is
|
|
196
211
|
* "Project root" (NOT the registry's "Target directory"), so it is declared as
|
|
197
212
|
* a per-command OptionSpec rather than the `cwd` common flag — preserving the
|
|
@@ -205,10 +220,19 @@ function pluginCwdOption() {
|
|
|
205
220
|
default: process.cwd(),
|
|
206
221
|
};
|
|
207
222
|
}
|
|
208
|
-
|
|
223
|
+
/** The single-domain layout view passed to the pure plugin commands so a
|
|
224
|
+
* bound `<tool> plugin …` op only ever touches its own domain. Resolved from
|
|
225
|
+
* the host's contributed `pluginLayouts` (so the domain is a real layout, not
|
|
226
|
+
* an arbitrary string); falls back to a minimal layout if the tool's full
|
|
227
|
+
* layout is somehow absent. */
|
|
228
|
+
function boundLayouts(ctx, domain) {
|
|
229
|
+
const match = ctx.pluginLayouts.find((l) => l.domain === domain);
|
|
230
|
+
return match ? [match] : [{ domain, userSubdirs: [] }];
|
|
231
|
+
}
|
|
232
|
+
function buildPluginListSpec(ctx, domain) {
|
|
209
233
|
return defineCommand({
|
|
210
234
|
name: 'list',
|
|
211
|
-
description:
|
|
235
|
+
description: `List installed ${domain} packs`,
|
|
212
236
|
commonFlags: ['json'],
|
|
213
237
|
options: [pluginCwdOption()],
|
|
214
238
|
scope: PROJECT_SCOPE,
|
|
@@ -216,29 +240,18 @@ function buildPluginListSpec(ctx) {
|
|
|
216
240
|
handler: (rawOpts) => {
|
|
217
241
|
const opts = rawOpts;
|
|
218
242
|
// Per-run admitted-tool provenance is on the entered RunScope (stamped by
|
|
219
|
-
// the bootstrap); read it here and pass it into the pure `pluginList
|
|
220
|
-
|
|
243
|
+
// the bootstrap); read it here and pass it into the pure `pluginList`,
|
|
244
|
+
// scoped to this tool's own domain.
|
|
245
|
+
return pluginList(effectiveCwd(opts), boundLayouts(ctx, domain), currentScope()?.toolProvenance ?? []);
|
|
221
246
|
},
|
|
222
247
|
});
|
|
223
248
|
}
|
|
224
|
-
function buildPluginAddSpec(ctx) {
|
|
249
|
+
function buildPluginAddSpec(ctx, domain) {
|
|
225
250
|
return defineCommand({
|
|
226
251
|
name: 'add',
|
|
227
|
-
description:
|
|
252
|
+
description: `Install a ${domain} pack and record it in opensip-cli.config.yml`,
|
|
228
253
|
commonFlags: ['json'],
|
|
229
|
-
options: [
|
|
230
|
-
{
|
|
231
|
-
flag: '--domain',
|
|
232
|
-
value: '<fit|sim|tool>',
|
|
233
|
-
description: 'Target domain (default: inferred; tool plugins auto-detected by marker)',
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
flag: '--project',
|
|
237
|
-
description: 'For a tool plugin, install project-local (.runtime/) instead of user-global',
|
|
238
|
-
default: false,
|
|
239
|
-
},
|
|
240
|
-
pluginCwdOption(),
|
|
241
|
-
],
|
|
254
|
+
options: [pluginCwdOption()],
|
|
242
255
|
// Empty description: the former `.command('add <package>')` declared the
|
|
243
256
|
// positional inline with no help text, so Commander rendered no "Arguments:"
|
|
244
257
|
// block. Keeping it empty preserves the byte-identical --help.
|
|
@@ -248,30 +261,17 @@ function buildPluginAddSpec(ctx) {
|
|
|
248
261
|
handler: (rawOpts) => {
|
|
249
262
|
const opts = rawOpts;
|
|
250
263
|
const packageName = opts._args[0];
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
});
|
|
264
|
+
// Domain is bound from the tool primary — no `--domain` flag.
|
|
265
|
+
return pluginAdd(packageName, effectiveCwd(opts), domain, boundLayouts(ctx, domain));
|
|
254
266
|
},
|
|
255
267
|
});
|
|
256
268
|
}
|
|
257
|
-
function buildPluginRemoveSpec(ctx) {
|
|
269
|
+
function buildPluginRemoveSpec(ctx, domain) {
|
|
258
270
|
return defineCommand({
|
|
259
271
|
name: 'remove',
|
|
260
|
-
description:
|
|
272
|
+
description: `Uninstall a ${domain} pack and remove it from opensip-cli.config.yml`,
|
|
261
273
|
commonFlags: ['json'],
|
|
262
|
-
options: [
|
|
263
|
-
{
|
|
264
|
-
flag: '--domain',
|
|
265
|
-
value: '<fit|sim|tool>',
|
|
266
|
-
description: 'Target domain (default: inferred from package name)',
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
flag: '--project',
|
|
270
|
-
description: 'For a tool plugin, target the project-local install instead of user-global',
|
|
271
|
-
default: false,
|
|
272
|
-
},
|
|
273
|
-
pluginCwdOption(),
|
|
274
|
-
],
|
|
274
|
+
options: [pluginCwdOption()],
|
|
275
275
|
// Empty description — see the plugin-add note above (byte-identical --help).
|
|
276
276
|
args: [{ name: 'package', description: '' }],
|
|
277
277
|
scope: PROJECT_SCOPE,
|
|
@@ -279,36 +279,78 @@ function buildPluginRemoveSpec(ctx) {
|
|
|
279
279
|
handler: (rawOpts) => {
|
|
280
280
|
const opts = rawOpts;
|
|
281
281
|
const packageName = opts._args[0];
|
|
282
|
-
return pluginRemove(packageName, effectiveCwd(opts),
|
|
283
|
-
project: opts.project,
|
|
284
|
-
});
|
|
282
|
+
return pluginRemove(packageName, effectiveCwd(opts), domain, boundLayouts(ctx, domain));
|
|
285
283
|
},
|
|
286
284
|
});
|
|
287
285
|
}
|
|
288
|
-
function buildPluginSyncSpec(ctx) {
|
|
286
|
+
function buildPluginSyncSpec(ctx, domain) {
|
|
289
287
|
return defineCommand({
|
|
290
288
|
name: 'sync',
|
|
291
|
-
description:
|
|
289
|
+
description: `Install every ${domain} pack declared in opensip-cli.config.yml (post-clone bootstrap)`,
|
|
292
290
|
commonFlags: ['json'],
|
|
293
|
-
options: [
|
|
294
|
-
{ flag: '--domain', value: '<fit|sim>', description: 'Sync only one domain' },
|
|
295
|
-
pluginCwdOption(),
|
|
296
|
-
],
|
|
291
|
+
options: [pluginCwdOption()],
|
|
297
292
|
scope: PROJECT_SCOPE,
|
|
298
293
|
output: COMMAND_RESULT,
|
|
299
294
|
handler: (rawOpts) => {
|
|
300
295
|
const opts = rawOpts;
|
|
301
|
-
return pluginSync(effectiveCwd(opts),
|
|
296
|
+
return pluginSync(effectiveCwd(opts), domain, boundLayouts(ctx, domain));
|
|
302
297
|
},
|
|
303
298
|
});
|
|
304
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Build the four domain-bound `plugin` leaf specs for ONE pack-supporting tool
|
|
302
|
+
* (`add`/`list`/`remove`/`sync`, all scoped to `domain`). Shared by the mount
|
|
303
|
+
* path (`mountToolPluginGroups`), the command-scope index, and the completion
|
|
304
|
+
* inventory so the three derive the SAME leaves.
|
|
305
|
+
*/
|
|
306
|
+
export function buildToolPluginLeaves(ctx, domain) {
|
|
307
|
+
return [
|
|
308
|
+
buildPluginListSpec(ctx, domain),
|
|
309
|
+
buildPluginAddSpec(ctx, domain),
|
|
310
|
+
buildPluginRemoveSpec(ctx, domain),
|
|
311
|
+
buildPluginSyncSpec(ctx, domain),
|
|
312
|
+
];
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Derive the per-tool `plugin` groups from the host's contributed
|
|
316
|
+
* `pluginLayouts` — one group per pack-supporting domain (fit/sim). A tool with
|
|
317
|
+
* no `pluginLayout` (e.g. `graph`) contributes none, so it gets no `plugin`
|
|
318
|
+
* group. The single source the mount path + scope index + completion all read.
|
|
319
|
+
*/
|
|
320
|
+
export function buildToolPluginGroups(ctx) {
|
|
321
|
+
return ctx.pluginLayouts.map((layout) => ({
|
|
322
|
+
toolVerb: layout.domain,
|
|
323
|
+
domain: layout.domain,
|
|
324
|
+
description: `Manage ${layout.domain} extension packs (add, list, remove, sync)`,
|
|
325
|
+
leaves: buildToolPluginLeaves(ctx, layout.domain),
|
|
326
|
+
}));
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Mount each per-tool `plugin` group UNDER its pack-supporting tool primary
|
|
330
|
+
* (`opensip fit plugin …`), domain pre-bound from the tool. The host derives the
|
|
331
|
+
* groups from the contributed `pluginLayouts` (fit/sim; graph has none, so no
|
|
332
|
+
* group). The tool primary must already be mounted — it is, because the
|
|
333
|
+
* composition root mounts tools before the host commands; a domain whose primary
|
|
334
|
+
* is absent (isolated host-only tests) is skipped (nowhere to hang it).
|
|
335
|
+
*/
|
|
336
|
+
export function mountToolPluginGroups(program, ctx) {
|
|
337
|
+
for (const group of buildToolPluginGroups(ctx)) {
|
|
338
|
+
const primary = program.commands.find((c) => c.name() === group.toolVerb);
|
|
339
|
+
if (primary === undefined)
|
|
340
|
+
continue; // no tool primary mounted (host-only tests)
|
|
341
|
+
const parent = primary.command('plugin').description(group.description);
|
|
342
|
+
for (const leaf of group.leaves) {
|
|
343
|
+
mountCommandSpec(parent, leaf, ctx);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
305
347
|
/**
|
|
306
348
|
* The action-less Commander subcommand GROUPS that legitimately cannot be a
|
|
307
349
|
* single {@link CommandSpec} — they have no action body, only sub-subcommands.
|
|
308
350
|
* This is the FINITE, NAMED set the Phase 7 `command-surface-parity` guardrail
|
|
309
351
|
* allow-lists as documented host exceptions. Every other host command IS a spec.
|
|
310
352
|
*/
|
|
311
|
-
export const HOST_SUBCOMMAND_GROUPS = ['sessions', '
|
|
353
|
+
export const HOST_SUBCOMMAND_GROUPS = ['sessions', 'tools'];
|
|
312
354
|
/**
|
|
313
355
|
* Build the subcommand-group parents with their leaf specs. The mounter turns
|
|
314
356
|
* each into a raw parent `program.command(name)` plus `mountCommandSpec(parent,
|
|
@@ -321,16 +363,6 @@ export function buildHostSubcommandGroups(ctx) {
|
|
|
321
363
|
description: 'Manage session data',
|
|
322
364
|
leaves: [buildSessionsListSpec(ctx), buildSessionsShowSpec(ctx), buildSessionsPurgeSpec(ctx)],
|
|
323
365
|
},
|
|
324
|
-
{
|
|
325
|
-
name: 'plugin',
|
|
326
|
-
description: 'Manage project-local plugins (add, list, remove, sync)',
|
|
327
|
-
leaves: [
|
|
328
|
-
buildPluginListSpec(ctx),
|
|
329
|
-
buildPluginAddSpec(ctx),
|
|
330
|
-
buildPluginRemoveSpec(ctx),
|
|
331
|
-
buildPluginSyncSpec(ctx),
|
|
332
|
-
],
|
|
333
|
-
},
|
|
334
366
|
{
|
|
335
367
|
name: 'tools',
|
|
336
368
|
description: 'Manage whole Tool plugins (list, validate, install, uninstall)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-subcommand-groups.js","sourceRoot":"","sources":["../../src/commands/host-subcommand-groups.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"host-subcommand-groups.js","sourceRoot":"","sources":["../../src/commands/host-subcommand-groups.ts"],"names":[],"mappings":"AAAA,+eAA+e;AAC/e;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,GAMd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AASzD;wEACwE;AACxE,MAAM,aAAa,GAA4B,SAAS,CAAC;AAEzD,8EAA8E;AAC9E,MAAM,cAAc,GAA0B,gBAAgB,CAAC;AAE/D,MAAM,UAAU,GAA0B,YAAY,CAAC;AAEvD,2FAA2F;AAC3F,MAAM,UAAU,YAAY,CAAC,IAAuD;IAClF,OAAO,IAAI,CAAC,cAAc,EAAE,WAAW,IAAI,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AACvE,CAAC;AAED,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,SAAS,qBAAqB,CAAC,GAAuB;IACpD,OAAO,aAAa,CAA8B;QAChD,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,sBAAsB;QACnC,WAAW,EAAE,CAAC,MAAM,CAAC;QACrB,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,oBAAoB;gBACjC,OAAO,EAAE,CAAC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,OAAO,EAAE;IAC/B,QAAQ,EAAE,GAAG,EAAE;QACb,uDAAuD;IACzD,CAAC;IACD,OAAO,EAAE,GAAG,EAAE;QACZ,uDAAuD;IACzD,CAAC;IACD,SAAS,EAAE,GAAG,EAAE;QACd,uDAAuD;IACzD,CAAC;IACD,aAAa,EAAE,EAAE;IACjB,aAAa,EAAE,EAAE;IACjB,8LAA8L;IAC9L,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS;CAC3B,CAAC;AAoBF,qFAAqF;AACrF,MAAM,UAAU,yBAAyB;IACvC,MAAM,gBAAgB,GAAsC,EAAE,CAAC;IAC/D,KAAK,MAAM,KAAK,IAAI,yBAAyB,CAAC,aAAa,CAAC,EAAE,CAAC;QAC7D,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC9B,CAAC"}
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* two-tier privilege.
|
|
21
21
|
*
|
|
22
22
|
* Tool-owned subcommands (`fit`, `sim`, `graph`, …) are mounted separately by
|
|
23
|
-
* walking the CLI-managed tool registry (`
|
|
23
|
+
* walking the CLI-managed tool registry (`mountAllToolCommands`), which mounts
|
|
24
24
|
* each tool's `commandSpecs` via the same `mountCommandSpec`.
|
|
25
25
|
*/
|
|
26
26
|
import type { CliCommandsContext } from './shared.js';
|
package/dist/commands/index.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* two-tier privilege.
|
|
21
21
|
*
|
|
22
22
|
* Tool-owned subcommands (`fit`, `sim`, `graph`, …) are mounted separately by
|
|
23
|
-
* walking the CLI-managed tool registry (`
|
|
23
|
+
* walking the CLI-managed tool registry (`mountAllToolCommands`), which mounts
|
|
24
24
|
* each tool's `commandSpecs` via the same `mountCommandSpec`.
|
|
25
25
|
*/
|
|
26
26
|
import { mountHostCommands } from './host-command-specs.js';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* internal-command-visibility — the single host source of truth for the
|
|
3
|
+
* tool-command-surface-taxonomy Tier-3 hide policy.
|
|
4
|
+
*
|
|
5
|
+
* Two host-owned primitives, used in lockstep so `--help` and shell completion
|
|
6
|
+
* agree on exactly which commands are internal and when they are revealed:
|
|
7
|
+
*
|
|
8
|
+
* - {@link internalCommandNames} walks the populated per-invocation
|
|
9
|
+
* `ToolRegistry` and collects every command whose `ToolCommandDescriptor`
|
|
10
|
+
* declares `visibility: 'internal'`. This is the descriptor-driven set the
|
|
11
|
+
* help hide pass (`register-tools-mount.ts`) and the completion inventory
|
|
12
|
+
* (`host-command-specs.ts` → `assembleCompletionInventory`) both consume —
|
|
13
|
+
* so adding a new internal worker is a one-line descriptor change, not a
|
|
14
|
+
* hand-maintained list edit in two places.
|
|
15
|
+
*
|
|
16
|
+
* - {@link showInternalCommands} is the single env predicate
|
|
17
|
+
* (`OPENSIP_CLI_SHOW_INTERNAL=1`) that un-hides internal commands across
|
|
18
|
+
* help + completion. Routed through the host {@link hostEnv} registry (the
|
|
19
|
+
* `env-via-registry` guardrail), so the value is documented in the env
|
|
20
|
+
* surface and read in exactly one place.
|
|
21
|
+
*
|
|
22
|
+
* Asymmetry (deliberate): the agent-catalog is a CURATED machine surface, not a
|
|
23
|
+
* debug dump, so it NEVER surfaces internal commands and the env reveal does NOT
|
|
24
|
+
* apply to it. Only `--help` and shell completion honour the override.
|
|
25
|
+
*/
|
|
26
|
+
import { type ToolRegistry } from '@opensip-cli/core';
|
|
27
|
+
/**
|
|
28
|
+
* Collect the names of every command a tool declares as
|
|
29
|
+
* `visibility: 'internal'` (Tier-3), across all tools in `registry`. The single
|
|
30
|
+
* host source for "which mounted commands are internal", read by the help hide
|
|
31
|
+
* pass and the completion inventory so the two never drift.
|
|
32
|
+
*/
|
|
33
|
+
export declare function internalCommandNames(registry: ToolRegistry): ReadonlySet<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Whether internal (Tier-3) commands should be REVEALED on the public surfaces
|
|
36
|
+
* that honour the override (`--help`, shell completion). True iff
|
|
37
|
+
* `OPENSIP_CLI_SHOW_INTERNAL` is exactly `'1'` (the env spec's strict coerce).
|
|
38
|
+
*
|
|
39
|
+
* The agent-catalog deliberately does NOT consult this — see the module JSDoc.
|
|
40
|
+
*/
|
|
41
|
+
export declare function showInternalCommands(): boolean;
|
|
42
|
+
//# sourceMappingURL=internal-command-visibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-command-visibility.d.ts","sourceRoot":"","sources":["../../src/commands/internal-command-visibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI3E;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,CAQhF;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* internal-command-visibility — the single host source of truth for the
|
|
3
|
+
* tool-command-surface-taxonomy Tier-3 hide policy.
|
|
4
|
+
*
|
|
5
|
+
* Two host-owned primitives, used in lockstep so `--help` and shell completion
|
|
6
|
+
* agree on exactly which commands are internal and when they are revealed:
|
|
7
|
+
*
|
|
8
|
+
* - {@link internalCommandNames} walks the populated per-invocation
|
|
9
|
+
* `ToolRegistry` and collects every command whose `ToolCommandDescriptor`
|
|
10
|
+
* declares `visibility: 'internal'`. This is the descriptor-driven set the
|
|
11
|
+
* help hide pass (`register-tools-mount.ts`) and the completion inventory
|
|
12
|
+
* (`host-command-specs.ts` → `assembleCompletionInventory`) both consume —
|
|
13
|
+
* so adding a new internal worker is a one-line descriptor change, not a
|
|
14
|
+
* hand-maintained list edit in two places.
|
|
15
|
+
*
|
|
16
|
+
* - {@link showInternalCommands} is the single env predicate
|
|
17
|
+
* (`OPENSIP_CLI_SHOW_INTERNAL=1`) that un-hides internal commands across
|
|
18
|
+
* help + completion. Routed through the host {@link hostEnv} registry (the
|
|
19
|
+
* `env-via-registry` guardrail), so the value is documented in the env
|
|
20
|
+
* surface and read in exactly one place.
|
|
21
|
+
*
|
|
22
|
+
* Asymmetry (deliberate): the agent-catalog is a CURATED machine surface, not a
|
|
23
|
+
* debug dump, so it NEVER surfaces internal commands and the env reveal does NOT
|
|
24
|
+
* apply to it. Only `--help` and shell completion honour the override.
|
|
25
|
+
*/
|
|
26
|
+
import { resolveToolCommands } from '@opensip-cli/core';
|
|
27
|
+
import { hostEnv } from '../env/host-env-specs.js';
|
|
28
|
+
/**
|
|
29
|
+
* Collect the names of every command a tool declares as
|
|
30
|
+
* `visibility: 'internal'` (Tier-3), across all tools in `registry`. The single
|
|
31
|
+
* host source for "which mounted commands are internal", read by the help hide
|
|
32
|
+
* pass and the completion inventory so the two never drift.
|
|
33
|
+
*/
|
|
34
|
+
export function internalCommandNames(registry) {
|
|
35
|
+
const names = new Set();
|
|
36
|
+
for (const tool of registry.list()) {
|
|
37
|
+
for (const descriptor of resolveToolCommands(tool)) {
|
|
38
|
+
if (descriptor.visibility === 'internal')
|
|
39
|
+
names.add(descriptor.name);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return names;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Whether internal (Tier-3) commands should be REVEALED on the public surfaces
|
|
46
|
+
* that honour the override (`--help`, shell completion). True iff
|
|
47
|
+
* `OPENSIP_CLI_SHOW_INTERNAL` is exactly `'1'` (the env spec's strict coerce).
|
|
48
|
+
*
|
|
49
|
+
* The agent-catalog deliberately does NOT consult this — see the module JSDoc.
|
|
50
|
+
*/
|
|
51
|
+
export function showInternalCommands() {
|
|
52
|
+
return hostEnv.get('OPENSIP_CLI_SHOW_INTERNAL') === true;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=internal-command-visibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-command-visibility.js","sourceRoot":"","sources":["../../src/commands/internal-command-visibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,mBAAmB,EAAqB,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAsB;IACzD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;QACnC,KAAK,MAAM,UAAU,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACnD,IAAI,UAAU,CAAC,UAAU,KAAK,UAAU;gBAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,OAAO,CAAC,GAAG,CAAU,2BAA2B,CAAC,KAAK,IAAI,CAAC;AACpE,CAAC"}
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* declared positionals come first, then the parsed-options object, then the
|
|
10
10
|
* `Command` instance.
|
|
11
11
|
*
|
|
12
|
+
* The returned `opts` are sourced from the final `Command`'s `optsWithGlobals()`
|
|
13
|
+
* when available (so a nested `<tool> <verb>` child inherits common flags its
|
|
14
|
+
* parent primary resolved — see {@link optsWithGlobals}), falling back to the
|
|
15
|
+
* options object Commander passed positionally (identical for a flat command).
|
|
16
|
+
*
|
|
12
17
|
* @throws {Error} When Commander does not provide a final Command argument, or
|
|
13
18
|
* when argument splitting would select the Command object as parsed options.
|
|
14
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount-command-action.d.ts","sourceRoot":"","sources":["../../src/commands/mount-command-action.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"mount-command-action.d.ts","sourceRoot":"","sources":["../../src/commands/mount-command-action.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkCH;;;;;;;;;;;;;;;GAeG;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,CAqCA"}
|
|
@@ -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,OAAO,CAAC,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CACb,qGAAqG;YACnG,0EAA0E;YAC1E,iDAAiD,CACpD,CAAC;IACJ,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,CA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AC,MAAM,GAAG,CAAC,CAAC;IACtC,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CACb,qGAAqG;YACnG,0EAA0E;YAC1E,iDAAiD,CACpD,CAAC;IACJ,CAAC;IAED,8EAA8E;IAC9E,4EAA4E;IAC5E,+EAA+E;IAC/E,MAAM,eAAe,GAAG,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IAE7D,KAAK,IAAI,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,CAAC;YACpF,MAAM,IAAI,GAAG,eAAe,IAAK,CAA6B,CAAC;YAC/D,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAE3C,IAAI,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnC,MAAM,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,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;;;;;;;;;;;;;;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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,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;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;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,UAAU,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"}
|
|
@@ -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,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAgD9D
|
|
1
|
+
{"version":3,"file":"mount-command-spec.js","sourceRoot":"","sources":["../../src/commands/mount-command-spec.ts"],"names":[],"mapp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