@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.
Files changed (278) hide show
  1. package/README.md +68 -67
  2. package/dist/commands.d.ts +7 -0
  3. package/dist/commands.d.ts.map +1 -0
  4. package/dist/commands.js +9 -0
  5. package/dist/commands.js.map +1 -0
  6. package/dist/hooks/command-not-found.d.ts +8 -0
  7. package/dist/hooks/command-not-found.d.ts.map +1 -0
  8. package/dist/hooks/command-not-found.js +72 -0
  9. package/dist/hooks/command-not-found.js.map +1 -0
  10. package/dist/hooks/init-host.d.ts +8 -0
  11. package/dist/hooks/init-host.d.ts.map +1 -0
  12. package/dist/hooks/init-host.js +45 -0
  13. package/dist/hooks/init-host.js.map +1 -0
  14. package/dist/hooks/jit-install.d.ts +8 -0
  15. package/dist/hooks/jit-install.d.ts.map +1 -0
  16. package/dist/hooks/jit-install.js +32 -0
  17. package/dist/hooks/jit-install.js.map +1 -0
  18. package/dist/hooks/trust.d.ts +9 -0
  19. package/dist/hooks/trust.d.ts.map +1 -0
  20. package/dist/hooks/trust.js +32 -0
  21. package/dist/hooks/trust.js.map +1 -0
  22. package/dist/lib/argv.d.ts +11 -0
  23. package/dist/lib/argv.d.ts.map +1 -0
  24. package/dist/lib/argv.js +30 -0
  25. package/dist/lib/argv.js.map +1 -0
  26. package/dist/lib/confirm.d.ts +16 -0
  27. package/dist/lib/confirm.d.ts.map +1 -0
  28. package/dist/lib/confirm.js +49 -0
  29. package/dist/lib/confirm.js.map +1 -0
  30. package/dist/lib/ensure-plugins.d.ts +17 -0
  31. package/dist/lib/ensure-plugins.d.ts.map +1 -0
  32. package/dist/lib/ensure-plugins.js +38 -0
  33. package/dist/lib/ensure-plugins.js.map +1 -0
  34. package/dist/lib/evaluate-trust.d.ts +26 -0
  35. package/dist/lib/evaluate-trust.d.ts.map +1 -0
  36. package/dist/lib/evaluate-trust.js +87 -0
  37. package/dist/lib/evaluate-trust.js.map +1 -0
  38. package/dist/lib/format-output.d.ts +17 -0
  39. package/dist/lib/format-output.d.ts.map +1 -0
  40. package/dist/lib/format-output.js +63 -0
  41. package/dist/lib/format-output.js.map +1 -0
  42. package/dist/lib/installed-plugins.d.ts +25 -0
  43. package/dist/lib/installed-plugins.d.ts.map +1 -0
  44. package/dist/lib/installed-plugins.js +22 -0
  45. package/dist/lib/installed-plugins.js.map +1 -0
  46. package/dist/lib/jit-plugins.d.ts +13 -0
  47. package/dist/lib/jit-plugins.d.ts.map +1 -0
  48. package/dist/lib/jit-plugins.js +25 -0
  49. package/dist/lib/jit-plugins.js.map +1 -0
  50. package/dist/lib/layer-environment.d.ts +29 -0
  51. package/dist/lib/layer-environment.d.ts.map +1 -0
  52. package/dist/lib/layer-environment.js +96 -0
  53. package/dist/lib/layer-environment.js.map +1 -0
  54. package/dist/lib/load-ecp.d.ts +17 -0
  55. package/dist/lib/load-ecp.d.ts.map +1 -0
  56. package/dist/lib/load-ecp.js +39 -0
  57. package/dist/lib/load-ecp.js.map +1 -0
  58. package/dist/lib/missing-plugins.d.ts +24 -0
  59. package/dist/lib/missing-plugins.d.ts.map +1 -0
  60. package/dist/lib/missing-plugins.js +53 -0
  61. package/dist/lib/missing-plugins.js.map +1 -0
  62. package/dist/lib/npm-registry.d.ts +40 -0
  63. package/dist/lib/npm-registry.d.ts.map +1 -0
  64. package/dist/lib/npm-registry.js +68 -0
  65. package/dist/lib/npm-registry.js.map +1 -0
  66. package/dist/lib/plugin-bindings.d.ts +13 -0
  67. package/dist/lib/plugin-bindings.d.ts.map +1 -0
  68. package/dist/lib/plugin-bindings.js +49 -0
  69. package/dist/lib/plugin-bindings.js.map +1 -0
  70. package/dist/lib/plugin-source.d.ts +11 -0
  71. package/dist/lib/plugin-source.d.ts.map +1 -0
  72. package/dist/lib/plugin-source.js +32 -0
  73. package/dist/lib/plugin-source.js.map +1 -0
  74. package/dist/lib/prepare-workflow.d.ts +27 -0
  75. package/dist/lib/prepare-workflow.d.ts.map +1 -0
  76. package/dist/lib/prepare-workflow.js +76 -0
  77. package/dist/lib/prepare-workflow.js.map +1 -0
  78. package/dist/lib/runs-io.d.ts +30 -0
  79. package/dist/lib/runs-io.d.ts.map +1 -0
  80. package/dist/lib/runs-io.js +154 -0
  81. package/dist/lib/runs-io.js.map +1 -0
  82. package/dist/lib/secrets/store.d.ts +2 -1
  83. package/dist/lib/secrets/store.d.ts.map +1 -1
  84. package/dist/lib/secrets/store.js +1 -1
  85. package/dist/lib/secrets/store.js.map +1 -1
  86. package/dist/lib/trust-store.d.ts +12 -0
  87. package/dist/lib/trust-store.d.ts.map +1 -0
  88. package/dist/lib/trust-store.js +33 -0
  89. package/dist/lib/trust-store.js.map +1 -0
  90. package/dist/operations/catalog.d.ts +7 -0
  91. package/dist/operations/catalog.d.ts.map +1 -0
  92. package/dist/operations/catalog.js +108 -0
  93. package/dist/operations/catalog.js.map +1 -0
  94. package/dist/operations/discover.d.ts +3 -0
  95. package/dist/operations/discover.d.ts.map +1 -0
  96. package/dist/operations/discover.js +61 -0
  97. package/dist/operations/discover.js.map +1 -0
  98. package/dist/operations/index.d.ts +4 -0
  99. package/dist/operations/index.d.ts.map +1 -0
  100. package/dist/operations/index.js +38 -0
  101. package/dist/operations/index.js.map +1 -0
  102. package/dist/operations/init.d.ts +3 -0
  103. package/dist/operations/init.d.ts.map +1 -0
  104. package/dist/operations/init.js +46 -0
  105. package/dist/operations/init.js.map +1 -0
  106. package/dist/operations/install.d.ts +3 -0
  107. package/dist/operations/install.d.ts.map +1 -0
  108. package/dist/operations/install.js +34 -0
  109. package/dist/operations/install.js.map +1 -0
  110. package/dist/operations/plugins.d.ts +7 -0
  111. package/dist/operations/plugins.d.ts.map +1 -0
  112. package/dist/operations/plugins.js +64 -0
  113. package/dist/operations/plugins.js.map +1 -0
  114. package/dist/operations/rollback.d.ts +3 -0
  115. package/dist/operations/rollback.d.ts.map +1 -0
  116. package/dist/operations/rollback.js +25 -0
  117. package/dist/operations/rollback.js.map +1 -0
  118. package/dist/operations/runs.d.ts +11 -0
  119. package/dist/operations/runs.d.ts.map +1 -0
  120. package/dist/operations/runs.js +205 -0
  121. package/dist/operations/runs.js.map +1 -0
  122. package/dist/operations/secrets.d.ts +11 -0
  123. package/dist/operations/secrets.d.ts.map +1 -0
  124. package/dist/operations/secrets.js +134 -0
  125. package/dist/operations/secrets.js.map +1 -0
  126. package/dist/operations/update.d.ts +3 -0
  127. package/dist/operations/update.d.ts.map +1 -0
  128. package/dist/operations/update.js +64 -0
  129. package/dist/operations/update.js.map +1 -0
  130. package/dist/operations/workflow.d.ts +7 -0
  131. package/dist/operations/workflow.d.ts.map +1 -0
  132. package/dist/operations/workflow.js +144 -0
  133. package/dist/operations/workflow.js.map +1 -0
  134. package/package.json +38 -12
  135. package/dist/commands/compile.d.ts +0 -15
  136. package/dist/commands/compile.d.ts.map +0 -1
  137. package/dist/commands/compile.js +0 -44
  138. package/dist/commands/compile.js.map +0 -1
  139. package/dist/commands/config/secrets/add.d.ts +0 -15
  140. package/dist/commands/config/secrets/add.d.ts.map +0 -1
  141. package/dist/commands/config/secrets/add.js +0 -51
  142. package/dist/commands/config/secrets/add.js.map +0 -1
  143. package/dist/commands/config/secrets/get.d.ts +0 -13
  144. package/dist/commands/config/secrets/get.d.ts.map +0 -1
  145. package/dist/commands/config/secrets/get.js +0 -39
  146. package/dist/commands/config/secrets/get.js.map +0 -1
  147. package/dist/commands/config/secrets/list.d.ts +0 -7
  148. package/dist/commands/config/secrets/list.d.ts.map +0 -1
  149. package/dist/commands/config/secrets/list.js +0 -22
  150. package/dist/commands/config/secrets/list.js.map +0 -1
  151. package/dist/commands/config/secrets/remove.d.ts +0 -10
  152. package/dist/commands/config/secrets/remove.d.ts.map +0 -1
  153. package/dist/commands/config/secrets/remove.js +0 -25
  154. package/dist/commands/config/secrets/remove.js.map +0 -1
  155. package/dist/commands/config/secrets.d.ts +0 -9
  156. package/dist/commands/config/secrets.d.ts.map +0 -1
  157. package/dist/commands/config/secrets.js +0 -31
  158. package/dist/commands/config/secrets.js.map +0 -1
  159. package/dist/commands/decode.d.ts +0 -18
  160. package/dist/commands/decode.d.ts.map +0 -1
  161. package/dist/commands/decode.js +0 -66
  162. package/dist/commands/decode.js.map +0 -1
  163. package/dist/commands/describe.d.ts +0 -15
  164. package/dist/commands/describe.d.ts.map +0 -1
  165. package/dist/commands/describe.js +0 -62
  166. package/dist/commands/describe.js.map +0 -1
  167. package/dist/commands/encode.d.ts +0 -18
  168. package/dist/commands/encode.d.ts.map +0 -1
  169. package/dist/commands/encode.js +0 -63
  170. package/dist/commands/encode.js.map +0 -1
  171. package/dist/commands/init.d.ts +0 -14
  172. package/dist/commands/init.d.ts.map +0 -1
  173. package/dist/commands/init.js +0 -91
  174. package/dist/commands/init.js.map +0 -1
  175. package/dist/commands/invoke.d.ts +0 -17
  176. package/dist/commands/invoke.d.ts.map +0 -1
  177. package/dist/commands/invoke.js +0 -47
  178. package/dist/commands/invoke.js.map +0 -1
  179. package/dist/commands/run.d.ts +0 -17
  180. package/dist/commands/run.d.ts.map +0 -1
  181. package/dist/commands/run.js +0 -53
  182. package/dist/commands/run.js.map +0 -1
  183. package/dist/commands/search.d.ts +0 -12
  184. package/dist/commands/search.d.ts.map +0 -1
  185. package/dist/commands/search.js +0 -26
  186. package/dist/commands/search.js.map +0 -1
  187. package/dist/commands/serve.d.ts +0 -15
  188. package/dist/commands/serve.d.ts.map +0 -1
  189. package/dist/commands/serve.js +0 -53
  190. package/dist/commands/serve.js.map +0 -1
  191. package/dist/commands/test/rerun.d.ts +0 -16
  192. package/dist/commands/test/rerun.d.ts.map +0 -1
  193. package/dist/commands/test/rerun.js +0 -38
  194. package/dist/commands/test/rerun.js.map +0 -1
  195. package/dist/commands/test/run.d.ts +0 -14
  196. package/dist/commands/test/run.d.ts.map +0 -1
  197. package/dist/commands/test/run.js +0 -36
  198. package/dist/commands/test/run.js.map +0 -1
  199. package/dist/commands/test/start.d.ts +0 -17
  200. package/dist/commands/test/start.d.ts.map +0 -1
  201. package/dist/commands/test/start.js +0 -43
  202. package/dist/commands/test/start.js.map +0 -1
  203. package/dist/commands/test/status.d.ts +0 -12
  204. package/dist/commands/test/status.d.ts.map +0 -1
  205. package/dist/commands/test/status.js +0 -24
  206. package/dist/commands/test/status.js.map +0 -1
  207. package/dist/commands/test.d.ts +0 -9
  208. package/dist/commands/test.d.ts.map +0 -1
  209. package/dist/commands/test.js +0 -32
  210. package/dist/commands/test.js.map +0 -1
  211. package/dist/commands/up.d.ts +0 -19
  212. package/dist/commands/up.d.ts.map +0 -1
  213. package/dist/commands/up.js +0 -102
  214. package/dist/commands/up.js.map +0 -1
  215. package/dist/commands/validate.d.ts +0 -12
  216. package/dist/commands/validate.d.ts.map +0 -1
  217. package/dist/commands/validate.js +0 -26
  218. package/dist/commands/validate.js.map +0 -1
  219. package/dist/lib/env-module-command.d.ts +0 -37
  220. package/dist/lib/env-module-command.d.ts.map +0 -1
  221. package/dist/lib/env-module-command.js +0 -59
  222. package/dist/lib/env-module-command.js.map +0 -1
  223. package/dist/lib/format-cli.d.ts +0 -13
  224. package/dist/lib/format-cli.d.ts.map +0 -1
  225. package/dist/lib/format-cli.js +0 -25
  226. package/dist/lib/format-cli.js.map +0 -1
  227. package/dist/lib/http/create-serve-handler.d.ts +0 -15
  228. package/dist/lib/http/create-serve-handler.d.ts.map +0 -1
  229. package/dist/lib/http/create-serve-handler.js +0 -40
  230. package/dist/lib/http/create-serve-handler.js.map +0 -1
  231. package/dist/lib/http/create-serve.d.ts +0 -30
  232. package/dist/lib/http/create-serve.d.ts.map +0 -1
  233. package/dist/lib/http/create-serve.js +0 -43
  234. package/dist/lib/http/create-serve.js.map +0 -1
  235. package/dist/lib/http/handle-artifact.d.ts +0 -14
  236. package/dist/lib/http/handle-artifact.d.ts.map +0 -1
  237. package/dist/lib/http/handle-artifact.js +0 -40
  238. package/dist/lib/http/handle-artifact.js.map +0 -1
  239. package/dist/lib/http/handle-invoke.d.ts +0 -59
  240. package/dist/lib/http/handle-invoke.d.ts.map +0 -1
  241. package/dist/lib/http/handle-invoke.js +0 -108
  242. package/dist/lib/http/handle-invoke.js.map +0 -1
  243. package/dist/lib/http/read-body.d.ts +0 -7
  244. package/dist/lib/http/read-body.d.ts.map +0 -1
  245. package/dist/lib/http/read-body.js +0 -12
  246. package/dist/lib/http/read-body.js.map +0 -1
  247. package/dist/lib/http/write-json.d.ts +0 -7
  248. package/dist/lib/http/write-json.d.ts.map +0 -1
  249. package/dist/lib/http/write-json.js +0 -11
  250. package/dist/lib/http/write-json.js.map +0 -1
  251. package/dist/lib/test-session-io.d.ts +0 -12
  252. package/dist/lib/test-session-io.d.ts.map +0 -1
  253. package/dist/lib/test-session-io.js +0 -36
  254. package/dist/lib/test-session-io.js.map +0 -1
  255. package/dist/lib/up/constants.d.ts +0 -15
  256. package/dist/lib/up/constants.d.ts.map +0 -1
  257. package/dist/lib/up/constants.js +0 -21
  258. package/dist/lib/up/constants.js.map +0 -1
  259. package/dist/lib/up/cors.d.ts +0 -12
  260. package/dist/lib/up/cors.d.ts.map +0 -1
  261. package/dist/lib/up/cors.js +0 -28
  262. package/dist/lib/up/cors.js.map +0 -1
  263. package/dist/lib/up/create-daemon.d.ts +0 -53
  264. package/dist/lib/up/create-daemon.d.ts.map +0 -1
  265. package/dist/lib/up/create-daemon.js +0 -85
  266. package/dist/lib/up/create-daemon.js.map +0 -1
  267. package/dist/lib/up/handle-request.d.ts +0 -19
  268. package/dist/lib/up/handle-request.d.ts.map +0 -1
  269. package/dist/lib/up/handle-request.js +0 -71
  270. package/dist/lib/up/handle-request.js.map +0 -1
  271. package/dist/lib/up/open-browser.d.ts +0 -19
  272. package/dist/lib/up/open-browser.d.ts.map +0 -1
  273. package/dist/lib/up/open-browser.js +0 -43
  274. package/dist/lib/up/open-browser.js.map +0 -1
  275. package/dist/lib/up/read-body.d.ts +0 -3
  276. package/dist/lib/up/read-body.d.ts.map +0 -1
  277. package/dist/lib/up/read-body.js +0 -3
  278. package/dist/lib/up/read-body.js.map +0 -1
