@testsprite/testsprite-cli 0.16.0 → 0.17.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 +51 -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 +38 -54
  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 +702 -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 +388 -37
  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 +15 -186
  19. package/dist/commands/project.js +89 -924
  20. package/dist/commands/result.d.ts +10 -0
  21. package/dist/commands/result.js +215 -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 -1816
  25. package/dist/commands/test.js +1951 -13902
  26. package/dist/commands/testlist.d.ts +128 -5
  27. package/dist/commands/testlist.js +269 -339
  28. package/dist/commands/tunnel.d.ts +2 -2
  29. package/dist/commands/tunnel.js +23 -19
  30. package/dist/commands/usage.d.ts +12 -45
  31. package/dist/commands/usage.js +50 -131
  32. package/dist/index.js +182 -104
  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 +10 -2
  45. package/dist/lib/client-factory.js +38 -26
  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 +71 -0
  56. package/dist/lib/conversation/api.js +150 -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 +19 -0
  60. package/dist/lib/conversation/context.js +70 -0
  61. package/dist/lib/conversation/environment.d.ts +15 -0
  62. package/dist/lib/conversation/environment.js +33 -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 +315 -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 +156 -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 +71 -0
  77. package/dist/lib/download.js +274 -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 +16 -27
  83. package/dist/lib/environment-tunnel.js +161 -154
  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 +16 -22
  91. package/dist/lib/first-suite-hint.js +38 -47
  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 +352 -289
  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 +3 -3
  107. package/dist/lib/local-target.js +3 -3
  108. package/dist/lib/output.d.ts +1 -40
  109. package/dist/lib/output.js +11 -49
  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 +154 -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 +71 -0
  127. package/dist/lib/result/evidence.js +420 -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 +1 -1
  151. package/dist/lib/target-url.js +6 -16
  152. package/dist/lib/telemetry.d.ts +31 -11
  153. package/dist/lib/telemetry.js +37 -8
  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 +7 -1
  169. package/dist/lib/tunnel-session.js +22 -9
  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 +48 -18
  183. package/skills/testsprite-onboard.skill.md +66 -151
  184. package/skills/testsprite-verify.codex.md +50 -52
  185. package/skills/testsprite-verify.skill.md +184 -351
  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,21 +1,22 @@
1
1
  /**
2
- * `testsprite init` — one-shot onboarding orchestrator.
2
+ * `testsprite setup` — one-shot onboarding orchestrator.
3
3
  *
4
4
  * Chains, in order:
5
5
  * 0. Agent-target resolution + confirmation prompt — the chosen install
6
6
  * targets are settled here, before anything is written
7
7
  * 1. runConfigure — writes the API-key profile (validates via GET /me first)
8
8
  * 2. runWhoami — fetches identity for the post-configure banner
9
+ * 2.5 ensureTestspriteIgnored — appends .testsprite/ to .gitignore inside a Git repo (unless --no-gitignore)
9
10
  * 3. runInstall — installs the TestSprite verification-loop skill (unless --no-agent)
10
11
  * 4. Summary print — JSON object or human text block
11
12
  *
12
13
  * Hard constraint: orchestrate existing exported primitives; never fork them.
13
14
  */
15
+ import path from 'node:path';
14
16
  import { Command } from 'commander';
15
17
  import { parseRequestTimeoutFlag, } from '../lib/client-factory.js';
16
18
  import { normalizeEnvVar, resolveProfileName } from '../lib/config.js';
17
- import { emitDeprecationNotice } from '../lib/deprecate.js';
18
- import { CLIError, InterruptError, localValidationError } from '../lib/errors.js';
19
+ import { ApiError, CLIError, InterruptError, localValidationError } from '../lib/errors.js';
19
20
  import { GLOBAL_OPTS_HINT, Output, resolveOutputMode } from '../lib/output.js';
20
21
  import { missingApiKeyError, runConfigure, runWhoami } from './auth.js';
21
22
  import { runInstall } from './agent.js';
