@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,492 @@
1
+ /**
2
+ * Helpers shared by the per-command-group CLI modules (`*-cli.ts`) that `program.ts` wires together
3
+ * (#231): deps and path resolution, JSON/human output, browser/emulation flags, AI gateway selection.
4
+ */
5
+ import { mkdir } from "node:fs/promises";
6
+ import { dirname, resolve as resolvePath } from "node:path";
7
+ import { userInfo } from "node:os";
8
+ import { openDatabase, migrateToLatest, SqliteSitePolicyRepository } from "@jevitate/storage-sqlite";
9
+ import { envCredentialStore, requireKeys, FakeGenerationGateway, OpenRouterGenerationGateway, RetryingGenerationPort, RetryingJudgmentPort, JevJudgmentGateway, realJevClientCall, UsageTracker, FAKE_CALL_USAGE, formatUsageLine, usageCountsFrom, } from "@jevitate/ai-core";
10
+ import { loadLocalCredentials } from "./credentials-file.js";
11
+ import { PlaywrightBrowserPort } from "@jevitate/playwright";
12
+ import { CastActor, BrowseTheWeb } from "@jevitate/screenplay";
13
+ import { UnsafeNameError, assertSafeName } from "@jevitate/domain";
14
+ import { fail } from "./envelope.js";
15
+ import { projectDataDir } from "./project-dir.js";
16
+ import { resolveUsagePricing } from "./usage-config.js";
17
+ import { realOpenRouterCall } from "./openrouter-call.js";
18
+ import { emitJsonOrRefusal } from "./cli-refusal.js";
19
+ import { emitEnvelope } from "./cli-output.js";
20
+ import { resolveDataDir } from "./data-dir.js";
21
+ import { FsTrustStore, FsAckStore, DEFAULT_LOCK_PATH } from "@jevitate/sources";
22
+ import { parseViewport, resolveEmulation } from "@jevitate/playwright";
23
+ import { nonNegativeIntArg } from "./cli-args.js";
24
+ import { HEADED_DEFAULT_SLOW_MO_MS, assertHeadedDisplay, headedFromEnv, sessionLaunchOptions } from "./browser-run-options.js";
25
+ // `~/.jevitate/*` is the product's runtime-data convention (product = Jevitate).
26
+ // See data-dir.ts.
27
+ export const DEFAULT_DB_PATH = resolveDataDir(["db.sqlite"]);
28
+ export const DEFAULT_MISSION_TARGETS_DIR = resolveDataDir(["missions", "targets"]);
29
+ export const DEFAULT_INBOX_DIR = resolveDataDir(["inbox"]);
30
+ export function resolveDbPath(deps, flag) {
31
+ return flag ?? deps.dbPath ?? DEFAULT_DB_PATH;
32
+ }
33
+ /** #247: where `--env` reads environments and per-origin sessions from (test seams; real defaults). */
34
+ export function environmentSeams(deps) {
35
+ return {
36
+ ...(deps.environmentsFile === undefined ? {} : { environmentsFile: deps.environmentsFile }),
37
+ ...(deps.explore?.targetsConfigPath === undefined ? {} : { targetsFile: deps.explore.targetsConfigPath }),
38
+ };
39
+ }
40
+ /**
41
+ * Mirrors `resolveDbPath`'s flag > deps > home-dir-default convention: a
42
+ * per-invocation `--dir` flag wins, then a `CliDeps.journeysDir` wired in by
43
+ * the host, then `~/.jevitate/journeys`.
44
+ */
45
+ export function resolveJourneysDir(deps, flag) {
46
+ return flag ?? deps.journeysDir ?? projectDataDir(["journeys"]);
47
+ }
48
+ /** Same flag > home-dir-default convention as `resolveJourneysDir`, for the
49
+ * committed-regressions directory `regression capture` writes into. */
50
+ export function resolveRegressionsDir(flag) {
51
+ return flag ?? projectDataDir(["regressions"]);
52
+ }
53
+ /** Same flag > deps > home-dir-default convention as `resolveJourneysDir`, for
54
+ * the mission-targets store `mission target ...` reads/writes. */
55
+ export function resolveMissionTargetsDir(deps, flag) {
56
+ return flag ?? deps.missionTargetsDir ?? DEFAULT_MISSION_TARGETS_DIR;
57
+ }
58
+ /** Same flag > deps > home-dir-default convention as `resolveJourneysDir`, for
59
+ * the inbox store `jevitate mcp`'s inbox tools AND `jevitate ui` both read
60
+ * from — the SAME resolved directory, so the two commands agree on where
61
+ * approvals/handbacks/reviews live. */
62
+ export function resolveInboxDir(deps, flag) {
63
+ return flag ?? deps.inboxDir ?? DEFAULT_INBOX_DIR;
64
+ }
65
+ /**
66
+ * Assembles the injected `SourceApiDeps` for the distributed-sources commands
67
+ * from `CliDeps.sources` (test-injected ports) or the real production
68
+ * defaults: `~/.jevitate/sources` clones, `<cwd>/jevitate.lock`, and the
69
+ * local, per-user `FsTrustStore`/`FsAckStore` under `~/.jevitate/trust`.
70
+ * Trust/ack stores are LOCAL by design (§14.1) — never the team-shared lock.
71
+ */
72
+ export function resolveSourceApiDeps(deps) {
73
+ const s = deps.sources ?? {};
74
+ return {
75
+ sourcesDir: s.sourcesDir ?? resolveDataDir(["sources"]),
76
+ lockPath: s.lockPath ?? DEFAULT_LOCK_PATH(),
77
+ trust: new FsTrustStore(s.trustDir ?? resolveDataDir(["trust"])),
78
+ ack: new FsAckStore(s.ackDir ?? resolveDataDir(["trust", "acks"])),
79
+ git: s.git,
80
+ now: s.now,
81
+ };
82
+ }
83
+ /** The identity recorded in a `TrustRecord`/`TouAck` — an injected value, else
84
+ * the OS username, else `"local"`. Never a secret/credential. */
85
+ export function resolveApprovedBy(deps) {
86
+ if (deps.sources?.approvedBy)
87
+ return deps.sources.approvedBy;
88
+ try {
89
+ return userInfo().username || "local";
90
+ }
91
+ catch {
92
+ return "local";
93
+ }
94
+ }
95
+ /**
96
+ * Builds a fresh, real Playwright-backed `Actor` (its own temp profile dir +
97
+ * browser context, per `journey-api.ts`'s `runJourneyProgrammatically`
98
+ * pattern) and returns it alongside a `close()` to tear the session down.
99
+ * `@jevitate/regression`'s `makeActor: () => Promise<Actor>` contract calls
100
+ * this once per reproduce/minimize attempt — a Playwright session cannot be
101
+ * reused after a run — so callers must close each one it hands back.
102
+ */
103
+ export async function makeRealBrowserActor(site, storageState, emulation, browser, portFactory = () => new PlaywrightBrowserPort(),
104
+ /** #247: an environment's allowed origins (default: just `site`). */
105
+ allowedOrigins = [site]) {
106
+ const port = portFactory();
107
+ const session = await port.open({
108
+ ...sessionLaunchOptions(browser),
109
+ allowedOrigins: [...allowedOrigins],
110
+ baseUrl: site,
111
+ ...emulation,
112
+ ...(storageState !== undefined ? { storageState } : {}),
113
+ });
114
+ const actor = CastActor.named("regression-capture").whoCan(new BrowseTheWeb(session, [...allowedOrigins]));
115
+ return {
116
+ actor,
117
+ close: () => session.close(),
118
+ };
119
+ }
120
+ /**
121
+ * Adds the shared Chromium launch flags to a browser-driving command. They map
122
+ * 1:1 onto `@jevitate/playwright`'s `BrowserLaunchOptions`; `--browser-arg`
123
+ * EXTENDS the Linux defaults (`--no-sandbox`, `--disable-dev-shm-usage`).
124
+ */
125
+ export function withBrowserLaunchFlags(cmd) {
126
+ return cmd
127
+ .option("--browser-executable <path>", "launch this Chromium binary instead of Playwright's pinned one")
128
+ .option("--browser-channel <name>", "Playwright browser channel to launch, e.g. chrome | msedge")
129
+ .option("--browser-arg <arg>", "extra Chromium switch (repeatable); extends the Linux defaults --no-sandbox --disable-dev-shm-usage", (v, prev) => [...prev, v], []);
130
+ }
131
+ /** The `BrowserLaunchOptions` for the parsed flags, or `undefined` when none were given. */
132
+ export function browserLaunchFromFlags(o) {
133
+ const launch = {
134
+ ...(o.browserExecutable !== undefined ? { executablePath: o.browserExecutable } : {}),
135
+ ...(o.browserChannel !== undefined ? { channel: o.browserChannel } : {}),
136
+ ...(o.browserArg.length > 0 ? { args: [...o.browserArg] } : {}),
137
+ };
138
+ return Object.keys(launch).length > 0 ? launch : undefined;
139
+ }
140
+ /**
141
+ * Adds the demo-mode flags (#245) to a browser-driving command. Headless stays the default; these
142
+ * are all opt-in and resolved by `browserRunFromFlags` (which also reads `JEVITATE_HEADED`).
143
+ */
144
+ export function withDemoFlags(cmd, set = {}) {
145
+ cmd
146
+ .option("--headed", `show the browser window (demo mode); also JEVITATE_HEADED=1. Default: headless. Needs a display${set.recordVideo === true ? " — else use --record-video" : ""}`)
147
+ .option("--slow-mo <ms>", `slow every browser operation by this many ms (default ${HEADED_DEFAULT_SLOW_MO_MS} with --headed, else 0)`, nonNegativeIntArg);
148
+ if (set.recordVideo === true) {
149
+ cmd.option("--record-video [dir]", "record a video of each browser context (works headless too); default: next to the run's result; listed as videoPaths");
150
+ }
151
+ if (set.overlay === true)
152
+ cmd.option("--no-overlay", "with --headed: hide the on-page overlay (step, intent, target highlight, outcome banner)");
153
+ return cmd;
154
+ }
155
+ /**
156
+ * #251: `--screenshots [mode|dir]` — masked screenshots of the run (one per distinct screen, or
157
+ * `steps`: one per step) plus an `index.md` contact sheet; parsed by `parseScreenshotsArg`.
158
+ */
159
+ export function withScreenshotsFlag(cmd) {
160
+ return cmd.option("--screenshots [mode|dir]", "masked screenshots + index.md: one per distinct screen (default), `steps` one per step; `screens:<dir>`/`steps:<dir>`/`<dir>` set the folder (default: next to the run's result); listed as screenshotPaths");
161
+ }
162
+ /**
163
+ * The runner's `browser` option for the parsed `--browser-*` and demo flags, or `undefined` when none
164
+ * were given. `--headed` (or `JEVITATE_HEADED=1`) without a display throws `HeadedWithoutDisplayError`
165
+ * HERE — before any browser launches — which every command reports as its usage error (exit 64).
166
+ */
167
+ export function browserRunFromFlags(o, env = process.env, platform = process.platform) {
168
+ const headed = o.headed === true || headedFromEnv(env);
169
+ assertHeadedDisplay(headed, env, platform);
170
+ const run = {
171
+ ...browserLaunchFromFlags(o),
172
+ ...(headed ? { headed: true } : {}),
173
+ ...(o.slowMo === undefined ? {} : { slowMo: o.slowMo }),
174
+ ...(o.recordVideo === undefined || o.recordVideo === false
175
+ ? {}
176
+ : { recordVideo: typeof o.recordVideo === "string" ? { dir: resolvePath(o.recordVideo) } : {} }),
177
+ ...(o.overlay === false ? { overlay: false } : {}),
178
+ };
179
+ return Object.keys(run).length > 0 ? run : undefined;
180
+ }
181
+ /** `{ browser }` for the parsed `--browser-*` flags, or `{}` when none were given — spread into a runner's options. */
182
+ export function browserOption(o) {
183
+ const launch = browserLaunchFromFlags(o);
184
+ return launch === undefined ? {} : { browser: launch };
185
+ }
186
+ /**
187
+ * Adds the shared `--viewport <W>x<H>` / `--device "<name>"` flags (#149) to a browser-driving
188
+ * command — mutually exclusive, on `explore`, `journey run`, `load run`, `source run`, `verify-fix`
189
+ * and `regression capture`/`run`. Absent both: Playwright's default (desktop) viewport, documented
190
+ * in each command's `--help`.
191
+ */
192
+ export function withEmulationFlags(cmd) {
193
+ return cmd
194
+ .option("--viewport <WxH>", "emulate a viewport of this size, e.g. --viewport 375x812 (mutually exclusive with --device)")
195
+ .option("--device <name>", 'emulate a Playwright registered device by name, e.g. --device "iPhone 13" (viewport + scale + mobile/touch + UA; mutually exclusive with --viewport)');
196
+ }
197
+ /**
198
+ * The `EmulationSpec` for the parsed flags, or `undefined` when neither was given (Playwright's own
199
+ * default viewport applies). Refused HERE, before any browser opens, when both are given —
200
+ * `resolveEmulation` (an unknown `--device`, or both together) is also re-checked wherever the spec
201
+ * is finally used, so every call path fails closed the same way.
202
+ */
203
+ export function emulationFromFlags(o) {
204
+ const spec = {
205
+ ...(o.viewport !== undefined ? { viewport: parseViewport(o.viewport) } : {}),
206
+ ...(o.device !== undefined ? { device: o.device } : {}),
207
+ };
208
+ if (Object.keys(spec).length === 0)
209
+ return undefined;
210
+ resolveEmulation(spec); // throws UnknownDeviceError / ConflictingEmulationError before any browser opens
211
+ return spec;
212
+ }
213
+ /**
214
+ * Parses repeated `--param key=value` flags into a `Record<string,string>`.
215
+ * `previous` starts as the option's default (`{}`) and this is called once
216
+ * per occurrence, commander's standard "collect" pattern.
217
+ */
218
+ export function collectParam(value, previous) {
219
+ const idx = value.indexOf("=");
220
+ const key = idx === -1 ? value : value.slice(0, idx);
221
+ const val = idx === -1 ? "" : value.slice(idx + 1);
222
+ return { ...previous, [key]: val };
223
+ }
224
+ export function makeClock() {
225
+ return {
226
+ nowIso: () => new Date().toISOString(),
227
+ monotonicMs: () => Date.now(),
228
+ };
229
+ }
230
+ export async function withSitePolicyRepository(dbPath, fn) {
231
+ await mkdir(dirname(dbPath), { recursive: true });
232
+ const db = openDatabase(dbPath);
233
+ try {
234
+ await migrateToLatest(db);
235
+ const repository = new SqliteSitePolicyRepository(db, makeClock());
236
+ return await fn(repository);
237
+ }
238
+ finally {
239
+ await db.destroy();
240
+ }
241
+ }
242
+ export function isPlannedStep(value) {
243
+ if (typeof value !== "object" || value === null)
244
+ return false;
245
+ const record = value;
246
+ if (typeof record.label !== "string")
247
+ return false;
248
+ switch (record.kind) {
249
+ case "type":
250
+ return typeof record.text === "string";
251
+ case "click":
252
+ case "navigate":
253
+ return true;
254
+ case "read":
255
+ return typeof record.chars === "number";
256
+ default:
257
+ return false;
258
+ }
259
+ }
260
+ export function parsePlannedScript(raw) {
261
+ const parsed = JSON.parse(raw);
262
+ if (!Array.isArray(parsed) || !parsed.every(isPlannedStep)) {
263
+ throw new Error("script must be a JSON array of planned steps ({kind, label, ...})");
264
+ }
265
+ return parsed;
266
+ }
267
+ /**
268
+ * Writes a JSON envelope using the program's CURRENTLY-CONFIGURED output
269
+ * writer (read at call time via `configureOutput()`), so tests that call
270
+ * `program.configureOutput({ writeOut })` after `buildProgram()` still see
271
+ * output routed to their writer. Also sets `process.exitCode` (0 for `ok`; for
272
+ * `fail`, the error's class from exit-codes.ts — 64 usage, else 2) instead of
273
+ * hard-exiting, so `exitOverride()` in tests works.
274
+ */
275
+ export function emitJson(program, envelope) {
276
+ // #218: a refusal without --json is a human `error <CODE>: …` line on stderr (cli-refusal.ts).
277
+ emitJsonOrRefusal(program, envelope);
278
+ if (envelope.ok)
279
+ emitUsageLine(program, envelope.data);
280
+ }
281
+ /**
282
+ * #210: the envelope with `--json`, else a human summary (a refusal: `error <CODE>: …` on stderr);
283
+ * the cost line on stderr either way. Exit code: the verdict's, else the envelope's class (exit-codes.ts).
284
+ */
285
+ export function emitCommandResult(program, envelope, opts) {
286
+ emitEnvelope(program, envelope, opts);
287
+ if (envelope.ok)
288
+ emitUsageLine(program, envelope.data);
289
+ }
290
+ /**
291
+ * #221: a user-supplied name that becomes a path (a profile name, a regression id) must be one safe
292
+ * segment (`assertSafeName`, @jevitate/domain). Refuses it (E_INVALID_NAME, exit 64) and returns true.
293
+ */
294
+ export function refuseUnsafeName(program, name, what) {
295
+ try {
296
+ assertSafeName(name, what);
297
+ return false;
298
+ }
299
+ catch (err) {
300
+ if (!(err instanceof UnsafeNameError))
301
+ throw err;
302
+ emitJson(program, fail(err.code, err.message));
303
+ return true;
304
+ }
305
+ }
306
+ /** A non-`--json` result: printed as bare JSON on stdout, with the cost summary line on stderr. */
307
+ export function writeRawResult(program, result) {
308
+ program.configureOutput().writeOut?.(`${JSON.stringify(result)}\n`);
309
+ emitUsageLine(program, result);
310
+ }
311
+ /** A non-`--json` result (#227): the human summary a `cli-output.ts` formatter renders, with the cost summary line on stderr. */
312
+ export function writeHumanResult(program, result, human) {
313
+ const text = human(result);
314
+ if (text !== "")
315
+ program.configureOutput().writeOut?.(text);
316
+ emitUsageLine(program, result);
317
+ }
318
+ /**
319
+ * The human cost summary (#163) — on STDERR, so stdout stays exactly the JSON a caller parses:
320
+ * `usage: cost $0.0312 (jev $0.0203 + generation $0.0109) · 398 judgments, …`, flagged
321
+ * `(partial: …)` when some call could not be priced. Nothing when the result carries no usage.
322
+ */
323
+ export function emitUsageLine(program, data) {
324
+ if (data === null || typeof data !== "object")
325
+ return;
326
+ const usage = usageCountsFrom(data.usage);
327
+ if (usage === undefined || usage.judgments + usage.generations === 0)
328
+ return;
329
+ program.configureOutput().writeErr?.(`usage: ${formatUsageLine(usage)}\n`);
330
+ }
331
+ /**
332
+ * `explore --help` trailer documenting every `outcome`/`stop`/`missionOutcome` value and its
333
+ * exit code (issue #83 item 2) — mirrors the README "Mission outcomes and exit codes" /
334
+ * "Every outcome, stop and missionOutcome value" sections, derived from the same sources:
335
+ * `MISSION_EXIT_CODES` (@jevitate/domain) and `goalExitCode`/`missionExitCode` (./mission-exit.ts).
336
+ */
337
+ /** `--stall-timeout <seconds>` (#114) → milliseconds; `undefined` when omitted, `null` when not a positive number. */
338
+ export function stallTimeoutMs(raw) {
339
+ if (raw === undefined)
340
+ return undefined;
341
+ const seconds = Number(raw);
342
+ return Number.isFinite(seconds) && seconds > 0 ? Math.round(seconds * 1000) : null;
343
+ }
344
+ /** #230: the only `--strategy` values `explore` accepts; anything else is refused, never silently run as goal. */
345
+ export const EXPLORE_STRATEGIES = ["goal", "coverage", "exploratory", "adversarial", "usability"];
346
+ export const EXPLORE_OUTCOME_HELP = `
347
+ Outcomes, stop reasons and exit codes:
348
+ Every result carries a canonical missionOutcome (and exitCode), whatever the strategy:
349
+ clean 0 · defects-found 1 · inconclusive 2 · crashed 2 · hang 3 · intermittent 4
350
+ --strategy goal also carries its own ending as "goalOutcome" (= its "outcome"), folded onto missionOutcome:
351
+ succeeded → clean 0 · failed / exhausted / blocked → defects-found 1
352
+ (defects-found, inconclusive, crashed, hang, intermittent are themselves)
353
+ --strategy goal's "stop" (why the loop itself stopped; not separately exit-coded):
354
+ done | blocked | exhausted | no-progress | hang | inconclusive | crashed | budget
355
+ (a "done" code rejected ends stop done, goalOutcome failed — never blocked)
356
+ --strategy adversarial's "stop" (why the hunt ended; its "outcome" is the canonical one above):
357
+ step-budget | action-budget | time-budget | strategies-exhausted | not-rendered
358
+ | scope-unreachable | targets-refused | target-unresponsive | hang | crashed
359
+ --strategy coverage/exploratory's own "outcome" (folds into missionOutcome above):
360
+ exhausted | insufficient-coverage | cap | scope-unreachable | stalled | crashed | hang
361
+ A run that proved nothing is inconclusive with failure.kind insufficient-coverage (the same word as
362
+ the frontier outcome), and failure.message says how to reach clean.
363
+ A starved host (#203): every result carries "hostHealth" (peak load/core, min free memory, peak
364
+ event-loop lag, slowest render). A hang, click timeout or no-progress met while the host was
365
+ starved is listed in "environmentDegraded" (advisory, never a finding); a run most of whose steps
366
+ ran starved is inconclusive (failure.kind degraded-environment), never clean.
367
+ --feature's own "outcome" (folds into missionOutcome above):
368
+ exhausted | insufficient-coverage | cap | path-cap | scope-unreachable | stalled | crashed | hang
369
+ Argument/input errors (E_EXPLORE_ARGS, E_EXPLORE_ASSERTION, …) exit 64, never 1.
370
+ Without --json: a human summary (verdict, defects by fingerprint, result file, next step);
371
+ with --json: the {v, ok, data} envelope.
372
+ Every command's exit codes: docs/outcomes.md "Exit codes".
373
+ `;
374
+ /** Distinct from MissingCredentialError: "no --real/--fake-ai selected" vs "keys missing." */
375
+ export class GatewaySelectionError extends Error {
376
+ }
377
+ export const DEFAULT_EXPLORE_CATALOG = [
378
+ { id: "openai/gpt-4o-mini", promptUsdPer1k: 0.15, completionUsdPer1k: 0.6, regions: [], latencyClass: "fast", capabilities: [] },
379
+ ];
380
+ export const DEFAULT_EXPLORE_CONSTRAINTS = { requiredCapabilities: [] };
381
+ /**
382
+ * Selects the exploration gateways. Injected gateways (tests) win; otherwise
383
+ * `--real` builds the live Jev + OpenRouter adapters behind a fail-closed
384
+ * credential preflight, and `--fake-ai` uses deterministic fakes (a pipeline
385
+ * smoke — the fake judge always proposes `done`, so it will not drive to a
386
+ * goal). No selection is a fail-closed refusal, never a silent fake.
387
+ */
388
+ export async function buildExploreGateways(deps, opts) {
389
+ // #100: ONE tracker per invocation, handed to whichever gateways are built below — real (counted
390
+ // at the innermost seam, so a retry counts too) or fake (0 tokens, so a test can assert the shape
391
+ // without a key). Injected gateways (tests) get an empty tracker: they have no real seam to count.
392
+ // #136/#163: configured prices (env/config) override the built-in, versioned price tables.
393
+ // #213: --real and --fake-ai are mutually exclusive — silently preferring one (real used to win)
394
+ // hides that the caller's own flags contradict each other.
395
+ if (opts.real && opts.fakeAi) {
396
+ throw new GatewaySelectionError("--real and --fake-ai are mutually exclusive — pass one, not both");
397
+ }
398
+ const usage = deps.explore?.usage ?? new UsageTracker(resolveUsagePricing(deps.explore?.env ?? process.env));
399
+ if (deps.explore?.judge && deps.explore?.gen) {
400
+ return { judge: deps.explore.judge, gen: deps.explore.gen, usage };
401
+ }
402
+ const store = envCredentialStore(deps.explore?.env ?? process.env, deps.explore?.localConfig ?? loadLocalCredentials());
403
+ if (opts.real) {
404
+ requireKeys("generation", store); // fail-closed
405
+ requireKeys("judgment", store); // fail-closed
406
+ const gen = new OpenRouterGenerationGateway({
407
+ store,
408
+ catalog: DEFAULT_EXPLORE_CATALOG,
409
+ constraints: DEFAULT_EXPLORE_CONSTRAINTS,
410
+ call: await realOpenRouterCall(usage),
411
+ });
412
+ const judge = new JevJudgmentGateway(store, await realJevClientCall(undefined, usage));
413
+ // Transient model/network failures are retried with exponential backoff + jitter (≈16s), then
414
+ // fail typed; validation/auth errors fail at once (owner ruling 4).
415
+ return { judge: new RetryingJudgmentPort(judge), gen: new RetryingGenerationPort(gen), usage };
416
+ }
417
+ if (opts.fakeAi) {
418
+ return { judge: fakeDoneJudge(usage), gen: new FakeGenerationGateway(undefined, usage), usage };
419
+ }
420
+ throw new GatewaySelectionError("no gateway selected — pass --real for live Jev+OpenRouter (after `jevitate ai setup`), or --fake-ai for a deterministic pipeline smoke");
421
+ }
422
+ /**
423
+ * #246: the generation gateway ALONE (`journey annotate` drafts text and asks no judgment
424
+ * question, so it needs no Jev key). Same selection rules as `buildExploreGateways`: injected (tests)
425
+ * wins, `--real` is fail-closed on the OpenRouter key, `--fake-ai` is the deterministic fake, the two
426
+ * are exclusive, and no selection is a refusal — never a silent fake.
427
+ */
428
+ export async function buildGenerationGateway(deps, opts) {
429
+ if (opts.real && opts.fakeAi) {
430
+ throw new GatewaySelectionError("--real and --fake-ai are mutually exclusive — pass one, not both");
431
+ }
432
+ const usage = deps.explore?.usage ?? new UsageTracker(resolveUsagePricing(deps.explore?.env ?? process.env));
433
+ if (deps.explore?.gen)
434
+ return { gen: deps.explore.gen, usage };
435
+ if (opts.real) {
436
+ const store = envCredentialStore(deps.explore?.env ?? process.env, deps.explore?.localConfig ?? loadLocalCredentials());
437
+ requireKeys("generation", store); // fail-closed
438
+ const gen = new OpenRouterGenerationGateway({
439
+ store,
440
+ catalog: DEFAULT_EXPLORE_CATALOG,
441
+ constraints: DEFAULT_EXPLORE_CONSTRAINTS,
442
+ call: await realOpenRouterCall(usage),
443
+ });
444
+ return { gen: new RetryingGenerationPort(gen), usage };
445
+ }
446
+ if (opts.fakeAi)
447
+ return { gen: new FakeGenerationGateway(undefined, usage), usage };
448
+ throw new GatewaySelectionError("no gateway selected — pass --real for live OpenRouter generation (after `jevitate ai setup generation`), or --fake-ai for a deterministic pipeline smoke");
449
+ }
450
+ /**
451
+ * A judge that always proposes `done` — used only by `--fake-ai` (smoke). It is TOTAL and
452
+ * deterministic: it answers EVERY question it is asked, whatever the mission or rubric names it
453
+ * (#213) — a choice offering `done` picks `done` (so the goal/coverage loop stops at once, and
454
+ * will not drive to a goal); a choice that does NOT offer `done` (e.g. the UX quality grader's
455
+ * label set, `grade::0`) deterministically picks its first listed option instead of throwing; a
456
+ * noul answers "no"; a score answers 0. It never throws on a question SHAPE it does not
457
+ * specifically know about — only on a malformed one (a choice with no options at all), which is a
458
+ * bug upstream, not an unknown question. `usage` (#100) is optional: when supplied, every call
459
+ * reports 1 judgment at 0 tokens.
460
+ */
461
+ export function fakeDoneJudge(usage) {
462
+ return {
463
+ async systemOne(args) {
464
+ const out = {};
465
+ for (const [name, q] of Object.entries(args.questions)) {
466
+ switch (q.kind) {
467
+ case "choice": {
468
+ // #213: total over every choice family, not just the goal/coverage loop's `done`.
469
+ const value = q.options.includes("done") ? "done" : q.options[0];
470
+ if (value === undefined)
471
+ throw new Error(`fake judge: question '${name}' offers no options`);
472
+ out[name] = { kind: "choice", value, confidence: 1 };
473
+ break;
474
+ }
475
+ case "noul":
476
+ out[name] = { kind: "noul", value: false, probability: 0 };
477
+ break;
478
+ case "score":
479
+ out[name] = { kind: "score", value: 0 };
480
+ break;
481
+ default: {
482
+ const exhaustive = q;
483
+ throw new Error(`fake judge: unsupported question ${JSON.stringify(exhaustive)}`);
484
+ }
485
+ }
486
+ }
487
+ usage?.recordJudgment(FAKE_CALL_USAGE);
488
+ return out;
489
+ },
490
+ };
491
+ }
492
+ //# sourceMappingURL=cli-shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-shared.js","sourceRoot":"","sources":["../src/cli-shared.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACrG,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,eAAe,EACf,eAAe,GAShB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAc,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAqB,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAA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CAAC,EAAE,CAAC;wBACrD,MAAM;oBACR,CAAC;oBACD,KAAK,MAAM;wBACT,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;wBAC3D,MAAM;oBACR,KAAK,OAAO;wBACV,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;wBACxC,MAAM;oBACR,OAAO,CAAC,CAAC,CAAC;wBACR,MAAM,UAAU,GAAU,CAAC,CAAC;wBAC5B,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oBACpF,CAAC;gBACH,CAAC;YACH,CAAC;YACD,KAAK,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;YACvC,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { Command, Option, Argument } from "commander";
2
+ /** Best-effort placeholder for absolute, environment-dependent paths (home dir, cwd, tmp). */
3
+ export declare function normalizeVolatile(text: string): string;
4
+ export interface OptionSurface {
5
+ readonly flags: string;
6
+ readonly description: string;
7
+ readonly defaultValue: string;
8
+ readonly choices: readonly string[] | null;
9
+ readonly required: boolean;
10
+ readonly mandatory: boolean;
11
+ readonly negate: boolean;
12
+ readonly variadic: boolean;
13
+ readonly envVar: string | null;
14
+ }
15
+ export interface ArgumentSurface {
16
+ readonly name: string;
17
+ readonly description: string;
18
+ readonly required: boolean;
19
+ readonly variadic: boolean;
20
+ readonly defaultValue: string;
21
+ readonly choices: readonly string[] | null;
22
+ }
23
+ export interface CommandSurface {
24
+ readonly path: string;
25
+ readonly aliases: readonly string[];
26
+ readonly description: string;
27
+ readonly arguments: readonly ArgumentSurface[];
28
+ readonly options: readonly OptionSurface[];
29
+ }
30
+ export declare function describeOption(o: Option): OptionSurface;
31
+ export declare function describeArgument(a: Argument): ArgumentSurface;
32
+ /** Walks the ENTIRE command tree recursively (subcommands of subcommands included, e.g. `mission target add`). */
33
+ export declare function walk(cmd: Command, path: string): CommandSurface[];
@@ -0,0 +1,48 @@
1
+ /** Best-effort placeholder for absolute, environment-dependent paths (home dir, cwd, tmp). */
2
+ export function normalizeVolatile(text) {
3
+ return text
4
+ .split(process.cwd()).join("<cwd>")
5
+ .replace(/\/home\/[^/\s"']+/g, "<home>")
6
+ .replace(/\/root(?=[/\s"'])/g, "<home>");
7
+ }
8
+ export function describeOption(o) {
9
+ return {
10
+ flags: o.flags,
11
+ description: normalizeVolatile(o.description),
12
+ defaultValue: normalizeVolatile(JSON.stringify(o.defaultValue ?? null)),
13
+ choices: o.argChoices ?? null,
14
+ required: o.required,
15
+ mandatory: o.mandatory,
16
+ negate: o.negate,
17
+ variadic: o.variadic,
18
+ envVar: o.envVar ?? null,
19
+ };
20
+ }
21
+ export function describeArgument(a) {
22
+ return {
23
+ name: a.name(),
24
+ description: normalizeVolatile(a.description),
25
+ required: a.required,
26
+ variadic: a.variadic,
27
+ defaultValue: normalizeVolatile(JSON.stringify(a.defaultValue ?? null)),
28
+ choices: a.argChoices ?? null,
29
+ };
30
+ }
31
+ /** Walks the ENTIRE command tree recursively (subcommands of subcommands included, e.g. `mission target add`). */
32
+ export function walk(cmd, path) {
33
+ const here = {
34
+ path,
35
+ aliases: [...cmd.aliases()].sort(),
36
+ description: normalizeVolatile(cmd.description()),
37
+ // Positional arguments: order is semantically meaningful (they're positional), never sorted.
38
+ arguments: cmd.registeredArguments.map(describeArgument),
39
+ // Options: sorted so option-registration order (an implementation detail) never causes a diff.
40
+ options: [...cmd.options].map(describeOption).sort((a, b) => a.flags.localeCompare(b.flags)),
41
+ };
42
+ const children = [...cmd.commands]
43
+ .filter((c) => c.name() !== "help") // Commander's auto-added implicit help subcommand: not user surface.
44
+ .sort((a, b) => a.name().localeCompare(b.name()))
45
+ .flatMap((c) => walk(c, path === "" ? c.name() : `${path} ${c.name()}`));
46
+ return [here, ...children];
47
+ }
48
+ //# sourceMappingURL=cli-surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-surface.js","sourceRoot":"","sources":["../src/cli-surface.ts"],"names":[],"mappings":"AAEA,8FAA8F;AAC9F,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI;SACR,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;SAClC,OAAO,CAAC,oBAAoB,EAAE,QAAQ,CAAC;SACvC,OAAO,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC;AA+BD,MAAM,UAAU,cAAc,CAAC,CAAS;IACtC,OAAO;QACL,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,WAAW,CAAC;QAC7C,YAAY,EAAE,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC;QACvE,OAAO,EAAE,CAAC,CAAC,UAAU,IAAI,IAAI;QAC7B,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,IAAI;KACzB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,CAAW;IAC1C,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QACd,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,WAAW,CAAC;QAC7C,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,YAAY,EAAE,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAA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,EAAE,GAAG,QAAQ,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** Conversational-page tuning shared by the goal and usability strategies (CLI flags). */
2
+ export interface ConversationOptions {
3
+ readonly replyWaitMs?: number;
4
+ readonly replyCeilingMs?: number;
5
+ readonly replyMaxChars?: number;
6
+ /** Job-wait budget (ms, #92): waiting on an in-progress status the page shows. */
7
+ readonly jobWaitMs?: number;
8
+ }
9
+ /** The ExploreConfig fields a `ConversationOptions` sets. */
10
+ export declare function conversationConfig(c: ConversationOptions | undefined): {
11
+ replyWaitMs?: number;
12
+ replyCeilingMs?: number;
13
+ replyMaxChars?: number;
14
+ jobWaitMs?: number;
15
+ };
@@ -0,0 +1,10 @@
1
+ /** The ExploreConfig fields a `ConversationOptions` sets. */
2
+ export function conversationConfig(c) {
3
+ return {
4
+ ...(c?.replyWaitMs === undefined ? {} : { replyWaitMs: c.replyWaitMs }),
5
+ ...(c?.replyCeilingMs === undefined ? {} : { replyCeilingMs: c.replyCeilingMs }),
6
+ ...(c?.replyMaxChars === undefined ? {} : { replyMaxChars: c.replyMaxChars }),
7
+ ...(c?.jobWaitMs === undefined ? {} : { jobWaitMs: c.jobWaitMs }),
8
+ };
9
+ }
10
+ //# sourceMappingURL=conversation-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-options.js","sourceRoot":"","sources":["../src/conversation-options.ts"],"names":[],"mappings":"AASA,6DAA6D;AAC7D,MAAM,UAAU,kBAAkB,CAChC,CAAkC;IAElC,OAAO;QACL,GAAG,CAAC,CAAC,EAAE,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QACvE,GAAG,CAAC,CAAC,EAAE,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC;QAChF,GAAG,CAAC,CAAC,EAAE,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC;QAC7E,GAAG,CAAC,CAAC,EAAE,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;KAClE,CAAC;AACJ,CAAC"}