package/README.md CHANGED
@@ -1,30 +1,34 @@
1
1
  # @executioncontrolprotocol/cli
2
2
 
3
- ECP command-line interface for running **workflows** (`@executioncontrolprotocol.workflow`) in configured
4
- **environments** (runtime + extensions + policies).
3
+ ECP (Execution Control Protocol) command-line interface. An oclif 5 host whose own commands
4
+ are `defineOperation` definitions compiled by `@executioncontrolprotocol/plugin-sdk`. Plugin
5
+ commands come from extension definitions; there are no hand-written command classes.
5
6
 
6
7
  This CLI is how you run ECP deterministically in a Node.js / TypeScript ecosystem:
7
8
 
8
- - Compile workflow source modules (`.ts` / `.js`) to portable JSON manifests
9
- - Validate workflows against an environment’s registered capabilities
9
+ - Compile workflow files (`*.ecp.ts` / `.js`) to portable JSON manifests
10
+ - Validate workflows against the process host or an optional `--env` overlay
10
11
  - Describe/search environment capabilities for agent/UI discovery
11
- - Run workflows and print structured run results
12
+ - Run workflows and print structured run results (`ecp run --to`, `ecp run --events`)
12
13
  - Invoke a single capability outside a workflow (`ecp invoke`)
13
- - Serve an environment over loopback HTTP for `POST /v1/invoke` (`ecp serve`)
14
- - Test workflows with a persistent session (`ecp test start|run|rerun|status`)
15
- - Encode/decode workflows using format extensions (TOON, Fluent, JSON)
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)
16
18
 
