@zgeoff/rig 0.0.0 → 0.0.2

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 (143) hide show
  1. package/README.md +87 -3
  2. package/dist/browser/browser-preload.d.ts +1 -0
  3. package/dist/browser/build-browser-run.d.ts +9 -0
  4. package/dist/browser/build-lane-environments.d.ts +8 -0
  5. package/dist/browser/build-recorded-command.d.ts +1 -0
  6. package/dist/browser/find-browser-run.d.ts +4 -0
  7. package/dist/browser/find-private-dir-problem.d.ts +2 -0
  8. package/dist/browser/has-browser-build-script.d.ts +1 -0
  9. package/dist/browser/has-error-code.d.ts +1 -0
  10. package/dist/browser/is-zombie-state.d.ts +1 -0
  11. package/dist/browser/lane-files.d.ts +13 -0
  12. package/dist/browser/make-browser-lane-hooks.d.ts +22 -0
  13. package/dist/browser/pick-chrome-dirs.d.ts +7 -0
  14. package/dist/browser/pick-exit-code-after-tests.d.ts +1 -0
  15. package/dist/browser/pick-step-after-build.d.ts +7 -0
  16. package/dist/browser/pick-stop-step.d.ts +17 -0
  17. package/dist/browser/probe-host-process.d.ts +1 -0
  18. package/dist/browser/probe-process.d.ts +6 -0
  19. package/dist/browser/probe-run.d.ts +9 -0
  20. package/dist/browser/process-group-still-running-error.d.ts +4 -0
  21. package/dist/browser/process-group-stop-error.d.ts +4 -0
  22. package/dist/browser/process-groups.d.ts +5 -0
  23. package/dist/browser/process-runtime.d.ts +15 -0
  24. package/dist/browser/read-dir-names.d.ts +1 -0
  25. package/dist/browser/read-process-table.d.ts +6 -0
  26. package/dist/browser/remove-exited-run-dirs.d.ts +2 -0
  27. package/dist/browser/remove-path.d.ts +1 -0
  28. package/dist/browser/run-in-page.d.ts +23 -0
  29. package/dist/browser/should-keep-run-folders.d.ts +1 -0
  30. package/dist/browser/start-browser.d.ts +9 -0
  31. package/dist/browser/start-process-group.d.ts +17 -0
  32. package/dist/browser/wire-browser-lane-hooks.d.ts +12 -0
  33. package/dist/build-diet-command.d.ts +1 -0
  34. package/dist/build-init-scripts.d.ts +3 -0
  35. package/dist/build-test-selection.d.ts +23 -0
  36. package/dist/build-unit-command.d.ts +2 -0
  37. package/dist/cli.d.ts +2 -0
  38. package/dist/define-rig.d.ts +2 -0
  39. package/dist/find-timeout-arg.d.ts +1 -0
  40. package/dist/format-no-match-message.d.ts +1 -0
  41. package/dist/format-no-tests-message.d.ts +1 -0
  42. package/dist/index.d.ts +6 -0
  43. package/dist/index.js +255 -0
  44. package/dist/init-files.d.ts +6 -0
  45. package/dist/is-command-name.d.ts +3 -0
  46. package/dist/lane-hooks.d.ts +13 -0
  47. package/dist/make-repo-lane-hooks.d.ts +12 -0
  48. package/dist/parse-duration.d.ts +1 -0
  49. package/dist/parse-lane-hook.d.ts +3 -0
  50. package/dist/parse-lane-start.d.ts +2 -0
  51. package/dist/parse-rig-config.d.ts +9 -0
  52. package/dist/parse-test-args.d.ts +5 -0
  53. package/dist/pick-e2e-dirs.d.ts +1 -0
  54. package/dist/pick-lane-selection.d.ts +2 -0
  55. package/dist/read-cli-args.d.ts +5 -0
  56. package/dist/read-memory-budget.d.ts +8 -0
  57. package/dist/read-rig-config.d.ts +6 -0
  58. package/dist/read-tracked-files.d.ts +1 -0
  59. package/dist/read-worker-count.d.ts +13 -0
  60. package/dist/resolve-diet-script.d.ts +1 -0
  61. package/dist/resolve-related-tests.d.ts +6 -0
  62. package/dist/run-cli.d.ts +9 -0
  63. package/dist/run-command.d.ts +6 -0
  64. package/dist/run-init.d.ts +8 -0
  65. package/dist/run-lane-hooks.d.ts +2 -0
  66. package/dist/run-lane.d.ts +18 -0
  67. package/dist/run-related-tests.d.ts +10 -0
  68. package/dist/run-unit-tests.d.ts +12 -0
  69. package/dist/run-unit.d.ts +8 -0
  70. package/dist/standard-lanes.d.ts +8 -0
  71. package/dist/system-clock.d.ts +5 -0
  72. package/dist/types.d.ts +42 -0
  73. package/package.json +41 -3
  74. package/src/browser/browser-preload.ts +36 -0
  75. package/src/browser/build-browser-run.ts +32 -0
  76. package/src/browser/build-lane-environments.ts +33 -0
  77. package/src/browser/build-recorded-command.ts +12 -0
  78. package/src/browser/find-browser-run.ts +15 -0
  79. package/src/browser/find-private-dir-problem.ts +21 -0
  80. package/src/browser/has-browser-build-script.ts +7 -0
  81. package/src/browser/has-error-code.ts +3 -0
  82. package/src/browser/is-zombie-state.ts +4 -0
  83. package/src/browser/lane-files.ts +56 -0
  84. package/src/browser/make-browser-lane-hooks.ts +228 -0
  85. package/src/browser/pick-chrome-dirs.ts +34 -0
  86. package/src/browser/pick-exit-code-after-tests.ts +5 -0
  87. package/src/browser/pick-step-after-build.ts +20 -0
  88. package/src/browser/pick-stop-step.ts +28 -0
  89. package/src/browser/probe-host-process.ts +11 -0
  90. package/src/browser/probe-process.ts +35 -0
  91. package/src/browser/probe-run.ts +38 -0
  92. package/src/browser/process-group-still-running-error.ts +9 -0
  93. package/src/browser/process-group-stop-error.ts +10 -0
  94. package/src/browser/process-groups.ts +45 -0
  95. package/src/browser/process-runtime.ts +40 -0
  96. package/src/browser/read-dir-names.ts +15 -0
  97. package/src/browser/read-process-table.ts +35 -0
  98. package/src/browser/remove-exited-run-dirs.ts +21 -0
  99. package/src/browser/remove-path.ts +5 -0
  100. package/src/browser/run-in-page.ts +103 -0
  101. package/src/browser/should-keep-run-folders.ts +7 -0
  102. package/src/browser/start-browser.ts +40 -0
  103. package/src/browser/start-process-group.ts +168 -0
  104. package/src/browser/wire-browser-lane-hooks.ts +88 -0
  105. package/src/build-diet-command.ts +11 -0
  106. package/src/build-init-scripts.ts +40 -0
  107. package/src/build-test-selection.ts +124 -0
  108. package/src/build-unit-command.ts +22 -0
  109. package/src/cli.ts +73 -0
  110. package/src/define-rig.ts +195 -0
  111. package/src/find-timeout-arg.ts +3 -0
  112. package/src/format-no-match-message.ts +3 -0
  113. package/src/format-no-tests-message.ts +3 -0
  114. package/src/index.ts +14 -0
  115. package/src/init-files.ts +15 -0
  116. package/src/is-command-name.ts +9 -0
  117. package/src/lane-hooks.ts +15 -0
  118. package/src/make-repo-lane-hooks.ts +70 -0
  119. package/src/parse-duration.ts +14 -0
  120. package/src/parse-lane-hook.ts +20 -0
  121. package/src/parse-lane-start.ts +30 -0
  122. package/src/parse-rig-config.ts +96 -0
  123. package/src/parse-test-args.ts +14 -0
  124. package/src/pick-e2e-dirs.ts +25 -0
  125. package/src/pick-lane-selection.ts +14 -0
  126. package/src/read-cli-args.ts +57 -0
  127. package/src/read-memory-budget.ts +65 -0
  128. package/src/read-rig-config.ts +32 -0
  129. package/src/read-tracked-files.ts +20 -0
  130. package/src/read-worker-count.ts +40 -0
  131. package/src/resolve-diet-script.ts +7 -0
  132. package/src/resolve-related-tests.ts +52 -0
  133. package/src/run-cli.ts +68 -0
  134. package/src/run-command.ts +36 -0
  135. package/src/run-init.ts +71 -0
  136. package/src/run-lane-hooks.ts +49 -0
  137. package/src/run-lane.ts +138 -0
  138. package/src/run-related-tests.ts +113 -0
  139. package/src/run-unit-tests.ts +42 -0
  140. package/src/run-unit.ts +68 -0
  141. package/src/standard-lanes.ts +23 -0
  142. package/src/system-clock.ts +10 -0
  143. package/src/types.ts +75 -0
