/** * The affected-scope test template a project runs under, declared or derived * (T13125). * * A scope-aware `tool:test` (T12959) runs only the packages a branch changed, * plus their dependents, when the project declares `testing.affectedCommand`. * Most workspaces never declared one, so every `cleo verify --evidence * tool:test` ran the whole workspace suite, once per task: on 2026-10-03 * VidaPeps (`testing.command` = `pnpm -r --no-bail --if-present run test`) * ran its entire suite for T1955 and then again for T1956, back to back. * * For the commands whose workspace-wide form names the scope as one flag, the * affected form is mechanical — the same command with that flag replaced by a * per-package selection: * * | Workspace-wide test command | Affected template | * |------------------------------------|---------------------------------------| * | `pnpm -r [flags] [run] test` | `pnpm {filters} [flags] [run] test` | * | `npm [run] test --workspaces` | `npm [run] test {workspaces}` | * | `turbo run test` (no `--filter`) | `turbo run test {filters}` | * * It runs the same per-package `test` scripts the full command runs, on the * subset; the affected planner still refuses the scope (a full run) when a * change touches anything outside every package. A ` run test` / * `npm test` command that delegates to the root `test` script is read through * that script once. Anything else derives nothing. * * A declared `testing.affectedCommand` always wins; a derived one is reported * as derived, with the command it came from, so `cleo init`, `cleo detect` * and `cleo doctor` can propose it and an evidence atom can say what it ran. * * @module * @task T13125 */ /** Where an affected template came from. */ export type AffectedTemplateSource = 'declared' | 'derived'; /** An affected-scope test template and its provenance. */ export interface AffectedTemplate { /** The template, e.g. `pnpm {filters} --no-bail --if-present run test`. */ readonly template: string; /** `declared` in `.cleo/project-context.json`, or `derived` from `testing.command`. */ readonly source: AffectedTemplateSource; /** For a derived template: the workspace-wide command it was derived from. */ readonly basis: string | null; } /** * Whether `root` is a workspace root: a `pnpm-workspace.yaml`, or a * `package.json` declaring `workspaces`. * * @param root - Directory to inspect. * @returns `true` for a workspace root. * @task T13125 */ export declare function isWorkspaceRoot(root: string): boolean; /** * Derive an affected-scope test template from a workspace's test command. * * @param root - The workspace root (its `package.json` and workspace file are read). * @param testCommand - `testing.command`, as declared or detected; when absent, * the root `test` script (what the language default runs) is read instead. * @returns The template and the workspace-wide command it came from, or `null` * when the command is not one whose affected form is mechanical, uses shell * syntax, or `root` is not a workspace. * * @example * ```ts * proposeAffectedCommand(root, 'pnpm -r --no-bail --if-present run test'); * // → { template: 'pnpm {filters} --no-bail --if-present run test', * // basis: 'pnpm -r --no-bail --if-present run test' } * ``` * * @task T13125 */ export declare function proposeAffectedCommand(root: string, testCommand: string | undefined): { template: string; basis: string; } | null; /** * The affected template a project's evidence runs use: the declared * `testing.affectedCommand`, else one derived from `testing.command` * ({@link proposeAffectedCommand}), else `null`. * * @param testing - The raw `testing` block of `.cleo/project-context.json`. * @param root - The workspace root the derivation inspects. * @returns The template with its provenance, or `null`. * * @task T13125 */ export declare function resolveAffectedTemplate(testing: { affectedCommand?: unknown; command?: unknown; } | undefined, root: string): AffectedTemplate | null; //# sourceMappingURL=affected-template.d.ts.map