@testsprite/testsprite-cli 0.16.0 → 0.18.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 (206) hide show
  1. package/README.md +52 -147
  2. package/dist/commands/agent.d.ts +12 -4
  3. package/dist/commands/agent.js +48 -63
  4. package/dist/commands/auth.d.ts +6 -10
  5. package/dist/commands/auth.js +40 -56
  6. package/dist/commands/ci.d.ts +23 -100
  7. package/dist/commands/ci.js +293 -487
  8. package/dist/commands/conversation.d.ts +27 -0
  9. package/dist/commands/conversation.js +741 -0
  10. package/dist/commands/doctor.d.ts +5 -1
  11. package/dist/commands/doctor.js +129 -34
  12. package/dist/commands/init.d.ts +4 -45
  13. package/dist/commands/init.js +108 -66
  14. package/dist/commands/project-env.d.ts +62 -2
  15. package/dist/commands/project-env.js +434 -43
  16. package/dist/commands/project-sign-in.d.ts +0 -48
  17. package/dist/commands/project-sign-in.js +1 -229
  18. package/dist/commands/project.d.ts +19 -186
  19. package/dist/commands/project.js +108 -926
  20. package/dist/commands/result.d.ts +10 -0
  21. package/dist/commands/result.js +216 -0
  22. package/dist/commands/schedule.d.ts +0 -29
  23. package/dist/commands/schedule.js +28 -87
  24. package/dist/commands/test.d.ts +301 -1838
  25. package/dist/commands/test.js +1880 -13917
  26. package/dist/commands/testlist.d.ts +130 -5
  27. package/dist/commands/testlist.js +300 -342
  28. package/dist/commands/tunnel.d.ts +3 -3
  29. package/dist/commands/tunnel.js +23 -20
  30. package/dist/commands/usage.d.ts +12 -45
  31. package/dist/commands/usage.js +50 -131
  32. package/dist/index.js +191 -110
  33. package/dist/lib/agent-detect.js +9 -5
  34. package/dist/lib/agent-targets.d.ts +21 -2
  35. package/dist/lib/agent-targets.js +88 -11
  36. package/dist/lib/args.d.ts +13 -0
  37. package/dist/lib/args.js +49 -0
  38. package/dist/lib/basic-auth.d.ts +3 -0
  39. package/dist/lib/basic-auth.js +15 -0
  40. package/dist/lib/billing-refusal.js +4 -3
  41. package/dist/lib/ci-linkage.d.ts +4 -82
  42. package/dist/lib/ci-linkage.js +4 -157
  43. package/dist/lib/ci-run.js +1 -1
  44. package/dist/lib/client-factory.d.ts +12 -4
  45. package/dist/lib/client-factory.js +41 -30
  46. package/dist/lib/commit-signal.d.ts +65 -0
  47. package/dist/lib/commit-signal.js +305 -0
  48. package/dist/lib/concurrency-limiter.d.ts +6 -0
  49. package/dist/lib/concurrency-limiter.js +29 -0
  50. package/dist/lib/config.js +10 -5
  51. package/dist/lib/conflict-reason.d.ts +9 -3
  52. package/dist/lib/conflict-reason.js +6 -3
  53. package/dist/lib/conversation/answers.d.ts +9 -0
  54. package/dist/lib/conversation/answers.js +49 -0
  55. package/dist/lib/conversation/api.d.ts +75 -0
  56. package/dist/lib/conversation/api.js +151 -0
  57. package/dist/lib/conversation/change.d.ts +31 -0
  58. package/dist/lib/conversation/change.js +124 -0
  59. package/dist/lib/conversation/context.d.ts +29 -0
  60. package/dist/lib/conversation/context.js +82 -0
  61. package/dist/lib/conversation/environment.d.ts +16 -0
  62. package/dist/lib/conversation/environment.js +21 -0
  63. package/dist/lib/conversation/follow.d.ts +24 -0
  64. package/dist/lib/conversation/follow.js +42 -0
  65. package/dist/lib/conversation/render.d.ts +33 -0
  66. package/dist/lib/conversation/render.js +318 -0
  67. package/dist/lib/conversation/title.d.ts +2 -0
  68. package/dist/lib/conversation/title.js +18 -0
  69. package/dist/lib/conversation/types.d.ts +158 -0
  70. package/dist/lib/conversation/types.js +6 -0
  71. package/dist/lib/credentials.js +67 -11
  72. package/dist/lib/cron.d.ts +1 -1
  73. package/dist/lib/cron.js +2 -2
  74. package/dist/lib/dispatch-stop.d.ts +20 -0
  75. package/dist/lib/dispatch-stop.js +30 -0
  76. package/dist/lib/download.d.ts +100 -0
  77. package/dist/lib/download.js +408 -0
  78. package/dist/lib/dry-run/fetch.d.ts +10 -0
  79. package/dist/lib/dry-run/fetch.js +20 -0
  80. package/dist/lib/dry-run/samples.d.ts +6 -34
  81. package/dist/lib/dry-run/samples.js +375 -747
  82. package/dist/lib/environment-tunnel.d.ts +19 -30
  83. package/dist/lib/environment-tunnel.js +168 -202
  84. package/dist/lib/errors.d.ts +20 -4
  85. package/dist/lib/errors.js +36 -16
  86. package/dist/lib/facade.d.ts +7 -29
  87. package/dist/lib/facade.js +7 -36
  88. package/dist/lib/failing-fe-resolver.d.ts +13 -58
  89. package/dist/lib/failing-fe-resolver.js +47 -132
  90. package/dist/lib/first-suite-hint.d.ts +20 -30
  91. package/dist/lib/first-suite-hint.js +57 -72
  92. package/dist/lib/gh-output.d.ts +76 -21
  93. package/dist/lib/gh-output.js +171 -90
  94. package/dist/lib/git-utils.d.ts +56 -0
  95. package/dist/lib/git-utils.js +212 -0
  96. package/dist/lib/github-context.d.ts +2 -0
  97. package/dist/lib/github-context.js +40 -8
  98. package/dist/lib/history-retention.d.ts +6 -2
  99. package/dist/lib/history-retention.js +10 -7
  100. package/dist/lib/http.d.ts +58 -134
  101. package/dist/lib/http.js +354 -291
  102. package/dist/lib/interrupt.d.ts +14 -8
  103. package/dist/lib/interrupt.js +28 -10
  104. package/dist/lib/junit-report.d.ts +57 -4
  105. package/dist/lib/junit-report.js +202 -32
  106. package/dist/lib/local-target.d.ts +8 -7
  107. package/dist/lib/local-target.js +14 -13
  108. package/dist/lib/output.d.ts +2 -41
  109. package/dist/lib/output.js +13 -51
  110. package/dist/lib/pagination.d.ts +2 -5
  111. package/dist/lib/pagination.js +2 -5
  112. package/dist/lib/presigned-url.d.ts +22 -0
  113. package/dist/lib/presigned-url.js +90 -0
  114. package/dist/lib/prompt.js +36 -2
  115. package/dist/lib/proxy.js +2 -1
  116. package/dist/lib/redact.d.ts +2 -2
  117. package/dist/lib/redact.js +3 -4
  118. package/dist/lib/removed-commands.d.ts +18 -0
  119. package/dist/lib/removed-commands.js +170 -0
  120. package/dist/lib/render-error.d.ts +31 -6
  121. package/dist/lib/render-error.js +88 -25
  122. package/dist/lib/response-schemas.d.ts +38 -30
  123. package/dist/lib/response-schemas.js +207 -207
  124. package/dist/lib/result/api.d.ts +24 -0
  125. package/dist/lib/result/api.js +28 -0
  126. package/dist/lib/result/evidence.d.ts +73 -0
  127. package/dist/lib/result/evidence.js +422 -0
  128. package/dist/lib/result/render.d.ts +20 -0
  129. package/dist/lib/result/render.js +194 -0
  130. package/dist/lib/result/types.d.ts +122 -0
  131. package/dist/lib/result/types.js +19 -0
  132. package/dist/lib/run-output.d.ts +275 -0
  133. package/dist/lib/run-output.js +227 -0
  134. package/dist/lib/run-render.d.ts +101 -0
  135. package/dist/lib/run-render.js +183 -0
  136. package/dist/lib/run-wait.d.ts +192 -0
  137. package/dist/lib/run-wait.js +452 -0
  138. package/dist/lib/runs.types.d.ts +118 -367
  139. package/dist/lib/runs.types.js +0 -14
  140. package/dist/lib/secret-file.d.ts +1 -1
  141. package/dist/lib/secret-file.js +11 -2
  142. package/dist/lib/skill-nudge.d.ts +7 -27
  143. package/dist/lib/skill-nudge.js +9 -37
  144. package/dist/lib/target-path.d.ts +15 -0
  145. package/dist/lib/target-path.js +35 -0
  146. package/dist/lib/target-url-advisory.d.ts +19 -0
  147. package/dist/lib/target-url-advisory.js +31 -0
  148. package/dist/lib/target-url-preflight.d.ts +9 -0
  149. package/dist/lib/target-url-preflight.js +214 -106
  150. package/dist/lib/target-url.d.ts +8 -8
  151. package/dist/lib/target-url.js +14 -24
  152. package/dist/lib/telemetry.d.ts +35 -15
  153. package/dist/lib/telemetry.js +38 -9
  154. package/dist/lib/terminal-text.d.ts +41 -0
  155. package/dist/lib/terminal-text.js +127 -0
  156. package/dist/lib/testlist.types.d.ts +16 -8
  157. package/dist/lib/testlist.types.js +1 -1
  158. package/dist/lib/text-equality.d.ts +2 -0
  159. package/dist/lib/text-equality.js +5 -0
  160. package/dist/lib/text-file.d.ts +16 -0
  161. package/dist/lib/text-file.js +41 -0
  162. package/dist/lib/text-table.d.ts +46 -0
  163. package/dist/lib/text-table.js +72 -4
  164. package/dist/lib/ticker.d.ts +9 -2
  165. package/dist/lib/ticker.js +16 -3
  166. package/dist/lib/transport-failure.d.ts +22 -0
  167. package/dist/lib/transport-failure.js +126 -0
  168. package/dist/lib/tunnel-session.d.ts +8 -2
  169. package/dist/lib/tunnel-session.js +24 -11
  170. package/dist/lib/update-check.js +3 -2
  171. package/dist/lib/url-template.d.ts +43 -0
  172. package/dist/lib/url-template.js +151 -0
  173. package/dist/lib/validate.d.ts +0 -64
  174. package/dist/lib/validate.js +2 -131
  175. package/dist/lib/version-notice.js +4 -3
  176. package/dist/lib/wait-exit.d.ts +37 -2
  177. package/dist/lib/wait-exit.js +88 -30
  178. package/dist/lib/workspace-status.js +10 -2
  179. package/dist/version.d.ts +1 -1
  180. package/dist/version.js +1 -1
  181. package/package.json +2 -3
  182. package/skills/testsprite-ci.skill.md +52 -23
  183. package/skills/testsprite-onboard.skill.md +70 -153
  184. package/skills/testsprite-verify.codex.md +54 -58
  185. package/skills/testsprite-verify.skill.md +189 -358
  186. package/dist/lib/browser.d.ts +0 -6
  187. package/dist/lib/browser.js +0 -54
  188. package/dist/lib/bundle.d.ts +0 -234
  189. package/dist/lib/bundle.js +0 -781
  190. package/dist/lib/deprecate.d.ts +0 -32
  191. package/dist/lib/deprecate.js +0 -39
  192. package/dist/lib/flaky.d.ts +0 -91
  193. package/dist/lib/flaky.js +0 -71
  194. package/dist/lib/plan-poll.d.ts +0 -171
  195. package/dist/lib/plan-poll.js +0 -441
  196. package/dist/lib/plans.types.d.ts +0 -130
  197. package/dist/lib/plans.types.js +0 -31
  198. package/dist/lib/poll.d.ts +0 -100
  199. package/dist/lib/poll.js +0 -290
  200. package/dist/lib/rate-throttle.d.ts +0 -49
  201. package/dist/lib/rate-throttle.js +0 -75
  202. package/dist/lib/run-progress.d.ts +0 -41
  203. package/dist/lib/run-progress.js +0 -56
  204. package/dist/lib/v3-advisory.d.ts +0 -55
  205. package/dist/lib/v3-advisory.js +0 -74
  206. package/schemas/plan.schema.json +0 -61