@@ -23,6 +24,8 @@ import { TARGETS, DEFAULT_SKILLS } from '../lib/agent-targets.js';
23
24
  import { FALLBACK_TARGET, resolveAgentTargets, } from '../lib/agent-detect.js';
24
25
  import { promptText } from '../lib/prompt.js';
25
26
  import { readProfile } from '../lib/credentials.js';
27
+ import { ensureTestspriteIgnored, checkTestspriteIgnored, isInsideGitRepoAsync, } from '../lib/git-utils.js';
28
+ import { terminalSafeLine, terminalSafeWriter } from '../lib/terminal-text.js';
26
29
  /** Mirrors auth.ts's DEFAULT_API_URL (kept in sync; auth.ts owns the canonical value). */
27
30
  const DEFAULT_API_URL = 'https://api.testsprite.com';
28
31
  /**
@@ -33,14 +36,18 @@ const DEFAULT_API_URL = 'https://api.testsprite.com';
33
36
  * configuring staging/dev (codex). On the real path this runs AFTER the profile
34
37
  * is written, so the persisted apiUrl is reflected faithfully.
35
38
  */
36
- function resolveReportedEndpoint(opts, deps) {
39
+ function resolveReportedEndpoint(opts, deps, stderrFn) {
37
40
  const env = deps.env ?? process.env;
38
41
  const envApiUrl = normalizeEnvVar(env.TESTSPRITE_API_URL);
39
42
  let existing;
40
43
  try {
41
44
  existing = readProfile(opts.profile, { path: deps.credentialsPath })?.apiUrl;
42
45
  }
43
- catch {
46
+ catch (err) {
47
+ if (opts.debug && stderrFn) {
48
+ const reason = err instanceof Error ? err.message : String(err);
49
+ stderrFn(`[debug] resolve endpoint profile read failed: ${reason}`);
50
+ }
44
51
  existing = undefined;
45
52
  }
46
53
  return opts.endpointUrl ?? envApiUrl ?? existing ?? DEFAULT_API_URL;
@@ -153,6 +160,28 @@ function shouldConfirmTargets(resolution, opts, isTTY) {
153
160
  return fromDetection && isTTY && !opts.yes && !opts.dryRun && opts.output !== 'json';
154
161
  }
155
162
  const CONFIRM_TARGETS_MAX_ATTEMPTS = 3;
163
+ /** Resolve the project root used for the .git walk and .gitignore (relative --dir is resolved against cwd). */
164
+ function resolveProjectDir(opts, deps) {
165
+ return path.resolve(opts.dir ?? deps.cwd ?? process.cwd());
166
+ }
167
+ /** Route .gitignore access through the injected agent fs when present (tests); real fs otherwise. */
168
+ function buildGitignoreDeps(deps) {
169
+ const agentFs = deps.fs;
170
+ if (!agentFs)
171
+ return {};
172
+ return {
173
+ exists: async (p) => (await agentFs.lstat(p)) !== null,
174
+ lstat: async (p) => {
175
+ const st = await agentFs.lstat(p);
176
+ return st === null ? null : { isSymbolicLink: st.isSymbolicLink };
177
+ },
178
+ readFile: p => agentFs.readFile(p),
179
+ appendFile: async (p, text) => {
180
+ const current = (await agentFs.lstat(p)) === null ? '' : await agentFs.readFile(p);
181
+ await agentFs.writeFile(p, current + text);
182
+ },
183
+ };
184
+ }
156
185
  /**
157
186
  * Let an operator see and edit the detected set before anything is written.
158
187
  *
@@ -209,7 +238,7 @@ async function confirmDetectedTargets(resolution, opts, isTTY, stderrFn, promptF
209
238
  // runInit
210
239
  // ---------------------------------------------------------------------------
211
240
  export async function runInit(opts, deps = {}) {
212
- const stderrFn = deps.stderr ?? ((line) => process.stderr.write(`${line}\n`));
241
+ const stderrFn = terminalSafeWriter(deps.stderr);
213
242
  const out = new Output(opts.output, { stdout: deps.stdout, stderr: deps.stderr });
214
243
  // An unknown --agent is refused here, before credentials are written. Left
215
244
  // to runInstall it surfaced as a `--target` error — a flag this command does
@@ -255,7 +284,7 @@ export async function runInit(opts, deps = {}) {
255
284
  // --dry-run, which is documented to work without credentials or network.
256
285
  if (!isTTY && !hasKeySource && !skipWillApply && !opts.dryRun) {
257
286
  throw missingApiKeyError('No API key available in non-interactive mode. ' +
258
- 'Pass --api-key <key>, --from-env (reads TESTSPRITE_API_KEY), or run interactively.', resolveReportedEndpoint(opts, deps));
287
+ 'Pass --api-key <key>, --from-env (reads TESTSPRITE_API_KEY), or run interactively.', resolveReportedEndpoint(opts, deps, stderrFn));
259
288
  }
260
289
  // JSON-output guard: an interactive secret prompt writes to stdout and would
261
290
  // corrupt init's single-JSON-object output contract. In --output json mode
@@ -308,9 +337,19 @@ export async function runInit(opts, deps = {}) {
308
337
  dir: opts.dir,
309
338
  }, toAgentDeps(deps));
310
339
  }
340
+ if (!opts.noGitignore) {
341
+ const projectDir = resolveProjectDir(opts, deps);
342
+ const gitignoreDeps = buildGitignoreDeps(deps);
343
+ if (await isInsideGitRepoAsync(projectDir, gitignoreDeps)) {
344
+ const isIgnored = await checkTestspriteIgnored(projectDir, gitignoreDeps);
345
+ if (!isIgnored) {
346
+ stderrFn('[dry-run] would ignore .testsprite/ in .gitignore');
347
+ }
348
+ }
349
+ }
311
350
  const summary = {
312
351
  profile: opts.profile,
313
- apiUrl: resolveReportedEndpoint(opts, deps),
352
+ apiUrl: resolveReportedEndpoint(opts, deps, stderrFn),
314
353
  env: 'development',
315
354
  scopes: [],
316
355
  agent: resolution
@@ -366,6 +405,21 @@ export async function runInit(opts, deps = {}) {
366
405
  catch (err) {
367
406
  if (err instanceof InterruptError)
368
407
  throw err;
408
+ // `--skip-if-configured` skipped the configure-time validation, so whoami is
409
+ // the only call that ever reaches the server on this path. Swallowing its
410
+ // auth failure made `setup --skip-if-configured` print an "initialized"
411
+ // summary with exit 0 for a key that had since been revoked, and the first
412
+ // real command failed afterwards with a much less obvious error. Let the
413
+ // typed envelop through instead (AUTH_INVALID / AUTH_FORBIDDEN, exit 3).
414
+ // Scoped to the two auth codes on purpose: a malformed saved key reports
415
+ // VALIDATION_ERROR from the client factory, and that stays display-only so
416
+ // a cosmetic format complaint cannot fail an otherwise valid setup.
417
+ // Every other path still treats whoami as display-only.
418
+ if (skipWillApply &&
419
+ err instanceof ApiError &&
420
+ (err.code === 'AUTH_INVALID' || err.code === 'AUTH_FORBIDDEN')) {
421
+ throw err;
422
+ }
369
423
  // Whoami is display-only. If it fails after a successful configure,
370
424
  // continue with a minimal placeholder so the summary still prints.
371
425
  if (opts.debug) {
@@ -375,6 +429,22 @@ export async function runInit(opts, deps = {}) {
375
429
  me = { userId: '', keyId: '', scopes: [], env: 'production' };
376
430
  }
377
431
  // -------------------------------------------------------------------------
432
+ // Step 2.5: Ensure .testsprite/ is ignored in .gitignore
433
+ // -------------------------------------------------------------------------
434
+ // Runs before the agent install so a failing skill install (which re-throws)
435
+ // cannot skip it after credentials were already saved. Never blocks setup.
436
+ if (!opts.noGitignore) {
437
+ try {
438
+ const appended = await ensureTestspriteIgnored(resolveProjectDir(opts, deps), buildGitignoreDeps(deps));
439
+ if (appended) {
440
+ stderrFn('[info] Added .testsprite/ to .gitignore (failure artifacts stay local; pass --no-gitignore to skip)');
441
+ }
442
+ }
443
+ catch (err) {
444
+ stderrFn(`[warn] Failed to update .gitignore: ${err instanceof Error ? err.message : String(err)}`);
445
+ }
446
+ }
447
+ // -------------------------------------------------------------------------
378
448
  // Step 3: Agent skill install (unless --no-agent)
379
449
  // -------------------------------------------------------------------------
380
450
  let installedTargets = null;
@@ -394,7 +464,11 @@ export async function runInit(opts, deps = {}) {
394
464
  capturedInstallResults = parsed;
395
465
  }
396
466
  }
397
- catch {
467
+ catch (err) {
468
+ if (opts.debug) {
469
+ const reason = err instanceof Error ? err.message : String(err);
470
+ stderrFn(`[debug] setup agent install output parse non-JSON: ${reason}`);
471
+ }
398
472
  // ignore non-JSON lines (shouldn't happen in json mode, but be safe)
399
473
  }
400
474
  };
@@ -441,7 +515,7 @@ export async function runInit(opts, deps = {}) {
441
515
  profile: opts.profile,
442
516
  // Resolved AFTER configure persists the profile → reflects the real endpoint
443
517
  // (staging/dev/prod), not a flat prod default (codex).
444
- apiUrl: resolveReportedEndpoint(opts, deps),
518
+ apiUrl: resolveReportedEndpoint(opts, deps, stderrFn),
445
519
  env: me.env,
446
520
  email: me.email,
447
521
  scopes: me.scopes,
@@ -465,11 +539,11 @@ function renderInitText(data) {
465
539
  lines.push('');
466
540
  lines.push(` profile: ${s.profile}`);
467
541
  lines.push(` endpoint: ${s.apiUrl}`);
468
- lines.push(` env: ${s.env}`);
542
+ lines.push(` env: ${terminalSafeLine(s.env)}`);
469
543
  if (s.email)
470
- lines.push(` email: ${s.email}`);
544
+ lines.push(` email: ${terminalSafeLine(s.email)}`);
471
545
  if (s.scopes.length > 0)
472
- lines.push(` scopes: ${s.scopes.join(', ')}`);
546
+ lines.push(` scopes: ${terminalSafeLine(s.scopes.join(', '))}`);
473
547
  if (s.credentials?.persisted === false) {
474
548
  lines.push(' credentials: session-only (TESTSPRITE_API_KEY; not saved)');
475
549
  }
@@ -496,36 +570,33 @@ function renderInitText(data) {
496
570
  lines.push('');
497
571
  }
498
572
  lines.push('Next steps:');
499
- lines.push(' # 1. Create your first project (frontend example) — prints a projectId');
500
- lines.push(' testsprite project create --type frontend --name "My App" --url https://your-app.com');
573
+ lines.push(' # 1. Create your first project and say where it runs — prints a projectId');
574
+ lines.push(' testsprite project create --type frontend --name "My App"');
575
+ lines.push(' testsprite project env create <projectId> --name default --url https://your-app.com');
501
576
  lines.push('');
502
577
  if (s.agent) {
503
- lines.push(' # 2. Generate tests: ask your coding agent (the testsprite-onboard skill is installed),');
504
- lines.push(' # or have TestSprite propose them directly (uses credits), review them, then accept:');
505
- lines.push(' testsprite test plan generate --project <projectId>');
506
- lines.push(' testsprite test plan accept --project <projectId>');
578
+ lines.push(' # 2. Get tests: ask your coding agent (the testsprite-onboard skill is installed),');
579
+ lines.push(" # or ask the project's agent directly, review what it proposes, then apply it:");
580
+ lines.push(' testsprite plan --project <projectId>');
581
+ lines.push(' testsprite apply');
507
582
  lines.push('');
508
583
  lines.push(' # 3. Run them (use the projectId from step 1):');
509
- lines.push(' testsprite test run --all --project <projectId>');
584
+ lines.push(' testsprite run --project <projectId>');
510
585
  lines.push('');
511
586
  lines.push(' # Manage installed agent skills');
512
587
  lines.push(' testsprite agent list');
513
588
  lines.push(' testsprite agent install --target=<t> # re-install or install additional targets');
514
589
  }
515
590
  else {
516
- // Without an agent, this is the only place a new user learns that
517
- // TestSprite can propose the first suite. Printing this runs and charges
518
- // nothing; generating does use credits, which the line says. The
519
- // hand-authored path stays visible as the fallback.
520
- lines.push(' # 2. Let TestSprite propose your first tests (uses credits), review them, then accept:');
521
- lines.push(' # Backend project? Upload your API spec first:');
522
- lines.push(' # testsprite project docs upload ./openapi.yaml --project <projectId>');
523
- lines.push(' testsprite test plan generate --project <projectId>');
524
- lines.push(' testsprite test plan accept --project <projectId>');
525
- lines.push(' # Prefer to write one yourself: testsprite test create --plan-template');
591
+ // Without a coding agent, this is the only place a new user learns that
592
+ // the project's agent writes the first suite.
593
+ lines.push(" # 2. Ask the project's agent for your first tests, review what it proposes, then apply it:");
594
+ lines.push(' # Backend project? Attach your API spec: --file ./openapi.yaml');
595
+ lines.push(' testsprite plan --project <projectId>');
596
+ lines.push(' testsprite apply');
526
597
  lines.push('');
527
598
  lines.push(' # 3. Run them (use the projectId from step 1):');
528
- lines.push(' testsprite test run --all --project <projectId>');
599
+ lines.push(' testsprite run --project <projectId>');
529
600
  lines.push(' # Tip: `testsprite agent install` sets up the onboarding skill for your coding agent');
530
601
  lines.push('');
531
602
  lines.push(' # Manage installed agent skills');
@@ -550,18 +621,18 @@ function resolveCommonOptions(command, env) {
550
621
  }
551
622
  const SETUP_DESCRIPTION = 'Set up TestSprite: configure your API key and install the TestSprite agent skills for your coding agent';
552
623
  /**
553
- * Attach the onboarding flags shared by `setup` and the `init`/`auth configure`
554
- * aliases. `--agent` deliberately carries NO default: its absence is the signal
624
+ * Attach the onboarding flags of `setup`. `--agent` deliberately carries NO default: its absence is the signal
555
625
  * that setup should detect the agent, and a default value here is
556
626
  * indistinguishable from the caller naming that same target.
557
627
  */
558
- export function addSetupOptions(cmd, validTargets, defaultAgent) {
628
+ function addSetupOptions(cmd, validTargets, defaultAgent) {
559
629
  return cmd
560
630
  .option('--api-key <key>', 'API key to configure (skips the interactive prompt)')
561
631
  .option('--from-env', 'Read TESTSPRITE_API_KEY from the environment instead of prompting', false)
562
632
  .option('--agent <target>', `Coding-agent target to install: ${validTargets.join(', ')} ` +
563
633
  `(default: every agent detected in this project, or ${defaultAgent} if none)`)
564
634
  .option('--no-agent', 'Skip the agent skill install (configure credentials only)')
635
+ .option('--no-gitignore', 'Skip adding .testsprite/ to .gitignore')
565
636
  .option('--force', 'Overwrite an existing skill file (a .bak backup is kept)')
566
637
  .option('--dir <path>', 'Project root for the skill install (default: current directory)')
567
638
  .option('-y, --yes', 'Non-interactive: accept defaults, never prompt (needs --from-env or --api-key)')
@@ -573,6 +644,7 @@ function buildSetupOptions(cmdOpts, command, env) {
573
644
  // Commander sets `agent: false` (boolean) when `--no-agent` is passed,
574
645
  // because `--no-agent` is the negation of `--agent <target>`.
575
646
  const isNoAgent = cmdOpts.noAgent === true || cmdOpts.agent === false;
647
+ const isNoGitignore = cmdOpts.noGitignore === true || cmdOpts.gitignore === false;
576
648
  // Detect conflict when both --no-agent and --agent <target> appear in the raw
577
649
  // args. Commander only populates `rawArgs` on the ROOT command passed to
578
650
  // parseAsync; subcommands have an empty array. Walk up to the root so we
@@ -594,6 +666,7 @@ function buildSetupOptions(cmdOpts, command, env) {
594
666
  fromEnv: Boolean(cmdOpts.fromEnv),
595
667
  agent: chosenAgent,
596
668
  noAgent: isNoAgent,
669
+ noGitignore: isNoGitignore,
597
670
  force: Boolean(cmdOpts.force),
598
671
  dir: cmdOpts.dir,
599
672
  yes: Boolean(cmdOpts.yes),
@@ -601,7 +674,7 @@ function buildSetupOptions(cmdOpts, command, env) {
601
674
  rawArgConflict,
602
675
  };
603
676
  }
604
- /** Shared action for `setup` and the deprecated `init` alias. */
677
+ /** The `setup` action. */
605
678
  async function runSetupAction(cmdOpts, command, deps) {
606
679
  const opts = buildSetupOptions(cmdOpts, command, deps.env);
607
680
  // When --yes is supplied without a key source, force isTTY=false so runInit
@@ -629,35 +702,4 @@ export function createSetupCommand(deps = {}) {
629
702
  await runSetupAction(cmdOpts, command, deps);
630
703
  });
631
704
  }
632
- /**
633
- * Hidden, deprecated `init` alias → runs `setup`. Kept so existing scripts and
634
- * agents trained on the old command keep working; registered with
635
- * `{ hidden: true }` in index.ts (invisible to `--help`) and prints a
636
- * deprecation notice. (Setup consolidation.)
637
- */
638
- export function createDeprecatedInitCommand(deps = {}) {
639
- const validTargets = Object.keys(TARGETS);
640
- const defaultAgent = 'claude';
641
- return addSetupOptions(new Command('init'), validTargets, defaultAgent)
642
- .description('(deprecated) alias for `setup`')
643
- .action(async (cmdOpts, command) => {
644
- emitDeprecationNotice('init', 'setup', deps.stderr);
645
- await runSetupAction(cmdOpts, command, deps);
646
- });
647
- }
648
- /**
649
- * Entry for the hidden, deprecated `auth configure` alias. Per the setup
650
- * consolidation, `auth configure` now runs FULL setup (configure + install)
651
- * so an agent that reaches for the old command still ends up with the skill.
652
- * `setup` is the ONLY path that writes credentials.
653
- *
654
- * Accepts the SAME `SetupCmdOpts` shape `setup` does — the alias previously
655
- * only wired up `--from-env`, so README's "runs the full setup" claim didn't
656
- * hold: `--yes`/`--agent`/`--api-key`/`--force`/`--dir`/`--no-agent` were all
657
- * rejected as unknown options. `index.ts` attaches the full flag set via
658
- * `addSetupOptions` before wiring this action.
659
- */
660
- export async function runConfigureViaSetup(command, deps, cmdOpts) {
661
- await runSetupAction(cmdOpts, command, deps);
662
- }
663
705
  //# sourceMappingURL=init.js.map
@@ -25,6 +25,58 @@ export interface CliProjectEnvironment {
25
25
  enableOtp: boolean;
26
26
  updatedAt: string;
27
27
  variables?: Record<string, string>;
28
+ /**
29
+ * Backend projects only: the environment as the project's agent reads it in
30
+ * `environments/<name>.md`. Reports what is set; never a credential, password
31
+ * or secret header value.
32
+ */
33
+ api?: CliApiEnvironment;
34
+ /**
35
+ * The environment's settings in the Portal: the page opens its dialog, where a
36
+ * manual login is captured. Absent from older servers; `null` when none resolves.
37
+ */
38
+ portalUrl?: string | null;
39
+ /** Manual environments only: the login a run would use now. Absent from older servers. */
40
+ manualLogin?: CliManualLogin;
41
+ }
42
+ /** A manual environment's captured login, by the rule a run applies before it starts. */
43
+ export interface CliManualLogin {
44
+ /** `valid`, `never` (nobody has logged in yet) or `expired`. Open string, rendered verbatim. */
45
+ session: string;
46
+ capturedAt: string | null;
47
+ /** `null` until a login is captured, and for a login that never expires. */
48
+ expiresAt: string | null;
49
+ /** How long a captured login is reused, counted from the capture; `-1` never expires. */
50
+ sessionReuseTtlSeconds: number;
51
+ }
52
+ /** How runs on a backend environment sign in to the API under test, as the agent's doc says it. */
53
+ export interface CliApiEnvironment {
54
+ url: string;
55
+ /**
56
+ * `none`, a static credential's type (`bearer`, `basic`, `apikey`) or a
57
+ * sign-in (`login`, `refresh-token`, `cognito`). Open string, rendered
58
+ * verbatim.
59
+ */
60
+ auth: string;
61
+ loginUrl: string;
62
+ loginMethod: string;
63
+ loginContentType: string;
64
+ loginBody: string;
65
+ username: string;
66
+ tokenPath: string;
67
+ tokenUrl: string;
68
+ clientId: string;
69
+ scope: string;
70
+ region: string;
71
+ inject: string;
72
+ /** Header name to value; `null` when the value is a secret: set, not shown. */
73
+ headers: Record<string, string | null>;
74
+ credentialSet: boolean;
75
+ passwordSet: boolean;
76
+ clientSecretSet: boolean;
77
+ refreshTokenSet: boolean;
78
+ /** Why the last sign-in failed; empty while it signs in, or does not sign in. */
79
+ authError: string;
28
80
  }
29
81
  export interface CliProjectEnvListResponse {
30
82
  environments: CliProjectEnvironment[];
@@ -40,6 +92,14 @@ export interface CliProjectEnvDeleteResponse {
40
92
  deleted: true;
41
93
  name: string;
42
94
  }
95
+ interface ApiAuthFlags {
96
+ auth?: string;
97
+ credential?: string;
98
+ credentialFile?: string;
99
+ header?: string[];
100
+ headerFile?: string;
101
+ autoAuthFile?: string;
102
+ }
43
103
  interface EnvListOptions extends CommonOptions {
44
104
  projectId: string;
45
105
  }
@@ -47,7 +107,7 @@ export declare function runEnvList(opts: EnvListOptions, deps?: ProjectDeps): Pr
47
107
  export declare function runEnvGet(opts: EnvListOptions & {
48
108
  name: string;
49
109
  }, deps?: ProjectDeps): Promise<CliProjectEnvUpdateResponse>;
50
- interface EnvCreateOptions extends CommonOptions {
110
+ interface EnvCreateOptions extends CommonOptions, ApiAuthFlags {
51
111
  projectId: string;
52
112
  name?: string;
53
113
  url?: string;
@@ -66,7 +126,7 @@ interface EnvCreateOptions extends CommonOptions {
66
126
  sessionTtl?: string;
67
127
  }
68
128
  export declare function runEnvCreate(opts: EnvCreateOptions, deps?: ProjectDeps): Promise<CliProjectEnvCreateResponse>;
69
- interface EnvUpdateOptions extends CommonOptions {
129
+ interface EnvUpdateOptions extends CommonOptions, ApiAuthFlags {
70
130
  projectId: string;
71
131
  name: string;
72
132
  url?: string;