@jevitate/cli 0.28.0 → 0.29.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 (180) hide show
  1. package/README.md +1 -1
  2. package/dist/approval-provenance.d.ts +9 -1
  3. package/dist/approval-provenance.js +12 -4
  4. package/dist/approval-provenance.js.map +1 -1
  5. package/dist/author-journey-cli.js +1 -1
  6. package/dist/author-journey-cli.js.map +1 -1
  7. package/dist/bin.js +12663 -8284
  8. package/dist/bin.js.map +1 -1
  9. package/dist/build-info.generated.js +3 -3
  10. package/dist/catalog-analysis.js +3 -2
  11. package/dist/catalog-analysis.js.map +1 -1
  12. package/dist/catalog-bundle.js +2 -2
  13. package/dist/catalog-bundle.js.map +1 -1
  14. package/dist/check-plan.js +12 -0
  15. package/dist/check-plan.js.map +1 -1
  16. package/dist/demo-aspect-cli.d.ts +10 -0
  17. package/dist/demo-aspect-cli.js +4 -1
  18. package/dist/demo-aspect-cli.js.map +1 -1
  19. package/dist/engine.d.ts +8 -1
  20. package/dist/engine.js +16 -2
  21. package/dist/engine.js.map +1 -1
  22. package/dist/explore-adversarial.js +4 -0
  23. package/dist/explore-adversarial.js.map +1 -1
  24. package/dist/explore-cli/feature-strategy.js +1 -0
  25. package/dist/explore-cli/feature-strategy.js.map +1 -1
  26. package/dist/explore-cli/run.js +7 -0
  27. package/dist/explore-cli/run.js.map +1 -1
  28. package/dist/explore-feature.d.ts +2 -0
  29. package/dist/explore-feature.js +15 -8
  30. package/dist/explore-feature.js.map +1 -1
  31. package/dist/explore-goal.js +12 -0
  32. package/dist/explore-goal.js.map +1 -1
  33. package/dist/explore-specs.js +2 -2
  34. package/dist/explore-specs.js.map +1 -1
  35. package/dist/heal-probe-guard.d.ts +7 -3
  36. package/dist/heal-probe-guard.js +8 -2
  37. package/dist/heal-probe-guard.js.map +1 -1
  38. package/dist/http-probe.js +2 -2
  39. package/dist/http-probe.js.map +1 -1
  40. package/dist/journey-annotate-api.d.ts +5 -0
  41. package/dist/journey-annotate-api.js +49 -24
  42. package/dist/journey-annotate-api.js.map +1 -1
  43. package/dist/journey-annotate-cli.js +4 -1
  44. package/dist/journey-annotate-cli.js.map +1 -1
  45. package/dist/journey-api.d.ts +46 -7
  46. package/dist/journey-api.js +111 -43
  47. package/dist/journey-api.js.map +1 -1
  48. package/dist/journey-chain.d.ts +0 -6
  49. package/dist/journey-chain.js +36 -5
  50. package/dist/journey-chain.js.map +1 -1
  51. package/dist/journey-cli/chain.js +6 -0
  52. package/dist/journey-cli/chain.js.map +1 -1
  53. package/dist/journey-cli/lint.js +10 -3
  54. package/dist/journey-cli/lint.js.map +1 -1
  55. package/dist/journey-cli/run.js +39 -4
  56. package/dist/journey-cli/run.js.map +1 -1
  57. package/dist/journey-cli/verify.d.ts +8 -1
  58. package/dist/journey-cli/verify.js +111 -14
  59. package/dist/journey-cli/verify.js.map +1 -1
  60. package/dist/journey-cli-readiness.js +2 -0
  61. package/dist/journey-cli-readiness.js.map +1 -1
  62. package/dist/journey-demo-cli.js +2 -0
  63. package/dist/journey-demo-cli.js.map +1 -1
  64. package/dist/journey-network-checks.d.ts +4 -0
  65. package/dist/journey-network-checks.js +6 -2
  66. package/dist/journey-network-checks.js.map +1 -1
  67. package/dist/journey-prefix.d.ts +2 -0
  68. package/dist/journey-prefix.js +20 -1
  69. package/dist/journey-prefix.js.map +1 -1
  70. package/dist/journey-proof-context.d.ts +7 -1
  71. package/dist/journey-proof-context.js +19 -1
  72. package/dist/journey-proof-context.js.map +1 -1
  73. package/dist/journey-proof-waiver-cli.js +6 -3
  74. package/dist/journey-proof-waiver-cli.js.map +1 -1
  75. package/dist/journey-readiness.js +4 -0
  76. package/dist/journey-readiness.js.map +1 -1
  77. package/dist/journey-review-api.js +23 -0
  78. package/dist/journey-review-api.js.map +1 -1
  79. package/dist/journey-review.d.ts +30 -10
  80. package/dist/journey-review.js +33 -39
  81. package/dist/journey-review.js.map +1 -1
  82. package/dist/journey-run-record.d.ts +91 -0
  83. package/dist/journey-run-record.js +239 -0
  84. package/dist/journey-run-record.js.map +1 -0
  85. package/dist/journey-stale-api.d.ts +7 -0
  86. package/dist/journey-stale-api.js +50 -6
  87. package/dist/journey-stale-api.js.map +1 -1
  88. package/dist/journey-verify-checkpoint.d.ts +656 -0
  89. package/dist/journey-verify-checkpoint.js +923 -0
  90. package/dist/journey-verify-checkpoint.js.map +1 -0
  91. package/dist/journey-verify.d.ts +84 -3
  92. package/dist/journey-verify.js +1387 -110
  93. package/dist/journey-verify.js.map +1 -1
  94. package/dist/kill-signal.d.ts +24 -2
  95. package/dist/kill-signal.js +39 -11
  96. package/dist/kill-signal.js.map +1 -1
  97. package/dist/load-api.js +31 -2
  98. package/dist/load-api.js.map +1 -1
  99. package/dist/load-cli.js +6 -0
  100. package/dist/load-cli.js.map +1 -1
  101. package/dist/logs-retention.js +28 -3
  102. package/dist/logs-retention.js.map +1 -1
  103. package/dist/mask-values.d.ts +5 -0
  104. package/dist/mask-values.js +12 -0
  105. package/dist/mask-values.js.map +1 -0
  106. package/dist/mcp-api.d.ts +2 -0
  107. package/dist/mcp-api.js +19 -3
  108. package/dist/mcp-api.js.map +1 -1
  109. package/dist/mcp-cli-runner.d.ts +7 -1
  110. package/dist/mcp-cli-runner.js +30 -3
  111. package/dist/mcp-cli-runner.js.map +1 -1
  112. package/dist/mcp-cli-tools.d.ts +9 -1
  113. package/dist/mcp-cli-tools.js +29 -4
  114. package/dist/mcp-cli-tools.js.map +1 -1
  115. package/dist/mcp-paths.js +11 -0
  116. package/dist/mcp-paths.js.map +1 -1
  117. package/dist/mcp-run-guard.d.ts +79 -0
  118. package/dist/mcp-run-guard.js +371 -0
  119. package/dist/mcp-run-guard.js.map +1 -0
  120. package/dist/mcp-tools/cli.js +1 -1
  121. package/dist/mcp-tools/cli.js.map +1 -1
  122. package/dist/mcp-tools/findings.js +12 -1
  123. package/dist/mcp-tools/findings.js.map +1 -1
  124. package/dist/mcp-tools/journey.js +25 -8
  125. package/dist/mcp-tools/journey.js.map +1 -1
  126. package/dist/mission-fixtures.d.ts +3 -1
  127. package/dist/mission-fixtures.js +23 -6
  128. package/dist/mission-fixtures.js.map +1 -1
  129. package/dist/mutation-proof-policy.d.ts +2 -0
  130. package/dist/mutation-proof-policy.js +2 -2
  131. package/dist/mutation-proof-policy.js.map +1 -1
  132. package/dist/program.d.ts +6 -0
  133. package/dist/program.js +6 -9
  134. package/dist/program.js.map +1 -1
  135. package/dist/project-dir.d.ts +5 -1
  136. package/dist/project-dir.js +54 -5
  137. package/dist/project-dir.js.map +1 -1
  138. package/dist/readiness.js +3 -1
  139. package/dist/readiness.js.map +1 -1
  140. package/dist/regression-api.d.ts +5 -0
  141. package/dist/regression-api.js +17 -10
  142. package/dist/regression-api.js.map +1 -1
  143. package/dist/regression-cli.js +14 -1
  144. package/dist/regression-cli.js.map +1 -1
  145. package/dist/report-api.js +6 -0
  146. package/dist/report-api.js.map +1 -1
  147. package/dist/resource-preflight.d.ts +2 -1
  148. package/dist/resource-preflight.js +2 -1
  149. package/dist/resource-preflight.js.map +1 -1
  150. package/dist/secret-params.d.ts +82 -0
  151. package/dist/secret-params.js +234 -0
  152. package/dist/secret-params.js.map +1 -0
  153. package/dist/self-heal-adapter.d.ts +2 -2
  154. package/dist/self-heal-adapter.js +7 -9
  155. package/dist/self-heal-adapter.js.map +1 -1
  156. package/dist/source-cli.js +3 -1
  157. package/dist/source-cli.js.map +1 -1
  158. package/dist/source-run-api.d.ts +2 -0
  159. package/dist/source-run-api.js +21 -2
  160. package/dist/source-run-api.js.map +1 -1
  161. package/dist/target-config.d.ts +39 -0
  162. package/dist/target-config.js +76 -1
  163. package/dist/target-config.js.map +1 -1
  164. package/dist/terminal-result.d.ts +181 -0
  165. package/dist/terminal-result.js +609 -0
  166. package/dist/terminal-result.js.map +1 -0
  167. package/dist/usability-capture.js +2 -2
  168. package/dist/usability-capture.js.map +1 -1
  169. package/dist/ux-usability/hang.js +2 -0
  170. package/dist/ux-usability/hang.js.map +1 -1
  171. package/dist/ux-usability.js +6 -0
  172. package/dist/ux-usability.js.map +1 -1
  173. package/dist/verify-fix-api.d.ts +43 -0
  174. package/dist/verify-fix-api.js +138 -10
  175. package/dist/verify-fix-api.js.map +1 -1
  176. package/dist/verify-fix-cli.d.ts +6 -1
  177. package/dist/verify-fix-cli.js +65 -11
  178. package/dist/verify-fix-cli.js.map +1 -1
  179. package/package.json +9 -9
  180. package/skills/jevitate-run-journey/SKILL.md +23 -3