@@ -1,55 +1,45 @@
1
1
  /**
2
2
  * "You have a project, but no tests yet" signposts.
3
3
  *
4
- * A user who is not driving a coding agent otherwise never learns that
5
- * `test plan generate` exists: `project create` used to print the record and
6
- * stop, and the empty-project outputs said only "No tests." Every variant also
7
- * names the hand-authored fallback, because an account not yet on the new
8
- * platform is refused by generate and pointed at the Portal.
4
+ * Tests are written by the project's agent: `testsprite plan` asks it for
5
+ * tests and `testsprite apply` saves what it proposes. A user who is not
6
+ * driving a coding agent otherwise never learns that: `project create` would
7
+ * print the record and stop, and the empty-project outputs would say only
8
+ * "No tests."
9
9
  *
10
10
  * Text mode only at every call site: a JSON caller already holds the project
11
11
  * id, and stdout and the JSON error envelope must stay unchanged. Never under
12
12
  * --dry-run (the id there is the canned sample). Printing a hint runs and
13
- * charges nothing; the generation it points at does use credits.
13
+ * charges nothing.
14
14
  *
15
15
  * Zero requests: each call site branches only on what it already knows.
16
- * `project create` knows the type and whether the app is local; `test run
17
- * --all --local` knows it is local. `test list` and a cloud `test run --all`
18
- * know neither, so their sentence names the backend prerequisite as a clause
19
- * and leaves a local project to the backend's own pre-charge refusal, which
20
- * carries the same hand-written-plan next step.
16
+ * `project create` knows the type; a project run on a local environment knows
17
+ * the app is on this machine. `test list` and a cloud `run --project` know neither, so
18
+ * their sentence names the backend API spec as a clause.
21
19
  */
