@testsprite/testsprite-cli 0.6.0 → 0.7.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 (50) hide show
  1. package/README.md +38 -30
  2. package/dist/commands/agent.js +44 -42
  3. package/dist/commands/doctor.d.ts +1 -1
  4. package/dist/commands/doctor.js +4 -7
  5. package/dist/commands/project.js +3 -2
  6. package/dist/commands/schedule.d.ts +120 -0
  7. package/dist/commands/schedule.js +487 -0
  8. package/dist/commands/test.d.ts +15 -1
  9. package/dist/commands/test.js +460 -256
  10. package/dist/commands/testlist.d.ts +88 -0
  11. package/dist/commands/testlist.js +747 -0
  12. package/dist/index.js +6 -2
  13. package/dist/lib/agent-targets.d.ts +13 -4
  14. package/dist/lib/agent-targets.js +11 -2
  15. package/dist/lib/conflict-reason.d.ts +30 -0
  16. package/dist/lib/conflict-reason.js +45 -0
  17. package/dist/lib/credentials.js +42 -1
  18. package/dist/lib/cron.d.ts +40 -0
  19. package/dist/lib/cron.js +190 -0
  20. package/dist/lib/dry-run/samples.js +177 -55
  21. package/dist/lib/errors.d.ts +9 -0
  22. package/dist/lib/errors.js +11 -0
  23. package/dist/lib/gh-output.d.ts +26 -1
  24. package/dist/lib/gh-output.js +47 -20
  25. package/dist/lib/http.d.ts +25 -0
  26. package/dist/lib/http.js +128 -2
  27. package/dist/lib/junit-report.d.ts +20 -2
  28. package/dist/lib/junit-report.js +38 -5
  29. package/dist/lib/proxy.d.ts +16 -0
  30. package/dist/lib/proxy.js +19 -1
  31. package/dist/lib/response-schemas.d.ts +7 -0
  32. package/dist/lib/response-schemas.js +23 -1
  33. package/dist/lib/runs.types.d.ts +8 -3
  34. package/dist/lib/secret-file.d.ts +15 -0
  35. package/dist/lib/secret-file.js +82 -0
  36. package/dist/lib/target-url-preflight.d.ts +91 -0
  37. package/dist/lib/target-url-preflight.js +259 -0
  38. package/dist/lib/target-url.d.ts +22 -5
  39. package/dist/lib/target-url.js +60 -28
  40. package/dist/lib/testlist.types.d.ts +77 -0
  41. package/dist/lib/testlist.types.js +9 -0
  42. package/dist/lib/v3-advisory.d.ts +35 -22
  43. package/dist/lib/v3-advisory.js +44 -24
  44. package/dist/lib/wait-exit.d.ts +29 -0
  45. package/dist/lib/wait-exit.js +103 -0
  46. package/dist/version-guard.d.ts +10 -7
  47. package/dist/version-guard.js +37 -9
  48. package/dist/version.d.ts +1 -1
  49. package/dist/version.js +1 -1
  50. package/package.json +1 -1
