@executioncontrolprotocol/cli 0.13.2 → 0.50.0
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/README.md +68 -67
- package/dist/commands.d.ts +7 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +9 -0
- package/dist/commands.js.map +1 -0
- package/dist/hooks/command-not-found.d.ts +8 -0
- package/dist/hooks/command-not-found.d.ts.map +1 -0
- package/dist/hooks/command-not-found.js +72 -0
- package/dist/hooks/command-not-found.js.map +1 -0
- package/dist/hooks/init-host.d.ts +8 -0
- package/dist/hooks/init-host.d.ts.map +1 -0
- package/dist/hooks/init-host.js +45 -0
- package/dist/hooks/init-host.js.map +1 -0
- package/dist/hooks/jit-install.d.ts +8 -0
- package/dist/hooks/jit-install.d.ts.map +1 -0
- package/dist/hooks/jit-install.js +32 -0
- package/dist/hooks/jit-install.js.map +1 -0
- package/dist/hooks/trust.d.ts +9 -0
- package/dist/hooks/trust.d.ts.map +1 -0
- package/dist/hooks/trust.js +32 -0
- package/dist/hooks/trust.js.map +1 -0
- package/dist/lib/argv.d.ts +11 -0
- package/dist/lib/argv.d.ts.map +1 -0
- package/dist/lib/argv.js +30 -0
- package/dist/lib/argv.js.map +1 -0
- package/dist/lib/confirm.d.ts +16 -0
- package/dist/lib/confirm.d.ts.map +1 -0
- package/dist/lib/confirm.js +49 -0
- package/dist/lib/confirm.js.map +1 -0
- package/dist/lib/ensure-plugins.d.ts +17 -0
- package/dist/lib/ensure-plugins.d.ts.map +1 -0
- package/dist/lib/ensure-plugins.js +38 -0
- package/dist/lib/ensure-plugins.js.map +1 -0
- package/dist/lib/evaluate-trust.d.ts +26 -0
- package/dist/lib/evaluate-trust.d.ts.map +1 -0
- package/dist/lib/evaluate-trust.js +87 -0
- package/dist/lib/evaluate-trust.js.map +1 -0
- package/dist/lib/format-output.d.ts +17 -0
- package/dist/lib/format-output.d.ts.map +1 -0
- package/dist/lib/format-output.js +63 -0
- package/dist/lib/format-output.js.map +1 -0
- package/dist/lib/installed-plugins.d.ts +25 -0
- package/dist/lib/installed-plugins.d.ts.map +1 -0
- package/dist/lib/installed-plugins.js +22 -0
- package/dist/lib/installed-plugins.js.map +1 -0
- package/dist/lib/jit-plugins.d.ts +13 -0
- package/dist/lib/jit-plugins.d.ts.map +1 -0
- package/dist/lib/jit-plugins.js +25 -0
- package/dist/lib/jit-plugins.js.map +1 -0
- package/dist/lib/layer-environment.d.ts +29 -0
- package/dist/lib/layer-environment.d.ts.map +1 -0
- package/dist/lib/layer-environment.js +96 -0
- package/dist/lib/layer-environment.js.map +1 -0
- package/dist/lib/load-ecp.d.ts +17 -0
- package/dist/lib/load-ecp.d.ts.map +1 -0
- package/dist/lib/load-ecp.js +39 -0
- package/dist/lib/load-ecp.js.map +1 -0
- package/dist/lib/missing-plugins.d.ts +24 -0
- package/dist/lib/missing-plugins.d.ts.map +1 -0
- package/dist/lib/missing-plugins.js +53 -0
- package/dist/lib/missing-plugins.js.map +1 -0
- package/dist/lib/npm-registry.d.ts +40 -0
- package/dist/lib/npm-registry.d.ts.map +1 -0
- package/dist/lib/npm-registry.js +68 -0
- package/dist/lib/npm-registry.js.map +1 -0
- package/dist/lib/plugin-bindings.d.ts +13 -0
- package/dist/lib/plugin-bindings.d.ts.map +1 -0
- package/dist/lib/plugin-bindings.js +49 -0
- package/dist/lib/plugin-bindings.js.map +1 -0
- package/dist/lib/plugin-source.d.ts +11 -0
- package/dist/lib/plugin-source.d.ts.map +1 -0
- package/dist/lib/plugin-source.js +32 -0
- package/dist/lib/plugin-source.js.map +1 -0
- package/dist/lib/prepare-workflow.d.ts +27 -0
- package/dist/lib/prepare-workflow.d.ts.map +1 -0
- package/dist/lib/prepare-workflow.js +76 -0
- package/dist/lib/prepare-workflow.js.map +1 -0
- package/dist/lib/runs-io.d.ts +30 -0
- package/dist/lib/runs-io.d.ts.map +1 -0
- package/dist/lib/runs-io.js +154 -0
- package/dist/lib/runs-io.js.map +1 -0
- package/dist/lib/secrets/store.d.ts +2 -1
- package/dist/lib/secrets/store.d.ts.map +1 -1
- package/dist/lib/secrets/store.js +1 -1
- package/dist/lib/secrets/store.js.map +1 -1
- package/dist/lib/trust-store.d.ts +12 -0
- package/dist/lib/trust-store.d.ts.map +1 -0
- package/dist/lib/trust-store.js +33 -0
- package/dist/lib/trust-store.js.map +1 -0
- package/dist/operations/catalog.d.ts +7 -0
- package/dist/operations/catalog.d.ts.map +1 -0
- package/dist/operations/catalog.js +108 -0
- package/dist/operations/catalog.js.map +1 -0
- package/dist/operations/discover.d.ts +3 -0
- package/dist/operations/discover.d.ts.map +1 -0
- package/dist/operations/discover.js +61 -0
- package/dist/operations/discover.js.map +1 -0
- package/dist/operations/index.d.ts +4 -0
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +38 -0
- package/dist/operations/index.js.map +1 -0
- package/dist/operations/init.d.ts +3 -0
- package/dist/operations/init.d.ts.map +1 -0
- package/dist/operations/init.js +46 -0
- package/dist/operations/init.js.map +1 -0
- package/dist/operations/install.d.ts +3 -0
- package/dist/operations/install.d.ts.map +1 -0
- package/dist/operations/install.js +34 -0
- package/dist/operations/install.js.map +1 -0
- package/dist/operations/plugins.d.ts +7 -0
- package/dist/operations/plugins.d.ts.map +1 -0
- package/dist/operations/plugins.js +64 -0
- package/dist/operations/plugins.js.map +1 -0
- package/dist/operations/rollback.d.ts +3 -0
- package/dist/operations/rollback.d.ts.map +1 -0
- package/dist/operations/rollback.js +25 -0
- package/dist/operations/rollback.js.map +1 -0
- package/dist/operations/runs.d.ts +11 -0
- package/dist/operations/runs.d.ts.map +1 -0
- package/dist/operations/runs.js +205 -0
- package/dist/operations/runs.js.map +1 -0
- package/dist/operations/secrets.d.ts +11 -0
- package/dist/operations/secrets.d.ts.map +1 -0
- package/dist/operations/secrets.js +134 -0
- package/dist/operations/secrets.js.map +1 -0
- package/dist/operations/update.d.ts +3 -0
- package/dist/operations/update.d.ts.map +1 -0
- package/dist/operations/update.js +64 -0
- package/dist/operations/update.js.map +1 -0
- package/dist/operations/workflow.d.ts +7 -0
- package/dist/operations/workflow.d.ts.map +1 -0
- package/dist/operations/workflow.js +144 -0
- package/dist/operations/workflow.js.map +1 -0
- package/package.json +38 -12
- package/dist/commands/compile.d.ts +0 -15
- package/dist/commands/compile.d.ts.map +0 -1
- package/dist/commands/compile.js +0 -44
- package/dist/commands/compile.js.map +0 -1
- package/dist/commands/config/secrets/add.d.ts +0 -15
- package/dist/commands/config/secrets/add.d.ts.map +0 -1
- package/dist/commands/config/secrets/add.js +0 -51
- package/dist/commands/config/secrets/add.js.map +0 -1
- package/dist/commands/config/secrets/get.d.ts +0 -13
- package/dist/commands/config/secrets/get.d.ts.map +0 -1
- package/dist/commands/config/secrets/get.js +0 -39
- package/dist/commands/config/secrets/get.js.map +0 -1
- package/dist/commands/config/secrets/list.d.ts +0 -7
- package/dist/commands/config/secrets/list.d.ts.map +0 -1
- package/dist/commands/config/secrets/list.js +0 -22
- package/dist/commands/config/secrets/list.js.map +0 -1
- package/dist/commands/config/secrets/remove.d.ts +0 -10
- package/dist/commands/config/secrets/remove.d.ts.map +0 -1
- package/dist/commands/config/secrets/remove.js +0 -25
- package/dist/commands/config/secrets/remove.js.map +0 -1
- package/dist/commands/config/secrets.d.ts +0 -9
- package/dist/commands/config/secrets.d.ts.map +0 -1
- package/dist/commands/config/secrets.js +0 -31
- package/dist/commands/config/secrets.js.map +0 -1
- package/dist/commands/decode.d.ts +0 -18
- package/dist/commands/decode.d.ts.map +0 -1
- package/dist/commands/decode.js +0 -66
- package/dist/commands/decode.js.map +0 -1
- package/dist/commands/describe.d.ts +0 -15
- package/dist/commands/describe.d.ts.map +0 -1
- package/dist/commands/describe.js +0 -62
- package/dist/commands/describe.js.map +0 -1
- package/dist/commands/encode.d.ts +0 -18
- package/dist/commands/encode.d.ts.map +0 -1
- package/dist/commands/encode.js +0 -63
- package/dist/commands/encode.js.map +0 -1
- package/dist/commands/init.d.ts +0 -14
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -91
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/invoke.d.ts +0 -17
- package/dist/commands/invoke.d.ts.map +0 -1
- package/dist/commands/invoke.js +0 -47
- package/dist/commands/invoke.js.map +0 -1
- package/dist/commands/run.d.ts +0 -17
- package/dist/commands/run.d.ts.map +0 -1
- package/dist/commands/run.js +0 -53
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/search.d.ts +0 -12
- package/dist/commands/search.d.ts.map +0 -1
- package/dist/commands/search.js +0 -26
- package/dist/commands/search.js.map +0 -1
- package/dist/commands/serve.d.ts +0 -15
- package/dist/commands/serve.d.ts.map +0 -1
- package/dist/commands/serve.js +0 -53
- package/dist/commands/serve.js.map +0 -1
- package/dist/commands/test/rerun.d.ts +0 -16
- package/dist/commands/test/rerun.d.ts.map +0 -1
- package/dist/commands/test/rerun.js +0 -38
- package/dist/commands/test/rerun.js.map +0 -1
- package/dist/commands/test/run.d.ts +0 -14
- package/dist/commands/test/run.d.ts.map +0 -1
- package/dist/commands/test/run.js +0 -36
- package/dist/commands/test/run.js.map +0 -1
- package/dist/commands/test/start.d.ts +0 -17
- package/dist/commands/test/start.d.ts.map +0 -1
- package/dist/commands/test/start.js +0 -43
- package/dist/commands/test/start.js.map +0 -1
- package/dist/commands/test/status.d.ts +0 -12
- package/dist/commands/test/status.d.ts.map +0 -1
- package/dist/commands/test/status.js +0 -24
- package/dist/commands/test/status.js.map +0 -1
- package/dist/commands/test.d.ts +0 -9
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js +0 -32
- package/dist/commands/test.js.map +0 -1
- package/dist/commands/up.d.ts +0 -19
- package/dist/commands/up.d.ts.map +0 -1
- package/dist/commands/up.js +0 -102
- package/dist/commands/up.js.map +0 -1
- package/dist/commands/validate.d.ts +0 -12
- package/dist/commands/validate.d.ts.map +0 -1
- package/dist/commands/validate.js +0 -26
- package/dist/commands/validate.js.map +0 -1
- package/dist/lib/env-module-command.d.ts +0 -37
- package/dist/lib/env-module-command.d.ts.map +0 -1
- package/dist/lib/env-module-command.js +0 -59
- package/dist/lib/env-module-command.js.map +0 -1
- package/dist/lib/format-cli.d.ts +0 -13
- package/dist/lib/format-cli.d.ts.map +0 -1
- package/dist/lib/format-cli.js +0 -25
- package/dist/lib/format-cli.js.map +0 -1
- package/dist/lib/http/create-serve-handler.d.ts +0 -15
- package/dist/lib/http/create-serve-handler.d.ts.map +0 -1
- package/dist/lib/http/create-serve-handler.js +0 -40
- package/dist/lib/http/create-serve-handler.js.map +0 -1
- package/dist/lib/http/create-serve.d.ts +0 -30
- package/dist/lib/http/create-serve.d.ts.map +0 -1
- package/dist/lib/http/create-serve.js +0 -43
- package/dist/lib/http/create-serve.js.map +0 -1
- package/dist/lib/http/handle-artifact.d.ts +0 -14
- package/dist/lib/http/handle-artifact.d.ts.map +0 -1
- package/dist/lib/http/handle-artifact.js +0 -40
- package/dist/lib/http/handle-artifact.js.map +0 -1
- package/dist/lib/http/handle-invoke.d.ts +0 -59
- package/dist/lib/http/handle-invoke.d.ts.map +0 -1
- package/dist/lib/http/handle-invoke.js +0 -108
- package/dist/lib/http/handle-invoke.js.map +0 -1
- package/dist/lib/http/read-body.d.ts +0 -7
- package/dist/lib/http/read-body.d.ts.map +0 -1
- package/dist/lib/http/read-body.js +0 -12
- package/dist/lib/http/read-body.js.map +0 -1
- package/dist/lib/http/write-json.d.ts +0 -7
- package/dist/lib/http/write-json.d.ts.map +0 -1
- package/dist/lib/http/write-json.js +0 -11
- package/dist/lib/http/write-json.js.map +0 -1
- package/dist/lib/test-session-io.d.ts +0 -12
- package/dist/lib/test-session-io.d.ts.map +0 -1
- package/dist/lib/test-session-io.js +0 -36
- package/dist/lib/test-session-io.js.map +0 -1
- package/dist/lib/up/constants.d.ts +0 -15
- package/dist/lib/up/constants.d.ts.map +0 -1
- package/dist/lib/up/constants.js +0 -21
- package/dist/lib/up/constants.js.map +0 -1
- package/dist/lib/up/cors.d.ts +0 -12
- package/dist/lib/up/cors.d.ts.map +0 -1
- package/dist/lib/up/cors.js +0 -28
- package/dist/lib/up/cors.js.map +0 -1
- package/dist/lib/up/create-daemon.d.ts +0 -53
- package/dist/lib/up/create-daemon.d.ts.map +0 -1
- package/dist/lib/up/create-daemon.js +0 -85
- package/dist/lib/up/create-daemon.js.map +0 -1
- package/dist/lib/up/handle-request.d.ts +0 -19
- package/dist/lib/up/handle-request.d.ts.map +0 -1
- package/dist/lib/up/handle-request.js +0 -71
- package/dist/lib/up/handle-request.js.map +0 -1
- package/dist/lib/up/open-browser.d.ts +0 -19
- package/dist/lib/up/open-browser.d.ts.map +0 -1
- package/dist/lib/up/open-browser.js +0 -43
- package/dist/lib/up/open-browser.js.map +0 -1
- package/dist/lib/up/read-body.d.ts +0 -3
- package/dist/lib/up/read-body.d.ts.map +0 -1
- package/dist/lib/up/read-body.js +0 -3
- package/dist/lib/up/read-body.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm.js","sourceRoot":"","sources":["../../src/lib/confirm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAiB,OAAO,CAAC,IAAI;IACpD,OAAO,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,GAAG,CAAA;AAC9E,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAe,EAAE,OAAiB,OAAO,CAAC,IAAI;IAC1E,IAAI,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAC/B,IAAI,CAAC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if/core";
|
|
2
|
+
import type { RequirementsDocument } from "@executioncontrolprotocol/core";
|
|
3
|
+
import { type EcpHost } from "@executioncontrolprotocol/plugin-sdk";
|
|
4
|
+
/**
|
|
5
|
+
* Ensure required plugins are installed. `validate` never installs.
|
|
6
|
+
* Interactive run prompts per package; `--json` / non-TTY throw {@link ECP_PLUGINS_MISSING}.
|
|
7
|
+
* @category CLI
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensurePluginsInstalled(options: {
|
|
10
|
+
requirements: RequirementsDocument;
|
|
11
|
+
config: Interfaces.Config;
|
|
12
|
+
argv: string[];
|
|
13
|
+
json: boolean;
|
|
14
|
+
install: boolean;
|
|
15
|
+
host?: EcpHost;
|
|
16
|
+
}): Promise<EcpHost | undefined>;
|
|
17
|
+
//# sourceMappingURL=ensure-plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-plugins.d.ts","sourceRoot":"","sources":["../../src/lib/ensure-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAIL,KAAK,OAAO,EACb,MAAM,sCAAsC,CAAA;AAiB7C;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE;IACpD,YAAY,EAAE,oBAAoB,CAAA;IAClC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAA;IACzB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAiB/B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ECP_PLUGINS_MISSING, EcpCliError, EXIT_PLUGINS_MISSING, } from "@executioncontrolprotocol/plugin-sdk";
|
|
2
|
+
import { confirmDefaultYes, wantsYes } from "./confirm.js";
|
|
3
|
+
import { rebuildProcessHost } from "./layer-environment.js";
|
|
4
|
+
import { findMissingPlugins } from "./missing-plugins.js";
|
|
5
|
+
function throwMissing(missing) {
|
|
6
|
+
throw new EcpCliError(ECP_PLUGINS_MISSING, `Missing plugins: ${missing.map((row) => row.package).join(", ")}`, {
|
|
7
|
+
exitCode: EXIT_PLUGINS_MISSING,
|
|
8
|
+
details: missing,
|
|
9
|
+
suggestions: missing.map((row) => row.command),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Ensure required plugins are installed. `validate` never installs.
|
|
14
|
+
* Interactive run prompts per package; `--json` / non-TTY throw {@link ECP_PLUGINS_MISSING}.
|
|
15
|
+
* @category CLI
|
|
16
|
+
*/
|
|
17
|
+
export async function ensurePluginsInstalled(options) {
|
|
18
|
+
let missing = findMissingPlugins(options.requirements, options.config);
|
|
19
|
+
if (missing.length === 0)
|
|
20
|
+
return options.host;
|
|
21
|
+
if (!options.install || options.json || (!wantsYes(options.argv) && (!process.stdin.isTTY || !process.stdout.isTTY))) {
|
|
22
|
+
throwMissing(missing);
|
|
23
|
+
}
|
|
24
|
+
let host = options.host;
|
|
25
|
+
for (const row of missing) {
|
|
26
|
+
const spec = row.range ? `${row.package}@${row.range}` : row.package;
|
|
27
|
+
const ok = await confirmDefaultYes(`Install ${spec}?`, options.argv);
|
|
28
|
+
if (!ok)
|
|
29
|
+
throwMissing([row]);
|
|
30
|
+
await options.config.runCommand("plugins:install", [spec]);
|
|
31
|
+
}
|
|
32
|
+
host = await rebuildProcessHost(options.config, host);
|
|
33
|
+
missing = findMissingPlugins(options.requirements, options.config);
|
|
34
|
+
if (missing.length > 0)
|
|
35
|
+
throwMissing(missing);
|
|
36
|
+
return host;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=ensure-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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AI,GAAG,OAAO,CAAC,IAAI,CAAA;IACvB,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAA;QACpE,MAAM,EAAE,GAAG,MAAM,iBAAiB,CAAC,WAAW,IAAI,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;QACpE,IAAI,CAAC,EAAE;YAAE,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QAC5B,MAAM,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAC5D,CAAC;IACD,IAAI,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACrD,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IAClE,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,YAAY,CAAC,OAAO,CAAC,CAAA;IAC7C,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Interfaces } from "@oclif/core";
|
|
2
|
+
/** Comma-separated git/path sources allowed without `--allow-source`. @category CLI */
|
|
3
|
+
export declare const ECP_ALLOW_SOURCE_ENV = "ECP_ALLOW_SOURCE";
|
|
4
|
+
/**
|
|
5
|
+
* Source kinds permitted by `--allow-source` and {@link ECP_ALLOW_SOURCE_ENV}.
|
|
6
|
+
* @category CLI
|
|
7
|
+
*/
|
|
8
|
+
export declare function allowedPluginSources(argv?: string[]): Set<string>;
|
|
9
|
+
/** Decision from the plugin trust check. @category CLI */
|
|
10
|
+
export interface TrustDecision {
|
|
11
|
+
/** Whether the install may proceed. */
|
|
12
|
+
allowed: boolean;
|
|
13
|
+
/** Reason when denied. */
|
|
14
|
+
reason?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Evaluate whether a plugin install is allowed.
|
|
18
|
+
* @category CLI
|
|
19
|
+
*/
|
|
20
|
+
export declare function evaluateTrust(config: Interfaces.Config, spec: string, argv?: string[]): Promise<TrustDecision>;
|
|
21
|
+
/**
|
|
22
|
+
* Throw {@link EcpCliError} when a trust check denies the install.
|
|
23
|
+
* @category CLI
|
|
24
|
+
*/
|
|
25
|
+
export declare function assertTrusted(config: Interfaces.Config, spec: string, argv?: string[]): Promise<void>;
|
|
26
|
+
//# sourceMappingURL=evaluate-trust.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate-trust.d.ts","sourceRoot":"","sources":["../../src/lib/evaluate-trust.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAY7C,uFAAuF;AACvF,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AAEtD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,GAAG,CAAC,MAAM,CAAC,CAW/E;AAED,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAA;IAChB,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAM,EAAiB,GAC5B,OAAO,CAAC,aAAa,CAAC,CAuCxB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAM,EAAiB,GAC5B,OAAO,CAAC,IAAI,CAAC,CASf"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ECP_PLUGIN_DENIED, EcpCliError, EXIT_FAILED, } from "@executioncontrolprotocol/plugin-sdk";
|
|
2
|
+
import { argvFlagValue, argvHasFlag } from "./argv.js";
|
|
3
|
+
import { confirm, wantsYes } from "./confirm.js";
|
|
4
|
+
import { isFirstPartyPackage } from "./npm-registry.js";
|
|
5
|
+
import { pluginNameFromSpec, pluginSourceKind } from "./plugin-source.js";
|
|
6
|
+
import { rememberTrust, rememberedTrust } from "./trust-store.js";
|
|
7
|
+
/** Comma-separated git/path sources allowed without `--allow-source`. @category CLI */
|
|
8
|
+
export const ECP_ALLOW_SOURCE_ENV = "ECP_ALLOW_SOURCE";
|
|
9
|
+
/**
|
|
10
|
+
* Source kinds permitted by `--allow-source` and {@link ECP_ALLOW_SOURCE_ENV}.
|
|
11
|
+
* @category CLI
|
|
12
|
+
*/
|
|
13
|
+
export function allowedPluginSources(argv = process.argv) {
|
|
14
|
+
const values = new Set();
|
|
15
|
+
const fromFlag = argvFlagValue(argv, "allow-source");
|
|
16
|
+
if (fromFlag)
|
|
17
|
+
values.add(fromFlag);
|
|
18
|
+
const fromEnv = process.env[ECP_ALLOW_SOURCE_ENV];
|
|
19
|
+
if (fromEnv) {
|
|
20
|
+
for (const part of fromEnv.split(/[,\s]+/)) {
|
|
21
|
+
if (part)
|
|
22
|
+
values.add(part);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return values;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Evaluate whether a plugin install is allowed.
|
|
29
|
+
* @category CLI
|
|
30
|
+
*/
|
|
31
|
+
export async function evaluateTrust(config, spec, argv = process.argv) {
|
|
32
|
+
const kind = pluginSourceKind(spec);
|
|
33
|
+
const name = pluginNameFromSpec(spec);
|
|
34
|
+
const sources = allowedPluginSources(argv);
|
|
35
|
+
if (kind === "git" && !sources.has("git")) {
|
|
36
|
+
return {
|
|
37
|
+
allowed: false,
|
|
38
|
+
reason: "Git plugin sources need --allow-source git or ECP_ALLOW_SOURCE=git",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (kind === "path" && !sources.has("path")) {
|
|
42
|
+
return {
|
|
43
|
+
allowed: false,
|
|
44
|
+
reason: "Local plugin paths need --allow-source path or ECP_ALLOW_SOURCE=path",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (kind === "npm" && isFirstPartyPackage(name)) {
|
|
48
|
+
return { allowed: true };
|
|
49
|
+
}
|
|
50
|
+
const remembered = await rememberedTrust(config, name);
|
|
51
|
+
if (remembered === true)
|
|
52
|
+
return { allowed: true };
|
|
53
|
+
if (remembered === false) {
|
|
54
|
+
return { allowed: false, reason: `Package ${name} was previously denied` };
|
|
55
|
+
}
|
|
56
|
+
if (wantsYes(argv)) {
|
|
57
|
+
await rememberTrust(config, name, true);
|
|
58
|
+
return { allowed: true };
|
|
59
|
+
}
|
|
60
|
+
if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
61
|
+
const ok = await confirm(`Trust and install ${name}?`, argv);
|
|
62
|
+
await rememberTrust(config, name, ok);
|
|
63
|
+
return ok
|
|
64
|
+
? { allowed: true }
|
|
65
|
+
: { allowed: false, reason: `User refused to trust ${name}` };
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
allowed: false,
|
|
69
|
+
reason: `Third-party package ${name} needs --yes or ECP_TRUST_THIRD_PARTY=1`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Throw {@link EcpCliError} when a trust check denies the install.
|
|
74
|
+
* @category CLI
|
|
75
|
+
*/
|
|
76
|
+
export async function assertTrusted(config, spec, argv = process.argv) {
|
|
77
|
+
const decision = await evaluateTrust(config, spec, argv);
|
|
78
|
+
if (decision.allowed)
|
|
79
|
+
return;
|
|
80
|
+
throw new EcpCliError(ECP_PLUGIN_DENIED, decision.reason ?? "Plugin install denied", {
|
|
81
|
+
exitCode: EXIT_FAILED,
|
|
82
|
+
suggestions: argvHasFlag(argv, "yes")
|
|
83
|
+
? undefined
|
|
84
|
+
: ["Pass --yes to trust a third-party package for this install"],
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=evaluate-trust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate-trust.js","sourceRoot":"","sources":["../../src/lib/evaluate-trust.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,WAAW,GACZ,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEjE,uFAAuF;AACvF,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAA;AAEtD;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAiB,OAAO,CAAC,IAAI;IAChE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA;IAChC,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,EAAE,cAAc,CAAC,CAAA;IACpD,IAAI,QAAQ;QAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAClC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;IACjD,IAAI,OAAO,EAAE,CAAC;QACZ,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3C,IAAI,IAAI;gBAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QA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AO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IAC1B,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAChD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,qBAAqB,IAAI,GAAG,EAAE,IAAI,CAAC,CAAA;QAC5D,MAAM,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;QACrC,OAAO,EAAE;YACP,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;YACnB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,yBAAyB,IAAI,EAAE,EAAE,CAAA;IACjE,CAAC;IACD,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,uBAAuB,IAAI,yCAAyC;KAC7E,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAyB,EACzB,IAAY,EACZ,OAAiB,OAAO,CAAC,IAAI;IAE7B,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IACxD,IAAI,QAAQ,CAAC,OAAO;QAAE,OAAM;IAC5B,MAAM,IAAI,WAAW,CAAC,iBAAiB,EAAE,QAAQ,CAAC,MAAM,IAAI,uBAAuB,EAAE;QACnF,QAAQ,EAAE,WAAW;QACrB,WAAW,EAAE,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC;YACnC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,CAAC,4DAA4D,CAAC;KACnE,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Ecp } from "@executioncontrolprotocol/core";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a `--format` token to a format-extension id.
|
|
4
|
+
* @category CLI
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatExtensionId(format: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Resolve a `--format` token to the first-party plugin package that provides it.
|
|
9
|
+
* @category CLI
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatPluginPackage(format: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Optionally re-encode `data` through an installed format plugin.
|
|
14
|
+
* @category CLI
|
|
15
|
+
*/
|
|
16
|
+
export declare function applyFormat(ecp: Ecp, data: unknown, format: string | undefined): Promise<unknown>;
|
|
17
|
+
//# sourceMappingURL=format-output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-output.d.ts","sourceRoot":"","sources":["../../src/lib/format-output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;AAUzD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAI1D;AAWD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CA8BvG"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ECP_ENCODING_ERROR_CODES } from "@executioncontrolprotocol/core/types";
|
|
2
|
+
import { EcpCliError, ECP_INPUT_INVALID, ECP_PLUGINS_MISSING, EXIT_PLUGINS_MISSING, EXIT_USAGE, } from "@executioncontrolprotocol/plugin-sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a `--format` token to a format-extension id.
|
|
5
|
+
* @category CLI
|
|
6
|
+
*/
|
|
7
|
+
export function formatExtensionId(format) {
|
|
8
|
+
if (format.includes("/"))
|
|
9
|
+
return format;
|
|
10
|
+
if (format.startsWith("format-"))
|
|
11
|
+
return `@executioncontrolprotocol/${format}`;
|
|
12
|
+
return `@executioncontrolprotocol/format-${format}`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a `--format` token to the first-party plugin package that provides it.
|
|
16
|
+
* @category CLI
|
|
17
|
+
*/
|
|
18
|
+
export function formatPluginPackage(format) {
|
|
19
|
+
const id = formatExtensionId(format);
|
|
20
|
+
const name = id.replace(/^@[^/]+\//, "");
|
|
21
|
+
return `@executioncontrolprotocol/plugin-${name}`;
|
|
22
|
+
}
|
|
23
|
+
function isMissingFormatError(err) {
|
|
24
|
+
return (typeof err === "object" &&
|
|
25
|
+
err !== null &&
|
|
26
|
+
"code" in err &&
|
|
27
|
+
err.code === ECP_ENCODING_ERROR_CODES.FORMAT_EXTENSION_NOT_FOUND);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Optionally re-encode `data` through an installed format plugin.
|
|
31
|
+
* @category CLI
|
|
32
|
+
*/
|
|
33
|
+
export async function applyFormat(ecp, data, format) {
|
|
34
|
+
if (!format)
|
|
35
|
+
return data;
|
|
36
|
+
const extensionId = formatExtensionId(format);
|
|
37
|
+
try {
|
|
38
|
+
const result = await ecp.encode(data).uses(extensionId).asString().process();
|
|
39
|
+
if (!result.success) {
|
|
40
|
+
const diagnostic = result.diagnostics[0];
|
|
41
|
+
throw new EcpCliError(diagnostic?.code ?? ECP_INPUT_INVALID, diagnostic?.message ?? `Format ${extensionId} is not installed`, {
|
|
42
|
+
suggestions: ["Install the format plugin or omit --format"],
|
|
43
|
+
exitCode: EXIT_USAGE,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return result.result;
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
if (err instanceof EcpCliError)
|
|
50
|
+
throw err;
|
|
51
|
+
if (isMissingFormatError(err)) {
|
|
52
|
+
const pkg = formatPluginPackage(format);
|
|
53
|
+
const installName = pkg.replace("@executioncontrolprotocol/plugin-", "");
|
|
54
|
+
throw new EcpCliError(ECP_PLUGINS_MISSING, `Plugin ${pkg} is not installed.`, {
|
|
55
|
+
details: { package: pkg },
|
|
56
|
+
suggestions: [`ecp plugins install ${installName}`],
|
|
57
|
+
exitCode: EXIT_PLUGINS_MISSING,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
throw err;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=format-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-output.js","sourceRoot":"","sources":["../../src/lib/format-output.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAA;AAC/E,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,UAAU,GACX,MAAM,sCAAsC,CAAA;AAE7C;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,MAAM,CAAA;IACvC,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,6BAA6B,MAAM,EAAE,CAAA;IAC9E,OAAO,oCAAoC,MAAM,EAAE,CAAA;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,MAAM,EAAE,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAA;IACpC,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IACxC,OAAO,oCAAoC,IAAI,EAAE,CAAA;AACnD,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAY;IACxC,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,MAAM,IAAI,GAAG;QACZ,GAAwB,CAAC,IAAI,KAAK,wBAAwB,CAAC,0BAA0B,CACvF,CAAA;AACH,CAAC;AAED;;;GAGG;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G,CAAA;IACX,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Interfaces } from "@oclif/core";
|
|
2
|
+
/** Installed oclif plugin snapshot. @category CLI */
|
|
3
|
+
export interface InstalledPlugin {
|
|
4
|
+
/** Package name. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Plugin root on disk. */
|
|
7
|
+
root: string;
|
|
8
|
+
/** Parsed package.json. */
|
|
9
|
+
pjson: Record<string, unknown>;
|
|
10
|
+
/** oclif plugin type when present. */
|
|
11
|
+
type?: string;
|
|
12
|
+
/** Installed version. */
|
|
13
|
+
version?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* List plugins currently loaded by oclif.
|
|
17
|
+
* @category CLI
|
|
18
|
+
*/
|
|
19
|
+
export declare function listInstalledPlugins(config: Interfaces.Config): InstalledPlugin[];
|
|
20
|
+
/**
|
|
21
|
+
* Names of plugins already installed (user, link, or core).
|
|
22
|
+
* @category CLI
|
|
23
|
+
*/
|
|
24
|
+
export declare function installedPluginNames(config: Interfaces.Config): Set<string>;
|
|
25
|
+
//# sourceMappingURL=installed-plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installed-plugins.d.ts","sourceRoot":"","sources":["../../src/lib/installed-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,qDAAqD;AACrD,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,eAAe,EAAE,CASjF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAE3E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List plugins currently loaded by oclif.
|
|
3
|
+
* @category CLI
|
|
4
|
+
*/
|
|
5
|
+
export function listInstalledPlugins(config) {
|
|
6
|
+
const iterable = config.getPluginsList();
|
|
7
|
+
return [...iterable].map((plugin) => ({
|
|
8
|
+
name: plugin.name,
|
|
9
|
+
root: plugin.root,
|
|
10
|
+
pjson: (plugin.pjson ?? {}),
|
|
11
|
+
type: plugin.type,
|
|
12
|
+
version: plugin.version,
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Names of plugins already installed (user, link, or core).
|
|
17
|
+
* @category CLI
|
|
18
|
+
*/
|
|
19
|
+
export function installedPluginNames(config) {
|
|
20
|
+
return new Set(listInstalledPlugins(config).map((plugin) => plugin.name));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=installed-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installed-plugins.js","sourceRoot":"","sources":["../../src/lib/installed-plugins.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAyB;IAC5D,MAAM,QAAQ,GAAG,MAAM,CAAC,cAAc,EAAE,CAAA;IACxC,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACpC,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAA4B;QACtD,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAC,CAAA;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAyB;IAC5D,OAAO,IAAI,GAAG,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;AAC3E,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* oclif JIT plugin map from the CLI package.json.
|
|
3
|
+
* @category CLI
|
|
4
|
+
*/
|
|
5
|
+
export type JitPluginMap = Record<string, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Package name in `oclif.jitPlugins` that owns `topic`, if any.
|
|
8
|
+
* `mcp` maps to `@executioncontrolprotocol/mcp` (not `plugin-mcp`) so
|
|
9
|
+
* command-not-found does not steal the JIT install path.
|
|
10
|
+
* @category CLI
|
|
11
|
+
*/
|
|
12
|
+
export declare function jitPluginForTopic(topic: string, jitPlugins: JitPluginMap): string | undefined;
|
|
13
|
+
//# sourceMappingURL=jit-plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jit-plugins.d.ts","sourceRoot":"","sources":["../../src/lib/jit-plugins.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAEjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAc7F"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package name in `oclif.jitPlugins` that owns `topic`, if any.
|
|
3
|
+
* `mcp` maps to `@executioncontrolprotocol/mcp` (not `plugin-mcp`) so
|
|
4
|
+
* command-not-found does not steal the JIT install path.
|
|
5
|
+
* @category CLI
|
|
6
|
+
*/
|
|
7
|
+
export function jitPluginForTopic(topic, jitPlugins) {
|
|
8
|
+
if (!topic)
|
|
9
|
+
return undefined;
|
|
10
|
+
const candidates = [
|
|
11
|
+
`@executioncontrolprotocol/${topic}`,
|
|
12
|
+
`@executioncontrolprotocol/plugin-${topic}`,
|
|
13
|
+
];
|
|
14
|
+
for (const name of candidates) {
|
|
15
|
+
if (name in jitPlugins)
|
|
16
|
+
return name;
|
|
17
|
+
}
|
|
18
|
+
for (const name of Object.keys(jitPlugins)) {
|
|
19
|
+
const bare = name.split("/").pop() ?? "";
|
|
20
|
+
if (bare === topic || bare === `plugin-${topic}`)
|
|
21
|
+
return name;
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=jit-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jit-plugins.js","sourceRoot":"","sources":["../../src/lib/jit-plugins.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,UAAwB;IACvE,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAC5B,MAAM,UAAU,GAAG;QACjB,6BAA6B,KAAK,EAAE;QACpC,oCAAoC,KAAK,EAAE;KAC5C,CAAA;IACD,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,IAAI,IAAI,UAAU;YAAE,OAAO,IAAI,CAAA;IACrC,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAA;QACxC,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,UAAU,KAAK,EAAE;YAAE,OAAO,IAAI,CAAA;IAC/D,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Interfaces } from "@oclif/core";
|
|
2
|
+
import { type Ecp, type WorkflowBinding } from "@executioncontrolprotocol/core";
|
|
3
|
+
import type { EcpHost } from "@executioncontrolprotocol/plugin-sdk";
|
|
4
|
+
import { terminateIfNeeded } from "./load-ecp.js";
|
|
5
|
+
/**
|
|
6
|
+
* User default environment file in the oclif config directory.
|
|
7
|
+
* @category CLI
|
|
8
|
+
*/
|
|
9
|
+
export declare function userEnvironmentFile(configDir: string): Promise<string | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Layer built-in Node + installed plugins, optional `--env` / user environment, then workflow `.with()`.
|
|
12
|
+
* @category CLI
|
|
13
|
+
*/
|
|
14
|
+
export declare function layerRunEnvironment(options: {
|
|
15
|
+
envFlag?: string;
|
|
16
|
+
workflowBindings?: WorkflowBinding[];
|
|
17
|
+
config: Interfaces.Config;
|
|
18
|
+
host?: EcpHost;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
ecp: Ecp;
|
|
21
|
+
terminate: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Rebuild the process host after installing plugins.
|
|
25
|
+
* @category CLI
|
|
26
|
+
*/
|
|
27
|
+
export declare function rebuildProcessHost(config: Interfaces.Config, previous?: EcpHost): Promise<EcpHost>;
|
|
28
|
+
export { terminateIfNeeded };
|
|
29
|
+
//# sourceMappingURL=layer-environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-environment.d.ts","sourceRoot":"","sources":["../../src/lib/layer-environment.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAIL,KAAK,GAAG,EAGR,KAAK,eAAe,EACrB,MAAM,gCAAgC,CAAA;AAGvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAGnE,OAAO,EAAkB,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAmCjE;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAMxF;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE;IACjD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAA;IACpC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAA;IACzB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CA0B5C;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,QAAQ,CAAC,EAAE,OAAO,GACjB,OAAO,CAAC,OAAO,CAAC,CAkBlB;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { access } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { PROCESS_ENV_RESOLVER_ID, SECRETS_RESOLVER_ID, extension, } from "@executioncontrolprotocol/core";
|
|
4
|
+
import { ECP_BINDING_INVALID, EcpError } from "@executioncontrolprotocol/core/types";
|
|
5
|
+
import { journalExtension, loadEnvironmentModule } from "@executioncontrolprotocol/node";
|
|
6
|
+
import { setHost } from "@executioncontrolprotocol/plugin-sdk";
|
|
7
|
+
import { createProcessEnvironment } from "./plugin-bindings.js";
|
|
8
|
+
import { ecpFromEnvFlag, terminateIfNeeded } from "./load-ecp.js";
|
|
9
|
+
async function pathExists(path) {
|
|
10
|
+
try {
|
|
11
|
+
await access(path);
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function assertWorkflowBindingsAllowed(bindings, registry) {
|
|
19
|
+
for (const binding of bindings) {
|
|
20
|
+
const ref = binding.getRef();
|
|
21
|
+
const id = typeof ref === "string" ? ref : ref.id;
|
|
22
|
+
const def = typeof ref === "object" && ref !== null && "providesConfigResolver" in ref
|
|
23
|
+
? ref
|
|
24
|
+
: registry?.getExtension(id);
|
|
25
|
+
if (id === SECRETS_RESOLVER_ID ||
|
|
26
|
+
id === PROCESS_ENV_RESOLVER_ID ||
|
|
27
|
+
def?.providesConfigResolver) {
|
|
28
|
+
throw new EcpError(ECP_BINDING_INVALID, `Workflow files cannot bind config resolver ${id}. Bind it on the environment instead.`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* User default environment file in the oclif config directory.
|
|
34
|
+
* @category CLI
|
|
35
|
+
*/
|
|
36
|
+
export async function userEnvironmentFile(configDir) {
|
|
37
|
+
for (const name of ["environment.ecp.ts", "environment.ecp.js", "environment.ts"]) {
|
|
38
|
+
const candidate = join(configDir, name);
|
|
39
|
+
if (await pathExists(candidate))
|
|
40
|
+
return candidate;
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Layer built-in Node + installed plugins, optional `--env` / user environment, then workflow `.with()`.
|
|
46
|
+
* @category CLI
|
|
47
|
+
*/
|
|
48
|
+
export async function layerRunEnvironment(options) {
|
|
49
|
+
const bindings = options.workflowBindings ?? [];
|
|
50
|
+
const envFile = options.envFlag ??
|
|
51
|
+
(options.config.configDir ? await userEnvironmentFile(options.config.configDir) : undefined);
|
|
52
|
+
if (!envFile && bindings.length === 0) {
|
|
53
|
+
return ecpFromEnvFlag(undefined, options.host);
|
|
54
|
+
}
|
|
55
|
+
let env;
|
|
56
|
+
if (envFile) {
|
|
57
|
+
env = await loadEnvironmentModule(envFile);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
env = await createProcessEnvironment(options.config);
|
|
61
|
+
}
|
|
62
|
+
env.with([extension(journalExtension)]);
|
|
63
|
+
if (bindings.length > 0) {
|
|
64
|
+
assertWorkflowBindingsAllowed(bindings, options.host?.registry);
|
|
65
|
+
env.with(bindings);
|
|
66
|
+
}
|
|
67
|
+
const ecp = await env.init();
|
|
68
|
+
return { ecp, terminate: true };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Rebuild the process host after installing plugins.
|
|
72
|
+
* @category CLI
|
|
73
|
+
*/
|
|
74
|
+
export async function rebuildProcessHost(config, previous) {
|
|
75
|
+
if (previous) {
|
|
76
|
+
try {
|
|
77
|
+
await previous.ecp.terminate();
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
/* ignore */
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const env = await createProcessEnvironment(config);
|
|
84
|
+
const ecp = await env.init();
|
|
85
|
+
const host = {
|
|
86
|
+
ecp,
|
|
87
|
+
registry: ecp.getRegistry(),
|
|
88
|
+
environmentId: ecp.id,
|
|
89
|
+
output: previous?.output ?? "pretty",
|
|
90
|
+
};
|
|
91
|
+
if (previous)
|
|
92
|
+
setHost(host);
|
|
93
|
+
return host;
|
|
94
|
+
}
|
|
95
|
+
export { terminateIfNeeded };
|
|
96
|
+
//# sourceMappingURL=layer-environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-environment.js","sourceRoot":"","sources":["../../src/lib/layer-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,SAAS,GAKV,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAA;AACpF,OAAO,EAAE,gBAAgB,E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EAAE,IAAI,EAAE,CAAA;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAyB,EACzB,QAAkB;IAElB,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,CAAA;QAChC,CAAC;QAAC,MAAM,CAAC;YACP,YAAY;QACd,CAAC;IACH,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAClD,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;IAC5B,MAAM,IAAI,GAAY;QACpB,GAAG;QACH,QAAQ,EAAE,GAAG,CAAC,WAAW,EAAE;QAC3B,aAAa,EAAE,GAAG,CAAC,EAAE;QACrB,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,QAAQ;KACrC,CAAA;IACD,IAAI,QAAQ;QAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,OAAO,IAAI,CAAA;AACb,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Ecp } from "@executioncontrolprotocol/core";
|
|
2
|
+
import { type EcpHost } from "@executioncontrolprotocol/plugin-sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Resolve an operational Ecp: `--env` module when provided, otherwise the process host.
|
|
5
|
+
* When the init hook has not run (in-process tests), fall back to a fresh Node environment.
|
|
6
|
+
* @category CLI
|
|
7
|
+
*/
|
|
8
|
+
export declare function ecpFromEnvFlag(envPath: string | undefined, host?: EcpHost): Promise<{
|
|
9
|
+
ecp: Ecp;
|
|
10
|
+
terminate: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Terminate an Ecp created for a single command (`--env`), ignoring cleanup errors.
|
|
14
|
+
* @category CLI
|
|
15
|
+
*/
|
|
16
|
+
export declare function terminateIfNeeded(ecp: Ecp, terminate: boolean): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=load-ecp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-ecp.d.ts","sourceRoot":"","sources":["../../src/lib/load-ecp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAE5E;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAc3C;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAOnF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { environment, loadEnvironmentModule, NODE_ENVIRONMENT_ID } from "@executioncontrolprotocol/node";
|
|
2
|
+
import { getHost } from "@executioncontrolprotocol/plugin-sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Resolve an operational Ecp: `--env` module when provided, otherwise the process host.
|
|
5
|
+
* When the init hook has not run (in-process tests), fall back to a fresh Node environment.
|
|
6
|
+
* @category CLI
|
|
7
|
+
*/
|
|
8
|
+
export async function ecpFromEnvFlag(envPath, host) {
|
|
9
|
+
if (envPath) {
|
|
10
|
+
const env = await loadEnvironmentModule(envPath);
|
|
11
|
+
const ecp = await env.init();
|
|
12
|
+
return { ecp, terminate: true };
|
|
13
|
+
}
|
|
14
|
+
if (host)
|
|
15
|
+
return { ecp: host.ecp, terminate: false };
|
|
16
|
+
try {
|
|
17
|
+
return { ecp: getHost().ecp, terminate: false };
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
const env = environment(NODE_ENVIRONMENT_ID, "cli");
|
|
21
|
+
const ecp = await env.init();
|
|
22
|
+
return { ecp, terminate: true };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Terminate an Ecp created for a single command (`--env`), ignoring cleanup errors.
|
|
27
|
+
* @category CLI
|
|
28
|
+
*/
|
|
29
|
+
export async function terminateIfNeeded(ecp, terminate) {
|
|
30
|
+
if (!terminate)
|
|
31
|
+
return;
|
|
32
|
+
try {
|
|
33
|
+
await ecp.terminate();
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
/* ignore */
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=load-ecp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-ecp.js","sourceRoot":"","sources":["../../src/lib/load-ecp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AAExG,OAAO,EAAE,OAAO,EAAgB,MAAM,sCAAsC,CAAA;AAE5E;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAA2B,EAC3B,IAAc;IAEd,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,MAAM,qBAAqB,CAAC,OAAO,CAAC,CAAA;QAChD,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;QAC5B,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;IACjC,CAAC;IACD,IAAI,IAAI;QAAE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;IACpD,IAAI,CAAC;QACH,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,GAAG,WAAW,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAA;QACnD,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;QAC5B,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;IACjC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,GAAQ,EAAE,SAAkB;IAClE,IAAI,CAAC,SAAS;QAAE,OAAM;IACtB,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,SAAS,EAAE,CAAA;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,YAAY;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Interfaces } from "@oclif/core";
|
|
2
|
+
import { type RequirementsDocument } from "@executioncontrolprotocol/core";
|
|
3
|
+
/** Why a required plugin is not usable. @category CLI */
|
|
4
|
+
export type MissingPluginReason = "missing" | "version";
|
|
5
|
+
/** One missing or out-of-range plugin. @category CLI */
|
|
6
|
+
export interface MissingPlugin {
|
|
7
|
+
/** Extension or policy id. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** npm package to install. */
|
|
10
|
+
package: string;
|
|
11
|
+
/** Requested semver range, when pinned. */
|
|
12
|
+
range?: string;
|
|
13
|
+
/** Why it is missing. */
|
|
14
|
+
reason: MissingPluginReason;
|
|
15
|
+
/** Exact install command. */
|
|
16
|
+
command: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Requirements that are not satisfied by currently installed plugins.
|
|
20
|
+
* Built-ins are skipped. Missing `package` rows are skipped (nothing to install).
|
|
21
|
+
* @category CLI
|
|
22
|
+
*/
|
|
23
|
+
export declare function findMissingPlugins(requirements: RequirementsDocument, config: Interfaces.Config): MissingPlugin[];
|
|
24
|
+
//# sourceMappingURL=missing-plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-plugins.d.ts","sourceRoot":"","sources":["../../src/lib/missing-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAA;AAGvC,yDAAyD;AACzD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,SAAS,CAAA;AAEvD,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yBAAyB;IACzB,MAAM,EAAE,mBAAmB,CAAA;IAC3B,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAA;CAChB;AAeD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,oBAAoB,EAClC,MAAM,EAAE,UAAU,CAAC,MAAM,GACxB,aAAa,EAAE,CAsBjB"}
|