@@ -0,0 +1,181 @@
1
+ import { type MissionOutcome } from "@jevitate/domain";
2
+ import { type EngineInfo } from "./engine.js";
3
+ import { type RunMetadata } from "./run-metadata.js";
4
+ /**
5
+ * The shared terminal result of a long-running command: however the command ends, it ends with a
6
+ * machine-readable result. A command registers once (`registerTerminalResult`), reports progress as
7
+ * it goes, and calls `complete()` when it has emitted its own result. If it ends any other way, this
8
+ * layer writes a redacted diagnostic artifact, prints one envelope and exits:
9
+ *
10
+ * | trigger | code | exit |
11
+ * |----------------|------------------------|-------------------------------------------------------|
12
+ * | signal | E_TERMINAL_SIGNAL | 129/130/143, by the kill switch (kill-signal.ts) |
13
+ * | parent gone | E_TERMINAL_PARENT_GONE | 129, by the kill switch; no signal was sent |
14
+ * | inactivity | E_TERMINAL_WATCHDOG | 2 (inconclusive: it proves nothing) |
15
+ * | `fail(err)` | E_TERMINAL_INTERNAL | 2 (crashed) |
16
+ * | uncaught error | E_TERMINAL_INTERNAL | 2 (crashed; an unhandled rejection arrives this way) |
17
+ * | process exit | E_TERMINAL_UNSETTLED | 2 (a `process.exit` or a drained event loop, no result) |
18
+ *
19
+ * Exactly once: the first trigger wins and every later one is a no-op. An uncaught error after
20
+ * `complete()` is no trigger, since the result is already out: one redacted stderr report, then an
21
+ * exit that keeps the code the command set.
22
+ *
23
+ * What cannot be handled in process (SIGKILL, a caller's limit that kills the whole group) leaves
24
+ * only what was already printed, so each `progress()` also prints one short redacted line to stderr.
25
+ * stdout stays exactly one envelope. A stderr that stops accepting them only ends the printing.
26
+ *
27
+ * A broken output pipe never decides a result: see `installBrokenPipePolicy`.
28
+ *
29
+ * Inside an MCP tool call (`mcp-cli-runner.ts`) the process is the shared server and fd 1 is the MCP
30
+ * protocol channel, so this layer stays out: nothing is printed, nothing is armed, and nothing
31
+ * exits. The tool's result is still the command's own captured envelope. `fail` rethrows there, and
32
+ * the runner turns that into its own `E_CLI_INTERNAL` result.
33
+ *
34
+ * SYNCHRONOUS BY CONTRACT. Everything from a trigger to the exit runs in one turn and never yields
35
+ * the event loop, for the reason `onKillSignal` documents: Playwright's own signal handler closes
36
+ * the browsers, in-flight page operations start rejecting, and the command's own error handling can
37
+ * otherwise win the race to `process.exit` with another result. So artifact and output writes are
38
+ * `writeFileSync`/`writeSync` only. `process.stdout.write` is not safe here: on a pipe it can queue,
39
+ * and an exit in the same turn loses what is queued. The envelope therefore goes through
40
+ * `emitCommandResult` on a program whose writers are synchronous. `progress` and `addSecrets` are
41
+ * synchronous for the same reason: the trigger only reads what was already reported.
42
+ *
43
+ * Limit: the watchdog and the signal handler both run on the event loop, so a synchronous spin
44
+ * delays them until it returns.
45
+ */
46
+ /**
47
+ * Where the command is now: what a progress line and a diagnostic name. All text is redacted before
48
+ * use. An update merges into what was reported, so pass `undefined` to clear a field that no longer
49
+ * applies (the mutation, once the replay under it has finished).
50
+ */
51
+ export interface TerminalProgress {
52
+ readonly phase?: string | undefined;
53
+ readonly replay?: number | string | undefined;
54
+ readonly mutation?: string | undefined;
55
+ readonly step?: number | string | undefined;
56
+ /** Carried in the diagnostic only, never in a progress line. */
57
+ readonly detail?: Readonly<Record<string, unknown>> | undefined;
58
+ }
59
+ export interface TerminalResultRegistration {
60
+ /** The command, named in the diagnostic and in a usage hint (e.g. `journey verify`, `verify-fix`). */
61
+ readonly command: string;
62
+ /** `--json` was passed: the envelope on stdout; otherwise the `error <CODE>: …` line on stderr. */
63
+ readonly json: boolean;
64
+ /** Values masked from all text, in each of their URL forms. Add later ones with `addSecrets`. */
65
+ readonly secrets: readonly string[];
66
+ /**
67
+ * The command's identity path. The result goes to `resultPathFor(artifactPath)` (`<stem>.result.json`),
68
+ * through `writeMissionResult`, and never to `artifactPath` itself, so a kill cannot replace an
69
+ * earlier proof stored there. Absent: the envelope is the only result.
70
+ */
71
+ readonly artifactPath?: string;
72
+ /**
73
+ * The longest the command may go without calling `progress()`, in milliseconds: a positive integer
74
+ * a timer can represent. Each `progress()` starts this limit again, so it does not bound the whole
75
+ * run: legal runs range from seconds to over 100 minutes (#778).
76
+ *
77
+ * Derive it from what one uninterrupted stretch can legally take, not from a typical run. If
78
+ * `progress()` is called per replay, it must cover the 300 s machine-slot admission bound
79
+ * (`DEFAULT_ADMISSION_TIMEOUT_MS`) plus the longest legal single replay of this command's plan,
80
+ * since both can fall between two calls.
81
+ */
82
+ readonly inactivityMs: number;
83
+ /** The progress known at registration. */
84
+ readonly progress?: TerminalProgress;
85
+ }
86
+ export interface TerminalResultHandle {
87
+ /**
88
+ * Merges what the command knows now into the progress a diagnostic reports, prints one redacted line
89
+ * to stderr, and starts `inactivityMs` again. A no-op once the command has settled. Synchronous;
90
+ * never throws.
91
+ */
92
+ progress(update: TerminalProgress): void;
93
+ /** Adds secrets learned during the run (a resolved auth token), so a later trigger masks them too. Synchronous; never throws. */
94
+ addSecrets(values: readonly string[]): void;
95
+ /**
96
+ * An internal error: reports it, then exits. A no-op once the command has settled. Inside an MCP
97
+ * tool call it throws the redacted error instead, so call it where a throw reaches the command's
98
+ * caller (a `catch` that ends the action).
99
+ */
100
+ fail(err: unknown): void;
101
+ /**
102
+ * The command has emitted its own result: nothing more is reported. Call it in the same synchronous
103
+ * turn as that emit, with no `await` between them. A command that never calls it reports
104
+ * E_TERMINAL_UNSETTLED at exit.
105
+ */
106
+ complete(): void;
107
+ }
108
+ /** The seams a test fakes. Every one of them must be synchronous (see this module's doc). */
109
+ export interface TerminalResultDeps {
110
+ readonly exit: (code: number) => void;
111
+ /** Ends only the browsers this process launched (`terminateOwnBrowsersSync`), and nothing else. */
112
+ readonly terminateBrowsers: () => void;
113
+ readonly writeStdout: (text: string) => void;
114
+ readonly writeStderr: (text: string) => void;
115
+ readonly writeResult: (artifactPath: string, missionOutcome: MissionOutcome, exitCode: number, result: unknown, meta: RunMetadata | undefined) => string;
116
+ readonly engine: () => EngineInfo;
117
+ /** Listens for an uncaught error (and so an unhandled rejection). Returns the remover. */
118
+ readonly onFatalError: (listener: (err: unknown) => void) => () => void;
119
+ /** Listens for the process ending on any path. Returns the remover. */
120
+ readonly onProcessExit: (listener: () => void) => () => void;
121
+ readonly installKillSwitch: () => void;
122
+ /** True when this process is shared with other work and is not this command's to print on or end. */
123
+ readonly sharedProcess: () => boolean;
124
+ }
125
+ /**
126
+ * The one rule for text leaving a command: registered secrets first and whole, so no part of one is
127
+ * left for a later rule to half-mask, then URL parameters, named credentials and credential shapes.
128
+ * Text past `MAX_MASKED_TEXT` once the secrets' masks are in is withheld whole.
129
+ */
130
+ export declare function redactSensitiveText(text: string, secrets: readonly string[]): string;
131
+ /**
132
+ * A path this process wrote must still open: only a real secret is masked, never a shape (a video's
133
+ * file name is 32 hex digits) and never a short value (`--param dir=logs` is not `.jevitate/logs`).
134
+ */
135
+ export declare function redactSensitivePath(path: string, secrets: readonly string[]): string;
136
+ /** How a field keeps its value: `verbatim` (no secret can be there), or `path` (see `redactSensitivePath`). */
137
+ export type RedactionFieldRule = (key: string) => "verbatim" | "path" | undefined;
138
+ /**
139
+ * Every string VALUE in `value` through `redactSensitiveText`. A field named for a credential loses
140
+ * its whole value, whatever it looks like. `rule` exempts a caller's known fields. Keys are never
141
+ * touched: they are what a reader finds `exitCode` and `verdict` by, so a value that happens to equal
142
+ * one must not rename it. A map keyed by data has to reach here as text (see `buildDiagnostic`).
143
+ */
144
+ export declare function redactSensitiveValue(value: unknown, secrets: readonly string[], rule?: RedactionFieldRule): unknown;
145
+ /** `err` with its text redacted: the same object and class, so a caller's `instanceof` still decides. */
146
+ export declare function redactThrown(err: unknown, secrets: readonly string[], depth?: number): unknown;
147
+ /**
148
+ * Registers how a long-running command produces its terminal result. Call it before the command's
149
+ * first browser launch, and keep the returned handle for the run. See this module's doc for what ends
150
+ * a command, and for the synchronous contract everything reachable from a trigger keeps.
151
+ *
152
+ * Throws a `RangeError` on an unusable `inactivityMs`: a command never runs without its bound.
153
+ */
154
+ export declare function registerTerminalResult(registration: TerminalResultRegistration, deps?: TerminalResultDeps): TerminalResultHandle;
155
+ /**
156
+ * What an EPIPE on an output stream means. A closed reader is not a verdict, and exit 0 here once
157
+ * reported `still-reproduces` as a pass, so:
158
+ *
159
+ * - stderr: nothing. It carries progress and diagnostics, and `2>&1 | head` must not end a proof.
160
+ * - stdout, a registered command still running: nothing. It goes on to its real result and exit code.
161
+ * - stdout otherwise: the process exits quietly (#213) with whatever `process.exitCode` the command
162
+ * set, 0 when it set none. `emitEnvelope` writes before it sets the code, but a stream reports
163
+ * the error on a later tick than the write, so the code is set by the time this runs. And a
164
+ * registered command calls `complete()` in that same turn, so if the error ever came first, the
165
+ * "still running" rule above would keep its code.
166
+ *
167
+ * `process.exit()` takes no code on purpose: it keeps the one the command set.
168
+ */
169
+ export declare function installBrokenPipePolicy(streams?: {
170
+ readonly stdout: NodeJS.EventEmitter;
171
+ readonly stderr: NodeJS.EventEmitter;
172
+ }, exit?: () => void): void;
173
+ /**
174
+ * A command's promise rejected up to the entry point. With a command registered in this process the
175
+ * layer handles it, so its secrets are redacted: a running one gets the usual E_TERMINAL_INTERNAL
176
+ * ending, and a completed one (its result already out, so no second envelope) a redacted stderr line
177
+ * and exit 2. Returns false when nothing was registered: the caller reports it itself.
178
+ */
179
+ export declare function reportCommandRejection(err: unknown, writeStderr?: (text: string) => void): boolean;
180
+ /** Test seam: resets all module state (a real run never needs this: one process, one exit). */
181
+ export declare function __resetTerminalResultForTests(): void;