22
- import { type StoredLocalTarget } from './local-target.js';
23
20
  /**
24
- * How the run that found the project empty chose its local target, so the
25
- * suggested `test run` reaches the same app with the same environment:
26
- * `port`/`host` only for an explicit `--local`, `targetUrl` for an explicit
27
- * `--target-url`, and `environment` for `--env` or the saved environment the
28
- * tunnel was resolved from.
21
+ * The local environment the run that found the project empty was going to: its
22
+ * name, and whether it is the project's default. The agent explores the default
23
+ * unless the request names another, so the planning advice names it otherwise.
29
24
  */
30
25
  export type LocalHint = {
31
- host?: StoredLocalTarget['host'];
32
- port?: number;
33
- targetUrl?: string;
34
26
  environment?: string;
27
+ isDefault?: boolean;
35
28
  };
36
- export declare const FIRST_SUITE_FALLBACK = "testsprite test create --plan-template";
37
29
  /**
38
- * Multi-line `[hint]` block for stderr after a real `project create` of a
39
- * deployed (non-`--local`) project. A `--local` project gets no hint here:
40
- * its text record already ends with the hand-written-plan next steps (plan
41
- * generation explores from the cloud with no tunnel, and the backend refuses
42
- * it for a local-origin project before any charge), and two "Next" blocks
43
- * would disagree.
30
+ * Multi-line `[hint]` block for stderr after a real `project create` (text
31
+ * mode): a new project has no environment and no tests, so it names both
32
+ * steps. A web app may be on this machine rather than deployed, so a frontend
33
+ * project is shown the local environment too; an API runs from the cloud only.
44
34
  */