17
19
  For the architecture and monorepo package boundaries, start with
18
- [`AGENTS.md`](../../AGENTS.md) and [`ecp-overhaul.md`](../../ecp-overhaul.md).
20
+ [`AGENTS.md`](../../AGENTS.md) and [`RESET-PLAN.md`](../../RESET-PLAN.md).
19
21
 
20
22
  ## Install
21
23
 
22
- From npm (when published):
24
+ From npm (when a dist-tag exists):
23
25
 
24
26
  ```sh
25
- npm install -g @executioncontrolprotocol/cli
27
+ npm install -g @executioncontrolprotocol/cli@next
26
28
  ```
27
29
 
30
+ Until `@next` is on the registry, pack-install from this repo (`pnpm run test:plugin-pack`).
31
+
28
32
  From this monorepo (recommended for development):
29
33
 
30
34
  ```sh
@@ -36,123 +40,120 @@ npm link
36
40
 
37
41
  ## Usage
38
42
 
39
- All operational commands that need an environment accept:
40
-
41
- - `--env <path>`: a module that exports the environment builder (`default export`)
43
+ `--env <file>` is an optional overlay (`environment(id).with([...])`). Omit it to use the
44
+ process host (built-in Node plus installed plugins).
42
45
 
43
46
  ### Run
44
47
 
45
48
  ```sh
