opensip-cli 0.1.9 → 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-fork-core.d.ts.map +1 -1
- package/dist/bootstrap/dispatch-fork-core.js +9 -15
- package/dist/bootstrap/dispatch-fork-core.js.map +1 -1
- 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
|
@@ -51,7 +51,12 @@ export function kindFromResult(value) {
|
|
|
51
51
|
* and the gate verdict is read from `.envelope.verdict`, not the outer status.
|
|
52
52
|
*/
|
|
53
53
|
export function outcomeFromEnvelope(envelope, exitCode) {
|
|
54
|
-
return withDiagnostics({
|
|
54
|
+
return withDiagnostics({
|
|
55
|
+
kind: kindFromEnvelope(envelope),
|
|
56
|
+
status: 'ok',
|
|
57
|
+
exitCode,
|
|
58
|
+
envelope,
|
|
59
|
+
});
|
|
55
60
|
}
|
|
56
61
|
/**
|
|
57
62
|
* Wrap a `CommandResult` (or a bare JSON document) as `.data`. An `ErrorResult`
|
|
@@ -62,15 +67,14 @@ export function outcomeFromEnvelope(envelope, exitCode) {
|
|
|
62
67
|
export function outcomeFromResult(value, exitCode) {
|
|
63
68
|
if (value?.type === 'error') {
|
|
64
69
|
const err = value;
|
|
65
|
-
return withDiagnostics(
|
|
66
|
-
kind: 'error',
|
|
67
|
-
status: 'error',
|
|
68
|
-
exitCode: err.exitCode,
|
|
69
|
-
data: value,
|
|
70
|
-
errors: [{ message: err.message, ...(err.suggestion ? { suggestion: err.suggestion } : {}) }],
|
|
71
|
-
});
|
|
70
|
+
return withDiagnostics(errorOutcomeFromDetail(err, err.exitCode, value));
|
|
72
71
|
}
|
|
73
|
-
return withDiagnostics({
|
|
72
|
+
return withDiagnostics({
|
|
73
|
+
kind: kindFromResult(value),
|
|
74
|
+
status: 'ok',
|
|
75
|
+
exitCode,
|
|
76
|
+
data: value,
|
|
77
|
+
});
|
|
74
78
|
}
|
|
75
79
|
/**
|
|
76
80
|
* Build a `status:'error'` outcome from a thrown error — the host's error
|
|
@@ -105,17 +109,30 @@ export function outcomeFromError(error, opts = {}) {
|
|
|
105
109
|
* `emitJson({ error })` shape) rather than a thrown error to map.
|
|
106
110
|
*/
|
|
107
111
|
export function outcomeFromErrorMessage(opts) {
|
|
108
|
-
return withDiagnostics({
|
|
109
|
-
|
|
110
|
-
status: 'error',
|
|
112
|
+
return withDiagnostics(errorOutcomeFromDetail({
|
|
113
|
+
message: opts.message,
|
|
111
114
|
exitCode: opts.exitCode,
|
|
115
|
+
...(opts.suggestion === undefined ? {} : { suggestion: opts.suggestion }),
|
|
116
|
+
...(opts.code === undefined ? {} : { code: opts.code }),
|
|
117
|
+
...(opts.diagnostic === undefined ? {} : { diagnostic: opts.diagnostic }),
|
|
118
|
+
}, opts.exitCode, undefined, opts.kind));
|
|
119
|
+
}
|
|
120
|
+
function errorOutcomeFromDetail(detail, exitCode, data, kind = 'command.error') {
|
|
121
|
+
const commandError = detail.diagnostic;
|
|
122
|
+
return {
|
|
123
|
+
kind,
|
|
124
|
+
status: 'error',
|
|
125
|
+
exitCode,
|
|
126
|
+
...(data === undefined ? {} : { data }),
|
|
127
|
+
...(commandError === undefined ? {} : { commandError }),
|
|
112
128
|
errors: [
|
|
113
129
|
{
|
|
114
|
-
message:
|
|
115
|
-
...(
|
|
116
|
-
...(
|
|
130
|
+
message: detail.message,
|
|
131
|
+
...(detail.suggestion === undefined ? {} : { suggestion: detail.suggestion }),
|
|
132
|
+
...(detail.code === undefined ? {} : { code: detail.code }),
|
|
133
|
+
...(commandError === undefined ? {} : { diagnostic: commandError }),
|
|
117
134
|
},
|
|
118
135
|
],
|
|
119
|
-
}
|
|
136
|
+
};
|
|
120
137
|
}
|
|
121
138
|
//# sourceMappingURL=assemble-outcome.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assemble-outcome.js","sourceRoot":"","sources":["../../src/commands/assemble-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"assemble-outcome.js","sourceRoot":"","sources":["../../src/commands/assemble-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,sBAAsB,GAMvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE5D;;;;;;GAMG;AACH,SAAS,eAAe,CAAC,OAAuB;IAC9C,MAAM,WAAW,GAAG,YAAY,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;IAC5D,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IAC9C,OAAO,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,CAAC;AACrC,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,gBAAgB,CAAC,QAAwB;IACvD,OAAO,GAAG,QAAQ,CAAC,IAAI,MAAM,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,MAAM,IAAI,GAAI,KAA4C,EAAE,IAAI,CAAC;IACjE,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAwB,EAAE,QAAgB;IAC5E,OAAO,eAAe,CAAC;QACrB,IAAI,EAAE,gBAAgB,CAAC,QAAQ,CAAC;QAChC,MAAM,EAAE,IAAI;QACZ,QAAQ;QACR,QAAQ;KACT,CAAC,CAAC;AACL,C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AE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;gBAC7E,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC3D,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;aACpE;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -30,7 +30,7 @@ export interface CommandScopeIndexInput {
|
|
|
30
30
|
/**
|
|
31
31
|
* The DOMAIN-BOUND per-tool `plugin` groups (mounted under each pack-supporting
|
|
32
32
|
* tool primary, e.g. `opensip fit plugin list`). Each leaf keys under
|
|
33
|
-
* `${
|
|
33
|
+
* `${parentVerb} plugin ${leaf}` so `commandPath` resolves the doubly-nested path.
|
|
34
34
|
* Optional so callers without tools (isolated tests) can omit it.
|
|
35
35
|
*/
|
|
36
36
|
readonly toolPluginGroups?: readonly ToolPluginGroup[];
|
|
@@ -24,10 +24,10 @@ export function buildCommandScopeIndex(input) {
|
|
|
24
24
|
group.leaves.forEach((leaf) => addSpec(index, group.name, leaf));
|
|
25
25
|
});
|
|
26
26
|
// Per-tool `plugin` group leaves key under the doubly-nested
|
|
27
|
-
// `${
|
|
27
|
+
// `${parentVerb} plugin ${leaf}` path (e.g. `fit plugin list`), matching what
|
|
28
28
|
// `commandPath` resolves for the mounted `opensip fit plugin list`.
|
|
29
29
|
(input.toolPluginGroups ?? []).forEach((group) => {
|
|
30
|
-
group.leaves.forEach((leaf) => addSpec(index, `${group.
|
|
30
|
+
group.leaves.forEach((leaf) => addSpec(index, `${group.parentVerb} plugin`, leaf));
|
|
31
31
|
});
|
|
32
32
|
return index;
|
|
33
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-scope-index.js","sourceRoot":"","sources":["../../src/commands/command-scope-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkCH,SAAS,OAAO,CACd,KAA2C,EAC3C,UAA8B,EAC9B,IAAsB;IAEtB,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;IACnD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,KAAK,CAAC,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,IAAI,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAA6B;IAClE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAmC,CAAC;IAEzD,mEAAmE;IACnE,+DAA+D;IAC/D,6EAA6E;IAC7E,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IACrE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACnE,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACjC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IACH,6DAA6D;IAC7D,
|
|
1
|
+
{"version":3,"file":"command-scope-index.js","sourceRoot":"","sources":["../../src/commands/command-scope-index.ts"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,EAAE;QAC/C,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,UAAU,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,aAAsB;IAChD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,MAAM,GAAmB,aAAa,CAAC;IAC3C,OAAO,MAAM,KAAK,IAAI,EAAE,CAAC;QACvB,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAC3B,OAAO,CAAC,OAAO,EAAE,CAAC;IAClB,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -23,34 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { type CommonFlagKey } from '@opensip-cli/contracts';
|
|
25
25
|
export type Shell = 'bash' | 'zsh' | 'fish';
|
|
26
|
-
/**
|
|
27
|
-
* Internal/machine-facing command names never offered in shell completion.
|
|
28
|
-
* These are spawned by the host (sharded build, off-process engine workers,
|
|
29
|
-
* machine exports), never typed by a user.
|
|
30
|
-
*
|
|
31
|
-
* This is the STATIC FALLBACK / default for {@link assembleCompletionInventory}'s
|
|
32
|
-
* `internalCommands` argument. The live path passes a descriptor-driven set
|
|
33
|
-
* (`visibility: 'internal'` + this fallback), keeping the runtime filter in
|
|
34
|
-
* lockstep with the `--help` hide pass. The set still backs the completion-drift
|
|
35
|
-
* test, and matters whenever a caller does not supply the descriptor-derived set.
|
|
36
|
-
*
|
|
37
|
-
* Note: the four `*-run-worker` / `*-shard-worker` names AND
|
|
38
|
-
* `graph-equivalence-check` are the Tier-3 `visibility: 'internal'` commands —
|
|
39
|
-
* they also flow through the descriptor-driven set. They are listed here so the
|
|
40
|
-
* static fallback is correct on its own (the historical gap was the missing
|
|
41
|
-
* `graph-equivalence-check`).
|
|
42
|
-
*/
|
|
43
|
-
/**
|
|
44
|
-
* Internal/machine-facing command names never offered in shell completion — the
|
|
45
|
-
* `visibility: 'internal'` Tier-3 commands: `*-run-worker` / `*-shard-worker` and
|
|
46
|
-
* `graph-equivalence-check` are machine-only IPC/CI bootstrap entry points
|
|
47
|
-
* (ADR-0028), revealed by `OPENSIP_CLI_SHOW_INTERNAL=1`.
|
|
48
|
-
*
|
|
49
|
-
* The legacy flat-root export aliases (`catalog-export` / `sarif-export` /
|
|
50
|
-
* `graph-baseline-export` / `fit-baseline-export`) were removed entirely, so they
|
|
51
|
-
* no longer appear in the tool registry and need no completion suppression — the
|
|
52
|
-
* canonical nested `<tool> export` forms are the only export surface.
|
|
53
|
-
*/
|
|
26
|
+
/** Internal/machine-facing commands excluded from shell completion (host-spawned workers). */
|
|
54
27
|
export declare const INTERNAL_COMMANDS: ReadonlySet<string>;
|
|
55
28
|
/**
|
|
56
29
|
* The derived completion surface, assembled from the live `CommandSpec`s by
|
|
@@ -66,7 +39,7 @@ export interface CompletionInventory {
|
|
|
66
39
|
/**
|
|
67
40
|
* Sub-subcommand names for the action-less groups (`sessions`, `tools`), the
|
|
68
41
|
* `<tool> <verb>` grammar (`fit export`…), and the per-tool `plugin` groups
|
|
69
|
-
* (`fit plugin`, keyed under `${
|
|
42
|
+
* (`fit plugin`, keyed under `${parentVerb} plugin`).
|
|
70
43
|
*/
|
|
71
44
|
readonly groupSubcommands: Readonly<Record<string, readonly string[]>>;
|
|
72
45
|
}
|
|
@@ -95,13 +68,14 @@ export interface GroupLike {
|
|
|
95
68
|
}[];
|
|
96
69
|
}
|
|
97
70
|
/**
|
|
98
|
-
* One pack-supporting tool's `plugin` group, keyed by the
|
|
71
|
+
* One pack-supporting tool's `plugin` group, keyed by the primary verb it mounts
|
|
99
72
|
* under (`fit`/`sim`). The `plugin` parent is offered as a leaf under that verb
|
|
100
73
|
* (`opensip fit <TAB>` ⇒ `… plugin`), and the `add|list|remove|sync` leaves are
|
|
101
|
-
* registered under the `${
|
|
74
|
+
* registered under the `${parentVerb} plugin` path for deeper completion.
|
|
102
75
|
*/
|
|
103
76
|
export interface ToolPluginGroupLike {
|
|
104
|
-
readonly
|
|
77
|
+
readonly parentVerb: string;
|
|
78
|
+
readonly parentAliases?: readonly string[];
|
|
105
79
|
readonly leaves: readonly {
|
|
106
80
|
readonly name: string;
|
|
107
81
|
}[];
|
|
@@ -140,7 +114,7 @@ export declare function assembleCompletionInventory(input: {
|
|
|
140
114
|
/**
|
|
141
115
|
* The DOMAIN-BOUND per-tool `plugin` groups (mounted under each pack-supporting
|
|
142
116
|
* tool primary). Folded into the group map so completion offers `plugin` under
|
|
143
|
-
* the tool verb and `add|list|remove|sync` under `${
|
|
117
|
+
* the tool verb and `add|list|remove|sync` under `${parentVerb} plugin`. Optional
|
|
144
118
|
* so callers without tools omit it.
|
|
145
119
|
*/
|
|
146
120
|
readonly toolPluginGroups?: readonly ToolPluginGroupLike[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEzE,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,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;IAC3C,QAAQ,CAAC,MAAM,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACvD;AA0BD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGjE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,MAAM,EAAE,CAQ/D;AAuFD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC3D,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACjD,GAAG,mBAAmB,CAoCtB;AA4HD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,mBAAmB,GAAG,MAAM,CAY1F;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,mBAAmB,EAC9B,KAAK,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAqC,GAC1D,IAAI,CAEN"}
|
|
@@ -22,42 +22,13 @@
|
|
|
22
22
|
* that can query `opensip fit --list` at completion time.
|
|
23
23
|
*/
|
|
24
24
|
import { commonFlags } from '@opensip-cli/contracts';
|
|
25
|
-
/**
|
|
26
|
-
* Internal/machine-facing command names never offered in shell completion.
|
|
27
|
-
* These are spawned by the host (sharded build, off-process engine workers,
|
|
28
|
-
* machine exports), never typed by a user.
|
|
29
|
-
*
|
|
30
|
-
* This is the STATIC FALLBACK / default for {@link assembleCompletionInventory}'s
|
|
31
|
-
* `internalCommands` argument. The live path passes a descriptor-driven set
|
|
32
|
-
* (`visibility: 'internal'` + this fallback), keeping the runtime filter in
|
|
33
|
-
* lockstep with the `--help` hide pass. The set still backs the completion-drift
|
|
34
|
-
* test, and matters whenever a caller does not supply the descriptor-derived set.
|
|
35
|
-
*
|
|
36
|
-
* Note: the four `*-run-worker` / `*-shard-worker` names AND
|
|
37
|
-
* `graph-equivalence-check` are the Tier-3 `visibility: 'internal'` commands —
|
|
38
|
-
* they also flow through the descriptor-driven set. They are listed here so the
|
|
39
|
-
* static fallback is correct on its own (the historical gap was the missing
|
|
40
|
-
* `graph-equivalence-check`).
|
|
41
|
-
*/
|
|
42
|
-
/**
|
|
43
|
-
* Internal/machine-facing command names never offered in shell completion — the
|
|
44
|
-
* `visibility: 'internal'` Tier-3 commands: `*-run-worker` / `*-shard-worker` and
|
|
45
|
-
* `graph-equivalence-check` are machine-only IPC/CI bootstrap entry points
|
|
46
|
-
* (ADR-0028), revealed by `OPENSIP_CLI_SHOW_INTERNAL=1`.
|
|
47
|
-
*
|
|
48
|
-
* The legacy flat-root export aliases (`catalog-export` / `sarif-export` /
|
|
49
|
-
* `graph-baseline-export` / `fit-baseline-export`) were removed entirely, so they
|
|
50
|
-
* no longer appear in the tool registry and need no completion suppression — the
|
|
51
|
-
* canonical nested `<tool> export` forms are the only export surface.
|
|
52
|
-
*/
|
|
25
|
+
/** Internal/machine-facing commands excluded from shell completion (host-spawned workers). */
|
|
53
26
|
export const INTERNAL_COMMANDS = new Set([
|
|
54
27
|
'graph-shard-worker',
|
|
55
28
|
'graph-equivalence-check',
|
|
56
29
|
'fit-run-worker',
|
|
57
30
|
'sim-run-worker',
|
|
58
31
|
'graph-run-worker',
|
|
59
|
-
// ADR-0054 M4-E: the host-owned dispatch worker subcommand (forked by the
|
|
60
|
-
// supervisor; never a public surface).
|
|
61
32
|
'__tool-command-worker',
|
|
62
33
|
]);
|
|
63
34
|
/** Long `--flag` form of each registry spec (short alias + arg placeholder
|
|
@@ -104,6 +75,64 @@ export function specLongFlags(spec) {
|
|
|
104
75
|
.filter((f) => f !== undefined);
|
|
105
76
|
return [...new Set([...common, ...opts, '--help'])];
|
|
106
77
|
}
|
|
78
|
+
function addFlatSpec(spec, flags, acc) {
|
|
79
|
+
const primaryAliases = spec.aliases ?? [];
|
|
80
|
+
if (primaryAliases.length > 0) {
|
|
81
|
+
acc.parentAliases[spec.name] = primaryAliases;
|
|
82
|
+
}
|
|
83
|
+
for (const name of [spec.name, ...primaryAliases]) {
|
|
84
|
+
acc.subcommands.push(name);
|
|
85
|
+
acc.commandFlags[name] = flags;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function addNestedSpec(spec, flags, acc) {
|
|
89
|
+
if (spec.parent === undefined)
|
|
90
|
+
return;
|
|
91
|
+
const leaves = (acc.toolGroupLeaves[spec.parent] ??= []);
|
|
92
|
+
for (const name of [spec.name, ...(spec.aliases ?? [])]) {
|
|
93
|
+
leaves.push(name);
|
|
94
|
+
acc.commandFlags[`${spec.parent} ${name}`] = flags;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function addSpecToInventory(spec, internalCommands, acc) {
|
|
98
|
+
if (internalCommands.has(spec.name))
|
|
99
|
+
return;
|
|
100
|
+
const flags = specLongFlags(spec);
|
|
101
|
+
if (spec.parent !== undefined) {
|
|
102
|
+
addNestedSpec(spec, flags, acc);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
addFlatSpec(spec, flags, acc);
|
|
106
|
+
}
|
|
107
|
+
function addGroupedCommands(groups, subcommands, groupSubcommands) {
|
|
108
|
+
for (const group of groups) {
|
|
109
|
+
subcommands.push(group.name);
|
|
110
|
+
groupSubcommands[group.name] = group.leaves.map((l) => l.name);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function foldToolLeaves(toolGroupLeaves, parentAliases, commandFlags, groupSubcommands) {
|
|
114
|
+
for (const [parent, leaves] of Object.entries(toolGroupLeaves)) {
|
|
115
|
+
groupSubcommands[parent] = [...(groupSubcommands[parent] ?? []), ...leaves];
|
|
116
|
+
for (const alias of parentAliases[parent] ?? []) {
|
|
117
|
+
groupSubcommands[alias] = [...(groupSubcommands[alias] ?? []), ...leaves];
|
|
118
|
+
for (const leaf of leaves) {
|
|
119
|
+
const parentFlags = commandFlags[`${parent} ${leaf}`];
|
|
120
|
+
if (parentFlags !== undefined) {
|
|
121
|
+
commandFlags[`${alias} ${leaf}`] = parentFlags;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function foldToolPluginGroups(toolPluginGroups, groupSubcommands) {
|
|
128
|
+
for (const group of toolPluginGroups ?? []) {
|
|
129
|
+
const pluginParents = [group.parentVerb, ...(group.parentAliases ?? [])];
|
|
130
|
+
for (const parent of pluginParents) {
|
|
131
|
+
groupSubcommands[parent] = [...(groupSubcommands[parent] ?? []), 'plugin'];
|
|
132
|
+
groupSubcommands[`${parent} plugin`] = group.leaves.map((l) => l.name);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
107
136
|
/**
|
|
108
137
|
* Assemble the completion inventory from the live specs. Pure: callers pass
|
|
109
138
|
* the tool command specs (from the populated `ToolRegistry`), the top-level
|
|
@@ -120,56 +149,34 @@ export function specLongFlags(spec) {
|
|
|
120
149
|
*/
|
|
121
150
|
export function assembleCompletionInventory(input) {
|
|
122
151
|
const internalCommands = input.internalCommands ?? INTERNAL_COMMANDS;
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
152
|
+
const acc = {
|
|
153
|
+
commandFlags: {},
|
|
154
|
+
subcommands: [],
|
|
155
|
+
// `parent` → leaf names, accumulated from `parent`-nested tool specs (the
|
|
156
|
+
// `<tool> <verb>` grammar). Merged into `groupSubcommands` below so the
|
|
157
|
+
// emitted script offers `<parent> <leaf>` exactly like a host group.
|
|
158
|
+
toolGroupLeaves: {},
|
|
159
|
+
parentAliases: {},
|
|
160
|
+
};
|
|
129
161
|
for (const spec of [...input.toolSpecs, ...input.hostSpecs]) {
|
|
130
|
-
|
|
131
|
-
continue;
|
|
132
|
-
const flags = specLongFlags(spec);
|
|
133
|
-
// A `parent`-nested tool spec is a sub-subcommand, NOT a top-level command:
|
|
134
|
-
// offer it as a leaf under its parent and key its flags under the qualified
|
|
135
|
-
// `${parent} ${name}` path (mirroring the host group leaves).
|
|
136
|
-
if (spec.parent !== undefined) {
|
|
137
|
-
const leaves = (toolGroupLeaves[spec.parent] ??= []);
|
|
138
|
-
for (const name of [spec.name, ...(spec.aliases ?? [])]) {
|
|
139
|
-
leaves.push(name);
|
|
140
|
-
commandFlags[`${spec.parent} ${name}`] = flags;
|
|
141
|
-
}
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
for (const name of [spec.name, ...(spec.aliases ?? [])]) {
|
|
145
|
-
subcommands.push(name);
|
|
146
|
-
commandFlags[name] = flags;
|
|
147
|
-
}
|
|
162
|
+
addSpecToInventory(spec, internalCommands, acc);
|
|
148
163
|
}
|
|
149
164
|
const groupSubcommands = {};
|
|
150
|
-
|
|
151
|
-
subcommands.push(group.name);
|
|
152
|
-
groupSubcommands[group.name] = group.leaves.map((l) => l.name);
|
|
153
|
-
}
|
|
165
|
+
addGroupedCommands(input.groups, acc.subcommands, groupSubcommands);
|
|
154
166
|
// Fold tool-command sub-subcommands into the group map. A primary verb
|
|
155
167
|
// (e.g. `graph`) is already a top-level subcommand with its own flags; adding
|
|
156
168
|
// its nested leaves here lets the script also complete `graph export` etc.
|
|
157
|
-
|
|
158
|
-
groupSubcommands[parent] = [...(groupSubcommands[parent] ?? []), ...leaves];
|
|
159
|
-
}
|
|
169
|
+
foldToolLeaves(acc.toolGroupLeaves, acc.parentAliases, acc.commandFlags, groupSubcommands);
|
|
160
170
|
// Fold the per-tool `plugin` groups in: `plugin` becomes a completable leaf
|
|
161
171
|
// under the tool verb (`opensip fit <TAB>` ⇒ `… plugin`), and the bound
|
|
162
|
-
// leaf names register under the doubly-nested `${
|
|
172
|
+
// leaf names register under the doubly-nested `${parentVerb} plugin` key for
|
|
163
173
|
// deeper completion. There is NO top-level `plugin` group anymore.
|
|
164
|
-
|
|
165
|
-
groupSubcommands[group.toolVerb] = [...(groupSubcommands[group.toolVerb] ?? []), 'plugin'];
|
|
166
|
-
groupSubcommands[`${group.toolVerb} plugin`] = group.leaves.map((l) => l.name);
|
|
167
|
-
}
|
|
174
|
+
foldToolPluginGroups(input.toolPluginGroups, groupSubcommands);
|
|
168
175
|
// `help` is a Commander built-in the script also surfaces.
|
|
169
|
-
subcommands.push('help');
|
|
176
|
+
acc.subcommands.push('help');
|
|
170
177
|
return {
|
|
171
|
-
subcommands: [...new Set(subcommands)].sort(),
|
|
172
|
-
commandFlags,
|
|
178
|
+
subcommands: [...new Set(acc.subcommands)].sort(),
|
|
179
|
+
commandFlags: acc.commandFlags,
|
|
173
180
|
groupSubcommands,
|
|
174
181
|
};
|
|
175
182
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,WAAW,EAAsB,MAAM,wBAAwB,CAAC;AAIzE
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,WAAW,EAAsB,MAAM,wBAAwB,CAAC;AAIzE,8FAA8F;AAC9F,MAAM,CAAC,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC;IAC5D,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;IAClB,uBAAuB;CACxB,CAAC,CAAC;AAuD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CAAC;YAAE,SAAS,CAAC,+CAA+C;QACjF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CACR,uDAAuD,IAAI,SAAS,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAC/F,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACjC,CAAC;AAED,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E,MAAM,UAAU,qBAAqB,CAAC,KAAY,EAAE,SAA8B;IAChF,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC;QACD,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC;QAC9B,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAY,EACZ,SAA8B,EAC9B,QAA6B,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAE3D,KAAK,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* history command — show run history.
|
|
3
|
-
*
|
|
4
|
-
* Backed by SessionRepo over the project-local SQLite DataStore.
|
|
5
|
-
* The CLI bootstrap opens the DataStore in `preAction`; this command
|
|
6
|
-
* receives the constructed repo from its caller.
|
|
7
3
|
*/
|
|
8
4
|
import type { HistoryResult } from '@opensip-cli/contracts';
|
|
9
|
-
import type { ToolShortId } from '@opensip-cli/core';
|
|
5
|
+
import type { ToolRegistry, ToolShortId } from '@opensip-cli/core';
|
|
10
6
|
import type { DataStore } from '@opensip-cli/datastore';
|
|
11
7
|
export interface ShowHistoryOptions {
|
|
12
8
|
readonly tool?: ToolShortId;
|
|
13
9
|
readonly limit?: number;
|
|
14
|
-
/** Agent ergonomics: drop the heavy per-session payload (keep showCommand + lightweight summary). */
|
|
15
10
|
readonly summaryOnly?: boolean;
|
|
11
|
+
/** When set, session list displays canonical tool names. */
|
|
12
|
+
readonly registry?: ToolRegistry;
|
|
16
13
|
}
|
|
17
14
|
export declare function showHistory(datastore: DataStore, opts?: ShowHistoryOptions): HistoryResult;
|
|
18
15
|
//# sourceMappingURL=history.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAiC,MAAM,wBAAwB,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,GAAE,kBAAuB,GAAG,aAAa,CAS9F"}
|
package/dist/commands/history.js
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* history command — show run history.
|
|
3
|
-
*
|
|
4
|
-
* Backed by SessionRepo over the project-local SQLite DataStore.
|
|
5
|
-
* The CLI bootstrap opens the DataStore in `preAction`; this command
|
|
6
|
-
* receives the constructed repo from its caller.
|
|
7
3
|
*/
|
|
4
|
+
import { buildToolIdentityIndex } from '@opensip-cli/core';
|
|
8
5
|
import { SessionRepo } from '@opensip-cli/session-store';
|
|
9
6
|
export function showHistory(datastore, opts = {}) {
|
|
10
7
|
const repo = new SessionRepo(datastore);
|
|
11
|
-
const
|
|
8
|
+
const identityIndex = opts.registry === undefined ? undefined : buildToolIdentityIndex(opts.registry);
|
|
9
|
+
const sessions = repo.list(opts).map((s) => toHistorySession(s, opts.summaryOnly, identityIndex));
|
|
12
10
|
return {
|
|
13
11
|
type: 'history',
|
|
14
12
|
sessions,
|
|
15
13
|
};
|
|
16
14
|
}
|
|
17
|
-
function toHistorySession(session, summaryOnly = false) {
|
|
15
|
+
function toHistorySession(session, summaryOnly = false, identityIndex) {
|
|
18
16
|
const summary = sessionSummary(session.payload);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// remain. `payload` is `readonly?`, so we omit it by spreading `rest` (without
|
|
22
|
-
// payload) and adding `payload` back only when NOT summary-only — no mutation /
|
|
23
|
-
// delete (which would need an `any` cast to bypass readonly).
|
|
24
|
-
const { payload, ...rest } = session;
|
|
17
|
+
const { payload, tool, ...rest } = session;
|
|
18
|
+
const displayTool = identityIndex === undefined ? tool : identityIndex.canonicalForStoredTool(tool);
|
|
25
19
|
return {
|
|
26
20
|
...rest,
|
|
21
|
+
tool: displayTool,
|
|
27
22
|
...(summaryOnly ? {} : { payload }),
|
|
28
23
|
...(summary === undefined ? {} : { summary }),
|
|
29
24
|
showCommand: `opensip sessions show ${session.id} --json`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"history.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CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;QAC7C,WAAW,EAAE,yBAAyB,OAAO,CAAC,EAAE,SAAS;KAC1D,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,OAAgB;IACtC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACtE,MAAM,OAAO,GAAI,OAAiC,CAAC,OAAO,CAAC;IAC3D,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACtE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAkC,CAAC;IACvF,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,QAAQ,KAAK,QAAQ,EAC5B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* host-command-specs —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `Tool.commandSpecs` and aren't discovered. Mounting them via the same
|
|
9
|
-
* `mountCommandSpec` means the Phase 7 `command-surface-parity` guardrail sees
|
|
10
|
-
* ONE uniform command surface: no second, more-privileged raw-Commander path for
|
|
11
|
-
* "blessed" CLI-owned commands. The pack-management `plugin {add,list,remove,
|
|
12
|
-
* sync}` ops are host-owned too, but mount UNDER each pack-supporting tool
|
|
13
|
-
* primary (`opensip fit plugin …`) via {@link mountToolPluginGroups} — there is
|
|
14
|
-
* no top-level `opensip plugin`.
|
|
15
|
-
*
|
|
16
|
-
* Each spec's handler closes over the per-invocation {@link CliCommandsContext}
|
|
17
|
-
* (render / setExitCode / datastore thunk / pluginLayouts). The mount layer only
|
|
18
|
-
* reaches for `render` / `setExitCode` (the `command-result` + thrown-`ToolError`
|
|
19
|
-
* arms) — the `signal-envelope` / `live-view` arms are never exercised by a host
|
|
20
|
-
* command, so `CliCommandsContext` is a valid (leaner) `CommandMountContext`.
|
|
21
|
-
*
|
|
22
|
-
* The action-less subcommand GROUPS (`sessions`, `tools`) + the domain-bound
|
|
23
|
-
* per-tool `plugin` group leaves (and {@link mountToolPluginGroups}) live in
|
|
24
|
-
* `host-subcommand-groups.ts` (a leaf module that lets `completion.ts` source its
|
|
25
|
-
* sub-subcommand names without a cycle). This module assembles the TOP-LEVEL
|
|
26
|
-
* specs and mounts the whole surface.
|
|
27
|
-
*
|
|
28
|
-
* Specs are built per-invocation (in the builders below, not at module load) so
|
|
29
|
-
* the `--cwd` defaults that resolve to `process.cwd()` are evaluated fresh each
|
|
30
|
-
* run — byte-identical to the former `.option(spec, desc, process.cwd())`
|
|
31
|
-
* registrars.
|
|
2
|
+
* host-command-specs — CLI-owned commands as declarative {@link CommandSpec}s,
|
|
3
|
+
* mounted via the same `mountCommandSpec` plane as tools (Phase 6/7 parity).
|
|
4
|
+
* Host commands (`init`, `configure`, `sessions`, `report`, `completion`,
|
|
5
|
+
* `uninstall`, `tools`) are not tool plugins. Action-less groups and per-tool
|
|
6
|
+
* `plugin` leaves live in `host-subcommand-groups.ts`; this module assembles
|
|
7
|
+
* top-level specs. Built per-invocation so `--cwd` defaults stay fresh.
|
|
32
8
|
*/
|
|
33
9
|
import { type HostSpec } from './host-subcommand-groups.js';
|
|
34
10
|
import type { CliCommandsContext } from './shared.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-command-specs.d.ts","sourceRoot":"","sources":["../../src/commands/host-command-specs.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"host-command-specs.d.ts","sourceRoot":"","sources":["../../src/commands/host-command-specs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAmBH,OAAO,EAIL,KAAK,QAAQ,EACd,MAAM,6BAA6B,CAAC;AAMrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,wBAAwB,CAAC;AAiUtE;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,kBAAkB,GAAG,SAAS,QAAQ,EAAE,CAanF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,kBAAkB,GAAG,IAAI,CAWpF"}
|
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* host-command-specs —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `Tool.commandSpecs` and aren't discovered. Mounting them via the same
|
|
9
|
-
* `mountCommandSpec` means the Phase 7 `command-surface-parity` guardrail sees
|
|
10
|
-
* ONE uniform command surface: no second, more-privileged raw-Commander path for
|
|
11
|
-
* "blessed" CLI-owned commands. The pack-management `plugin {add,list,remove,
|
|
12
|
-
* sync}` ops are host-owned too, but mount UNDER each pack-supporting tool
|
|
13
|
-
* primary (`opensip fit plugin …`) via {@link mountToolPluginGroups} — there is
|
|
14
|
-
* no top-level `opensip plugin`.
|
|
15
|
-
*
|
|
16
|
-
* Each spec's handler closes over the per-invocation {@link CliCommandsContext}
|
|
17
|
-
* (render / setExitCode / datastore thunk / pluginLayouts). The mount layer only
|
|
18
|
-
* reaches for `render` / `setExitCode` (the `command-result` + thrown-`ToolError`
|
|
19
|
-
* arms) — the `signal-envelope` / `live-view` arms are never exercised by a host
|
|
20
|
-
* command, so `CliCommandsContext` is a valid (leaner) `CommandMountContext`.
|
|
21
|
-
*
|
|
22
|
-
* The action-less subcommand GROUPS (`sessions`, `tools`) + the domain-bound
|
|
23
|
-
* per-tool `plugin` group leaves (and {@link mountToolPluginGroups}) live in
|
|
24
|
-
* `host-subcommand-groups.ts` (a leaf module that lets `completion.ts` source its
|
|
25
|
-
* sub-subcommand names without a cycle). This module assembles the TOP-LEVEL
|
|
26
|
-
* specs and mounts the whole surface.
|
|
27
|
-
*
|
|
28
|
-
* Specs are built per-invocation (in the builders below, not at module load) so
|
|
29
|
-
* the `--cwd` defaults that resolve to `process.cwd()` are evaluated fresh each
|
|
30
|
-
* run — byte-identical to the former `.option(spec, desc, process.cwd())`
|
|
31
|
-
* registrars.
|
|
2
|
+
* host-command-specs — CLI-owned commands as declarative {@link CommandSpec}s,
|
|
3
|
+
* mounted via the same `mountCommandSpec` plane as tools (Phase 6/7 parity).
|
|
4
|
+
* Host commands (`init`, `configure`, `sessions`, `report`, `completion`,
|
|
5
|
+
* `uninstall`, `tools`) are not tool plugins. Action-less groups and per-tool
|
|
6
|
+
* `plugin` leaves live in `host-subcommand-groups.ts`; this module assembles
|
|
7
|
+
* top-level specs. Built per-invocation so `--cwd` defaults stay fresh.
|
|
32
8
|
*/
|
|
33
9
|
import { EXIT_CODES } from '@opensip-cli/contracts';
|
|
34
10
|
import { ConfigurationError, defineCommand } from '@opensip-cli/core';
|
|
@@ -306,8 +282,9 @@ function buildHostCompletionSurface(ctx) {
|
|
|
306
282
|
return {
|
|
307
283
|
specs: [...buildNonCompletionHostSpecs(ctx), COMPLETION_SELF_SPEC],
|
|
308
284
|
groups: buildHostSubcommandGroups(ctx),
|
|
309
|
-
toolPluginGroups: buildToolPluginGroups(ctx).map((g) => ({
|
|
310
|
-
|
|
285
|
+
toolPluginGroups: buildToolPluginGroups(ctx, ctx.tools).map((g) => ({
|
|
286
|
+
parentVerb: g.parentVerb,
|
|
287
|
+
parentAliases: g.parentAliases,
|
|
311
288
|
leaves: g.leaves.map((l) => ({ name: l.name })),
|
|
312
289
|
})),
|
|
313
290
|
};
|
|
@@ -352,6 +329,6 @@ export function mountHostCommands(program, ctx) {
|
|
|
352
329
|
mountCommandSpec(parent, leaf, ctx);
|
|
353
330
|
}
|
|
354
331
|
}
|
|
355
|
-
mountToolPluginGroups(program, ctx);
|
|
332
|
+
mountToolPluginGroups(program, ctx, ctx.tools);
|
|
356
333
|
}
|
|
357
334
|
//# sourceMappingURL=host-command-specs.js.map
|