package/README.md CHANGED
@@ -1,4 +1,88 @@
1
- # @zgeoff/rig
1
+ <div align="center">
2
+ <h1>@zgeoff/rig</h1>
2
3
 
3
- Run a repo's test lanes, the browser lane included, under one command. Not released yet: this
4
- version only reserves the name.
4
+ <p>
5
+ <a href="https://www.npmjs.com/package/@zgeoff/rig"><img src="https://img.shields.io/npm/v/@zgeoff/rig" alt="npm version"></a>
6
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"></a>
7
+ </p>
8
+
9
+ <p>
10
+ <a href="../../docs/README.md">Documentation</a> •
11
+ <a href="../../docs/architecture/rig.md">How rig works</a> •
12
+ <a href="../../docs/guides/browser-lane.md">Browser lane</a>
13
+ </p>
14
+ </div>
15
+
16
+ Run every test lane of a Bun repo from one declaration of its limits, with a browser lane built in.
17
+
18
+ A repo's tests split into lanes: the unit run, `e2e/` folders, and suites that need a real system,
19
+ such as a browser or a container. `rig` runs each lane with its own timeout, worker count and memory
20
+ cap, and the unit run leaves every lane out, so a lane never runs by mistake. The same declaration
21
+ sets the limits that the `@zgeoff/oxlint-config` rules check. To start, run `rig init`, then
22
+ `rig unit`.
23
+
24
+ ## Install
25
+
26
+ ```sh
27
+ bun add -d @zgeoff/rig
28
+ bunx rig init
29
+ ```
30
+
31
+ `rig` runs under Bun. It runs each command under [`@zgeoff/diet`](../diet/README.md), a dependency,
32
+ so a run that outgrows its memory budget fails alone when `diet` finds a
33
+ [cap mode](../../docs/architecture/memory-caps.md#the-modes) that the host supports. With
34
+ `DIET_MODE=none`, or on a host with no supported mode, the command runs uncapped.
35
+
36
+ ## Commands
37
+
38
+ - `rig unit` runs the unit tests in random order with the host's worker count.
39
+ - `rig related <paths...>` runs the unit tests beside the changed files, for a pre-push hook.
40
+ - `rig <lane>` runs one lane: `e2e`, `browser`, `docker`, `host`, `agent-sdk`, `model-api`, or a
41
+ lane the repo declares.
42
+ - `rig init` writes the `test`, `test:related` and `test:<lane>` scripts and a starter config.
43
+
44
+ `rig unit` and the lane commands pass every argument after the command on to `bun test`, so
45
+ `bun run test --seed=1` replays a run's order, and rig drops one `--` among them. The exception is
46
+ `--timeout`: the lane's limit in `rig.config.ts` is its one per-test timeout, so rig exits 2 on a
47
+ `--timeout` or `--timeout=<ms>` argument and runs nothing. `rig related` takes changed file paths
48
+ only, and exits 2 on an option.
49
+
50
+ Among those arguments, a path keeps only the lane's own files that it selects: a file, the files
51
+ under a folder, or, for a bare word, the files whose path holds it. rig resolves a path, with its
52
+ `.` and `..` segments, against the repo root, and a path outside the repo selects nothing. When the
53
+ paths select no file of the lane, as `rig unit ./src/oven.host.test.ts` does, rig names them and
54
+ exits 1. An option takes its value after `=`, as in `--rerun-each=2`, because rig reads every
55
+ argument that does not start with `-` as a path. So `--rerun-each 2` makes `2` a path, which selects
56
+ no file and fails the run.
57
+
58
+ ## Configuration
59
+
60
+ `rig.config.ts` at the repo root declares what differs from the built-in lanes:
61
+
62
+ ```ts
63
+ import { defineRig } from '@zgeoff/rig';
64
+
65
+ export default defineRig({
66
+ lanes: { kiln: { suffix: '.kiln', limit: '15s', start: './test-utils/start-kiln.ts' } },
67
+ });
68
+ ```
69
+
70
+ Oxlint's plugin reads this file under Node 22.18 or later, or under Bun, because it imports the
71
+ config to take the limits from it.
72
+
73
+ ## Testing in a page
74
+
75
+ A `.browser.test.ts` suite runs in Chrome through `Bun.WebView`. `runInPage` runs a real function in
76
+ the page and parses its result with a schema:
77
+
78
+ ```ts
79
+ import { runInPage } from '@zgeoff/rig';
80
+ import { z } from 'zod';
81
+
82
+ const title = await runInPage(view, () => document.title, undefined, z.string());
83
+ ```
84
+
85
+ ## Documentation
86
+
87
+ [How rig works](../../docs/architecture/rig.md) describes the lane table, a lane's run, the browser
88
+ lane and the limits mechanism.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export interface BrowserRun {
2
+ readonly runID: string;
3
+ readonly runsDir: string;
4
+ readonly runDir: string;
5
+ readonly groupsDir: string;
6
+ readonly buildDir: string;
7
+ readonly profilesDir: string;
8
+ }
9
+ export declare function buildBrowserRun(repoRoot: string, hostName: string, runID: string): BrowserRun;
@@ -0,0 +1,8 @@
1
+ import type { BrowserRun } from './build-browser-run.ts';
2
+ type Environment = Readonly<Record<string, string | undefined>>;
3
+ export interface LaneEnvironments {
4
+ readonly buildEnvironment: Environment;
5
+ readonly testsEnvironment: Environment;
6
+ }
7
+ export declare function buildLaneEnvironments(environment: Environment, run: BrowserRun, chromeRunDir: string, hasBuild: boolean): LaneEnvironments;
8
+ export {};
@@ -0,0 +1 @@
1
+ export declare function buildRecordedCommand(groupsDir: string, pendingRecord: string, command: readonly string[]): readonly string[];
@@ -0,0 +1,4 @@
1
+ import type { BrowserRun } from './build-browser-run.ts';
2
+ export declare const runIDVariable = "RIG_BROWSER_RUN_ID";
3
+ export declare const buildDirVariable = "RIG_BROWSER_BUILD_DIR";
4
+ export declare function findBrowserRun(repoRoot: string, hostName: string, environment: Readonly<Record<string, string | undefined>>): BrowserRun | null;
@@ -0,0 +1,2 @@
1
+ import type { PathStatus } from './lane-files.ts';
2
+ export declare function findPrivateDirProblem(path: string, status: PathStatus | null, userID: number): string | null;
@@ -0,0 +1 @@
1
+ export declare function hasBrowserBuildScript(manifest: unknown): boolean;
@@ -0,0 +1 @@
1
+ export declare function hasErrorCode(error: unknown, code: string): boolean;
@@ -0,0 +1 @@
1
+ export declare function isZombieState(state: string): boolean;
@@ -0,0 +1,13 @@
1
+ export interface PathStatus {
2
+ readonly isDirectory: boolean;
3
+ readonly ownerID: number;
4
+ readonly mode: number;
5
+ }
6
+ export interface LaneFiles {
7
+ readonly createPrivateDir: (path: string) => Promise<void>;
8
+ readonly createDirs: (path: string) => Promise<void>;
9
+ readonly readStatus: (path: string) => Promise<PathStatus | null>;
10
+ readonly readDirNames: (path: string) => Promise<readonly string[]>;
11
+ readonly removePath: (path: string) => Promise<void>;
12
+ }
13
+ export declare const laneFiles: LaneFiles;
@@ -0,0 +1,22 @@
1
+ import type { LaneHooks } from '../lane-hooks.ts';
2
+ import type { BrowserRun } from './build-browser-run.ts';
3
+ import type { LaneFiles } from './lane-files.ts';
4
+ import type { ChromeDirs } from './pick-chrome-dirs.ts';
5
+ import type { ProcessGroups } from './process-groups.ts';
6
+ type Environment = Readonly<Record<string, string | undefined>>;
7
+ export interface BrowserLaneOptions {
8
+ readonly run: BrowserRun;
9
+ readonly chromeDirs: ChromeDirs;
10
+ readonly userID: number;
11
+ readonly preloadPath: string;
12
+ readonly environment: Environment;
13
+ readonly signal: AbortSignal;
14
+ readonly files: LaneFiles;
15
+ readonly probeProcess: (pid: number) => boolean;
16
+ readonly groups: Pick<ProcessGroups, 'probeGroup'>;
17
+ readonly runBuild: ((environment: Environment, signal: AbortSignal, pendingRecord: string) => Promise<number>) | null;
18
+ readonly reportCleanupError: (error: unknown) => void;
19
+ readonly runTests: (testArgs: readonly string[], environment: Environment, signal: AbortSignal, pendingRecord: string) => Promise<number>;
20
+ }
21
+ export declare function makeBrowserLaneHooks(options: BrowserLaneOptions): LaneHooks;
22
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { BrowserRun } from './build-browser-run.ts';
2
+ export interface ChromeDirs {
3
+ readonly privateDir: string;
4
+ readonly runsDir: string;
5
+ readonly runDir: string;
6
+ }
7
+ export declare function pickChromeDirs(tmpdir: string, userID: number, run: BrowserRun): ChromeDirs;
@@ -0,0 +1 @@
1
+ export declare function pickExitCodeAfterTests(testsExitCode: number, isAborted: boolean): number;
@@ -0,0 +1,7 @@
1
+ export type StepAfterBuild = {
2
+ readonly kind: 'run-tests';
3
+ } | {
4
+ readonly kind: 'finish';
5
+ readonly exitCode: number;
6
+ };
7
+ export declare function pickStepAfterBuild(buildExitCode: number | null, isAborted: boolean): StepAfterBuild;
@@ -0,0 +1,17 @@
1
+ export type StopPhase = 'before-stop' | 'after-sigterm' | 'after-sigkill';
2
+ export interface StopObservation {
3
+ readonly phase: StopPhase;
4
+ readonly isGroupRunning: boolean;
5
+ readonly isPastDeadline: boolean;
6
+ }
7
+ export type StopStep = {
8
+ readonly kind: 'done';
9
+ } | {
10
+ readonly kind: 'signal';
11
+ readonly signal: 'SIGTERM' | 'SIGKILL';
12
+ } | {
13
+ readonly kind: 'wait';
14
+ } | {
15
+ readonly kind: 'fail';
16
+ };
17
+ export declare function pickStopStep(observation: StopObservation): StopStep;
@@ -0,0 +1 @@
1
+ export declare function probeHostProcess(pid: number): boolean;
@@ -0,0 +1,6 @@
1
+ import type { ProcessEntry } from './read-process-table.ts';
2
+ export interface ProcessProbeDependencies {
3
+ readonly signalProcess: (pid: number, signal: number) => void;
4
+ readonly readProcessTable: () => readonly ProcessEntry[] | null;
5
+ }
6
+ export declare function probeProcess(pid: number, dependencies: ProcessProbeDependencies): boolean;
@@ -0,0 +1,9 @@
1
+ import type { LaneFiles } from './lane-files.ts';
2
+ import type { ProcessGroups } from './process-groups.ts';
3
+ export interface RunProbeOptions {
4
+ readonly files: Pick<LaneFiles, 'readDirNames' | 'removePath'>;
5
+ readonly probeProcess: (pid: number) => boolean;
6
+ readonly groups: Pick<ProcessGroups, 'probeGroup'>;
7
+ }
8
+ export declare const pendingRecordPrefix = "pending-";
9
+ export declare function probeRun(runID: string, groupsDir: string, options: RunProbeOptions): Promise<boolean>;
@@ -0,0 +1,4 @@
1
+ import { ProcessGroupStopError } from './process-group-stop-error.ts';
2
+ export declare class ProcessGroupStillRunningError extends ProcessGroupStopError {
3
+ constructor(groupID: number);
4
+ }
@@ -0,0 +1,4 @@
1
+ export declare class ProcessGroupStopError extends Error {
2
+ readonly groupID: number;
3
+ constructor(groupID: number, message: string, options?: ErrorOptions);
4
+ }
@@ -0,0 +1,5 @@
1
+ export interface ProcessGroups {
2
+ readonly signalGroup: (groupID: number, signal: NodeJS.Signals) => void;
3
+ readonly probeGroup: (groupID: number) => boolean;
4
+ }
5
+ export declare const processGroups: ProcessGroups;
@@ -0,0 +1,15 @@
1
+ import type { Clock } from '../system-clock.ts';
2
+ export interface SpawnedProcess {
3
+ readonly pid: number;
4
+ readonly stdout: ReadableStream<Uint8Array> | null;
5
+ readonly exited: Promise<number>;
6
+ }
7
+ export interface SpawnOptions {
8
+ readonly cwd: string;
9
+ readonly environment: Readonly<Record<string, string | undefined>>;
10
+ readonly stdout: 'inherit' | 'pipe';
11
+ }
12
+ export interface ProcessRuntime extends Clock {
13
+ readonly spawn: (command: readonly string[], options: SpawnOptions) => SpawnedProcess;
14
+ }
15
+ export declare const processRuntime: ProcessRuntime;
@@ -0,0 +1 @@
1
+ export declare function readDirNames(path: string): Promise<readonly string[]>;
@@ -0,0 +1,6 @@
1
+ export interface ProcessEntry {
2
+ readonly pid: number;
3
+ readonly groupID: number;
4
+ readonly state: string;
5
+ }
6
+ export declare function readProcessTable(): readonly ProcessEntry[] | null;
@@ -0,0 +1,2 @@
1
+ import type { LaneFiles } from './lane-files.ts';
2
+ export declare function removeExitedRunDirs(parentDir: string, files: Pick<LaneFiles, 'readDirNames' | 'removePath'>, probeRun: (runID: string) => Promise<boolean>): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function removePath(path: string): Promise<void>;
@@ -0,0 +1,23 @@
1
+ interface PageResultIssue {
2
+ readonly message: string;
3
+ readonly path?: readonly (PropertyKey | {
4
+ readonly key: PropertyKey;
5
+ })[] | undefined;
6
+ }
7
+ type PageResult<Output> = {
8
+ readonly value: Output;
9
+ readonly issues?: undefined;
10
+ } | {
11
+ readonly issues: readonly PageResultIssue[];
12
+ };
13
+ export interface PageResultSchema<Input, Output> {
14
+ readonly '~standard': {
15
+ readonly validate: (value: unknown) => PageResult<Output> | Promise<PageResult<Output>>;
16
+ readonly types?: {
17
+ readonly input: Input;
18
+ readonly output: Output;
19
+ } | undefined;
20
+ };
21
+ }
22
+ export declare function runInPage<Argument, Input, Output>(view: Bun.WebView, pageFunction: (argument: Argument) => NoInfer<Input> | Promise<NoInfer<Input>>, argument: Argument, schema: PageResultSchema<Input, Output>): Promise<Output>;
23
+ export {};
@@ -0,0 +1 @@
1
+ export declare function shouldKeepRunFolders(error: unknown): boolean;
@@ -0,0 +1,9 @@
1
+ export interface BrowserStart {
2
+ readonly repoRoot: string;
3
+ readonly hostName: string;
4
+ readonly environment: Readonly<Record<string, string | undefined>>;
5
+ readonly profileName: string;
6
+ readonly readDirNames: (path: string) => Promise<readonly string[]>;
7
+ readonly openView: (profileDir: string) => Promise<void>;
8
+ }
9
+ export declare function startBrowser(start: BrowserStart): Promise<void>;
@@ -0,0 +1,17 @@
1
+ import type { ProcessGroups } from './process-groups.ts';
2
+ import type { ProcessRuntime } from './process-runtime.ts';
3
+ export interface ProcessGroupOptions {
4
+ readonly cwd: string;
5
+ readonly environment: Readonly<Record<string, string | undefined>>;
6
+ readonly signal: AbortSignal;
7
+ readonly stdout: 'inherit' | 'pipe';
8
+ readonly stopDeadlineMs: number;
9
+ readonly groups: ProcessGroups;
10
+ readonly runtime: ProcessRuntime;
11
+ }
12
+ export interface StartedProcessGroup {
13
+ readonly pid: number;
14
+ readonly stdout: ReadableStream<Uint8Array> | null;
15
+ readonly exited: Promise<number>;
16
+ }
17
+ export declare function startProcessGroup(command: readonly string[], options: ProcessGroupOptions): StartedProcessGroup;
@@ -0,0 +1,12 @@
1
+ import type { LaneHooks } from '../lane-hooks.ts';
2
+ type Environment = Readonly<Record<string, string | undefined>>;
3
+ export interface BrowserLaneWiring {
4
+ readonly repoRoot: string;
5
+ readonly runID: string;
6
+ readonly memory: string | null;
7
+ readonly dietScript: string;
8
+ readonly environment: Environment;
9
+ readonly signal: AbortSignal;
10
+ }
11
+ export declare function wireBrowserLaneHooks(wiring: BrowserLaneWiring): Promise<LaneHooks>;
12
+ export {};
@@ -0,0 +1 @@
1
+ export declare function buildDietCommand(dietScript: string, memory: string | null, command: readonly string[]): readonly string[];
@@ -0,0 +1,3 @@
1
+ import type { RigConfig } from './types.ts';
2
+ export type PackageScripts = Readonly<Record<string, string>>;
3
+ export declare function buildInitScripts(oldScripts: PackageScripts, config: RigConfig, trackedFiles: readonly string[]): PackageScripts;
@@ -0,0 +1,23 @@
1
+ import type { TestArgs } from './parse-test-args.ts';
2
+ import type { ResolvedLane, RigConfig } from './types.ts';
3
+ export type TestSelection = {
4
+ readonly kind: 'lane';
5
+ readonly flags: readonly string[];
6
+ } | {
7
+ readonly kind: 'empty';
8
+ } | {
9
+ readonly kind: 'files';
10
+ readonly files: readonly string[];
11
+ readonly flags: readonly string[];
12
+ } | {
13
+ readonly kind: 'none';
14
+ readonly paths: readonly string[];
15
+ };
16
+ export interface TestSelectionRequest {
17
+ readonly config: RigConfig;
18
+ readonly lane: Pick<ResolvedLane, 'name' | 'suffix'>;
19
+ readonly repoRoot: string;
20
+ readonly trackedFiles: readonly string[];
21
+ readonly args: TestArgs;
22
+ }
23
+ export declare function buildTestSelection(request: TestSelectionRequest): TestSelection;
@@ -0,0 +1,2 @@
1
+ import type { RigConfig } from './types.ts';
2
+ export declare function buildUnitCommand(config: RigConfig, e2eDirs: readonly string[], workerCount: number, extraArgs: readonly string[]): readonly string[];
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { RigConfig, RigDeclaration } from './types.ts';
2
+ export declare function defineRig(declaration: RigDeclaration): RigConfig;
@@ -0,0 +1 @@
1
+ export declare function findTimeoutArg(args: readonly string[]): string | undefined;
@@ -0,0 +1 @@
1
+ export declare function formatNoMatchMessage(laneName: string, paths: readonly string[]): string;
@@ -0,0 +1 @@
1
+ export declare function formatNoTestsMessage(laneName: string): string;
@@ -0,0 +1,6 @@
1
+ export { defineRig } from './define-rig.ts';
2
+ export { parseRigConfig } from './parse-rig-config.ts';
3
+ export type { ParsedRigConfig } from './parse-rig-config.ts';
4
+ export { runInPage } from './browser/run-in-page.ts';
5
+ export type { PageResultSchema } from './browser/run-in-page.ts';
6
+ export type { LaneContext, LaneDeclaration, LaneStart, ResolvedLane, RigConfig, RigDeclaration, } from './types.ts';