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
|
@@ -1,18 +1,189 @@
|
|
|
1
|
+
// @fitness-ignore-file performance-anti-patterns -- sequential await across discovered tool packages preserves load order for plugin-conflict detection; bounded by installed plugin count
|
|
1
2
|
/**
|
|
2
|
-
* register-tools — populate the kernel
|
|
3
|
-
* tools (
|
|
4
|
-
* packages discovered on disk.
|
|
3
|
+
* register-tools — populate the kernel ToolRegistry with bundled, installed,
|
|
4
|
+
* and authored tools (ADR-0027 / ADR-0041).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `tool.registry.duplicate` warning. Keeping the explicit guard avoids
|
|
10
|
-
* a noisy warning when a third-party package happens to ship under a
|
|
11
|
-
* built-in id.
|
|
6
|
+
* Merged registration cluster: manifest constants, bundled admission,
|
|
7
|
+
* installed/authored admission, and discovery walkers. Command mounting lives
|
|
8
|
+
* in register-tools-mount.ts.
|
|
12
9
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
11
|
+
import { createRequire } from 'node:module';
|
|
12
|
+
import { dirname, join } from 'node:path';
|
|
13
|
+
import { logger, PluginIncompatibleError, } from '@opensip-cli/core';
|
|
14
|
+
import { admitToolPackage } from './admit-tool-package.js';
|
|
15
|
+
import { BUNDLED_TOOL_PACKAGES } from './bundled-manifest.js';
|
|
16
|
+
import { BOOTSTRAP_MODULE } from './constants.js';
|
|
17
|
+
export { BUNDLED_CAPABILITY_PACKS, BUNDLED_TOOL_PACKAGES, EXPECTED_SCAFFOLDING_TOOL_IDS, } from './bundled-manifest.js';
|
|
18
|
+
/** Used to resolve the bundled engine package dirs from the CLI's own module graph. */
|
|
19
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
20
|
+
/**
|
|
21
|
+
* Resolve a bundled tool's PACKAGE DIR — the directory whose `package.json`
|
|
22
|
+
* carries the `opensipTools` manifest.
|
|
23
|
+
*
|
|
24
|
+
* The `./package.json` subpath is not declared in each engine's `exports`,
|
|
25
|
+
* so `require.resolve('<pkg>/package.json')` throws. Instead we resolve the
|
|
26
|
+
* package's MAIN entry (a bare-name resolve, always permitted by `exports`)
|
|
27
|
+
* and walk up to the nearest ancestor directory that has a `package.json`
|
|
28
|
+
* whose `name` matches `packageName`. That ancestor IS the tool's own
|
|
29
|
+
* package dir under both the source layout and pnpm's workspace-injected
|
|
30
|
+
* `node_modules` layout (verified against fitness/simulation/graph here).
|
|
31
|
+
*
|
|
32
|
+
* @returns the resolved package directory, or `undefined` when the package
|
|
33
|
+
* cannot be resolved (should never happen for a bundled direct dep).
|
|
34
|
+
*/
|
|
35
|
+
export function resolveBundledPackageDir(packageName) {
|
|
36
|
+
let resolvedEntry;
|
|
37
|
+
try {
|
|
38
|
+
resolvedEntry = requireFromHere.resolve(packageName);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
// A bundled direct dep failing to resolve is a packaging fault — log it
|
|
42
|
+
// so the subsequent fail-closed throw is diagnosable, then signal the
|
|
43
|
+
// unresolved state to the caller (which raises PluginIncompatibleError).
|
|
44
|
+
logger.debug({
|
|
45
|
+
evt: 'cli.tool.bundled_unresolved',
|
|
46
|
+
module: BOOTSTRAP_MODULE,
|
|
47
|
+
packageName,
|
|
48
|
+
error: error instanceof Error ? error.message : String(error),
|
|
49
|
+
});
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
let dir = dirname(resolvedEntry);
|
|
53
|
+
for (let i = 0; i < 50; i++) {
|
|
54
|
+
const pkgPath = join(dir, 'package.json');
|
|
55
|
+
if (existsSync(pkgPath)) {
|
|
56
|
+
try {
|
|
57
|
+
const json = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
58
|
+
if (json.name === packageName)
|
|
59
|
+
return dir;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// @swallow-ok unreadable package.json on the walk-up — keep climbing.
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const parent = dirname(dir);
|
|
66
|
+
if (parent === dir)
|
|
67
|
+
break;
|
|
68
|
+
dir = parent;
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Resolve a bundled tool package's on-disk directory, requiring success.
|
|
74
|
+
*
|
|
75
|
+
* @throws {PluginIncompatibleError} when the package directory cannot be
|
|
76
|
+
* resolved on disk (its manifest is unreadable).
|
|
77
|
+
*/
|
|
78
|
+
export function resolveRequiredBundledPackageDir(packageName) {
|
|
79
|
+
const dir = resolveBundledPackageDir(packageName);
|
|
80
|
+
if (dir !== undefined)
|
|
81
|
+
return dir;
|
|
82
|
+
throw new PluginIncompatibleError(`bundled tool '${packageName}' could not be resolved on disk; its manifest is unreadable`, { diagnostic: 'package directory not resolvable' });
|
|
83
|
+
}
|
|
84
|
+
// The runtime-load primitive (`importToolRuntime` + `ToolRuntimeLoad`) and the
|
|
85
|
+
// full admission SEQUENCE (`admitToolPackage`) live in `admit-tool-package.ts`
|
|
86
|
+
// (ADR-0041: one validator, four consumers). This file keeps the per-source
|
|
87
|
+
// POLICY: bundled fails closed below; the installed/authored legs skip with
|
|
88
|
+
// diagnostics.
|
|
89
|
+
/**
|
|
90
|
+
* Register the bundled first-party tools into the supplied registry, each one
|
|
91
|
+
* flowing through the SAME admit → dynamic-import → register path the external
|
|
92
|
+
* path uses (launch cutover — replaces the static-import + gate path).
|
|
93
|
+
*
|
|
94
|
+
* Per package name: `resolveBundledPackageDir` → `loadToolManifest('bundled')`
|
|
95
|
+
* → `admitTool({ source: 'bundled', explicitlyRequested: true })` →
|
|
96
|
+
* `importToolRuntime` (dynamic import + shape validation) → drift guard →
|
|
97
|
+
* `registry.register`. A bundled tool ships with the CLI, so it is always
|
|
98
|
+
* explicitly present: a missing/incompatible manifest or a runtime that fails
|
|
99
|
+
* to load is FAIL-CLOSED (never a silent skip). The recorded `ToolProvenance`
|
|
100
|
+
* (source `'bundled'`, trusted-by-shipping) and manifest are pushed onto the
|
|
101
|
+
* optional collectors so the composition root can surface provenance
|
|
102
|
+
* (`plugin list`) and seed the per-run capability registry (§5.3).
|
|
103
|
+
*
|
|
104
|
+
* @param registry The per-invocation tool registry to populate.
|
|
105
|
+
* @param provenance Optional sink for the admitted tools' provenance records.
|
|
106
|
+
* @param manifests Optional sink for the admitted tools' manifests (§5.3).
|
|
107
|
+
* @param packages The bundled package names to load (defaults to
|
|
108
|
+
* {@link BUNDLED_TOOL_PACKAGES}; injectable so the fail-closed paths are
|
|
109
|
+
* testable with fixture packages).
|
|
110
|
+
* @throws {PluginIncompatibleError} when a bundled tool cannot be resolved,
|
|
111
|
+
* has no conformant manifest, is out of range, or its runtime fails to load
|
|
112
|
+
* — mapped to `EXIT_CODES.PLUGIN_INCOMPATIBLE` (exit 5) by the CLI boundary.
|
|
113
|
+
*/
|
|
114
|
+
export async function registerFirstPartyTools(registry, provenance = [], manifests = [], packages = BUNDLED_TOOL_PACKAGES) {
|
|
115
|
+
for (const packageName of packages) {
|
|
116
|
+
const dir = resolveRequiredBundledPackageDir(packageName);
|
|
117
|
+
// The shared admission SEQUENCE (ADR-0041). The bundled POLICY below maps
|
|
118
|
+
// each failed section to the exact fail-closed error this path always
|
|
119
|
+
// threw — a bundled tool ships with the CLI, so every failure is a
|
|
120
|
+
// packaging fault, never a silent skip.
|
|
121
|
+
const report = await admitToolPackage({
|
|
122
|
+
dir,
|
|
123
|
+
source: 'bundled',
|
|
124
|
+
packageName,
|
|
125
|
+
// A bundled tool ships with the CLI; it is always explicitly present,
|
|
126
|
+
// so an incompatible manifest fails the run rather than skipping.
|
|
127
|
+
explicitlyRequested: true,
|
|
128
|
+
});
|
|
129
|
+
if (!report.ok) {
|
|
130
|
+
// @fitness-ignore-next-line detached-promises -- synchronous never-returning thrower; the heuristic mistakes the bare call for an unawaited promise
|
|
131
|
+
throwBundledAdmissionFailure(packageName, report);
|
|
132
|
+
}
|
|
133
|
+
/* v8 ignore next 3 -- throwBundledAdmissionFailure never returns on a failed report; this guard narrows types */
|
|
134
|
+
if (report.tool === undefined ||
|
|
135
|
+
report.provenance === undefined ||
|
|
136
|
+
report.manifest === undefined) {
|
|
137
|
+
throw new PluginIncompatibleError(`bundled tool '${packageName}' produced an incomplete admission report`, { diagnostic: 'incomplete admission report' });
|
|
138
|
+
}
|
|
139
|
+
registry.register(report.tool);
|
|
140
|
+
provenance.push(report.provenance);
|
|
141
|
+
// Record the manifest so the pre-action-hook can register this tool's
|
|
142
|
+
// declared capability domains into the per-run capability registry
|
|
143
|
+
// (launch, §5.3).
|
|
144
|
+
manifests.push(report.manifest);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The bundled FAIL-CLOSED policy: convert a failed {@link AdmissionReport}
|
|
149
|
+
* into the same `PluginIncompatibleError` (message + diagnostic) the inline
|
|
150
|
+
* pipeline threw before the ADR-0041 factoring. Never returns.
|
|
151
|
+
*
|
|
152
|
+
* @throws {PluginIncompatibleError} always (or rethrows the original
|
|
153
|
+
* coherence error from `assertManifestMatchesTool`, preserving its type).
|
|
154
|
+
*/
|
|
155
|
+
function throwBundledAdmissionFailure(packageName, report) {
|
|
156
|
+
const failed = report.sections.find((s) => !s.ok);
|
|
157
|
+
const failedSection = failed?.section;
|
|
158
|
+
if (failedSection === 'manifest') {
|
|
159
|
+
throw new PluginIncompatibleError(`bundled tool '${packageName}' has no conformant package.json#opensipTools manifest`, { diagnostic: 'manifest missing or malformed' });
|
|
160
|
+
}
|
|
161
|
+
const id = report.manifest?.id ?? packageName;
|
|
162
|
+
if (failedSection === 'compatibility') {
|
|
163
|
+
if (report.compatibilityDecision === 'fail-closed') {
|
|
164
|
+
throw new PluginIncompatibleError(`bundled tool '${id}' is incompatible: ${failed?.diagnostic ?? 'compatibility gate rejected it'}`, { diagnostic: failed?.diagnostic });
|
|
165
|
+
}
|
|
166
|
+
if (report.compatibilityDecision === 'skip') {
|
|
167
|
+
// Should not happen for an in-range bundled tool, but never silently
|
|
168
|
+
// drop a bundled tool — surface it loudly.
|
|
169
|
+
throw new PluginIncompatibleError(`bundled tool '${id}' was skipped by the compatibility gate: ${failed?.diagnostic ?? 'unknown reason'}`, { diagnostic: failed?.diagnostic });
|
|
170
|
+
}
|
|
171
|
+
throw new PluginIncompatibleError(`bundled tool '${id}' reached an unknown admission decision`, { diagnostic: 'unknown admission decision' });
|
|
172
|
+
}
|
|
173
|
+
if (failedSection === 'runtime-load' || failedSection === 'tool-shape') {
|
|
174
|
+
const reason = report.runtimeLoadReason ?? 'import-failed';
|
|
175
|
+
const detailSuffix = report.runtimeLoadDetail ? `: ${report.runtimeLoadDetail}` : '';
|
|
176
|
+
throw new PluginIncompatibleError(`bundled tool '${id}' failed to load via the plugin path (${reason}${detailSuffix})`, { diagnostic: `bundled tool runtime load failed: ${reason}` });
|
|
177
|
+
}
|
|
178
|
+
if (failedSection === 'manifest-runtime-coherence' && report.coherenceError instanceof Error) {
|
|
179
|
+
// Preserve the original drift-guard error type + message untouched.
|
|
180
|
+
// (assertManifestMatchesTool always throws Error subclasses; the
|
|
181
|
+
// instanceof narrowing satisfies only-throw-error without a cast.)
|
|
182
|
+
throw report.coherenceError;
|
|
183
|
+
}
|
|
184
|
+
/* v8 ignore next 4 -- defensive: a failed report always carries a failed section */
|
|
185
|
+
throw new PluginIncompatibleError(`bundled tool '${packageName}' failed admission for an unknown reason`, { diagnostic: 'unknown admission failure' });
|
|
186
|
+
}
|
|
187
|
+
export { admitProjectLocalTool, admitUserGlobalTool, buildToolDiscoverySources, discoverAndRegisterAuthoredTools, discoverAndRegisterToolPackages, emitInstalledLoadFailure, } from './register-tools-discovery.js';
|
|
188
|
+
export { mountAllToolCommands, mountOneTool } from './register-tools-mount.js';
|
|
18
189
|
//# sourceMappingURL=register-tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-tools.js","sourceRoot":"","sources":["../../src/bootstrap/register-tools.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"register-tools.js","sourceRoot":"","sources":["../../src/bootstrap/register-tools.ts"],"names":[],"mappings":"AAAA,2LAA2L;AAC3L;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EACL,MAAM,EACN,uBAAuB,GAIxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAwB,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAE/B,uFAAuF;AACvF,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEvD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAmB;IAC1D,IAAI,aAAqB,CAAC;IAC1B,IAAI,CAAC;QACH,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,wEAAwE;QACxE,sEAAsE;QACtE,yEAAyE;QACzE,MAAM,CAAC,KAAK,CAAC;YACX,GAAG,EAAE,6BAA6B;YAClC,MAAM,EAAE,gBAAgB;YACxB,WAAW;YACX,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,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yCAAyC,MAAM,GAAG,YAAY,GAAG,EACpF,EAAE,UAAU,EAAE,qCAAqC,MAAM,EAAE,EAAE,CAC9D,CAAC;IACJ,CAAC;IACD,IAAI,aAAa,KAAK,4BAA4B,IAAI,MAAM,CAAC,cAAc,YAAY,KAAK,EAAE,CAAC;QAC7F,oEAAoE;QACpE,iEAAiE;QACjE,mEAAmE;QACnE,MAAM,MAAM,CAAC,cAAc,CAAC;IAC9B,CAAC;IACD,oFAAoF;IACpF,MAAM,IAAI,uBAAuB,CAC/B,iBAAiB,WAAW,0CAA0C,EACtE,EAAE,UAAU,EAAE,2BAA2B,EAAE,CAC5C,CAAC;AACJ,CAAC;AAED,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,gCAAgC,EAChC,+BAA+B,EAC/B,wBAAwB,GAGzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* root-version — host-owned detection of the bare `opensip --version` request.
|
|
3
|
+
*
|
|
4
|
+
* The root program deliberately carries NO Commander `.version()` option: a root
|
|
5
|
+
* version option is GLOBAL and would intercept `--version` even after a known
|
|
6
|
+
* subcommand, so `opensip fit --version` would print the CLI version instead of
|
|
7
|
+
* the tool's. The per-tool `--version` is a subcommand-local Commander version
|
|
8
|
+
* option (`decorateToolPrimary`); the bare CLI form is detected here, before
|
|
9
|
+
* Commander parses, so the two never collide.
|
|
10
|
+
*
|
|
11
|
+
* Kept in its own module (rather than inline in the composition root) so it is
|
|
12
|
+
* unit-testable without importing `index.ts` — whose top-level `await main()`
|
|
13
|
+
* side-effect would run the whole CLI on import.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Is this argv a BARE `opensip --version` / `-V` (the CLI version), as opposed to
|
|
17
|
+
* a tool primary's own `opensip <tool> --version`?
|
|
18
|
+
*
|
|
19
|
+
* The bare form has `--version` / `-V` with NO subcommand (positional) token
|
|
20
|
+
* before it. A `--version` that follows a subcommand belongs to that subcommand
|
|
21
|
+
* and is left for Commander (and `decorateToolPrimary`).
|
|
22
|
+
*
|
|
23
|
+
* @param argv `process.argv.slice(2)` — the user-supplied args after the binary.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isRootVersionRequest(argv: readonly string[]): boolean;
|
|
26
|
+
//# sourceMappingURL=root-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-version.d.ts","sourceRoot":"","sources":["../../src/bootstrap/root-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAQrE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* root-version — host-owned detection of the bare `opensip --version` request.
|
|
3
|
+
*
|
|
4
|
+
* The root program deliberately carries NO Commander `.version()` option: a root
|
|
5
|
+
* version option is GLOBAL and would intercept `--version` even after a known
|
|
6
|
+
* subcommand, so `opensip fit --version` would print the CLI version instead of
|
|
7
|
+
* the tool's. The per-tool `--version` is a subcommand-local Commander version
|
|
8
|
+
* option (`decorateToolPrimary`); the bare CLI form is detected here, before
|
|
9
|
+
* Commander parses, so the two never collide.
|
|
10
|
+
*
|
|
11
|
+
* Kept in its own module (rather than inline in the composition root) so it is
|
|
12
|
+
* unit-testable without importing `index.ts` — whose top-level `await main()`
|
|
13
|
+
* side-effect would run the whole CLI on import.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Is this argv a BARE `opensip --version` / `-V` (the CLI version), as opposed to
|
|
17
|
+
* a tool primary's own `opensip <tool> --version`?
|
|
18
|
+
*
|
|
19
|
+
* The bare form has `--version` / `-V` with NO subcommand (positional) token
|
|
20
|
+
* before it. A `--version` that follows a subcommand belongs to that subcommand
|
|
21
|
+
* and is left for Commander (and `decorateToolPrimary`).
|
|
22
|
+
*
|
|
23
|
+
* @param argv `process.argv.slice(2)` — the user-supplied args after the binary.
|
|
24
|
+
*/
|
|
25
|
+
export function isRootVersionRequest(argv) {
|
|
26
|
+
for (const token of argv) {
|
|
27
|
+
if (token === '--version' || token === '-V')
|
|
28
|
+
return true;
|
|
29
|
+
// The first non-flag token is the subcommand verb — any `--version` after it
|
|
30
|
+
// is the subcommand's, not the root's.
|
|
31
|
+
if (!token.startsWith('-'))
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=root-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-version.js","sourceRoot":"","sources":["../../src/bootstrap/root-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAuB;IAC1D,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,IAAI,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QACzD,6EAA6E;QAC7E,uCAAuC;QACvC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;IAC3C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -65,4 +65,15 @@ export declare function getOrOpenDatastore(_log?: Logger): DataStore;
|
|
|
65
65
|
* datastore); other datastore-open failures propagate unchanged.
|
|
66
66
|
*/
|
|
67
67
|
export declare function getProjectDatastore(): DataStore;
|
|
68
|
+
/** How a datastore resolver should behave when scope or project context is absent. */
|
|
69
|
+
export type DatastoreResolverMode = 'strict' | 'project-seam' | 'best-effort';
|
|
70
|
+
/**
|
|
71
|
+
* Unified lazy datastore accessor for host planes and the run plane.
|
|
72
|
+
*
|
|
73
|
+
* - `strict` — throws when outside a project scope (via `getOrOpenDatastore`).
|
|
74
|
+
* - `project-seam` — maps outside-project to `ConfigurationError` for documented seams.
|
|
75
|
+
* - `best-effort` — returns `undefined` when scope or datastore is unavailable.
|
|
76
|
+
*/
|
|
77
|
+
export declare function createDatastoreResolver(mode: 'strict' | 'project-seam', logger?: Logger): () => DataStore;
|
|
78
|
+
export declare function createDatastoreResolver(mode: 'best-effort', logger?: Logger): () => DataStore | undefined;
|
|
68
79
|
//# sourceMappingURL=scope-access.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-access.d.ts","sourceRoot":"","sources":["../../src/bootstrap/scope-access.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,QAAQ,EAKd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE1E;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,QAAQ,CAWpC;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAS9C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,cAAc,EACvB,GAAG,GAAE,MAAsB,GAC1B,MAAM,SAAS,CAoBjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,GAAE,MAAsB,GAAG,SAAS,CAG1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,SAAS,CAgB/C"}
|
|
1
|
+
{"version":3,"file":"scope-access.d.ts","sourceRoot":"","sources":["../../src/bootstrap/scope-access.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,QAAQ,EAKd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE1E;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,QAAQ,CAWpC;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAS9C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,cAAc,EACvB,GAAG,GAAE,MAAsB,GAC1B,MAAM,SAAS,CAoBjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,GAAE,MAAsB,GAAG,SAAS,CAG1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,SAAS,CAgB/C;AAED,sFAAsF;AACtF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,cAAc,GAAG,aAAa,CAAC;AAE9E;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,QAAQ,GAAG,cAAc,EAC/B,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,SAAS,CAAC;AACnB,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,aAAa,EACnB,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,SAAS,GAAG,SAAS,CAAC"}
|
|
@@ -112,4 +112,30 @@ export function getProjectDatastore() {
|
|
|
112
112
|
throw error;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
export function createDatastoreResolver(mode, logger = defaultLogger) {
|
|
116
|
+
switch (mode) {
|
|
117
|
+
case 'strict': {
|
|
118
|
+
return () => getOrOpenDatastore(logger);
|
|
119
|
+
}
|
|
120
|
+
case 'project-seam': {
|
|
121
|
+
return () => getProjectDatastore();
|
|
122
|
+
}
|
|
123
|
+
case 'best-effort': {
|
|
124
|
+
return () => {
|
|
125
|
+
try {
|
|
126
|
+
const thunk = readScope().datastore;
|
|
127
|
+
return thunk ? thunk() : undefined;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
logger.debug({
|
|
131
|
+
evt: 'cli.context.datastore_unavailable',
|
|
132
|
+
module: 'cli:context',
|
|
133
|
+
error: error instanceof Error ? error.message : String(error),
|
|
134
|
+
});
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
115
141
|
//# sourceMappingURL=scope-access.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-access.js","sourceRoot":"","sources":["../../src/bootstrap/scope-access.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,kBAAkB,EAIlB,WAAW,EACX,YAAY,EACZ,MAAM,IAAI,aAAa,EACvB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAkB,MAAM,wBAAwB,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,WAAW,CACnB,2FAA2F;YACzF,yFAAyF;YACzF,2FAA2F,EAC7F,EAAE,IAAI,EAAE,0BAA0B,EAAE,CACrC,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC,cAAc,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,WAAW,CACnB,6EAA6E,EAC7E,EAAE,IAAI,EAAE,gCAAgC,EAAE,CAC3C,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,WAAW,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAuB,EACvB,MAAc,aAAa;IAE3B,IAAI,MAA6B,CAAC;IAClC,OAAO,GAAG,EAAE;QACV,IAAI,M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AC,CAAC,SAAS,CAAC;gBACpD,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,CAAC,KAAK,CAAC;wBACX,GAAG,EAAE,mCAAmC;wBACxC,MAAM,EAAE,aAAa;wBACrB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBAC9D,CAAC,CAAC;oBACH,OAAO;gBACT,CAAC;YACH,CAAC,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -48,8 +48,6 @@
|
|
|
48
48
|
* one ordered entry point. The driver is intentionally THIN: it sequences the
|
|
49
49
|
* pre-existing helpers, it does not reimplement them.
|
|
50
50
|
*/
|
|
51
|
-
import type { CliProgram } from '@opensip-cli/contracts';
|
|
52
|
-
import type { ToolCliContext, ToolRegistry } from '@opensip-cli/core';
|
|
53
51
|
/**
|
|
54
52
|
* Canonical, ordered tool-lifecycle steps (launch, §5.4). The numeric
|
|
55
53
|
* values are the step ordinals used in the JSDoc above and in
|
|
@@ -79,24 +77,4 @@ export declare const TOOL_LIFECYCLE_STEPS: {
|
|
|
79
77
|
/** 10 — Commander dispatches the action body through the mount pipeline. */
|
|
80
78
|
readonly dispatch: 10;
|
|
81
79
|
};
|
|
82
|
-
/**
|
|
83
|
-
* Drive the STARTUP-phase command-mount step (step 8) for every registered
|
|
84
|
-
* tool. By the time this runs, steps 1-4 have already populated `registry`
|
|
85
|
-
* inside {@link bootstrapCli} (provenance no longer matters — bundled and
|
|
86
|
-
* installed tools mount identically). This is the single ordered entry point
|
|
87
|
-
* the composition root calls for step 8, replacing the bare
|
|
88
|
-
* `mountAllToolCommands(...)` call so the lifecycle has one named seam.
|
|
89
|
-
*
|
|
90
|
-
* Kept THIN deliberately: it delegates straight to
|
|
91
|
-
* {@link mountAllToolCommands}, which mounts each tool's declared `commandSpecs`
|
|
92
|
-
* (the one command surface, launch) with per-tool failure isolation. The naming +
|
|
93
|
-
* ordering is the value here, not new logic.
|
|
94
|
-
*
|
|
95
|
-
* @param registry The per-invocation tool registry, already populated by
|
|
96
|
-
* steps 1-4.
|
|
97
|
-
* @param program The root Commander program (host-owned; passed in since the tool
|
|
98
|
-
* context no longer carries it, §8).
|
|
99
|
-
* @param ctx The per-invocation handler context handed to each mounted command.
|
|
100
|
-
*/
|
|
101
|
-
export declare function mountToolCommands(registry: ToolRegistry, program: CliProgram, ctx: ToolCliContext): void;
|
|
102
80
|
//# sourceMappingURL=tool-lifecycle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-lifecycle.d.ts","sourceRoot":"","sources":["../../src/bootstrap/tool-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;
|
|
1
|
+
{"version":3,"file":"tool-lifecycle.d.ts","sourceRoot":"","sources":["../../src/bootstrap/tool-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;IAC/B,oDAAoD;;IAEpD,mEAAmE;;IAEnE,0EAA0E;;IAE1E,uEAAuE;;IAEvE,+DAA+D;;IAE/D,sDAAsD;;IAEtD,gFAAgF;;IAEhF,mDAAmD;;IAEnD,0EAA0E;;IAE1E,4EAA4E;;CAEpE,CAAC"}
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
* one ordered entry point. The driver is intentionally THIN: it sequences the
|
|
49
49
|
* pre-existing helpers, it does not reimplement them.
|
|
50
50
|
*/
|
|
51
|
-
import { mountAllToolCommands } from './register-tools.js';
|
|
52
51
|
/**
|
|
53
52
|
* Canonical, ordered tool-lifecycle steps (launch, §5.4). The numeric
|
|
54
53
|
* values are the step ordinals used in the JSDoc above and in
|
|
@@ -78,26 +77,4 @@ export const TOOL_LIFECYCLE_STEPS = {
|
|
|
78
77
|
/** 10 — Commander dispatches the action body through the mount pipeline. */
|
|
79
78
|
dispatch: 10,
|
|
80
79
|
};
|
|
81
|
-
/**
|
|
82
|
-
* Drive the STARTUP-phase command-mount step (step 8) for every registered
|
|
83
|
-
* tool. By the time this runs, steps 1-4 have already populated `registry`
|
|
84
|
-
* inside {@link bootstrapCli} (provenance no longer matters — bundled and
|
|
85
|
-
* installed tools mount identically). This is the single ordered entry point
|
|
86
|
-
* the composition root calls for step 8, replacing the bare
|
|
87
|
-
* `mountAllToolCommands(...)` call so the lifecycle has one named seam.
|
|
88
|
-
*
|
|
89
|
-
* Kept THIN deliberately: it delegates straight to
|
|
90
|
-
* {@link mountAllToolCommands}, which mounts each tool's declared `commandSpecs`
|
|
91
|
-
* (the one command surface, launch) with per-tool failure isolation. The naming +
|
|
92
|
-
* ordering is the value here, not new logic.
|
|
93
|
-
*
|
|
94
|
-
* @param registry The per-invocation tool registry, already populated by
|
|
95
|
-
* steps 1-4.
|
|
96
|
-
* @param program The root Commander program (host-owned; passed in since the tool
|
|
97
|
-
* context no longer carries it, §8).
|
|
98
|
-
* @param ctx The per-invocation handler context handed to each mounted command.
|
|
99
|
-
*/
|
|
100
|
-
export function mountToolCommands(registry, program, ctx) {
|
|
101
|
-
mountAllToolCommands(registry, program, ctx);
|
|
102
|
-
}
|
|
103
80
|
//# sourceMappingURL=tool-lifecycle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-lifecycle.js","sourceRoot":"","sources":["../../src/bootstrap/tool-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH
|
|
1
|
+
{"version":3,"file":"tool-lifecycle.js","sourceRoot":"","sources":["../../src/bootstrap/tool-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,oDAAoD;IACpD,QAAQ,EAAE,CAAC;IACX,mEAAmE;IACnE,MAAM,EAAE,CAAC;IACT,0EAA0E;IAC1E,KAAK,EAAE,CAAC;IACR,uEAAuE;IACvE,MAAM,EAAE,CAAC;IACT,+DAA+D;IAC/D,MAAM,EAAE,CAAC;IACT,sDAAsD;IACtD,KAAK,EAAE,CAAC;IACR,gFAAgF;IAChF,YAAY,EAAE,CAAC;IACf,mDAAmD;IACnD,KAAK,EAAE,CAAC;IACR,0EAA0E;IAC1E,UAAU,EAAE,CAAC;IACb,4EAA4E;IAC5E,QAAQ,EAAE,EAAE;CACJ,CAAC"}
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* an arbitrary npm package and inspects whatever it exports.
|
|
5
5
|
*
|
|
6
6
|
* Verifies the minimal contract the registry depends on: a
|
|
7
|
-
* `metadata.id` string (used for dedupe + listing), a
|
|
8
|
-
*
|
|
7
|
+
* `metadata.id` string (used for dedupe + listing), and a command surface —
|
|
8
|
+
* a non-empty `commandSpecs` array (the one command
|
|
9
9
|
* surface as of launch; `register()` was removed). A tool with no `commandSpecs`
|
|
10
|
-
* cannot mount any command, so it fails the shape check.
|
|
11
|
-
* `
|
|
10
|
+
* cannot mount any command, so it fails the shape check. Lifecycle hooks belong
|
|
11
|
+
* under `extensionPoints` only — top-level hooks are rejected with an actionable
|
|
12
|
+
* diagnostic.
|
|
12
13
|
*
|
|
13
14
|
* Ordering vs. the admission gate: this shape check runs AFTER a
|
|
14
15
|
* tool's module is imported. The compatibility gate (`admitTool`) and the
|
|
@@ -18,5 +19,10 @@
|
|
|
18
19
|
* and never reaches `isValidTool`.
|
|
19
20
|
*/
|
|
20
21
|
import { type Tool } from '@opensip-cli/core';
|
|
22
|
+
/**
|
|
23
|
+
* Human-readable rejection reason for an exported `tool` value.
|
|
24
|
+
* `undefined` means the export satisfies {@link isValidTool}.
|
|
25
|
+
*/
|
|
26
|
+
export declare function toolValidationFailure(value: unknown): string | undefined;
|
|
21
27
|
export declare function isValidTool(value: unknown): value is Tool;
|
|
22
28
|
//# sourceMappingURL=validate-tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-tool.d.ts","sourceRoot":"","sources":["../../src/bootstrap/validate-tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validate-tool.d.ts","sourceRoot":"","sources":["../../src/bootstrap/validate-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAuB,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAuDnE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAqBxE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAEzD"}
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* an arbitrary npm package and inspects whatever it exports.
|
|
5
5
|
*
|
|
6
6
|
* Verifies the minimal contract the registry depends on: a
|
|
7
|
-
* `metadata.id` string (used for dedupe + listing), a
|
|
8
|
-
*
|
|
7
|
+
* `metadata.id` string (used for dedupe + listing), and a command surface —
|
|
8
|
+
* a non-empty `commandSpecs` array (the one command
|
|
9
9
|
* surface as of launch; `register()` was removed). A tool with no `commandSpecs`
|
|
10
|
-
* cannot mount any command, so it fails the shape check.
|
|
11
|
-
* `
|
|
10
|
+
* cannot mount any command, so it fails the shape check. Lifecycle hooks belong
|
|
11
|
+
* under `extensionPoints` only — top-level hooks are rejected with an actionable
|
|
12
|
+
* diagnostic.
|
|
12
13
|
*
|
|
13
14
|
* Ordering vs. the admission gate: this shape check runs AFTER a
|
|
14
15
|
* tool's module is imported. The compatibility gate (`admitTool`) and the
|
|
@@ -18,25 +19,78 @@
|
|
|
18
19
|
* and never reaches `isValidTool`.
|
|
19
20
|
*/
|
|
20
21
|
import { validateCommandSpec } from '@opensip-cli/core';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/** Top-level hook keys removed in the tool-author-simplify contract. */
|
|
23
|
+
const LEGACY_TOP_LEVEL_HOOK_KEYS = [
|
|
24
|
+
'initialize',
|
|
25
|
+
'contributeScope',
|
|
26
|
+
'collectReportData',
|
|
27
|
+
'sessionReplay',
|
|
28
|
+
'config',
|
|
29
|
+
'capabilityRegistrars',
|
|
30
|
+
'fingerprintStrategy',
|
|
31
|
+
'scaffoldExamples',
|
|
32
|
+
'stableExampleIds',
|
|
33
|
+
'scaffoldConfigBlock',
|
|
34
|
+
];
|
|
35
|
+
function legacyTopLevelHookKeys(candidate) {
|
|
36
|
+
return LEGACY_TOP_LEVEL_HOOK_KEYS.filter((key) => candidate[key] !== undefined);
|
|
37
|
+
}
|
|
38
|
+
function metadataValidationFailure(metadata) {
|
|
39
|
+
if (typeof metadata !== 'object' || metadata === null) {
|
|
40
|
+
return 'tool.metadata is missing or not an object';
|
|
41
|
+
}
|
|
42
|
+
if (typeof metadata.id !== 'string') {
|
|
43
|
+
return 'tool.metadata.id must be a string';
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
function commandSpecsValidationFailure(commandSpecs) {
|
|
48
|
+
if (!Array.isArray(commandSpecs) || commandSpecs.length === 0) {
|
|
49
|
+
return 'tool.commandSpecs must be a non-empty array (the declarative command surface)';
|
|
50
|
+
}
|
|
51
|
+
for (const spec of commandSpecs) {
|
|
52
|
+
if (!validateCommandSpec(spec)) {
|
|
53
|
+
return 'tool.commandSpecs contains an invalid CommandSpec';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
function optionalCommandsValidationFailure(commands) {
|
|
59
|
+
if (!Array.isArray(commands))
|
|
60
|
+
return undefined;
|
|
61
|
+
for (const cmd of commands) {
|
|
62
|
+
if (typeof cmd !== 'object' || cmd === null) {
|
|
63
|
+
return 'tool.commands contains a non-object entry';
|
|
64
|
+
}
|
|
65
|
+
if (typeof cmd.name !== 'string') {
|
|
66
|
+
return 'tool.commands entries must include a string name';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Human-readable rejection reason for an exported `tool` value.
|
|
73
|
+
* `undefined` means the export satisfies {@link isValidTool}.
|
|
74
|
+
*/
|
|
75
|
+
export function toolValidationFailure(value) {
|
|
76
|
+
if (typeof value !== 'object' || value === null) {
|
|
77
|
+
return 'tool export is not an object';
|
|
78
|
+
}
|
|
24
79
|
const candidate = value;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
// array (the one command surface, launch — `register()` was removed). A tool
|
|
33
|
-
// with no commandSpecs cannot contribute any command and is rejected.
|
|
34
|
-
if (!Array.isArray(candidate.commandSpecs) || candidate.commandSpecs.length === 0)
|
|
35
|
-
return false;
|
|
36
|
-
for (const spec of candidate.commandSpecs) {
|
|
37
|
-
if (!validateCommandSpec(spec))
|
|
38
|
-
return false;
|
|
80
|
+
const metadataFailure = metadataValidationFailure(candidate.metadata);
|
|
81
|
+
if (metadataFailure !== undefined)
|
|
82
|
+
return metadataFailure;
|
|
83
|
+
const legacy = legacyTopLevelHookKeys(candidate);
|
|
84
|
+
if (legacy.length > 0) {
|
|
85
|
+
return (`tool declares deprecated top-level hooks [${legacy.join(', ')}]; ` +
|
|
86
|
+
'move them under extensionPoints (see opensip tool authoring docs)');
|
|
39
87
|
}
|
|
40
|
-
|
|
88
|
+
const specsFailure = commandSpecsValidationFailure(candidate.commandSpecs);
|
|
89
|
+
if (specsFailure !== undefined)
|
|
90
|
+
return specsFailure;
|
|
91
|
+
return optionalCommandsValidationFailure(candidate.commands);
|
|
92
|
+
}
|
|
93
|
+
export function isValidTool(value) {
|
|
94
|
+
return toolValidationFailure(value) === undefined;
|
|
41
95
|
}
|
|
42
96
|
//# sourceMappingURL=validate-tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-tool.js","sourceRoot":"","sources":["../../src/bootstrap/validate-tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validate-tool.js","sourceRoot":"","sources":["../../src/bootstrap/validate-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,mBAAmB,EAAa,MAAM,mBAAmB,CAAC;AAEnE,wEAAwE;AACxE,MAAM,0BAA0B,GAAG;IACjC,YAAY;IACZ,iBAAiB;IACjB,mBAAmB;IACnB,eAAe;IACf,QAAQ;IACR,sBAAsB;IACtB,qBAAqB;IACrB,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;CACb,CAAC;AAEX,SAAS,sBAAsB,CAAC,SAAkC;IAChE,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC;AAClF,CAAC;AAED,SAAS,yBAAyB,CAAC,QAAiB;IAClD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtD,OAAO,2CAA2C,CAAC;IACrD,CAAC;IACD,IAAI,OAAQ,QAA6B,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;QAC1D,OAAO,mCAAmC,CAAC;IAC7C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,6BAA6B,CAAC,YAAqB;IAC1D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9D,OAAO,+EAA+E,CAAC;IACzF,CAAC;IACD,KAAK,MAAM,IAAI,IAA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AE,OAAO,YAAY,CAAC;IAEpD,OAAO,iCAAiC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,qBAAqB,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;AACpD,CAAC"}
|
package/dist/cli-context.d.ts
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
* `.runtime/datastore.sqlite`.
|
|
18
18
|
*/
|
|
19
19
|
import { type Logger, type ToolCliContext } from '@opensip-cli/core';
|
|
20
|
-
import { type LiveViewRegistry } from './bootstrap/
|
|
20
|
+
import { type LiveViewRegistry } from './bootstrap/io-plane.js';
|
|
21
21
|
import type { CommandResult } from '@opensip-cli/contracts';
|
|
22
22
|
export { buildDatastoreThunk, getCurrentProjectRoot, getOrOpenDatastore, } from './bootstrap/scope-access.js';
|
|
23
|
-
export { createLiveViewRegistry, type LiveViewRegistry } from './bootstrap/
|
|
23
|
+
export { createLiveViewRegistry, type LiveViewRegistry } from './bootstrap/io-plane.js';
|
|
24
24
|
export interface BuildToolCliContextOptions {
|
|
25
25
|
readonly render: (result: CommandResult) => Promise<void>;
|
|
26
26
|
readonly liveViews: LiveViewRegistry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-context.d.ts","sourceRoot":"","sources":["../src/cli-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-context.d.ts","sourceRoot":"","sources":["../src/cli-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAW/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAmB5D,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAExF,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,eAAe,EAAE,CAAC,IAAI,EAAE;QAC/B,aAAa,EAAE,OAAO,CAAC;QACvB,UAAU,EAAE,OAAO,CAAC;KACrB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CAChD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,0BAA0B,GAAG,oBAAoB,CAgF1F"}
|