package/README.md CHANGED
@@ -116,35 +116,43 @@ Prefer to configure each step by hand (or learn the surface offline with `--dry-
116
116
 
117
117
  ## Commands
118
118
 
119
- | Group | Command | What it does |
120
- | --------- | ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
121
- | **Setup** | `setup` | **Start here** — one command: configure your API key, verify it, and install the agent verification skill |
122
- | | `doctor` | Environment diagnostic — CLI/Node versions, profile, endpoint, credentials, connectivity, agent skill; exits non-zero on failure |
123
- | **Auth** | `auth status` | Resolve the active profile to its user, key, env, and scopes |
124
- | | `auth remove` | Remove the active profile from the credentials file |
125
- | | `usage` (alias `credits`) | Account pre-flight: identity, plus credit balance / plan info when the backend supplies them |
126
- | **Read** | `project list` / `project get` | List projects / fetch one by id |
127
- | | `test list` / `test get` | List tests under a project / fetch one by id |
128
- | | `test code get` | Print (or write) the generated test source |
129
- | | `test steps` | List the latest run's steps with screenshot / DOM pointers |
130
- | | `test result` | Latest result; `--history` lists a test's prior runs |
131
- | | `test failure get` | The agent entry point: one self-contained latest-failure bundle |
132
- | | `test failure summary` | One-screen triage card (no media download) |
133
- | | `test diff` | Compare two runs — verdict, failure kind, per-step status flips, code-version drift |
134
- | **Write** | `test scaffold` / `test lint` | Author plans locally: emit a schema-correct starter, validate plan files offline — no network, no credentials |
135
- | | `test create` / `test create-batch` | Create a test (or bulk-create from a plan file); `--produces` / `--needs` / `--category` wire BE dependency metadata |
136
- | | `test update` / `test delete` / `test delete-batch` | Edit metadata and BE dependency declarations (`--produces` / `--needs` / `--category`) / permanently delete (no restore window; `--confirm` required) |
137
- | | `test code put` | Replace generated code (etag-guarded) |
138
- | | `test plan put` | Replace a frontend test's plan-steps |
139
- | | `project create` / `project update` / `project delete` | Manage projects; `delete` removes a project and everything under it (`--confirm` required, no restore window) |
140
- | | `project credential` / `project auto-auth` | Configure backend-test auth: a static injected credential, or auto-refresh login (Pro) |
141
- | **Run** | `test run` | Trigger a fresh run; `--wait` blocks until terminal; `--all --project <id>` runs all tests in a project in wave order |
142
- | | `test rerun` | Replay one/many tests (FE verbatim; BE with deps); billed as a run (0.5 credits FE / 0.2 BE); `--all --project <id>` reruns all tests |
143
- | | `test flaky` | Replay a test several times (auto-heal off) and report a stability score |
144
- | | `test wait` | Block on one or more `runId`s until terminal |
145
- | | `test cancel` | Cancel one or more in-flight runs (Ctrl-C during `--wait` only detaches — `cancel` is the real stop) |
146
- | | `test artifact get` | Download the failure bundle for a specific `runId` |
147
- | **Agent** | `agent install` / `agent list` / `agent status` | Add, list, or health-check coding-agent skills (pure-local): `claude`, `codex`, `cursor`, `cline`, `antigravity`, `kiro`, `windsurf`, `copilot` |
119
+ | Group | Command | What it does |
120
+ | -------------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
121
+ | **Setup** | `setup` | **Start here** — one command: configure your API key, verify it, and install the agent verification skill |
122
+ | | `doctor` | Environment diagnostic — CLI/Node versions, profile, endpoint, credentials, connectivity, agent skill; exits non-zero on failure |
123
+ | **Auth** | `auth status` | Resolve the active profile to its user, key, env, and scopes |
124
+ | | `auth remove` | Remove the active profile from the credentials file |
125
+ | | `usage` (alias `credits`) | Account pre-flight: identity, plus credit balance / plan info when the backend supplies them |
126
+ | **Read** | `project list` / `project get` | List projects / fetch one by id |
127
+ | | `test list` / `test get` | List tests under a project / fetch one by id |
128
+ | | `test code get` | Print (or write) the generated test source |
129
+ | | `test steps` | List the latest run's steps with screenshot / DOM pointers |
130
+ | | `test result` | Latest result; `--history` lists a test's prior runs |
131
+ | | `test failure get` | The agent entry point: one self-contained latest-failure bundle |
132
+ | | `test failure summary` | One-screen triage card (no media download) |
133
+ | | `test diff` | Compare two runs — verdict, failure kind, per-step status flips, code-version drift |
134
+ | **Write** | `test scaffold` / `test lint` | Author plans locally: emit a schema-correct starter, validate plan files offline — no network, no credentials |
135
+ | | `test create` / `test create-batch` | Create a test (or bulk-create from a plan file); `--produces` / `--needs` / `--category` wire BE dependency metadata |
136
+ | | `test update` / `test delete` / `test delete-batch` | Edit metadata and BE dependency declarations (`--produces` / `--needs` / `--category`) / permanently delete (no restore window; `--confirm` required) |
137
+ | | `test code put` | Replace generated code (etag-guarded) |
138
+ | | `test plan put` | Replace a frontend test's plan-steps |
139
+ | | `project create` / `project update` / `project delete` | Manage projects; `delete` removes a project and everything under it (`--confirm` required, no restore window) |
140
+ | | `project credential` / `project auto-auth` | Configure backend-test auth: a static injected credential, or auto-refresh login (Pro) |
141
+ | **Run** | `test run` | Trigger a fresh run; `--wait` blocks until terminal; `--all --project <id>` runs all tests in a project in wave order |
142
+ | | `test rerun` | Replay one/many tests (FE verbatim; BE with deps); billed as a run (0.5 credits FE / 0.2 BE); `--all --project <id>` reruns all tests |
143
+ | | `test flaky` | Replay a test several times (auto-heal off) and report a stability score |
144
+ | | `test wait` | Block on one or more `runId`s until terminal |
145
+ | | `test cancel` | Cancel one or more in-flight runs (Ctrl-C during `--wait` only detaches — `cancel` is the real stop) |
146
+ | | `test artifact get` | Download the failure bundle for a specific `runId` |
147
+ | **Test lists** | `testlist list` / `testlist get` | Inspect saved test lists — named, cross-project collections with per-project environment pins (V3-only) |
148
+ | | `testlist create` / `update` / `add` / `remove` / `delete` | Manage a list and its cases; `--project-env <id>:<env>` pins environments; `delete` requires `--confirm` |
149
+ | | `testlist run` | Run every case (or a `--case` subset) through its pinned environment; `--wait` polls all runs, `--report junit` writes a CI sidecar |
150
+ | **Schedule** | `schedule list` / `schedule get` | List schedules visible to the key / fetch one by id (status is `ENABLED`, `PAUSED`, or `AUTO_PAUSED` after repeated failures) |
151
+ | | `schedule create` | Run a project or test list on a 5-field cron; states the frequency before sending and the per-run / monthly credit cost once priced |
152
+ | | `schedule update` | Retime or rename a schedule, change its recipients, `--pause` / `--resume` it |
153
+ | | `schedule delete` | Remove a schedule and its run history, stopping future triggers (`--confirm` required, no restore window) |
154
+ | | `schedule run list` | A schedule's past runs, with per-run pass / fail / blocked counts |
155
+ | **Agent** | `agent install` / `agent list` / `agent status` | Add, list, or health-check coding-agent skills (pure-local): `claude`, `codex`, `cursor`, `cline`, `antigravity`, `kiro`, `windsurf`, `copilot` |
148
156
 
149
157
  > The earlier command names — `init`, `auth configure`, `auth whoami`, `auth logout` — still work as hidden, deprecated aliases (each prints a one-line notice pointing at the new name), so existing scripts keep running. `auth configure` now runs the full `setup` (it also installs the skill).
150
158
 
@@ -219,7 +227,7 @@ npm run lint:fix # ESLint
219
227
  npm run typecheck # tsc --noEmit
220
228
  ```
221
229
 
222
- Pull requests target the `dev` branch. The full guide — build from source, test tiers, CI gates, branches, project layout — is in [CONTRIBUTING.md](./CONTRIBUTING.md).
230
+ Pull requests target the `main` branch. The full guide — build from source, test tiers, CI checks, branches, project layout — is in [CONTRIBUTING.md](./CONTRIBUTING.md).
223
231
 
224
232
  **Support** — if you need any help, we're responsive on [Discord](https://discord.gg/W4JDrZfdB), and feel free to email us at [contact@testsprite.com](mailto:contact@testsprite.com) too.
225
233
 
@@ -4,7 +4,7 @@ import { Command } from 'commander';
4
4
  import { CLIError, localValidationError } from '../lib/errors.js';
5
5
  import { GLOBAL_OPTS_HINT, Output, resolveOutputMode } from '../lib/output.js';
6
6
  import { promptText } from '../lib/prompt.js';
7
- import { TARGETS, SKILLS, DEFAULT_SKILLS, MARKER_SKILL_SEPARATOR, pathFor, loadSkillBodyFor, bodyHash12, compactBodyFor, buildCodexAggregate, buildSkillMarker, parseSkillMarker, renderForTarget, renderOwnFileWithMarker, MANAGED_SECTION_BEGIN, MANAGED_SECTION_END, } from '../lib/agent-targets.js';
7
+ import { TARGETS, SKILLS, DEFAULT_SKILLS, MARKER_SKILL_SEPARATOR, pathFor, ownFileBodyFor, bodyHash12, buildCodexAggregate, buildSkillMarker, parseSkillMarker, renderForTarget, renderOwnFileWithMarker, MANAGED_SECTION_BEGIN, MANAGED_SECTION_END, } from '../lib/agent-targets.js';
8
8
  // ---------------------------------------------------------------------------
9
9
  // Constants
10
10
  // ---------------------------------------------------------------------------
@@ -213,6 +213,31 @@ function composeManagedFile(state, section) {
213
213
  return `${state.before}${section}${state.after}`;
214
214
  }
215
215
  // ---------------------------------------------------------------------------
216
+ // Shared canonical-body resolution
217
+ // ---------------------------------------------------------------------------
218
+ /**
219
+ * Per-invocation cache in front of {@link ownFileBodyFor}, so each (target, skill)
220
+ * pair reads its asset once. `agent install` (which stamps the body's hash into the
221
+ * marker) and `agent status` (which re-derives it) share this rather than keeping
222
+ * private copies — they didn't, hence DEV-672.
223
+ */
224
+ function makeOwnFileBodyResolver() {
225
+ // Keyed on the pair: the same skill resolves to different bytes per target.
226
+ // NUL separates them because no target or skill name can contain one; written
227
+ // as an escape, since a raw NUL in the source makes grep treat this file as
228
+ // binary and skip it.
229
+ const cache = new Map();
230
+ return (target, skill) => {
231
+ const key = `${target}\u0000${skill}`;
232
+ let body = cache.get(key);
233
+ if (body === undefined) {
234
+ body = ownFileBodyFor(target, skill);
235
+ cache.set(key, body);
236
+ }
237
+ return body;
238
+ };
239
+ }
240
+ // ---------------------------------------------------------------------------
216
241
  // runInstall
217
242
  // ---------------------------------------------------------------------------
218
243
  export async function runInstall(opts, deps = {}) {
@@ -282,31 +307,9 @@ export async function runInstall(opts, deps = {}) {
282
307
  const dir = opts.dir ?? deps.cwd ?? process.cwd();
283
308
  const root = path.resolve(dir);
284
309
  // 4. Lazy asset loaders — only touch disk if a target actually needs it.
285
- // own-file bodies are per-skill (cached); the codex section aggregates EVERY
286
- // installed skill's contribution into ONE managed section.
287
- const skillBodyCache = new Map();
288
- const bodyForSkill = (skill) => {
289
- let b = skillBodyCache.get(skill);
290
- if (b === undefined) {
291
- b = loadSkillBodyFor(skill);
292
- skillBodyCache.set(skill, b);
293
- }
294
- return b;
295
- };
296
- // Budget-capped own-file targets (e.g. windsurf) render the compact per-skill
297
- // body so the rule file isn't truncated by the agent. Cached separately; must
298
- // match renderForTarget's default selection so written bytes equal the asserted
299
- // render.
300
- const compactBodyCache = new Map();
301
- const compactBodyForSkill = (skill) => {
302
- let b = compactBodyCache.get(skill);
303
- if (b === undefined) {
304
- b = compactBodyFor(skill);
305
- compactBodyCache.set(skill, b);
306
- }
307
- return b;
308
- };
309
- const ownFileBodyFor = (t, skill) => TARGETS[t].compactBody ? compactBodyForSkill(skill) : bodyForSkill(skill);
310
+ // own-file bodies come from the shared per-target resolver; the codex section
311
+ // aggregates EVERY installed skill's contribution into ONE managed section.
312
+ const ownFileBodyFor = makeOwnFileBodyResolver();
310
313
  let codexSectionCache;
311
314
  const getCodexSection = () => {
312
315
  if (codexSectionCache === undefined) {
@@ -600,8 +603,13 @@ export async function runList(opts, deps = {}) {
600
603
  * Classify one own-file artifact per the {@link SkillArtifactState} contract.
601
604
  * Comparisons are byte-exact, matching the installer's own skipped/blocked
602
605
  * comparison for own-file targets.
606
+ *
607
+ * `canonicalBody` is already bound to THIS target by the caller and takes no
608
+ * arguments, so the per-skill-only lookup that caused DEV-672 cannot be expressed
609
+ * here. It is called only once an artifact is known to exist and carry a marker,
610
+ * so a row with nothing installed never touches the skill assets.
603
611
  */
604
- async function classifyOwnFileState(agentFs, abs, target, skill, bodyForSkill) {
612
+ async function classifyOwnFileState(agentFs, abs, target, skill, canonicalBody) {
605
613
  const stat = await agentFs.lstat(abs);
606
614
  if (stat === null)
607
615
  return 'absent';
@@ -613,13 +621,13 @@ async function classifyOwnFileState(agentFs, abs, target, skill, bodyForSkill) {
613
621
  const marker = parseSkillMarker(existing);
614
622
  if (marker === null)
615
623
  return 'unmarked';
616
- const canonicalBody = bodyForSkill(skill);
617
- if (marker.hash12 !== bodyHash12(canonicalBody))
624
+ const body = canonicalBody();
625
+ if (marker.hash12 !== bodyHash12(body))
618
626
  return 'stale';
619
627
  // Hash matches the current body: pristine iff the file equals the canonical
620
628
  // render carrying its own marker line, so a marker whose version string lags
621
629
  // behind an unchanged body still reads ok.
622
- const reRender = renderOwnFileWithMarker(target, skill, marker.line, canonicalBody);
630
+ const reRender = renderOwnFileWithMarker(target, skill, marker.line, body);
623
631
  return existing === reRender ? 'ok' : 'modified';
624
632
  }
625
633
  /**
@@ -696,17 +704,8 @@ export async function runStatus(opts, deps = {}) {
696
704
  }
697
705
  const dir = opts.dir !== undefined ? opts.dir.trim() : (deps.cwd ?? process.cwd());
698
706
  const root = path.resolve(dir);
699
- // Canonical own-file bodies, read once per skill (same lazy caching pattern
700
- // as runInstall's bodyForSkill).
701
- const skillBodyCache = new Map();
702
- const bodyForSkill = (skill) => {
703
- let cachedBody = skillBodyCache.get(skill);
704
- if (cachedBody === undefined) {
705
- cachedBody = loadSkillBodyFor(skill);
706
- skillBodyCache.set(skill, cachedBody);
707
- }
708
- return cachedBody;
709
- };
707
+ // The SAME resolver the installer stamps its marker hashes from (DEV-672).
708
+ const ownFileBodyFor = makeOwnFileBodyResolver();
710
709
  const results = [];
711
710
  for (const [target, spec] of Object.entries(TARGETS)) {
712
711
  if (spec.mode === 'managed-section') {
@@ -722,7 +721,10 @@ export async function runStatus(opts, deps = {}) {
722
721
  target,
723
722
  skill,
724
723
  path: relPath,
725
- state: await classifyOwnFileState(agentFs, path.resolve(root, relPath), target, skill, bodyForSkill),
724
+ state: await classifyOwnFileState(agentFs, path.resolve(root, relPath), target, skill,
725
+ // Deferred, not resolved here: an absent artifact must not need the
726
+ // skill assets at all, as it didn't before DEV-672.
727
+ () => ownFileBodyFor(target, skill)),
726
728
  });
727
729
  }
728
730
  }
@@ -38,7 +38,7 @@ export interface DoctorDeps {
38
38
  stderr?: (line: string) => void;
39
39
  /** Project dir for the skill check. Defaults to `process.cwd()`. */
40
40
  cwd?: string;
41
- /** Runtime version string (e.g. "22.9.0"). Defaults to `process.versions.node`. */
41
+ /** Runtime version string (e.g. "22.13.0"). Defaults to `process.versions.node`. */
42
42
  nodeVersion?: string;
43
43
  existsSync?: (p: string) => boolean;
44
44
  readFileSync?: (p: string) => string;
@@ -23,7 +23,7 @@ import { GLOBAL_OPTS_HINT, Output, resolveOutputMode } from '../lib/output.js';
23
23
  import { isVerifySkillInstalled } from '../lib/skill-nudge.js';
24
24
  import { emitV3RoutingAdvisory, routingLabel } from '../lib/v3-advisory.js';
25
25
  import { VERSION } from '../version.js';
26
- import { MIN_SUPPORTED_NODE_MAJOR, shouldRejectNodeVersion } from '../version-guard.js';
26
+ import { SUPPORTED_NODE_RANGE, shouldRejectNodeVersion } from '../version-guard.js';
27
27
  export async function runDoctor(opts, deps = {}) {
28
28
  const out = makeOutput(opts.output, deps);
29
29
  const env = deps.env ?? process.env;
@@ -93,17 +93,14 @@ export async function runDoctor(opts, deps = {}) {
93
93
  return report;
94
94
  }
95
95
  function checkNodeVersion(nodeVersion) {
96
- // Reuse the CLI's own runtime guard so the verdict matches exactly what the
97
- // entrypoint enforces at startup, rather than a divergent hardcoded check.
98
- // The precise engines floor (20.19+/22.13+/24+) is enforced by npm at install
99
- // time via .npmrc engine-strict. sourceRef: src/version-guard.ts.
96
+ // Reuse the CLI runtime guard so doctor and startup enforce and describe the same range.
100
97
  const rejected = shouldRejectNodeVersion(nodeVersion);
101
98
  return {
102
99
  name: 'Node.js',
103
100
  status: rejected ? 'fail' : 'ok',
104
101
  detail: rejected
105
- ? `v${nodeVersion} is below the required Node ${MIN_SUPPORTED_NODE_MAJOR}; upgrade Node.js`
106
- : `v${nodeVersion} (>=${MIN_SUPPORTED_NODE_MAJOR} required)`,
102
+ ? `v${nodeVersion} is outside the supported Node range ${SUPPORTED_NODE_RANGE}; upgrade Node.js`
103
+ : `v${nodeVersion} (supported range: ${SUPPORTED_NODE_RANGE})`,
107
104
  };
108
105
  }
109
106
  function checkEndpoint(apiUrl) {
@@ -4,6 +4,7 @@ import { Command } from 'commander';
4
4
  import { emitDryRunBanner, makeHttpClient, parseRequestTimeoutFlag, } from '../lib/client-factory.js';
5
5
  import { ApiError } from '../lib/errors.js';
6
6
  import { GLOBAL_OPTS_HINT, Output, resolveOutputMode } from '../lib/output.js';
7
+ import { readSecretFileGuarded } from '../lib/secret-file.js';
7
8
  import { assertNotLocal } from '../lib/target-url.js';
8
9
  import { renderTextTable, resolveTextColumns } from '../lib/text-table.js';
9
10
  import { assertIdempotencyKey } from '../lib/validate.js';
@@ -113,7 +114,7 @@ export async function runCreate(opts, deps = {}) {
113
114
  // Resolve password: flag > file > none
114
115
  let password = opts.password;
115
116
  if (password === undefined && opts.passwordFile !== undefined) {
116
- password = readFileSync(opts.passwordFile, 'utf8').trim();
117
+ password = readSecretFileGuarded('password-file', opts.passwordFile);
117
118
  }
118
119
  const idempotencyKey = opts.idempotencyKey ?? `cli-proj-create-${randomUUID()}`;
119
120
  if (opts.idempotencyKey === undefined && (opts.output === 'json' || opts.verbose || opts.debug)) {
@@ -245,7 +246,7 @@ export async function runUpdate(opts, deps = {}) {
245
246
  // filesystem, even when --password-file is present.
246
247
  let password = opts.password;
247
248
  if (password === undefined && opts.passwordFile !== undefined) {
248
- password = readFileSync(opts.passwordFile, 'utf8').trim();
249
+ password = readSecretFileGuarded('password-file', opts.passwordFile);
249
250
  }
250
251
  const idempotencyKey = opts.idempotencyKey ?? `cli-proj-update-${randomUUID()}`;
251
252
  if (opts.idempotencyKey === undefined && (opts.output === 'json' || opts.verbose || opts.debug)) {
@@ -0,0 +1,120 @@
1
+ import { Command } from 'commander';
2
+ import { type CommonOptions as FactoryCommonOptions } from '../lib/client-factory.js';
3
+ import type { FetchImpl } from '../lib/http.js';
4
+ /** A schedule as returned by the API. */
5
+ export interface CliSchedule {
6
+ scheduleId: string;
7
+ name: string;
8
+ enabled: boolean;
9
+ targetType: 'project' | 'testList';
10
+ /** Project id when `targetType` is `project`, else the test-list id. */
11
+ targetId: string | null;
12
+ cron: string | null;
13
+ timezone: string | null;
14
+ startAt: string | null;
15
+ endAt: string | null;
16
+ /** Comma-separated notification recipients. */
17
+ sendTo: string | null;
18
+ /** Set when the schedule was disabled automatically after repeated failures. */
19
+ autoPausedAt: string | null;
20
+ /** Most recent run, or null if it has never run. */
21
+ lastRunId: string | null;
22
+ createdAt: string;
23
+ updatedAt: string;
24
+ }
25
+ /** `GET /schedules` response. Not paginated. */
26
+ interface ScheduleListResponse {
27
+ schedules: CliSchedule[];
28
+ }
29
+ export interface ScheduleDeps {
30
+ env?: NodeJS.ProcessEnv;
31
+ credentialsPath?: string;
32
+ fetchImpl?: FetchImpl;
33
+ stdout?: (line: string) => void;
34
+ stderr?: (line: string) => void;
35
+ }
36
+ type CommonOptions = FactoryCommonOptions;
37
+ interface ListOptions extends CommonOptions {
38
+ columns?: string;
39
+ noHeader?: boolean;
40
+ }
41
+ interface GetOptions extends CommonOptions {
42
+ scheduleId: string;
43
+ }
44
+ export interface CreateOptions extends CommonOptions {
45
+ name?: string;
46
+ targetType?: string;
47
+ targetId?: string;
48
+ cron?: string;
49
+ timezone?: string;
50
+ start?: string;
51
+ end?: string;
52
+ sendTo?: string;
53
+ idempotencyKey?: string;
54
+ }
55
+ export interface CliCreateScheduleResponse {
56
+ scheduleId: string;
57
+ /**
58
+ * Approximate credits ONE run of this schedule will consume, as calculated by
59
+ * the API from the target's live case count. `null` when it could not be
60
+ * determined, absent on an API that does not supply it.
61
+ *
62
+ * Per run rather than per month because the API knows the price of a run and
63
+ * this side knows how often the cron fires; neither knows both.
64
+ */
65
+ estimatedCreditsPerRun?: number | null;
66
+ }
67
+ export interface UpdateOptions extends CommonOptions {
68
+ scheduleId: string;
69
+ name?: string;
70
+ cron?: string;
71
+ timezone?: string;
72
+ start?: string;
73
+ end?: string;
74
+ sendTo?: string;
75
+ pause?: boolean;
76
+ resume?: boolean;
77
+ idempotencyKey?: string;
78
+ }
79
+ export interface DeleteOptions extends CommonOptions {
80
+ scheduleId: string;
81
+ confirm?: boolean;
82
+ idempotencyKey?: string;
83
+ }
84
+ export interface CliDeleteScheduleResponse {
85
+ scheduleId: string;
86
+ }
87
+ export interface RunListOptions extends CommonOptions {
88
+ scheduleId: string;
89
+ columns?: string;
90
+ noHeader?: boolean;
91
+ }
92
+ export interface CliScheduleRun {
93
+ runId: string;
94
+ scheduleId: string | null;
95
+ status: 'queued' | 'running' | 'passed' | 'failed' | 'blocked' | 'cancelled';
96
+ projectId: string | null;
97
+ testListId: string | null;
98
+ stats: {
99
+ total: number;
100
+ passed: number;
101
+ failed: number;
102
+ blocked: number;
103
+ running: number;
104
+ cancelled: number;
105
+ };
106
+ createdAt: string;
107
+ updatedAt: string;
108
+ }
109
+ /** `GET /schedules/{id}/runs` response. Not paginated. */
110
+ interface ScheduleRunListResponse {
111
+ runs: CliScheduleRun[];
112
+ }
113
+ export declare function runList(opts: ListOptions, deps?: ScheduleDeps): Promise<ScheduleListResponse>;
114
+ export declare function runGet(opts: GetOptions, deps?: ScheduleDeps): Promise<CliSchedule>;
115
+ export declare function runCreate(opts: CreateOptions, deps?: ScheduleDeps): Promise<CliCreateScheduleResponse>;
116
+ export declare function runUpdate(opts: UpdateOptions, deps?: ScheduleDeps): Promise<CliSchedule>;
117
+ export declare function runDelete(opts: DeleteOptions, deps?: ScheduleDeps): Promise<CliDeleteScheduleResponse>;
118
+ export declare function runRunList(opts: RunListOptions, deps?: ScheduleDeps): Promise<ScheduleRunListResponse>;
119
+ export declare function createScheduleCommand(deps?: ScheduleDeps): Command;
120
+ export {};