@executioncontrolprotocol/cli 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 -156
- package/bin/dev.js +7 -3
- package/bin/ecp.js +6 -3
- package/bin/run.cmd +2 -3
- package/bin/run.js +1 -2
- package/bin/setup-env.js +42 -0
- package/dist/commands/app.d.ts +22 -0
- package/dist/commands/app.d.ts.map +1 -0
- package/dist/commands/app.js +75 -0
- package/dist/commands/app.js.map +1 -0
- package/dist/commands/commit.d.ts +24 -0
- package/dist/commands/commit.d.ts.map +1 -0
- package/dist/commands/commit.js +76 -0
- package/dist/commands/commit.js.map +1 -0
- package/dist/commands/config/secrets/list.d.ts +17 -0
- package/dist/commands/config/secrets/list.d.ts.map +1 -0
- package/dist/commands/config/secrets/list.js +41 -0
- package/dist/commands/config/secrets/list.js.map +1 -0
- package/dist/commands/config/secrets/set.d.ts +21 -0
- package/dist/commands/config/secrets/set.d.ts.map +1 -0
- package/dist/commands/config/secrets/set.js +86 -0
- package/dist/commands/config/secrets/set.js.map +1 -0
- package/dist/commands/config/secrets/unset.d.ts +20 -0
- package/dist/commands/config/secrets/unset.d.ts.map +1 -0
- package/dist/commands/config/secrets/unset.js +42 -0
- package/dist/commands/config/secrets/unset.js.map +1 -0
- package/dist/commands/execute.d.ts +27 -0
- package/dist/commands/execute.d.ts.map +1 -0
- package/dist/commands/execute.js +92 -0
- package/dist/commands/execute.js.map +1 -0
- package/dist/commands/host/logs.d.ts +19 -0
- package/dist/commands/host/logs.d.ts.map +1 -0
- package/dist/commands/host/logs.js +53 -0
- package/dist/commands/host/logs.js.map +1 -0
- package/dist/commands/host/reload.d.ts +15 -0
- package/dist/commands/host/reload.d.ts.map +1 -0
- package/dist/commands/host/reload.js +17 -0
- package/dist/commands/host/reload.js.map +1 -0
- package/dist/commands/host/restart.d.ts +18 -0
- package/dist/commands/host/restart.d.ts.map +1 -0
- package/dist/commands/host/restart.js +42 -0
- package/dist/commands/host/restart.js.map +1 -0
- package/dist/commands/host/start.d.ts +20 -0
- package/dist/commands/host/start.d.ts.map +1 -0
- package/dist/commands/host/start.js +100 -0
- package/dist/commands/host/start.js.map +1 -0
- package/dist/commands/host/status.d.ts +17 -0
- package/dist/commands/host/status.d.ts.map +1 -0
- package/dist/commands/host/status.js +86 -0
- package/dist/commands/host/status.js.map +1 -0
- package/dist/commands/host/stop.d.ts +18 -0
- package/dist/commands/host/stop.d.ts.map +1 -0
- package/dist/commands/host/stop.js +62 -0
- package/dist/commands/host/stop.js.map +1 -0
- package/dist/commands/mcp/start.d.ts +14 -0
- package/dist/commands/mcp/start.d.ts.map +1 -0
- package/dist/commands/mcp/start.js +42 -0
- package/dist/commands/mcp/start.js.map +1 -0
- package/dist/commands/plugins/index.d.ts +18 -0
- package/dist/commands/plugins/index.d.ts.map +1 -0
- package/dist/commands/plugins/index.js +55 -0
- package/dist/commands/plugins/index.js.map +1 -0
- package/dist/commands/plugins/inspect.d.ts +23 -0
- package/dist/commands/plugins/inspect.d.ts.map +1 -0
- package/dist/commands/plugins/inspect.js +113 -0
- package/dist/commands/plugins/inspect.js.map +1 -0
- package/dist/commands/plugins/install.d.ts +23 -0
- package/dist/commands/plugins/install.d.ts.map +1 -0
- package/dist/commands/plugins/install.js +135 -0
- package/dist/commands/plugins/install.js.map +1 -0
- package/dist/commands/plugins/link.d.ts +22 -0
- package/dist/commands/plugins/link.d.ts.map +1 -0
- package/dist/commands/plugins/link.js +90 -0
- package/dist/commands/plugins/link.js.map +1 -0
- package/dist/commands/plugins/reset.d.ts +20 -0
- package/dist/commands/plugins/reset.d.ts.map +1 -0
- package/dist/commands/plugins/reset.js +112 -0
- package/dist/commands/plugins/reset.js.map +1 -0
- package/dist/commands/plugins/uninstall.d.ts +27 -0
- package/dist/commands/plugins/uninstall.d.ts.map +1 -0
- package/dist/commands/plugins/uninstall.js +89 -0
- package/dist/commands/plugins/uninstall.js.map +1 -0
- package/dist/commands/plugins/update.d.ts +18 -0
- package/dist/commands/plugins/update.d.ts.map +1 -0
- package/dist/commands/plugins/update.js +75 -0
- package/dist/commands/plugins/update.js.map +1 -0
- package/dist/commands/retrieve.d.ts +26 -0
- package/dist/commands/retrieve.d.ts.map +1 -0
- package/dist/commands/retrieve.js +97 -0
- package/dist/commands/retrieve.js.map +1 -0
- package/dist/hooks/init.d.ts +9 -0
- package/dist/hooks/init.d.ts.map +1 -0
- package/dist/hooks/init.js +12 -0
- package/dist/hooks/init.js.map +1 -0
- package/dist/hooks/plugins-changed.d.ts +26 -0
- package/dist/hooks/plugins-changed.d.ts.map +1 -0
- package/dist/hooks/plugins-changed.js +106 -0
- package/dist/hooks/plugins-changed.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/control-client.d.ts +20 -0
- package/dist/lib/control-client.d.ts.map +1 -0
- package/dist/lib/control-client.js +49 -0
- package/dist/lib/control-client.js.map +1 -0
- package/dist/lib/exit.d.ts +12 -0
- package/dist/lib/exit.d.ts.map +1 -0
- package/dist/lib/exit.js +27 -0
- package/dist/lib/exit.js.map +1 -0
- package/dist/lib/help-quality.d.ts +17 -0
- package/dist/lib/help-quality.d.ts.map +1 -0
- package/dist/lib/help-quality.js +53 -0
- package/dist/lib/help-quality.js.map +1 -0
- package/dist/lib/home.d.ts +39 -0
- package/dist/lib/home.d.ts.map +1 -0
- package/dist/lib/home.js +98 -0
- package/dist/lib/home.js.map +1 -0
- package/dist/lib/host-discovery.d.ts +78 -0
- package/dist/lib/host-discovery.d.ts.map +1 -0
- package/dist/lib/host-discovery.js +315 -0
- package/dist/lib/host-discovery.js.map +1 -0
- package/dist/lib/host-unavailable.d.ts +16 -0
- package/dist/lib/host-unavailable.d.ts.map +1 -0
- package/dist/lib/host-unavailable.js +23 -0
- package/dist/lib/host-unavailable.js.map +1 -0
- package/dist/lib/input.d.ts +35 -0
- package/dist/lib/input.d.ts.map +1 -0
- package/dist/lib/input.js +80 -0
- package/dist/lib/input.js.map +1 -0
- package/dist/lib/output.d.ts +69 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +295 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/plugin-mgmt.d.ts +194 -0
- package/dist/lib/plugin-mgmt.d.ts.map +1 -0
- package/dist/lib/plugin-mgmt.js +278 -0
- package/dist/lib/plugin-mgmt.js.map +1 -0
- package/dist/lib/secrets.d.ts +7 -0
- package/dist/lib/secrets.d.ts.map +1 -0
- package/dist/lib/secrets.js +31 -0
- package/dist/lib/secrets.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/oclif.manifest.json +1109 -0
- package/package.json +46 -40
- package/dist/commands.d.ts +0 -7
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -9
- package/dist/commands.js.map +0 -1
- package/dist/hooks/command-not-found.d.ts +0 -8
- package/dist/hooks/command-not-found.d.ts.map +0 -1
- package/dist/hooks/command-not-found.js +0 -72
- package/dist/hooks/command-not-found.js.map +0 -1
- package/dist/hooks/init-host.d.ts +0 -8
- package/dist/hooks/init-host.d.ts.map +0 -1
- package/dist/hooks/init-host.js +0 -45
- package/dist/hooks/init-host.js.map +0 -1
- package/dist/hooks/jit-install.d.ts +0 -8
- package/dist/hooks/jit-install.d.ts.map +0 -1
- package/dist/hooks/jit-install.js +0 -32
- package/dist/hooks/jit-install.js.map +0 -1
- package/dist/hooks/trust.d.ts +0 -9
- package/dist/hooks/trust.d.ts.map +0 -1
- package/dist/hooks/trust.js +0 -32
- package/dist/hooks/trust.js.map +0 -1
- package/dist/lib/argv.d.ts +0 -11
- package/dist/lib/argv.d.ts.map +0 -1
- package/dist/lib/argv.js +0 -30
- package/dist/lib/argv.js.map +0 -1
- package/dist/lib/command-helpers.d.ts +0 -14
- package/dist/lib/command-helpers.d.ts.map +0 -1
- package/dist/lib/command-helpers.js +0 -37
- package/dist/lib/command-helpers.js.map +0 -1
- package/dist/lib/confirm.d.ts +0 -16
- package/dist/lib/confirm.d.ts.map +0 -1
- package/dist/lib/confirm.js +0 -49
- package/dist/lib/confirm.js.map +0 -1
- package/dist/lib/ensure-plugins.d.ts +0 -17
- package/dist/lib/ensure-plugins.d.ts.map +0 -1
- package/dist/lib/ensure-plugins.js +0 -38
- package/dist/lib/ensure-plugins.js.map +0 -1
- package/dist/lib/evaluate-trust.d.ts +0 -26
- package/dist/lib/evaluate-trust.d.ts.map +0 -1
- package/dist/lib/evaluate-trust.js +0 -87
- package/dist/lib/evaluate-trust.js.map +0 -1
- package/dist/lib/format-output.d.ts +0 -17
- package/dist/lib/format-output.d.ts.map +0 -1
- package/dist/lib/format-output.js +0 -63
- package/dist/lib/format-output.js.map +0 -1
- package/dist/lib/init/collect-env-packages.d.ts +0 -14
- package/dist/lib/init/collect-env-packages.d.ts.map +0 -1
- package/dist/lib/init/collect-env-packages.js +0 -36
- package/dist/lib/init/collect-env-packages.js.map +0 -1
- package/dist/lib/init/merge-package-json.d.ts +0 -29
- package/dist/lib/init/merge-package-json.d.ts.map +0 -1
- package/dist/lib/init/merge-package-json.js +0 -56
- package/dist/lib/init/merge-package-json.js.map +0 -1
- package/dist/lib/installed-plugins.d.ts +0 -25
- package/dist/lib/installed-plugins.d.ts.map +0 -1
- package/dist/lib/installed-plugins.js +0 -22
- package/dist/lib/installed-plugins.js.map +0 -1
- package/dist/lib/jit-plugins.d.ts +0 -13
- package/dist/lib/jit-plugins.d.ts.map +0 -1
- package/dist/lib/jit-plugins.js +0 -25
- package/dist/lib/jit-plugins.js.map +0 -1
- package/dist/lib/layer-environment.d.ts +0 -29
- package/dist/lib/layer-environment.d.ts.map +0 -1
- package/dist/lib/layer-environment.js +0 -96
- package/dist/lib/layer-environment.js.map +0 -1
- package/dist/lib/load-ecp.d.ts +0 -17
- package/dist/lib/load-ecp.d.ts.map +0 -1
- package/dist/lib/load-ecp.js +0 -39
- package/dist/lib/load-ecp.js.map +0 -1
- package/dist/lib/missing-plugins.d.ts +0 -24
- package/dist/lib/missing-plugins.d.ts.map +0 -1
- package/dist/lib/missing-plugins.js +0 -53
- package/dist/lib/missing-plugins.js.map +0 -1
- package/dist/lib/npm-registry.d.ts +0 -40
- package/dist/lib/npm-registry.d.ts.map +0 -1
- package/dist/lib/npm-registry.js +0 -68
- package/dist/lib/npm-registry.js.map +0 -1
- package/dist/lib/plugin-bindings.d.ts +0 -13
- package/dist/lib/plugin-bindings.d.ts.map +0 -1
- package/dist/lib/plugin-bindings.js +0 -49
- package/dist/lib/plugin-bindings.js.map +0 -1
- package/dist/lib/plugin-source.d.ts +0 -11
- package/dist/lib/plugin-source.d.ts.map +0 -1
- package/dist/lib/plugin-source.js +0 -32
- package/dist/lib/plugin-source.js.map +0 -1
- package/dist/lib/prepare-workflow.d.ts +0 -27
- package/dist/lib/prepare-workflow.d.ts.map +0 -1
- package/dist/lib/prepare-workflow.js +0 -76
- package/dist/lib/prepare-workflow.js.map +0 -1
- package/dist/lib/runs-io.d.ts +0 -30
- package/dist/lib/runs-io.d.ts.map +0 -1
- package/dist/lib/runs-io.js +0 -154
- package/dist/lib/runs-io.js.map +0 -1
- package/dist/lib/secrets/store.d.ts +0 -4
- package/dist/lib/secrets/store.d.ts.map +0 -1
- package/dist/lib/secrets/store.js +0 -6
- package/dist/lib/secrets/store.js.map +0 -1
- package/dist/lib/trust-store.d.ts +0 -12
- package/dist/lib/trust-store.d.ts.map +0 -1
- package/dist/lib/trust-store.js +0 -33
- package/dist/lib/trust-store.js.map +0 -1
- package/dist/operations/catalog.d.ts +0 -7
- package/dist/operations/catalog.d.ts.map +0 -1
- package/dist/operations/catalog.js +0 -108
- package/dist/operations/catalog.js.map +0 -1
- package/dist/operations/discover.d.ts +0 -3
- package/dist/operations/discover.d.ts.map +0 -1
- package/dist/operations/discover.js +0 -61
- package/dist/operations/discover.js.map +0 -1
- package/dist/operations/index.d.ts +0 -4
- package/dist/operations/index.d.ts.map +0 -1
- package/dist/operations/index.js +0 -38
- package/dist/operations/index.js.map +0 -1
- package/dist/operations/init.d.ts +0 -3
- package/dist/operations/init.d.ts.map +0 -1
- package/dist/operations/init.js +0 -46
- package/dist/operations/init.js.map +0 -1
- package/dist/operations/install.d.ts +0 -3
- package/dist/operations/install.d.ts.map +0 -1
- package/dist/operations/install.js +0 -34
- package/dist/operations/install.js.map +0 -1
- package/dist/operations/plugins.d.ts +0 -7
- package/dist/operations/plugins.d.ts.map +0 -1
- package/dist/operations/plugins.js +0 -64
- package/dist/operations/plugins.js.map +0 -1
- package/dist/operations/rollback.d.ts +0 -3
- package/dist/operations/rollback.d.ts.map +0 -1
- package/dist/operations/rollback.js +0 -25
- package/dist/operations/rollback.js.map +0 -1
- package/dist/operations/runs.d.ts +0 -11
- package/dist/operations/runs.d.ts.map +0 -1
- package/dist/operations/runs.js +0 -205
- package/dist/operations/runs.js.map +0 -1
- package/dist/operations/secrets.d.ts +0 -11
- package/dist/operations/secrets.d.ts.map +0 -1
- package/dist/operations/secrets.js +0 -134
- package/dist/operations/secrets.js.map +0 -1
- package/dist/operations/update.d.ts +0 -3
- package/dist/operations/update.d.ts.map +0 -1
- package/dist/operations/update.js +0 -64
- package/dist/operations/update.js.map +0 -1
- package/dist/operations/workflow.d.ts +0 -7
- package/dist/operations/workflow.d.ts.map +0 -1
- package/dist/operations/workflow.js +0 -144
- package/dist/operations/workflow.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,159 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@executioncontrolprotocol/cli`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
commands come from extension definitions; there are no hand-written command classes.
|
|
3
|
+
The `ecp` CLI (oclif): `retrieve`, `execute`, `commit`, `host`, `mcp`, `app`, `plugins`,
|
|
4
|
+
`secrets`, `schema`.
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
**Entrypoints:** `bin/ecp.js`, `src/index.ts`
|
|
8
7
|
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
- Describe/search environment capabilities for agent/UI discovery
|
|
12
|
-
- Run workflows and print structured run results (`ecp run --to`, `ecp run --events`)
|
|
13
|
-
- Invoke a single capability outside a workflow (`ecp invoke`)
|
|
14
|
-
- Inspect and continue run journals (`ecp runs list|show|resume|rerun`)
|
|
15
|
-
- Install inferred plugins for a workflow file (`ecp install`)
|
|
16
|
-
- Author and check plugins (`ecp plugins new|build|check`) next to oclif's `plugins install|link`
|
|
17
|
-
- Encode/decode on `Ecp` after `init()` (the CLI `encode`/`decode` commands were removed in Phase 1)
|
|
18
|
-
|
|
19
|
-
For the architecture and monorepo package boundaries, start with
|
|
20
|
-
[`AGENTS.md`](../../AGENTS.md) and [`RESET-PLAN.md`](../../RESET-PLAN.md).
|
|
21
|
-
|
|
22
|
-
## Install
|
|
23
|
-
|
|
24
|
-
From npm (when a dist-tag exists):
|
|
25
|
-
|
|
26
|
-
```sh
|
|
27
|
-
npm install -g @executioncontrolprotocol/cli@next
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Until `@next` is on the registry, pack-install from this repo (`pnpm run test:plugin-pack`).
|
|
31
|
-
|
|
32
|
-
From this monorepo (recommended for development):
|
|
33
|
-
|
|
34
|
-
```sh
|
|
35
|
-
npm install
|
|
36
|
-
npm run build
|
|
37
|
-
cd packages/cli
|
|
38
|
-
npm link
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Usage
|
|
42
|
-
|
|
43
|
-
`--env <file>` is an optional overlay (`environment(id).with([...])`). Omit it to use the
|
|
44
|
-
process host (built-in Node plus installed plugins).
|
|
45
|
-
|
|
46
|
-
### Run
|
|
47
|
-
|
|
48
|
-
```sh
|
|
49
|
-
ecp run examples/01-echo/workflow.ecp.ts
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Provide workflow input (JSON file):
|
|
53
|
-
|
|
54
|
-
```sh
|
|
55
|
-
ecp run workflow.ecp.ts --input input.json
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Dry run (validate + plan without invoking capabilities):
|
|
59
|
-
|
|
60
|
-
```sh
|
|
61
|
-
ecp run workflow.ecp.ts --dry-run
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Validate
|
|
65
|
-
|
|
66
|
-
```sh
|
|
67
|
-
ecp validate examples/01-echo/workflow.ecp.ts
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Compile (portable JSON)
|
|
71
|
-
|
|
72
|
-
```sh
|
|
73
|
-
ecp compile examples/01-echo/workflow.ecp.ts -o dist/workflow.json
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Describe / search environment capabilities
|
|
77
|
-
|
|
78
|
-
```sh
|
|
79
|
-
ecp describe
|
|
80
|
-
ecp search "echo"
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Run journals (`ecp runs`)
|
|
84
|
-
|
|
85
|
-
Every `ecp run` writes `.ecp/runs/<runId>/` (`run.json` plus `steps/<stepId>.json`). Override
|
|
86
|
-
the directory with `ECP_RUNS_DIR`.
|
|
87
|
-
|
|
88
|
-
```sh
|
|
89
|
-
ecp run workflow.ecp.ts --to step-b
|
|
90
|
-
ecp runs list
|
|
91
|
-
ecp runs show <id>
|
|
92
|
-
ecp runs resume <id>
|
|
93
|
-
ecp runs resume <id> --approve
|
|
94
|
-
ecp runs rerun <id> --from step-a --to step-a
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
- `ecp run --to <step-id>` is **inclusive** (runs through that step, then stops with status
|
|
98
|
-
`stopped`).
|
|
99
|
-
- `runs resume` continues a `stopped` or `paused` run as a new run id.
|
|
100
|
-
- `runs rerun --from <step>` re-executes from that step using the current file; `--from X --to X`
|
|
101
|
-
re-runs exactly one step and clears later outputs.
|
|
102
|
-
- `runs resume --approve` records `{ stepId, approvedBy, at }` for a policy-paused step.
|
|
103
|
-
|
|
104
|
-
### Invoke a capability
|
|
105
|
-
|
|
106
|
-
Call a single bound capability without a workflow:
|
|
107
|
-
|
|
108
|
-
```sh
|
|
109
|
-
ecp invoke @executioncontrolprotocol/test.echo --input input.json
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Prints an `InvokeResult` JSON document; exits non-zero when `success` is false.
|
|
113
|
-
|
|
114
|
-
Pass `--json` for `{ ok: true, data }` or `{ ok: false, error: { code, message, path, suggestions } }`.
|
|
115
|
-
|
|
116
|
-
### Plugins
|
|
117
|
-
|
|
118
|
-
```sh
|
|
119
|
-
ecp plugins new my-transform
|
|
120
|
-
ecp plugins build
|
|
121
|
-
ecp plugins check
|
|
122
|
-
ecp plugins link plugins/plugin-jsonata
|
|
123
|
-
ecp jsonata transform --expression '$.a' --input payload.json --json
|
|
124
|
-
ecp discover jsonata --json
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
`--env` is optional on `run`, `validate`, and `install`. `describe`, `search`, and `invoke`
|
|
128
|
-
take it the same way.
|
|
129
|
-
|
|
130
|
-
### MCP
|
|
131
|
-
|
|
132
|
-
`ecp mcp serve` is a JIT plugin (`@executioncontrolprotocol/mcp`). Until `@next` is published,
|
|
133
|
-
link the workspace package:
|
|
134
|
-
|
|
135
|
-
```sh
|
|
136
|
-
ecp plugins link packages/mcp
|
|
137
|
-
ecp mcp serve
|
|
138
|
-
ecp mcp serve --http
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### App
|
|
142
|
-
|
|
143
|
-
`ecp app` is a JIT plugin (`@executioncontrolprotocol/plugin-app`). Until `@next` is published,
|
|
144
|
-
link the workspace package:
|
|
145
|
-
|
|
146
|
-
```sh
|
|
147
|
-
ecp plugins link plugins/plugin-app
|
|
148
|
-
ecp app examples/01-echo/workflow.ecp.ts
|
|
149
|
-
ecp app brief.ecp.ts --no-open
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Related packages
|
|
153
|
-
|
|
154
|
-
- [`@executioncontrolprotocol/core`](../core/README.md): host-agnostic core + fluent API
|
|
155
|
-
- [`@executioncontrolprotocol/plugin-sdk`](../plugin-sdk/README.md): command generation and plugin build library
|
|
156
|
-
- [`@executioncontrolprotocol/node`](../environments/node/README.md): Node environment used by CLI examples
|
|
157
|
-
- [`@executioncontrolprotocol/core/types`](../core/README.md): protocol types + generated JSON Schemas
|
|
158
|
-
- [`@executioncontrolprotocol/mcp`](../mcp/): MCP server adapter exposing an environment to agents
|
|
159
|
-
- [`@executioncontrolprotocol/plugin-jsonata`](../../plugins/plugin-jsonata/README.md): reference plugin
|
|
8
|
+
When no host is running, one-off commands use an in-process host. Prefer `ecp host start` for
|
|
9
|
+
repeated calls, MCP, and the App.
|
package/bin/dev.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
2
|
import { execute } from "@oclif/core"
|
|
3
|
+
import { setupEcpEnv } from "./setup-env.js"
|
|
4
4
|
|
|
5
5
|
process.noDeprecation = true
|
|
6
|
-
|
|
7
|
-
await execute({
|
|
6
|
+
setupEcpEnv()
|
|
7
|
+
await execute({
|
|
8
|
+
development: true,
|
|
9
|
+
dir: import.meta.url,
|
|
10
|
+
loadOptions: { userPlugins: false },
|
|
11
|
+
})
|
package/bin/ecp.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
2
|
import { execute } from "@oclif/core"
|
|
3
|
+
import { setupEcpEnv } from "./setup-env.js"
|
|
4
4
|
|
|
5
5
|
process.noDeprecation = true
|
|
6
|
-
|
|
7
|
-
await execute({
|
|
6
|
+
setupEcpEnv()
|
|
7
|
+
await execute({
|
|
8
|
+
dir: import.meta.url,
|
|
9
|
+
loadOptions: { userPlugins: false },
|
|
10
|
+
})
|
package/bin/run.cmd
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
|
|
3
|
-
node "%~dp0\ecp.js" %*
|
|
1
|
+
@echo off
|
|
2
|
+
node "%~dp0\run.js" %*
|
package/bin/run.js
CHANGED
package/bin/setup-env.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve and apply ECP_HOME / ECP_DATA_DIR before oclif Config.load.
|
|
3
|
+
* Plain JS so the bin does not depend on dist/.
|
|
4
|
+
* Keep semantics aligned with `src/lib/home.ts` (parity tested in unit tests).
|
|
5
|
+
*/
|
|
6
|
+
import { mkdirSync } from "node:fs"
|
|
7
|
+
import os from "node:os"
|
|
8
|
+
import path from "node:path"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Absolute `ECP_HOME` (default `~/.ecp`).
|
|
12
|
+
* @param {NodeJS.ProcessEnv} [env]
|
|
13
|
+
* @returns {string}
|
|
14
|
+
*/
|
|
15
|
+
export function resolveEcpHome(env = process.env) {
|
|
16
|
+
return path.resolve(env.ECP_HOME ?? path.join(os.homedir(), ".ecp"))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Plugin data dir (`ECP_DATA_DIR` or `$ECP_HOME/plugins`).
|
|
21
|
+
* @param {NodeJS.ProcessEnv} [env]
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
export function resolveEcpDataDir(env = process.env) {
|
|
25
|
+
const home = resolveEcpHome(env)
|
|
26
|
+
return path.resolve(env.ECP_DATA_DIR ?? path.join(home, "plugins"))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Ensure home and data dirs exist; set both on the given env.
|
|
31
|
+
* @param {NodeJS.ProcessEnv} [env]
|
|
32
|
+
* @returns {{ home: string, dataDir: string }}
|
|
33
|
+
*/
|
|
34
|
+
export function setupEcpEnv(env = process.env) {
|
|
35
|
+
const home = resolveEcpHome(env)
|
|
36
|
+
const dataDir = resolveEcpDataDir(env)
|
|
37
|
+
mkdirSync(home, { recursive: true })
|
|
38
|
+
mkdirSync(dataDir, { recursive: true })
|
|
39
|
+
env.ECP_HOME = home
|
|
40
|
+
env.ECP_DATA_DIR = dataDir
|
|
41
|
+
return { home, dataDir }
|
|
42
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
/**
|
|
3
|
+
* `ecp app` — open the App URL (UI lands in Phase 7).
|
|
4
|
+
* @category CLI
|
|
5
|
+
*/
|
|
6
|
+
export default class App extends Command {
|
|
7
|
+
static description: string;
|
|
8
|
+
static args: {
|
|
9
|
+
path: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
static examples: {
|
|
12
|
+
description: string;
|
|
13
|
+
command: string;
|
|
14
|
+
}[];
|
|
15
|
+
static flags: {
|
|
16
|
+
id: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
"no-open": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/commands/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAS,MAAM,aAAa,CAAA;AAKlD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,OAAO;IACtC,OAAgB,WAAW,SACwG;IAEnI,OAAgB,IAAI;;MAEnB;IAED,OAAgB,QAAQ;;;QAKvB;IAED,OAAgB,KAAK;;;;MAWpB;IAEc,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAoBpC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Args, Command, Flags } from "@oclif/core";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { ensureWarmHost } from "../lib/host-discovery.js";
|
|
4
|
+
import { writeEnvelope } from "../lib/output.js";
|
|
5
|
+
/**
|
|
6
|
+
* `ecp app` — open the App URL (UI lands in Phase 7).
|
|
7
|
+
* @category CLI
|
|
8
|
+
*/
|
|
9
|
+
export default class App extends Command {
|
|
10
|
+
static description = "Open the visual App in a browser (starts the background host if needed); use retrieve and execute for headless agent workflows.";
|
|
11
|
+
static args = {
|
|
12
|
+
path: Args.string({ description: "Execution file path to open in the App (resolved to absolute)." }),
|
|
13
|
+
};
|
|
14
|
+
static examples = [
|
|
15
|
+
{
|
|
16
|
+
description: "Prints the App URL without opening a browser.",
|
|
17
|
+
command: "<%= config.bin %> app --no-open",
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
static flags = {
|
|
21
|
+
id: Flags.string({ description: "Stored execution id to open instead of a file path." }),
|
|
22
|
+
"no-open": Flags.boolean({
|
|
23
|
+
description: "Print the URL only; do not launch the default browser.",
|
|
24
|
+
default: false,
|
|
25
|
+
}),
|
|
26
|
+
json: Flags.boolean({
|
|
27
|
+
description: "Print one JSON object on stdout: { ok: true, data } on success, { ok: false, error } on failure (exit code non-zero).",
|
|
28
|
+
default: false,
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
async run() {
|
|
32
|
+
const { args, flags } = await this.parse(App);
|
|
33
|
+
const warm = await ensureWarmHost();
|
|
34
|
+
const params = new URLSearchParams();
|
|
35
|
+
params.set("token", warm.token);
|
|
36
|
+
if (flags.id)
|
|
37
|
+
params.set("id", flags.id);
|
|
38
|
+
else if (args.path)
|
|
39
|
+
params.set("open", path.resolve(args.path));
|
|
40
|
+
else
|
|
41
|
+
params.set("dir", process.cwd());
|
|
42
|
+
const url = `${warm.url}/app/#${params.toString()}`;
|
|
43
|
+
if (flags.json) {
|
|
44
|
+
writeEnvelope({ ok: true, data: { url } }, { json: true, exitCode: 0 });
|
|
45
|
+
}
|
|
46
|
+
if (flags["no-open"])
|
|
47
|
+
this.log(url);
|
|
48
|
+
else {
|
|
49
|
+
const opened = await openUrl(url);
|
|
50
|
+
if (!opened)
|
|
51
|
+
this.log(url);
|
|
52
|
+
else
|
|
53
|
+
this.log(`opened ${url}`);
|
|
54
|
+
}
|
|
55
|
+
writeEnvelope({ ok: true, data: { url } }, { exitCode: 0 });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function openUrl(url) {
|
|
59
|
+
try {
|
|
60
|
+
const { execFile } = await import("node:child_process");
|
|
61
|
+
const { promisify } = await import("node:util");
|
|
62
|
+
const execFileAsync = promisify(execFile);
|
|
63
|
+
if (process.platform === "win32")
|
|
64
|
+
await execFileAsync("cmd", ["/c", "start", "", url]);
|
|
65
|
+
else if (process.platform === "darwin")
|
|
66
|
+
await execFileAsync("open", [url]);
|
|
67
|
+
else
|
|
68
|
+
await execFileAsync("xdg-open", [url]);
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/commands/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,OAAO;IACtC,MAAM,CAAU,WAAW,GACzB,iIAAiI,CAAA;IAEnI,MAAM,CAAU,IAAI,GAAG;QACrB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,gEAAgE,EAAE,CAAC;KACrG,CAAA;IAED,MAAM,CAAU,QAAQ,GAAG;QACzB;YACE,WAA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|
+
import { Command } from "@oclif/core";
|
|
2
|
+
/**
|
|
3
|
+
* `ecp commit`
|
|
4
|
+
* @category CLI
|
|
5
|
+
*/
|
|
6
|
+
export default class Commit extends Command {
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: {
|
|
9
|
+
description: string;
|
|
10
|
+
command: string;
|
|
11
|
+
}[];
|
|
12
|
+
static flags: {
|
|
13
|
+
type: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
action: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
id: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
object: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
patch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
"if-version": import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
"no-start-host": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
21
|
+
};
|
|
22
|
+
run(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=commit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../src/commands/commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAQ5C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAO;IACzC,OAAgB,WAAW,SACuF;IAElH,OAAgB,QAAQ;;;QAKvB;IAED,OAAgB,KAAK;;;;;;;;;MAwBpB;IAEc,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8BpC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Command, Flags } from "@oclif/core";
|
|
2
|
+
import { discoverOps } from "../lib/host-discovery.js";
|
|
3
|
+
import { hostUnavailableEnvelope, isHostUnavailableError } from "../lib/host-unavailable.js";
|
|
4
|
+
import { writeEnvelope } from "../lib/output.js";
|
|
5
|
+
import { parseJsonFlag } from "../lib/input.js";
|
|
6
|
+
import { finishOperation, printCommitHuman } from "../lib/output.js";
|
|
7
|
+
/**
|
|
8
|
+
* `ecp commit`
|
|
9
|
+
* @category CLI
|
|
10
|
+
*/
|
|
11
|
+
export default class Commit extends Command {
|
|
12
|
+
static description = "Create, update, or delete stored executions and configs; use execute --validate before committing risky edits.";
|
|
13
|
+
static examples = [
|
|
14
|
+
{
|
|
15
|
+
description: "Creates a stored execution from a JSON file referenced with @path.",
|
|
16
|
+
command: "<%= config.bin %> commit --type execution --action create --id demo --object @./demo.ecp.json",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
type: Flags.string({
|
|
21
|
+
required: true,
|
|
22
|
+
options: ["execution", "config"],
|
|
23
|
+
description: "Object family to change (execution or config).",
|
|
24
|
+
}),
|
|
25
|
+
action: Flags.string({
|
|
26
|
+
required: true,
|
|
27
|
+
options: ["create", "update", "delete"],
|
|
28
|
+
description: "create, update, or delete.",
|
|
29
|
+
}),
|
|
30
|
+
id: Flags.string({ description: "Object id (required for update/delete and optional on create)." }),
|
|
31
|
+
object: Flags.string({ description: "Full object JSON, @file, or - (stdin)." }),
|
|
32
|
+
patch: Flags.string({ description: "JSON Patch array, @file, or - (stdin) for updates." }),
|
|
33
|
+
"if-version": Flags.integer({ description: "Expected objectVersion for optimistic concurrency." }),
|
|
34
|
+
json: Flags.boolean({
|
|
35
|
+
description: "Print one JSON object on stdout: { ok: true, data } on success, { ok: false, error } on failure (exit code non-zero).",
|
|
36
|
+
default: false,
|
|
37
|
+
}),
|
|
38
|
+
"no-start-host": Flags.boolean({
|
|
39
|
+
description: "Do not start a background host when one is not already running.",
|
|
40
|
+
default: false,
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
async run() {
|
|
44
|
+
const { flags } = await this.parse(Commit);
|
|
45
|
+
let ops;
|
|
46
|
+
try {
|
|
47
|
+
ops = await discoverOps({ autoStart: !flags["no-start-host"] });
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (isHostUnavailableError(error)) {
|
|
51
|
+
writeEnvelope(hostUnavailableEnvelope(error), {
|
|
52
|
+
json: flags.json,
|
|
53
|
+
human: () => this.error(error.message, { exit: 4 }),
|
|
54
|
+
exitCode: 4,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const input = {
|
|
61
|
+
type: flags.type,
|
|
62
|
+
action: flags.action,
|
|
63
|
+
id: flags.id,
|
|
64
|
+
object: await parseJsonFlag(flags.object),
|
|
65
|
+
patch: (await parseJsonFlag(flags.patch)),
|
|
66
|
+
ifVersion: flags["if-version"],
|
|
67
|
+
};
|
|
68
|
+
const envelope = await ops.commit(input);
|
|
69
|
+
finishOperation(envelope, { json: flags.json, human: printCommitHuman });
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
await ops.close();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit.js","sourceRoot":"","sources":["../../src/commands/commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAA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AAC;IACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
/**
|
|
3
|
+
* `ecp config secrets list`
|
|
4
|
+
* @category CLI
|
|
5
|
+
*/
|
|
6
|
+
export default class ConfigSecretsList extends Command {
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: {
|
|
9
|
+
description: string;
|
|
10
|
+
command: string;
|
|
11
|
+
}[];
|
|
12
|
+
static flags: {
|
|
13
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/config/secrets/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAI5C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,OAAO;IACpD,OAAgB,WAAW,SAC8F;IAEzH,OAAgB,QAAQ;;;QAKvB;IAED,OAAgB,KAAK;;MAMpB;IAEc,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAwBpC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Command, Flags } from "@oclif/core";
|
|
2
|
+
import { withSecrets } from "../../../lib/secrets.js";
|
|
3
|
+
import { printTable, writeEnvelope } from "../../../lib/output.js";
|
|
4
|
+
/**
|
|
5
|
+
* `ecp config secrets list`
|
|
6
|
+
* @category CLI
|
|
7
|
+
*/
|
|
8
|
+
export default class ConfigSecretsList extends Command {
|
|
9
|
+
static description = "List secret key names and sources (never values); use config secrets set before execute steps that reference $secret.";
|
|
10
|
+
static examples = [
|
|
11
|
+
{
|
|
12
|
+
description: "Prints keys and keychain/env source; add --json for the envelope.",
|
|
13
|
+
command: "<%= config.bin %> config secrets list",
|
|
14
|
+
},
|
|
15
|
+
];
|
|
16
|
+
static flags = {
|
|
17
|
+
json: Flags.boolean({
|
|
18
|
+
description: "Print one JSON object on stdout: { ok: true, data } on success, { ok: false, error } on failure (exit code non-zero).",
|
|
19
|
+
default: false,
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags } = await this.parse(ConfigSecretsList);
|
|
24
|
+
const rows = await withSecrets(async (secrets) => secrets.listDetailed());
|
|
25
|
+
writeEnvelope({ ok: true, data: { items: rows } }, {
|
|
26
|
+
json: flags.json,
|
|
27
|
+
human: () => {
|
|
28
|
+
if (rows.length === 0) {
|
|
29
|
+
this.log("No secrets stored.");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
printTable([
|
|
33
|
+
{ key: "key", header: "key" },
|
|
34
|
+
{ key: "source", header: "source" },
|
|
35
|
+
], rows.map((row) => ({ key: row.key, source: row.source })));
|
|
36
|
+
},
|
|
37
|
+
exitCode: 0,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/config/secrets/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAElE;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,OAAO;IACpD,MAAM,CAAU,WAAW,GACzB,uHAAuH,CAAA;IAEzH,MAAM,CAAU,QAAQ,GAAG;QACzB;YACE,WAAW,EAAE,mEAAmE;YAChF,OAAO,EAAE,uCAAuC;SACjD;KACF,CAAA;IAED,MAAM,CAAU,KAAK,GAAG;QACtB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;YAClB,WAAW,EACT,uHAAuH;YACzH,OAAO,EAAE,KAAK;SACf,CAAC;KACH,CAAA;IAEQ,KAAK,CAAC,GAAG;QAChB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACrD,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;QACzE,aAAa,CACX,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EACnC;YACE,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,GAAG,EAAE;gBACV,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACtB,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;oBAC9B,OAAM;gBACR,CAAC;gBACD,UAAU,CACR;oBACE,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;oBAC7B,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE;iBACpC,EACD,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAC1D,CAAA;YACH,CAAC;YACD,QAAQ,EAAE,CAAC;SACZ,CACF,CAAA;IACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
/**
|
|
3
|
+
* `ecp config secrets set`
|
|
4
|
+
* @category CLI
|
|
5
|
+
*/
|
|
6
|
+
export default class ConfigSecretsSet extends Command {
|
|
7
|
+
static description: string;
|
|
8
|
+
static args: {
|
|
9
|
+
key: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
static examples: {
|
|
12
|
+
description: string;
|
|
13
|
+
command: string;
|
|
14
|
+
}[];
|
|
15
|
+
static flags: {
|
|
16
|
+
value: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../../src/commands/config/secrets/set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAS,MAAM,aAAa,CAAA;AAKlD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,OAAO;IACnD,OAAgB,WAAW,SACuE;IAElG,OAAgB,IAAI;;MAEnB;IAED,OAAgB,QAAQ;;;QAKvB;IAED,OAAgB,KAAK;;;MAOpB;IAEc,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA6BpC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Args, Command, Flags } from "@oclif/core";
|
|
2
|
+
import { readStdin } from "../../../lib/input.js";
|
|
3
|
+
import { withSecrets } from "../../../lib/secrets.js";
|
|
4
|
+
import { writeEnvelope } from "../../../lib/output.js";
|
|
5
|
+
/**
|
|
6
|
+
* `ecp config secrets set`
|
|
7
|
+
* @category CLI
|
|
8
|
+
*/
|
|
9
|
+
export default class ConfigSecretsSet extends Command {
|
|
10
|
+
static description = "Store a secret in the OS keychain; prefer stdin over --value so the shell history stays clean.";
|
|
11
|
+
static args = {
|
|
12
|
+
key: Args.string({ required: true, description: "Secret key: starts with a letter or digit, then letters, digits, '.', '_', '/' or '-' (max 128); e.g. anthropic/api-key." }),
|
|
13
|
+
};
|
|
14
|
+
static examples = [
|
|
15
|
+
{
|
|
16
|
+
description: "Reads the value from stdin and stores it under the key.",
|
|
17
|
+
command: "<%= config.bin %> config secrets set anthropic/api-key",
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
static flags = {
|
|
21
|
+
value: Flags.string({ description: "Secret value inline (prefer stdin to avoid shell history)." }),
|
|
22
|
+
json: Flags.boolean({
|
|
23
|
+
description: "Print one JSON object on stdout: { ok: true, data } on success, { ok: false, error } on failure (exit code non-zero).",
|
|
24
|
+
default: false,
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
async run() {
|
|
28
|
+
const { args, flags } = await this.parse(ConfigSecretsSet);
|
|
29
|
+
let value = flags.value;
|
|
30
|
+
if (value === undefined) {
|
|
31
|
+
if (!process.stdin.isTTY)
|
|
32
|
+
value = (await readStdin()).replace(/\r?\n$/, "");
|
|
33
|
+
else
|
|
34
|
+
value = await promptHidden("value: ");
|
|
35
|
+
}
|
|
36
|
+
if (value === undefined || value === "") {
|
|
37
|
+
writeEnvelope({ ok: false, error: { code: "ECP_REQUEST_INVALID", message: "Secret value is required." } }, {
|
|
38
|
+
json: flags.json,
|
|
39
|
+
human: () => this.error("Secret value is required.", { exit: 2 }),
|
|
40
|
+
exitCode: 2,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
await withSecrets(async (secrets) => {
|
|
44
|
+
await secrets.set(args.key, value);
|
|
45
|
+
});
|
|
46
|
+
writeEnvelope({ ok: true, data: { key: args.key, set: true } }, {
|
|
47
|
+
json: flags.json,
|
|
48
|
+
human: () => this.log(`set ${args.key}`),
|
|
49
|
+
exitCode: 0,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function promptHidden(label) {
|
|
54
|
+
const { createInterface } = await import("node:readline");
|
|
55
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
56
|
+
return new Promise((resolve) => {
|
|
57
|
+
process.stderr.write(label);
|
|
58
|
+
const stdin = process.stdin;
|
|
59
|
+
const wasRaw = stdin.isRaw;
|
|
60
|
+
if (stdin.isTTY)
|
|
61
|
+
stdin.setRawMode(true);
|
|
62
|
+
let value = "";
|
|
63
|
+
const onData = (chunk) => {
|
|
64
|
+
const text = chunk.toString("utf8");
|
|
65
|
+
if (text === "\n" || text === "\r" || text === "\u0004") {
|
|
66
|
+
if (stdin.isTTY)
|
|
67
|
+
stdin.setRawMode(wasRaw ?? false);
|
|
68
|
+
stdin.off("data", onData);
|
|
69
|
+
rl.close();
|
|
70
|
+
process.stderr.write("\n");
|
|
71
|
+
resolve(value);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (text === "\u0003") {
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
if (text === "\u007f" || text === "\b") {
|
|
78
|
+
value = value.slice(0, -1);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
value += text;
|
|
82
|
+
};
|
|
83
|
+
stdin.on("data", onData);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=set.js.map
|