opensip-cli 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap/admit-tool-package.d.ts +15 -1
- package/dist/bootstrap/admit-tool-package.d.ts.map +1 -1
- package/dist/bootstrap/admit-tool-package.js +30 -5
- package/dist/bootstrap/admit-tool-package.js.map +1 -1
- package/dist/bootstrap/bind-tool-context.d.ts.map +1 -1
- package/dist/bootstrap/bind-tool-context.js +5 -3
- package/dist/bootstrap/bind-tool-context.js.map +1 -1
- package/dist/bootstrap/build-command-registration-input.d.ts +7 -0
- package/dist/bootstrap/build-command-registration-input.d.ts.map +1 -1
- package/dist/bootstrap/build-command-registration-input.js +11 -4
- package/dist/bootstrap/build-command-registration-input.js.map +1 -1
- package/dist/bootstrap/build-per-run-scope.d.ts +12 -0
- package/dist/bootstrap/build-per-run-scope.d.ts.map +1 -1
- package/dist/bootstrap/build-per-run-scope.js +84 -9
- package/dist/bootstrap/build-per-run-scope.js.map +1 -1
- package/dist/bootstrap/bundled-manifest.d.ts +5 -0
- package/dist/bootstrap/bundled-manifest.d.ts.map +1 -0
- package/dist/bootstrap/bundled-manifest.js +13 -0
- package/dist/bootstrap/bundled-manifest.js.map +1 -0
- package/dist/bootstrap/bundled-tools.manifest.json +19 -1
- package/dist/bootstrap/config-and-capabilities.d.ts +5 -3
- package/dist/bootstrap/config-and-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/config-and-capabilities.js +10 -7
- package/dist/bootstrap/config-and-capabilities.js.map +1 -1
- package/dist/bootstrap/constants.d.ts +3 -0
- package/dist/bootstrap/constants.d.ts.map +1 -0
- package/dist/bootstrap/constants.js +3 -0
- package/dist/bootstrap/constants.js.map +1 -0
- package/dist/bootstrap/decorate-tool-primary.d.ts +50 -0
- package/dist/bootstrap/decorate-tool-primary.d.ts.map +1 -0
- package/dist/bootstrap/decorate-tool-primary.js +111 -0
- package/dist/bootstrap/decorate-tool-primary.js.map +1 -0
- package/dist/bootstrap/execute-post-bailout-bootstrap.d.ts +1 -0
- package/dist/bootstrap/execute-post-bailout-bootstrap.d.ts.map +1 -1
- package/dist/bootstrap/execute-post-bailout-bootstrap.js +12 -1
- package/dist/bootstrap/execute-post-bailout-bootstrap.js.map +1 -1
- package/dist/bootstrap/index.d.ts +1 -1
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +1 -4
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/bootstrap/io-plane.d.ts +47 -0
- package/dist/bootstrap/io-plane.d.ts.map +1 -0
- package/dist/bootstrap/io-plane.js +73 -0
- package/dist/bootstrap/io-plane.js.map +1 -0
- package/dist/bootstrap/load-tool-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/load-tool-capabilities.js +18 -2
- package/dist/bootstrap/load-tool-capabilities.js.map +1 -1
- package/dist/bootstrap/owning-tool-init.d.ts.map +1 -1
- package/dist/bootstrap/owning-tool-init.js +7 -4
- package/dist/bootstrap/owning-tool-init.js.map +1 -1
- package/dist/bootstrap/phase-map.d.ts +20 -0
- package/dist/bootstrap/phase-map.d.ts.map +1 -0
- package/dist/bootstrap/phase-map.js +108 -0
- package/dist/bootstrap/phase-map.js.map +1 -0
- package/dist/bootstrap/plan-pre-action-bootstrap.d.ts +5 -5
- package/dist/bootstrap/plan-pre-action-bootstrap.d.ts.map +1 -1
- package/dist/bootstrap/plan-pre-action-bootstrap.js +3 -19
- package/dist/bootstrap/plan-pre-action-bootstrap.js.map +1 -1
- package/dist/bootstrap/pre-action-guards.d.ts +2 -1
- package/dist/bootstrap/pre-action-guards.d.ts.map +1 -1
- package/dist/bootstrap/pre-action-guards.js +3 -27
- package/dist/bootstrap/pre-action-guards.js.map +1 -1
- package/dist/bootstrap/pre-action-hook.d.ts +2 -1
- package/dist/bootstrap/pre-action-hook.d.ts.map +1 -1
- package/dist/bootstrap/pre-action-hook.js +23 -4
- package/dist/bootstrap/pre-action-hook.js.map +1 -1
- package/dist/bootstrap/register-tools-discovery.d.ts +38 -39
- package/dist/bootstrap/register-tools-discovery.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-discovery.js +134 -85
- package/dist/bootstrap/register-tools-discovery.js.map +1 -1
- package/dist/bootstrap/register-tools-mount.d.ts +18 -1
- package/dist/bootstrap/register-tools-mount.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-mount.js +118 -18
- package/dist/bootstrap/register-tools-mount.js.map +1 -1
- package/dist/bootstrap/register-tools.d.ts +58 -14
- package/dist/bootstrap/register-tools.d.ts.map +1 -1
- package/dist/bootstrap/register-tools.js +185 -14
- package/dist/bootstrap/register-tools.js.map +1 -1
- package/dist/bootstrap/root-version.d.ts +26 -0
- package/dist/bootstrap/root-version.d.ts.map +1 -0
- package/dist/bootstrap/root-version.js +36 -0
- package/dist/bootstrap/root-version.js.map +1 -0
- package/dist/bootstrap/scope-access.d.ts +11 -0
- package/dist/bootstrap/scope-access.d.ts.map +1 -1
- package/dist/bootstrap/scope-access.js +26 -0
- package/dist/bootstrap/scope-access.js.map +1 -1
- package/dist/bootstrap/tool-lifecycle.d.ts +0 -22
- package/dist/bootstrap/tool-lifecycle.d.ts.map +1 -1
- package/dist/bootstrap/tool-lifecycle.js +0 -23
- package/dist/bootstrap/tool-lifecycle.js.map +1 -1
- package/dist/bootstrap/validate-tool.d.ts +10 -4
- package/dist/bootstrap/validate-tool.d.ts.map +1 -1
- package/dist/bootstrap/validate-tool.js +76 -22
- package/dist/bootstrap/validate-tool.js.map +1 -1
- package/dist/cli-context.d.ts +2 -2
- package/dist/cli-context.d.ts.map +1 -1
- package/dist/cli-context.js +20 -35
- package/dist/cli-context.js.map +1 -1
- package/dist/commands/agent-catalog.d.ts +29 -0
- package/dist/commands/agent-catalog.d.ts.map +1 -1
- package/dist/commands/agent-catalog.js +77 -36
- package/dist/commands/agent-catalog.js.map +1 -1
- package/dist/commands/clear.d.ts.map +1 -1
- package/dist/commands/clear.js +0 -1
- package/dist/commands/clear.js.map +1 -1
- package/dist/commands/command-scope-index.d.ts +45 -0
- package/dist/commands/command-scope-index.d.ts.map +1 -0
- package/dist/commands/command-scope-index.js +51 -0
- package/dist/commands/command-scope-index.js.map +1 -0
- package/dist/commands/completion.d.ts +67 -6
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +84 -12
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/configure.d.ts.map +1 -1
- package/dist/commands/configure.js +0 -1
- package/dist/commands/configure.js.map +1 -1
- package/dist/commands/host-command-specs.d.ts +16 -9
- package/dist/commands/host-command-specs.d.ts.map +1 -1
- package/dist/commands/host-command-specs.js +47 -21
- package/dist/commands/host-command-specs.js.map +1 -1
- package/dist/commands/host-config-flag.d.ts +21 -0
- package/dist/commands/host-config-flag.d.ts.map +1 -0
- package/dist/commands/host-config-flag.js +21 -0
- package/dist/commands/host-config-flag.js.map +1 -0
- package/dist/commands/host-subcommand-groups.d.ts +46 -5
- package/dist/commands/host-subcommand-groups.d.ts.map +1 -1
- package/dist/commands/host-subcommand-groups.js +97 -65
- package/dist/commands/host-subcommand-groups.js.map +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/internal-command-visibility.d.ts +42 -0
- package/dist/commands/internal-command-visibility.d.ts.map +1 -0
- package/dist/commands/internal-command-visibility.js +54 -0
- package/dist/commands/internal-command-visibility.js.map +1 -0
- package/dist/commands/mount-command-action.d.ts +24 -0
- package/dist/commands/mount-command-action.d.ts.map +1 -0
- package/dist/commands/mount-command-action.js +78 -0
- package/dist/commands/mount-command-action.js.map +1 -0
- package/dist/commands/mount-command-spec-wiring.d.ts +24 -0
- package/dist/commands/mount-command-spec-wiring.d.ts.map +1 -0
- package/dist/commands/mount-command-spec-wiring.js +71 -0
- package/dist/commands/mount-command-spec-wiring.js.map +1 -0
- package/dist/commands/mount-command-spec.d.ts +9 -2
- package/dist/commands/mount-command-spec.d.ts.map +1 -1
- package/dist/commands/mount-command-spec.js +11 -135
- package/dist/commands/mount-command-spec.js.map +1 -1
- package/dist/commands/plugin/domain-resolution.d.ts +12 -13
- package/dist/commands/plugin/domain-resolution.d.ts.map +1 -1
- package/dist/commands/plugin/domain-resolution.js +12 -58
- package/dist/commands/plugin/domain-resolution.js.map +1 -1
- package/dist/commands/plugin/host-dir.d.ts +0 -1
- package/dist/commands/plugin/host-dir.d.ts.map +1 -1
- package/dist/commands/plugin/host-dir.js +1 -1
- package/dist/commands/plugin/host-dir.js.map +1 -1
- package/dist/commands/plugin.d.ts +20 -14
- package/dist/commands/plugin.d.ts.map +1 -1
- package/dist/commands/plugin.js +39 -47
- package/dist/commands/plugin.js.map +1 -1
- package/dist/commands/render-outcome.d.ts.map +1 -1
- package/dist/commands/render-outcome.js.map +1 -1
- package/dist/commands/shared.d.ts +9 -0
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/tools/create.d.ts +11 -0
- package/dist/commands/tools/create.d.ts.map +1 -0
- package/dist/commands/tools/create.js +84 -0
- package/dist/commands/tools/create.js.map +1 -0
- package/dist/commands/tools/index.d.ts.map +1 -1
- package/dist/commands/tools/index.js +31 -0
- package/dist/commands/tools/index.js.map +1 -1
- package/dist/commands/tools/runtime-probe-entry.d.ts.map +1 -1
- package/dist/commands/tools/runtime-probe-entry.js +4 -2
- package/dist/commands/tools/runtime-probe-entry.js.map +1 -1
- package/dist/commands/tools/validate.d.ts.map +1 -1
- package/dist/commands/tools/validate.js +12 -5
- package/dist/commands/tools/validate.js.map +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +0 -1
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/env/host-env-specs.d.ts +18 -0
- package/dist/env/host-env-specs.d.ts.map +1 -1
- package/dist/env/host-env-specs.js +36 -2
- package/dist/env/host-env-specs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -21
- package/dist/index.js.map +1 -1
- package/dist/report-compose.d.ts.map +1 -1
- package/dist/report-compose.js +2 -2
- package/dist/report-compose.js.map +1 -1
- package/dist/session-replay-registry.d.ts +1 -1
- package/dist/session-replay-registry.d.ts.map +1 -1
- package/dist/session-replay-registry.js +3 -1
- package/dist/session-replay-registry.js.map +1 -1
- package/dist/ui/result-to-view.d.ts +27 -7
- package/dist/ui/result-to-view.d.ts.map +1 -1
- package/dist/ui/result-to-view.js +68 -75
- package/dist/ui/result-to-view.js.map +1 -1
- package/dist/ui/views/misc-views.d.ts.map +1 -1
- package/dist/ui/views/misc-views.js +3 -1
- package/dist/ui/views/misc-views.js.map +1 -1
- package/dist/ui/views/tools-views.d.ts +2 -1
- package/dist/ui/views/tools-views.d.ts.map +1 -1
- package/dist/ui/views/tools-views.js +21 -0
- package/dist/ui/views/tools-views.js.map +1 -1
- package/package.json +32 -32
- package/dist/bootstrap/authored-tool-admission.d.ts +0 -23
- package/dist/bootstrap/authored-tool-admission.d.ts.map +0 -1
- package/dist/bootstrap/authored-tool-admission.js +0 -54
- package/dist/bootstrap/authored-tool-admission.js.map +0 -1
- package/dist/bootstrap/egress-plane.d.ts +0 -22
- package/dist/bootstrap/egress-plane.d.ts.map +0 -1
- package/dist/bootstrap/egress-plane.js +0 -37
- package/dist/bootstrap/egress-plane.js.map +0 -1
- package/dist/bootstrap/installed-tool-admission.d.ts +0 -20
- package/dist/bootstrap/installed-tool-admission.d.ts.map +0 -1
- package/dist/bootstrap/installed-tool-admission.js +0 -60
- package/dist/bootstrap/installed-tool-admission.js.map +0 -1
- package/dist/bootstrap/live-plane.d.ts +0 -51
- package/dist/bootstrap/live-plane.d.ts.map +0 -1
- package/dist/bootstrap/live-plane.js +0 -72
- package/dist/bootstrap/live-plane.js.map +0 -1
- package/dist/bootstrap/register-tools-bundled.d.ts +0 -28
- package/dist/bootstrap/register-tools-bundled.d.ts.map +0 -1
- package/dist/bootstrap/register-tools-bundled.js +0 -107
- package/dist/bootstrap/register-tools-bundled.js.map +0 -1
- package/dist/bootstrap/register-tools-shared.d.ts +0 -40
- package/dist/bootstrap/register-tools-shared.d.ts.map +0 -1
- package/dist/bootstrap/register-tools-shared.js +0 -98
- package/dist/bootstrap/register-tools-shared.js.map +0 -1
package/dist/cli-context.js
CHANGED
|
@@ -18,15 +18,12 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { logger as defaultLogger, } from '@opensip-cli/core';
|
|
20
20
|
import { buildBaselineSeams } from './bootstrap/baseline-seams.js';
|
|
21
|
-
import { createEgressPlane } from './bootstrap/egress-plane.js';
|
|
22
21
|
import { buildHostPlanes } from './bootstrap/host-planes.js';
|
|
23
|
-
import {
|
|
22
|
+
import { createIoPlane } from './bootstrap/io-plane.js';
|
|
24
23
|
import { createOutputPlane } from './bootstrap/output-plane.js';
|
|
25
24
|
import { createRunActionHooks, createRunPlaneFactory, createRunSessionSeam, } from './bootstrap/run-plane.js';
|
|
26
|
-
import {
|
|
25
|
+
import { createDatastoreResolver, readScope } from './bootstrap/scope-access.js';
|
|
27
26
|
import { buildStateSeams } from './bootstrap/state-seams.js';
|
|
28
|
-
/** Structured-log `module` tag for this composition-root module. */
|
|
29
|
-
const MODULE_TAG = 'cli:context';
|
|
30
27
|
// ---------------------------------------------------------------------------
|
|
31
28
|
// No module-global bootstrap-handoff bag.
|
|
32
29
|
//
|
|
@@ -40,11 +37,11 @@ const MODULE_TAG = 'cli:context';
|
|
|
40
37
|
// `currentScope()?.toolProvenance` / `?.toolManifests`.
|
|
41
38
|
// ---------------------------------------------------------------------------
|
|
42
39
|
// Per-run scope + datastore readers live in `bootstrap/scope-access.ts`; the
|
|
43
|
-
// live-view registry lives in `bootstrap/
|
|
40
|
+
// live-view registry lives in `bootstrap/io-plane.ts`. Both are re-exported
|
|
44
41
|
// here so existing importers (`main()` + the dynamic-import tests) keep their
|
|
45
42
|
// stable `cli-context.js` entry point while this module focuses on assembly.
|
|
46
43
|
export { buildDatastoreThunk, getCurrentProjectRoot, getOrOpenDatastore, } from './bootstrap/scope-access.js';
|
|
47
|
-
export { createLiveViewRegistry } from './bootstrap/
|
|
44
|
+
export { createLiveViewRegistry } from './bootstrap/io-plane.js';
|
|
48
45
|
export function buildToolCliContext(opts) {
|
|
49
46
|
const log = opts.logger ?? defaultLogger;
|
|
50
47
|
// Output plane owns the single `process.exitCode` write path + the four
|
|
@@ -56,34 +53,16 @@ export function buildToolCliContext(opts) {
|
|
|
56
53
|
// - durable per-tool keyed JSON state (ADR-0042);
|
|
57
54
|
// - governance / entitlements / audit (H1-H3);
|
|
58
55
|
// - effectful egress (cloud sync + `--report-to` + SARIF file sink).
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
56
|
+
const projectDatastore = createDatastoreResolver('project-seam', log);
|
|
57
|
+
const baselineSeams = buildBaselineSeams({ getDatastore: projectDatastore, logger: log });
|
|
58
|
+
const stateSeams = buildStateSeams({ getDatastore: projectDatastore });
|
|
59
|
+
const hostPlanes = buildHostPlanes({ getDatastore: projectDatastore, logger: log });
|
|
63
60
|
// Host run-lifecycle plane (host-owned-run-timing Phase 1). The FACTORY holds
|
|
64
61
|
// stable deps only — it must NOT start a lifecycle here. The lifecycle is
|
|
65
62
|
// created inside the command action (mount-command-spec calls `beginRun()`
|
|
66
63
|
// after RunScope entry, before the handler) or lazily on first `timing` read.
|
|
67
64
|
const runPlane = createRunPlaneFactory({
|
|
68
|
-
|
|
69
|
-
// global access). Returns undefined when no project/datastore is in scope.
|
|
70
|
-
getDatastore: () => {
|
|
71
|
-
try {
|
|
72
|
-
const thunk = readScope().datastore;
|
|
73
|
-
return thunk ? thunk() : undefined;
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
// @swallow-ok no entered scope / no datastore in scope is normal for
|
|
77
|
-
// non-project commands and tests; degrade to "no datastore" (the run
|
|
78
|
-
// plane then no-ops). Debug-log for diagnosability.
|
|
79
|
-
log.debug?.({
|
|
80
|
-
evt: 'cli.context.datastore_unavailable',
|
|
81
|
-
module: MODULE_TAG,
|
|
82
|
-
error: error instanceof Error ? error.message : String(error),
|
|
83
|
-
});
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
},
|
|
65
|
+
getDatastore: createDatastoreResolver('best-effort', log),
|
|
87
66
|
logger: log,
|
|
88
67
|
});
|
|
89
68
|
// Public run seam (display-only timing) + internal action hooks (the mount
|
|
@@ -95,7 +74,13 @@ export function buildToolCliContext(opts) {
|
|
|
95
74
|
// Live plane binds the per-invocation registry (built in `main()`) to the run
|
|
96
75
|
// plane so `renderLive` owns the live run lifecycle: it times the TTY
|
|
97
76
|
// occupancy and persists the renderer's returned `session` contribution.
|
|
98
|
-
const
|
|
77
|
+
const ioPlane = createIoPlane({
|
|
78
|
+
setExitCode: outputPlane.setExitCode,
|
|
79
|
+
logger: log,
|
|
80
|
+
liveViews: opts.liveViews,
|
|
81
|
+
runPlane,
|
|
82
|
+
runSession,
|
|
83
|
+
});
|
|
99
84
|
const ctx = {
|
|
100
85
|
get scope() {
|
|
101
86
|
// The pre-action-hook (or explicit runWithScope in tests) enters the
|
|
@@ -105,14 +90,14 @@ export function buildToolCliContext(opts) {
|
|
|
105
90
|
return readScope();
|
|
106
91
|
},
|
|
107
92
|
render: (result) => opts.render(result),
|
|
108
|
-
registerLiveView:
|
|
109
|
-
renderLive:
|
|
93
|
+
registerLiveView: ioPlane.register,
|
|
94
|
+
renderLive: ioPlane.renderLive,
|
|
110
95
|
maybeOpenReport: opts.maybeOpenReport,
|
|
111
96
|
logger: log,
|
|
112
97
|
setExitCode: outputPlane.setExitCode,
|
|
113
98
|
...outputPlane.emits, // emitJson / emitEnvelope / emitError / emitRaw
|
|
114
|
-
deliverSignals:
|
|
115
|
-
writeSarif:
|
|
99
|
+
deliverSignals: ioPlane.deliverSignals,
|
|
100
|
+
writeSarif: ioPlane.writeSarif,
|
|
116
101
|
// Host baseline/ratchet plane seams (ADR-0036) — persistence + diff + exports.
|
|
117
102
|
saveBaseline: baselineSeams.saveBaseline,
|
|
118
103
|
compareBaseline: baselineSeams.compareBaseline,
|
package/dist/cli-context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-context.js","sourceRoot":"","sources":["../src/cli-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAEL,MAAM,IAAI,aAAa,GAGxB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-context.js","sourceRoot":"","sources":["../src/cli-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAEL,MAAM,IAAI,aAAa,GAGxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,GAErB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI7D,8EAA8E;AAC9E,0CAA0C;AAC1C,EAAE;AACF,gFAAgF;AAChF,iFAAiF;AACjF,kFAAkF;AAClF,iFAAiF;AACjF,gFAAgF;AAChF,8EAA8E;AAC9E,qEAAqE;AACrE,wDAAwD;AACxD,8EAA8E;AAE9E,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAyB,MAAM,yBAAyB,CAAC;AAiBxF,MAAM,UAAU,mBA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,SAAS;QACzB,QAAQ;QACR,UAAU;KACX,CAAC,CAAC;IAEH,MAAM,GAAG,GAAoC;QAC3C,IAAI,KAAK;YACP,qEAAqE;YACrE,4EAA4E;YAC5E,wEAAwE;YACxE,6DAA6D;YAC7D,OAAO,SAAS,EAAE,CAAC;QACrB,CAAC;QACD,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAuB,CAAC;QACxD,gBAAgB,EAAE,OAAO,CAAC,QAAQ;QAClC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,WAAW,CAAC,WAAW;QACpC,GAAG,WAAW,CAAC,KAAK,EAAE,gDAAgD;QACtE,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,+EAA+E;QAC/E,YAAY,EAAE,aAAa,CAAC,YAAY;QACxC,eAAe,EAAE,aAAa,CAAC,eAAe;QAC9C,mBAAmB,EAAE,aAAa,CAAC,mBAAmB;QACtD,0BAA0B,EAAE,aAAa,CAAC,0BAA0B;QACpE,SAAS,EAAE,UAAU,EAAE,8CAA8C;QACrE,UAAU,EAAE,yCAAyC;QACrD,UAAU,EAAE,6DAA6D;QACzE,6EAA6E;QAC7E,2EAA2E;QAC3E,yEAAyE;QACzE,GAAG,cAAc;KAClB,CAAC;IAEF,OAAO;QACL,GAAG;QACH,WAAW,EAAE,WAAW,CAAC,WAAW;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -7,7 +7,28 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Future: can be made more dynamic by introspecting live CommandSpecs
|
|
9
9
|
* (see completion.ts for precedent).
|
|
10
|
+
*
|
|
11
|
+
* Command taxonomy (tool-command-surface-taxonomy):
|
|
12
|
+
* - Entry points are keyed by the PUBLIC command path. A `parent`-nested tool
|
|
13
|
+
* verb (the `<tool> <verb>` grammar enabled by `CommandSpec.parent` — e.g.
|
|
14
|
+
* `graph export`, `fit list`) is catalogued UNDER its tool's entry point
|
|
15
|
+
* (the `<tool> <verb>` form), NOT as a separate root entry point.
|
|
16
|
+
* - Tier-3 `visibility: 'internal'` commands (`*-run-worker`, `*-shard-worker`,
|
|
17
|
+
* `*-equivalence-check`) are NEVER catalogued here — the agent-catalog
|
|
18
|
+
* primary surface excludes internal workers (the host-owned tiering pass
|
|
19
|
+
* formalized in Phase 1 filters them when this surface becomes spec-derived).
|
|
20
|
+
* In Phase 0 no tool declares `parent`/`visibility`, so the static catalog below
|
|
21
|
+
* already satisfies both rules (no nested verb, no internal worker is listed).
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The command-taxonomy tier an entry point belongs to
|
|
25
|
+
* (tool-command-surface-taxonomy). `'platform'` = host-owned Tier-1 commands
|
|
26
|
+
* (`init`, `sessions`, `agent-catalog`, …); `'tool'` = a Tier-2 tool verb
|
|
27
|
+
* (`fit`, `graph`, `sim`, and their `<tool> <verb>` sub-verbs). `'internal'`
|
|
28
|
+
* (Tier-3 workers) is part of the union for completeness ONLY — the agent-catalog
|
|
29
|
+
* NEVER emits an `internal` entry point (its primary surface excludes Tier-3).
|
|
10
30
|
*/
|
|
31
|
+
export type CommandTier = 'platform' | 'tool' | 'internal';
|
|
11
32
|
export interface AgentCatalog {
|
|
12
33
|
readonly version: string;
|
|
13
34
|
readonly description: string;
|
|
@@ -15,6 +36,14 @@ export interface AgentCatalog {
|
|
|
15
36
|
readonly command: string;
|
|
16
37
|
readonly description: string;
|
|
17
38
|
readonly examples: readonly string[];
|
|
39
|
+
/**
|
|
40
|
+
* Taxonomy tier of this entry point (tool-command-surface-taxonomy). Additive
|
|
41
|
+
* (optional) so existing consumers of the `entryPoints` shape are unaffected;
|
|
42
|
+
* present on every entry the catalog ships so an agent sees the predictable
|
|
43
|
+
* Tier-1/Tier-2 structure. NEVER `'internal'` — Tier-3 is excluded from this
|
|
44
|
+
* surface by construction (see {@link assertNoInternalEntryPoints}).
|
|
45
|
+
*/
|
|
46
|
+
readonly tier?: CommandTier;
|
|
18
47
|
}[];
|
|
19
48
|
readonly commonPatterns: readonly {
|
|
20
49
|
readonly name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-catalog.d.ts","sourceRoot":"","sources":["../../src/commands/agent-catalog.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent-catalog.d.ts","sourceRoot":"","sources":["../../src/commands/agent-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,SAAS;QAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;QACrC;;;;;;WAMG;QACH,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;KAC7B,EAAE,CAAC;IACJ,QAAQ,CAAC,cAAc,EAAE,SAAS;QAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KAC1B,EAAE,CAAC;IACJ,QAAQ,CAAC,YAAY,EAAE;QACrB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAkCD,wBAAgB,iBAAiB,IAAI,YAAY,CA8GhD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO;;;;;;;;;;EA8BhE"}
|
|
@@ -1,45 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal (Tier-3) command-name shapes the agent-catalog must NEVER surface:
|
|
3
|
+
* the IPC/CI workers and the equivalence gate. The guard checks both the name
|
|
4
|
+
* shape AND an explicit `tier: 'internal'` so a future edit can't slip one in by
|
|
5
|
+
* either route. This is the by-construction complement to the Phase 4 test.
|
|
6
|
+
*/
|
|
7
|
+
const INTERNAL_COMMAND_NAME_RE = /(?:-run-worker|-shard-worker|-equivalence-check)\b/;
|
|
8
|
+
/**
|
|
9
|
+
* Throw if any entry point is a Tier-3 internal command (by name shape or by an
|
|
10
|
+
* explicit `tier: 'internal'`). Called at catalog-build time so a regression that
|
|
11
|
+
* pastes an internal command into `entryPoints` fails loudly the first time the
|
|
12
|
+
* catalog is built, not silently at the agent boundary.
|
|
13
|
+
*
|
|
14
|
+
* @throws {Error} When an entry point is a Tier-3 internal command — by an
|
|
15
|
+
* explicit `tier: 'internal'` or by an internal command-name shape
|
|
16
|
+
* (`*-run-worker` / `*-shard-worker` / `*-equivalence-check`).
|
|
17
|
+
*/
|
|
18
|
+
function assertNoInternalEntryPoints(entryPoints) {
|
|
19
|
+
const leaked = entryPoints.find((e) => e.tier === 'internal' || INTERNAL_COMMAND_NAME_RE.test(e.command));
|
|
20
|
+
if (leaked !== undefined) {
|
|
21
|
+
throw new Error(`agent-catalog: Tier-3 internal command '${leaked.command}' must not appear in the ` +
|
|
22
|
+
'agent-catalog primary surface (tool-command-surface-taxonomy). Remove it from entryPoints.');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
1
25
|
export function buildAgentCatalog() {
|
|
26
|
+
// tool-command-surface-taxonomy Task 1.4: every entry point is annotated with
|
|
27
|
+
// its taxonomy `tier` so an agent sees the predictable Tier-1/Tier-2 shape, and
|
|
28
|
+
// NO Tier-3 internal worker is catalogued. The static list below is the
|
|
29
|
+
// primary surface; `assertNoInternalEntryPoints` guards (by construction)
|
|
30
|
+
// against a future edit pasting an internal command in (the Phase 4 test
|
|
31
|
+
// also asserts this).
|
|
32
|
+
const entryPoints = [
|
|
33
|
+
{
|
|
34
|
+
command: 'fit',
|
|
35
|
+
description: 'Run fitness checks. Use --json for machine output (SignalEnvelope).',
|
|
36
|
+
examples: ['opensip fit --recipe default --json', 'opensip fit --check some-check --json'],
|
|
37
|
+
tier: 'tool',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
command: 'graph',
|
|
41
|
+
description: 'Build static call graph + rules. --json yields SignalEnvelope.',
|
|
42
|
+
examples: ['opensip graph --json', 'opensip graph --sarif out.sarif'],
|
|
43
|
+
tier: 'tool',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
command: 'sessions list',
|
|
47
|
+
description: 'List stored sessions. --summary-only is agent-friendly (omits heavy payloads).',
|
|
48
|
+
examples: [
|
|
49
|
+
'opensip sessions list --json --summary-only',
|
|
50
|
+
'opensip sessions list --json --tool fit --limit 5',
|
|
51
|
+
],
|
|
52
|
+
tier: 'platform',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
command: 'sessions show',
|
|
56
|
+
description: 'Retrieve a prior run as SessionReplayResult (includes projected SignalEnvelope). ' +
|
|
57
|
+
'Supports latest + --tool and rich filtering.',
|
|
58
|
+
examples: [
|
|
59
|
+
'opensip sessions show latest --tool fit --json',
|
|
60
|
+
'opensip sessions show latest --tool fit --json --filter errors-only --filter top:20',
|
|
61
|
+
'opensip sessions show GRAPH_01... --json --raw',
|
|
62
|
+
'opensip sessions show previous --tool graph --json',
|
|
63
|
+
],
|
|
64
|
+
tier: 'platform',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
command: 'agent-catalog',
|
|
68
|
+
description: 'This command. Self-describing catalog for agents (JSON preferred).',
|
|
69
|
+
examples: ['opensip agent-catalog --json'],
|
|
70
|
+
tier: 'platform',
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
assertNoInternalEntryPoints(entryPoints);
|
|
2
74
|
return {
|
|
3
75
|
version: '1.0.0',
|
|
4
76
|
description: 'Stable, machine-oriented surface for AI agents using OpenSIP CLI. ' +
|
|
5
77
|
'Focus on --json paths, sessions for historical results, and composable filters. ' +
|
|
6
78
|
'Human UX (tables, banners) is preserved unchanged.',
|
|
7
|
-
entryPoints
|
|
8
|
-
{
|
|
9
|
-
command: 'fit',
|
|
10
|
-
description: 'Run fitness checks. Use --json for machine output (SignalEnvelope).',
|
|
11
|
-
examples: ['opensip fit --recipe default --json', 'opensip fit --check some-check --json'],
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
command: 'graph',
|
|
15
|
-
description: 'Build static call graph + rules. --json yields SignalEnvelope.',
|
|
16
|
-
examples: ['opensip graph --json', 'opensip graph --sarif out.sarif'],
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
command: 'sessions list',
|
|
20
|
-
description: 'List stored sessions. --summary-only is agent-friendly (omits heavy payloads).',
|
|
21
|
-
examples: [
|
|
22
|
-
'opensip sessions list --json --summary-only',
|
|
23
|
-
'opensip sessions list --json --tool fit --limit 5',
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
command: 'sessions show',
|
|
28
|
-
description: 'Retrieve a prior run as SessionReplayResult (includes projected SignalEnvelope). ' +
|
|
29
|
-
'Supports latest + --tool and rich filtering.',
|
|
30
|
-
examples: [
|
|
31
|
-
'opensip sessions show latest --tool fit --json',
|
|
32
|
-
'opensip sessions show latest --tool fit --json --filter errors-only --filter top:20',
|
|
33
|
-
'opensip sessions show GRAPH_01... --json --raw',
|
|
34
|
-
'opensip sessions show previous --tool graph --json',
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
command: 'agent-catalog',
|
|
39
|
-
description: 'This command. Self-describing catalog for agents (JSON preferred).',
|
|
40
|
-
examples: ['opensip agent-catalog --json'],
|
|
41
|
-
},
|
|
42
|
-
],
|
|
79
|
+
entryPoints,
|
|
43
80
|
commonPatterns: [
|
|
44
81
|
{
|
|
45
82
|
name: 'Inspect latest fit with focus on errors',
|
|
@@ -73,6 +110,10 @@ export function buildAgentCatalog() {
|
|
|
73
110
|
'filtersApplied, originalSignalCount, returnedSignalCount appear when --filter is used.',
|
|
74
111
|
'The fidelity field on replays is always "projection" (rebuilt from persisted data).',
|
|
75
112
|
'Human-readable output (no --json) uses the same tables/banners as before — unchanged.',
|
|
113
|
+
// Uniform tool-primary surface (host-guaranteed; decorateToolPrimary).
|
|
114
|
+
'Every tool primary (fit/graph/sim and any third-party tool) accepts `<tool> --version` ' +
|
|
115
|
+
'(prints the TOOL version, e.g. `fit 0.1.6`; distinct from `opensip --version`, the CLI), ' +
|
|
116
|
+
'plus the guaranteed baseline flags --cwd, --json, --config, --quiet, --verbose.',
|
|
76
117
|
'Dogfood gate requires 0 errors + 0 warnings on fit:ci and graph:ci after any change.',
|
|
77
118
|
// Hygiene invariant (host-planes-scope-seams-hygiene Phases 2-4): everything runs inside an
|
|
78
119
|
// entered RunScope; the only sanctioned seams for output, delivery, baselines, toolState,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-catalog.js","sourceRoot":"","sources":["../../src/commands/agent-catalog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-catalog.js","sourceRoot":"","sources":["../../src/commands/agent-catalog.ts"],"names":[],"mappings":"AA6DA;;;;;GAKG;AACH,MAAM,wBAAwB,GAAG,oDAAoD,CAAC;AAEtF;;;;;;;;;GASG;AACH,SAAS,2BAA2B,CAClC,WAAiF;IAEjF,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAC7B,CAAC,CAAC,EAAE,EAAE,CAAC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AE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;QACnE,EAAE;QACF,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC3E,EAAE;QACF,sEAAsE;KACvE,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,eAAe;QACtB,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../src/commands/clear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../src/commands/clear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;CACtB;AAYD;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAyC/E"}
|
package/dist/commands/clear.js
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
* Banners and result lines route through the Ink renderer via the
|
|
12
12
|
* `clear-done` `CommandResult` shape — no raw ANSI escapes here.
|
|
13
13
|
*/
|
|
14
|
-
// @fitness-ignore-file only-documented-toolcli-seams -- interactive TTY confirmation: the pre-prompt notes printed before "Continue? (y/n)" are human-readable readline UX, not machine run output through a ToolCliContext seam (mirrors the ESLint exemption for this file). Result lines route through the Ink `clear-done` CommandResult. (Architecture review finding 5.)
|
|
15
14
|
import { createInterface } from 'node:readline';
|
|
16
15
|
import { SessionRepo } from '@opensip-cli/session-store';
|
|
17
16
|
function ask(question) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear.js","sourceRoot":"","sources":["../../src/commands/clear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH
|
|
1
|
+
{"version":3,"file":"clear.js","sourceRoot":"","sources":["../../src/commands/clear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAWzD,SAAS,GAAG,CAAC,QAAgB;IAC3B,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;YAC/B,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAkB;IACnD,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAClC,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EA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,CAAC,CAAC;QAC3E,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,YAAY,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* command-scope-index — the runtime lookup used by pre-action bootstrap to
|
|
3
|
+
* decide whether a command may run without an opensip-cli project.
|
|
4
|
+
*
|
|
5
|
+
* The index is built from the same declarative CommandSpecs that are mounted
|
|
6
|
+
* into Commander: top-level host specs, grouped host leaves, and tool
|
|
7
|
+
* commandSpecs. This keeps `CommandSpec.scope` as the source of truth instead
|
|
8
|
+
* of a parallel allowlist.
|
|
9
|
+
*/
|
|
10
|
+
import type { HostSubcommandGroup, ToolPluginGroup } from './host-subcommand-groups.js';
|
|
11
|
+
import type { CommandScopeRequirement } from '@opensip-cli/core';
|
|
12
|
+
import type { Command } from 'commander';
|
|
13
|
+
export type CommandScopeIndex = ReadonlyMap<string, CommandScopeRequirement>;
|
|
14
|
+
export interface CommandScopeSpec {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly aliases?: readonly string[];
|
|
17
|
+
readonly scope: CommandScopeRequirement;
|
|
18
|
+
/**
|
|
19
|
+
* When set, this tool command is nested under the named primary verb (the
|
|
20
|
+
* `<tool> <verb>` grammar — see `CommandSpec.parent`). The index then keys it
|
|
21
|
+
* under `${parent} ${name}` so `commandPath` resolves `graph export` /
|
|
22
|
+
* `fit list` rather than a bare `export` / `list`. Omitted ⇒ flat root key.
|
|
23
|
+
*/
|
|
24
|
+
readonly parent?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface CommandScopeIndexInput {
|
|
27
|
+
readonly hostSpecs: readonly CommandScopeSpec[];
|
|
28
|
+
readonly hostGroups: readonly HostSubcommandGroup[];
|
|
29
|
+
readonly toolSpecs: readonly CommandScopeSpec[];
|
|
30
|
+
/**
|
|
31
|
+
* The DOMAIN-BOUND per-tool `plugin` groups (mounted under each pack-supporting
|
|
32
|
+
* tool primary, e.g. `opensip fit plugin list`). Each leaf keys under
|
|
33
|
+
* `${toolVerb} plugin ${leaf}` so `commandPath` resolves the doubly-nested path.
|
|
34
|
+
* Optional so callers without tools (isolated tests) can omit it.
|
|
35
|
+
*/
|
|
36
|
+
readonly toolPluginGroups?: readonly ToolPluginGroup[];
|
|
37
|
+
}
|
|
38
|
+
export declare function buildCommandScopeIndex(input: CommandScopeIndexInput): CommandScopeIndex;
|
|
39
|
+
/**
|
|
40
|
+
* Commander exposes the invoked leaf as `actionCommand`; walk its parents back
|
|
41
|
+
* to the root program and keep only real subcommands. For `opensip tools list`,
|
|
42
|
+
* this returns `tools list`, not just `list`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function commandPath(actionCommand: Command): string;
|
|
45
|
+
//# sourceMappingURL=command-scope-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-scope-index.d.ts","sourceRoot":"","sources":["../../src/commands/command-scope-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAE7E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,uBAAuB,CAAC;IACxC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAChD,QAAQ,CAAC,UAAU,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAChD;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;CACxD;AAaD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,sBAAsB,GAAG,iBAAiB,CAmBvF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,CAU1D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* command-scope-index — the runtime lookup used by pre-action bootstrap to
|
|
3
|
+
* decide whether a command may run without an opensip-cli project.
|
|
4
|
+
*
|
|
5
|
+
* The index is built from the same declarative CommandSpecs that are mounted
|
|
6
|
+
* into Commander: top-level host specs, grouped host leaves, and tool
|
|
7
|
+
* commandSpecs. This keeps `CommandSpec.scope` as the source of truth instead
|
|
8
|
+
* of a parallel allowlist.
|
|
9
|
+
*/
|
|
10
|
+
function addSpec(index, pathPrefix, spec) {
|
|
11
|
+
const names = [spec.name, ...(spec.aliases ?? [])];
|
|
12
|
+
names.forEach((name) => {
|
|
13
|
+
index.set(pathPrefix === undefined ? name : `${pathPrefix} ${name}`, spec.scope);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export function buildCommandScopeIndex(input) {
|
|
17
|
+
const index = new Map();
|
|
18
|
+
// Tool specs key flat by `name`, EXCEPT `parent`-nested specs (the
|
|
19
|
+
// `<tool> <verb>` grammar, taxonomy Task 0.4), which key under
|
|
20
|
+
// `${parent} ${name}` so `commandPath` resolves `graph export` / `fit list`.
|
|
21
|
+
input.toolSpecs.forEach((spec) => addSpec(index, spec.parent, spec));
|
|
22
|
+
input.hostSpecs.forEach((spec) => addSpec(index, undefined, spec));
|
|
23
|
+
input.hostGroups.forEach((group) => {
|
|
24
|
+
group.leaves.forEach((leaf) => addSpec(index, group.name, leaf));
|
|
25
|
+
});
|
|
26
|
+
// Per-tool `plugin` group leaves key under the doubly-nested
|
|
27
|
+
// `${toolVerb} plugin ${leaf}` path (e.g. `fit plugin list`), matching what
|
|
28
|
+
// `commandPath` resolves for the mounted `opensip fit plugin list`.
|
|
29
|
+
(input.toolPluginGroups ?? []).forEach((group) => {
|
|
30
|
+
group.leaves.forEach((leaf) => addSpec(index, `${group.toolVerb} plugin`, leaf));
|
|
31
|
+
});
|
|
32
|
+
return index;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Commander exposes the invoked leaf as `actionCommand`; walk its parents back
|
|
36
|
+
* to the root program and keep only real subcommands. For `opensip tools list`,
|
|
37
|
+
* this returns `tools list`, not just `list`.
|
|
38
|
+
*/
|
|
39
|
+
export function commandPath(actionCommand) {
|
|
40
|
+
const parts = [];
|
|
41
|
+
let cursor = actionCommand;
|
|
42
|
+
while (cursor !== null) {
|
|
43
|
+
if (cursor.parent !== null)
|
|
44
|
+
parts.push(cursor.name());
|
|
45
|
+
cursor = cursor.parent;
|
|
46
|
+
}
|
|
47
|
+
const ordered = [...parts];
|
|
48
|
+
ordered.reverse();
|
|
49
|
+
return ordered.join(' ');
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=command-scope-index.js.map
|
|
@@ -0,0 +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,IA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;IACnF,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"}
|
|
@@ -26,8 +26,30 @@ export type Shell = 'bash' | 'zsh' | 'fish';
|
|
|
26
26
|
/**
|
|
27
27
|
* Internal/machine-facing command names never offered in shell completion.
|
|
28
28
|
* These are spawned by the host (sharded build, off-process engine workers,
|
|
29
|
-
* machine exports), never typed by a user.
|
|
30
|
-
*
|
|
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.
|
|
31
53
|
*/
|
|
32
54
|
export declare const INTERNAL_COMMANDS: ReadonlySet<string>;
|
|
33
55
|
/**
|
|
@@ -41,7 +63,11 @@ export interface CompletionInventory {
|
|
|
41
63
|
readonly subcommands: readonly string[];
|
|
42
64
|
/** Per-command long-flag list, keyed by command name (and alias). */
|
|
43
65
|
readonly commandFlags: Readonly<Record<string, readonly string[]>>;
|
|
44
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Sub-subcommand names for the action-less groups (`sessions`, `tools`), the
|
|
68
|
+
* `<tool> <verb>` grammar (`fit export`…), and the per-tool `plugin` groups
|
|
69
|
+
* (`fit plugin`, keyed under `${toolVerb} plugin`).
|
|
70
|
+
*/
|
|
45
71
|
readonly groupSubcommands: Readonly<Record<string, readonly string[]>>;
|
|
46
72
|
}
|
|
47
73
|
/** Minimal structural view of a `CommandSpec` this module needs to read. */
|
|
@@ -52,14 +78,34 @@ export interface SpecLike {
|
|
|
52
78
|
readonly options?: readonly {
|
|
53
79
|
readonly flag: string;
|
|
54
80
|
}[];
|
|
81
|
+
/**
|
|
82
|
+
* When set, this tool command is a `<parent> <name>` sub-subcommand (the
|
|
83
|
+
* `<tool> <verb>` grammar — see `CommandSpec.parent`, taxonomy Task 0.4). The
|
|
84
|
+
* inventory then offers it as a leaf under `parent` (like a `plugin`/`sessions`
|
|
85
|
+
* group leaf) and keys its flags under `${parent} ${name}`. Omitted ⇒ a flat
|
|
86
|
+
* top-level command.
|
|
87
|
+
*/
|
|
88
|
+
readonly parent?: string;
|
|
55
89
|
}
|
|
56
|
-
/** One action-less group (`
|
|
90
|
+
/** One action-less group (`sessions` / `tools`) and its leaf command names. */
|
|
57
91
|
export interface GroupLike {
|
|
58
92
|
readonly name: string;
|
|
59
93
|
readonly leaves: readonly {
|
|
60
94
|
readonly name: string;
|
|
61
95
|
}[];
|
|
62
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* One pack-supporting tool's `plugin` group, keyed by the tool verb it mounts
|
|
99
|
+
* under (`fit`/`sim`). The `plugin` parent is offered as a leaf under that verb
|
|
100
|
+
* (`opensip fit <TAB>` ⇒ `… plugin`), and the `add|list|remove|sync` leaves are
|
|
101
|
+
* registered under the `${toolVerb} plugin` path for deeper completion.
|
|
102
|
+
*/
|
|
103
|
+
export interface ToolPluginGroupLike {
|
|
104
|
+
readonly toolVerb: string;
|
|
105
|
+
readonly leaves: readonly {
|
|
106
|
+
readonly name: string;
|
|
107
|
+
}[];
|
|
108
|
+
}
|
|
63
109
|
/**
|
|
64
110
|
* Extract the canonical long `--flag` from a Commander flag string —
|
|
65
111
|
* `'-y, --yes'` → `'--yes'`, `'--no-cache'` → `'--no-cache'`,
|
|
@@ -77,13 +123,28 @@ export declare function specLongFlags(spec: SpecLike): readonly string[];
|
|
|
77
123
|
* Assemble the completion inventory from the live specs. Pure: callers pass
|
|
78
124
|
* the tool command specs (from the populated `ToolRegistry`), the top-level
|
|
79
125
|
* host specs, and the action-less groups; this turns them into the flag /
|
|
80
|
-
* subcommand maps the script builders consume.
|
|
81
|
-
*
|
|
126
|
+
* subcommand maps the script builders consume.
|
|
127
|
+
*
|
|
128
|
+
* Internal commands are filtered out by `input.internalCommands` — the
|
|
129
|
+
* descriptor-driven `visibility: 'internal'` set the host computes from the live
|
|
130
|
+
* tool registry (`internalCommandNames`), so completion and the `--help` hide
|
|
131
|
+
* pass key on the SAME source. Defaults to the static {@link INTERNAL_COMMANDS}
|
|
132
|
+
* fallback when omitted (tests / callers without a registry). The
|
|
133
|
+
* `OPENSIP_CLI_SHOW_INTERNAL=1` reveal is applied at the call site: the host
|
|
134
|
+
* passes an EMPTY set to skip filtering when the override is on.
|
|
82
135
|
*/
|
|
83
136
|
export declare function assembleCompletionInventory(input: {
|
|
84
137
|
readonly toolSpecs: readonly SpecLike[];
|
|
85
138
|
readonly hostSpecs: readonly SpecLike[];
|
|
86
139
|
readonly groups: readonly GroupLike[];
|
|
140
|
+
/**
|
|
141
|
+
* The DOMAIN-BOUND per-tool `plugin` groups (mounted under each pack-supporting
|
|
142
|
+
* tool primary). Folded into the group map so completion offers `plugin` under
|
|
143
|
+
* the tool verb and `add|list|remove|sync` under `${toolVerb} plugin`. Optional
|
|
144
|
+
* so callers without tools omit it.
|
|
145
|
+
*/
|
|
146
|
+
readonly toolPluginGroups?: readonly ToolPluginGroupLike[];
|
|
147
|
+
readonly internalCommands?: ReadonlySet<string>;
|
|
87
148
|
}): CompletionInventory;
|
|
88
149
|
export declare function buildCompletionScript(shell: Shell, inventory: CompletionInventory): string;
|
|
89
150
|
export declare function printCompletionScript(shell: Shell, inventory: CompletionInventory, write?: (s: string) => void): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
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;AAE5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