46
- ecp run examples/01-echo/workflow.ts --env examples/01-echo/environment.ts
49
+ ecp run examples/01-echo/workflow.ecp.ts
47
50
  ```
48
51
 
49
52
  Provide workflow input (JSON file):
50
53
 
51
54
  ```sh
52
- ecp run workflow.json --env environment.ts --input input.json
55
+ ecp run workflow.ecp.ts --input input.json
53
56
  ```
54
57
 
55
58
  Dry run (validate + plan without invoking capabilities):
56
59
 
57
60
  ```sh
58
- ecp run workflow.ts --env environment.ts --dry-run
61
+ ecp run workflow.ecp.ts --dry-run
59
62
  ```
60
63
 
61
64
  ### Validate
62
65
 
63
66
  ```sh
64
- ecp validate examples/01-echo/workflow.ts --env examples/01-echo/environment.ts
67
+ ecp validate examples/01-echo/workflow.ecp.ts
65
68
  ```
66
69
 
67
70
  ### Compile (portable JSON)
68
71
 
69
72
  ```sh
70
- ecp compile examples/01-echo/workflow.ts -o dist/workflow.json
73
+ ecp compile examples/01-echo/workflow.ecp.ts -o dist/workflow.json
71
74
  ```
72
75
 
73
76
  ### Describe / search environment capabilities
74
77
 
75
78
  ```sh
76
- ecp describe --env examples/01-echo/environment.ts
77
- ecp search "echo" --env examples/01-echo/environment.ts
79
+ ecp describe
80
+ ecp search "echo"
78
81
  ```
79
82
 
80
- ### Test session (`ecp test`)
83
+ ### Run journals (`ecp runs`)
81
84
 
82
- Drive a workflow incrementally with frozen state (distinct from `@executioncontrolprotocol/core/testing` stubs):
85
+ Every `ecp run` writes `.ecp/runs/<runId>/` (`run.json` plus `steps/<stepId>.json`). Override
86
+ the directory with `ECP_RUNS_DIR`.
83
87
 
84
88
  ```sh
85
- ecp test start workflow.ts --env environment.ts -o session.json
86
- ecp test run --to step-b --env environment.ts --session session.json
87
- ecp test rerun step-a --env environment.ts --session session.json
88
- ecp test status --session session.json
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
89
95
  ```
90
96
 
91
- - `run --to <step-id>` is **inclusive** (runs through that step, then pauses).
92
- - `rerun <step-id>` re-executes one step and **clears** downstream history and `.as` state keys.
93
- - Session file schema: `@executioncontrolprotocol.test.session`.
94
-
95
- Fluent API: `ecp.test(workflow).with({ input }).start()` then `session.runTo(id)` / `session.rerun(id)`.
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.
96
103
 
97
104
  ### Invoke a capability
98
105
 
99
106
  Call a single bound capability without a workflow:
100
107
 
101
108
  ```sh
