@interf/compiler 0.9.4 → 0.9.5
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/CHANGELOG.md +93 -0
- package/README.md +2 -1
- package/agent-skills/interf-actions/SKILL.md +17 -11
- package/agent-skills/interf-actions/references/cli.md +8 -22
- package/dist/cli/commands/action-input-cli.d.ts +25 -0
- package/dist/cli/commands/action-input-cli.js +73 -0
- package/dist/cli/commands/compile.d.ts +3 -8
- package/dist/cli/commands/compile.js +13 -41
- package/dist/cli/commands/create-method-wizard.d.ts +0 -12
- package/dist/cli/commands/create-method-wizard.js +95 -126
- package/dist/cli/commands/create.d.ts +0 -2
- package/dist/cli/commands/create.js +16 -22
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/executor-flow.js +1 -1
- package/dist/cli/commands/init.d.ts +16 -1
- package/dist/cli/commands/init.js +40 -53
- package/dist/cli/commands/list.js +1 -1
- package/dist/cli/commands/preparation-action.d.ts +8 -0
- package/dist/cli/commands/preparation-action.js +29 -0
- package/dist/cli/commands/preparation-picker.d.ts +5 -0
- package/dist/cli/commands/preparation-picker.js +36 -0
- package/dist/cli/commands/preparation-selection.js +2 -2
- package/dist/cli/commands/reset.js +15 -4
- package/dist/cli/commands/service-action-flow.d.ts +9 -0
- package/dist/cli/commands/service-action-flow.js +19 -0
- package/dist/cli/commands/source-config-wizard.d.ts +0 -1
- package/dist/cli/commands/source-config-wizard.js +43 -53
- package/dist/cli/commands/status.js +7 -123
- package/dist/cli/commands/test.d.ts +1 -2
- package/dist/cli/commands/test.js +40 -203
- package/dist/cli/commands/web.js +8 -262
- package/dist/compiler-ui/404.html +1 -1
- package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
- package/dist/compiler-ui/__next._full.txt +3 -3
- package/dist/compiler-ui/__next._head.txt +1 -1
- package/dist/compiler-ui/__next._index.txt +2 -2
- package/dist/compiler-ui/__next._tree.txt +2 -2
- package/dist/compiler-ui/_next/static/chunks/177mvn4rse235.js +89 -0
- package/dist/compiler-ui/_next/static/chunks/18a8f2jkv3z.c.css +3 -0
- package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
- package/dist/compiler-ui/_not-found.html +1 -1
- package/dist/compiler-ui/_not-found.txt +2 -2
- package/dist/compiler-ui/index.html +1 -1
- package/dist/compiler-ui/index.txt +3 -3
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -16
- package/dist/packages/agents/lib/shells.js +2 -2
- package/dist/packages/compiler/lib/schema.d.ts +1 -1
- package/dist/packages/compiler/lib/schema.js +1 -1
- package/dist/packages/contracts/lib/schema.d.ts +0 -1
- package/dist/packages/contracts/lib/schema.js +0 -1
- package/dist/packages/execution/lib/schema.d.ts +0 -7
- package/dist/packages/execution/lib/schema.js +0 -1
- package/dist/packages/local-service/action-definitions.d.ts +246 -0
- package/dist/packages/local-service/action-definitions.js +1148 -0
- package/dist/packages/local-service/action-planner.d.ts +9 -0
- package/dist/packages/local-service/action-planner.js +134 -0
- package/dist/packages/local-service/action-values.d.ts +1 -23
- package/dist/packages/local-service/action-values.js +1 -31
- package/dist/packages/local-service/client.d.ts +48 -17
- package/dist/packages/local-service/client.js +95 -52
- package/dist/packages/local-service/index.d.ts +8 -5
- package/dist/packages/local-service/index.js +5 -3
- package/dist/packages/local-service/lib/schema.d.ts +301 -295
- package/dist/packages/local-service/lib/schema.js +114 -39
- package/dist/packages/local-service/native-run-handlers.d.ts +23 -0
- package/dist/{cli/commands/compile-controller.js → packages/local-service/native-run-handlers.js} +203 -19
- package/dist/{cli/commands/check-draft.d.ts → packages/local-service/readiness-check-draft.d.ts} +2 -2
- package/dist/packages/local-service/routes.d.ts +6 -1
- package/dist/packages/local-service/routes.js +7 -2
- package/dist/packages/local-service/run-observability.js +15 -17
- package/dist/packages/local-service/runtime.d.ts +10 -7
- package/dist/packages/local-service/runtime.js +427 -297
- package/dist/packages/local-service/server.js +94 -44
- package/dist/packages/method-package/method-review-paths.d.ts +1 -1
- package/dist/packages/method-package/method-review-paths.js +5 -5
- package/dist/packages/project-model/index.d.ts +1 -0
- package/dist/packages/project-model/index.js +1 -0
- package/dist/packages/project-model/preparation-entries.d.ts +11 -0
- package/dist/packages/project-model/preparation-entries.js +49 -0
- package/dist/packages/project-model/source-config.d.ts +1 -0
- package/dist/packages/project-model/source-config.js +12 -1
- package/dist/packages/testing/lib/schema.d.ts +2 -3
- package/dist/packages/testing/lib/schema.js +2 -3
- package/dist/packages/testing/readiness-check-run.d.ts +3 -3
- package/dist/packages/testing/readiness-check-run.js +12 -17
- package/package.json +5 -24
- package/dist/cli/commands/compile-controller.d.ts +0 -17
- package/dist/cli/commands/compiled-flow.d.ts +0 -25
- package/dist/cli/commands/compiled-flow.js +0 -112
- package/dist/cli/commands/test-flow.d.ts +0 -58
- package/dist/cli/commands/test-flow.js +0 -231
- package/dist/compiler-ui/_next/static/chunks/0d~8t0zm6545p.js +0 -118
- package/dist/compiler-ui/_next/static/chunks/0xnel.ax9a.2c.css +0 -3
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → 84FaeF3EzBF9kKTMjSEVN}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → 84FaeF3EzBF9kKTMjSEVN}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → 84FaeF3EzBF9kKTMjSEVN}/_ssgManifest.js +0 -0
- /package/dist/{cli/commands/check-draft.js → packages/local-service/readiness-check-draft.js} +0 -0
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import * as p from "@clack/prompts";
|
|
3
|
-
import { ensurePortableContextScaffold, listPortableContextsForSourceFolder, } from "../../packages/project-model/interf.js";
|
|
4
|
-
import { listSourcePreparationConfigs, loadCompiledPreparationConfig, loadSourceFolderConfig, resolveSourcePreparationPath, sourcePreparationConfigFromInterfConfig, syncCompiledInterfConfigFromSourcePreparationConfig, } from "../../packages/project-model/source-config.js";
|
|
5
|
-
import { compileCompiled, createCompiled, } from "../../packages/compiler/method-runs.js";
|
|
6
|
-
import { formatMethodExecutionProfile } from "../../packages/agents/lib/execution-profile.js";
|
|
7
|
-
import { resolveMethodId } from "../../packages/methods/method-resolution.js";
|
|
8
|
-
function formatSavedPreparationHint(entry) {
|
|
9
|
-
const config = entry.config;
|
|
10
|
-
const checkCount = config.checks.length;
|
|
11
|
-
const methodHint = `Method ${resolveMethodId(config)}${entry.localDraft ? " (local draft)" : ""}`;
|
|
12
|
-
if (config.about)
|
|
13
|
-
return `${config.path} · ${config.about} · ${methodHint}`;
|
|
14
|
-
if (checkCount === 0)
|
|
15
|
-
return `${config.path} · No readiness checks yet · ${methodHint}`;
|
|
16
|
-
return `${config.path} · ${checkCount} readiness check${checkCount === 1 ? "" : "s"} · ${methodHint}`;
|
|
17
|
-
}
|
|
18
|
-
export function listSavedPreparationEntries(sourcePath) {
|
|
19
|
-
const builtEntries = new Map();
|
|
20
|
-
for (const builtCompiled of listPortableContextsForSourceFolder(sourcePath)) {
|
|
21
|
-
const preparationConfig = loadCompiledPreparationConfig(builtCompiled.path)
|
|
22
|
-
?? sourcePreparationConfigFromInterfConfig(builtCompiled.config);
|
|
23
|
-
builtEntries.set(builtCompiled.config.name, {
|
|
24
|
-
config: preparationConfig,
|
|
25
|
-
path: builtCompiled.path,
|
|
26
|
-
localDraft: builtCompiled.config.method_origin?.local_draft === true,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
const entries = new Map();
|
|
30
|
-
for (const config of listSourcePreparationConfigs(loadSourceFolderConfig(sourcePath))) {
|
|
31
|
-
const built = builtEntries.get(config.name);
|
|
32
|
-
entries.set(config.name, {
|
|
33
|
-
config,
|
|
34
|
-
path: built?.path ?? null,
|
|
35
|
-
localDraft: built?.localDraft ?? false,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return Array.from(entries.values()).sort((left, right) => left.config.name.localeCompare(right.config.name));
|
|
39
|
-
}
|
|
40
|
-
export function findBuiltCompiledPath(sourcePath, compiledName) {
|
|
41
|
-
return listSavedPreparationEntries(sourcePath).find((entry) => entry.config.name === compiledName)?.path ?? null;
|
|
42
|
-
}
|
|
43
|
-
export function findSavedCompiledConfig(sourcePath, compiledName) {
|
|
44
|
-
return listSavedPreparationEntries(sourcePath).find((entry) => entry.config.name === compiledName)?.config ?? null;
|
|
45
|
-
}
|
|
46
|
-
export async function chooseCompiledConfigToBuild(options) {
|
|
47
|
-
const savedEntries = listSavedPreparationEntries(options.sourcePath);
|
|
48
|
-
if (savedEntries.length === 0) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
if (savedEntries.length === 1) {
|
|
52
|
-
return savedEntries[0]?.config ?? null;
|
|
53
|
-
}
|
|
54
|
-
const selected = await p.select({
|
|
55
|
-
message: options.selectMessage,
|
|
56
|
-
options: savedEntries.map((entry) => ({
|
|
57
|
-
value: entry.config.name,
|
|
58
|
-
label: entry.config.name,
|
|
59
|
-
hint: [
|
|
60
|
-
formatSavedPreparationHint(entry),
|
|
61
|
-
entry.path ? "Portable Context available" : "Portable Context not built yet",
|
|
62
|
-
].join(" · "),
|
|
63
|
-
})),
|
|
64
|
-
});
|
|
65
|
-
if (p.isCancel(selected))
|
|
66
|
-
return undefined;
|
|
67
|
-
return savedEntries.find((entry) => entry.config.name === selected)?.config ?? null;
|
|
68
|
-
}
|
|
69
|
-
export function createCompiledFromConfig(sourcePath, preparationConfig) {
|
|
70
|
-
const methodId = resolveMethodId(preparationConfig);
|
|
71
|
-
const sourceFolderPath = resolveSourcePreparationPath(sourcePath, preparationConfig);
|
|
72
|
-
const compiledPath = createCompiled(preparationConfig.name, sourcePath, methodId, preparationConfig.about, sourceFolderPath);
|
|
73
|
-
syncCompiledInterfConfigFromSourcePreparationConfig(compiledPath, preparationConfig);
|
|
74
|
-
return compiledPath;
|
|
75
|
-
}
|
|
76
|
-
export function ensureCompiledFromConfig(sourcePath, preparationConfig) {
|
|
77
|
-
const methodId = resolveMethodId(preparationConfig);
|
|
78
|
-
const existingPath = findBuiltCompiledPath(sourcePath, preparationConfig.name);
|
|
79
|
-
if (existingPath) {
|
|
80
|
-
ensurePortableContextScaffold(sourcePath, preparationConfig.name, methodId);
|
|
81
|
-
syncCompiledInterfConfigFromSourcePreparationConfig(existingPath, preparationConfig);
|
|
82
|
-
return existingPath;
|
|
83
|
-
}
|
|
84
|
-
return createCompiledFromConfig(sourcePath, preparationConfig);
|
|
85
|
-
}
|
|
86
|
-
export async function compileCompiledWithReporter(executor, compiledPath, options = {}) {
|
|
87
|
-
console.log();
|
|
88
|
-
console.log(chalk.bold(` ${options.heading ?? "Building Portable Context..."}`));
|
|
89
|
-
const profileLabel = formatMethodExecutionProfile(executor.executionProfile);
|
|
90
|
-
if (profileLabel) {
|
|
91
|
-
console.log(chalk.dim(` Execution profile: ${profileLabel}`));
|
|
92
|
-
}
|
|
93
|
-
console.log();
|
|
94
|
-
const reporter = {
|
|
95
|
-
line: (message) => console.log(chalk.dim(` ${message}`)),
|
|
96
|
-
blankLine: () => console.log(),
|
|
97
|
-
};
|
|
98
|
-
const result = await compileCompiled({
|
|
99
|
-
executor,
|
|
100
|
-
compiledPath,
|
|
101
|
-
reporter,
|
|
102
|
-
preserveStageShells: options.preserveStageShells,
|
|
103
|
-
runId: options.runId,
|
|
104
|
-
events: options.events,
|
|
105
|
-
});
|
|
106
|
-
if (!result.ok) {
|
|
107
|
-
return result;
|
|
108
|
-
}
|
|
109
|
-
console.log();
|
|
110
|
-
console.log(chalk.green(` ✓ ${options.successMessage ?? "Portable Context ready."}`));
|
|
111
|
-
return result;
|
|
112
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { TestTargetCandidate, TestTargetResult } from "../../packages/testing/test.js";
|
|
2
|
-
import type { MethodExecutionProfile, MethodExecutor } from "../../packages/agents/lib/executors.js";
|
|
3
|
-
import type { TestSandboxRetentionMode } from "../../packages/testing/test-sandbox.js";
|
|
4
|
-
import type { SourcePreparationConfig } from "../../packages/project-model/lib/schema.js";
|
|
5
|
-
import type { ReadinessCheckRun, TestRunMode } from "../../packages/testing/lib/schema.js";
|
|
6
|
-
export interface SavedTestOutcome {
|
|
7
|
-
runPath: string;
|
|
8
|
-
displayRunPath?: string;
|
|
9
|
-
target: TestTargetCandidate;
|
|
10
|
-
result: TestTargetResult;
|
|
11
|
-
}
|
|
12
|
-
export interface AgentTestMatrixRow {
|
|
13
|
-
agentLabel: string;
|
|
14
|
-
rawOutcome?: SavedTestOutcome | null;
|
|
15
|
-
compiledOutcome?: SavedTestOutcome | null;
|
|
16
|
-
}
|
|
17
|
-
export declare function readinessPassRate(outcome: SavedTestOutcome): number;
|
|
18
|
-
export declare function readSavedTestComparison(projectPath: string, preparationName: string): ReadinessCheckRun | null;
|
|
19
|
-
export declare function readCurrentSavedTestComparison(options: {
|
|
20
|
-
projectPath: string;
|
|
21
|
-
preparationName: string;
|
|
22
|
-
checks: SourcePreparationConfig["checks"];
|
|
23
|
-
}): {
|
|
24
|
-
comparison: ReadinessCheckRun | null;
|
|
25
|
-
stale: boolean;
|
|
26
|
-
};
|
|
27
|
-
export declare function printSavedTestComparisonState(payload: ReadinessCheckRun, comparisonRunPath?: string | null): void;
|
|
28
|
-
export declare function printAgentTestMatrix(rows: AgentTestMatrixRow[]): void;
|
|
29
|
-
export declare function printAgentTestFailures(rows: AgentTestMatrixRow[]): void;
|
|
30
|
-
export declare function printSavedTestOutcome(prefix: string, outcome: SavedTestOutcome): void;
|
|
31
|
-
export declare function printSavedTestComparison(rawOutcome: SavedTestOutcome | null, compiledOutcome: SavedTestOutcome | null, comparisonRunPath?: string | null): void;
|
|
32
|
-
export declare function printSavedTestComparisonSummary(rawOutcome: SavedTestOutcome | null, compiledOutcome: SavedTestOutcome | null, comparisonRunPath?: string | null): void;
|
|
33
|
-
export declare function saveTestComparisonRun(options: {
|
|
34
|
-
sourcePath: string;
|
|
35
|
-
compiledPath: string | null;
|
|
36
|
-
compiledName: string;
|
|
37
|
-
checksFingerprint: string;
|
|
38
|
-
mode: TestRunMode;
|
|
39
|
-
rawOutcome: SavedTestOutcome | null;
|
|
40
|
-
compiledOutcome: SavedTestOutcome | null;
|
|
41
|
-
}): string;
|
|
42
|
-
export declare function runSavedRawTest(options: {
|
|
43
|
-
sourcePath: string;
|
|
44
|
-
preparationConfig: SourcePreparationConfig;
|
|
45
|
-
executor?: MethodExecutor | null;
|
|
46
|
-
executionProfile?: MethodExecutionProfile;
|
|
47
|
-
preserveSandboxes?: TestSandboxRetentionMode;
|
|
48
|
-
runSuffix?: string | null;
|
|
49
|
-
}): Promise<SavedTestOutcome | null>;
|
|
50
|
-
export declare function runSavedCompiledTest(options: {
|
|
51
|
-
sourcePath: string;
|
|
52
|
-
preparationConfig: SourcePreparationConfig;
|
|
53
|
-
executor?: MethodExecutor | null;
|
|
54
|
-
executionProfile?: MethodExecutionProfile;
|
|
55
|
-
compiledPath?: string | null;
|
|
56
|
-
preserveSandboxes?: TestSandboxRetentionMode;
|
|
57
|
-
runSuffix?: string | null;
|
|
58
|
-
}): Promise<SavedTestOutcome | null>;
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { readinessPassRate as readinessPassRateForOutcome, readCurrentSavedReadinessCheckRun, readSavedReadinessCheckRun, runSavedPortableContextCheck, runSavedSourceFilesCheck, saveReadinessCheckRun, } from "../../packages/testing/readiness-check-run.js";
|
|
3
|
-
import { findBuiltCompiledPath } from "./compiled-flow.js";
|
|
4
|
-
export function readinessPassRate(outcome) {
|
|
5
|
-
return readinessPassRateForOutcome(outcome);
|
|
6
|
-
}
|
|
7
|
-
function visibleRunPath(outcome) {
|
|
8
|
-
return outcome.displayRunPath ?? outcome.runPath;
|
|
9
|
-
}
|
|
10
|
-
function loadLatestComparison(projectPath, preparationName) {
|
|
11
|
-
return readSavedReadinessCheckRun(projectPath, preparationName);
|
|
12
|
-
}
|
|
13
|
-
export function readSavedTestComparison(projectPath, preparationName) {
|
|
14
|
-
return loadLatestComparison(projectPath, preparationName);
|
|
15
|
-
}
|
|
16
|
-
export function readCurrentSavedTestComparison(options) {
|
|
17
|
-
return readCurrentSavedReadinessCheckRun({
|
|
18
|
-
projectPath: options.projectPath,
|
|
19
|
-
preparationName: options.preparationName,
|
|
20
|
-
checks: options.checks,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
export function printSavedTestComparisonState(payload, comparisonRunPath) {
|
|
24
|
-
console.log();
|
|
25
|
-
console.log(chalk.bold(" Latest readiness results"));
|
|
26
|
-
console.log();
|
|
27
|
-
console.log(" | Target | Readiness checks |");
|
|
28
|
-
console.log(" | --- | --- |");
|
|
29
|
-
if (payload.raw) {
|
|
30
|
-
console.log(` | Source files | \`${payload.raw.passed_cases}/${payload.raw.total_cases}\` |`);
|
|
31
|
-
}
|
|
32
|
-
if (payload.compiled) {
|
|
33
|
-
console.log(` | Portable Context | \`${payload.compiled.passed_cases}/${payload.compiled.total_cases}\` |`);
|
|
34
|
-
}
|
|
35
|
-
if (!payload.raw || !payload.compiled) {
|
|
36
|
-
console.log();
|
|
37
|
-
if (!payload.raw) {
|
|
38
|
-
console.log(chalk.dim(" No saved source-files baseline yet."));
|
|
39
|
-
}
|
|
40
|
-
if (!payload.compiled) {
|
|
41
|
-
console.log(chalk.dim(" No saved portable-context run yet."));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (payload.summary.raw_pass_rate != null && payload.summary.compiled_pass_rate != null) {
|
|
45
|
-
const direction = (payload.summary.pass_rate_delta ?? 0) >= 0 ? "improved" : "decreased";
|
|
46
|
-
const color = (payload.summary.pass_rate_delta ?? 0) >= 0 ? chalk.green : chalk.red;
|
|
47
|
-
console.log();
|
|
48
|
-
console.log(color(` Readiness-check pass rate ${direction} from ${payload.summary.raw_pass_rate}% to ${payload.summary.compiled_pass_rate}%.`));
|
|
49
|
-
}
|
|
50
|
-
if (comparisonRunPath) {
|
|
51
|
-
console.log();
|
|
52
|
-
console.log(chalk.dim(` Saved summary: ${comparisonRunPath}`));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function padCell(value, width) {
|
|
56
|
-
return value.padEnd(width, " ");
|
|
57
|
-
}
|
|
58
|
-
function resultCell(outcome) {
|
|
59
|
-
if (!outcome)
|
|
60
|
-
return "—";
|
|
61
|
-
return `${outcome.result.passedCases}/${outcome.result.totalCases}`;
|
|
62
|
-
}
|
|
63
|
-
function deltaCell(row) {
|
|
64
|
-
if (!row.rawOutcome || !row.compiledOutcome)
|
|
65
|
-
return "—";
|
|
66
|
-
const delta = row.compiledOutcome.result.passedCases - row.rawOutcome.result.passedCases;
|
|
67
|
-
return delta > 0 ? `+${delta}` : `${delta}`;
|
|
68
|
-
}
|
|
69
|
-
export function printAgentTestMatrix(rows) {
|
|
70
|
-
if (rows.length === 0)
|
|
71
|
-
return;
|
|
72
|
-
const includeRaw = rows.some((row) => Boolean(row.rawOutcome));
|
|
73
|
-
const includeCompiled = rows.some((row) => Boolean(row.compiledOutcome));
|
|
74
|
-
const includeDelta = includeRaw && includeCompiled;
|
|
75
|
-
const headers = [
|
|
76
|
-
"Agent",
|
|
77
|
-
...(includeRaw ? ["Source files"] : []),
|
|
78
|
-
...(includeCompiled ? ["Portable Context"] : []),
|
|
79
|
-
...(includeDelta ? ["Delta"] : []),
|
|
80
|
-
];
|
|
81
|
-
const body = rows.map((row) => [
|
|
82
|
-
row.agentLabel,
|
|
83
|
-
...(includeRaw ? [resultCell(row.rawOutcome)] : []),
|
|
84
|
-
...(includeCompiled ? [resultCell(row.compiledOutcome)] : []),
|
|
85
|
-
...(includeDelta ? [deltaCell(row)] : []),
|
|
86
|
-
]);
|
|
87
|
-
const widths = headers.map((header, index) => Math.max(header.length, ...body.map((row) => (row[index] ?? "").length)));
|
|
88
|
-
const heading = includeDelta ? " Comparison" : " Results";
|
|
89
|
-
console.log();
|
|
90
|
-
console.log(chalk.bold(heading));
|
|
91
|
-
console.log();
|
|
92
|
-
console.log(` | ${headers.map((header, index) => padCell(header, widths[index] ?? header.length)).join(" | ")} |`);
|
|
93
|
-
console.log(` | ${widths.map((width) => "-".repeat(width)).join(" | ")} |`);
|
|
94
|
-
for (const row of body) {
|
|
95
|
-
console.log(` | ${row.map((cell, index) => padCell(cell ?? "", widths[index] ?? cell.length)).join(" | ")} |`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
export function printAgentTestFailures(rows) {
|
|
99
|
-
for (const row of rows) {
|
|
100
|
-
const failures = [];
|
|
101
|
-
for (const [label, outcome] of [
|
|
102
|
-
["Source files", row.rawOutcome ?? null],
|
|
103
|
-
["Portable Context", row.compiledOutcome ?? null],
|
|
104
|
-
]) {
|
|
105
|
-
if (!outcome || outcome.result.ok)
|
|
106
|
-
continue;
|
|
107
|
-
for (const [index, caseResult] of outcome.result.caseResults.entries()) {
|
|
108
|
-
if (caseResult.ok)
|
|
109
|
-
continue;
|
|
110
|
-
const reason = caseResult.checks.find((entry) => !entry.ok)?.detail ?? "failed";
|
|
111
|
-
failures.push(`${label} · Check ${index + 1}: ${reason}`);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (failures.length === 0)
|
|
115
|
-
continue;
|
|
116
|
-
console.log();
|
|
117
|
-
console.log(chalk.bold(` ${row.agentLabel} failures`));
|
|
118
|
-
console.log();
|
|
119
|
-
for (const failure of failures) {
|
|
120
|
-
console.log(` - ${failure}`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
export function printSavedTestOutcome(prefix, outcome) {
|
|
125
|
-
const color = outcome.result.ok ? chalk.green : chalk.red;
|
|
126
|
-
const status = outcome.result.ok ? chalk.green("PASS") : chalk.red("FAIL");
|
|
127
|
-
console.log(chalk.bold(` ${prefix}`));
|
|
128
|
-
console.log();
|
|
129
|
-
console.log(color(` ${status} ${outcome.result.passedCases}/${outcome.result.totalCases} readiness checks`));
|
|
130
|
-
console.log();
|
|
131
|
-
for (const [index, caseResult] of outcome.result.caseResults.entries()) {
|
|
132
|
-
const caseStatus = caseResult.ok ? chalk.green("PASS") : chalk.red("FAIL");
|
|
133
|
-
console.log(` ${caseStatus} Check ${index + 1}`);
|
|
134
|
-
console.log(chalk.dim(` ${caseResult.question}`));
|
|
135
|
-
const failedChecks = caseResult.checks.filter((entry) => !entry.ok).slice(0, 3);
|
|
136
|
-
for (const failedCheck of failedChecks) {
|
|
137
|
-
console.log(chalk.dim(` Failed criterion: ${failedCheck.label}: ${failedCheck.detail}`));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
console.log();
|
|
141
|
-
if (outcome.result.sandbox_path) {
|
|
142
|
-
console.log(chalk.dim(` Preserved sandbox: ${outcome.result.sandbox_path}`));
|
|
143
|
-
console.log();
|
|
144
|
-
}
|
|
145
|
-
console.log(chalk.dim(` Saved run: ${visibleRunPath(outcome)}`));
|
|
146
|
-
}
|
|
147
|
-
export function printSavedTestComparison(rawOutcome, compiledOutcome, comparisonRunPath) {
|
|
148
|
-
if (!rawOutcome && !compiledOutcome)
|
|
149
|
-
return;
|
|
150
|
-
console.log();
|
|
151
|
-
if (rawOutcome) {
|
|
152
|
-
printSavedTestOutcome("Source files", rawOutcome);
|
|
153
|
-
}
|
|
154
|
-
if (compiledOutcome) {
|
|
155
|
-
if (rawOutcome)
|
|
156
|
-
console.log();
|
|
157
|
-
printSavedTestOutcome("Portable Context", compiledOutcome);
|
|
158
|
-
}
|
|
159
|
-
if (rawOutcome && compiledOutcome) {
|
|
160
|
-
const rawReadiness = readinessPassRate(rawOutcome);
|
|
161
|
-
const compiledReadiness = readinessPassRate(compiledOutcome);
|
|
162
|
-
const delta = compiledReadiness - rawReadiness;
|
|
163
|
-
const color = delta >= 0 ? chalk.green : chalk.red;
|
|
164
|
-
const direction = delta >= 0 ? "improved" : "decreased";
|
|
165
|
-
console.log();
|
|
166
|
-
console.log(color(` Readiness-check pass rate ${direction} from ${rawReadiness}% to ${compiledReadiness}%.`));
|
|
167
|
-
}
|
|
168
|
-
if (comparisonRunPath) {
|
|
169
|
-
console.log();
|
|
170
|
-
console.log(chalk.dim(` Saved summary: ${comparisonRunPath}`));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
export function printSavedTestComparisonSummary(rawOutcome, compiledOutcome, comparisonRunPath) {
|
|
174
|
-
if (!rawOutcome && !compiledOutcome)
|
|
175
|
-
return;
|
|
176
|
-
console.log();
|
|
177
|
-
console.log(chalk.bold(" Comparison"));
|
|
178
|
-
console.log();
|
|
179
|
-
console.log(" | Target | Readiness checks |");
|
|
180
|
-
console.log(" | --- | --- |");
|
|
181
|
-
if (rawOutcome) {
|
|
182
|
-
console.log(` | Source files | \`${rawOutcome.result.passedCases}/${rawOutcome.result.totalCases}\` |`);
|
|
183
|
-
}
|
|
184
|
-
if (compiledOutcome) {
|
|
185
|
-
console.log(` | Portable Context | \`${compiledOutcome.result.passedCases}/${compiledOutcome.result.totalCases}\` |`);
|
|
186
|
-
}
|
|
187
|
-
if (rawOutcome && compiledOutcome) {
|
|
188
|
-
const rawReadiness = readinessPassRate(rawOutcome);
|
|
189
|
-
const compiledReadiness = readinessPassRate(compiledOutcome);
|
|
190
|
-
const delta = compiledReadiness - rawReadiness;
|
|
191
|
-
const color = delta >= 0 ? chalk.green : chalk.red;
|
|
192
|
-
const direction = delta >= 0 ? "improved" : "decreased";
|
|
193
|
-
console.log();
|
|
194
|
-
console.log(color(` Readiness-check pass rate ${direction} from ${rawReadiness}% to ${compiledReadiness}%.`));
|
|
195
|
-
}
|
|
196
|
-
if (comparisonRunPath) {
|
|
197
|
-
console.log();
|
|
198
|
-
console.log(chalk.dim(` Saved summary: ${comparisonRunPath}`));
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
export function saveTestComparisonRun(options) {
|
|
202
|
-
return saveReadinessCheckRun({
|
|
203
|
-
sourcePath: options.sourcePath,
|
|
204
|
-
portableContextPath: options.compiledPath,
|
|
205
|
-
preparationName: options.compiledName,
|
|
206
|
-
checksFingerprint: options.checksFingerprint,
|
|
207
|
-
mode: options.mode,
|
|
208
|
-
rawOutcome: options.rawOutcome,
|
|
209
|
-
compiledOutcome: options.compiledOutcome,
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
export async function runSavedRawTest(options) {
|
|
213
|
-
return runSavedSourceFilesCheck({
|
|
214
|
-
sourcePath: options.sourcePath,
|
|
215
|
-
preparationConfig: options.preparationConfig,
|
|
216
|
-
executor: options.executor,
|
|
217
|
-
preserveSandboxes: options.preserveSandboxes ?? "on-failure",
|
|
218
|
-
runSuffix: options.runSuffix,
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
export async function runSavedCompiledTest(options) {
|
|
222
|
-
const compiledPath = options.compiledPath ?? findBuiltCompiledPath(options.sourcePath, options.preparationConfig.name);
|
|
223
|
-
return runSavedPortableContextCheck({
|
|
224
|
-
sourcePath: options.sourcePath,
|
|
225
|
-
preparationConfig: options.preparationConfig,
|
|
226
|
-
executor: options.executor,
|
|
227
|
-
portableContextPath: compiledPath,
|
|
228
|
-
preserveSandboxes: options.preserveSandboxes ?? "on-failure",
|
|
229
|
-
runSuffix: options.runSuffix,
|
|
230
|
-
});
|
|
231
|
-
}
|