@mairwunnx/ctxray 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +160 -2
- package/bin/ctxray.js +2 -0
- package/index.js +1 -0
- package/package.json +41 -4
- package/types/app/globals.d.ts +3 -0
- package/types/app/public-api.d.ts +3 -0
- package/types/entities/harness/adapters.d.ts +12 -0
- package/types/entities/harness/capability.d.ts +2 -0
- package/types/entities/harness/capture/canary.d.ts +5 -0
- package/types/entities/harness/capture/copy.d.ts +3 -0
- package/types/entities/harness/capture/isolate.d.ts +16 -0
- package/types/entities/harness/capture/loadout.d.ts +19 -0
- package/types/entities/harness/capture/mcp.d.ts +15 -0
- package/types/entities/harness/capture/model.d.ts +44 -0
- package/types/entities/harness/capture/session.d.ts +54 -0
- package/types/entities/harness/capture/user-scope.d.ts +12 -0
- package/types/entities/harness/claude-code/transcript.d.ts +8 -0
- package/types/entities/harness/index.d.ts +22 -0
- package/types/entities/harness/inventory.d.ts +54 -0
- package/types/entities/harness/layers/dead-rules.d.ts +3 -0
- package/types/entities/harness/layers/files.d.ts +8 -0
- package/types/entities/harness/layers/lint-config.d.ts +9 -0
- package/types/entities/harness/layers/lint.d.ts +5 -0
- package/types/entities/harness/layers/policy.d.ts +16 -0
- package/types/entities/harness/layers/reach.d.ts +7 -0
- package/types/entities/harness/profile.d.ts +22 -0
- package/types/entities/harness/profiles.d.ts +3 -0
- package/types/entities/harness/project.d.ts +26 -0
- package/types/entities/harness/revision.d.ts +11 -0
- package/types/entities/harness/static-loadout.d.ts +42 -0
- package/types/entities/harness-cache/dirs.d.ts +7 -0
- package/types/entities/harness-cache/failure.d.ts +7 -0
- package/types/entities/harness-cache/index.d.ts +11 -0
- package/types/entities/harness-cache/install.d.ts +35 -0
- package/types/entities/harness-cache/inventory.d.ts +15 -0
- package/types/entities/harness-cache/npmrc.d.ts +9 -0
- package/types/entities/harness-cache/pack.d.ts +8 -0
- package/types/entities/harness-cache/progress-view.d.ts +5 -0
- package/types/entities/harness-cache/provisioning.d.ts +38 -0
- package/types/entities/harness-cache/recipes.d.ts +18 -0
- package/types/entities/harness-cache/registry.d.ts +20 -0
- package/types/entities/harness-cache/resolve.d.ts +4 -0
- package/types/entities/loadout/diff.d.ts +21 -0
- package/types/entities/loadout/index.d.ts +1 -0
- package/types/entities/proxy/ask.d.ts +9 -0
- package/types/entities/proxy/cassette.d.ts +20 -0
- package/types/entities/proxy/conversation.d.ts +10 -0
- package/types/entities/proxy/credentials.d.ts +4 -0
- package/types/entities/proxy/egress.d.ts +6 -0
- package/types/entities/proxy/exact/attribute.d.ts +19 -0
- package/types/entities/proxy/exact/cache.d.ts +7 -0
- package/types/entities/proxy/exact/counter.d.ts +17 -0
- package/types/entities/proxy/exact/endpoints.d.ts +14 -0
- package/types/entities/proxy/exact/index.d.ts +3 -0
- package/types/entities/proxy/forward.d.ts +16 -0
- package/types/entities/proxy/index.d.ts +15 -0
- package/types/entities/proxy/mcp-forward.d.ts +6 -0
- package/types/entities/proxy/model.d.ts +16 -0
- package/types/entities/proxy/prices.d.ts +10 -0
- package/types/entities/proxy/protocols/calls.d.ts +6 -0
- package/types/entities/proxy/protocols/index.d.ts +6 -0
- package/types/entities/proxy/protocols/kit.d.ts +7 -0
- package/types/entities/proxy/protocols/sse.d.ts +8 -0
- package/types/entities/proxy/relay.d.ts +13 -0
- package/types/entities/proxy/server.d.ts +17 -0
- package/types/entities/proxy/trace.d.ts +7 -0
- package/types/entities/proxy/usage.d.ts +10 -0
- package/types/entities/user-config/config.d.ts +32 -0
- package/types/entities/user-config/define.d.ts +2 -0
- package/types/entities/user-config/index.d.ts +8 -0
- package/types/entities/user-config/load.d.ts +15 -0
- package/types/entities/user-config/merge.d.ts +3 -0
- package/types/entities/user-config/network.d.ts +12 -0
- package/types/entities/user-config/option.d.ts +2 -0
- package/types/entities/user-config/problem.d.ts +13 -0
- package/types/entities/user-config/read.d.ts +2 -0
- package/types/features/test-run/api/baseline-command.d.ts +10 -0
- package/types/features/test-run/api/command.d.ts +15 -0
- package/types/features/test-run/baseline.action.d.ts +11 -0
- package/types/features/test-run/index.d.ts +11 -0
- package/types/features/test-run/lib/attempt.d.ts +31 -0
- package/types/features/test-run/lib/backend.d.ts +39 -0
- package/types/features/test-run/lib/base.d.ts +10 -0
- package/types/features/test-run/lib/binaries.d.ts +11 -0
- package/types/features/test-run/lib/capture.d.ts +37 -0
- package/types/features/test-run/lib/captured.d.ts +47 -0
- package/types/features/test-run/lib/cassettes.d.ts +15 -0
- package/types/features/test-run/lib/corpus.d.ts +5 -0
- package/types/features/test-run/lib/coverage.d.ts +15 -0
- package/types/features/test-run/lib/dsl.d.ts +31 -0
- package/types/features/test-run/lib/evals.d.ts +26 -0
- package/types/features/test-run/lib/expect.d.ts +43 -0
- package/types/features/test-run/lib/failure.d.ts +15 -0
- package/types/features/test-run/lib/loadout.d.ts +37 -0
- package/types/features/test-run/lib/model.d.ts +63 -0
- package/types/features/test-run/lib/rules.d.ts +32 -0
- package/types/features/test-run/lib/run.d.ts +44 -0
- package/types/features/test-run/lib/runs.d.ts +25 -0
- package/types/features/test-run/lib/scope.d.ts +39 -0
- package/types/features/test-run/lib/selection.d.ts +24 -0
- package/types/features/test-run/lib/session.d.ts +19 -0
- package/types/features/test-run/lib/snapshot.d.ts +46 -0
- package/types/features/test-run/lib/spend.d.ts +14 -0
- package/types/features/test-run/lib/workspace.d.ts +3 -0
- package/types/features/test-run/starting-loadout.action.d.ts +8 -0
- package/types/features/test-run/test-run.action.d.ts +51 -0
- package/types/shared/cli/command.d.ts +19 -0
- package/types/shared/cli/index.d.ts +2 -0
- package/types/shared/cli/parse.d.ts +14 -0
- package/types/shared/codeowners/codeowners.d.ts +5 -0
- package/types/shared/codeowners/index.d.ts +1 -0
- package/types/shared/contract/activation.d.ts +8 -0
- package/types/shared/contract/config.d.ts +373 -0
- package/types/shared/contract/exit-code.d.ts +10 -0
- package/types/shared/contract/harness.d.ts +31 -0
- package/types/shared/contract/index.d.ts +15 -0
- package/types/shared/contract/inspection.d.ts +327 -0
- package/types/shared/contract/json-schema.d.ts +1572 -0
- package/types/shared/contract/limits.d.ts +58 -0
- package/types/shared/contract/lint.d.ts +272 -0
- package/types/shared/contract/loadout.d.ts +195 -0
- package/types/shared/contract/lockfile.d.ts +48 -0
- package/types/shared/contract/report.d.ts +1635 -0
- package/types/shared/contract/result.d.ts +27 -0
- package/types/shared/contract/session.d.ts +230 -0
- package/types/shared/contract/tests.d.ts +625 -0
- package/types/shared/contract/trace.d.ts +42 -0
- package/types/shared/i18n/catalog-type.d.ts +4 -0
- package/types/shared/i18n/catalog.d.ts +7 -0
- package/types/shared/i18n/format.d.ts +7 -0
- package/types/shared/i18n/index.d.ts +5 -0
- package/types/shared/i18n/locales/en/index.d.ts +637 -0
- package/types/shared/i18n/locales/index.d.ts +3 -0
- package/types/shared/i18n/resolve-locale.d.ts +9 -0
- package/types/shared/i18n/translate.d.ts +5 -0
- package/types/shared/infra/env.d.ts +3 -0
- package/types/shared/infra/file-lock.d.ts +6 -0
- package/types/shared/infra/http.d.ts +7 -0
- package/types/shared/infra/index.d.ts +5 -0
- package/types/shared/infra/parallel.d.ts +2 -0
- package/types/shared/infra/platform.d.ts +9 -0
- package/types/shared/mcp-shim/index.d.ts +2 -0
- package/types/shared/mcp-shim/read.d.ts +18 -0
- package/types/shared/mcp-shim/shim.d.ts +15 -0
- package/types/shared/redact/index.d.ts +2 -0
- package/types/shared/redact/patterns.d.ts +14 -0
- package/types/shared/redact/redact.d.ts +6 -0
- package/types/shared/render/choose.d.ts +9 -0
- package/types/shared/render/index.d.ts +5 -0
- package/types/shared/render/layout.d.ts +7 -0
- package/types/shared/render/plain.d.ts +2 -0
- package/types/shared/render/renderer.d.ts +10 -0
- package/types/shared/render/view.d.ts +8 -0
- package/types/shared/stats/index.d.ts +1 -0
- package/types/shared/stats/wilson.d.ts +20 -0
- package/types/shared/tokens/calibration/calibration.d.ts +25 -0
- package/types/shared/tokens/calibration/classify.d.ts +3 -0
- package/types/shared/tokens/calibration/index.d.ts +9 -0
- package/types/shared/tokens/count.d.ts +10 -0
- package/types/shared/tokens/index.d.ts +2 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Inventory, Project } from "#entities/harness/index.js";
|
|
2
|
+
import type { Activation } from "#shared/contract/index.js";
|
|
3
|
+
import { type CellScope } from "./scope.js";
|
|
4
|
+
export type RuleSelector = {
|
|
5
|
+
owner?: string | readonly string[];
|
|
6
|
+
under?: string;
|
|
7
|
+
activation?: Activation | readonly Activation[];
|
|
8
|
+
};
|
|
9
|
+
export type Rule = {
|
|
10
|
+
path: string;
|
|
11
|
+
dir: string;
|
|
12
|
+
activation: Activation;
|
|
13
|
+
globs: readonly string[];
|
|
14
|
+
matchingFiles: (options?: {
|
|
15
|
+
sample?: number;
|
|
16
|
+
}) => string[];
|
|
17
|
+
nonMatchingFile: () => string | undefined;
|
|
18
|
+
};
|
|
19
|
+
declare const SELECTORS: unique symbol;
|
|
20
|
+
export type RuleSet = {
|
|
21
|
+
readonly [SELECTORS]: readonly RuleSelector[];
|
|
22
|
+
where: (selector: RuleSelector) => RuleSet;
|
|
23
|
+
readonly rules: Rule[];
|
|
24
|
+
readonly root: string;
|
|
25
|
+
};
|
|
26
|
+
export declare const isRuleSet: (value: unknown) => value is RuleSet;
|
|
27
|
+
export declare const rulesOf: (project: Project, inventory: Inventory) => Rule[];
|
|
28
|
+
export declare const selectRules: (scope: CellScope, set: RuleSet) => Rule[];
|
|
29
|
+
export declare const discover: {
|
|
30
|
+
rules: (selector?: RuleSelector) => RuleSet;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { HarnessId, Layer, SkipReason, TestStatus } from "#shared/contract/index.js";
|
|
2
|
+
import { type Failure } from "./attempt.js";
|
|
3
|
+
import type { Capture } from "./capture.js";
|
|
4
|
+
import type { EvalContext } from "./evals.js";
|
|
5
|
+
import { type TestDefinition } from "./model.js";
|
|
6
|
+
import type { SessionRecord, Stat } from "./scope.js";
|
|
7
|
+
import { type Selection } from "./selection.js";
|
|
8
|
+
import { type Snapshots } from "./snapshot.js";
|
|
9
|
+
import type { Workspaces } from "./workspace.js";
|
|
10
|
+
export type CellResult = {
|
|
11
|
+
file: string | undefined;
|
|
12
|
+
check?: "lint" | "policy" | "context";
|
|
13
|
+
suites: readonly string[];
|
|
14
|
+
fixture: string | undefined;
|
|
15
|
+
name: string;
|
|
16
|
+
key: string;
|
|
17
|
+
layer: Layer;
|
|
18
|
+
harness: HarnessId;
|
|
19
|
+
status: TestStatus;
|
|
20
|
+
reason?: SkipReason;
|
|
21
|
+
missing?: readonly string[];
|
|
22
|
+
failure?: Failure;
|
|
23
|
+
warnings?: number;
|
|
24
|
+
tokens?: number;
|
|
25
|
+
exact?: boolean;
|
|
26
|
+
stats?: readonly Stat[];
|
|
27
|
+
sessions?: readonly SessionRecord[];
|
|
28
|
+
attempts: number;
|
|
29
|
+
duration: number;
|
|
30
|
+
};
|
|
31
|
+
export type RunContext = {
|
|
32
|
+
root: string;
|
|
33
|
+
workspaces: Workspaces;
|
|
34
|
+
snapshots: Snapshots;
|
|
35
|
+
capture: Capture;
|
|
36
|
+
evals: EvalContext | undefined;
|
|
37
|
+
seen: (harness: HarnessId) => Set<string>;
|
|
38
|
+
};
|
|
39
|
+
export type Cell = {
|
|
40
|
+
name: string;
|
|
41
|
+
key: string;
|
|
42
|
+
item: Readonly<Record<string, unknown>> | undefined;
|
|
43
|
+
};
|
|
44
|
+
export declare const runDefinition: (definition: TestDefinition, harness: HarnessId, selection: Selection, context: RunContext) => Promise<CellResult[]>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MadeCall } from "#entities/proxy/index.js";
|
|
2
|
+
import type { LoadoutSnapshot, SkillEntry } from "#shared/contract/index.js";
|
|
3
|
+
import type { Failure } from "./attempt.js";
|
|
4
|
+
import type { CapturedLoadout } from "./captured.js";
|
|
5
|
+
export type Run = {
|
|
6
|
+
kind: "run";
|
|
7
|
+
prompt: string;
|
|
8
|
+
sample: number;
|
|
9
|
+
skills: readonly SkillEntry[];
|
|
10
|
+
rules: readonly string[];
|
|
11
|
+
tools: readonly MadeCall[];
|
|
12
|
+
changed: readonly string[];
|
|
13
|
+
turns: number;
|
|
14
|
+
cut: boolean;
|
|
15
|
+
loadout: CapturedLoadout | undefined;
|
|
16
|
+
snapshot: LoadoutSnapshot | undefined;
|
|
17
|
+
added: readonly string[];
|
|
18
|
+
error?: Failure | undefined;
|
|
19
|
+
};
|
|
20
|
+
export type Runs = readonly Run[] & {
|
|
21
|
+
readonly positive: readonly Run[];
|
|
22
|
+
readonly negative: readonly Run[];
|
|
23
|
+
};
|
|
24
|
+
export declare const runsOf: (all: readonly Run[], positive: readonly Run[], negative: readonly Run[]) => Runs;
|
|
25
|
+
export declare const isRunList: (value: unknown) => value is readonly Run[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Inventory, Project } from "#entities/harness/index.js";
|
|
2
|
+
import type { Codeowners } from "#shared/codeowners/index.js";
|
|
3
|
+
import type { HarnessId, LoadoutSnapshot } from "#shared/contract/index.js";
|
|
4
|
+
import type { Judgement, Threshold } from "#shared/stats/index.js";
|
|
5
|
+
export type Workspace = {
|
|
6
|
+
root: string;
|
|
7
|
+
project: Project;
|
|
8
|
+
codeowners: Codeowners | undefined;
|
|
9
|
+
inventoryOf: (harness: HarnessId) => Promise<Inventory>;
|
|
10
|
+
};
|
|
11
|
+
export type SnapshotCheck = (value: unknown, variant: string) => void;
|
|
12
|
+
export type SessionRecord = {
|
|
13
|
+
start: LoadoutSnapshot;
|
|
14
|
+
peak: LoadoutSnapshot;
|
|
15
|
+
timeline: readonly {
|
|
16
|
+
turn: number;
|
|
17
|
+
added: readonly string[];
|
|
18
|
+
tokens: number;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
export type Stat = Judgement & {
|
|
22
|
+
subject: string;
|
|
23
|
+
threshold: Threshold;
|
|
24
|
+
};
|
|
25
|
+
export type CellScope = {
|
|
26
|
+
harness: HarnessId;
|
|
27
|
+
workspace: Workspace;
|
|
28
|
+
inventory: Inventory;
|
|
29
|
+
snapshot: SnapshotCheck;
|
|
30
|
+
stats: Stat[];
|
|
31
|
+
sessions: SessionRecord[];
|
|
32
|
+
seen: Set<string>;
|
|
33
|
+
activate?: {
|
|
34
|
+
min: number;
|
|
35
|
+
max: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export declare const inCell: <T>(scope: CellScope, run: () => T) => T;
|
|
39
|
+
export declare const currentCell: () => CellScope;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Backend, HarnessId, Layer, SkipReason } from "#shared/contract/index.js";
|
|
2
|
+
import { type TestDefinition } from "./model.js";
|
|
3
|
+
export type Selection = {
|
|
4
|
+
harnesses: readonly HarnessId[];
|
|
5
|
+
experimental: ReadonlySet<HarnessId>;
|
|
6
|
+
backend: {
|
|
7
|
+
kind: Backend;
|
|
8
|
+
name: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
layers: ReadonlySet<Layer>;
|
|
11
|
+
filter: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
export declare const LAYERS: readonly Layer[];
|
|
14
|
+
export declare const parseLayers: (text: string) => Set<Layer> | undefined;
|
|
15
|
+
export declare const launches: (harness: HarnessId, selection: Pick<Selection, "experimental">) => boolean;
|
|
16
|
+
export type Decision = {
|
|
17
|
+
run: true;
|
|
18
|
+
} | {
|
|
19
|
+
run: false;
|
|
20
|
+
reason: SkipReason;
|
|
21
|
+
missing?: readonly string[];
|
|
22
|
+
};
|
|
23
|
+
export declare const fullName: (definition: Pick<TestDefinition, "suites" | "name">) => string;
|
|
24
|
+
export declare const decide: (definition: TestDefinition, harness: HarnessId, selection: Selection) => Decision;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Capture } from "./capture.js";
|
|
2
|
+
import type { CapturedRequest } from "./captured.js";
|
|
3
|
+
import type { CellScope } from "./scope.js";
|
|
4
|
+
export type Session = {
|
|
5
|
+
harness: string;
|
|
6
|
+
firstRequest: () => Promise<CapturedRequest>;
|
|
7
|
+
nextRequest: () => Promise<CapturedRequest>;
|
|
8
|
+
model: {
|
|
9
|
+
calls: (tool: string, input?: Record<string, unknown>) => Promise<void>;
|
|
10
|
+
says: (text: string) => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
events: () => Promise<readonly unknown[]>;
|
|
13
|
+
end: () => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export type SessionRequest = {
|
|
16
|
+
cwd?: string;
|
|
17
|
+
prompt?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const createSession: (capture: Capture, scope: CellScope, request?: SessionRequest) => Session;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { StaticLoadout } from "#entities/harness/index.js";
|
|
2
|
+
import { type FailureLine } from "./failure.js";
|
|
3
|
+
export declare const snapshotOf: (loadout: StaticLoadout) => {
|
|
4
|
+
rules: {
|
|
5
|
+
[k: string]: {
|
|
6
|
+
activation: "always" | "intent" | "manual" | "path";
|
|
7
|
+
reason: string;
|
|
8
|
+
tokens: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
skills: {
|
|
12
|
+
[k: string]: {
|
|
13
|
+
path: string;
|
|
14
|
+
tokens: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
mcp: string[];
|
|
18
|
+
commands: string[];
|
|
19
|
+
tokens: {
|
|
20
|
+
method: string;
|
|
21
|
+
commands?: number;
|
|
22
|
+
mcp?: number;
|
|
23
|
+
rules?: number;
|
|
24
|
+
skills?: number;
|
|
25
|
+
system?: number;
|
|
26
|
+
tools?: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare const attachSnapshot: <T extends object>(view: T, value: unknown, variant: string) => T;
|
|
30
|
+
export declare const attachedSnapshot: (view: unknown) => {
|
|
31
|
+
value: unknown;
|
|
32
|
+
variant: string;
|
|
33
|
+
} | undefined;
|
|
34
|
+
export declare const snapshotKey: (test: string, harness: string, version?: string) => string;
|
|
35
|
+
export declare const snapshotFile: (testFile: string) => string;
|
|
36
|
+
export declare const describeChange: (before: unknown, after: unknown) => FailureLine[];
|
|
37
|
+
export type SnapshotStats = {
|
|
38
|
+
written: number;
|
|
39
|
+
updated: number;
|
|
40
|
+
};
|
|
41
|
+
export declare const createSnapshots: (update: boolean) => {
|
|
42
|
+
load: (testFile: string) => Promise<void>;
|
|
43
|
+
check: (testFile: string, key: string, value: unknown) => void;
|
|
44
|
+
save: () => Promise<SnapshotStats>;
|
|
45
|
+
};
|
|
46
|
+
export type Snapshots = ReturnType<typeof createSnapshots>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Answer, type Exchange, type Price, type Usage } from "#entities/proxy/index.js";
|
|
2
|
+
import type { Budget } from "#shared/contract/index.js";
|
|
3
|
+
export type SpendTotal = {
|
|
4
|
+
usage: Usage;
|
|
5
|
+
cost: number;
|
|
6
|
+
unpriced: readonly string[];
|
|
7
|
+
answers: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const createSpend: (budget: Budget, prices: Readonly<Record<string, Price>>) => {
|
|
10
|
+
add: (exchange: Exchange, answer: Answer) => void;
|
|
11
|
+
refuse: () => string | undefined;
|
|
12
|
+
total: () => SpendTotal;
|
|
13
|
+
};
|
|
14
|
+
export type Spend = ReturnType<typeof createSpend>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Config } from "#entities/user-config/index.js";
|
|
2
|
+
import type { HarnessId, LoadoutSnapshot } from "#shared/contract/index.js";
|
|
3
|
+
import type { Env } from "#shared/infra/index.js";
|
|
4
|
+
export declare function createStartingLoadout(config: Config, env: Env, cwd: string, self: readonly string[]): (harness: HarnessId, binary: string) => Promise<LoadoutSnapshot>;
|
|
5
|
+
export declare namespace createStartingLoadout {
|
|
6
|
+
var inject: readonly ["config", "env", "cwd", "self"];
|
|
7
|
+
}
|
|
8
|
+
export type StartingLoadout = ReturnType<typeof createStartingLoadout>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Progress as CacheProgress } from "#entities/harness-cache/index.js";
|
|
2
|
+
import { type Config } from "#entities/user-config/index.js";
|
|
3
|
+
import type { HarnessId } from "#shared/contract/index.js";
|
|
4
|
+
import { type Env } from "#shared/infra/index.js";
|
|
5
|
+
import { type Failure } from "./lib/attempt.js";
|
|
6
|
+
import { type BaseDiff } from "./lib/base.js";
|
|
7
|
+
import { type Coverage } from "./lib/coverage.js";
|
|
8
|
+
import { type CellResult } from "./lib/run.js";
|
|
9
|
+
import { type Selection } from "./lib/selection.js";
|
|
10
|
+
import { type SnapshotStats } from "./lib/snapshot.js";
|
|
11
|
+
import { type SpendTotal } from "./lib/spend.js";
|
|
12
|
+
export type TestRunRequest = {
|
|
13
|
+
selection: Selection;
|
|
14
|
+
updateSnapshots: boolean;
|
|
15
|
+
differences?: boolean;
|
|
16
|
+
errorOnWarnings?: boolean;
|
|
17
|
+
frozen?: boolean;
|
|
18
|
+
install?: boolean;
|
|
19
|
+
record?: boolean;
|
|
20
|
+
budget?: number;
|
|
21
|
+
base?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type TestRunResult = {
|
|
24
|
+
cwd: string;
|
|
25
|
+
files: readonly string[];
|
|
26
|
+
broken: readonly {
|
|
27
|
+
file: string;
|
|
28
|
+
failure: Failure;
|
|
29
|
+
}[];
|
|
30
|
+
results: readonly CellResult[];
|
|
31
|
+
snapshots: SnapshotStats;
|
|
32
|
+
spend: SpendTotal | undefined;
|
|
33
|
+
cassettes: number;
|
|
34
|
+
root: string;
|
|
35
|
+
selection: Selection;
|
|
36
|
+
coverage: readonly Coverage[];
|
|
37
|
+
base: BaseDiff | undefined;
|
|
38
|
+
baseline: {
|
|
39
|
+
file: string;
|
|
40
|
+
known: number;
|
|
41
|
+
} | undefined;
|
|
42
|
+
installed: string | undefined;
|
|
43
|
+
duration: number;
|
|
44
|
+
};
|
|
45
|
+
export type Progress = (done: number, total: number, current: string | undefined) => void;
|
|
46
|
+
export type InstallProgress = (harness: HarnessId, progress: CacheProgress) => void;
|
|
47
|
+
export declare function createTestRunAction(config: Config, cwd: string, version: string, env: Env, self: readonly string[]): ({ selection, updateSnapshots, differences, errorOnWarnings, ...request }: TestRunRequest, progress?: Progress, onInstall?: InstallProgress) => Promise<TestRunResult>;
|
|
48
|
+
export declare namespace createTestRunAction {
|
|
49
|
+
var inject: readonly ["config", "cwd", "version", "env", "self"];
|
|
50
|
+
}
|
|
51
|
+
export type TestRunAction = ReturnType<typeof createTestRunAction>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ExitCode } from "#shared/contract/index.js";
|
|
2
|
+
import type { MessageKey } from "#shared/i18n/index.js";
|
|
3
|
+
export type OptionSpec = {
|
|
4
|
+
readonly type: "boolean" | "string";
|
|
5
|
+
readonly short?: string;
|
|
6
|
+
readonly summary: MessageKey;
|
|
7
|
+
readonly value?: string;
|
|
8
|
+
};
|
|
9
|
+
export type OptionSpecs = Readonly<Record<string, OptionSpec>>;
|
|
10
|
+
export type Values = Readonly<Record<string, string | boolean | undefined>>;
|
|
11
|
+
export type CommandSpec = {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly summary: MessageKey;
|
|
14
|
+
readonly options: OptionSpecs;
|
|
15
|
+
readonly usesConfig?: boolean;
|
|
16
|
+
readonly subcommands?: Readonly<Record<string, MessageKey>>;
|
|
17
|
+
readonly defaultSubcommand?: string;
|
|
18
|
+
};
|
|
19
|
+
export type Handler = (values: Values, args: readonly string[]) => Promise<ExitCode>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OptionSpecs, Values } from "./command.js";
|
|
2
|
+
export type ParseError = {
|
|
3
|
+
readonly kind: "unknownOption" | "missingValue" | "unexpectedValue";
|
|
4
|
+
readonly option: string;
|
|
5
|
+
};
|
|
6
|
+
export type Parsed = {
|
|
7
|
+
readonly ok: true;
|
|
8
|
+
readonly values: Values;
|
|
9
|
+
readonly positionals: readonly string[];
|
|
10
|
+
} | {
|
|
11
|
+
readonly ok: false;
|
|
12
|
+
readonly error: ParseError;
|
|
13
|
+
};
|
|
14
|
+
export declare const parseFlags: (args: readonly string[], specs: OptionSpecs) => Parsed;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CODEOWNERS_FILES, type Codeowners, parseCodeowners } from "./codeowners.js";
|