opensip-cli 0.1.12 → 0.1.13
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/artifact-seams.d.ts +7 -0
- package/dist/bootstrap/artifact-seams.d.ts.map +1 -0
- package/dist/bootstrap/artifact-seams.js +53 -0
- package/dist/bootstrap/artifact-seams.js.map +1 -0
- package/dist/bootstrap/atomic-artifact-write.d.ts +19 -0
- package/dist/bootstrap/atomic-artifact-write.d.ts.map +1 -0
- package/dist/bootstrap/atomic-artifact-write.js +68 -0
- package/dist/bootstrap/atomic-artifact-write.js.map +1 -0
- package/dist/bootstrap/baseline-seams.d.ts.map +1 -1
- package/dist/bootstrap/baseline-seams.js +79 -27
- package/dist/bootstrap/baseline-seams.js.map +1 -1
- package/dist/bootstrap/build-external-worker-child-env.d.ts +25 -0
- package/dist/bootstrap/build-external-worker-child-env.d.ts.map +1 -0
- package/dist/bootstrap/build-external-worker-child-env.js +71 -0
- package/dist/bootstrap/build-external-worker-child-env.js.map +1 -0
- package/dist/bootstrap/build-per-run-scope.js +1 -1
- package/dist/bootstrap/build-per-run-scope.js.map +1 -1
- package/dist/bootstrap/config-and-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/config-and-capabilities.js +12 -94
- package/dist/bootstrap/config-and-capabilities.js.map +1 -1
- package/dist/bootstrap/config-declarations.d.ts +23 -0
- package/dist/bootstrap/config-declarations.d.ts.map +1 -0
- package/dist/bootstrap/config-declarations.js +73 -0
- package/dist/bootstrap/config-declarations.js.map +1 -0
- package/dist/bootstrap/deliver-envelope.d.ts +4 -1
- package/dist/bootstrap/deliver-envelope.d.ts.map +1 -1
- package/dist/bootstrap/deliver-envelope.js +12 -5
- package/dist/bootstrap/deliver-envelope.js.map +1 -1
- package/dist/bootstrap/dispatch-fork-core.d.ts +1 -1
- package/dist/bootstrap/dispatch-fork-core.d.ts.map +1 -1
- package/dist/bootstrap/dispatch-fork-core.js +73 -75
- package/dist/bootstrap/dispatch-fork-core.js.map +1 -1
- package/dist/bootstrap/dispatch-host-rpc-handler.d.ts.map +1 -1
- package/dist/bootstrap/dispatch-host-rpc-handler.js +4 -0
- package/dist/bootstrap/dispatch-host-rpc-handler.js.map +1 -1
- package/dist/bootstrap/dispatch-replay-result.d.ts.map +1 -1
- package/dist/bootstrap/dispatch-replay-result.js +3 -0
- package/dist/bootstrap/dispatch-replay-result.js.map +1 -1
- package/dist/bootstrap/load-tool-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/load-tool-capabilities.js +34 -3
- package/dist/bootstrap/load-tool-capabilities.js.map +1 -1
- package/dist/bootstrap/register-tools-discovery.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-discovery.js +2 -0
- package/dist/bootstrap/register-tools-discovery.js.map +1 -1
- package/dist/bootstrap/report-failure.d.ts +28 -0
- package/dist/bootstrap/report-failure.d.ts.map +1 -0
- package/dist/bootstrap/report-failure.js +135 -0
- package/dist/bootstrap/report-failure.js.map +1 -0
- package/dist/bootstrap/scope-access.d.ts +1 -1
- package/dist/bootstrap/scope-access.d.ts.map +1 -1
- package/dist/bootstrap/scope-access.js +7 -2
- package/dist/bootstrap/scope-access.js.map +1 -1
- package/dist/bootstrap/state-lock-policy.d.ts +19 -0
- package/dist/bootstrap/state-lock-policy.d.ts.map +1 -0
- package/dist/bootstrap/state-lock-policy.js +86 -0
- package/dist/bootstrap/state-lock-policy.js.map +1 -0
- package/dist/bootstrap/synthesize-external-tool.d.ts.map +1 -1
- package/dist/bootstrap/synthesize-external-tool.js +11 -1
- package/dist/bootstrap/synthesize-external-tool.js.map +1 -1
- package/dist/bootstrap/tool-command-dispatch-types.d.ts +23 -2
- package/dist/bootstrap/tool-command-dispatch-types.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-context.d.ts +4 -3
- package/dist/bootstrap/tool-command-worker-context.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-context.js +28 -4
- package/dist/bootstrap/tool-command-worker-context.js.map +1 -1
- package/dist/bootstrap/tool-command-worker-entry.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-entry.js +38 -31
- package/dist/bootstrap/tool-command-worker-entry.js.map +1 -1
- package/dist/bootstrap/tool-command-worker-result.d.ts +25 -0
- package/dist/bootstrap/tool-command-worker-result.d.ts.map +1 -0
- package/dist/bootstrap/tool-command-worker-result.js +60 -0
- package/dist/bootstrap/tool-command-worker-result.js.map +1 -0
- package/dist/bootstrap/tool-trust.d.ts +12 -0
- package/dist/bootstrap/tool-trust.d.ts.map +1 -1
- package/dist/bootstrap/tool-trust.js +29 -5
- package/dist/bootstrap/tool-trust.js.map +1 -1
- package/dist/cli-context.d.ts.map +1 -1
- package/dist/cli-context.js +22 -3
- package/dist/cli-context.js.map +1 -1
- package/dist/commands/agent-catalog.d.ts +8 -7
- package/dist/commands/agent-catalog.d.ts.map +1 -1
- package/dist/commands/agent-catalog.js +108 -60
- package/dist/commands/agent-catalog.js.map +1 -1
- package/dist/commands/config.d.ts +22 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +135 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/host-command-specs.d.ts.map +1 -1
- package/dist/commands/host-command-specs.js +8 -4
- package/dist/commands/host-command-specs.js.map +1 -1
- package/dist/commands/host-subcommand-config.d.ts +7 -0
- package/dist/commands/host-subcommand-config.d.ts.map +1 -0
- package/dist/commands/host-subcommand-config.js +75 -0
- package/dist/commands/host-subcommand-config.js.map +1 -0
- package/dist/commands/host-subcommand-groups.d.ts.map +1 -1
- package/dist/commands/host-subcommand-groups.js +7 -1
- package/dist/commands/host-subcommand-groups.js.map +1 -1
- package/dist/commands/host-subcommand-sessions.d.ts.map +1 -1
- package/dist/commands/host-subcommand-sessions.js +3 -3
- package/dist/commands/host-subcommand-sessions.js.map +1 -1
- package/dist/commands/init/language-detection.d.ts.map +1 -1
- package/dist/commands/init/language-detection.js +3 -2
- package/dist/commands/init/language-detection.js.map +1 -1
- package/dist/commands/init.d.ts +5 -4
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +5 -4
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mount-command-spec.d.ts +3 -1
- package/dist/commands/mount-command-spec.d.ts.map +1 -1
- package/dist/commands/mount-command-spec.js +27 -4
- package/dist/commands/mount-command-spec.js.map +1 -1
- package/dist/commands/shared.d.ts +5 -1
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/tools/create-template-writer.d.ts +16 -0
- package/dist/commands/tools/create-template-writer.d.ts.map +1 -0
- package/dist/commands/tools/create-template-writer.js +39 -0
- package/dist/commands/tools/create-template-writer.js.map +1 -0
- package/dist/commands/tools/create-templates.d.ts +19 -0
- package/dist/commands/tools/create-templates.d.ts.map +1 -0
- package/dist/commands/tools/create-templates.js +228 -0
- package/dist/commands/tools/create-templates.js.map +1 -0
- package/dist/commands/tools/create.d.ts +4 -1
- package/dist/commands/tools/create.d.ts.map +1 -1
- package/dist/commands/tools/create.js +35 -50
- package/dist/commands/tools/create.js.map +1 -1
- package/dist/commands/tools/index.d.ts.map +1 -1
- package/dist/commands/tools/index.js +8 -0
- package/dist/commands/tools/index.js.map +1 -1
- package/dist/commands/tools/install.d.ts.map +1 -1
- package/dist/commands/tools/install.js +14 -1
- package/dist/commands/tools/install.js.map +1 -1
- package/dist/commands/tools/validate.d.ts.map +1 -1
- package/dist/commands/tools/validate.js +46 -5
- package/dist/commands/tools/validate.js.map +1 -1
- package/dist/env/host-env-specs.d.ts.map +1 -1
- package/dist/env/host-env-specs.js +57 -4
- package/dist/env/host-env-specs.js.map +1 -1
- package/dist/error-handler.d.ts.map +1 -1
- package/dist/error-handler.js +28 -6
- package/dist/error-handler.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/report-compose.d.ts.map +1 -1
- package/dist/report-compose.js +21 -3
- package/dist/report-compose.js.map +1 -1
- package/dist/ui/result-to-view.d.ts.map +1 -1
- package/dist/ui/result-to-view.js +10 -1
- package/dist/ui/result-to-view.js.map +1 -1
- package/dist/ui/views/misc-views.d.ts +13 -0
- package/dist/ui/views/misc-views.d.ts.map +1 -1
- package/dist/ui/views/misc-views.js +53 -1
- package/dist/ui/views/misc-views.js.map +1 -1
- package/dist/ui/views/tools-views.d.ts.map +1 -1
- package/dist/ui/views/tools-views.js +8 -7
- package/dist/ui/views/tools-views.js.map +1 -1
- package/dist/update-notifier.d.ts +3 -0
- package/dist/update-notifier.d.ts.map +1 -1
- package/dist/update-notifier.js +3 -0
- package/dist/update-notifier.js.map +1 -1
- package/package.json +33 -33
|
@@ -32,8 +32,12 @@ export const PROJECT_TOOL_ALLOWLIST_ENV = 'OPENSIP_CLI_ALLOW_PROJECT_TOOLS';
|
|
|
32
32
|
* {@link isInstalledToolTrusted}).
|
|
33
33
|
*/
|
|
34
34
|
export const INSTALLED_TOOL_ALLOWLIST_ENV = 'OPENSIP_CLI_ALLOW_INSTALLED_TOOLS';
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Environment variable carrying the capability-pack allowlist. Unlike the older
|
|
37
|
+
* tool allowlists, this launch surface is exact-name only: wildcard `*` is not
|
|
38
|
+
* honored.
|
|
39
|
+
*/
|
|
40
|
+
export const CAPABILITY_PACK_ALLOWLIST_ENV = 'OPENSIP_CLI_ALLOW_CAPABILITY_PACKS';
|
|
37
41
|
/**
|
|
38
42
|
* Parse the allowlist env var into a set of permitted tool ids. Empty/
|
|
39
43
|
* unset ⇒ empty set (deny-by-default). The wildcard `'*'` admits all
|
|
@@ -48,13 +52,23 @@ function parseAllowlist(raw) {
|
|
|
48
52
|
.filter((s) => s.length > 0));
|
|
49
53
|
}
|
|
50
54
|
function warnWildcardAllowlist(envVar, allow) {
|
|
51
|
-
if (
|
|
55
|
+
if (!allow.has('*'))
|
|
52
56
|
return;
|
|
53
|
-
wildcardAllowlistWarned = true;
|
|
54
57
|
logger.warn({
|
|
55
58
|
evt: 'cli.trust.wildcard_allowlist',
|
|
56
59
|
envVar,
|
|
57
|
-
|
|
60
|
+
deprecated: true,
|
|
61
|
+
detail: 'DEPRECATED: trust allowlist contains wildcard * — every matching tool runs at full user privilege; ' +
|
|
62
|
+
'this is fault-isolation only, not a sandbox',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function warnIgnoredCapabilityWildcard(allow) {
|
|
66
|
+
if (!allow.has('*'))
|
|
67
|
+
return;
|
|
68
|
+
logger.warn({
|
|
69
|
+
evt: 'cli.trust.capability_wildcard_ignored',
|
|
70
|
+
envVar: CAPABILITY_PACK_ALLOWLIST_ENV,
|
|
71
|
+
detail: 'OPENSIP_CLI_ALLOW_CAPABILITY_PACKS requires exact package names; wildcard * is ignored',
|
|
58
72
|
});
|
|
59
73
|
}
|
|
60
74
|
/**
|
|
@@ -100,4 +114,14 @@ export function isInstalledToolTrusted(id, env = process.env) {
|
|
|
100
114
|
warnWildcardAllowlist(INSTALLED_TOOL_ALLOWLIST_ENV, allow);
|
|
101
115
|
return allow.has('*') || allow.has(id);
|
|
102
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Decide whether a third-party capability pack may be imported into the host
|
|
119
|
+
* process. First-party bundled packs are handled by the caller; this predicate
|
|
120
|
+
* is exact-name allowlist only and intentionally does not honor `*`.
|
|
121
|
+
*/
|
|
122
|
+
export function isCapabilityPackTrusted(packageName, env = process.env) {
|
|
123
|
+
const allow = parseAllowlist(env[CAPABILITY_PACK_ALLOWLIST_ENV]);
|
|
124
|
+
warnIgnoredCapabilityWildcard(allow);
|
|
125
|
+
return allow.has(packageName);
|
|
126
|
+
}
|
|
103
127
|
//# sourceMappingURL=tool-trust.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-trust.js","sourceRoot":"","sources":["../../src/bootstrap/tool-trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;GAoBG;A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AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"cli-context.d.ts","sourceRoot":"","sources":["../src/cli-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAKL,KAAK,MAAM,EACX,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAY/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,CA6F1F;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAmCpE"}
|
package/dist/cli-context.js
CHANGED
|
@@ -16,11 +16,13 @@
|
|
|
16
16
|
* lands on `RunScope.datastore`; paths that never touch it never materialise
|
|
17
17
|
* `.runtime/datastore.sqlite`.
|
|
18
18
|
*/
|
|
19
|
-
import { createRunTimer, logger as defaultLogger, } from '@opensip-cli/core';
|
|
19
|
+
import { createRunTimer, currentScope, logger as defaultLogger, } from '@opensip-cli/core';
|
|
20
|
+
import { createWriteArtifactSeam } from './bootstrap/artifact-seams.js';
|
|
20
21
|
import { buildBaselineSeams } from './bootstrap/baseline-seams.js';
|
|
21
22
|
import { buildHostPlanes } from './bootstrap/host-planes.js';
|
|
22
23
|
import { createIoPlane } from './bootstrap/io-plane.js';
|
|
23
24
|
import { createOutputPlane } from './bootstrap/output-plane.js';
|
|
25
|
+
import { createReportFailure } from './bootstrap/report-failure.js';
|
|
24
26
|
import { createRunActionHooks, createRunPlaneFactory, createRunSessionSeam, } from './bootstrap/run-plane.js';
|
|
25
27
|
import { createDatastoreResolver, readScope } from './bootstrap/scope-access.js';
|
|
26
28
|
import { buildStateSeams } from './bootstrap/state-seams.js';
|
|
@@ -55,6 +57,7 @@ export function buildToolCliContext(opts) {
|
|
|
55
57
|
// - effectful egress (cloud sync + `--report-to` + SARIF file sink).
|
|
56
58
|
const projectDatastore = createDatastoreResolver('project-seam', log);
|
|
57
59
|
const baselineSeams = buildBaselineSeams({ getDatastore: projectDatastore, logger: log });
|
|
60
|
+
const writeArtifact = createWriteArtifactSeam(log);
|
|
58
61
|
const stateSeams = buildStateSeams({ getDatastore: projectDatastore });
|
|
59
62
|
const hostPlanes = buildHostPlanes({ getDatastore: projectDatastore, logger: log });
|
|
60
63
|
// Host run-lifecycle plane (host-owned-run-timing Phase 1). The FACTORY holds
|
|
@@ -81,6 +84,13 @@ export function buildToolCliContext(opts) {
|
|
|
81
84
|
runPlane,
|
|
82
85
|
runSession,
|
|
83
86
|
});
|
|
87
|
+
const reportFailure = createReportFailure({
|
|
88
|
+
getLogger: () => currentScope()?.logger ?? log,
|
|
89
|
+
setExitCode: outputPlane.setExitCode,
|
|
90
|
+
render: (result) => opts.render(result),
|
|
91
|
+
emitError: outputPlane.emits.emitError,
|
|
92
|
+
getDiagnostics: () => currentScope()?.diagnostics,
|
|
93
|
+
});
|
|
84
94
|
const ctx = {
|
|
85
95
|
get scope() {
|
|
86
96
|
// The pre-action-hook (or explicit runWithScope in tests) enters the
|
|
@@ -93,11 +103,15 @@ export function buildToolCliContext(opts) {
|
|
|
93
103
|
registerLiveView: ioPlane.register,
|
|
94
104
|
renderLive: ioPlane.renderLive,
|
|
95
105
|
maybeOpenReport: opts.maybeOpenReport,
|
|
96
|
-
logger
|
|
106
|
+
get logger() {
|
|
107
|
+
return currentScope()?.logger ?? log;
|
|
108
|
+
},
|
|
109
|
+
reportFailure,
|
|
97
110
|
setExitCode: outputPlane.setExitCode,
|
|
98
111
|
...outputPlane.emits, // emitJson / emitEnvelope / emitError / emitRaw
|
|
99
112
|
deliverSignals: ioPlane.deliverSignals,
|
|
100
113
|
writeSarif: ioPlane.writeSarif,
|
|
114
|
+
writeArtifact,
|
|
101
115
|
// Host baseline/ratchet plane seams (ADR-0036) — persistence + diff + exports.
|
|
102
116
|
saveBaseline: baselineSeams.saveBaseline,
|
|
103
117
|
compareBaseline: baselineSeams.compareBaseline,
|
|
@@ -136,6 +150,7 @@ export function buildHostDispatchCtx(logger) {
|
|
|
136
150
|
const log = logger ?? defaultLogger;
|
|
137
151
|
const projectDatastore = createDatastoreResolver('project-seam', log);
|
|
138
152
|
const baselineSeams = buildBaselineSeams({ getDatastore: projectDatastore, logger: log });
|
|
153
|
+
const writeArtifact = createWriteArtifactSeam(log);
|
|
139
154
|
const stateSeams = buildStateSeams({ getDatastore: projectDatastore });
|
|
140
155
|
const hostPlanes = buildHostPlanes({ getDatastore: projectDatastore, logger: log });
|
|
141
156
|
const outputPlane = createOutputPlane({ render: deniedHookSeam('render'), logger: log });
|
|
@@ -147,13 +162,17 @@ export function buildHostDispatchCtx(logger) {
|
|
|
147
162
|
registerLiveView: deniedHookSeam('registerLiveView'),
|
|
148
163
|
renderLive: deniedHookSeam('renderLive'),
|
|
149
164
|
maybeOpenReport: deniedHookSeam('maybeOpenReport'),
|
|
150
|
-
logger
|
|
165
|
+
get logger() {
|
|
166
|
+
return currentScope()?.logger ?? log;
|
|
167
|
+
},
|
|
168
|
+
reportFailure: deniedHookSeam('reportFailure'),
|
|
151
169
|
setExitCode: outputPlane.setExitCode,
|
|
152
170
|
...outputPlane.emits,
|
|
153
171
|
// Display-only timing seam (host-owned-run-timing); a hook never records a run.
|
|
154
172
|
runSession: { timing: createRunTimer() },
|
|
155
173
|
deliverSignals: deniedHookSeam('deliverSignals'),
|
|
156
174
|
writeSarif: deniedHookSeam('writeSarif'),
|
|
175
|
+
writeArtifact,
|
|
157
176
|
saveBaseline: baselineSeams.saveBaseline,
|
|
158
177
|
compareBaseline: baselineSeams.compareBaseline,
|
|
159
178
|
exportBaselineSarif: baselineSeams.exportBaselineSarif,
|
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,EACL,cAAc,
|
|
1
|
+
{"version":3,"file":"cli-context.js","sourceRoot":"","sources":["../src/cli-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,cAAc,EACd,YAAY,EAEZ,MAAM,IAAI,aAAa,GAGxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,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,EAAE,mBAAmB,EAAE,MAAM,+B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ACb,4BAA4B,IAAI,oDAAoD,CACrF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
* This is intentionally a small, self-contained surface so agents can
|
|
6
6
|
* bootstrap their usage without parsing --help text or source.
|
|
7
7
|
*
|
|
8
|
-
* Future: can be made more dynamic by introspecting live CommandSpecs
|
|
9
|
-
* (see completion.ts for precedent).
|
|
10
|
-
*
|
|
11
8
|
* Command taxonomy (tool-command-surface-taxonomy):
|
|
12
9
|
* - Entry points are keyed by the PUBLIC command path. A `parent`-nested tool
|
|
13
10
|
* verb (the `<tool> <verb>` grammar enabled by `CommandSpec.parent` — e.g.
|
|
@@ -17,9 +14,8 @@
|
|
|
17
14
|
* `*-equivalence-check`) are NEVER catalogued here — the agent-catalog
|
|
18
15
|
* primary surface excludes internal workers (the host-owned tiering pass
|
|
19
16
|
* 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
17
|
*/
|
|
18
|
+
import type { ToolRegistry } from '@opensip-cli/core';
|
|
23
19
|
/**
|
|
24
20
|
* The command-taxonomy tier an entry point belongs to
|
|
25
21
|
* (tool-command-surface-taxonomy). `'platform'` = host-owned Tier-1 commands
|
|
@@ -57,9 +53,14 @@ export interface AgentCatalog {
|
|
|
57
53
|
};
|
|
58
54
|
readonly notes: readonly string[];
|
|
59
55
|
}
|
|
60
|
-
export declare function buildAgentCatalog(
|
|
56
|
+
export declare function buildAgentCatalog(input?: {
|
|
57
|
+
readonly tools?: ToolRegistry;
|
|
58
|
+
readonly internalCommands?: ReadonlySet<string>;
|
|
59
|
+
}): AgentCatalog;
|
|
61
60
|
export declare function executeAgentCatalog(opts?: {
|
|
62
|
-
json?: boolean;
|
|
61
|
+
readonly json?: boolean;
|
|
62
|
+
readonly tools?: ToolRegistry;
|
|
63
|
+
readonly internalCommands?: ReadonlySet<string>;
|
|
63
64
|
}): {
|
|
64
65
|
type: string;
|
|
65
66
|
catalog: AgentCatalog;
|
|
@@ -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;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAqB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACzE;;;;;;;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;AAqID,wBAAgB,iBAAiB,CAC/B,KAAK,GAAE;IACL,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC5C,GACL,YAAY,CAmEd;AAED,wBAAgB,mBAAmB,CACjC,IAAI,GAAE;IACJ,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC5C;;;;;;;;;;EAkCP"}
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured catalog for AI agents.
|
|
3
|
+
* Provides stable entry points, recommended patterns (including the new
|
|
4
|
+
* agent ergonomics like --filter, --raw, --summary-only), and example shapes.
|
|
5
|
+
* This is intentionally a small, self-contained surface so agents can
|
|
6
|
+
* bootstrap their usage without parsing --help text or source.
|
|
7
|
+
*
|
|
8
|
+
* Command taxonomy (tool-command-surface-taxonomy):
|
|
9
|
+
* - Entry points are keyed by the PUBLIC command path. A `parent`-nested tool
|
|
10
|
+
* verb (the `<tool> <verb>` grammar enabled by `CommandSpec.parent` — e.g.
|
|
11
|
+
* `graph export`, `fit list`) is catalogued UNDER its tool's entry point
|
|
12
|
+
* (the `<tool> <verb>` form), NOT as a separate root entry point.
|
|
13
|
+
* - Tier-3 `visibility: 'internal'` commands (`*-run-worker`, `*-shard-worker`,
|
|
14
|
+
* `*-equivalence-check`) are NEVER catalogued here — the agent-catalog
|
|
15
|
+
* primary surface excludes internal workers (the host-owned tiering pass
|
|
16
|
+
* formalized in Phase 1 filters them when this surface becomes spec-derived).
|
|
17
|
+
*/
|
|
1
18
|
/**
|
|
2
19
|
* Internal (Tier-3) command-name shapes the agent-catalog must NEVER surface:
|
|
3
20
|
* the IPC/CI workers and the equivalence gate. The guard checks both the name
|
|
@@ -5,6 +22,13 @@
|
|
|
5
22
|
* either route. This is the by-construction complement to the Phase 4 test.
|
|
6
23
|
*/
|
|
7
24
|
const INTERNAL_COMMAND_NAME_RE = /(?:-run-worker|-shard-worker|-equivalence-check)\b/;
|
|
25
|
+
function compareCodePoint(left, right) {
|
|
26
|
+
if (left < right)
|
|
27
|
+
return -1;
|
|
28
|
+
if (left > right)
|
|
29
|
+
return 1;
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
8
32
|
/**
|
|
9
33
|
* Throw if any entry point is a Tier-3 internal command (by name shape or by an
|
|
10
34
|
* explicit `tier: 'internal'`). Called at catalog-build time so a regression that
|
|
@@ -22,62 +46,82 @@ function assertNoInternalEntryPoints(entryPoints) {
|
|
|
22
46
|
'agent-catalog primary surface (tool-command-surface-taxonomy). Remove it from entryPoints.');
|
|
23
47
|
}
|
|
24
48
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
49
|
+
const TOOL_ENTRY_OVERLAYS = {
|
|
50
|
+
fitness: {
|
|
51
|
+
description: 'Run fitness checks. Use --json for machine output (SignalEnvelope). Alias: fit.',
|
|
52
|
+
examples: ['opensip fitness --recipe default --json', 'opensip fit --check some-check --json'],
|
|
53
|
+
},
|
|
54
|
+
graph: {
|
|
55
|
+
description: 'Build static call graph + rules. --json yields SignalEnvelope.',
|
|
56
|
+
examples: ['opensip graph --json', 'opensip graph --sarif out.sarif'],
|
|
57
|
+
},
|
|
58
|
+
sim: {
|
|
59
|
+
description: 'Run simulation scenarios. Use --json for machine output (SignalEnvelope).',
|
|
60
|
+
examples: ['opensip sim --json', 'opensip sim --scenario default --json'],
|
|
61
|
+
},
|
|
62
|
+
yagni: {
|
|
63
|
+
description: 'Run YAGNI reduction audit detectors. Advisory findings; --json yields SignalEnvelope.',
|
|
64
|
+
examples: ['opensip yagni --json', 'opensip yagni --json packages/yagni/engine'],
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
const PLATFORM_ENTRY_POINTS = [
|
|
68
|
+
{
|
|
69
|
+
command: 'sessions list',
|
|
70
|
+
description: 'List stored sessions. --summary-only is agent-friendly (omits heavy payloads).',
|
|
71
|
+
examples: [
|
|
72
|
+
'opensip sessions list --json --summary-only',
|
|
73
|
+
'opensip sessions list --json --tool fitness --limit 5',
|
|
74
|
+
],
|
|
75
|
+
tier: 'platform',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
command: 'sessions show',
|
|
79
|
+
description: 'Retrieve a prior run as SessionReplayResult (includes projected SignalEnvelope). ' +
|
|
80
|
+
'Supports latest + --tool and rich filtering.',
|
|
81
|
+
examples: [
|
|
82
|
+
'opensip sessions show latest --tool fitness --json',
|
|
83
|
+
'opensip sessions show latest --tool fit --json --filter errors-only --filter top:20',
|
|
84
|
+
'opensip sessions show GRAPH_01... --json --raw',
|
|
85
|
+
'opensip sessions show previous --tool graph --json',
|
|
86
|
+
],
|
|
87
|
+
tier: 'platform',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
command: 'agent-catalog',
|
|
91
|
+
description: 'This command. Self-describing catalog for agents (JSON preferred).',
|
|
92
|
+
examples: ['opensip agent-catalog --json'],
|
|
93
|
+
tier: 'platform',
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
function publicPrimaryCommand(tool, internalCommands) {
|
|
97
|
+
return (tool.commandSpecs ?? []).find((spec) => spec.parent === undefined &&
|
|
98
|
+
spec.visibility !== 'internal' &&
|
|
99
|
+
!internalCommands.has(spec.name) &&
|
|
100
|
+
!INTERNAL_COMMAND_NAME_RE.test(spec.name));
|
|
101
|
+
}
|
|
102
|
+
function entryPointForTool(tool, internalCommands) {
|
|
103
|
+
const primary = publicPrimaryCommand(tool, internalCommands);
|
|
104
|
+
if (primary === undefined)
|
|
105
|
+
return undefined;
|
|
106
|
+
const overlay = TOOL_ENTRY_OVERLAYS[primary.name] ?? TOOL_ENTRY_OVERLAYS[tool.metadata.name];
|
|
107
|
+
return {
|
|
108
|
+
command: primary.name,
|
|
109
|
+
description: overlay?.description ??
|
|
110
|
+
`${primary.description} Use --json when available for machine output.`,
|
|
111
|
+
examples: overlay?.examples ?? [`opensip ${primary.name} --json`],
|
|
112
|
+
tier: 'tool',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function deriveToolEntryPoints(tools, internalCommands) {
|
|
116
|
+
return (tools?.list() ?? [])
|
|
117
|
+
.map((tool) => entryPointForTool(tool, internalCommands))
|
|
118
|
+
.filter((entry) => entry !== undefined)
|
|
119
|
+
.sort((a, b) => compareCodePoint(a.command, b.command));
|
|
120
|
+
}
|
|
121
|
+
export function buildAgentCatalog(input = {}) {
|
|
32
122
|
const entryPoints = [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
description: 'Run fitness checks. Use --json for machine output (SignalEnvelope). Alias: fit.',
|
|
36
|
-
examples: [
|
|
37
|
-
'opensip fitness --recipe default --json',
|
|
38
|
-
'opensip fit --check some-check --json',
|
|
39
|
-
],
|
|
40
|
-
tier: 'tool',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
command: 'graph',
|
|
44
|
-
description: 'Build static call graph + rules. --json yields SignalEnvelope.',
|
|
45
|
-
examples: ['opensip graph --json', 'opensip graph --sarif out.sarif'],
|
|
46
|
-
tier: 'tool',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
command: 'yagni',
|
|
50
|
-
description: 'Run YAGNI reduction audit detectors. Advisory findings; --json yields SignalEnvelope.',
|
|
51
|
-
examples: ['opensip yagni --json', 'opensip yagni --json packages/yagni/engine'],
|
|
52
|
-
tier: 'tool',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
command: 'sessions list',
|
|
56
|
-
description: 'List stored sessions. --summary-only is agent-friendly (omits heavy payloads).',
|
|
57
|
-
examples: [
|
|
58
|
-
'opensip sessions list --json --summary-only',
|
|
59
|
-
'opensip sessions list --json --tool fitness --limit 5',
|
|
60
|
-
],
|
|
61
|
-
tier: 'platform',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
command: 'sessions show',
|
|
65
|
-
description: 'Retrieve a prior run as SessionReplayResult (includes projected SignalEnvelope). ' +
|
|
66
|
-
'Supports latest + --tool and rich filtering.',
|
|
67
|
-
examples: [
|
|
68
|
-
'opensip sessions show latest --tool fitness --json',
|
|
69
|
-
'opensip sessions show latest --tool fit --json --filter errors-only --filter top:20',
|
|
70
|
-
'opensip sessions show GRAPH_01... --json --raw',
|
|
71
|
-
'opensip sessions show previous --tool graph --json',
|
|
72
|
-
],
|
|
73
|
-
tier: 'platform',
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
command: 'agent-catalog',
|
|
77
|
-
description: 'This command. Self-describing catalog for agents (JSON preferred).',
|
|
78
|
-
examples: ['opensip agent-catalog --json'],
|
|
79
|
-
tier: 'platform',
|
|
80
|
-
},
|
|
123
|
+
...deriveToolEntryPoints(input.tools, input.internalCommands ?? new Set()),
|
|
124
|
+
...PLATFORM_ENTRY_POINTS,
|
|
81
125
|
];
|
|
82
126
|
assertNoInternalEntryPoints(entryPoints);
|
|
83
127
|
return {
|
|
@@ -120,22 +164,26 @@ export function buildAgentCatalog() {
|
|
|
120
164
|
'The fidelity field on replays is always "projection" (rebuilt from persisted data).',
|
|
121
165
|
'Human-readable output (no --json) uses the same tables/banners as before — unchanged.',
|
|
122
166
|
// Uniform tool-primary surface (host-guaranteed; decorateToolPrimary).
|
|
123
|
-
'Every tool primary (fit/graph/sim and any third-party tool) accepts `<tool> --version` ' +
|
|
167
|
+
'Every tool primary (fit/graph/sim/yagni and any third-party tool) accepts `<tool> --version` ' +
|
|
124
168
|
'(prints the TOOL version, e.g. `fit 0.1.6`; distinct from `opensip --version`, the CLI), ' +
|
|
125
169
|
'plus the guaranteed baseline flags --cwd, --json, --config, --quiet, --verbose.',
|
|
126
170
|
'Dogfood gate requires 0 errors + 0 warnings on fit:ci and graph:ci after any change.',
|
|
127
171
|
// Hygiene invariant (host-planes-scope-seams-hygiene Phases 2-4): everything runs inside an
|
|
128
172
|
// entered RunScope; the only sanctioned seams for output, delivery, baselines, toolState,
|
|
129
173
|
// and hostPlanes (governance/audit/entitlements) are the documented methods on ToolCliContext
|
|
130
|
-
// (render, emitJson, emitEnvelope, deliverSignals, writeSarif, + the
|
|
131
|
-
// accessors). Direct stdout, the old pre-scope holder, or
|
|
132
|
-
// forbidden and caught by ESLint + fitness check + runtime
|
|
174
|
+
// (render, emitJson, emitEnvelope, deliverSignals, writeArtifact, writeSarif, + the
|
|
175
|
+
// baseline/toolState/hostPlanes accessors). Direct stdout, the old pre-scope holder, or
|
|
176
|
+
// raw datastore from handlers is forbidden and caught by ESLint + fitness check + runtime
|
|
177
|
+
// guards. Bootstrap root is exempted.
|
|
133
178
|
'Only the methods on the ToolCliContext you receive are allowed for emission/state/planes.',
|
|
134
179
|
],
|
|
135
180
|
};
|
|
136
181
|
}
|
|
137
182
|
export function executeAgentCatalog(opts = {}) {
|
|
138
|
-
const catalog = buildAgentCatalog(
|
|
183
|
+
const catalog = buildAgentCatalog({
|
|
184
|
+
tools: opts.tools,
|
|
185
|
+
internalCommands: opts.internalCommands,
|
|
186
|
+
});
|
|
139
187
|
if (opts.json) {
|
|
140
188
|
// Return a result shape that the host can emit cleanly.
|
|
141
189
|
// Using a plain object here; a proper AgentCatalogResult union member
|
|
@@ -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":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA4CH;;;;;GAKG;AACH,MAAM,wBAAwB,GAAG,oDAAoD,CAAC;AAEtF,SAAS,gBAAgB,CAAC,IAAY,EA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ToolPluginManifest, type ToolProvenance, type ToolRegistry } from '@opensip-cli/core';
|
|
5
|
+
import type { ConfigSchemaResult, ConfigValidateResult } from '@opensip-cli/contracts';
|
|
6
|
+
export interface ConfigValidateInput {
|
|
7
|
+
readonly tools: ToolRegistry;
|
|
8
|
+
readonly manifests?: readonly ToolPluginManifest[];
|
|
9
|
+
readonly provenance?: readonly ToolProvenance[];
|
|
10
|
+
readonly configPath: string | undefined;
|
|
11
|
+
readonly cwd: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ConfigSchemaInput extends ConfigValidateInput {
|
|
14
|
+
readonly outPath?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function executeConfigValidate(input: ConfigValidateInput): ConfigValidateResult;
|
|
17
|
+
/**
|
|
18
|
+
* @throws {ConfigurationError} When `--out` points to a directory.
|
|
19
|
+
* @throws {Error} When schema composition or file write fails.
|
|
20
|
+
*/
|
|
21
|
+
export declare function executeConfigSchema(input: ConfigSchemaInput): ConfigSchemaResult;
|
|
22
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAIvF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACnD,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC5D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AA+CD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CAsCtF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB,CAgDhF"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `opensip config validate|schema` execution helpers.
|
|
3
|
+
*/
|
|
4
|
+
import { mkdirSync, statSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { dirname, resolve } from 'node:path';
|
|
6
|
+
import { analyzeNamespaceClaims, composeConfigSchema, partitionUnclaimedNamespaces, toJsonSchema, validateConfigDocument, } from '@opensip-cli/config';
|
|
7
|
+
import { ConfigurationError, currentScope, readYamlFileOrThrow, } from '@opensip-cli/core';
|
|
8
|
+
import { buildConfigDeclarations } from '../bootstrap/config-declarations.js';
|
|
9
|
+
const CONFIG_LOG_MODULE = 'cli:config';
|
|
10
|
+
function configLogger() {
|
|
11
|
+
const logger = currentScope()?.logger;
|
|
12
|
+
return {
|
|
13
|
+
info: (entry) => {
|
|
14
|
+
logger?.info(entry);
|
|
15
|
+
},
|
|
16
|
+
error: (entry) => {
|
|
17
|
+
logger?.error(entry);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function readConfigDocument(configPath) {
|
|
22
|
+
if (configPath === undefined)
|
|
23
|
+
return {};
|
|
24
|
+
return readYamlFileOrThrow(configPath, { loader: 'project-config' });
|
|
25
|
+
}
|
|
26
|
+
function namespaceNames(declarations) {
|
|
27
|
+
return [...new Set(declarations.map((d) => d.namespace))].sort();
|
|
28
|
+
}
|
|
29
|
+
function collectWarnings(declarations, document, loadedToolNames) {
|
|
30
|
+
const report = analyzeNamespaceClaims(declarations, document);
|
|
31
|
+
const { toolBugs, benign } = partitionUnclaimedNamespaces(report, loadedToolNames);
|
|
32
|
+
if (toolBugs.length > 0) {
|
|
33
|
+
const names = toolBugs.map((u) => `'${u.namespace}'`).join(', ');
|
|
34
|
+
throw new ConfigurationError(`Config declares ${names} but the loaded tool(s) of the same id contribute no Tool.config — ` +
|
|
35
|
+
`the block can never apply. Remove the block or fix the tool's config contribution. (ADR-0043)`, { code: 'CONFIGURATION_ERROR' });
|
|
36
|
+
}
|
|
37
|
+
return benign.map((u) => {
|
|
38
|
+
const didYouMean = u.suggestion === undefined ? '' : ` — did you mean '${u.suggestion}:'?`;
|
|
39
|
+
return `Config namespace '${u.namespace}:' is not claimed by any loaded tool${didYouMean}`;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function executeConfigValidate(input) {
|
|
43
|
+
const log = configLogger();
|
|
44
|
+
log.info({ evt: 'cli.config.validate.start', module: CONFIG_LOG_MODULE });
|
|
45
|
+
try {
|
|
46
|
+
const { declarations } = buildConfigDeclarations({
|
|
47
|
+
tools: input.tools,
|
|
48
|
+
manifests: input.manifests,
|
|
49
|
+
provenance: input.provenance,
|
|
50
|
+
});
|
|
51
|
+
const schema = composeConfigSchema(declarations);
|
|
52
|
+
const document = readConfigDocument(input.configPath);
|
|
53
|
+
validateConfigDocument(schema, document);
|
|
54
|
+
const loadedToolNames = new Set(input.tools.list().map((t) => t.metadata.name ?? t.metadata.id));
|
|
55
|
+
const warnings = collectWarnings(declarations, document, loadedToolNames);
|
|
56
|
+
const configPath = input.configPath ?? resolve(input.cwd, 'opensip-cli.config.yml');
|
|
57
|
+
const result = {
|
|
58
|
+
type: 'config-validate',
|
|
59
|
+
valid: true,
|
|
60
|
+
configPath,
|
|
61
|
+
namespaces: namespaceNames(declarations),
|
|
62
|
+
...(warnings.length > 0 ? { warnings } : {}),
|
|
63
|
+
};
|
|
64
|
+
log.info({
|
|
65
|
+
evt: 'cli.config.validate.complete',
|
|
66
|
+
module: CONFIG_LOG_MODULE,
|
|
67
|
+
namespaces: result.namespaces.length,
|
|
68
|
+
});
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
log.error({
|
|
73
|
+
evt: 'cli.config.validate.error',
|
|
74
|
+
module: CONFIG_LOG_MODULE,
|
|
75
|
+
err: error instanceof Error ? error.message : String(error),
|
|
76
|
+
});
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @throws {ConfigurationError} When `--out` points to a directory.
|
|
82
|
+
* @throws {Error} When schema composition or file write fails.
|
|
83
|
+
*/
|
|
84
|
+
export function executeConfigSchema(input) {
|
|
85
|
+
const log = configLogger();
|
|
86
|
+
log.info({ evt: 'cli.config.schema.start', module: CONFIG_LOG_MODULE });
|
|
87
|
+
try {
|
|
88
|
+
const { declarations } = buildConfigDeclarations({
|
|
89
|
+
tools: input.tools,
|
|
90
|
+
manifests: input.manifests,
|
|
91
|
+
provenance: input.provenance,
|
|
92
|
+
});
|
|
93
|
+
const schema = toJsonSchema(composeConfigSchema(declarations));
|
|
94
|
+
const namespaces = namespaceNames(declarations);
|
|
95
|
+
let outPath;
|
|
96
|
+
if (input.outPath !== undefined) {
|
|
97
|
+
const resolved = resolve(input.cwd, input.outPath);
|
|
98
|
+
let stat;
|
|
99
|
+
try {
|
|
100
|
+
stat = statSync(resolved);
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
stat = undefined;
|
|
104
|
+
}
|
|
105
|
+
if (stat?.isDirectory()) {
|
|
106
|
+
throw new ConfigurationError(`--out must be a file path, not a directory: '${resolved}'`);
|
|
107
|
+
}
|
|
108
|
+
mkdirSync(dirname(resolved), { recursive: true });
|
|
109
|
+
writeFileSync(resolved, `${JSON.stringify(schema, null, 2)}\n`, 'utf8');
|
|
110
|
+
outPath = resolved;
|
|
111
|
+
}
|
|
112
|
+
const result = {
|
|
113
|
+
type: 'config-schema',
|
|
114
|
+
schema,
|
|
115
|
+
namespaces,
|
|
116
|
+
...(outPath === undefined ? {} : { outPath }),
|
|
117
|
+
};
|
|
118
|
+
log.info({
|
|
119
|
+
evt: 'cli.config.schema.complete',
|
|
120
|
+
module: CONFIG_LOG_MODULE,
|
|
121
|
+
namespaces: namespaces.length,
|
|
122
|
+
wroteFile: outPath !== undefined,
|
|
123
|
+
});
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
log.error({
|
|
128
|
+
evt: 'cli.config.schema.error',
|
|
129
|
+
module: CONFIG_LOG_MODULE,
|
|
130
|
+
err: error instanceof Error ? error.message : String(error),
|
|
131
|
+
});
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,4BAA4B,EAC5B,YAAY,EACZ,sBAAsB,GAEvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,GAIpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAI9E,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAcvC,SAAS,YAAY;IAInB,MAAM,MAAM,GAAG,YAAY,EAAE,EAAE,MAAM,CAAC;IACtC,OAAO;QACL,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;YACd,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;QACD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;YACf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H,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-command-specs.d.ts","sourceRoot":"","sources":["../../src/commands/host-command-specs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAmBH,OAAO,EAIL,KAAK,QAAQ,EACd,MAAM,6BAA6B,CAAC;AAMrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"host-command-specs.d.ts","sourceRoot":"","sources":["../../src/commands/host-command-specs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAmBH,OAAO,EAIL,KAAK,QAAQ,EACd,MAAM,6BAA6B,CAAC;AAMrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,wBAAwB,CAAC;AAqUtE;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,kBAAkB,GAAG,SAAS,QAAQ,EAAE,CAanF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,kBAAkB,GAAG,IAAI,CAWpF"}
|