102
- ecp invoke @executioncontrolprotocol/test.echo --env examples/01-echo/environment.ts --input input.json
109
+ ecp invoke @executioncontrolprotocol/test.echo --input input.json
103
110
  ```
104
111
 
105
- Optional `--uses <provider-capability-id>` overrides the harness default provider. Prints an `InvokeResult` JSON document; exits non-zero when `success` is false.
112
+ Prints an `InvokeResult` JSON document; exits non-zero when `success` is false.
106
113
 
107
- ### Serve (`ecp serve`)
114
+ Pass `--json` for `{ ok: true, data }` or `{ ok: false, error: { code, message, path, suggestions } }`.
108
115
 
109
- Expose any `--env` over loopback HTTP (no auth; loopback-only trust):
116
+ ### Plugins
110
117
 
111
118
  ```sh
112
- ecp serve --env examples/01-echo/environment.ts
113
- ecp serve --env environment.ts --port 3090 --cors-origin http://localhost:5173
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
114
125
  ```
115
126
 
116
- - `GET /health` — `{ ok, version }`
117
- - `POST /v1/invoke` — body `{ capability, input?, provider? }` → `ecp.invoke(...).with(...).process()`
127
+ `--env` is optional on `run`, `validate`, and `install`. `describe`, `search`, and `invoke`
128
+ take it the same way.
118
129
 
119
- Default port **3090** (ECP leet), host `127.0.0.1`.
130
+ ### MCP
120
131
 
121
- ### Local daemon (`ecp up`)
122
-
123
- Ollama/PNA **demo bridge** (fixed local env, not arbitrary `--env`). Prefer `ecp serve` for general HTTP invoke. Start the daemon, then open the demo with a pairing token:
132
+ `ecp mcp serve` is a JIT plugin (`@executioncontrolprotocol/mcp`). Until `@next` is published,
133
+ link the workspace package:
124
134
 
125
135
  ```sh
126
- ecp up
127
- # Opens https://demo.executioncontrolprotocol.io/?token=<uuid>&bridge=http://127.0.0.1:3090
128
-
129
- ecp up --open-url http://localhost:5173/
130
- ecp up --no-open
136
+ ecp plugins link packages/mcp
137
+ ecp mcp serve
138
+ ecp mcp serve --http
131
139
  ```
132
140
 
133
- - `GET /health` — `{ ok, version, ollamaReachable }` (no auth; used by the demo to enable Ollama)
134
- - `POST /v1/invoke` — Bearer token required; same body shape as `ecp serve`
141
+ ### App
135
142
 
136
- Default port **3090**. The demo reads `?token=` (and optional `?bridge=`) automatically. Hosted HTTPS demos need **Chromium** (Chrome/Edge) for Private Network Access. Add extra page origins with `--cors-origin`.
137
-
138
- ### Encode / decode formats
139
-
140
- Encoding and decoding uses **format extensions** bound in your environment.
143
+ `ecp app` is a JIT plugin (`@executioncontrolprotocol/plugin-app`). Until `@next` is published,
144
+ link the workspace package:
141
145
 
142
146
  ```sh
