@jevitate/cli 0.1.0 → 0.2.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 (375) hide show
  1. package/README.md +23 -0
  2. package/dist/ai-cli.js +40 -30
  3. package/dist/ai-cli.js.map +1 -1
  4. package/dist/author-journey-cli.d.ts +4 -0
  5. package/dist/author-journey-cli.js +109 -0
  6. package/dist/author-journey-cli.js.map +1 -0
  7. package/dist/bin.js +58077 -22454
  8. package/dist/bin.js.map +1 -1
  9. package/dist/browser-run-options.d.ts +58 -0
  10. package/dist/browser-run-options.js +106 -0
  11. package/dist/browser-run-options.js.map +1 -0
  12. package/dist/build-info.generated.d.ts +2 -0
  13. package/dist/build-info.generated.js +10 -0
  14. package/dist/build-info.generated.js.map +1 -0
  15. package/dist/check-api.d.ts +5 -0
  16. package/dist/check-api.js +233 -0
  17. package/dist/check-api.js.map +1 -0
  18. package/dist/check-budget.d.ts +26 -0
  19. package/dist/check-budget.js +89 -0
  20. package/dist/check-budget.js.map +1 -0
  21. package/dist/check-cli.d.ts +31 -0
  22. package/dist/check-cli.js +109 -0
  23. package/dist/check-cli.js.map +1 -0
  24. package/dist/check-execute.d.ts +25 -0
  25. package/dist/check-execute.js +385 -0
  26. package/dist/check-execute.js.map +1 -0
  27. package/dist/check-plan.d.ts +113 -0
  28. package/dist/check-plan.js +448 -0
  29. package/dist/check-plan.js.map +1 -0
  30. package/dist/check-suite.d.ts +171 -0
  31. package/dist/check-suite.js +515 -0
  32. package/dist/check-suite.js.map +1 -0
  33. package/dist/check-types.d.ts +181 -0
  34. package/dist/check-types.js +35 -0
  35. package/dist/check-types.js.map +1 -0
  36. package/dist/cli-args.d.ts +26 -0
  37. package/dist/cli-args.js +50 -0
  38. package/dist/cli-args.js.map +1 -0
  39. package/dist/cli-output.d.ts +102 -0
  40. package/dist/cli-output.js +516 -0
  41. package/dist/cli-output.js.map +1 -0
  42. package/dist/cli-reference.d.ts +3 -0
  43. package/dist/cli-reference.js +81 -0
  44. package/dist/cli-reference.js.map +1 -0
  45. package/dist/cli-refusal.d.ts +12 -0
  46. package/dist/cli-refusal.js +52 -0
  47. package/dist/cli-refusal.js.map +1 -0
  48. package/dist/cli-shared.d.ts +330 -0
  49. package/dist/cli-shared.js +492 -0
  50. package/dist/cli-shared.js.map +1 -0
  51. package/dist/cli-surface.d.ts +33 -0
  52. package/dist/cli-surface.js +48 -0
  53. package/dist/cli-surface.js.map +1 -0
  54. package/dist/conversation-options.d.ts +15 -0
  55. package/dist/conversation-options.js +10 -0
  56. package/dist/conversation-options.js.map +1 -0
  57. package/dist/credentials-file.d.ts +15 -0
  58. package/dist/credentials-file.js +56 -0
  59. package/dist/credentials-file.js.map +1 -0
  60. package/dist/data-dir.d.ts +1 -1
  61. package/dist/data-dir.js +1 -1
  62. package/dist/defect-evidence.d.ts +141 -0
  63. package/dist/defect-evidence.js +502 -0
  64. package/dist/defect-evidence.js.map +1 -0
  65. package/dist/demo-aspect-api.d.ts +209 -0
  66. package/dist/demo-aspect-api.js +397 -0
  67. package/dist/demo-aspect-api.js.map +1 -0
  68. package/dist/demo-aspect-cli.d.ts +3 -0
  69. package/dist/demo-aspect-cli.js +241 -0
  70. package/dist/demo-aspect-cli.js.map +1 -0
  71. package/dist/demo-capture.d.ts +108 -0
  72. package/dist/demo-capture.js +438 -0
  73. package/dist/demo-capture.js.map +1 -0
  74. package/dist/engine.d.ts +35 -0
  75. package/dist/engine.js +25 -0
  76. package/dist/engine.js.map +1 -0
  77. package/dist/environments.d.ts +155 -0
  78. package/dist/environments.js +364 -0
  79. package/dist/environments.js.map +1 -0
  80. package/dist/exit-codes.d.ts +46 -0
  81. package/dist/exit-codes.js +91 -0
  82. package/dist/exit-codes.js.map +1 -0
  83. package/dist/explore-adversarial.d.ts +137 -0
  84. package/dist/explore-adversarial.js +218 -0
  85. package/dist/explore-adversarial.js.map +1 -0
  86. package/dist/explore-api.d.ts +7 -187
  87. package/dist/explore-api.js +7 -301
  88. package/dist/explore-api.js.map +1 -1
  89. package/dist/explore-author.d.ts +79 -0
  90. package/dist/explore-author.js +86 -0
  91. package/dist/explore-author.js.map +1 -0
  92. package/dist/explore-cli.d.ts +7 -0
  93. package/dist/explore-cli.js +963 -0
  94. package/dist/explore-cli.js.map +1 -0
  95. package/dist/explore-coverage.d.ts +158 -0
  96. package/dist/explore-coverage.js +240 -0
  97. package/dist/explore-coverage.js.map +1 -0
  98. package/dist/explore-feature.d.ts +127 -0
  99. package/dist/explore-feature.js +220 -0
  100. package/dist/explore-feature.js.map +1 -0
  101. package/dist/explore-goal.d.ts +253 -0
  102. package/dist/explore-goal.js +374 -0
  103. package/dist/explore-goal.js.map +1 -0
  104. package/dist/explore-shared.d.ts +152 -0
  105. package/dist/explore-shared.js +129 -0
  106. package/dist/explore-shared.js.map +1 -0
  107. package/dist/explore-specs.d.ts +53 -0
  108. package/dist/explore-specs.js +333 -0
  109. package/dist/explore-specs.js.map +1 -0
  110. package/dist/findings-filing.d.ts +64 -0
  111. package/dist/findings-filing.js +108 -0
  112. package/dist/findings-filing.js.map +1 -0
  113. package/dist/fixture-auth.d.ts +52 -0
  114. package/dist/fixture-auth.js +82 -0
  115. package/dist/fixture-auth.js.map +1 -0
  116. package/dist/fixture-cli.d.ts +70 -0
  117. package/dist/fixture-cli.js +178 -0
  118. package/dist/fixture-cli.js.map +1 -0
  119. package/dist/github-issue-filer.d.ts +62 -0
  120. package/dist/github-issue-filer.js +188 -0
  121. package/dist/github-issue-filer.js.map +1 -0
  122. package/dist/host-health-run.d.ts +24 -0
  123. package/dist/host-health-run.js +27 -0
  124. package/dist/host-health-run.js.map +1 -0
  125. package/dist/http-5xx-outcome.d.ts +6 -0
  126. package/dist/http-5xx-outcome.js +39 -0
  127. package/dist/http-5xx-outcome.js.map +1 -0
  128. package/dist/inbox-cli.d.ts +7 -0
  129. package/dist/inbox-cli.js +197 -0
  130. package/dist/inbox-cli.js.map +1 -0
  131. package/dist/index.d.ts +1 -0
  132. package/dist/index.js +1 -0
  133. package/dist/index.js.map +1 -1
  134. package/dist/init-cli.d.ts +4 -0
  135. package/dist/init-cli.js +127 -0
  136. package/dist/init-cli.js.map +1 -0
  137. package/dist/init-keys.d.ts +19 -2
  138. package/dist/init-keys.js +15 -4
  139. package/dist/init-keys.js.map +1 -1
  140. package/dist/init-next-steps.d.ts +35 -0
  141. package/dist/init-next-steps.js +79 -0
  142. package/dist/init-next-steps.js.map +1 -0
  143. package/dist/invariants-file.d.ts +34 -0
  144. package/dist/invariants-file.js +68 -0
  145. package/dist/invariants-file.js.map +1 -0
  146. package/dist/invariants-validate.d.ts +30 -0
  147. package/dist/invariants-validate.js +105 -0
  148. package/dist/invariants-validate.js.map +1 -0
  149. package/dist/journey-annotate-api.d.ts +76 -0
  150. package/dist/journey-annotate-api.js +256 -0
  151. package/dist/journey-annotate-api.js.map +1 -0
  152. package/dist/journey-annotate-cli.d.ts +9 -0
  153. package/dist/journey-annotate-cli.js +179 -0
  154. package/dist/journey-annotate-cli.js.map +1 -0
  155. package/dist/journey-api.d.ts +79 -2
  156. package/dist/journey-api.js +136 -19
  157. package/dist/journey-api.js.map +1 -1
  158. package/dist/journey-cli.d.ts +4 -0
  159. package/dist/journey-cli.js +370 -0
  160. package/dist/journey-cli.js.map +1 -0
  161. package/dist/journey-demo-api.d.ts +112 -0
  162. package/dist/journey-demo-api.js +392 -0
  163. package/dist/journey-demo-api.js.map +1 -0
  164. package/dist/journey-demo-cli.d.ts +10 -0
  165. package/dist/journey-demo-cli.js +155 -0
  166. package/dist/journey-demo-cli.js.map +1 -0
  167. package/dist/kill-signal.d.ts +193 -0
  168. package/dist/kill-signal.js +284 -0
  169. package/dist/kill-signal.js.map +1 -0
  170. package/dist/launch-armed.d.ts +37 -0
  171. package/dist/launch-armed.js +31 -0
  172. package/dist/launch-armed.js.map +1 -0
  173. package/dist/ledger-api.d.ts +106 -0
  174. package/dist/ledger-api.js +237 -0
  175. package/dist/ledger-api.js.map +1 -0
  176. package/dist/ledger-cli.d.ts +18 -0
  177. package/dist/ledger-cli.js +107 -0
  178. package/dist/ledger-cli.js.map +1 -0
  179. package/dist/load-api.d.ts +29 -11
  180. package/dist/load-api.js +23 -15
  181. package/dist/load-api.js.map +1 -1
  182. package/dist/load-cli.d.ts +4 -0
  183. package/dist/load-cli.js +97 -0
  184. package/dist/load-cli.js.map +1 -0
  185. package/dist/log-correlation.d.ts +147 -0
  186. package/dist/log-correlation.js +325 -0
  187. package/dist/log-correlation.js.map +1 -0
  188. package/dist/log-lines.d.ts +131 -0
  189. package/dist/log-lines.js +389 -0
  190. package/dist/log-lines.js.map +1 -0
  191. package/dist/log-sources.d.ts +71 -0
  192. package/dist/log-sources.js +235 -0
  193. package/dist/log-sources.js.map +1 -0
  194. package/dist/logs-cli.d.ts +3 -0
  195. package/dist/logs-cli.js +51 -0
  196. package/dist/logs-cli.js.map +1 -0
  197. package/dist/logs-retention.d.ts +28 -0
  198. package/dist/logs-retention.js +84 -0
  199. package/dist/logs-retention.js.map +1 -0
  200. package/dist/mcp-api.d.ts +89 -1
  201. package/dist/mcp-api.js +472 -18
  202. package/dist/mcp-api.js.map +1 -1
  203. package/dist/mcp-args.d.ts +38 -0
  204. package/dist/mcp-args.js +131 -0
  205. package/dist/mcp-args.js.map +1 -0
  206. package/dist/mcp-cli-bridge.d.ts +34 -0
  207. package/dist/mcp-cli-bridge.js +62 -0
  208. package/dist/mcp-cli-bridge.js.map +1 -0
  209. package/dist/mcp-cli-runner.d.ts +29 -0
  210. package/dist/mcp-cli-runner.js +44 -0
  211. package/dist/mcp-cli-runner.js.map +1 -0
  212. package/dist/mcp-cli-tools.d.ts +125 -0
  213. package/dist/mcp-cli-tools.js +680 -0
  214. package/dist/mcp-cli-tools.js.map +1 -0
  215. package/dist/mcp-paths.d.ts +28 -0
  216. package/dist/mcp-paths.js +76 -0
  217. package/dist/mcp-paths.js.map +1 -0
  218. package/dist/mission-actors.d.ts +40 -0
  219. package/dist/mission-actors.js +72 -0
  220. package/dist/mission-actors.js.map +1 -0
  221. package/dist/mission-api.d.ts +35 -0
  222. package/dist/mission-api.js +58 -2
  223. package/dist/mission-api.js.map +1 -1
  224. package/dist/mission-cli.d.ts +4 -0
  225. package/dist/mission-cli.js +247 -0
  226. package/dist/mission-cli.js.map +1 -0
  227. package/dist/mission-exit.d.ts +22 -0
  228. package/dist/mission-exit.js +26 -0
  229. package/dist/mission-exit.js.map +1 -0
  230. package/dist/mission-fixtures.d.ts +225 -0
  231. package/dist/mission-fixtures.js +828 -0
  232. package/dist/mission-fixtures.js.map +1 -0
  233. package/dist/mission-journal.d.ts +60 -0
  234. package/dist/mission-journal.js +115 -0
  235. package/dist/mission-journal.js.map +1 -0
  236. package/dist/mission-queue-cli.d.ts +10 -0
  237. package/dist/mission-queue-cli.js +198 -0
  238. package/dist/mission-queue-cli.js.map +1 -0
  239. package/dist/mission-queue-runner.d.ts +126 -0
  240. package/dist/mission-queue-runner.js +397 -0
  241. package/dist/mission-queue-runner.js.map +1 -0
  242. package/dist/multi-run-cli.d.ts +37 -0
  243. package/dist/multi-run-cli.js +110 -0
  244. package/dist/multi-run-cli.js.map +1 -0
  245. package/dist/multi-run.d.ts +339 -0
  246. package/dist/multi-run.js +619 -0
  247. package/dist/multi-run.js.map +1 -0
  248. package/dist/openrouter-call.d.ts +22 -0
  249. package/dist/openrouter-call.js +63 -0
  250. package/dist/openrouter-call.js.map +1 -0
  251. package/dist/profile-cli.d.ts +4 -0
  252. package/dist/profile-cli.js +57 -0
  253. package/dist/profile-cli.js.map +1 -0
  254. package/dist/program.d.ts +3 -75
  255. package/dist/program.js +119 -1921
  256. package/dist/program.js.map +1 -1
  257. package/dist/project-dir.d.ts +96 -0
  258. package/dist/project-dir.js +220 -0
  259. package/dist/project-dir.js.map +1 -0
  260. package/dist/record-api.d.ts +10 -6
  261. package/dist/record-api.js +39 -28
  262. package/dist/record-api.js.map +1 -1
  263. package/dist/record-cli.d.ts +4 -0
  264. package/dist/record-cli.js +64 -0
  265. package/dist/record-cli.js.map +1 -0
  266. package/dist/recording-cli.d.ts +4 -0
  267. package/dist/recording-cli.js +248 -0
  268. package/dist/recording-cli.js.map +1 -0
  269. package/dist/regression-api.d.ts +101 -0
  270. package/dist/regression-api.js +384 -5
  271. package/dist/regression-api.js.map +1 -1
  272. package/dist/regression-cli.d.ts +4 -0
  273. package/dist/regression-cli.js +232 -0
  274. package/dist/regression-cli.js.map +1 -0
  275. package/dist/report-api.d.ts +146 -0
  276. package/dist/report-api.js +430 -0
  277. package/dist/report-api.js.map +1 -0
  278. package/dist/report-cli.d.ts +12 -0
  279. package/dist/report-cli.js +147 -0
  280. package/dist/report-cli.js.map +1 -0
  281. package/dist/result-schema.d.ts +22 -0
  282. package/dist/result-schema.js +28 -0
  283. package/dist/result-schema.js.map +1 -0
  284. package/dist/run-index.d.ts +29 -0
  285. package/dist/run-index.js +70 -0
  286. package/dist/run-index.js.map +1 -0
  287. package/dist/run-screenshots.d.ts +123 -0
  288. package/dist/run-screenshots.js +229 -0
  289. package/dist/run-screenshots.js.map +1 -0
  290. package/dist/runtime-env.d.ts +8 -0
  291. package/dist/runtime-env.js +22 -0
  292. package/dist/runtime-env.js.map +1 -0
  293. package/dist/secret-args.d.ts +23 -0
  294. package/dist/secret-args.js +45 -0
  295. package/dist/secret-args.js.map +1 -0
  296. package/dist/serve-cli.d.ts +4 -0
  297. package/dist/serve-cli.js +95 -0
  298. package/dist/serve-cli.js.map +1 -0
  299. package/dist/server-log-verify.d.ts +34 -0
  300. package/dist/server-log-verify.js +115 -0
  301. package/dist/server-log-verify.js.map +1 -0
  302. package/dist/session-check.d.ts +14 -0
  303. package/dist/session-check.js +44 -0
  304. package/dist/session-check.js.map +1 -0
  305. package/dist/site-cli.d.ts +4 -0
  306. package/dist/site-cli.js +127 -0
  307. package/dist/site-cli.js.map +1 -0
  308. package/dist/site-gate-cli.d.ts +28 -0
  309. package/dist/site-gate-cli.js +58 -0
  310. package/dist/site-gate-cli.js.map +1 -0
  311. package/dist/source-api.js +18 -3
  312. package/dist/source-api.js.map +1 -1
  313. package/dist/source-cli.d.ts +4 -0
  314. package/dist/source-cli.js +284 -0
  315. package/dist/source-cli.js.map +1 -0
  316. package/dist/source-run-api.d.ts +27 -1
  317. package/dist/source-run-api.js +22 -11
  318. package/dist/source-run-api.js.map +1 -1
  319. package/dist/storage-state-snapshot.d.ts +50 -0
  320. package/dist/storage-state-snapshot.js +87 -0
  321. package/dist/storage-state-snapshot.js.map +1 -0
  322. package/dist/suite-explore-options.d.ts +289 -0
  323. package/dist/suite-explore-options.js +140 -0
  324. package/dist/suite-explore-options.js.map +1 -0
  325. package/dist/target-config.d.ts +109 -0
  326. package/dist/target-config.js +216 -0
  327. package/dist/target-config.js.map +1 -0
  328. package/dist/transcript-file.d.ts +12 -0
  329. package/dist/transcript-file.js +23 -0
  330. package/dist/transcript-file.js.map +1 -0
  331. package/dist/ui-api.d.ts +3 -0
  332. package/dist/ui-api.js +7 -1
  333. package/dist/ui-api.js.map +1 -1
  334. package/dist/usability-capture.d.ts +43 -0
  335. package/dist/usability-capture.js +326 -0
  336. package/dist/usability-capture.js.map +1 -0
  337. package/dist/usage-config.d.ts +36 -0
  338. package/dist/usage-config.js +114 -0
  339. package/dist/usage-config.js.map +1 -0
  340. package/dist/ux-api.d.ts +3 -75
  341. package/dist/ux-api.js +3 -220
  342. package/dist/ux-api.js.map +1 -1
  343. package/dist/ux-cli.d.ts +4 -0
  344. package/dist/ux-cli.js +102 -0
  345. package/dist/ux-cli.js.map +1 -0
  346. package/dist/ux-config.d.ts +29 -0
  347. package/dist/ux-config.js +103 -0
  348. package/dist/ux-config.js.map +1 -0
  349. package/dist/ux-evidence.d.ts +54 -0
  350. package/dist/ux-evidence.js +197 -0
  351. package/dist/ux-evidence.js.map +1 -0
  352. package/dist/ux-review.d.ts +112 -0
  353. package/dist/ux-review.js +151 -0
  354. package/dist/ux-review.js.map +1 -0
  355. package/dist/ux-usability.d.ts +238 -0
  356. package/dist/ux-usability.js +494 -0
  357. package/dist/ux-usability.js.map +1 -0
  358. package/dist/verify-fix-api.d.ts +173 -0
  359. package/dist/verify-fix-api.js +454 -0
  360. package/dist/verify-fix-api.js.map +1 -0
  361. package/dist/verify-fix-cli.d.ts +4 -0
  362. package/dist/verify-fix-cli.js +110 -0
  363. package/dist/verify-fix-cli.js.map +1 -0
  364. package/package.json +19 -14
  365. package/skills/jevitate-ci-check/SKILL.md +77 -0
  366. package/skills/jevitate-demo/SKILL.md +61 -0
  367. package/skills/jevitate-explore/SKILL.md +88 -87
  368. package/skills/jevitate-getting-started/SKILL.md +88 -0
  369. package/skills/jevitate-load-test/SKILL.md +11 -2
  370. package/skills/jevitate-mission-scope/SKILL.md +19 -11
  371. package/skills/jevitate-record/SKILL.md +23 -5
  372. package/skills/jevitate-run-journey/SKILL.md +61 -17
  373. package/skills/jevitate-sources/SKILL.md +57 -14
  374. package/skills/jevitate-ux-review/SKILL.md +106 -16
  375. package/skills/jevitate-verify-fix/SKILL.md +76 -0
