@dads-framework/testing 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.md +21 -0
- package/README.md +215 -2
- package/bin/dad-test.js +3 -0
- package/dist/cli-arguments.d.ts +26 -0
- package/dist/cli-arguments.d.ts.map +1 -0
- package/dist/cli-arguments.js +90 -0
- package/dist/cli-arguments.js.map +1 -0
- package/dist/cli-output.d.ts +8 -0
- package/dist/cli-output.d.ts.map +1 -0
- package/dist/cli-output.js +11 -0
- package/dist/cli-output.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/explain.d.ts +8 -0
- package/dist/commands/explain.d.ts.map +1 -0
- package/dist/commands/explain.js +39 -0
- package/dist/commands/explain.js.map +1 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +57 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/plan-run.d.ts +8 -0
- package/dist/commands/plan-run.d.ts.map +1 -0
- package/dist/commands/plan-run.js +93 -0
- package/dist/commands/plan-run.js.map +1 -0
- package/dist/dad-test-cli.d.ts +33 -0
- package/dist/dad-test-cli.d.ts.map +1 -0
- package/dist/dad-test-cli.js +52 -0
- package/dist/dad-test-cli.js.map +1 -0
- package/dist/explain-plan.d.ts +86 -0
- package/dist/explain-plan.d.ts.map +1 -0
- package/dist/explain-plan.js +302 -0
- package/dist/explain-plan.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/init/check-testing-manifest.d.ts +11 -0
- package/dist/init/check-testing-manifest.d.ts.map +1 -0
- package/dist/init/check-testing-manifest.js +166 -0
- package/dist/init/check-testing-manifest.js.map +1 -0
- package/dist/init/describe-error.d.ts +11 -0
- package/dist/init/describe-error.d.ts.map +1 -0
- package/dist/init/describe-error.js +13 -0
- package/dist/init/describe-error.js.map +1 -0
- package/dist/init/detect-workspace.d.ts +21 -0
- package/dist/init/detect-workspace.d.ts.map +1 -0
- package/dist/init/detect-workspace.js +133 -0
- package/dist/init/detect-workspace.js.map +1 -0
- package/dist/init/infer-one-package.d.ts +43 -0
- package/dist/init/infer-one-package.d.ts.map +1 -0
- package/dist/init/infer-one-package.js +173 -0
- package/dist/init/infer-one-package.js.map +1 -0
- package/dist/init/infer-testing-manifest.d.ts +60 -0
- package/dist/init/infer-testing-manifest.d.ts.map +1 -0
- package/dist/init/infer-testing-manifest.js +90 -0
- package/dist/init/infer-testing-manifest.js.map +1 -0
- package/dist/init/init-testing-manifest.d.ts +30 -0
- package/dist/init/init-testing-manifest.d.ts.map +1 -0
- package/dist/init/init-testing-manifest.js +205 -0
- package/dist/init/init-testing-manifest.js.map +1 -0
- package/dist/init/package-inventory.d.ts +21 -0
- package/dist/init/package-inventory.d.ts.map +1 -0
- package/dist/init/package-inventory.js +215 -0
- package/dist/init/package-inventory.js.map +1 -0
- package/dist/init/pnpm-workspace-yaml.d.ts +15 -0
- package/dist/init/pnpm-workspace-yaml.d.ts.map +1 -0
- package/dist/init/pnpm-workspace-yaml.js +158 -0
- package/dist/init/pnpm-workspace-yaml.js.map +1 -0
- package/dist/init/project-ids.d.ts +18 -0
- package/dist/init/project-ids.d.ts.map +1 -0
- package/dist/init/project-ids.js +54 -0
- package/dist/init/project-ids.js.map +1 -0
- package/dist/init/strip-json-comments.d.ts +9 -0
- package/dist/init/strip-json-comments.d.ts.map +1 -0
- package/dist/init/strip-json-comments.js +119 -0
- package/dist/init/strip-json-comments.js.map +1 -0
- package/dist/init/workspace-glob.d.ts +22 -0
- package/dist/init/workspace-glob.d.ts.map +1 -0
- package/dist/init/workspace-glob.js +154 -0
- package/dist/init/workspace-glob.js.map +1 -0
- package/dist/init/workspace-relative-path.d.ts +11 -0
- package/dist/init/workspace-relative-path.d.ts.map +1 -0
- package/dist/init/workspace-relative-path.js +17 -0
- package/dist/init/workspace-relative-path.js.map +1 -0
- package/dist/native-platform.d.ts +19 -0
- package/dist/native-platform.d.ts.map +1 -0
- package/dist/native-platform.js +115 -0
- package/dist/native-platform.js.map +1 -0
- package/dist/parse-guards.d.ts +13 -0
- package/dist/parse-guards.d.ts.map +1 -0
- package/dist/parse-guards.js +17 -0
- package/dist/parse-guards.js.map +1 -0
- package/dist/path-ownership.d.ts +17 -0
- package/dist/path-ownership.d.ts.map +1 -0
- package/dist/path-ownership.js +37 -0
- package/dist/path-ownership.js.map +1 -0
- package/dist/plan-issues.d.ts +17 -0
- package/dist/plan-issues.d.ts.map +1 -0
- package/dist/plan-issues.js +39 -0
- package/dist/plan-issues.js.map +1 -0
- package/dist/plan-reasons.d.ts +3 -0
- package/dist/plan-reasons.d.ts.map +1 -0
- package/dist/plan-reasons.js +14 -0
- package/dist/plan-reasons.js.map +1 -0
- package/dist/testing-api.d.ts +115 -0
- package/dist/testing-api.d.ts.map +1 -0
- package/dist/testing-api.js +96 -0
- package/dist/testing-api.js.map +1 -0
- package/dist/testing-manifest.d.ts +59 -0
- package/dist/testing-manifest.d.ts.map +1 -0
- package/dist/testing-manifest.js +196 -0
- package/dist/testing-manifest.js.map +1 -0
- package/dist/testing-report.d.ts +77 -0
- package/dist/testing-report.d.ts.map +1 -0
- package/dist/testing-report.js +184 -0
- package/dist/testing-report.js.map +1 -0
- package/dist/testing.tsbuildinfo +1 -0
- package/dist/write-files-atomically.d.ts +11 -0
- package/dist/write-files-atomically.d.ts.map +1 -0
- package/dist/write-files-atomically.js +30 -0
- package/dist/write-files-atomically.js.map +1 -0
- package/package.json +43 -4
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { readPositiveInteger } from "../cli-arguments.js";
|
|
3
|
+
import { writeCommandSuccess } from "../cli-output.js";
|
|
4
|
+
import { planTesting, runTesting } from "../testing-api.js";
|
|
5
|
+
import { readTestingManifest } from "../testing-manifest.js";
|
|
6
|
+
import { buildTestingReport } from "../testing-report.js";
|
|
7
|
+
import { writeFilesAtomically } from "../write-files-atomically.js";
|
|
8
|
+
/** `plan` and `run` select the same scope, so they accept the same options. */
|
|
9
|
+
const operationOptions = [
|
|
10
|
+
{ name: "--manifest", kind: "value" },
|
|
11
|
+
{ name: "--base", kind: "value" },
|
|
12
|
+
{ name: "--head", kind: "value" },
|
|
13
|
+
{ name: "--all", kind: "flag" },
|
|
14
|
+
{ name: "--task", kind: "repeatable" },
|
|
15
|
+
{ name: "--jobs", kind: "value" },
|
|
16
|
+
{ name: "--report", kind: "optional-value" },
|
|
17
|
+
];
|
|
18
|
+
export const planCommand = {
|
|
19
|
+
options: operationOptions,
|
|
20
|
+
execute: async (parsed, io, json) => {
|
|
21
|
+
const plan = await planTesting(buildOperationRequest(parsed, io));
|
|
22
|
+
const report = buildReportIfRequested(parsed, io, plan);
|
|
23
|
+
writeCommandSuccess(io, json, "plan", report === undefined ? plan : { ...plan, report });
|
|
24
|
+
writeReportWrittenLine(parsed, io, json, report);
|
|
25
|
+
return 0;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const runCommand = {
|
|
29
|
+
options: operationOptions,
|
|
30
|
+
execute: async (parsed, io, json) => {
|
|
31
|
+
const result = await runTesting(buildOperationRequest(parsed, io));
|
|
32
|
+
const report = buildReportIfRequested(parsed, io, result.plan, result.run);
|
|
33
|
+
writeCommandSuccess(io, json, "run", report === undefined
|
|
34
|
+
? result
|
|
35
|
+
: { plan: result.plan, run: result.run, report });
|
|
36
|
+
writeReportWrittenLine(parsed, io, json, report);
|
|
37
|
+
return result.run.exitCode;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Builds the `--report` output when `--report` was given, reading the manifest
|
|
42
|
+
* only in that case: without `--report`, `plan`/`run` output must stay exactly
|
|
43
|
+
* what it was before this option existed.
|
|
44
|
+
*/
|
|
45
|
+
function buildReportIfRequested(parsed, io, plan, run) {
|
|
46
|
+
if (!parsed.present.has("--report"))
|
|
47
|
+
return undefined;
|
|
48
|
+
const manifest = readTestingManifest(io.cwd, parsed.values.get("--manifest"));
|
|
49
|
+
const report = buildTestingReport({
|
|
50
|
+
plan,
|
|
51
|
+
manifest,
|
|
52
|
+
...(run === undefined ? {} : { run }),
|
|
53
|
+
});
|
|
54
|
+
const reportPath = parsed.values.get("--report");
|
|
55
|
+
if (reportPath !== undefined) {
|
|
56
|
+
writeFilesAtomically([
|
|
57
|
+
{
|
|
58
|
+
path: resolve(io.cwd, reportPath),
|
|
59
|
+
contents: `${JSON.stringify(report, null, 2)}\n`,
|
|
60
|
+
},
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
return report;
|
|
64
|
+
}
|
|
65
|
+
/** In human mode only, names the file `--report` wrote, after the normal output. */
|
|
66
|
+
function writeReportWrittenLine(parsed, io, json, report) {
|
|
67
|
+
if (json || report === undefined)
|
|
68
|
+
return;
|
|
69
|
+
const reportPath = parsed.values.get("--report");
|
|
70
|
+
if (reportPath === undefined)
|
|
71
|
+
return;
|
|
72
|
+
io.stdout(`report written: ${reportPath}\n`);
|
|
73
|
+
}
|
|
74
|
+
/** Builds the one request the native engine receives for `plan` and `run`. */
|
|
75
|
+
export function buildOperationRequest(parsed, io) {
|
|
76
|
+
const manifestPath = parsed.values.get("--manifest");
|
|
77
|
+
const base = parsed.values.get("--base");
|
|
78
|
+
const head = parsed.values.get("--head");
|
|
79
|
+
const jobs = parsed.values.get("--jobs");
|
|
80
|
+
return {
|
|
81
|
+
workspaceRoot: io.cwd,
|
|
82
|
+
...(manifestPath === undefined ? {} : { manifestPath }),
|
|
83
|
+
...(base === undefined ? {} : { base }),
|
|
84
|
+
...(head === undefined ? {} : { head }),
|
|
85
|
+
all: parsed.flags.has("--all"),
|
|
86
|
+
taskIds: parsed.repeated.get("--task") ?? [],
|
|
87
|
+
...(jobs === undefined
|
|
88
|
+
? {}
|
|
89
|
+
: { jobs: readPositiveInteger(jobs, "--jobs") }),
|
|
90
|
+
...(io.nativeBinary === undefined ? {} : { nativeBinary: io.nativeBinary }),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=plan-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-run.js","sourceRoot":"","sources":["../../src/commands/plan-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAM5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,+EAA+E;AAC/E,MAAM,gBAAgB,GAAmC;IACvD,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE;IACrC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE;IACjC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE;IACjC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE;IAC/B,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE;IACtC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE;IACjC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE;CAC7C,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAmB;IACzC,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,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|
|
2
|
+
/**
|
|
3
|
+
* The `dad-test` command line as a function of its inputs. Every effect the CLI
|
|
4
|
+
* has — the working directory it plans, the environment it reads, the streams it
|
|
5
|
+
* writes, the exit code it returns — is passed in or returned, so the whole CLI
|
|
6
|
+
* is testable in process without spawning Node.
|
|
7
|
+
*/
|
|
8
|
+
export type DadTestCliIo = {
|
|
9
|
+
readonly cwd: string;
|
|
10
|
+
readonly env: NodeJS.ProcessEnv;
|
|
11
|
+
readonly stdout: (text: string) => void;
|
|
12
|
+
readonly stderr: (text: string) => void;
|
|
13
|
+
/** An explicit native binary is intended for local development and test harnesses. */
|
|
14
|
+
readonly nativeBinary?: string;
|
|
15
|
+
};
|
|
16
|
+
export type DadTestCommand = {
|
|
17
|
+
readonly options: readonly OptionSpecification[];
|
|
18
|
+
readonly execute: (parsed: ParsedArguments, io: DadTestCliIo, json: boolean) => Promise<number>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The command surface `dad-test` accepts, in registration order: each command
|
|
22
|
+
* name with every option it parses. `--json` is listed on every command because
|
|
23
|
+
* the parser accepts it everywhere, so a reader of this list never has to know
|
|
24
|
+
* that it is implicit. Documentation checks read this instead of re-deriving the
|
|
25
|
+
* surface from the source, so a new command or option cannot ship undocumented.
|
|
26
|
+
*/
|
|
27
|
+
export declare function listDadTestCommands(): readonly {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly options: readonly string[];
|
|
30
|
+
}[];
|
|
31
|
+
/** Runs one `dad-test` invocation and returns its exit code. */
|
|
32
|
+
export declare function runDadTestCli(argumentsAfterExecutable: readonly string[], io: DadTestCliIo): Promise<number>;
|
|
33
|
+
//# sourceMappingURL=dad-test-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dad-test-cli.d.ts","sourceRoot":"","sources":["../src/dad-test-cli.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAK/E;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,sFAAsF;IACtF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,CAChB,MAAM,EAAE,eAAe,EACvB,EAAE,EAAE,YAAY,EAChB,IAAI,EAAE,OAAO,KACV,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB,CAAC;AAYF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,SAAS;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,EAAE,CAMF;AAED,gEAAgE;AAChE,wBAAsB,aAAa,CACjC,wBAAwB,EAAE,SAAS,MAAM,EAAE,EAC3C,EAAE,EAAE,YAAY,GACf,OAAO,CAAC,MAAM,CAAC,CA6BjB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { parseCommandOptions } from "./cli-arguments.js";
|
|
2
|
+
import { explainCommand } from "./commands/explain.js";
|
|
3
|
+
import { initCommand } from "./commands/init.js";
|
|
4
|
+
import { planCommand, runCommand } from "./commands/plan-run.js";
|
|
5
|
+
const usage = "Usage: dad-test plan|run|explain|init [options] [--json]. See the package README for each option.\n";
|
|
6
|
+
const commands = new Map([
|
|
7
|
+
["plan", planCommand],
|
|
8
|
+
["run", runCommand],
|
|
9
|
+
["explain", explainCommand],
|
|
10
|
+
["init", initCommand],
|
|
11
|
+
]);
|
|
12
|
+
/**
|
|
13
|
+
* The command surface `dad-test` accepts, in registration order: each command
|
|
14
|
+
* name with every option it parses. `--json` is listed on every command because
|
|
15
|
+
* the parser accepts it everywhere, so a reader of this list never has to know
|
|
16
|
+
* that it is implicit. Documentation checks read this instead of re-deriving the
|
|
17
|
+
* surface from the source, so a new command or option cannot ship undocumented.
|
|
18
|
+
*/
|
|
19
|
+
export function listDadTestCommands() {
|
|
20
|
+
return [...commands].map(([name, command]) => {
|
|
21
|
+
const optionNames = new Set(command.options.map((option) => option.name));
|
|
22
|
+
optionNames.add("--json");
|
|
23
|
+
return { name, options: [...optionNames] };
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Runs one `dad-test` invocation and returns its exit code. */
|
|
27
|
+
export async function runDadTestCli(argumentsAfterExecutable, io) {
|
|
28
|
+
// The envelope is chosen before parsing so a parse failure is still reported
|
|
29
|
+
// in the shape the caller asked for.
|
|
30
|
+
const json = argumentsAfterExecutable.includes("--json");
|
|
31
|
+
try {
|
|
32
|
+
const operation = argumentsAfterExecutable[0];
|
|
33
|
+
if (operation === "--help" || operation === "help") {
|
|
34
|
+
io.stdout(usage);
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
const command = operation === undefined ? undefined : commands.get(operation);
|
|
38
|
+
if (command === undefined) {
|
|
39
|
+
throw new Error("Expected operation plan, run, explain, or init.");
|
|
40
|
+
}
|
|
41
|
+
const parsed = parseCommandOptions(argumentsAfterExecutable.slice(1), command.options);
|
|
42
|
+
return await command.execute(parsed, io, json);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
const message = error instanceof Error ? error.message : "Unknown failure.";
|
|
46
|
+
io.stderr(json
|
|
47
|
+
? `${JSON.stringify({ schemaVersion: 1, ok: false, error: message })}\n`
|
|
48
|
+
: `dad-test: ${message}\n`);
|
|
49
|
+
return 1;
|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-api.js";
|
|
3
|
+
import type { TestingManifest } from "./testing-manifest.js";
|
|
4
|
+
/**
|
|
5
|
+
* `dad-test explain` turns a plan into the evidence behind it: for every task,
|
|
6
|
+
* why it was selected or skipped, and which uncertainty widened the selection.
|
|
7
|
+
*
|
|
8
|
+
* A plan carries that evidence directly when the engine reports `causes`. An
|
|
9
|
+
* older engine reports only a reason code, so this module reconstructs what the
|
|
10
|
+
* reason implies from the plan and the manifest. The two are never mixed: the
|
|
11
|
+
* explanation says which it is in `detail`, so a reader always knows whether a
|
|
12
|
+
* cause was proven by the engine or inferred here.
|
|
13
|
+
*/
|
|
14
|
+
export type ExplainedIssue = {
|
|
15
|
+
readonly code: string;
|
|
16
|
+
readonly message: string;
|
|
17
|
+
readonly location?: string;
|
|
18
|
+
readonly severity: "info" | "uncertainty" | "error";
|
|
19
|
+
readonly scope: "module" | "workspace" | "unknown";
|
|
20
|
+
readonly project?: string;
|
|
21
|
+
};
|
|
22
|
+
export type ExplanationCause = {
|
|
23
|
+
readonly kind: "direct-task-input";
|
|
24
|
+
readonly taskId: string;
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: "prerequisite-of";
|
|
27
|
+
readonly taskId: string;
|
|
28
|
+
} | {
|
|
29
|
+
readonly kind: "changed-path";
|
|
30
|
+
readonly path: string;
|
|
31
|
+
} | {
|
|
32
|
+
readonly kind: "changed-export";
|
|
33
|
+
readonly path: string;
|
|
34
|
+
readonly symbol: string;
|
|
35
|
+
} | {
|
|
36
|
+
readonly kind: "reached-import";
|
|
37
|
+
readonly path: string;
|
|
38
|
+
readonly location?: string;
|
|
39
|
+
readonly importedFrom: string;
|
|
40
|
+
readonly symbols: readonly string[];
|
|
41
|
+
} | {
|
|
42
|
+
readonly kind: "issue";
|
|
43
|
+
readonly issue: ExplainedIssue;
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: "fallback-dependency";
|
|
46
|
+
readonly project: string;
|
|
47
|
+
};
|
|
48
|
+
export type ExplainedTask = {
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly project?: string;
|
|
51
|
+
readonly decision: TestingTaskDecision["decision"];
|
|
52
|
+
readonly reason: string;
|
|
53
|
+
readonly reasonText: string;
|
|
54
|
+
readonly confidence: string;
|
|
55
|
+
readonly widened: boolean;
|
|
56
|
+
readonly causes: readonly ExplanationCause[];
|
|
57
|
+
};
|
|
58
|
+
export type PlanExplanation = {
|
|
59
|
+
readonly schemaVersion: 1;
|
|
60
|
+
readonly scope: TestingPlanResult["scope"];
|
|
61
|
+
readonly summary: {
|
|
62
|
+
readonly tasks: number;
|
|
63
|
+
readonly selected: number;
|
|
64
|
+
readonly skipped: number;
|
|
65
|
+
readonly widened: number;
|
|
66
|
+
readonly byReason: Readonly<Record<string, number>>;
|
|
67
|
+
readonly fullFallback: boolean;
|
|
68
|
+
readonly fullFallbackCauses: readonly ExplainedIssue[];
|
|
69
|
+
};
|
|
70
|
+
readonly tasks: readonly ExplainedTask[];
|
|
71
|
+
readonly informational: readonly ExplainedIssue[];
|
|
72
|
+
readonly detail: "engine" | "derived";
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Explains a plan. The manifest is optional because `explain` must still say
|
|
76
|
+
* something useful about a plan whose manifest cannot be read; without it,
|
|
77
|
+
* derived mode has no project ownership and reports fewer causes.
|
|
78
|
+
*/
|
|
79
|
+
export declare function explainPlan(plan: TestingPlanResult, manifest?: TestingManifest): PlanExplanation;
|
|
80
|
+
/**
|
|
81
|
+
* Renders the explanation for a person. Every line is anchored by a leading
|
|
82
|
+
* keyword and carries key=value tokens before free text, so the output is
|
|
83
|
+
* greppable without being a parsing contract: `--json` is the contract.
|
|
84
|
+
*/
|
|
85
|
+
export declare function renderPlanExplanation(explanation: PlanExplanation): string;
|
|
86
|
+
//# sourceMappingURL=explain-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explain-plan.d.ts","sourceRoot":"","sources":["../src/explain-plan.ts"],"names":[],"mappings":"AA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S,cAAc,EAAE,CAAC;KACxD,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,aAAa,EAAE,SAAS,cAAc,EAAE,CAAC;IAClD,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;CACvC,CAAC;AAQF;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,iBAAiB,EACvB,QAAQ,CAAC,EAAE,eAAe,GACzB,eAAe,CAkCjB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,eAAe,GAAG,MAAM,CAoB1E"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { owningProjectForPath } from "./path-ownership.js";
|
|
2
|
+
import { reasonTexts } from "./plan-reasons.js";
|
|
3
|
+
export { reasonTexts } from "./plan-reasons.js";
|
|
4
|
+
import { formatIssueLocation, issueScope, issueSeverity, } from "./plan-issues.js";
|
|
5
|
+
/**
|
|
6
|
+
* Derived mode knows a task imports a changed symbol but not which one, and
|
|
7
|
+
* says so rather than leaving the reader to wonder where the detail went.
|
|
8
|
+
*/
|
|
9
|
+
const derivedSymbolNote = " (symbol not reported by this dad-test build)";
|
|
10
|
+
/**
|
|
11
|
+
* Explains a plan. The manifest is optional because `explain` must still say
|
|
12
|
+
* something useful about a plan whose manifest cannot be read; without it,
|
|
13
|
+
* derived mode has no project ownership and reports fewer causes.
|
|
14
|
+
*/
|
|
15
|
+
export function explainPlan(plan, manifest) {
|
|
16
|
+
// One task without causes makes the whole explanation derived: mixing proven
|
|
17
|
+
// and inferred causes in one report would leave `detail` meaningless.
|
|
18
|
+
const detail = plan.tasks.every((task) => task.causes !== undefined)
|
|
19
|
+
? "engine"
|
|
20
|
+
: "derived";
|
|
21
|
+
const tasks = plan.tasks.map((task) => detail === "engine"
|
|
22
|
+
? explainWithEngineCauses(task, plan.issues)
|
|
23
|
+
: explainWithDerivedCauses(task, plan, manifest));
|
|
24
|
+
const selected = plan.tasks.filter((task) => task.decision === "run").length;
|
|
25
|
+
return {
|
|
26
|
+
schemaVersion: 1,
|
|
27
|
+
scope: plan.scope,
|
|
28
|
+
summary: {
|
|
29
|
+
tasks: plan.tasks.length,
|
|
30
|
+
selected,
|
|
31
|
+
skipped: plan.tasks.length - selected,
|
|
32
|
+
widened: plan.tasks.filter((task) => task.widened).length,
|
|
33
|
+
byReason: countByReason(plan.tasks),
|
|
34
|
+
fullFallback: plan.scope.fullFallback,
|
|
35
|
+
fullFallbackCauses: detail === "engine"
|
|
36
|
+
? engineFullFallbackCauses(plan)
|
|
37
|
+
: derivedFullFallbackCauses(plan),
|
|
38
|
+
},
|
|
39
|
+
tasks,
|
|
40
|
+
informational: plan.issues
|
|
41
|
+
.filter((issue) => issueSeverity(issue) === "info")
|
|
42
|
+
.map(explainIssue),
|
|
43
|
+
detail,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Renders the explanation for a person. Every line is anchored by a leading
|
|
48
|
+
* keyword and carries key=value tokens before free text, so the output is
|
|
49
|
+
* greppable without being a parsing contract: `--json` is the contract.
|
|
50
|
+
*/
|
|
51
|
+
export function renderPlanExplanation(explanation) {
|
|
52
|
+
const { summary } = explanation;
|
|
53
|
+
const lines = [
|
|
54
|
+
`explain: ${String(summary.selected)} of ${String(summary.tasks)} tasks selected, ${String(summary.skipped)} skipped, ${String(summary.widened)} widened detail=${explanation.detail}`,
|
|
55
|
+
renderScope(explanation.scope),
|
|
56
|
+
`full-fallback: ${summary.fullFallback ? "yes" : "no"}`,
|
|
57
|
+
];
|
|
58
|
+
if (summary.fullFallback) {
|
|
59
|
+
for (const issue of summary.fullFallbackCauses) {
|
|
60
|
+
lines.push(` forced-by ${renderIssue(issue)}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (const task of explanation.tasks) {
|
|
64
|
+
lines.push(renderTaskHeadline(task), ` because ${task.reasonText}`);
|
|
65
|
+
for (const cause of task.causes)
|
|
66
|
+
lines.push(` ${renderCause(cause)}`);
|
|
67
|
+
}
|
|
68
|
+
for (const issue of explanation.informational) {
|
|
69
|
+
lines.push(`info ${issue.code} ${issue.message}`);
|
|
70
|
+
}
|
|
71
|
+
return `${lines.join("\n")}\n`;
|
|
72
|
+
}
|
|
73
|
+
// --- Engine causes -------------------------------------------------------
|
|
74
|
+
function explainWithEngineCauses(task, issues) {
|
|
75
|
+
return {
|
|
76
|
+
...taskHeadFields(task, task.project),
|
|
77
|
+
reasonText: reasonTexts[task.reason] ?? task.reason,
|
|
78
|
+
causes: (task.causes ?? []).map((cause) => explainCause(cause, issues)),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function explainCause(cause, issues) {
|
|
82
|
+
switch (cause.kind) {
|
|
83
|
+
case "direct-task-input":
|
|
84
|
+
return { kind: "direct-task-input", taskId: cause.taskId };
|
|
85
|
+
case "prerequisite-of":
|
|
86
|
+
return { kind: "prerequisite-of", taskId: cause.taskId };
|
|
87
|
+
case "changed-path":
|
|
88
|
+
return { kind: "changed-path", path: cause.path };
|
|
89
|
+
case "changed-export":
|
|
90
|
+
return {
|
|
91
|
+
kind: "changed-export",
|
|
92
|
+
path: cause.path,
|
|
93
|
+
symbol: cause.symbol,
|
|
94
|
+
};
|
|
95
|
+
case "reached-import": {
|
|
96
|
+
// The location is carried only when it says more than the path already does.
|
|
97
|
+
const location = cause.line === undefined
|
|
98
|
+
? undefined
|
|
99
|
+
: formatSourceLocation(cause.path, cause.line, cause.column);
|
|
100
|
+
return {
|
|
101
|
+
kind: "reached-import",
|
|
102
|
+
path: cause.path,
|
|
103
|
+
...(location === undefined ? {} : { location }),
|
|
104
|
+
importedFrom: cause.importedFrom,
|
|
105
|
+
symbols: cause.symbols,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
case "issue":
|
|
109
|
+
return { kind: "issue", issue: explainIssueAt(issues, cause.index) };
|
|
110
|
+
case "fallback-dependency":
|
|
111
|
+
return { kind: "fallback-dependency", project: cause.project };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function engineFullFallbackCauses(plan) {
|
|
115
|
+
const indexes = new Set();
|
|
116
|
+
for (const task of plan.tasks) {
|
|
117
|
+
if (task.reason !== "full-fallback")
|
|
118
|
+
continue;
|
|
119
|
+
for (const cause of task.causes ?? []) {
|
|
120
|
+
if (cause.kind === "issue")
|
|
121
|
+
indexes.add(cause.index);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return [...indexes]
|
|
125
|
+
.sort((left, right) => left - right)
|
|
126
|
+
.map((index) => explainIssueAt(plan.issues, index));
|
|
127
|
+
}
|
|
128
|
+
// --- Derived causes ------------------------------------------------------
|
|
129
|
+
function explainWithDerivedCauses(task, plan, manifest) {
|
|
130
|
+
const project = task.project ??
|
|
131
|
+
manifest?.tasks.find((candidate) => candidate.id === task.id)?.project;
|
|
132
|
+
const reasonText = reasonTexts[task.reason] ?? task.reason;
|
|
133
|
+
return {
|
|
134
|
+
...taskHeadFields(task, project),
|
|
135
|
+
reasonText: task.reason === "graph-symbol-importer"
|
|
136
|
+
? `${reasonText}${derivedSymbolNote}`
|
|
137
|
+
: reasonText,
|
|
138
|
+
causes: deriveCauses(task, plan, manifest, project),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function deriveCauses(task, plan, manifest, project) {
|
|
142
|
+
switch (task.reason) {
|
|
143
|
+
case "direct-task-input":
|
|
144
|
+
return [{ kind: "direct-task-input", taskId: task.id }];
|
|
145
|
+
case "full-fallback":
|
|
146
|
+
return workspaceUncertaintyIssues(plan.issues).map(asIssueCause);
|
|
147
|
+
case "graph-uncertainty-project-fallback":
|
|
148
|
+
return [
|
|
149
|
+
...moduleUncertaintyIssues(plan.issues, project).map(asIssueCause),
|
|
150
|
+
...ownedChangedPathCauses(plan, manifest, project),
|
|
151
|
+
];
|
|
152
|
+
case "changed-owned-project":
|
|
153
|
+
case "graph-changed-export":
|
|
154
|
+
return ownedChangedPathCauses(plan, manifest, project);
|
|
155
|
+
case "selected-prerequisite":
|
|
156
|
+
return prerequisiteCauses(task.id, plan, manifest);
|
|
157
|
+
// impact-always, proven-unaffected, graph-symbol-importer and any reason
|
|
158
|
+
// this build does not know carry no evidence that can be reconstructed.
|
|
159
|
+
default:
|
|
160
|
+
return [];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function derivedFullFallbackCauses(plan) {
|
|
164
|
+
if (!plan.tasks.some((task) => task.reason === "full-fallback"))
|
|
165
|
+
return [];
|
|
166
|
+
return workspaceUncertaintyIssues(plan.issues);
|
|
167
|
+
}
|
|
168
|
+
function ownedChangedPathCauses(plan, manifest, project) {
|
|
169
|
+
if (manifest === undefined || project === undefined)
|
|
170
|
+
return [];
|
|
171
|
+
return plan.scope.changedPaths
|
|
172
|
+
.filter((path) => owningProjectForPath(manifest.projects, path)?.id === project)
|
|
173
|
+
.map((path) => ({ kind: "changed-path", path }));
|
|
174
|
+
}
|
|
175
|
+
function prerequisiteCauses(taskId, plan, manifest) {
|
|
176
|
+
if (manifest === undefined)
|
|
177
|
+
return [];
|
|
178
|
+
const selected = new Set(plan.tasks.filter((task) => task.decision === "run").map((task) => task.id));
|
|
179
|
+
return manifest.tasks
|
|
180
|
+
.filter((task) => selected.has(task.id) && task.dependsOn.includes(taskId))
|
|
181
|
+
.map((task) => ({
|
|
182
|
+
kind: "prerequisite-of",
|
|
183
|
+
taskId: task.id,
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
function workspaceUncertaintyIssues(issues) {
|
|
187
|
+
return issues
|
|
188
|
+
.filter((issue) => issueScope(issue) === "workspace" && issueSeverity(issue) !== "info")
|
|
189
|
+
.map(explainIssue);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* A module-scope uncertainty explains a project only when it names that project
|
|
193
|
+
* or names none: an uncertainty about another module is not evidence here.
|
|
194
|
+
*/
|
|
195
|
+
function moduleUncertaintyIssues(issues, project) {
|
|
196
|
+
return issues
|
|
197
|
+
.filter((issue) => issueScope(issue) === "module" &&
|
|
198
|
+
issueSeverity(issue) !== "info" &&
|
|
199
|
+
(issue.project === undefined || issue.project === project))
|
|
200
|
+
.map(explainIssue);
|
|
201
|
+
}
|
|
202
|
+
function asIssueCause(issue) {
|
|
203
|
+
return { kind: "issue", issue };
|
|
204
|
+
}
|
|
205
|
+
// --- Shared shaping ------------------------------------------------------
|
|
206
|
+
function taskHeadFields(task, project) {
|
|
207
|
+
return {
|
|
208
|
+
id: task.id,
|
|
209
|
+
...(project === undefined ? {} : { project }),
|
|
210
|
+
decision: task.decision,
|
|
211
|
+
reason: task.reason,
|
|
212
|
+
confidence: task.confidence,
|
|
213
|
+
widened: task.widened,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function countByReason(tasks) {
|
|
217
|
+
const counts = {};
|
|
218
|
+
for (const task of tasks) {
|
|
219
|
+
counts[task.reason] = (counts[task.reason] ?? 0) + 1;
|
|
220
|
+
}
|
|
221
|
+
return counts;
|
|
222
|
+
}
|
|
223
|
+
function explainIssue(issue) {
|
|
224
|
+
const location = formatIssueLocation(issue);
|
|
225
|
+
return {
|
|
226
|
+
code: issue.code,
|
|
227
|
+
message: issue.message,
|
|
228
|
+
...(location === undefined ? {} : { location }),
|
|
229
|
+
severity: issueSeverity(issue),
|
|
230
|
+
scope: issueScope(issue),
|
|
231
|
+
...(issue.project === undefined ? {} : { project: issue.project }),
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Resolves an issue reference. A reference the plan cannot satisfy is reported
|
|
236
|
+
* as its own uncertainty rather than dropped: a cause that cannot be shown is
|
|
237
|
+
* still a cause, and losing it would make the explanation look complete.
|
|
238
|
+
*/
|
|
239
|
+
function explainIssueAt(issues, index) {
|
|
240
|
+
const issue = issues[index];
|
|
241
|
+
if (issue === undefined) {
|
|
242
|
+
return {
|
|
243
|
+
code: "unknown-issue-index",
|
|
244
|
+
message: `the plan referenced issue index ${String(index)}, which it does not contain`,
|
|
245
|
+
severity: "uncertainty",
|
|
246
|
+
scope: "unknown",
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
return explainIssue(issue);
|
|
250
|
+
}
|
|
251
|
+
/** Formats a source position exactly as an issue location is formatted. */
|
|
252
|
+
function formatSourceLocation(path, line, column) {
|
|
253
|
+
return (formatIssueLocation({
|
|
254
|
+
code: "source-location",
|
|
255
|
+
message: "",
|
|
256
|
+
path,
|
|
257
|
+
...(line === undefined ? {} : { line }),
|
|
258
|
+
...(column === undefined ? {} : { column }),
|
|
259
|
+
}) ?? path);
|
|
260
|
+
}
|
|
261
|
+
// --- Human rendering -----------------------------------------------------
|
|
262
|
+
function renderScope(scope) {
|
|
263
|
+
const tokens = [`kind=${scope.kind}`];
|
|
264
|
+
if (scope.base !== undefined)
|
|
265
|
+
tokens.push(`base=${scope.base}`);
|
|
266
|
+
if (scope.head !== undefined)
|
|
267
|
+
tokens.push(`head=${scope.head}`);
|
|
268
|
+
tokens.push(`changed=${String(scope.changedPaths.length)}`);
|
|
269
|
+
return `scope: ${tokens.join(" ")}`;
|
|
270
|
+
}
|
|
271
|
+
function renderTaskHeadline(task) {
|
|
272
|
+
const tokens = [task.decision === "run" ? "RUN" : "SKIP", task.id];
|
|
273
|
+
if (task.project !== undefined)
|
|
274
|
+
tokens.push(`project=${task.project}`);
|
|
275
|
+
tokens.push(`reason=${task.reason}`, `confidence=${task.confidence}`, `widened=${task.widened ? "yes" : "no"}`);
|
|
276
|
+
return tokens.join(" ");
|
|
277
|
+
}
|
|
278
|
+
function renderCause(cause) {
|
|
279
|
+
switch (cause.kind) {
|
|
280
|
+
case "changed-path":
|
|
281
|
+
return `changed ${cause.path}`;
|
|
282
|
+
case "changed-export":
|
|
283
|
+
return `export ${cause.symbol} ${cause.path}`;
|
|
284
|
+
case "reached-import": {
|
|
285
|
+
const symbols = cause.symbols.length === 0 ? "" : ` ${cause.symbols.join(",")}`;
|
|
286
|
+
return `import ${cause.location ?? cause.path} from ${cause.importedFrom}${symbols}`;
|
|
287
|
+
}
|
|
288
|
+
case "prerequisite-of":
|
|
289
|
+
return `prerequisite-of ${cause.taskId}`;
|
|
290
|
+
case "direct-task-input":
|
|
291
|
+
return `direct-task-input ${cause.taskId}`;
|
|
292
|
+
case "issue":
|
|
293
|
+
return `issue ${renderIssue(cause.issue)}`;
|
|
294
|
+
case "fallback-dependency":
|
|
295
|
+
return `fallback-dependency ${cause.project}`;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function renderIssue(issue) {
|
|
299
|
+
const location = issue.location === undefined ? "" : `${issue.location} `;
|
|
300
|
+
return `${issue.code} ${location}${issue.message}`;
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=explain-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explain-plan.js","sourceRoot":"","sources":["../src/explain-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,aAAa,GACd,MAAM,kBAAkB,CAAC;AA4E1B;;;GAGG;AACH,MAAM,iBAAiB,GAAG,+CAA+C,CAAC;AAE1E;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,IAAuB,EACvB,QAA0B;IAE1B,6EAA6E;IAC7E,sEAAsE;IACtE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC;QAClE,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,C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C,QAAQ,GAAG,CAAC;IAC1E,OAAO,GAAG,KAAK,CAAC,IAAI,IAAI,QAAQ,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;AACrD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { planTesting, runTesting, type TestingOperationRequest, type TestingPlanIssue, type TestingPlanResult, type TestingRunResult, type TestingTaskCause, type TestingTaskDecision, type TestingTaskOutput, type TestingTaskRunResult, } from "./testing-api.js";
|
|
2
|
+
export { listDadTestCommands, runDadTestCli, type DadTestCliIo, } from "./dad-test-cli.js";
|
|
3
|
+
export { parseTestingManifest, readTestingManifest, serializeTestingManifest, type TestingManifest, type TestingManifestProject, type TestingManifestTask, } from "./testing-manifest.js";
|
|
4
|
+
export { owningProjectForPath, pathIsInside } from "./path-ownership.js";
|
|
5
|
+
export { formatIssueLocation, issueScope, issueSeverity, } from "./plan-issues.js";
|
|
6
|
+
export { writeFilesAtomically } from "./write-files-atomically.js";
|
|
7
|
+
export { explainPlan, reasonTexts, renderPlanExplanation, type ExplainedIssue, type ExplainedTask, type ExplanationCause, type PlanExplanation, } from "./explain-plan.js";
|
|
8
|
+
export { buildTestingReport, type ReportIssue, type TestingReport, } from "./testing-report.js";
|
|
9
|
+
export { initTestingManifest, type InitTestingManifestOptions, type InitTestingManifestResult, } from "./init/init-testing-manifest.js";
|
|
10
|
+
export { inferTestingManifest, type InitInference, type InitReport, type InitUnsupported, } from "./init/infer-testing-manifest.js";
|
|
11
|
+
export { checkTestingManifest } from "./init/check-testing-manifest.js";
|
|
12
|
+
export { detectWorkspace, type DetectedWorkspace, } from "./init/detect-workspace.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,UAAU,EACV,KAAK,uBAAuB,EAC5B,KAAK,g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+
export { listDadTestCommands, runDadTestCli, } from "./dad-test-cli.js";
|
|
3
|
+
export { parseTestingManifest, readTestingManifest, serializeTestingManifest, } from "./testing-manifest.js";
|
|
4
|
+
export { owningProjectForPath, pathIsInside } from "./path-ownership.js";
|
|
5
|
+
export { formatIssueLocation, issueScope, issueSeverity, } from "./plan-issues.js";
|
|
6
|
+
export { writeFilesAtomically } from "./write-files-atomically.js";
|
|
7
|
+
export { explainPlan, reasonTexts, renderPlanExplanation, } from "./explain-plan.js";
|
|
8
|
+
export { buildTestingReport, } from "./testing-report.js";
|
|
9
|
+
export { initTestingManifest, } from "./init/init-testing-manifest.js";
|
|
10
|
+
export { inferTestingManifest, } from "./init/infer-testing-manifest.js";
|
|
11
|
+
export { checkTestingManifest } from "./init/check-testing-manifest.js";
|
|
12
|
+
export { detectWorkspace, } from "./init/detect-workspace.js";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|