143
- ecp encode workflow.json --format toon --env environment.ts -o workflow.toon
144
- ecp encode workflow.json --format fluent --env environment.ts -o workflow.generated.ts
145
- ecp decode workflow.toon --format toon --env environment.ts -o workflow.json
147
+ ecp plugins link plugins/plugin-app
148
+ ecp app examples/01-echo/workflow.ecp.ts
149
+ ecp app brief.ecp.ts --no-open
146
150
  ```
147
151
 
148
- Notes:
149
-
150
- - Fluent **decode** is not supported. Use `ecp compile` for TypeScript/Fluent source → manifest.
151
- - JSON is the canonical manifest format; other formats are optional extensions.
152
-
153
152
  ## Related packages
154
153
 
155
- - [`@executioncontrolprotocol/core`](../core/README.md): runtime-agnostic core + fluent API
156
- - [`@executioncontrolprotocol/node`](../runtimes/node/README.md): Node runtime host used by CLI examples
157
- - [`@executioncontrolprotocol/types`](../types/README.md): protocol types + generated JSON Schemas
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
158
  - [`@executioncontrolprotocol/mcp`](../mcp/): MCP server adapter exposing an environment to agents
159
+ - [`@executioncontrolprotocol/plugin-jsonata`](../../plugins/plugin-jsonata/README.md): reference plugin
@@ -0,0 +1,7 @@
1
+ /**
2
+ * CLI command classes generated from host operations.
3
+ * oclif loads this map with the explicit strategy.
4
+ * @category CLI
5
+ */
6
+ export declare const COMMANDS: Record<string, import("@oclif/core").Command.Class>;
7
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,qDAAyB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { toCommands } from "@executioncontrolprotocol/plugin-sdk";
2
+ import { operations } from "./operations/index.js";
3
+ /**
4
+ * CLI command classes generated from host operations.
5
+ * oclif loads this map with the explicit strategy.
6
+ * @category CLI
7
+ */
8
+ export const COMMANDS = toCommands(operations);
9
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { Hook } from "@oclif/core";
2
+ /**
3
+ * Map an unknown topic to a first-party plugin, or redirect `ecp plugin` to `ecp plugins`.
4
+ * @category CLI
5
+ */
6
+ declare const hook: Hook<"command_not_found">;
7
+ export default hook;
8
+ //# sourceMappingURL=command-not-found.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-not-found.d.ts","sourceRoot":"","sources":["../../src/hooks/command-not-found.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAevC;;;GAGG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAmEnC,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,72 @@
1
+ import { ECP_PLUGINS_MISSING, EXIT_PLUGINS_MISSING, failureEnvelope, } from "@executioncontrolprotocol/plugin-sdk";
2
+ import { argvHasFlag } from "../lib/argv.js";
3
+ import { confirm } from "../lib/confirm.js";
4
+ import { jitPluginForTopic } from "../lib/jit-plugins.js";
5
+ function firstToken(id) {
6
+ if (!id)
7
+ return "";
8
+ return id.split(":")[0] ?? id;
9
+ }
10
+ /**
11
+ * Map an unknown topic to a first-party plugin, or redirect `ecp plugin` to `ecp plugins`.
12
+ * @category CLI
13
+ */
14
+ const hook = async function (options) {
15
+ const id = options.id ?? "";
16
+ const argv = options.argv ?? [];
17
+ const json = argvHasFlag(argv, "json");
18
+ if (id === "plugin" || id.startsWith("plugin:")) {
19
+ const rest = id === "plugin"
20
+ ? argv.join(" ")
21
+ : `${id.slice("plugin:".length).replaceAll(":", " ")} ${argv.join(" ")}`.trim();
22
+ const suggestion = rest ? `ecp plugins ${rest}` : "ecp plugins";
23
+ const message = `The command is ${suggestion}, not ecp plugin.`;
24
+ if (json) {
25
+ this.log(JSON.stringify(failureEnvelope({
26
+ code: ECP_PLUGINS_MISSING,
27
+ message,
28
+ suggestions: [suggestion],
29
+ })));
30
+ }
31
+ else {
32
+ this.log(message);
33
+ }
34
+ this.exit(EXIT_PLUGINS_MISSING);
35
+ }
36
+ const topic = firstToken(id);
37
+ if (!topic)
38
+ return;
39
+ const jitPlugins = this.config.pjson?.oclif
40
+ ?.jitPlugins ?? {};
41
+ // JIT packages (`mcp`, later `app`) are not `plugin-<topic>`. Let oclif's
42
+ // plugin-not-found hook install from `oclif.jitPlugins` instead of mapping
43
+ // `ecp mcp` to `@executioncontrolprotocol/plugin-mcp`.
44
+ if (jitPluginForTopic(topic, jitPlugins))
45
+ return;
46
+ // First-party plugins are unpublished until later phases. Map the unknown
47
+ // topic to plugin-<topic> so `ecp jsonata` returns ECP_PLUGINS_MISSING
48
+ // (exit 3) instead of oclif's not-found exit 127.
49
+ const pkg = `@executioncontrolprotocol/plugin-${topic}`;
50
+ const installHint = `ecp plugins install ${topic}`;
51
+ const message = `Plugin ${pkg} is not installed.`;
52
+ if (json) {
53
+ this.log(JSON.stringify(failureEnvelope({
54
+ code: ECP_PLUGINS_MISSING,
55
+ message,
56
+ suggestions: [installHint],
57
+ })));
58
+ this.exit(EXIT_PLUGINS_MISSING);
59
+ }
60
+ if (process.stdin.isTTY && process.stdout.isTTY) {
61
+ const ok = await confirm(`Install ${pkg} and rerun?`, argv);
62
+ if (ok) {
63
+ await this.config.runCommand("plugins:install", [pkg]);
64
+ await this.config.runCommand(id, argv);
65
+ return;
66
+ }
67
+ }
68
+ this.log(`${message} Run: ${installHint}`);
69
+ this.exit(EXIT_PLUGINS_MISSING);
70
+ };
71
+ export default hook;
72
+ //# sourceMappingURL=command-not-found.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-not-found.js","sourceRoot":"","sources":["../../src/hooks/command-not-found.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,8 @@
1
+ import type { Hook } from "@oclif/core";
2
+ /**
3
+ * Create the process-wide ECP host from installed plugin definitions.
4
+ * @category CLI
5
+ */
6
+ declare const hook: Hook<"init">;
7
+ export default hook;
8
+ //# sourceMappingURL=init-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-host.d.ts","sourceRoot":"","sources":["../../src/hooks/init-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,aAAa,CAAA;AAkCnD;;;GAGG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,MAAM,CAYtB,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,45 @@
1
+ import { NODE_ENVIRONMENT_ID, writeInvokeJournal } from "@executioncontrolprotocol/node";
2
+ import { setHost } from "@executioncontrolprotocol/plugin-sdk";
3
+ import { createProcessEnvironment } from "../lib/plugin-bindings.js";
4
+ async function reloadUserPlugins(config) {
5
+ const loader = config;
6
+ await loader.loadPluginsAndCommands?.({ force: true });
7
+ }
8
+ async function createHost(config) {
9
+ const env = await createProcessEnvironment(config);
10
+ const ecp = await env.init();
11
+ const host = {
12
+ ecp,
13
+ registry: ecp.getRegistry(),
14
+ environmentId: NODE_ENVIRONMENT_ID,
15
+ output: "pretty",
16
+ recordInvoke: async (entry) => {
17
+ await writeInvokeJournal(entry);
18
+ },
19
+ rebuild: async () => {
20
+ await ecp.terminate();
21
+ await reloadUserPlugins(config);
22
+ const next = await createHost(config);
23
+ setHost(next);
24
+ return next;
25
+ },
26
+ };
27
+ return host;
28
+ }
29
+ /**
30
+ * Create the process-wide ECP host from installed plugin definitions.
31
+ * @category CLI
32
+ */
33
+ const hook = async function (options) {
34
+ const argv = options.argv ?? process.argv;
35
+ if (!options.id ||
36
+ options.id === "help" ||
37
+ options.id === "version" ||
38
+ argv.includes("--help") ||
39
+ argv.includes("-h")) {
40
+ return;
41
+ }
42
+ setHost(await createHost(options.config));
43
+ };
44
+ export default hook;
45
+ //# sourceMappingURL=init-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-host.js","sourceRoot":"","sources":["../../src/hooks/init-host.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACxF,OAAO,EAAE,OAAO,EAAgB,MAAM,sCAAsC,CAAA;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAEpE,KAAK,UAAU,iBAAiB,CAAC,MAAyB;IACxD,MAAM,MAAM,GAAG,MAEd,CAAA;IACD,MAAM,MAAM,CAAC,sBAAsB,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;AACxD,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,MAAyB;IACjD,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,mBAAmB;QAClC,MAAM,EAAE,QAAQ;QAChB,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YAC5B,MAAM,kBAAkB,CAAC,KAAK,CAAC,CAAA;QACjC,CAAC;QACD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,GAAG,CAAC,SAAS,EAAE,CAAA;YACrB,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAA;YAC/B,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,CAAA;YACrC,OAAO,CAAC,IAAI,CAAC,CAAA;YACb,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,IAAI,GAAiB,KAAK,WAAW,OAAO;IAChD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAA;IACzC,IACE,CAAC,OAAO,CAAC,EAAE;QACX,OAAO,CAAC,EAAE,KAAK,MAAM;QACrB,OAAO,CAAC,EAAE,KAAK,SAAS;QACxB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EACnB,CAAC;QACD,OAAM;IACR,CAAC;IACD,OAAO,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;AAC3C,CAAC,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { Hook } from "@oclif/core";
2
+ /**
3
+ * Confirm, install a JIT plugin at its pinned range, then rerun the command.
4
+ * @category CLI
5
+ */
6
+ declare const hook: Hook<"jit_plugin_not_installed">;
7
+ export default hook;
8
+ //# sourceMappingURL=jit-install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jit-install.d.ts","sourceRoot":"","sources":["../../src/hooks/jit-install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AASvC;;;GAGG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,0BAA0B,CAyB1C,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { ECP_PLUGINS_MISSING, EXIT_PLUGINS_MISSING, failureEnvelope, } from "@executioncontrolprotocol/plugin-sdk";
2
+ import { argvHasFlag } from "../lib/argv.js";
3
+ import { confirm } from "../lib/confirm.js";
4
+ /**
5
+ * Confirm, install a JIT plugin at its pinned range, then rerun the command.
6
+ * @category CLI
7
+ */
8
+ const hook = async function (options) {
9
+ const name = options.pluginName;
10
+ const tag = options.pluginVersion || "latest";
11
+ if (!name)
12
+ return;
13
+ const spec = `${name}@${tag}`;
14
+ const argv = process.argv.slice(2);
15
+ const json = argvHasFlag(argv, "json");
16
+ if (json) {
17
+ this.log(JSON.stringify(failureEnvelope({
18
+ code: ECP_PLUGINS_MISSING,
19
+ message: `Plugin ${spec} is not installed.`,
20
+ suggestions: [`ecp plugins install ${spec}`],
21
+ })));
22
+ this.exit(EXIT_PLUGINS_MISSING);
23
+ }
24
+ const ok = await confirm(`Install ${spec} and continue?`, argv);
25
+ if (!ok) {
26
+ this.log(`Run: ecp plugins install ${spec}`);
27
+ this.exit(EXIT_PLUGINS_MISSING);
28
+ }
29
+ await this.config.runCommand("plugins:install", [spec]);
30
+ };
31
+ export default hook;
32
+ //# sourceMappingURL=jit-install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jit-install.js","sourceRoot":"","sources":["../../src/hooks/jit-install.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,GAChB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C;;;GAGG;AACH,MAAM,IAAI,GAAqC,KAAK,WAAW,OAAO;IACpE,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAA;IAC/B,MAAM,GAAG,GAAG,OAAO,CAAC,aAAa,IAAI,QAAQ,CAAA;IAC7C,IAAI,CAAC,IAAI;QAAE,OAAM;IACjB,MAAM,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,EAAE,CAAA;IAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAClC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACtC,IAAI,IAAI,EAAE,CAAC;QACT,IAAI,CAAC,GAAG,CACN,IAAI,CAAC,SAAS,CACZ,eAAe,CAAC;YACd,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,UAAU,IAAI,oBAAoB;YAC3C,WAAW,EAAE,CAAC,uBAAuB,IAAI,EAAE,CAAC;SAC7C,CAAC,CACH,CACF,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;IACjC,CAAC;IACD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,WAAW,IAAI,gBAAgB,EAAE,IAAI,CAAC,CAAA;IAC/D,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAA;QAC5C,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;IACjC,CAAC;IACD,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AACzD,CAAC,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { Hook } from "@oclif/core";
2
+ /**
3
+ * Trust check before `plugins:install`. First-party npm packages are allowed;
4
+ * third-party packages need a prompt, `--yes`, or a remembered decision.
5
+ * @category CLI
6
+ */
7
+ declare const hook: Hook<"plugins:preinstall">;
8
+ export default hook;
9
+ //# sourceMappingURL=trust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust.d.ts","sourceRoot":"","sources":["../../src/hooks/trust.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAUvC;;;;GAIG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAiBpC,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { failureEnvelope } from "@executioncontrolprotocol/plugin-sdk";
2
+ import { EcpCliError } from "@executioncontrolprotocol/plugin-sdk";
3
+ import { argvHasFlag } from "../lib/argv.js";
4
+ import { assertTrusted } from "../lib/evaluate-trust.js";
5
+ /**
6
+ * Trust check before `plugins:install`. First-party npm packages are allowed;
7
+ * third-party packages need a prompt, `--yes`, or a remembered decision.
8
+ * @category CLI
9
+ */
10
+ const hook = async function (options) {
11
+ const plugin = options.plugin;
12
+ const spec = plugin?.url || plugin?.name;
13
+ if (!spec)
14
+ return;
15
+ try {
16
+ await assertTrusted(this.config, spec, process.argv.slice(2));
17
+ }
18
+ catch (err) {
19
+ if (err instanceof EcpCliError) {
20
+ if (argvHasFlag(process.argv, "json")) {
21
+ this.log(JSON.stringify(failureEnvelope(err.toBody())));
22
+ }
23
+ else {
24
+ this.error(err.message, { exit: err.exitCode });
25
+ }
26
+ this.exit(err.exitCode);
27
+ }
28
+ throw err;
29
+ }
30
+ };
31
+ export default hook;
32
+ //# sourceMappingURL=trust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust.js","sourceRoot":"","sources":["../../src/hooks/trust.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAMxD;;;;GAIG;AACH,MAAM,IAAI,GAA+B,KAAK,WAAW,OAAO;IAC9D,MAAM,MAAM,GAAI,OAAwC,CAAC,MAAM,CAAA;IAC/D,MAAM,IAAI,GAAG,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,IAAI,CAAA;IACxC,IAAI,CAAC,IAAI;QAAE,OAAM;IACjB,IAAI,CAAC;QACH,MAAM,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAC/D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,WAAW,EAAE,CAAC;YAC/B,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;gBACtC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;YACzD,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAA;YACjD,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACzB,CAAC;QACD,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * True when argv includes `--name`, `--name=…`, or `-x` for a known short flag.
3
+ * @category CLI
4
+ */
5
+ export declare function argvHasFlag(argv: string[], name: string, short?: string): boolean;
6
+ /**
7
+ * Value of `--name <value>` or `--name=value` from argv.
8
+ * @category CLI
9
+ */
10
+ export declare function argvFlagValue(argv: string[], name: string): string | undefined;
11
+ //# sourceMappingURL=argv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"argv.d.ts","sourceRoot":"","sources":["../../src/lib/argv.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAKjF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAS9E"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * True when argv includes `--name`, `--name=…`, or `-x` for a known short flag.
3
+ * @category CLI
4
+ */
5
+ export function argvHasFlag(argv, name, short) {
6
+ const token = `--${name}`;
7
+ if (argv.some((arg) => arg === token || arg.startsWith(`${token}=`)))
8
+ return true;
9
+ if (short && argv.includes(`-${short}`))
10
+ return true;
11
+ return false;
12
+ }
13
+ /**
14
+ * Value of `--name <value>` or `--name=value` from argv.
15
+ * @category CLI
16
+ */
17
+ export function argvFlagValue(argv, name) {
18
+ const token = `--${name}`;
19
+ for (let i = 0; i < argv.length; i += 1) {
20
+ const arg = argv[i];
21
+ if (!arg)
22
+ continue;
23
+ if (arg === token)
24
+ return argv[i + 1];
25
+ if (arg.startsWith(`${token}=`))
26
+ return arg.slice(token.length + 1);
27
+ }
28
+ return undefined;
29
+ }
30
+ //# sourceMappingURL=argv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"argv.js","sourceRoot":"","sources":["../../src/lib/argv.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAc,EAAE,IAAY,EAAE,KAAc;IACtE,MAAM,KAAK,GAAG,KAAK,IAAI,EAAE,CAAA;IACzB,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,KAAK,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;QAAE,OAAO,IAAI,CAAA;IACjF,IAAI,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC;QAAE,OAAO,IAAI,CAAA;IACpD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAAc,EAAE,IAAY;IACxD,MAAM,KAAK,GAAG,KAAK,IAAI,EAAE,CAAA;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,IAAI,CAAC,GAAG;YAAE,SAAQ;QAClB,IAAI,GAAG,KAAK,KAAK;YAAE,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QACrC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,KAAK,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACrE,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * True when the user passed `--yes` or `ECP_TRUST_THIRD_PARTY=1`.
3
+ * @category CLI
4
+ */
5
+ export declare function wantsYes(argv?: string[]): boolean;
6
+ /**
7
+ * Confirm an action: `--yes` wins; otherwise prompt on a TTY.
8
+ * @category CLI
9
+ */
10
+ export declare function confirm(message: string, argv?: string[]): Promise<boolean>;
11
+ /**
12
+ * Confirm an install: `--yes` wins; empty TTY answer defaults to yes.
13
+ * @category CLI
14
+ */
15
+ export declare function confirmDefaultYes(message: string, argv?: string[]): Promise<boolean>;
16
+ //# sourceMappingURL=confirm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../src/lib/confirm.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAE/D;AAED;;;GAGG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAU9F;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAiB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAWlB"}
@@ -0,0 +1,49 @@
1
+ import { createInterface } from "node:readline/promises";
2
+ import { stdin as input, stdout as output } from "node:process";
3
+ import { argvHasFlag } from "./argv.js";
4
+ /**
5
+ * True when the user passed `--yes` or `ECP_TRUST_THIRD_PARTY=1`.
6
+ * @category CLI
7
+ */
8
+ export function wantsYes(argv = process.argv) {
9
+ return argvHasFlag(argv, "yes") || process.env.ECP_TRUST_THIRD_PARTY === "1";
10
+ }
11
+ /**
12
+ * Confirm an action: `--yes` wins; otherwise prompt on a TTY.
13
+ * @category CLI
14
+ */
15
+ export async function confirm(message, argv = process.argv) {
16
+ if (wantsYes(argv))
17
+ return true;
18
+ if (!process.stdin.isTTY || !process.stdout.isTTY)
19
+ return false;
20
+ const rl = createInterface({ input, output });
21
+ try {
22
+ const answer = (await rl.question(`${message} (y/N) `)).trim().toLowerCase();
23
+ return answer === "y" || answer === "yes";
24
+ }
25
+ finally {
26
+ rl.close();
27
+ }
28
+ }
29
+ /**
30
+ * Confirm an install: `--yes` wins; empty TTY answer defaults to yes.
31
+ * @category CLI
32
+ */
33
+ export async function confirmDefaultYes(message, argv = process.argv) {
34
+ if (wantsYes(argv))
35
+ return true;
36
+ if (!process.stdin.isTTY || !process.stdout.isTTY)
37
+ return false;
38
+ const rl = createInterface({ input, output });
39
+ try {
40
+ const answer = (await rl.question(`${message} (Y/n) `)).trim().toLowerCase();
41
+ if (answer === "")
42
+ return true;
43
+ return answer === "y" || answer === "yes";
44
+ }
45
+ finally {
46
+ rl.close();
47
+ }
48
+ }
49
+ //# sourceMappingURL=confirm.js.map