@@ -0,0 +1,81 @@
1
+ import { walk } from "./cli-surface.js";
2
+ /** Escapes a value for a markdown table cell. */
3
+ function cell(text) {
4
+ return text.replace(/\|/g, "\\|").replace(/\s*\n\s*/g, " ").trim();
5
+ }
6
+ function code(text) {
7
+ return `\`${text.replace(/`/g, "'")}\``;
8
+ }
9
+ function anchor(path) {
10
+ return path.replace(/[^a-z0-9]+/gi, "-").toLowerCase().replace(/^-|-$/g, "");
11
+ }
12
+ function defaultCell(json) {
13
+ if (json === "null")
14
+ return "";
15
+ try {
16
+ const v = JSON.parse(json);
17
+ return code(typeof v === "string" ? v : JSON.stringify(v));
18
+ }
19
+ catch {
20
+ return code(json);
21
+ }
22
+ }
23
+ function usageLine(s, hasChildren) {
24
+ const args = s.arguments.map((a) => {
25
+ const n = a.variadic ? `${a.name}...` : a.name;
26
+ return a.required ? `<${n}>` : `[${n}]`;
27
+ });
28
+ const parts = [`jevitate ${s.path}`, ...(s.options.length > 0 ? ["[options]"] : []), ...(hasChildren ? ["[command]"] : []), ...args];
29
+ return parts.join(" ");
30
+ }
31
+ function renderArguments(args) {
32
+ if (args.length === 0)
33
+ return [];
34
+ const out = ["**Arguments**", "", "| Argument | Description | Required | Default | Choices |", "| --- | --- | --- | --- | --- |"];
35
+ for (const a of args) {
36
+ out.push(`| ${code(a.variadic ? `${a.name}...` : a.name)} | ${cell(a.description)} | ${a.required ? "yes" : "no"} | ${defaultCell(a.defaultValue)} | ${a.choices ? a.choices.map(code).join(", ") : ""} |`);
37
+ }
38
+ return [...out, ""];
39
+ }
40
+ function renderOptions(opts) {
41
+ if (opts.length === 0)
42
+ return [];
43
+ const out = ["**Options**", "", "| Flags | Description | Default | Choices | Required | Env |", "| --- | --- | --- | --- | --- | --- |"];
44
+ for (const o of opts) {
45
+ out.push(`| ${code(o.flags)} | ${cell(o.description)} | ${defaultCell(o.defaultValue)} | ${o.choices ? o.choices.map(code).join(", ") : ""} | ${o.mandatory ? "yes" : ""} | ${o.envVar ? code(o.envVar) : ""} |`);
46
+ }
47
+ return [...out, ""];
48
+ }
49
+ /** Renders the full CLI reference markdown from a live commander tree. Deterministic: no versions, dates or absolute paths. */
50
+ export function renderCliReference(program) {
51
+ const surfaces = walk(program, "");
52
+ const root = surfaces[0];
53
+ const commands = surfaces.slice(1);
54
+ const hasChildren = (path) => commands.some((c) => c.path.startsWith(`${path} `));
55
+ const top = commands.filter((c) => !c.path.includes(" "));
56
+ const lines = [
57
+ "# CLI reference",
58
+ "",
59
+ "> Generated from the CLI — do not edit by hand; run `pnpm docs:cli`.",
60
+ "",
61
+ root.description,
62
+ "",
63
+ ...renderOptions(root.options),
64
+ "## Commands",
65
+ "",
66
+ ...top.map((c) => `- [${code(c.path)}](#${anchor(c.path)}): ${c.description.split("\n")[0]}`),
67
+ "",
68
+ ];
69
+ for (const c of commands) {
70
+ const depth = Math.min(c.path.split(" ").length + 1, 6);
71
+ lines.push(`${"#".repeat(depth)} ${c.path}`, "");
72
+ lines.push("```", usageLine(c, hasChildren(c.path)), "```", "");
73
+ if (c.description !== "")
74
+ lines.push(c.description, "");
75
+ if (c.aliases.length > 0)
76
+ lines.push(`Aliases: ${c.aliases.map(code).join(", ")}`, "");
77
+ lines.push(...renderArguments(c.arguments), ...renderOptions(c.options));
78
+ }
79
+ return `${lines.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd()}\n`;
80
+ }
81
+ //# sourceMappingURL=cli-reference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-reference.js","sourceRoot":"","sources":["../src/cli-reference.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAiE,MAAM,kBAAkB,CAAC;AAEvG,iDAAiD;AACjD,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACrE,CAAC;AAED,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;AAC1C,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC/B,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IAC/B,IAAI,CAAC;QACH,MAAM,CAAC,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IA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AAC,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACjD,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,CAAC,WAAW,KAAK,EAAE;YAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACvF,KAAK,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;AACtE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Command } from "commander";
2
+ import type { JsonEnvelope } from "./envelope.js";
3
+ /** Records, on every dispatch, the leaf command commander is about to run (a `preAction` hook on the root). */
4
+ export declare function trackActionCommand(program: Command): void;
5
+ /** `ledger add`, `mission target update`, … — the command's path under the root program. */
6
+ export declare function commandPath(cmd: Command): string;
7
+ /**
8
+ * Prints an envelope a command produced: a success as the envelope line (as it always was); a
9
+ * refusal as the envelope with `--json`, else `error <CODE>: …` on stderr. Sets `process.exitCode`
10
+ * (`exitCode` when the caller has a verdict code, else the envelope's class).
11
+ */
12
+ export declare function emitJsonOrRefusal(program: Command, envelope: JsonEnvelope<unknown>, exitCode?: number): void;
@@ -0,0 +1,52 @@
1
+ import { emitEnvelope } from "./cli-output.js";
2
+ import { exitCodeForEnvelope } from "./exit-codes.js";
3
+ /**
4
+ * THE refusal path for every command (#218). A command that refuses (`fail(code, message)`) prints
5
+ * the `{v, ok:false, error}` envelope on stdout only when it was asked for JSON (`--json`); without
6
+ * it, one human `error <CODE>: <message>` line (+ a `--help` hint for a usage error) on stderr, and
7
+ * nothing on stdout. The exit code comes from exit-codes.ts either way (64 usage · 2 otherwise).
8
+ *
9
+ * The emitters that print envelopes (`emitJson` in program.ts, report/invariants/ai commands) all
10
+ * route here, so which command is running — and whether IT was given `--json` — is looked up from
11
+ * the command commander dispatched to (recorded by `trackActionCommand`), not threaded by hand.
12
+ * A successful envelope is printed exactly as before: this module changes refusals only.
13
+ */
14
+ const actionCommands = new WeakMap();
15
+ /** Records, on every dispatch, the leaf command commander is about to run (a `preAction` hook on the root). */
16
+ export function trackActionCommand(program) {
17
+ program.hook("preAction", (root, action) => {
18
+ actionCommands.set(root, action);
19
+ });
20
+ }
21
+ /** `ledger add`, `mission target update`, … — the command's path under the root program. */
22
+ export function commandPath(cmd) {
23
+ const names = [];
24
+ for (let c = cmd; c !== null && c.parent !== null; c = c.parent)
25
+ names.unshift(c.name());
26
+ return names.join(" ");
27
+ }
28
+ /** Whether the running command asked for the JSON envelope. A command without a `--json` flag never did. */
29
+ function wantsJson(program) {
30
+ const action = actionCommands.get(program);
31
+ if (action === undefined)
32
+ return { json: true }; // not dispatched through the program (a direct call): unchanged
33
+ const hasJsonFlag = action.options.some((o) => o.long === "--json");
34
+ return { json: hasJsonFlag && action.opts().json === true, command: commandPath(action) };
35
+ }
36
+ /**
37
+ * Prints an envelope a command produced: a success as the envelope line (as it always was); a
38
+ * refusal as the envelope with `--json`, else `error <CODE>: …` on stderr. Sets `process.exitCode`
39
+ * (`exitCode` when the caller has a verdict code, else the envelope's class).
40
+ */
41
+ export function emitJsonOrRefusal(program, envelope, exitCode) {
42
+ if (!envelope.ok) {
43
+ const { json, command } = wantsJson(program);
44
+ if (!json) {
45
+ emitEnvelope(program, envelope, { json: false, ...(command === undefined ? {} : { command }), ...(exitCode === undefined ? {} : { exitCode }) });
46
+ return;
47
+ }
48
+ }
49
+ program.configureOutput().writeOut?.(`${JSON.stringify(envelope)}\n`);
50
+ process.exitCode = exitCode ?? exitCodeForEnvelope(envelope);
51
+ }
52
+ //# sourceMappingURL=cli-refusal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-refusal.js","sourceRoot":"","sources":["../src/cli-refusal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;;;GAUG;AAEH,MAAM,cAAc,GAAG,IAAI,OAAO,EAAoB,CAAC;AAEvD,+GAA+G;AAC/G,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;QACzC,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,IAAI,CAAC,GAAmB,GAAG,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM;QAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACzG,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,4GAA4G;AAC5G,SAAS,SAAS,CAAC,OAAgB;IACjC,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3C,IAAI,MAA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ep } from "@jevitate/domain";
4
+ import { SqliteSitePolicyRepository } from "@jevitate/storage-sqlite";
5
+ import { UsageTracker, type JudgmentPort, type GenerationPort, type CatalogModel, type ModelConstraints, type UsageSink } from "@jevitate/ai-core";
6
+ import { type Actor } from "@jevitate/screenplay";
7
+ import { type JsonEnvelope } from "./envelope.js";
8
+ import { type QueuedMissionExecutor } from "./mission-queue-runner.js";
9
+ import { type StartUiServerDeps, type UiServerHandle } from "./ui-api.js";
10
+ import { type AiCliDeps } from "./ai-cli.js";
11
+ import { type EmitOptions } from "./cli-output.js";
12
+ import { type DetectionDeps } from "./init-skills.js";
13
+ import { type ExploreCliDeps } from "./explore-api.js";
14
+ import { type RecorderLike } from "./record-api.js";
15
+ import { type SourceApiDeps } from "./source-api.js";
16
+ import { type RunResolvedJourney } from "./source-run-api.js";
17
+ import { type GitExec, type GhPort } from "@jevitate/sources";
18
+ import type { BrowserLaunchOptions, BrowserPort, BrowserSession } from "@jevitate/playwright";
19
+ import { type EmulationSpec } from "@jevitate/playwright";
20
+ import { type BrowserRunOptions } from "./browser-run-options.js";
21
+ /** Injectable wiring for the `record` command (all optional; real defaults). */
22
+ export interface RecordCliDeps {
23
+ /** Testing seam — defaults to a real `PlaywrightBrowserPort`. */
24
+ browserPortFactory?: () => BrowserPort;
25
+ /** Testing seam — defaults to a real `@jevitate/recorder` `Recorder`. */
26
+ recorderFactory?: (session: BrowserSession, site: string) => RecorderLike;
27
+ /** Testing seam — the "user signalled done" wait. Defaults to Enter on stdin. */
28
+ waitForStop?: () => Promise<void>;
29
+ }
30
+ export interface CliDeps {
31
+ profiles: ProfileManager;
32
+ dbPath?: string;
33
+ /**
34
+ * Prune `.jevitate/logs` by the retention policy before each command that writes run output (the
35
+ * real binary sets it; left unset, e.g. in tests, nothing is pruned implicitly). `logsRoot`
36
+ * overrides where (default: the project's logs, else `~/.jevitate/logs`).
37
+ */
38
+ logs?: {
39
+ readonly autoPrune: boolean;
40
+ readonly logsRoot?: string;
41
+ readonly configPath?: string;
42
+ };
43
+ journeysDir?: string;
44
+ /**
45
+ * Optional, additive (#247): the environments file `--env` reads (default: the repo's
46
+ * `.jevitate/environments.json`, found from the working directory).
47
+ */
48
+ environmentsFile?: string;
49
+ /** Optional, additive: overrides the mission-targets store directory
50
+ * (default: ~/.jevitate/missions/targets). Same dir `queue_exploration`
51
+ * resolves promoted targets from. */
52
+ missionTargetsDir?: string;
53
+ /** Optional, additive: overrides the inbox store directory (default:
54
+ * ~/.jevitate/inbox). Same dir BOTH `jevitate mcp`'s inbox tools AND
55
+ * `jevitate ui` resolve against by default — Task 8 threads one resolved
56
+ * dir into both so they serve/consume the same store. */
57
+ inboxDir?: string;
58
+ /** Optional, additive: `jevitate ui` wiring (see ui-api.ts). Omitted in
59
+ * production means the real `startUiServer`, which binds a real loopback
60
+ * HTTP port — tests inject a fake so no port is ever bound. */
61
+ ui?: {
62
+ startUiServer?: (deps: StartUiServerDeps) => Promise<UiServerHandle>;
63
+ };
64
+ /** Optional, additive: `@jevitate/ai-core` wiring (see ai-cli.ts). Omitted in
65
+ * production means real env + the deterministic fake generation gateway. */
66
+ ai?: AiCliDeps;
67
+ /** Optional, additive: `@jevitate/explore` wiring (see explore-api.ts). */
68
+ explore?: ExploreCliDeps;
69
+ /** Optional, additive: `mission run` wiring — tests inject the executor so no browser opens. */
70
+ missions?: {
71
+ execute?: QueuedMissionExecutor;
72
+ /** Optional, additive (#255): the mission queue directory (default ~/.jevitate/missions/queue) — `mission run/queue/result` and `jevitate mcp`. */
73
+ queueDir?: string;
74
+ };
75
+ /** Optional, additive: `jevitate record` wiring (see record-api.ts). */
76
+ record?: RecordCliDeps;
77
+ /** Optional, additive: `jevitate init` wiring (see init-skills.ts). Omitted
78
+ * in production means the real `existsSync`/`homedir`/`cwd` and the real
79
+ * `~/.jevitate/skills-install-state.json` state path.
80
+ * `isInteractive` (#230): whether key collection may prompt stdin;
81
+ * omitted in production means the real `process.stdin.isTTY` check. */
82
+ init?: {
83
+ detection?: DetectionDeps;
84
+ statePath?: string;
85
+ isInteractive?: () => boolean;
86
+ };
87
+ /**
88
+ * Optional, additive: distributed-Journey-sources wiring (see source-api.ts).
89
+ * Every field is injectable so tests never touch the network, the real home
90
+ * dir, or the real `git`/`gh` binaries. Omitted in production means the real
91
+ * `~/.jevitate/sources` clone dir, `<cwd>/jevitate.lock`, `~/.jevitate/trust`
92
+ * stores, and the real `git`/`gh` ports.
93
+ */
94
+ sources?: {
95
+ sourcesDir?: string;
96
+ lockPath?: string;
97
+ trustDir?: string;
98
+ ackDir?: string;
99
+ git?: GitExec;
100
+ gh?: GhPort;
101
+ now?: () => string;
102
+ /** Identity recorded in a `TrustRecord`/`TouAck`; defaults to the OS user. */
103
+ approvedBy?: string;
104
+ /** Optional, additive: `jevitate source run` runner seam (see
105
+ * source-run-api.ts). Omitted in production means the real
106
+ * Playwright-backed `realResolvedJourneyRunner`; tests inject a fake so no
107
+ * browser launches. */
108
+ runJourney?: RunResolvedJourney;
109
+ };
110
+ }
111
+ export declare const DEFAULT_DB_PATH: string;
112
+ export declare const DEFAULT_MISSION_TARGETS_DIR: string;
113
+ export declare const DEFAULT_INBOX_DIR: string;
114
+ export declare function resolveDbPath(deps: CliDeps, flag?: string): string;
115
+ /** #247: where `--env` reads environments and per-origin sessions from (test seams; real defaults). */
116
+ export declare function environmentSeams(deps: CliDeps): {
117
+ environmentsFile?: string;
118
+ targetsFile?: string;
119
+ };
120
+ /**
121
+ * Mirrors `resolveDbPath`'s flag > deps > home-dir-default convention: a
122
+ * per-invocation `--dir` flag wins, then a `CliDeps.journeysDir` wired in by
123
+ * the host, then `~/.jevitate/journeys`.
124
+ */
125
+ export declare function resolveJourneysDir(deps: CliDeps, flag?: string): string;
126
+ /** Same flag > home-dir-default convention as `resolveJourneysDir`, for the
127
+ * committed-regressions directory `regression capture` writes into. */
128
+ export declare function resolveRegressionsDir(flag?: string): string;
129
+ /** Same flag > deps > home-dir-default convention as `resolveJourneysDir`, for
130
+ * the mission-targets store `mission target ...` reads/writes. */
131
+ export declare function resolveMissionTargetsDir(deps: CliDeps, flag?: string): string;
132
+ /** Same flag > deps > home-dir-default convention as `resolveJourneysDir`, for
133
+ * the inbox store `jevitate mcp`'s inbox tools AND `jevitate ui` both read
134
+ * from — the SAME resolved directory, so the two commands agree on where
135
+ * approvals/handbacks/reviews live. */
136
+ export declare function resolveInboxDir(deps: CliDeps, flag?: string): string;
137
+ /**
138
+ * Assembles the injected `SourceApiDeps` for the distributed-sources commands
139
+ * from `CliDeps.sources` (test-injected ports) or the real production
140
+ * defaults: `~/.jevitate/sources` clones, `<cwd>/jevitate.lock`, and the
141
+ * local, per-user `FsTrustStore`/`FsAckStore` under `~/.jevitate/trust`.
142
+ * Trust/ack stores are LOCAL by design (§14.1) — never the team-shared lock.
143
+ */
144
+ export declare function resolveSourceApiDeps(deps: CliDeps): SourceApiDeps;
145
+ /** The identity recorded in a `TrustRecord`/`TouAck` — an injected value, else
146
+ * the OS username, else `"local"`. Never a secret/credential. */
147
+ export declare function resolveApprovedBy(deps: CliDeps): string;
148
+ /**
149
+ * Builds a fresh, real Playwright-backed `Actor` (its own temp profile dir +
150
+ * browser context, per `journey-api.ts`'s `runJourneyProgrammatically`
151
+ * pattern) and returns it alongside a `close()` to tear the session down.
152
+ * `@jevitate/regression`'s `makeActor: () => Promise<Actor>` contract calls
153
+ * this once per reproduce/minimize attempt — a Playwright session cannot be
154
+ * reused after a run — so callers must close each one it hands back.
155
+ */
156
+ export declare function makeRealBrowserActor(site: string, storageState?: string, emulation?: EmulationSpec, browser?: BrowserRunOptions, portFactory?: () => BrowserPort,
157
+ /** #247: an environment's allowed origins (default: just `site`). */
158
+ allowedOrigins?: readonly string[]): Promise<{
159
+ actor: Actor;
160
+ close: () => Promise<void>;
161
+ }>;
162
+ /** Raw commander values of the shared `--browser-*` launch flags. */
163
+ export interface BrowserLaunchFlags {
164
+ browserExecutable?: string;
165
+ browserChannel?: string;
166
+ browserArg: string[];
167
+ }
168
+ /**
169
+ * Adds the shared Chromium launch flags to a browser-driving command. They map
170
+ * 1:1 onto `@jevitate/playwright`'s `BrowserLaunchOptions`; `--browser-arg`
171
+ * EXTENDS the Linux defaults (`--no-sandbox`, `--disable-dev-shm-usage`).
172
+ */
173
+ export declare function withBrowserLaunchFlags(cmd: Command): Command;
174
+ /** The `BrowserLaunchOptions` for the parsed flags, or `undefined` when none were given. */
175
+ export declare function browserLaunchFromFlags(o: BrowserLaunchFlags): BrowserLaunchOptions | undefined;
176
+ /** Raw commander values of the demo-mode flags (#245). `overlay` is `--no-overlay`'s attribute. */
177
+ export interface DemoFlags {
178
+ headed?: boolean;
179
+ slowMo?: number;
180
+ recordVideo?: boolean | string;
181
+ overlay?: boolean;
182
+ }
183
+ /** Which demo-mode flags a command takes: every one shows (`--headed`/`--slow-mo`); some record and overlay. */
184
+ export interface DemoFlagSet {
185
+ /** `--record-video [dir]` — the command lists the videos in its result. */
186
+ readonly recordVideo?: boolean;
187
+ /** `--no-overlay` — the command runs an explore mission (the overlay lives in `@jevitate/explore`). */
188
+ readonly overlay?: boolean;
189
+ }
190
+ /**
191
+ * Adds the demo-mode flags (#245) to a browser-driving command. Headless stays the default; these
192
+ * are all opt-in and resolved by `browserRunFromFlags` (which also reads `JEVITATE_HEADED`).
193
+ */
194
+ export declare function withDemoFlags(cmd: Command, set?: DemoFlagSet): Command;
195
+ /** Raw commander value of `--screenshots [mode|dir]` (#251). */
196
+ export interface ScreenshotsFlags {
197
+ screenshots?: boolean | string;
198
+ }
199
+ /**
200
+ * #251: `--screenshots [mode|dir]` — masked screenshots of the run (one per distinct screen, or
201
+ * `steps`: one per step) plus an `index.md` contact sheet; parsed by `parseScreenshotsArg`.
202
+ */
203
+ export declare function withScreenshotsFlag(cmd: Command): Command;
204
+ /**
205
+ * The runner's `browser` option for the parsed `--browser-*` and demo flags, or `undefined` when none
206
+ * were given. `--headed` (or `JEVITATE_HEADED=1`) without a display throws `HeadedWithoutDisplayError`
207
+ * HERE — before any browser launches — which every command reports as its usage error (exit 64).
208
+ */
209
+ export declare function browserRunFromFlags(o: BrowserLaunchFlags & DemoFlags, env?: Readonly<Record<string, string | undefined>>, platform?: NodeJS.Platform): BrowserRunOptions | undefined;
210
+ /** `{ browser }` for the parsed `--browser-*` flags, or `{}` when none were given — spread into a runner's options. */
211
+ export declare function browserOption(o: BrowserLaunchFlags): {
212
+ browser?: BrowserLaunchOptions;
213
+ };
214
+ /** Raw commander values of the shared `--viewport`/`--device` emulation flags (#149). */
215
+ export interface EmulationFlags {
216
+ viewport?: string;
217
+ device?: string;
218
+ }
219
+ /**
220
+ * Adds the shared `--viewport <W>x<H>` / `--device "<name>"` flags (#149) to a browser-driving
221
+ * command — mutually exclusive, on `explore`, `journey run`, `load run`, `source run`, `verify-fix`
222
+ * and `regression capture`/`run`. Absent both: Playwright's default (desktop) viewport, documented
223
+ * in each command's `--help`.
224
+ */
225
+ export declare function withEmulationFlags(cmd: Command): Command;
226
+ /**
227
+ * The `EmulationSpec` for the parsed flags, or `undefined` when neither was given (Playwright's own
228
+ * default viewport applies). Refused HERE, before any browser opens, when both are given —
229
+ * `resolveEmulation` (an unknown `--device`, or both together) is also re-checked wherever the spec
230
+ * is finally used, so every call path fails closed the same way.
231
+ */
232
+ export declare function emulationFromFlags(o: EmulationFlags): EmulationSpec | undefined;
233
+ /**
234
+ * Parses repeated `--param key=value` flags into a `Record<string,string>`.
235
+ * `previous` starts as the option's default (`{}`) and this is called once
236
+ * per occurrence, commander's standard "collect" pattern.
237
+ */
238
+ export declare function collectParam(value: string, previous: Record<string, string>): Record<string, string>;
239
+ export declare function makeClock(): {
240
+ nowIso: () => string;
241
+ monotonicMs: () => number;
242
+ };
243
+ export declare function withSitePolicyRepository<T>(dbPath: string, fn: (repository: SqliteSitePolicyRepository) => Promise<T>): Promise<T>;
244
+ export declare function isPlannedStep(value: unknown): value is PlannedStep;
245
+ export declare function parsePlannedScript(raw: string): PlannedStep[];
246
+ /**
247
+ * Writes a JSON envelope using the program's CURRENTLY-CONFIGURED output
248
+ * writer (read at call time via `configureOutput()`), so tests that call
249
+ * `program.configureOutput({ writeOut })` after `buildProgram()` still see
250
+ * output routed to their writer. Also sets `process.exitCode` (0 for `ok`; for
251
+ * `fail`, the error's class from exit-codes.ts — 64 usage, else 2) instead of
252
+ * hard-exiting, so `exitOverride()` in tests works.
253
+ */
254
+ export declare function emitJson(program: Command, envelope: JsonEnvelope<unknown>): void;
255
+ /**
256
+ * #210: the envelope with `--json`, else a human summary (a refusal: `error <CODE>: …` on stderr);
257
+ * the cost line on stderr either way. Exit code: the verdict's, else the envelope's class (exit-codes.ts).
258
+ */
259
+ export declare function emitCommandResult<T>(program: Command, envelope: JsonEnvelope<T>, opts: EmitOptions<T>): void;
260
+ /**
261
+ * #221: a user-supplied name that becomes a path (a profile name, a regression id) must be one safe
262
+ * segment (`assertSafeName`, @jevitate/domain). Refuses it (E_INVALID_NAME, exit 64) and returns true.
263
+ */
264
+ export declare function refuseUnsafeName(program: Command, name: string, what: string): boolean;
265
+ /** A non-`--json` result: printed as bare JSON on stdout, with the cost summary line on stderr. */
266
+ export declare function writeRawResult(program: Command, result: unknown): void;
267
+ /** A non-`--json` result (#227): the human summary a `cli-output.ts` formatter renders, with the cost summary line on stderr. */
268
+ export declare function writeHumanResult(program: Command, result: unknown, human: (data: unknown) => string): void;
269
+ /**
270
+ * The human cost summary (#163) — on STDERR, so stdout stays exactly the JSON a caller parses:
271
+ * `usage: cost $0.0312 (jev $0.0203 + generation $0.0109) · 398 judgments, …`, flagged
272
+ * `(partial: …)` when some call could not be priced. Nothing when the result carries no usage.
273
+ */
274
+ export declare function emitUsageLine(program: Command, data: unknown): void;
275
+ /**
276
+ * `explore --help` trailer documenting every `outcome`/`stop`/`missionOutcome` value and its
277
+ * exit code (issue #83 item 2) — mirrors the README "Mission outcomes and exit codes" /
278
+ * "Every outcome, stop and missionOutcome value" sections, derived from the same sources:
279
+ * `MISSION_EXIT_CODES` (@jevitate/domain) and `goalExitCode`/`missionExitCode` (./mission-exit.ts).
280
+ */
281
+ /** `--stall-timeout <seconds>` (#114) → milliseconds; `undefined` when omitted, `null` when not a positive number. */
282
+ export declare function stallTimeoutMs(raw: string | number | undefined): number | undefined | null;
283
+ /** #230: the only `--strategy` values `explore` accepts; anything else is refused, never silently run as goal. */
284
+ export declare const EXPLORE_STRATEGIES: readonly ["goal", "coverage", "exploratory", "adversarial", "usability"];
285
+ export declare const EXPLORE_OUTCOME_HELP = "\nOutcomes, stop reasons and exit codes:\n Every result carries a canonical missionOutcome (and exitCode), whatever the strategy:\n clean 0 \u00B7 defects-found 1 \u00B7 inconclusive 2 \u00B7 crashed 2 \u00B7 hang 3 \u00B7 intermittent 4\n --strategy goal also carries its own ending as \"goalOutcome\" (= its \"outcome\"), folded onto missionOutcome:\n succeeded \u2192 clean 0 \u00B7 failed / exhausted / blocked \u2192 defects-found 1\n (defects-found, inconclusive, crashed, hang, intermittent are themselves)\n --strategy goal's \"stop\" (why the loop itself stopped; not separately exit-coded):\n done | blocked | exhausted | no-progress | hang | inconclusive | crashed | budget\n (a \"done\" code rejected ends stop done, goalOutcome failed \u2014 never blocked)\n --strategy adversarial's \"stop\" (why the hunt ended; its \"outcome\" is the canonical one above):\n step-budget | action-budget | time-budget | strategies-exhausted | not-rendered\n | scope-unreachable | targets-refused | target-unresponsive | hang | crashed\n --strategy coverage/exploratory's own \"outcome\" (folds into missionOutcome above):\n exhausted | insufficient-coverage | cap | scope-unreachable | stalled | crashed | hang\n A run that proved nothing is inconclusive with failure.kind insufficient-coverage (the same word as\n the frontier outcome), and failure.message says how to reach clean.\n A starved host (#203): every result carries \"hostHealth\" (peak load/core, min free memory, peak\n event-loop lag, slowest render). A hang, click timeout or no-progress met while the host was\n starved is listed in \"environmentDegraded\" (advisory, never a finding); a run most of whose steps\n ran starved is inconclusive (failure.kind degraded-environment), never clean.\n --feature's own \"outcome\" (folds into missionOutcome above):\n exhausted | insufficient-coverage | cap | path-cap | scope-unreachable | stalled | crashed | hang\n Argument/input errors (E_EXPLORE_ARGS, E_EXPLORE_ASSERTION, \u2026) exit 64, never 1.\n Without --json: a human summary (verdict, defects by fingerprint, result file, next step);\n with --json: the {v, ok, data} envelope.\n Every command's exit codes: docs/outcomes.md \"Exit codes\".\n";
286
+ /** Distinct from MissingCredentialError: "no --real/--fake-ai selected" vs "keys missing." */
287
+ export declare class GatewaySelectionError extends Error {
288
+ }
289
+ export declare const DEFAULT_EXPLORE_CATALOG: CatalogModel[];
290
+ export declare const DEFAULT_EXPLORE_CONSTRAINTS: ModelConstraints;
291
+ /**
292
+ * Selects the exploration gateways. Injected gateways (tests) win; otherwise
293
+ * `--real` builds the live Jev + OpenRouter adapters behind a fail-closed
294
+ * credential preflight, and `--fake-ai` uses deterministic fakes (a pipeline
295
+ * smoke — the fake judge always proposes `done`, so it will not drive to a
296
+ * goal). No selection is a fail-closed refusal, never a silent fake.
297
+ */
298
+ export declare function buildExploreGateways(deps: CliDeps, opts: {
299
+ real: boolean;
300
+ fakeAi: boolean;
301
+ }): Promise<{
302
+ judge: JudgmentPort;
303
+ gen: GenerationPort;
304
+ usage: UsageTracker;
305
+ }>;
306
+ /**
307
+ * #246: the generation gateway ALONE (`journey annotate` drafts text and asks no judgment
308
+ * question, so it needs no Jev key). Same selection rules as `buildExploreGateways`: injected (tests)
309
+ * wins, `--real` is fail-closed on the OpenRouter key, `--fake-ai` is the deterministic fake, the two
310
+ * are exclusive, and no selection is a refusal — never a silent fake.
311
+ */
312
+ export declare function buildGenerationGateway(deps: CliDeps, opts: {
313
+ real: boolean;
314
+ fakeAi: boolean;
315
+ }): Promise<{
316
+ gen: GenerationPort;
317
+ usage: UsageTracker;
318
+ }>;
319
+ /**
320
+ * A judge that always proposes `done` — used only by `--fake-ai` (smoke). It is TOTAL and
321
+ * deterministic: it answers EVERY question it is asked, whatever the mission or rubric names it
322
+ * (#213) — a choice offering `done` picks `done` (so the goal/coverage loop stops at once, and
323
+ * will not drive to a goal); a choice that does NOT offer `done` (e.g. the UX quality grader's
324
+ * label set, `grade::0`) deterministically picks its first listed option instead of throwing; a
325
+ * noul answers "no"; a score answers 0. It never throws on a question SHAPE it does not
326
+ * specifically know about — only on a malformed one (a choice with no options at all), which is a
327
+ * bug upstream, not an unknown question. `usage` (#100) is optional: when supplied, every call
328
+ * reports 1 judgment at 0 tokens.
329
+ */
330
+ export declare function fakeDoneJudge(usage?: UsageSink): JudgmentPort;