45
- export declare function firstSuiteNextSteps(projectId: string, type: string): string;
35
+ export declare function firstSuiteNextSteps(wireProjectId: string, type: string): string;
46
36
  /**
47
37
  * One sentence for an EMPTY project; folded into an error message or a hint.
48
38
  *
49
39
  * Pass `local` only where the caller knows the project runs on this machine
50
- * (`test run --all --local`); see the module comment for why the other
40
+ * (a project run on a local environment); see the module comment for why the other
51
41
  * callers cannot.
52
42
  */
53
- export declare function emptyProjectNextStep(projectId: string, local?: LocalHint | null): string;
43
+ export declare function emptyProjectNextStep(wireProjectId: string, local?: LocalHint | null): string;
54
44
  /** The same sentence as a stderr `[hint]` line. */
55
45
  export declare function emptyProjectHint(projectId: string, local?: LocalHint | null): string;
@@ -1,98 +1,83 @@
1
1
  /**
2
2
  * "You have a project, but no tests yet" signposts.
3
3
  *
4
- * A user who is not driving a coding agent otherwise never learns that
5
- * `test plan generate` exists: `project create` used to print the record and
6
- * stop, and the empty-project outputs said only "No tests." Every variant also
7
- * names the hand-authored fallback, because an account not yet on the new
8
- * platform is refused by generate and pointed at the Portal.
4
+ * Tests are written by the project's agent: `testsprite plan` asks it for
5
+ * tests and `testsprite apply` saves what it proposes. A user who is not
6
+ * driving a coding agent otherwise never learns that: `project create` would
7
+ * print the record and stop, and the empty-project outputs would say only
8
+ * "No tests."
9
9
  *
10
10
  * Text mode only at every call site: a JSON caller already holds the project
11
11
  * id, and stdout and the JSON error envelope must stay unchanged. Never under
12
12
  * --dry-run (the id there is the canned sample). Printing a hint runs and
13
- * charges nothing; the generation it points at does use credits.
13
+ * charges nothing.
14
14
  *
15
15
  * Zero requests: each call site branches only on what it already knows.
16
- * `project create` knows the type and whether the app is local; `test run
17
- * --all --local` knows it is local. `test list` and a cloud `test run --all`
18
- * know neither, so their sentence names the backend prerequisite as a clause
19
- * and leaves a local project to the backend's own pre-charge refusal, which
20
- * carries the same hand-written-plan next step.
16
+ * `project create` knows the type; a project run on a local environment knows
17
+ * the app is on this machine. `test list` and a cloud `run --project` know neither, so
18
+ * their sentence names the backend API spec as a clause.
21
19
  */
