@executioncontrolprotocol/plugin-sdk 0.50.0 → 0.60.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 +6 -26
- package/dist/bin/ecp-plugin-manifest.d.ts +3 -0
- package/dist/bin/ecp-plugin-manifest.d.ts.map +1 -0
- package/dist/bin/ecp-plugin-manifest.js +94 -0
- package/dist/bin/ecp-plugin-manifest.js.map +1 -0
- package/dist/canonical.d.ts +15 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +30 -0
- package/dist/canonical.js.map +1 -0
- package/dist/define.d.ts +117 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +88 -0
- package/dist/define.js.map +1 -0
- package/dist/file-ref.d.ts +58 -0
- package/dist/file-ref.d.ts.map +1 -0
- package/dist/file-ref.js +33 -0
- package/dist/file-ref.js.map +1 -0
- package/dist/index.d.ts +13 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -14
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +67 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +163 -0
- package/dist/manifest.js.map +1 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/package.json +14 -13
- package/dist/build/build-plugin.d.ts +0 -7
- package/dist/build/build-plugin.d.ts.map +0 -1
- package/dist/build/build-plugin.js +0 -52
- package/dist/build/build-plugin.js.map +0 -1
- package/dist/build/check-plugin.d.ts +0 -7
- package/dist/build/check-plugin.d.ts.map +0 -1
- package/dist/build/check-plugin.js +0 -98
- package/dist/build/check-plugin.js.map +0 -1
- package/dist/build/generated-pjson.d.ts +0 -23
- package/dist/build/generated-pjson.d.ts.map +0 -1
- package/dist/build/generated-pjson.js +0 -72
- package/dist/build/generated-pjson.js.map +0 -1
- package/dist/build/scaffold-plugin.d.ts +0 -6
- package/dist/build/scaffold-plugin.d.ts.map +0 -1
- package/dist/build/scaffold-plugin.js +0 -103
- package/dist/build/scaffold-plugin.js.map +0 -1
- package/dist/build/types.d.ts +0 -37
- package/dist/build/types.d.ts.map +0 -1
- package/dist/build/types.js +0 -2
- package/dist/build/types.js.map +0 -1
- package/dist/codes.d.ts +0 -12
- package/dist/codes.d.ts.map +0 -1
- package/dist/codes.js +0 -12
- package/dist/codes.js.map +0 -1
- package/dist/define-operation.d.ts +0 -77
- package/dist/define-operation.d.ts.map +0 -1
- package/dist/define-operation.js +0 -47
- package/dist/define-operation.js.map +0 -1
- package/dist/ecp-command.d.ts +0 -40
- package/dist/ecp-command.d.ts.map +0 -1
- package/dist/ecp-command.js +0 -100
- package/dist/ecp-command.js.map +0 -1
- package/dist/envelope.d.ts +0 -48
- package/dist/envelope.d.ts.map +0 -1
- package/dist/envelope.js +0 -15
- package/dist/envelope.js.map +0 -1
- package/dist/errors.d.ts +0 -27
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -38
- package/dist/errors.js.map +0 -1
- package/dist/flags-from-schema.d.ts +0 -17
- package/dist/flags-from-schema.d.ts.map +0 -1
- package/dist/flags-from-schema.js +0 -129
- package/dist/flags-from-schema.js.map +0 -1
- package/dist/help-text.d.ts +0 -13
- package/dist/help-text.d.ts.map +0 -1
- package/dist/help-text.js +0 -38
- package/dist/help-text.js.map +0 -1
- package/dist/host.d.ts +0 -51
- package/dist/host.d.ts.map +0 -1
- package/dist/host.js +0 -30
- package/dist/host.js.map +0 -1
- package/dist/input-merge.d.ts +0 -12
- package/dist/input-merge.d.ts.map +0 -1
- package/dist/input-merge.js +0 -76
- package/dist/input-merge.js.map +0 -1
- package/dist/kebab.d.ts +0 -6
- package/dist/kebab.d.ts.map +0 -1
- package/dist/kebab.js +0 -12
- package/dist/kebab.js.map +0 -1
- package/dist/reserved-names.d.ts +0 -16
- package/dist/reserved-names.d.ts.map +0 -1
- package/dist/reserved-names.js +0 -37
- package/dist/reserved-names.js.map +0 -1
- package/dist/schema-fields.d.ts +0 -7
- package/dist/schema-fields.d.ts.map +0 -1
- package/dist/schema-fields.js +0 -11
- package/dist/schema-fields.js.map +0 -1
- package/dist/to-commands.d.ts +0 -9
- package/dist/to-commands.d.ts.map +0 -1
- package/dist/to-commands.js +0 -162
- package/dist/to-commands.js.map +0 -1
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { toKebabCase } from "../kebab.js";
|
|
4
|
-
function pluginPackageName(name) {
|
|
5
|
-
if (name.startsWith("@"))
|
|
6
|
-
return name;
|
|
7
|
-
const slug = toKebabCase(name.replace(/^plugin-/, ""));
|
|
8
|
-
return `@executioncontrolprotocol/plugin-${slug}`;
|
|
9
|
-
}
|
|
10
|
-
function extensionName(name) {
|
|
11
|
-
if (name.startsWith("@")) {
|
|
12
|
-
const rest = name.split("/")[1] ?? name;
|
|
13
|
-
return rest.replace(/^plugin-/, "");
|
|
14
|
-
}
|
|
15
|
-
return toKebabCase(name.replace(/^plugin-/, ""));
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Scaffold a plugin directory with `src/index.ts` and a minimal `package.json`.
|
|
19
|
-
* @category CLI
|
|
20
|
-
*/
|
|
21
|
-
export async function scaffoldPlugin(dir, name) {
|
|
22
|
-
const pkgName = pluginPackageName(name);
|
|
23
|
-
const extName = extensionName(name);
|
|
24
|
-
await mkdir(join(dir, "src"), { recursive: true });
|
|
25
|
-
const packageJson = {
|
|
26
|
-
name: pkgName,
|
|
27
|
-
version: "0.50.0",
|
|
28
|
-
description: `ECP plugin ${extName}`,
|
|
29
|
-
license: "Apache-2.0",
|
|
30
|
-
type: "module",
|
|
31
|
-
main: "./dist/index.js",
|
|
32
|
-
types: "./dist/index.d.ts",
|
|
33
|
-
exports: {
|
|
34
|
-
".": {
|
|
35
|
-
types: "./dist/index.d.ts",
|
|
36
|
-
import: "./dist/index.js",
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
files: ["dist", "README.md"],
|
|
40
|
-
scripts: {
|
|
41
|
-
build: "tsc -b && ecp plugins build",
|
|
42
|
-
},
|
|
43
|
-
peerDependencies: {
|
|
44
|
-
"@executioncontrolprotocol/core": "workspace:^",
|
|
45
|
-
zod: "catalog:",
|
|
46
|
-
},
|
|
47
|
-
dependencies: {
|
|
48
|
-
"@executioncontrolprotocol/plugin-sdk": "workspace:^",
|
|
49
|
-
},
|
|
50
|
-
devDependencies: {
|
|
51
|
-
"@executioncontrolprotocol/cli": "workspace:^",
|
|
52
|
-
"@executioncontrolprotocol/core": "workspace:^",
|
|
53
|
-
typescript: "catalog:",
|
|
54
|
-
zod: "catalog:",
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
await writeFile(join(dir, "package.json"), `${JSON.stringify(packageJson, null, 2)}\n`, "utf8");
|
|
58
|
-
const source = `import { defineExtension, capabilityFor } from "@executioncontrolprotocol/core"
|
|
59
|
-
import { z } from "zod"
|
|
60
|
-
|
|
61
|
-
const ${camel(extName)}Extension = defineExtension("@executioncontrolprotocol", ${JSON.stringify(extName)})
|
|
62
|
-
.withMetadata({
|
|
63
|
-
summary: "${extName} plugin",
|
|
64
|
-
description: "Replace this summary with product prose.",
|
|
65
|
-
useCases: ["Call this plugin when the workflow needs ${extName}"],
|
|
66
|
-
})
|
|
67
|
-
.withCapabilities([
|
|
68
|
-
capabilityFor("@executioncontrolprotocol/${extName}", "run")
|
|
69
|
-
.withInput(z.object({ value: z.string() }))
|
|
70
|
-
.withOutput(z.object({ result: z.string() }))
|
|
71
|
-
.withMetadata({
|
|
72
|
-
summary: "Echo value",
|
|
73
|
-
description: "Returns the input value. Replace with a real handler.",
|
|
74
|
-
useCases: ["Smoke-test a newly scaffolded plugin"],
|
|
75
|
-
projections: [
|
|
76
|
-
{
|
|
77
|
-
summary: "Take the result string",
|
|
78
|
-
description: "Use result as the echoed value.",
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
})
|
|
82
|
-
.withHandler(async (input) => ({ result: input.value })),
|
|
83
|
-
])
|
|
84
|
-
.build()
|
|
85
|
-
|
|
86
|
-
export default ${camel(extName)}Extension
|
|
87
|
-
`;
|
|
88
|
-
await writeFile(join(dir, "src", "index.ts"), source, "utf8");
|
|
89
|
-
const tsconfig = {
|
|
90
|
-
extends: "../../tsconfig.base.json",
|
|
91
|
-
compilerOptions: { outDir: "dist", rootDir: "src", composite: true },
|
|
92
|
-
include: ["src/**/*.ts"],
|
|
93
|
-
references: [{ path: "../../packages/core" }],
|
|
94
|
-
};
|
|
95
|
-
await writeFile(join(dir, "tsconfig.json"), `${JSON.stringify(tsconfig, null, 2)}\n`, "utf8");
|
|
96
|
-
}
|
|
97
|
-
function camel(value) {
|
|
98
|
-
const parts = value.split(/[-_]/g).filter(Boolean);
|
|
99
|
-
const [first = "plugin", ...rest] = parts;
|
|
100
|
-
return (first.replace(/[^a-zA-Z0-9]/g, "") +
|
|
101
|
-
rest.map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(""));
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=scaffold-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold-plugin.js","sourceRoot":"","sources":["../../src/build/scaffold-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,SAAS,iBAAiB,CAAC,IAAY;IACrC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IACrC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAA;IACtD,OAAO,oCAAoC,IAAI,EAAE,CAAA;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ACzC,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;QAClC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CACjE,CAAA;AACH,CAAC"}
|
package/dist/build/types.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Report from {@link buildPlugin}.
|
|
3
|
-
* @category CLI
|
|
4
|
-
*/
|
|
5
|
-
export interface BuildReport {
|
|
6
|
-
/** Plugin directory. */
|
|
7
|
-
dir: string;
|
|
8
|
-
/** Written files (relative to dir). */
|
|
9
|
-
written: string[];
|
|
10
|
-
/** Extension or policy id loaded from dist. */
|
|
11
|
-
definitionId: string;
|
|
12
|
-
/** Generated command ids. */
|
|
13
|
-
commandIds: string[];
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Stale-file issue from {@link checkPlugin}.
|
|
17
|
-
* @category CLI
|
|
18
|
-
*/
|
|
19
|
-
export interface CheckIssue {
|
|
20
|
-
/** File or field that is stale. */
|
|
21
|
-
path: string;
|
|
22
|
-
/** What is wrong. */
|
|
23
|
-
message: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Report from {@link checkPlugin}.
|
|
27
|
-
* @category CLI
|
|
28
|
-
*/
|
|
29
|
-
export interface CheckReport {
|
|
30
|
-
/** Plugin directory. */
|
|
31
|
-
dir: string;
|
|
32
|
-
/** True when generated files match the definition. */
|
|
33
|
-
ok: boolean;
|
|
34
|
-
/** Stale or missing generated artifacts. */
|
|
35
|
-
issues: CheckIssue[];
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/build/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,uCAAuC;IACvC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAA;IACpB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,sDAAsD;IACtD,EAAE,EAAE,OAAO,CAAA;IACX,4CAA4C;IAC5C,MAAM,EAAE,UAAU,EAAE,CAAA;CACrB"}
|
package/dist/build/types.js
DELETED
package/dist/build/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/build/types.ts"],"names":[],"mappings":""}
|
package/dist/codes.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { ECP_BINDING_INVALID, ECP_CAPABILITY_UNKNOWN, ECP_ENVIRONMENT_UNSUPPORTED, ECP_INPUT_INVALID, ECP_PLUGIN_DENIED, ECP_PLUGINS_MISSING, ECP_POLICY_DENIED, ECP_RUN_PAUSED, ECP_SECRET_MISSING, ECP_STEP_FAILED, ECP_WORKFLOW_LOAD, ECP_RERUN_INCOMPATIBLE, } from "@executioncontrolprotocol/core/types";
|
|
2
|
-
/** Process exit code for success. @category CLI */
|
|
3
|
-
export declare const EXIT_OK = 0;
|
|
4
|
-
/** Process exit code when a capability or run failed. @category CLI */
|
|
5
|
-
export declare const EXIT_FAILED = 1;
|
|
6
|
-
/** Process exit code for invalid input or usage. @category CLI */
|
|
7
|
-
export declare const EXIT_USAGE = 2;
|
|
8
|
-
/** Process exit code when a required plugin is missing. @category CLI */
|
|
9
|
-
export declare const EXIT_PLUGINS_MISSING = 3;
|
|
10
|
-
/** Process exit code when a policy paused execution. @category CLI */
|
|
11
|
-
export declare const EXIT_PAUSED = 4;
|
|
12
|
-
//# sourceMappingURL=codes.d.ts.map
|
package/dist/codes.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../src/codes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,sCAAsC,CAAA;AAE7C,mDAAmD;AACnD,eAAO,MAAM,OAAO,IAAI,CAAA;AAExB,uEAAuE;AACvE,eAAO,MAAM,WAAW,IAAI,CAAA;AAE5B,kEAAkE;AAClE,eAAO,MAAM,UAAU,IAAI,CAAA;AAE3B,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAErC,sEAAsE;AACtE,eAAO,MAAM,WAAW,IAAI,CAAA"}
|
package/dist/codes.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { ECP_BINDING_INVALID, ECP_CAPABILITY_UNKNOWN, ECP_ENVIRONMENT_UNSUPPORTED, ECP_INPUT_INVALID, ECP_PLUGIN_DENIED, ECP_PLUGINS_MISSING, ECP_POLICY_DENIED, ECP_RUN_PAUSED, ECP_SECRET_MISSING, ECP_STEP_FAILED, ECP_WORKFLOW_LOAD, ECP_RERUN_INCOMPATIBLE, } from "@executioncontrolprotocol/core/types";
|
|
2
|
-
/** Process exit code for success. @category CLI */
|
|
3
|
-
export const EXIT_OK = 0;
|
|
4
|
-
/** Process exit code when a capability or run failed. @category CLI */
|
|
5
|
-
export const EXIT_FAILED = 1;
|
|
6
|
-
/** Process exit code for invalid input or usage. @category CLI */
|
|
7
|
-
export const EXIT_USAGE = 2;
|
|
8
|
-
/** Process exit code when a required plugin is missing. @category CLI */
|
|
9
|
-
export const EXIT_PLUGINS_MISSING = 3;
|
|
10
|
-
/** Process exit code when a policy paused execution. @category CLI */
|
|
11
|
-
export const EXIT_PAUSED = 4;
|
|
12
|
-
//# sourceMappingURL=codes.js.map
|
package/dist/codes.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codes.js","sourceRoot":"","sources":["../src/codes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,sCAAsC,CAAA;AAE7C,mDAAmD;AACnD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAA;AAExB,uEAAuE;AACvE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAA;AAE5B,kEAAkE;AAClE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAA;AAE3B,yEAAyE;AACzE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAA;AAErC,sEAAsE;AACtE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAA"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { Interfaces } from "@oclif/core";
|
|
2
|
-
import type { z } from "zod";
|
|
3
|
-
import type { EcpHost } from "./host.js";
|
|
4
|
-
/**
|
|
5
|
-
* Optional CLI hint on an operation: positional argument field names.
|
|
6
|
-
* @category CLI
|
|
7
|
-
*/
|
|
8
|
-
export interface OperationCliHint {
|
|
9
|
-
/** Input-schema field names that become positional args, in order. */
|
|
10
|
-
args?: string[];
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Agent-facing metadata for a host operation.
|
|
14
|
-
* @category CLI
|
|
15
|
-
*/
|
|
16
|
-
export interface OperationMetadata {
|
|
17
|
-
/** One-line summary. */
|
|
18
|
-
summary: string;
|
|
19
|
-
/** Longer description. */
|
|
20
|
-
description?: string;
|
|
21
|
-
/** When to use this command. */
|
|
22
|
-
useCases?: string[];
|
|
23
|
-
/** Example invocations. */
|
|
24
|
-
examples?: string[];
|
|
25
|
-
/** Positional argument mapping. */
|
|
26
|
-
cli?: OperationCliHint;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Context passed to an operation handler.
|
|
30
|
-
* @category CLI
|
|
31
|
-
*/
|
|
32
|
-
export interface OperationContext {
|
|
33
|
-
/** Process host, when the init hook has run. */
|
|
34
|
-
host: EcpHost | undefined;
|
|
35
|
-
/** oclif config. */
|
|
36
|
-
config: Interfaces.Config;
|
|
37
|
-
/** Parsed argv after the command id. */
|
|
38
|
-
argv: string[];
|
|
39
|
-
/** True when `--json` was passed. */
|
|
40
|
-
json: boolean;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Host command definition (CLI's own commands). Not usable as a workflow step.
|
|
44
|
-
* @category CLI
|
|
45
|
-
*/
|
|
46
|
-
export interface OperationDefinition {
|
|
47
|
-
/** Command id (`run`, `plugins:new`, `config:secrets:add`). */
|
|
48
|
-
name: string;
|
|
49
|
-
/** Zod schema for merged flags and args. */
|
|
50
|
-
inputSchema: z.ZodType;
|
|
51
|
-
/** Agent-facing docs. */
|
|
52
|
-
metadata: OperationMetadata;
|
|
53
|
-
/** Run the operation; return value becomes envelope `data`. */
|
|
54
|
-
handler: (input: Record<string, unknown>, ctx: OperationContext) => Promise<unknown>;
|
|
55
|
-
}
|
|
56
|
-
declare class OperationBuilder {
|
|
57
|
-
private readonly name;
|
|
58
|
-
private inputSchema?;
|
|
59
|
-
private metadata?;
|
|
60
|
-
private handler?;
|
|
61
|
-
constructor(name: string);
|
|
62
|
-
/** Set the input schema. */
|
|
63
|
-
withInput(schema: z.ZodType): this;
|
|
64
|
-
/** Set command metadata. */
|
|
65
|
-
withMetadata(metadata: OperationMetadata): this;
|
|
66
|
-
/** Set the handler. */
|
|
67
|
-
withHandler(handler: OperationDefinition["handler"]): this;
|
|
68
|
-
/** Build a plain operation definition. */
|
|
69
|
-
build(): OperationDefinition;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Start a host-operation builder. The CLI's own commands are operations.
|
|
73
|
-
* @category CLI
|
|
74
|
-
*/
|
|
75
|
-
export declare function defineOperation(name: string): OperationBuilder;
|
|
76
|
-
export {};
|
|
77
|
-
//# sourceMappingURL=define-operation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-operation.d.ts","sourceRoot":"","sources":["../src/define-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,mCAAmC;IACnC,GAAG,CAAC,EAAE,gBAAgB,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,IAAI,EAAE,OAAO,GAAG,SAAS,CAAA;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|
-
this.name = name;
|
|
8
|
-
}
|
|
9
|
-
/** Set the input schema. */
|
|
10
|
-
withInput(schema) {
|
|
11
|
-
this.inputSchema = schema;
|
|
12
|
-
return this;
|
|
13
|
-
}
|
|
14
|
-
/** Set command metadata. */
|
|
15
|
-
withMetadata(metadata) {
|
|
16
|
-
this.metadata = metadata;
|
|
17
|
-
return this;
|
|
18
|
-
}
|
|
19
|
-
/** Set the handler. */
|
|
20
|
-
withHandler(handler) {
|
|
21
|
-
this.handler = handler;
|
|
22
|
-
return this;
|
|
23
|
-
}
|
|
24
|
-
/** Build a plain operation definition. */
|
|
25
|
-
build() {
|
|
26
|
-
if (!this.inputSchema)
|
|
27
|
-
throw new Error(`Operation ${this.name} is missing withInput`);
|
|
28
|
-
if (!this.metadata?.summary)
|
|
29
|
-
throw new Error(`Operation ${this.name} is missing metadata.summary`);
|
|
30
|
-
if (!this.handler)
|
|
31
|
-
throw new Error(`Operation ${this.name} is missing withHandler`);
|
|
32
|
-
return {
|
|
33
|
-
name: this.name,
|
|
34
|
-
inputSchema: this.inputSchema,
|
|
35
|
-
metadata: this.metadata,
|
|
36
|
-
handler: this.handler,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Start a host-operation builder. The CLI's own commands are operations.
|
|
42
|
-
* @category CLI
|
|
43
|
-
*/
|
|
44
|
-
export function defineOperation(name) {
|
|
45
|
-
return new OperationBuilder(name);
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=define-operation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-operation.js","sourceRoot":"","sources":["../src/define-operation.ts"],"names":[],"mappings":"AA4DA,MAAM,gBAAgB;IAKS;IAJrB,WAAW,CAAY;IACvB,QAAQ,CAAoB;IAC5B,OAAO,CAAiC;IAEhD,YAA6B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAE7C,4BAA4B;IAC5B,SAAS,CAAC,MAAiB;QACzB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA;QACzB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,4BAA4B;IAC5B,YAAY,CAAC,QAA2B;QACtC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,uBAAuB;IACvB,WAAW,CAAC,OAAuC;QACjD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,0CAA0C;IAC1C,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,uBAAuB,CAAC,CAAA;QACrF,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,8BAA8B,CAAC,CAAA;QAClG,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,yBAAyB,CAAC,CAAA;QACnF,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;IACH,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC"}
|
package/dist/ecp-command.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
/**
|
|
3
|
-
* Base class for generated capability and operation commands.
|
|
4
|
-
* Owns the JSON envelope, error codes and exit codes.
|
|
5
|
-
* @category CLI
|
|
6
|
-
*/
|
|
7
|
-
export declare abstract class EcpCommand extends Command {
|
|
8
|
-
static enableJsonFlag: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* True when the caller passed `--json`. Non-TTY spawn clients keep pretty JSON
|
|
11
|
-
* until they opt in with `--json` (existing CLI tests).
|
|
12
|
-
* @category CLI
|
|
13
|
-
*/
|
|
14
|
-
protected wantsEnvelope(): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Pretty-print `data` when not using `--json`. With `--json`, oclif prints
|
|
17
|
-
* {@link toSuccessJson} from the `run()` return value.
|
|
18
|
-
* @category CLI
|
|
19
|
-
*/
|
|
20
|
-
protected writeSuccess(data: unknown): void;
|
|
21
|
-
/**
|
|
22
|
-
* oclif `--json` success wrapper. Returns the ECP envelope, not the raw result.
|
|
23
|
-
* @category CLI
|
|
24
|
-
*/
|
|
25
|
-
toSuccessJson(result: unknown): unknown;
|
|
26
|
-
/**
|
|
27
|
-
* oclif `--json` error wrapper. Keeps the `ECP_*` code instead of oclif's
|
|
28
|
-
* `{ error: { oclif: { exit } } }` payload.
|
|
29
|
-
* @category CLI
|
|
30
|
-
*/
|
|
31
|
-
toErrorJson(error: unknown): unknown;
|
|
32
|
-
/**
|
|
33
|
-
* Print the ECP error envelope (or pretty message) and exit.
|
|
34
|
-
* @category CLI
|
|
35
|
-
*/
|
|
36
|
-
catch(error: Error & {
|
|
37
|
-
exitCode?: number;
|
|
38
|
-
}): Promise<void>;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=ecp-command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ecp-command.d.ts","sourceRoot":"","sources":["../src/ecp-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAKrC;;;;GAIG;AACH,8BAAsB,UAAW,SAAQ,OAAO;IAC9C,MAAM,CAAC,cAAc,UAAO;IAE5B;;;;OAIG;IACH,SAAS,CAAC,aAAa,IAAI,OAAO;IAIlC;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAU3C;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO;IAKvC;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIpC;;;OAGG;IACG,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAWjE"}
|
package/dist/ecp-command.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
import { ECP_INPUT_INVALID, EXIT_FAILED, EXIT_USAGE } from "./codes.js";
|
|
3
|
-
import { EcpCliError } from "./errors.js";
|
|
4
|
-
import { failureEnvelope } from "./envelope.js";
|
|
5
|
-
/**
|
|
6
|
-
* Base class for generated capability and operation commands.
|
|
7
|
-
* Owns the JSON envelope, error codes and exit codes.
|
|
8
|
-
* @category CLI
|
|
9
|
-
*/
|
|
10
|
-
export class EcpCommand extends Command {
|
|
11
|
-
static enableJsonFlag = true;
|
|
12
|
-
/**
|
|
13
|
-
* True when the caller passed `--json`. Non-TTY spawn clients keep pretty JSON
|
|
14
|
-
* until they opt in with `--json` (existing CLI tests).
|
|
15
|
-
* @category CLI
|
|
16
|
-
*/
|
|
17
|
-
wantsEnvelope() {
|
|
18
|
-
return this.jsonEnabled();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Pretty-print `data` when not using `--json`. With `--json`, oclif prints
|
|
22
|
-
* {@link toSuccessJson} from the `run()` return value.
|
|
23
|
-
* @category CLI
|
|
24
|
-
*/
|
|
25
|
-
writeSuccess(data) {
|
|
26
|
-
if (this.jsonEnabled())
|
|
27
|
-
return;
|
|
28
|
-
if (data === undefined)
|
|
29
|
-
return;
|
|
30
|
-
if (typeof data === "string") {
|
|
31
|
-
this.log(data);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
this.log(JSON.stringify(data, null, 2));
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* oclif `--json` success wrapper. Returns the ECP envelope, not the raw result.
|
|
38
|
-
* @category CLI
|
|
39
|
-
*/
|
|
40
|
-
toSuccessJson(result) {
|
|
41
|
-
if (this.argv?.includes("--events"))
|
|
42
|
-
return undefined;
|
|
43
|
-
return { ok: true, data: result };
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* oclif `--json` error wrapper. Keeps the `ECP_*` code instead of oclif's
|
|
47
|
-
* `{ error: { oclif: { exit } } }` payload.
|
|
48
|
-
* @category CLI
|
|
49
|
-
*/
|
|
50
|
-
toErrorJson(error) {
|
|
51
|
-
return failureEnvelope(errorBody(error));
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Print the ECP error envelope (or pretty message) and exit.
|
|
55
|
-
* @category CLI
|
|
56
|
-
*/
|
|
57
|
-
async catch(error) {
|
|
58
|
-
const body = errorBody(error);
|
|
59
|
-
const exitCode = exitCodeOf(error);
|
|
60
|
-
const json = this.jsonEnabled() || (this.argv ?? []).includes("--json");
|
|
61
|
-
if (json) {
|
|
62
|
-
// `this.log` is a no-op when jsonEnabled() is true; `logJson` always writes.
|
|
63
|
-
this.logJson(this.toErrorJson(error));
|
|
64
|
-
this.exit(exitCode);
|
|
65
|
-
}
|
|
66
|
-
this.error(body.message, { exit: exitCode });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function errorBody(error) {
|
|
70
|
-
if (error instanceof EcpCliError)
|
|
71
|
-
return error.toBody();
|
|
72
|
-
if (error && typeof error === "object" && "oclif" in error) {
|
|
73
|
-
const err = error;
|
|
74
|
-
const exit = err.oclif?.exit;
|
|
75
|
-
return {
|
|
76
|
-
code: exit === EXIT_USAGE ? ECP_INPUT_INVALID : "ECP_CLI_ERROR",
|
|
77
|
-
message: err.message,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
if (error instanceof Error) {
|
|
81
|
-
return { code: "ECP_CLI_ERROR", message: error.message };
|
|
82
|
-
}
|
|
83
|
-
return { code: "ECP_CLI_ERROR", message: String(error) };
|
|
84
|
-
}
|
|
85
|
-
function exitCodeOf(error) {
|
|
86
|
-
if (error instanceof EcpCliError)
|
|
87
|
-
return error.exitCode;
|
|
88
|
-
if (error && typeof error === "object" && "oclif" in error) {
|
|
89
|
-
const exit = error.oclif?.exit;
|
|
90
|
-
if (typeof exit === "number")
|
|
91
|
-
return exit;
|
|
92
|
-
}
|
|
93
|
-
if (error && typeof error === "object" && "exitCode" in error) {
|
|
94
|
-
const exit = error.exitCode;
|
|
95
|
-
if (typeof exit === "number")
|
|
96
|
-
return exit;
|
|
97
|
-
}
|
|
98
|
-
return EXIT_FAILED;
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=ecp-command.js.map
|
package/dist/ecp-command.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ecp-command.js","sourceRoot":"","sources":["../src/ecp-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,eAAe,EAAqB,MAAM,eAAe,CAAA;AAElE;;;;GAIG;AACH,MAAM,OAAgB,UAAW,SAAQ,OAAO;IAC9C,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;IAE5B;;;;OAIG;IACO,aAAa;QACrB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;IAC3B,CAAC;IAED;;;;OAIG;IACO,YAAY,CAAC,IAAa;QAClC,IAAI,IAAI,CAAC,WAAW,EAAE;YAAE,OAAM;QAC9B,IAAI,IAAI,KAAK,SAAS;YAAE,OAAM;QAC9B,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,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|
-
* @category CLI
|
|
4
|
-
*/
|
|
5
|
-
export interface EcpErrorBody {
|
|
6
|
-
/** Stable `ECP_*` (or invoke) code. */
|
|
7
|
-
code: string;
|
|
8
|
-
/** Human-readable message. */
|
|
9
|
-
message: string;
|
|
10
|
-
/** Optional JSON-pointer or flag path. */
|
|
11
|
-
path?: string;
|
|
12
|
-
/** Optional recovery hints. */
|
|
13
|
-
suggestions?: string[];
|
|
14
|
-
/** Structured extras (for example missing-plugin rows). */
|
|
15
|
-
details?: unknown;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Success envelope printed with `--json` or when stdout is not a TTY.
|
|
19
|
-
* @category CLI
|
|
20
|
-
*/
|
|
21
|
-
export interface EcpSuccessEnvelope {
|
|
22
|
-
ok: true;
|
|
23
|
-
data: unknown;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Failure envelope printed with `--json` or when stdout is not a TTY.
|
|
27
|
-
* @category CLI
|
|
28
|
-
*/
|
|
29
|
-
export interface EcpFailureEnvelope {
|
|
30
|
-
ok: false;
|
|
31
|
-
error: EcpErrorBody;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* CLI JSON envelope.
|
|
35
|
-
* @category CLI
|
|
36
|
-
*/
|
|
37
|
-
export type EcpEnvelope = EcpSuccessEnvelope | EcpFailureEnvelope;
|
|
38
|
-
/**
|
|
39
|
-
* Build a success envelope.
|
|
40
|
-
* @category CLI
|
|
41
|
-
*/
|
|
42
|
-
export declare function successEnvelope(data: unknown): EcpSuccessEnvelope;
|
|
43
|
-
/**
|
|
44
|
-
* Build a failure envelope.
|
|
45
|
-
* @category CLI
|
|
46
|
-
*/
|
|
47
|
-
export declare function failureEnvelope(error: EcpErrorBody): EcpFailureEnvelope;
|
|
48
|
-
//# sourceMappingURL=envelope.d.ts.map
|
package/dist/envelope.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../src/envelope.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,IAAI,CAAA;IACR,IAAI,EAAE,OAAO,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,KAAK,CAAA;IACT,KAAK,EAAE,YAAY,CAAA;CACpB;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,kBAAkB,CAAA;AAEjE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,kBAAkB,CAEjE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,kBAAkB,CAEvE"}
|
package/dist/envelope.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build a success envelope.
|
|
3
|
-
* @category CLI
|
|
4
|
-
*/
|
|
5
|
-
export function successEnvelope(data) {
|
|
6
|
-
return { ok: true, data };
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Build a failure envelope.
|
|
10
|
-
* @category CLI
|
|
11
|
-
*/
|
|
12
|
-
export function failureEnvelope(error) {
|
|
13
|
-
return { ok: false, error };
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=envelope.js.map
|
package/dist/envelope.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.js","sourceRoot":"","sources":["../src/envelope.ts"],"names":[],"mappings":"AAyCA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAAa;IAC3C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAmB;IACjD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAC7B,CAAC"}
|
package/dist/errors.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { EcpErrorBody } from "./envelope.js";
|
|
2
|
-
/**
|
|
3
|
-
* Thrown by generated commands and operations so {@link EcpCommand} can print
|
|
4
|
-
* the ECP envelope and set the process exit code.
|
|
5
|
-
* @category CLI
|
|
6
|
-
*/
|
|
7
|
-
export declare class EcpCliError extends Error {
|
|
8
|
-
/** Stable `ECP_*` (or invoke) code. */
|
|
9
|
-
readonly code: string;
|
|
10
|
-
/** Optional JSON-pointer or flag path. */
|
|
11
|
-
readonly path?: string;
|
|
12
|
-
/** Optional recovery hints. */
|
|
13
|
-
readonly suggestions?: string[];
|
|
14
|
-
/** Structured extras (for example missing-plugin rows). */
|
|
15
|
-
readonly details?: unknown;
|
|
16
|
-
/** Process exit code. */
|
|
17
|
-
readonly exitCode: number;
|
|
18
|
-
constructor(code: string, message: string, options?: {
|
|
19
|
-
path?: string;
|
|
20
|
-
suggestions?: string[];
|
|
21
|
-
exitCode?: number;
|
|
22
|
-
details?: unknown;
|
|
23
|
-
});
|
|
24
|
-
/** Convert to the envelope error body. */
|
|
25
|
-
toBody(): EcpErrorBody;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,uCAAuC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,+BAA+B;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IAC/B,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,yBAAyB;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;gBAGvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO;IAW/F,0CAA0C;IAC1C,MAAM,IAAI,YAAY;CASvB"}
|
package/dist/errors.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { EXIT_FAILED } from "./codes.js";
|
|
2
|
-
/**
|
|
3
|
-
* Thrown by generated commands and operations so {@link EcpCommand} can print
|
|
4
|
-
* the ECP envelope and set the process exit code.
|
|
5
|
-
* @category CLI
|
|
6
|
-
*/
|
|
7
|
-
export class EcpCliError extends Error {
|
|
8
|
-
/** Stable `ECP_*` (or invoke) code. */
|
|
9
|
-
code;
|
|
10
|
-
/** Optional JSON-pointer or flag path. */
|
|
11
|
-
path;
|
|
12
|
-
/** Optional recovery hints. */
|
|
13
|
-
suggestions;
|
|
14
|
-
/** Structured extras (for example missing-plugin rows). */
|
|
15
|
-
details;
|
|
16
|
-
/** Process exit code. */
|
|
17
|
-
exitCode;
|
|
18
|
-
constructor(code, message, options = {}) {
|
|
19
|
-
super(message);
|
|
20
|
-
this.name = "EcpCliError";
|
|
21
|
-
this.code = code;
|
|
22
|
-
this.path = options.path;
|
|
23
|
-
this.suggestions = options.suggestions;
|
|
24
|
-
this.details = options.details;
|
|
25
|
-
this.exitCode = options.exitCode ?? EXIT_FAILED;
|
|
26
|
-
}
|
|
27
|
-
/** Convert to the envelope error body. */
|
|
28
|
-
toBody() {
|
|
29
|
-
return {
|
|
30
|
-
code: this.code,
|
|
31
|
-
message: this.message,
|
|
32
|
-
...(this.path !== undefined ? { path: this.path } : {}),
|
|
33
|
-
...(this.suggestions !== undefined ? { suggestions: this.suggestions } : {}),
|
|
34
|
-
...(this.details !== undefined ? { details: this.details } : {}),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAGxC;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,uCAAuC;IAC9B,IAAI,CAAQ;IACrB,0CAA0C;IACjC,IAAI,CAAS;IACtB,+BAA+B;IACtB,WAAW,CAAW;IAC/B,2DAA2D;IAClD,OAAO,CAAU;IAC1B,yBAAyB;IAChB,QAAQ,CAAQ;IAEzB,YACE,IAAY,EACZ,OAAe,EACf,UAA2F,EAAE;QAE7F,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC9B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,WAAW,CAAA;IACjD,CAAC;IAED,0CAA0C;IAC1C,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5E,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACjE,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type Command } from "@oclif/core";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
/** oclif flag map generated from a zod object. @category CLI */
|
|
4
|
-
export type GeneratedFlagInput = Command.Class["flags"];
|
|
5
|
-
/**
|
|
6
|
-
* Generate oclif flags from a zod object schema's top-level primitive fields.
|
|
7
|
-
* Nested objects, unions and unknowns get no flag (they come from `--input`).
|
|
8
|
-
* Reserved names (`json`, `input`, `help`, `yes`) stay input-only.
|
|
9
|
-
* @category CLI
|
|
10
|
-
*/
|
|
11
|
-
export declare function flagsFromSchema(schema: z.ZodTypeAny | undefined, reserved?: readonly string[]): GeneratedFlagInput;
|
|
12
|
-
/**
|
|
13
|
-
* True when argv includes an explicit `--name` or `--name=` token.
|
|
14
|
-
* @category CLI
|
|
15
|
-
*/
|
|
16
|
-
export declare function flagProvided(argv: string[], kebabName: string): boolean;
|
|
17
|
-
//# sourceMappingURL=flags-from-schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flags-from-schema.d.ts","sourceRoot":"","sources":["../src/flags-from-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,OAAO,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,gEAAgE;AAChE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AAiFvD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,SAAS,EAChC,QAAQ,GAAE,SAAS,MAAM,EAAwB,GAChD,kBAAkB,CAoCpB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAOvE"}
|