opensip-cli 0.1.10 → 0.1.11
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/baseline-seams.d.ts.map +1 -1
- package/dist/bootstrap/baseline-seams.js +0 -2
- package/dist/bootstrap/baseline-seams.js.map +1 -1
- package/dist/bootstrap/bootstrap-diagnostics-buffer.d.ts +15 -0
- package/dist/bootstrap/bootstrap-diagnostics-buffer.d.ts.map +1 -0
- package/dist/bootstrap/bootstrap-diagnostics-buffer.js +24 -0
- package/dist/bootstrap/bootstrap-diagnostics-buffer.js.map +1 -0
- package/dist/bootstrap/build-command-registration-input.d.ts +2 -0
- package/dist/bootstrap/build-command-registration-input.d.ts.map +1 -1
- package/dist/bootstrap/build-command-registration-input.js +1 -0
- package/dist/bootstrap/build-command-registration-input.js.map +1 -1
- package/dist/bootstrap/build-per-run-scope.d.ts +5 -1
- package/dist/bootstrap/build-per-run-scope.d.ts.map +1 -1
- package/dist/bootstrap/build-per-run-scope.js +8 -2
- package/dist/bootstrap/build-per-run-scope.js.map +1 -1
- package/dist/bootstrap/bundled-tools.manifest.json +6 -1
- package/dist/bootstrap/config-and-capabilities.d.ts +2 -1
- package/dist/bootstrap/config-and-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/config-and-capabilities.js +18 -5
- package/dist/bootstrap/config-and-capabilities.js.map +1 -1
- package/dist/bootstrap/deliver-envelope.d.ts.map +1 -1
- package/dist/bootstrap/deliver-envelope.js +0 -1
- package/dist/bootstrap/deliver-envelope.js.map +1 -1
- package/dist/bootstrap/discovery-diagnostics.d.ts +17 -0
- package/dist/bootstrap/discovery-diagnostics.d.ts.map +1 -0
- package/dist/bootstrap/discovery-diagnostics.js +94 -0
- package/dist/bootstrap/discovery-diagnostics.js.map +1 -0
- package/dist/bootstrap/dispatch-host-rpc-handler.d.ts.map +1 -1
- package/dist/bootstrap/dispatch-host-rpc-handler.js +0 -1
- package/dist/bootstrap/dispatch-host-rpc-handler.js.map +1 -1
- package/dist/bootstrap/dispatch-replay-result.d.ts.map +1 -1
- package/dist/bootstrap/dispatch-replay-result.js +0 -1
- package/dist/bootstrap/dispatch-replay-result.js.map +1 -1
- package/dist/bootstrap/execute-post-bailout-bootstrap.d.ts.map +1 -1
- package/dist/bootstrap/execute-post-bailout-bootstrap.js +8 -2
- package/dist/bootstrap/execute-post-bailout-bootstrap.js.map +1 -1
- package/dist/bootstrap/index.d.ts +6 -1
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +15 -4
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/bootstrap/load-tool-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/load-tool-capabilities.js +14 -2
- package/dist/bootstrap/load-tool-capabilities.js.map +1 -1
- package/dist/bootstrap/output-plane.d.ts.map +1 -1
- package/dist/bootstrap/output-plane.js +1 -0
- package/dist/bootstrap/output-plane.js.map +1 -1
- package/dist/bootstrap/pre-action-hook.d.ts.map +1 -1
- package/dist/bootstrap/pre-action-hook.js +0 -2
- package/dist/bootstrap/pre-action-hook.js.map +1 -1
- package/dist/bootstrap/pre-action-runtime.d.ts +2 -1
- package/dist/bootstrap/pre-action-runtime.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-discovery.d.ts +6 -4
- package/dist/bootstrap/register-tools-discovery.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-discovery.js +32 -19
- package/dist/bootstrap/register-tools-discovery.js.map +1 -1
- package/dist/bootstrap/register-tools-mount.d.ts +8 -5
- package/dist/bootstrap/register-tools-mount.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-mount.js +35 -6
- package/dist/bootstrap/register-tools-mount.js.map +1 -1
- package/dist/bootstrap/register-tools.d.ts.map +1 -1
- package/dist/bootstrap/register-tools.js +0 -2
- package/dist/bootstrap/register-tools.js.map +1 -1
- package/dist/bootstrap/render-bootstrap-diagnostics.d.ts +13 -0
- package/dist/bootstrap/render-bootstrap-diagnostics.d.ts.map +1 -0
- package/dist/bootstrap/render-bootstrap-diagnostics.js +25 -0
- package/dist/bootstrap/render-bootstrap-diagnostics.js.map +1 -0
- package/dist/bootstrap/run-plane.d.ts.map +1 -1
- package/dist/bootstrap/run-plane.js +9 -4
- package/dist/bootstrap/run-plane.js.map +1 -1
- package/dist/bootstrap/state-seams.d.ts.map +1 -1
- package/dist/bootstrap/state-seams.js +0 -1
- package/dist/bootstrap/state-seams.js.map +1 -1
- package/dist/bootstrap/synthesize-external-tool.d.ts +0 -37
- package/dist/bootstrap/synthesize-external-tool.d.ts.map +1 -1
- package/dist/bootstrap/synthesize-external-tool.js +18 -67
- package/dist/bootstrap/synthesize-external-tool.js.map +1 -1
- package/dist/bootstrap/tool-command-worker-context.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-context.js +0 -1
- package/dist/bootstrap/tool-command-worker-context.js.map +1 -1
- package/dist/bootstrap/tool-command-worker-entry.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-entry.js +1 -3
- package/dist/bootstrap/tool-command-worker-entry.js.map +1 -1
- package/dist/bootstrap/tool-trust.d.ts.map +1 -1
- package/dist/bootstrap/tool-trust.js +15 -0
- package/dist/bootstrap/tool-trust.js.map +1 -1
- package/dist/bootstrap/validate-tool.d.ts.map +1 -1
- package/dist/bootstrap/validate-tool.js +63 -6
- package/dist/bootstrap/validate-tool.js.map +1 -1
- package/dist/cli-context.js +0 -1
- package/dist/cli-context.js.map +1 -1
- package/dist/commands/agent-catalog.d.ts.map +1 -1
- package/dist/commands/agent-catalog.js +14 -5
- package/dist/commands/agent-catalog.js.map +1 -1
- package/dist/commands/assemble-outcome.d.ts +2 -1
- package/dist/commands/assemble-outcome.d.ts.map +1 -1
- package/dist/commands/assemble-outcome.js +33 -16
- package/dist/commands/assemble-outcome.js.map +1 -1
- package/dist/commands/command-scope-index.d.ts +1 -1
- package/dist/commands/command-scope-index.js +2 -2
- package/dist/commands/command-scope-index.js.map +1 -1
- package/dist/commands/completion.d.ts +7 -33
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +76 -69
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/history.d.ts +3 -6
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +7 -12
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/host-command-specs.d.ts +6 -30
- package/dist/commands/host-command-specs.d.ts.map +1 -1
- package/dist/commands/host-command-specs.js +10 -33
- package/dist/commands/host-command-specs.js.map +1 -1
- package/dist/commands/host-subcommand-groups.d.ts +8 -72
- package/dist/commands/host-subcommand-groups.d.ts.map +1 -1
- package/dist/commands/host-subcommand-groups.js +9 -400
- package/dist/commands/host-subcommand-groups.js.map +1 -1
- package/dist/commands/host-subcommand-plugins.d.ts +20 -0
- package/dist/commands/host-subcommand-plugins.d.ts.map +1 -0
- package/dist/commands/host-subcommand-plugins.js +116 -0
- package/dist/commands/host-subcommand-plugins.js.map +1 -0
- package/dist/commands/host-subcommand-sessions.d.ts +8 -0
- package/dist/commands/host-subcommand-sessions.d.ts.map +1 -0
- package/dist/commands/host-subcommand-sessions.js +201 -0
- package/dist/commands/host-subcommand-sessions.js.map +1 -0
- package/dist/commands/host-subcommand-shared.d.ts +20 -0
- package/dist/commands/host-subcommand-shared.d.ts.map +1 -0
- package/dist/commands/host-subcommand-shared.js +15 -0
- package/dist/commands/host-subcommand-shared.js.map +1 -0
- package/dist/commands/init/file-classifier.d.ts.map +1 -1
- package/dist/commands/init/file-classifier.js +0 -1
- package/dist/commands/init/file-classifier.js.map +1 -1
- package/dist/commands/init/state-machine.d.ts.map +1 -1
- package/dist/commands/init/state-machine.js +0 -1
- package/dist/commands/init/state-machine.js.map +1 -1
- package/dist/commands/plugin/host-dir.d.ts.map +1 -1
- package/dist/commands/plugin/host-dir.js +0 -1
- package/dist/commands/plugin/host-dir.js.map +1 -1
- package/dist/commands/plugin-host-ops.d.ts.map +1 -1
- package/dist/commands/plugin-host-ops.js +0 -1
- package/dist/commands/plugin-host-ops.js.map +1 -1
- package/dist/commands/plugin.d.ts.map +1 -1
- package/dist/commands/plugin.js +0 -1
- package/dist/commands/plugin.js.map +1 -1
- package/dist/commands/session-show.d.ts +3 -1
- package/dist/commands/session-show.d.ts.map +1 -1
- package/dist/commands/session-show.js +23 -9
- package/dist/commands/session-show.js.map +1 -1
- package/dist/commands/shared.d.ts +3 -1
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/tools/doctor.d.ts +7 -0
- package/dist/commands/tools/doctor.d.ts.map +1 -0
- package/dist/commands/tools/doctor.js +12 -0
- package/dist/commands/tools/doctor.js.map +1 -0
- package/dist/commands/tools/index.d.ts.map +1 -1
- package/dist/commands/tools/index.js +58 -8
- package/dist/commands/tools/index.js.map +1 -1
- package/dist/commands/uninstall/targets.d.ts.map +1 -1
- package/dist/commands/uninstall/targets.js +0 -1
- package/dist/commands/uninstall/targets.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/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/open-report.d.ts.map +1 -1
- package/dist/open-report.js +0 -1
- package/dist/open-report.js.map +1 -1
- package/dist/report-compose.d.ts.map +1 -1
- package/dist/report-compose.js +0 -2
- package/dist/report-compose.js.map +1 -1
- package/dist/session-replay-registry.js +0 -1
- package/dist/session-replay-registry.js.map +1 -1
- package/dist/telemetry/sdk-init.d.ts.map +1 -1
- package/dist/telemetry/sdk-init.js +1 -1
- package/dist/telemetry/sdk-init.js.map +1 -1
- package/dist/ui/render-diagnostic.d.ts +20 -0
- package/dist/ui/render-diagnostic.d.ts.map +1 -0
- package/dist/ui/render-diagnostic.js +22 -0
- package/dist/ui/render-diagnostic.js.map +1 -0
- package/dist/ui/result-to-view.d.ts.map +1 -1
- package/dist/ui/result-to-view.js +13 -102
- package/dist/ui/result-to-view.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 +46 -5
- package/dist/ui/views/tools-views.js.map +1 -1
- package/dist/update-notifier.d.ts.map +1 -1
- package/dist/update-notifier.js +0 -1
- package/dist/update-notifier.js.map +1 -1
- package/dist/update-state.d.ts.map +1 -1
- package/dist/update-state.js +0 -1
- package/dist/update-state.js.map +1 -1
- package/package.json +33 -32
|
@@ -1,4 +1,3 @@
|
|
|
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
1
|
/**
|
|
3
2
|
* host-subcommand-groups — the action-less Commander subcommand GROUPS
|
|
4
3
|
* (`sessions`, `tools`) and their leaf {@link CommandSpec}s, PLUS the
|
|
@@ -14,394 +13,14 @@
|
|
|
14
13
|
* leaves + inventory here (a module that imports NEITHER `completion.ts` nor
|
|
15
14
|
* `host-command-specs.ts`) lets both depend on this leaf module without a cycle.
|
|
16
15
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `command-surface-parity` guardrail's allow-list, see {@link HOST_SUBCOMMAND_GROUPS}).
|
|
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 …`.
|
|
16
|
+
* Leaf specs are split across `host-subcommand-sessions.ts` and
|
|
17
|
+
* `host-subcommand-plugins.ts` to stay under the file-length-limit; this module
|
|
18
|
+
* remains the cycle-free assembly + inventory surface.
|
|
28
19
|
*/
|
|
29
|
-
import {
|
|
30
|
-
import { currentScope, defineCommand, registeredToolShortIds, } from '@opensip-cli/core';
|
|
31
|
-
import { executeClear } from './clear.js';
|
|
32
|
-
import { showHistory } from './history.js';
|
|
33
|
-
import { mountCommandSpec } from './mount-command-spec.js';
|
|
34
|
-
import { pluginAdd, pluginList, pluginRemove, pluginSync } from './plugin.js';
|
|
35
|
-
import { executeSessionShow } from './session-show.js';
|
|
20
|
+
import { buildSessionsGroupLeaves } from './host-subcommand-sessions.js';
|
|
36
21
|
import { buildToolsGroupLeaves } from './tools/index.js';
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const PROJECT_SCOPE = 'project';
|
|
40
|
-
/** The `command-result` output mode, named once (the leaves all share it). */
|
|
41
|
-
const COMMAND_RESULT = 'command-result';
|
|
42
|
-
const RAW_STREAM = 'raw-stream';
|
|
43
|
-
/** Prefer the discovered project root; fall back to literal cwd; finally process.cwd(). */
|
|
44
|
-
export function effectiveCwd(opts) {
|
|
45
|
-
return opts.projectContext?.projectRoot ?? opts.cwd ?? process.cwd();
|
|
46
|
-
}
|
|
47
|
-
// ---------------------------------------------------------------------------
|
|
48
|
-
// sessions list / purge
|
|
49
|
-
// ---------------------------------------------------------------------------
|
|
50
|
-
/**
|
|
51
|
-
* Validate a user-supplied `--tool` filter against the live tool registry (M3).
|
|
52
|
-
*
|
|
53
|
-
* The session/persistence discriminant is the OPEN `ToolShortId`, so a
|
|
54
|
-
* registered third-party tool's id is a legitimate filter — the former static
|
|
55
|
-
* `choices: ['fit','graph','sim']` Commander enum re-closed that set and denied
|
|
56
|
-
* third-party tools session-list parity. Membership is therefore validated at
|
|
57
|
-
* RUNTIME against the per-run `ToolRegistry` (always entered for host commands)
|
|
58
|
-
* rather than a compile-time enum. Returns `undefined` (valid) or an error
|
|
59
|
-
* detail the caller emits.
|
|
60
|
-
*/
|
|
61
|
-
function validateToolFilter(tool) {
|
|
62
|
-
if (tool === undefined)
|
|
63
|
-
return undefined;
|
|
64
|
-
const registry = currentScope()?.tools;
|
|
65
|
-
// No registry (isolated tests): fall back to accepting any non-empty id — the
|
|
66
|
-
// datastore simply returns rows for that discriminant (empty when none).
|
|
67
|
-
if (registry === undefined)
|
|
68
|
-
return undefined;
|
|
69
|
-
// Membership against the registry's session short ids (the set the
|
|
70
|
-
// `isRegisteredToolId` guard reads); used directly here so the unknown-id
|
|
71
|
-
// branch keeps `tool` typed as the original string for the message below.
|
|
72
|
-
const known = registeredToolShortIds(registry);
|
|
73
|
-
if (known.has(tool))
|
|
74
|
-
return undefined;
|
|
75
|
-
const knownList = [...known].sort();
|
|
76
|
-
return {
|
|
77
|
-
code: 'unknown-tool',
|
|
78
|
-
message: `unknown tool '${tool}'` +
|
|
79
|
-
(knownList.length > 0 ? `; registered tools: ${knownList.join(', ')}` : ''),
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function buildSessionsListSpec(ctx) {
|
|
83
|
-
return defineCommand({
|
|
84
|
-
name: 'list',
|
|
85
|
-
description: 'List stored sessions',
|
|
86
|
-
commonFlags: ['json'],
|
|
87
|
-
options: [
|
|
88
|
-
{
|
|
89
|
-
flag: '--tool',
|
|
90
|
-
value: '<name>',
|
|
91
|
-
description: 'Filter to one tool (any registered tool id)',
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
flag: '--limit',
|
|
95
|
-
value: '<n>',
|
|
96
|
-
description: 'Maximum sessions to return',
|
|
97
|
-
parse: parsePositiveInt,
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
flag: '--summary-only',
|
|
101
|
-
description: 'Omit heavy per-session payloads (agent friendly; showCommand and lightweight summary remain). ' +
|
|
102
|
-
'Pairs well with --json for lean "menu" of historical results.',
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
scope: PROJECT_SCOPE,
|
|
106
|
-
output: COMMAND_RESULT,
|
|
107
|
-
handler: (rawOpts) => {
|
|
108
|
-
const opts = rawOpts;
|
|
109
|
-
const invalid = validateToolFilter(opts.tool);
|
|
110
|
-
if (invalid) {
|
|
111
|
-
ctx.setExitCode(EXIT_CODES.CONFIGURATION_ERROR);
|
|
112
|
-
return {
|
|
113
|
-
type: 'error',
|
|
114
|
-
message: invalid.message,
|
|
115
|
-
exitCode: EXIT_CODES.CONFIGURATION_ERROR,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
return showHistory(ctx.datastore(), {
|
|
119
|
-
tool: opts.tool,
|
|
120
|
-
limit: opts.limit,
|
|
121
|
-
summaryOnly: !!opts.summaryOnly,
|
|
122
|
-
});
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function buildSessionsShowSpec(ctx) {
|
|
127
|
-
return defineCommand({
|
|
128
|
-
name: 'show',
|
|
129
|
-
description: 'Display a stored session result',
|
|
130
|
-
commonFlags: ['json'],
|
|
131
|
-
args: [{ name: 'ref', description: 'Session id, or latest with --tool' }],
|
|
132
|
-
options: [
|
|
133
|
-
{
|
|
134
|
-
flag: '--tool',
|
|
135
|
-
value: '<name>',
|
|
136
|
-
description: 'Tool for latest, or an optional id sanity check (any registered tool id)',
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
flag: '--filter',
|
|
140
|
-
value: '<type>',
|
|
141
|
-
description: 'Filter replayed signals (repeatable): errors-only | warnings-only | top:<n>. ' +
|
|
142
|
-
'Composable, e.g. --filter errors-only --filter top:20. Agent ergonomics for historical results.',
|
|
143
|
-
arrayDefault: [],
|
|
144
|
-
parse: (val, prev) => [...prev, val],
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
flag: '--raw',
|
|
148
|
-
description: 'With --json: emit the inner payload (session + envelope + metadata) without the outer CommandResult wrapper. ' +
|
|
149
|
-
'Ideal for agents that want the smallest possible response.',
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
scope: PROJECT_SCOPE,
|
|
153
|
-
output: RAW_STREAM,
|
|
154
|
-
rawStreamReason: 'session-replay',
|
|
155
|
-
handler: async (rawOpts) => {
|
|
156
|
-
const opts = rawOpts;
|
|
157
|
-
const ref = opts._args[0];
|
|
158
|
-
const invalid = validateToolFilter(opts.tool);
|
|
159
|
-
if (invalid) {
|
|
160
|
-
if (opts.json === true) {
|
|
161
|
-
ctx.emitError({
|
|
162
|
-
message: invalid.message,
|
|
163
|
-
exitCode: EXIT_CODES.CONFIGURATION_ERROR,
|
|
164
|
-
code: invalid.code,
|
|
165
|
-
});
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
ctx.setExitCode(EXIT_CODES.CONFIGURATION_ERROR);
|
|
169
|
-
await ctx.render({
|
|
170
|
-
type: 'error',
|
|
171
|
-
message: invalid.message,
|
|
172
|
-
exitCode: EXIT_CODES.CONFIGURATION_ERROR,
|
|
173
|
-
});
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
const filters = normalizeFilterOption(opts.filter);
|
|
177
|
-
await executeSessionShow({
|
|
178
|
-
replayRegistry: ctx.sessionReplayRegistry,
|
|
179
|
-
ref,
|
|
180
|
-
tool: opts.tool,
|
|
181
|
-
json: opts.json,
|
|
182
|
-
filters,
|
|
183
|
-
raw: opts.raw,
|
|
184
|
-
render: ctx.render,
|
|
185
|
-
emitJson: ctx.emitJson,
|
|
186
|
-
emitRaw: ctx.emitRaw,
|
|
187
|
-
emitError: ctx.emitError,
|
|
188
|
-
setExitCode: ctx.setExitCode,
|
|
189
|
-
});
|
|
190
|
-
},
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Normalize the repeatable `--filter` option (Commander yields a string for one
|
|
195
|
-
* occurrence, a string[] for many, undefined for none) into a uniform
|
|
196
|
-
* `string[] | undefined` for `executeSessionShow`.
|
|
197
|
-
*/
|
|
198
|
-
function normalizeFilterOption(filter) {
|
|
199
|
-
if (Array.isArray(filter))
|
|
200
|
-
return filter;
|
|
201
|
-
if (filter)
|
|
202
|
-
return [filter];
|
|
203
|
-
return undefined;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Validating coercion for `sessions list --limit <n>`.
|
|
207
|
-
*
|
|
208
|
-
* @throws {Error} When the raw value is not a positive integer.
|
|
209
|
-
*/
|
|
210
|
-
function parsePositiveInt(raw) {
|
|
211
|
-
const n = Number.parseInt(raw, 10);
|
|
212
|
-
if (Number.isNaN(n) || n <= 0) {
|
|
213
|
-
throw new Error(`Invalid --limit value: '${raw}'. Must be a positive integer.`);
|
|
214
|
-
}
|
|
215
|
-
return n;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Validating coercion for `sessions purge --older-than <days>` — identical to
|
|
219
|
-
* the former inline argParser. A named declaration (not an inline lambda) so the
|
|
220
|
-
* `@throws` contract below is documented.
|
|
221
|
-
*
|
|
222
|
-
* @throws {Error} When the raw value is not a non-negative integer.
|
|
223
|
-
*/
|
|
224
|
-
function parseOlderThanDays(raw) {
|
|
225
|
-
const n = Number.parseInt(raw, 10);
|
|
226
|
-
if (Number.isNaN(n) || n < 0) {
|
|
227
|
-
throw new Error(`Invalid --older-than value: '${raw}'. Must be a non-negative integer.`);
|
|
228
|
-
}
|
|
229
|
-
return n;
|
|
230
|
-
}
|
|
231
|
-
function buildSessionsPurgeSpec(ctx) {
|
|
232
|
-
return defineCommand({
|
|
233
|
-
name: 'purge',
|
|
234
|
-
description: 'Delete session rows from the project-local SQLite store (opensip-cli/.runtime/datastore.sqlite)',
|
|
235
|
-
commonFlags: ['json'],
|
|
236
|
-
options: [
|
|
237
|
-
{
|
|
238
|
-
flag: '--older-than',
|
|
239
|
-
value: '<days>',
|
|
240
|
-
description: 'Only delete sessions older than N days',
|
|
241
|
-
// Pure validating coercion — identical to the former inline argParser.
|
|
242
|
-
parse: parseOlderThanDays,
|
|
243
|
-
},
|
|
244
|
-
{ flag: '-y, --yes', description: 'Skip confirmation prompt', default: false },
|
|
245
|
-
],
|
|
246
|
-
scope: PROJECT_SCOPE,
|
|
247
|
-
output: COMMAND_RESULT,
|
|
248
|
-
handler: (rawOpts) => {
|
|
249
|
-
const opts = rawOpts;
|
|
250
|
-
return executeClear({
|
|
251
|
-
olderThan: opts.olderThan,
|
|
252
|
-
yes: opts.yes,
|
|
253
|
-
datastore: ctx.datastore(),
|
|
254
|
-
});
|
|
255
|
-
},
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
// ---------------------------------------------------------------------------
|
|
259
|
-
// <tool> plugin {list,add,remove,sync} — DOMAIN-BOUND extension-pack ops
|
|
260
|
-
// ---------------------------------------------------------------------------
|
|
261
|
-
//
|
|
262
|
-
// The pack ops are mounted UNDER each pack-supporting tool primary
|
|
263
|
-
// (`opensip fit plugin …`, `opensip sim plugin …`) by `mountToolPluginGroups`,
|
|
264
|
-
// with the `domain` PRE-BOUND from that tool. There is no top-level
|
|
265
|
-
// `opensip plugin` command and no `--domain`/`--type` flag: the tool the
|
|
266
|
-
// subcommand hangs off of IS the domain. Whole Tool plugins are managed by
|
|
267
|
-
// `opensip tools …`, never here.
|
|
268
|
-
/** The shared `--cwd <path>` option for the plugin leaves. Its description is
|
|
269
|
-
* "Project root" (NOT the registry's "Target directory"), so it is declared as
|
|
270
|
-
* a per-command OptionSpec rather than the `cwd` common flag — preserving the
|
|
271
|
-
* byte-identical help text. The default resolves per-invocation (the builders
|
|
272
|
-
* run on each `registerCliCommands` call). */
|
|
273
|
-
function pluginCwdOption() {
|
|
274
|
-
return {
|
|
275
|
-
flag: '--cwd',
|
|
276
|
-
value: '<path>',
|
|
277
|
-
description: 'Project root',
|
|
278
|
-
default: process.cwd(),
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
/** The single-domain layout view passed to the pure plugin commands so a
|
|
282
|
-
* bound `<tool> plugin …` op only ever touches its own domain. Resolved from
|
|
283
|
-
* the host's contributed `pluginLayouts` (so the domain is a real layout, not
|
|
284
|
-
* an arbitrary string); falls back to a minimal layout if the tool's full
|
|
285
|
-
* layout is somehow absent. */
|
|
286
|
-
function boundLayouts(ctx, domain) {
|
|
287
|
-
const match = ctx.pluginLayouts.find((l) => l.domain === domain);
|
|
288
|
-
return match ? [match] : [{ domain, userSubdirs: [] }];
|
|
289
|
-
}
|
|
290
|
-
function buildPluginListSpec(ctx, domain) {
|
|
291
|
-
return defineCommand({
|
|
292
|
-
name: 'list',
|
|
293
|
-
description: `List installed ${domain} packs`,
|
|
294
|
-
commonFlags: ['json'],
|
|
295
|
-
options: [pluginCwdOption()],
|
|
296
|
-
scope: PROJECT_SCOPE,
|
|
297
|
-
output: COMMAND_RESULT,
|
|
298
|
-
handler: (rawOpts) => {
|
|
299
|
-
const opts = rawOpts;
|
|
300
|
-
// Per-run admitted-tool provenance is on the entered RunScope (stamped by
|
|
301
|
-
// the bootstrap); read it here and pass it into the pure `pluginList`,
|
|
302
|
-
// scoped to this tool's own domain.
|
|
303
|
-
return pluginList(effectiveCwd(opts), boundLayouts(ctx, domain), currentScope()?.toolProvenance ?? []);
|
|
304
|
-
},
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
function buildPluginAddSpec(ctx, domain) {
|
|
308
|
-
return defineCommand({
|
|
309
|
-
name: 'add',
|
|
310
|
-
description: `Install a ${domain} pack and record it in opensip-cli.config.yml`,
|
|
311
|
-
commonFlags: ['json'],
|
|
312
|
-
options: [pluginCwdOption()],
|
|
313
|
-
// Empty description: the former `.command('add <package>')` declared the
|
|
314
|
-
// positional inline with no help text, so Commander rendered no "Arguments:"
|
|
315
|
-
// block. Keeping it empty preserves the byte-identical --help.
|
|
316
|
-
args: [{ name: 'package', description: '' }],
|
|
317
|
-
scope: PROJECT_SCOPE,
|
|
318
|
-
output: COMMAND_RESULT,
|
|
319
|
-
handler: (rawOpts) => {
|
|
320
|
-
const opts = rawOpts;
|
|
321
|
-
const packageName = opts._args[0];
|
|
322
|
-
// Domain is bound from the tool primary — no `--domain` flag.
|
|
323
|
-
return pluginAdd(packageName, effectiveCwd(opts), domain, boundLayouts(ctx, domain));
|
|
324
|
-
},
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
function buildPluginRemoveSpec(ctx, domain) {
|
|
328
|
-
return defineCommand({
|
|
329
|
-
name: 'remove',
|
|
330
|
-
description: `Uninstall a ${domain} pack and remove it from opensip-cli.config.yml`,
|
|
331
|
-
commonFlags: ['json'],
|
|
332
|
-
options: [pluginCwdOption()],
|
|
333
|
-
// Empty description — see the plugin-add note above (byte-identical --help).
|
|
334
|
-
args: [{ name: 'package', description: '' }],
|
|
335
|
-
scope: PROJECT_SCOPE,
|
|
336
|
-
output: COMMAND_RESULT,
|
|
337
|
-
handler: (rawOpts) => {
|
|
338
|
-
const opts = rawOpts;
|
|
339
|
-
const packageName = opts._args[0];
|
|
340
|
-
return pluginRemove(packageName, effectiveCwd(opts), domain, boundLayouts(ctx, domain));
|
|
341
|
-
},
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
function buildPluginSyncSpec(ctx, domain) {
|
|
345
|
-
return defineCommand({
|
|
346
|
-
name: 'sync',
|
|
347
|
-
description: `Install every ${domain} pack declared in opensip-cli.config.yml (post-clone bootstrap)`,
|
|
348
|
-
commonFlags: ['json'],
|
|
349
|
-
options: [pluginCwdOption()],
|
|
350
|
-
scope: PROJECT_SCOPE,
|
|
351
|
-
output: COMMAND_RESULT,
|
|
352
|
-
handler: (rawOpts) => {
|
|
353
|
-
const opts = rawOpts;
|
|
354
|
-
return pluginSync(effectiveCwd(opts), domain, boundLayouts(ctx, domain));
|
|
355
|
-
},
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* Build the four domain-bound `plugin` leaf specs for ONE pack-supporting tool
|
|
360
|
-
* (`add`/`list`/`remove`/`sync`, all scoped to `domain`). Shared by the mount
|
|
361
|
-
* path (`mountToolPluginGroups`), the command-scope index, and the completion
|
|
362
|
-
* inventory so the three derive the SAME leaves.
|
|
363
|
-
*/
|
|
364
|
-
export function buildToolPluginLeaves(ctx, domain) {
|
|
365
|
-
return [
|
|
366
|
-
buildPluginListSpec(ctx, domain),
|
|
367
|
-
buildPluginAddSpec(ctx, domain),
|
|
368
|
-
buildPluginRemoveSpec(ctx, domain),
|
|
369
|
-
buildPluginSyncSpec(ctx, domain),
|
|
370
|
-
];
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Derive the per-tool `plugin` groups from the host's contributed
|
|
374
|
-
* `pluginLayouts` — one group per pack-supporting domain (fit/sim). A tool with
|
|
375
|
-
* no `pluginLayout` (e.g. `graph`) contributes none, so it gets no `plugin`
|
|
376
|
-
* group. The single source the mount path + scope index + completion all read.
|
|
377
|
-
*/
|
|
378
|
-
export function buildToolPluginGroups(ctx) {
|
|
379
|
-
return ctx.pluginLayouts.map((layout) => ({
|
|
380
|
-
toolVerb: layout.domain,
|
|
381
|
-
domain: layout.domain,
|
|
382
|
-
description: `Manage ${layout.domain} extension packs (add, list, remove, sync)`,
|
|
383
|
-
leaves: buildToolPluginLeaves(ctx, layout.domain),
|
|
384
|
-
}));
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Mount each per-tool `plugin` group UNDER its pack-supporting tool primary
|
|
388
|
-
* (`opensip fit plugin …`), domain pre-bound from the tool. The host derives the
|
|
389
|
-
* groups from the contributed `pluginLayouts` (fit/sim; graph has none, so no
|
|
390
|
-
* group). The tool primary must already be mounted — it is, because the
|
|
391
|
-
* composition root mounts tools before the host commands; a domain whose primary
|
|
392
|
-
* is absent (isolated host-only tests) is skipped (nowhere to hang it).
|
|
393
|
-
*/
|
|
394
|
-
export function mountToolPluginGroups(program, ctx) {
|
|
395
|
-
for (const group of buildToolPluginGroups(ctx)) {
|
|
396
|
-
const primary = program.commands.find((c) => c.name() === group.toolVerb);
|
|
397
|
-
if (primary === undefined)
|
|
398
|
-
continue; // no tool primary mounted (host-only tests)
|
|
399
|
-
const parent = primary.command('plugin').description(group.description);
|
|
400
|
-
for (const leaf of group.leaves) {
|
|
401
|
-
mountCommandSpec(parent, leaf, ctx);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
22
|
+
export { effectiveCwd } from './host-subcommand-shared.js';
|
|
23
|
+
export { buildToolPluginLeaves, buildToolPluginGroups, mountToolPluginGroups, } from './host-subcommand-plugins.js';
|
|
405
24
|
/**
|
|
406
25
|
* The action-less Commander subcommand GROUPS that legitimately cannot be a
|
|
407
26
|
* single {@link CommandSpec} — they have no action body, only sub-subcommands.
|
|
@@ -409,17 +28,13 @@ export function mountToolPluginGroups(program, ctx) {
|
|
|
409
28
|
* allow-lists as documented host exceptions. Every other host command IS a spec.
|
|
410
29
|
*/
|
|
411
30
|
export const HOST_SUBCOMMAND_GROUPS = ['sessions', 'tools'];
|
|
412
|
-
/**
|
|
413
|
-
* Build the subcommand-group parents with their leaf specs. The mounter turns
|
|
414
|
-
* each into a raw parent `program.command(name)` plus `mountCommandSpec(parent,
|
|
415
|
-
* leaf)` for each leaf.
|
|
416
|
-
*/
|
|
31
|
+
/** Build the subcommand-group parents with their leaf specs. */
|
|
417
32
|
export function buildHostSubcommandGroups(ctx) {
|
|
418
33
|
return [
|
|
419
34
|
{
|
|
420
35
|
name: 'sessions',
|
|
421
36
|
description: 'Manage session data',
|
|
422
|
-
leaves:
|
|
37
|
+
leaves: buildSessionsGroupLeaves(ctx),
|
|
423
38
|
},
|
|
424
39
|
{
|
|
425
40
|
name: 'tools',
|
|
@@ -428,12 +43,6 @@ export function buildHostSubcommandGroups(ctx) {
|
|
|
428
43
|
},
|
|
429
44
|
];
|
|
430
45
|
}
|
|
431
|
-
/**
|
|
432
|
-
* A no-op {@link CliCommandsContext} used purely to BUILD the group leaf specs
|
|
433
|
-
* so their `name` can be read for the completion-script sub-subcommand
|
|
434
|
-
* inventory. The handlers are never invoked here — we only inspect the static
|
|
435
|
-
* declarations — so the render/datastore/exit members are inert stubs.
|
|
436
|
-
*/
|
|
437
46
|
const INVENTORY_CTX = {
|
|
438
47
|
setExitCode: () => {
|
|
439
48
|
/* inert — inventory builds never dispatch a handler */
|
|
@@ -450,7 +59,7 @@ const INVENTORY_CTX = {
|
|
|
450
59
|
},
|
|
451
60
|
pluginLayouts: [],
|
|
452
61
|
toolScaffolds: [],
|
|
453
|
-
// eslint-disable-next-line unicorn/no-useless-undefined -- explicit no-store sentinel matching the `datastore` thunk contract
|
|
62
|
+
// eslint-disable-next-line unicorn/no-useless-undefined -- explicit no-store sentinel matching the `datastore` thunk contract
|
|
454
63
|
datastore: () => undefined,
|
|
455
64
|
};
|
|
456
65
|
/** Build the host subcommand-group name inventory (single source for completion). */
|
|
@@ -1 +1 @@
|
|
|
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,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,sBAAsB,GAMvB,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,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,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"}
|
|
1
|
+
{"version":3,"file":"host-subcommand-groups.js","sourceRoot":"","sources":["../../src/commands/host-subcommand-groups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAKzD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GAEtB,MAAM,8BAA8B,CAAC;AAUtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB,CAAC,UAAU,EAAE,OAAO,CAAU,CAAC;AAExF,gEAAgE;AAChE,MAAM,UAAU,yBAAyB,CAAC,GAAuB;IAC/D,OAAO;QACL;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,qBAAqB;YAClC,MAAM,EAAE,wBAAwB,CAAC,GAAG,CAAC;SACtC;QACD;YACE,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,gEAAgE;YAC7E,MAAM,EAAE,qBAAqB,CAAC,GAAG,CAAC;SACnC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,aAAa,GAAuB;IACxC,WAAW,EAAE,GAAG,EAAE;QAChB,uDAAuD;IACzD,CAAC;IACD,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,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,8HAA8H;IAC9H,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS;CAC3B,CAAC;AAMF,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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-tool `plugin` subcommand group leaf specs and mount helpers.
|
|
3
|
+
*/
|
|
4
|
+
import { type ToolRegistry } from '@opensip-cli/core';
|
|
5
|
+
import { type HostSpec } from './host-subcommand-shared.js';
|
|
6
|
+
import type { CliCommandsContext } from './shared.js';
|
|
7
|
+
import type { CliProgram } from '@opensip-cli/contracts';
|
|
8
|
+
export declare function buildToolPluginLeaves(ctx: CliCommandsContext, domain: string): readonly HostSpec[];
|
|
9
|
+
export interface ToolPluginGroup {
|
|
10
|
+
readonly parentVerb: string;
|
|
11
|
+
readonly parentAliases: readonly string[];
|
|
12
|
+
/** @deprecated Use {@link parentVerb} — kept for completion inventory compat. */
|
|
13
|
+
readonly toolVerb: string;
|
|
14
|
+
readonly domain: string;
|
|
15
|
+
readonly description: string;
|
|
16
|
+
readonly leaves: readonly HostSpec[];
|
|
17
|
+
}
|
|
18
|
+
export declare function buildToolPluginGroups(ctx: CliCommandsContext, registry?: ToolRegistry): readonly ToolPluginGroup[];
|
|
19
|
+
export declare function mountToolPluginGroups(program: CliProgram, ctx: CliCommandsContext, registry?: ToolRegistry): void;
|
|
20
|
+
//# sourceMappingURL=host-subcommand-plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-subcommand-plugins.d.ts","sourceRoot":"","sources":["../../src/commands/host-subcommand-plugins.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGL,KAAK,YAAY,EAElB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,6BAA6B,CAAC;AAIrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAyFzD,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,kBAAkB,EACvB,MAAM,EAAE,MAAM,GACb,SAAS,QAAQ,EAAE,CAOrB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC;CACtC;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,kBAAkB,EACvB,QAAQ,CAAC,EAAE,YAAY,GACtB,SAAS,eAAe,EAAE,CAgB5B;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,UAAU,EACnB,GAAG,EAAE,kBAAkB,EACvB,QAAQ,CAAC,EAAE,YAAY,GACtB,IAAI,CASN"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-tool `plugin` subcommand group leaf specs and mount helpers.
|
|
3
|
+
*/
|
|
4
|
+
import { currentScope, } from '@opensip-cli/core';
|
|
5
|
+
import { COMMAND_RESULT, defineCommand, effectiveCwd, PROJECT_SCOPE, } from './host-subcommand-shared.js';
|
|
6
|
+
import { mountCommandSpec } from './mount-command-spec.js';
|
|
7
|
+
import { pluginAdd, pluginList, pluginRemove, pluginSync } from './plugin.js';
|
|
8
|
+
function pluginCwdOption() {
|
|
9
|
+
return {
|
|
10
|
+
flag: '--cwd',
|
|
11
|
+
value: '<path>',
|
|
12
|
+
description: 'Project root',
|
|
13
|
+
default: process.cwd(),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function boundLayouts(ctx, domain) {
|
|
17
|
+
const match = ctx.pluginLayouts.find((l) => l.domain === domain);
|
|
18
|
+
return match ? [match] : [{ domain, userSubdirs: [] }];
|
|
19
|
+
}
|
|
20
|
+
function buildPluginListSpec(ctx, domain) {
|
|
21
|
+
return defineCommand({
|
|
22
|
+
name: 'list',
|
|
23
|
+
description: `List installed ${domain} packs`,
|
|
24
|
+
commonFlags: ['json'],
|
|
25
|
+
options: [pluginCwdOption()],
|
|
26
|
+
scope: PROJECT_SCOPE,
|
|
27
|
+
output: COMMAND_RESULT,
|
|
28
|
+
handler: (rawOpts) => {
|
|
29
|
+
const opts = rawOpts;
|
|
30
|
+
return pluginList(effectiveCwd(opts), boundLayouts(ctx, domain), currentScope()?.toolProvenance ?? []);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function buildPluginAddSpec(ctx, domain) {
|
|
35
|
+
return defineCommand({
|
|
36
|
+
name: 'add',
|
|
37
|
+
description: `Install a ${domain} pack and record it in opensip-cli.config.yml`,
|
|
38
|
+
commonFlags: ['json'],
|
|
39
|
+
options: [pluginCwdOption()],
|
|
40
|
+
args: [{ name: 'package', description: '' }],
|
|
41
|
+
scope: PROJECT_SCOPE,
|
|
42
|
+
output: COMMAND_RESULT,
|
|
43
|
+
handler: (rawOpts) => {
|
|
44
|
+
const opts = rawOpts;
|
|
45
|
+
const packageName = opts._args[0];
|
|
46
|
+
return pluginAdd(packageName, effectiveCwd(opts), domain, boundLayouts(ctx, domain));
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function buildPluginRemoveSpec(ctx, domain) {
|
|
51
|
+
return defineCommand({
|
|
52
|
+
name: 'remove',
|
|
53
|
+
description: `Uninstall a ${domain} pack and remove it from opensip-cli.config.yml`,
|
|
54
|
+
commonFlags: ['json'],
|
|
55
|
+
options: [pluginCwdOption()],
|
|
56
|
+
args: [{ name: 'package', description: '' }],
|
|
57
|
+
scope: PROJECT_SCOPE,
|
|
58
|
+
output: COMMAND_RESULT,
|
|
59
|
+
handler: (rawOpts) => {
|
|
60
|
+
const opts = rawOpts;
|
|
61
|
+
const packageName = opts._args[0];
|
|
62
|
+
return pluginRemove(packageName, effectiveCwd(opts), domain, boundLayouts(ctx, domain));
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function buildPluginSyncSpec(ctx, domain) {
|
|
67
|
+
return defineCommand({
|
|
68
|
+
name: 'sync',
|
|
69
|
+
description: `Install every ${domain} pack declared in opensip-cli.config.yml (post-clone bootstrap)`,
|
|
70
|
+
commonFlags: ['json'],
|
|
71
|
+
options: [pluginCwdOption()],
|
|
72
|
+
scope: PROJECT_SCOPE,
|
|
73
|
+
output: COMMAND_RESULT,
|
|
74
|
+
handler: (rawOpts) => {
|
|
75
|
+
const opts = rawOpts;
|
|
76
|
+
return pluginSync(effectiveCwd(opts), domain, boundLayouts(ctx, domain));
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export function buildToolPluginLeaves(ctx, domain) {
|
|
81
|
+
return [
|
|
82
|
+
buildPluginListSpec(ctx, domain),
|
|
83
|
+
buildPluginAddSpec(ctx, domain),
|
|
84
|
+
buildPluginRemoveSpec(ctx, domain),
|
|
85
|
+
buildPluginSyncSpec(ctx, domain),
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
export function buildToolPluginGroups(ctx, registry) {
|
|
89
|
+
return ctx.pluginLayouts.map((layout) => {
|
|
90
|
+
const tool = registry
|
|
91
|
+
?.list()
|
|
92
|
+
.find((candidate) => candidate.pluginLayout?.domain === layout.domain);
|
|
93
|
+
const parentVerb = tool?.metadata.name ?? layout.domain;
|
|
94
|
+
const parentAliases = tool?.identity.aliases ?? [];
|
|
95
|
+
return {
|
|
96
|
+
parentVerb,
|
|
97
|
+
parentAliases,
|
|
98
|
+
toolVerb: parentVerb,
|
|
99
|
+
domain: layout.domain,
|
|
100
|
+
description: `Manage ${layout.domain} extension packs (add, list, remove, sync)`,
|
|
101
|
+
leaves: buildToolPluginLeaves(ctx, layout.domain),
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export function mountToolPluginGroups(program, ctx, registry) {
|
|
106
|
+
for (const group of buildToolPluginGroups(ctx, registry)) {
|
|
107
|
+
const primary = program.commands.find((c) => c.name() === group.parentVerb);
|
|
108
|
+
if (primary === undefined)
|
|
109
|
+
continue;
|
|
110
|
+
const parent = primary.command('plugin').description(group.description);
|
|
111
|
+
for (const leaf of group.leaves) {
|
|
112
|
+
mountCommandSpec(parent, leaf, ctx);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=host-subcommand-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-subcommand-plugins.js","sourceRoot":"","sources":["../../src/commands/host-subcommand-plugins.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,YAAY,GAIb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,GAEd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAK9E,SAAS,eA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qB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC;SAClD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,OAAmB,EACnB,GAAuB,EACvB,QAAuB;IAEvB,KAAK,MAAM,KAAK,IAAI,qBAAqB,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC;QACzD,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,UAAU,CAAC,CAAC;QAC5E,IAAI,OAAO,KAAK,SAAS;YAAE,SAAS;QACpC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACxE,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAChC,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sessions` subcommand group leaf specs (list / show / purge).
|
|
3
|
+
*/
|
|
4
|
+
import { type HostSpec } from './host-subcommand-shared.js';
|
|
5
|
+
import type { CliCommandsContext } from './shared.js';
|
|
6
|
+
/** Build the three `sessions` group leaf specs. */
|
|
7
|
+
export declare function buildSessionsGroupLeaves(ctx: CliCommandsContext): readonly HostSpec[];
|
|
8
|
+
//# sourceMappingURL=host-subcommand-sessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-subcommand-sessions.d.ts","sourceRoot":"","sources":["../../src/commands/host-subcommand-sessions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA+MtD,mDAAmD;AACnD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,kBAAkB,GAAG,SAAS,QAAQ,EAAE,CAErF"}
|