22
- import { quoteEnvironmentName } from './environment-tunnel.js';
23
- import { DEFAULT_LOCAL_HOST } from './local-target.js';
24
- export const FIRST_SUITE_FALLBACK = 'testsprite test create --plan-template';
20
+ import { terminalSafeLine } from './terminal-text.js';
25
21
  /**
26
- * `test run <test-id>` with the target flags the empty run was given. A bare
27
- * `test run` would resolve the project's DEFAULT environment, which may be a
28
- * deployed site rather than the app on this machine, so the environment is
29
- * always named when one was used. `--local-host` is carried whenever the host
30
- * is not the default: without it a `::1` or `localhost` app would be run
31
- * against 127.0.0.1.
22
+ * Multi-line `[hint]` block for stderr after a real `project create` (text
23
+ * mode): a new project has no environment and no tests, so it names both
24
+ * steps. A web app may be on this machine rather than deployed, so a frontend
25
+ * project is shown the local environment too; an API runs from the cloud only.
32
26
  */
33
- function localRunCommand(local) {
34
- const flags = [];
35
- if (local.targetUrl !== undefined) {
36
- flags.push(`--target-url ${shellWord(local.targetUrl)}`);
37
- }
38
- else if (local.port !== undefined) {
39
- flags.push(`--local ${local.port}`);
40
- if (local.host !== undefined && local.host !== DEFAULT_LOCAL_HOST)
41
- flags.push(`--local-host ${local.host}`);
42
- }
43
- if (local.environment !== undefined)
44
- flags.push(`--env ${quoteEnvironmentName(local.environment)}`);
45
- return ['testsprite test run <test-id>', ...flags].join(' ');
46
- }
47
- /** A URL as one shell word: as typed when it is plain, single-quoted otherwise. */
48
- function shellWord(value) {
49
- return /^[\w.:/@%+=,~-]+$/.test(value) ? value : quoteEnvironmentName(value);
50
- }
51
- /**
52
- * Multi-line `[hint]` block for stderr after a real `project create` of a
53
- * deployed (non-`--local`) project. A `--local` project gets no hint here:
54
- * its text record already ends with the hand-written-plan next steps (plan
55
- * generation explores from the cloud with no tunnel, and the backend refuses
56
- * it for a local-origin project before any charge), and two "Next" blocks
57
- * would disagree.
58
- */
59
- export function firstSuiteNextSteps(projectId, type) {
60
- const backend = type === 'backend';
61
- const lead = backend
62
- ? 'Next: upload your API spec, then let TestSprite propose your first tests (uses credits), review them, then accept:'
63
- : 'Next: let TestSprite propose your first tests (uses credits), review them, then accept:';
64
- const steps = [
65
- ...(backend ? [`testsprite project docs upload <api-spec.yaml> --project ${projectId}`] : []),
66
- `testsprite test plan generate --project ${projectId}`,
67
- `testsprite test plan accept --project ${projectId}`,
68
- ];
27
+ export function firstSuiteNextSteps(wireProjectId, type) {
28
+ const projectId = terminalSafeLine(wireProjectId);
29
+ const env = type === 'backend'
30
+ ? `testsprite project env create ${projectId} --name default --url https://api.example.com`
31
+ : `testsprite project env create ${projectId} --name default --url https://app.example.com`;
32
+ const plan = type === 'backend'
33
+ ? `testsprite plan --project ${projectId} --file <api-spec.yaml>`
34
+ : `testsprite plan --project ${projectId}`;
69
35
  return [
70
- `[hint] ${lead}`,
71
- ...steps.map(s => ` ${s}`),
72
- ` Prefer to write one yourself: ${FIRST_SUITE_FALLBACK}`,
36
+ '[hint] Next: give the project an environment, then ask its agent for your first tests and apply them:',
37
+ ` ${env}`,
38
+ ...(type === 'backend'
39
+ ? []
40
+ : [
41
+ ` (an app on this machine: testsprite project env create ${projectId} --name local --url http://localhost:<port>)`,
42
+ ]),
43
+ ` ${plan}`,
44
+ ' testsprite apply',
73
45
  ].join('\n');
74
46
  }
75
47
  /**
76
48
  * One sentence for an EMPTY project; folded into an error message or a hint.
77
49
  *
78
50
  * Pass `local` only where the caller knows the project runs on this machine
79
- * (`test run --all --local`); see the module comment for why the other
51
+ * (a project run on a local environment); see the module comment for why the other
80
52
  * callers cannot.
81
53
  */
82
- export function emptyProjectNextStep(projectId, local) {
54
+ export function emptyProjectNextStep(wireProjectId, local) {
55
+ const projectId = terminalSafeLine(wireProjectId);
83
56
  if (local) {
84
- return (`This project has no tests yet, and plan generation cannot reach an app on your machine yet. ` +
85
- `Write a plan yourself: ${FIRST_SUITE_FALLBACK} > first.plan.json, ` +
86
- `set projectId to ${projectId} in it and edit the steps, create it with ` +
87
- `testsprite test create --plan-from first.plan.json, ` +
88
- `then run it with ${localRunCommand(local)}`);
57
+ const plan = local.environment !== undefined && local.isDefault === false
58
+ ? `testsprite plan "<what to test> on the ${nameForCommand(local.environment)} environment" --project ${projectId}`
59
+ : `testsprite plan --project ${projectId}`;
60
+ // No run command: `apply` prints the one for what it saves.
61
+ return (`This project has no tests yet. Ask the project's agent for a first set; its browser ` +
62
+ `opens the app on your machine through a tunnel, so keep testsprite tunnel start ` +
63
+ `running in another terminal: ${plan}, then testsprite apply`);
89
64
  }
90
- return (`This project has no tests yet. Get a first set: ` +
91
- `testsprite test plan generate --project ${projectId}, then ` +
92
- `testsprite test plan accept --project ${projectId} ` +
93
- `(generation uses credits; a backend project needs its API spec uploaded first: ` +
94
- `testsprite project docs upload <spec> --project ${projectId}). ` +
95
- `Or write one yourself: ${FIRST_SUITE_FALLBACK}`);
65
+ return (`This project has no tests yet. Ask the project's agent for a first set: ` +
66
+ `testsprite plan --project ${projectId}, then testsprite apply ` +
67
+ `(a backend project: attach its API spec with --file <spec>)`);
68
+ }
69
+ /**
70
+ * An environment name for inside the double-quoted request above, or a
71
+ * placeholder. Anyone who can edit the project's environments names them, and
72
+ * no escape is safe in every shell: inside double quotes a POSIX shell runs
73
+ * `$(…)` and backticks, PowerShell runs `$(…)` and escapes with a backtick, and
74
+ * cmd expands `%…%`. Letters, digits, spaces, `.`, `_` and `-` mean nothing to
75
+ * any of them, so such a name goes in as written; any other is the user's to
76
+ * type.
77
+ */
78
+ function nameForCommand(name) {
79
+ const shown = terminalSafeLine(name);
80
+ return /^[\p{L}\p{N} ._-]+$/u.test(shown) ? shown : '<environment name>';
96
81
  }
97
82
  /** The same sentence as a stderr `[hint]` line. */
98
83
  export function emptyProjectHint(projectId, local) {
@@ -2,11 +2,11 @@ import type { ExecutionReport } from './runs.types.js';
2
2
  /**
3
3
  * CI-native output layer for the run path (issue #99, reshaped from
4
4
  * the withdrawn top-level `ci` command per the #264 review). Covers both a
5
- * single `test run <test-id> --wait` and the `test run --all --wait` batch.
5
+ * single `run <test-id> --wait` and the `run --project --wait` batch.
6
6
  *
7
7
  * A `--wait` run presents its result in the formats CI consumes:
8
- * (a) a stable machine summary `{total, passed, failed, skipped, timedOut,
9
- * runs[]}` written to `--summary-file <path>` when requested,
8
+ * (a) a stable machine summary `{total, passed, failed, blocked?, skipped, timedOut,
9
+ * results[]}` written to `--summary-file <path>` when requested,
10
10
  * (b) a Markdown results table appended to `$GITHUB_STEP_SUMMARY` when
11
11
  * running under GitHub Actions,
12
12
  * (c) one workflow-command line per non-passed run so it annotates the PR
@@ -18,14 +18,24 @@ import type { ExecutionReport } from './runs.types.js';
18
18
  * summary file must never mask the batch gate's exit code.
19
19
  */
20
20
  export interface CiRunRow {
21
- testId: string;
21
+ /** Absent for an execution diagnostic or a result without a case key. */
22
+ testId?: string;
22
23
  /** Human title for the Test column; falls back to `testId` when absent. */
23
24
  title?: string;
25
+ /**
26
+ * The result id (wire name), written out as `resultId`. On a row that never
27
+ * dispatched because the test was already running, it is that run's result.
28
+ */
29
+ resultId?: string;
30
+ /**
31
+ * The launch the result belongs to (wire name), written out as `runId`.
32
+ * Absent on an older backend.
33
+ */
24
34
  runId?: string;
25
35
  status: string;
26
36
  /** Test-case page link — anchors the Test column title. */
27
37
  dashboardUrl?: string;
28
- /** This run's execution-result page link — anchors the Run column. */
38
+ /** This result's own page link — anchors the Result column. */
29
39
  executionUrl?: string;
30
40
  error?: string;
31
41
  }
@@ -33,22 +43,39 @@ export interface CiSummary {
33
43
  total: number;
34
44
  passed: number;
35
45
  failed: number;
46
+ /** Disjoint from failed. Absent when no test was blocked. */
47
+ blocked?: number;
48
+ cancelled?: number;
49
+ /** Result-level read errors or unknown verdicts. */
50
+ errors?: number;
36
51
  /**
37
52
  * Requested tests that never dispatched (deferred / conflict / not_found /
38
53
  * skipped / no_tests rows). Kept OUT of `failed`: `failed` claiming
39
54
  * a test failed while the exit code says otherwise is the artifacts-disagree
40
55
  * bug this field fixes. Non-dispatch still gates the exit where it should
41
- * (deferred → 7, all-conflict → 6, all-not-found rerun → 4, zero-dispatch → 5).
56
+ * (deferred → 7, all-conflict → 6, not-found → 4, zero-dispatch → 5).
42
57
  */
43
58
  skipped: number;
44
59
  timedOut: number;
45
- runs: CiRunRow[];
60
+ /** Present when a wait ends with dispatched tests still running. */
61
+ running?: number;
62
+ /**
63
+ * One row per requested test. Not `runs`: in what the CLI prints, `runs[]`
64
+ * is the launches, each with its results.
65
+ */
66
+ results: CiRunRow[];
46
67
  /**
47
68
  * The server's execution report (the GitHub App comment content) when the
48
- * backend could provide one for this batch. Absent otherwise — never null —
49
- * so a summary from an older backend is byte-identical to before.
69
+ * backend could provide one for this batch: absent, never null, on an older
70
+ * backend or when no report arrived in time.
50
71
  */
51
72
  executionReport?: ExecutionReport;
73
+ /** Execution-level failures that cannot be inferred from individual result verdicts. */
74
+ runFailures?: Array<{
75
+ runId: string;
76
+ status: 'cancelled' | 'error' | 'timeout';
77
+ message: string;
78
+ }>;
52
79
  }
53
80
  export declare function isNonDispatchedStatus(status: string): boolean;
54
81
  /**
@@ -64,18 +91,27 @@ export declare function isNonDispatchedStatus(status: string): boolean;
64
91
  * gates' call, and a `failed` count the gates disagree with is exactly the
65
92
  * artifacts-contradict-the-exit bug.
66
93
  *
67
- * `skippedFrontend` / `skippedIntegration` are folded in only under
68
- * `foldSkippedBuckets` (the `ci run` contract: ONE skipped number covering
69
- * everything requested but not run). Default off — for `test run --all` they
70
- * exit 0 and are the Action layer's allow-partial concern, and changing that
71
- * default would silently change its artifacts.
94
+ * `foldSkippedBuckets` (the `ci run` contract) keeps a `not_found` conflict's
95
+ * own status so the `ci run` gate can exit 4 for it. Default off — for
96
+ * `run --project` it stays a conflict row, and changing that default would
97
+ * silently change its artifacts.
72
98
  */
73
99
  export declare function summarizeAcceptedPayload(capturedJson: string, opts?: {
74
100
  notFoundNote?: string;
75
101
  foldSkippedBuckets?: boolean;
76
102
  }): CiSummary;
103
+ /** Summarize the known results together with members the server did not dispatch. */
104
+ export declare function summarizeRunRows(results: CiRunRow[], payload?: {
105
+ conflicts?: unknown;
106
+ skipped?: unknown;
107
+ deferred?: unknown;
108
+ notFound?: unknown;
109
+ }, opts?: {
110
+ notFoundNote?: string;
111
+ foldSkippedBuckets?: boolean;
112
+ }): CiSummary;
77
113
  /**
78
- * Reduce a single `test run <test-id> --wait` result into the same CI summary
114
+ * Reduce a single `run <test-id> --wait` result into the same CI summary
79
115
  * shape as the batch path, so `--gh-output` / `--summary-file` behave
80
116
  * identically for a one-test CI job. Unlike the batch envelope, a single
81
117
  * RunResponse carries `error` as a raw string (not `{ message }`) and
@@ -84,14 +120,32 @@ export declare function summarizeAcceptedPayload(capturedJson: string, opts?: {
84
120
  export declare function summarizeSingleRun(run: {
85
121
  testId?: string;
86
122
  testTitle?: string | null;
123
+ resultId?: string;
87
124
  runId?: string;
88
125
  status?: string;
89
126
  dashboardUrl?: string | null;
90
127
  executionUrl?: string | null;
91
128
  error?: string | null;
92
129
  }): CiSummary;
93
- /** Markdown table for the GitHub job summary. */
130
+ export declare function formatFailureCounts(summary: CiSummary): string;
131
+ /**
132
+ * Markdown table for the GitHub job summary: the launch (or launches) the
133
+ * dispatched tests belong to on a line of its own when the backend named one,
134
+ * then one row per test with its result. A test that never dispatched because
135
+ * it was already running names that other run's result, whose launch is not
136
+ * this run and is left off the line.
137
+ */
94
138
  export declare function renderJobSummaryMarkdown(summary: CiSummary): string;
139
+ /**
140
+ * Escape a value destined for the DATA half of a workflow command (the text
141
+ * after `::`). Per GitHub's rules, `%`, CR and LF are percent-encoded so a raw
142
+ * multiline run error can never introduce a newline that starts a second
143
+ * `::command::` line in the Actions output stream (`%` first, so the encodings
144
+ * we add are not themselves re-encoded). The line is printed to a log a
145
+ * terminal or the Actions viewer shows, so the server's text loses its escape
146
+ * sequences and control characters ({@link terminalSafe}) once CR is encoded.
147
+ */
148
+ export declare function escapeCommandData(value: string): string;
95
149
  /**
96
150
  * Emit the GitHub-native surfaces. Self-gating on the standard env vars:
97
151
  * `$GITHUB_STEP_SUMMARY` (a file path Actions provides) receives the Markdown
@@ -128,13 +182,13 @@ export declare function emitGithubOutputs(summary: CiSummary, env: NodeJS.Proces
128
182
  * Emit the CI artifacts for a `--wait` run: the machine summary file (when
129
183
  * `--summary-file` is set) and the GitHub-native annotations + job-summary table
130
184
  * (when `--gh-output` or `GITHUB_ACTIONS=true`). One shared implementation for
131
- * every `--wait` command — `test run` (single + `--all`), `test rerun`, and
132
- * `testlist run` — so the four copies of this block can no longer drift (a
185
+ * every `--wait` command — `run` (single + `--all`) and `run --testlist` —
186
+ * so the copies of this block can no longer drift (a
133
187
  * per-copy fix like the `notFound` fold reaching only one of them is what this
134
188
  * consolidates away). The caller reduces its own envelope to a `CiSummary` first
135
189
  * (`summarizeAcceptedPayload` for a batch, `summarizeSingleRun` for one run);
136
190
  * this owns only the two sinks and their best-effort writes. `label` names the
137
- * command in the failure messages (`[run]` / `[rerun]` / `[testlist run]`).
191
+ * command in the failure messages (`[run]` / `[ci run]` / `[testlist]`).
138
192
  * Both writes are best-effort — a sink throwing must never change the exit code.
139
193
  */
140
194
  export declare function emitCiArtifacts(summary: CiSummary, opts: {
@@ -152,6 +206,7 @@ export declare function emitCiArtifacts(summary: CiSummary, opts: {
152
206
  * Hand the execution report to later steps: its JSON and Markdown are written
153
207
  * under `$RUNNER_TEMP` (else the OS temp dir) and their paths appended to
154
208
  * `$GITHUB_OUTPUT` as `execution-report-file` / `execution-report-markdown-file`.
209
+ * The JSON names the launch the report describes `runId`, as the summary does.
155
210
  * Paths, not bodies — a step output is capped at 1 MiB and multi-line values
156
211
  * need heredoc escaping. No-op without `GITHUB_OUTPUT` (nothing can consume
157
212
  * them). Best-effort: a write failure is reported and never masks the gate.
@@ -169,7 +224,7 @@ export declare function emitExecutionReportOutputs(ready: {
169
224
  /**
170
225
  * The job-summary Markdown for a batch that has a server execution report.
171
226
  *
172
- * The exit code comes from the CLI's own poll of every run plus whatever did
227
+ * The exit code comes from the CLI's own execution waits plus whatever did
173
228
  * not dispatch; the report describes only the execution. Usually they agree
174
229
  * and the summary is the report, byte for byte the App's comment. When they
175
230
  * do not — a run the CLI could not read or that timed out, a test refused
@@ -182,7 +237,7 @@ export declare function reconcileExecutionReportMarkdown(summary: CiSummary, rea
182
237
  report: ExecutionReport;
183
238
  markdown: string;
184
239
  }): string;
185
- /** Numeric step outputs share the exact counters used by every other CI sink. */
240
+ /** Keep the historical failed step output for existing Actions gates. */
186
241
  export declare function emitCiStepOutputs(summary: CiSummary, io: {
187
242
  env: NodeJS.ProcessEnv;
188
243
  stderr: (line: string) => void;