@interf/compiler 0.9.4 → 0.13.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/README.md +96 -91
- package/TRADEMARKS.md +2 -13
- package/agent-skills/interf-actions/SKILL.md +97 -32
- package/agent-skills/interf-actions/references/cli.md +124 -71
- package/builtin-methods/interf-default/README.md +3 -4
- package/builtin-methods/interf-default/compile/stages/shape/SKILL.md +2 -2
- package/builtin-methods/interf-default/compile/stages/summarize/SKILL.md +2 -1
- package/builtin-methods/interf-default/improve/SKILL.md +1 -1
- package/builtin-methods/interf-default/method.json +10 -4
- package/builtin-methods/interf-default/method.schema.json +0 -9
- package/builtin-methods/interf-default/use/query/SKILL.md +5 -5
- package/dist/cli/commands/compile.d.ts +9 -31
- package/dist/cli/commands/compile.js +75 -388
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/login.d.ts +7 -0
- package/dist/cli/commands/login.js +39 -0
- package/dist/cli/commands/logout.d.ts +2 -0
- package/dist/cli/commands/logout.js +16 -0
- package/dist/cli/commands/method.d.ts +2 -0
- package/dist/cli/commands/method.js +113 -0
- package/dist/cli/commands/prep.d.ts +2 -0
- package/dist/cli/commands/prep.js +134 -0
- package/dist/cli/commands/reset.d.ts +8 -1
- package/dist/cli/commands/reset.js +47 -15
- package/dist/cli/commands/runs.d.ts +2 -0
- package/dist/cli/commands/runs.js +120 -0
- package/dist/cli/commands/status.d.ts +6 -1
- package/dist/cli/commands/status.js +61 -220
- package/dist/cli/commands/test.d.ts +6 -15
- package/dist/cli/commands/test.js +63 -342
- package/dist/cli/commands/web.d.ts +0 -9
- package/dist/cli/commands/web.js +140 -367
- package/dist/cli/commands/wizard.d.ts +9 -0
- package/dist/cli/commands/wizard.js +442 -0
- package/dist/cli/index.d.ts +7 -6
- package/dist/cli/index.js +13 -10
- 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/045gole2ojo3g.css +3 -0
- package/dist/compiler-ui/_next/static/chunks/17t-lulmyawg5.js +89 -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.d.ts +1 -1
- package/dist/packages/agents/lib/shells.js +113 -54
- package/dist/packages/agents/lib/user-config.d.ts +4 -2
- package/dist/packages/agents/lib/user-config.js +15 -7
- package/dist/packages/compiler/compiled-paths.d.ts +9 -2
- package/dist/packages/compiler/compiled-paths.js +30 -15
- package/dist/packages/compiler/compiled-pipeline.js +23 -3
- package/dist/packages/compiler/compiled-stage-plan.js +4 -0
- package/dist/packages/compiler/compiled-target.d.ts +1 -1
- package/dist/packages/compiler/compiled-target.js +1 -1
- package/dist/packages/compiler/index.d.ts +1 -0
- package/dist/packages/compiler/index.js +1 -0
- package/dist/packages/compiler/lib/schema.d.ts +27 -32
- package/dist/packages/compiler/lib/schema.js +2 -13
- package/dist/packages/compiler/method-runs.d.ts +2 -3
- package/dist/packages/compiler/method-runs.js +2 -3
- package/dist/packages/compiler/reset.js +3 -1
- package/dist/packages/compiler/runtime-contracts.js +0 -3
- package/dist/packages/compiler/runtime-prompt.js +1 -1
- package/dist/packages/compiler/source-files.d.ts +46 -0
- package/dist/packages/compiler/source-files.js +149 -0
- package/dist/packages/compiler/state-artifacts.d.ts +3 -2
- package/dist/packages/compiler/state-artifacts.js +4 -3
- package/dist/packages/compiler/state-io.d.ts +3 -2
- package/dist/packages/compiler/state-io.js +11 -5
- package/dist/packages/compiler/state-paths.d.ts +2 -1
- package/dist/packages/compiler/state-paths.js +6 -3
- package/dist/packages/compiler/state-view.d.ts +3 -2
- package/dist/packages/compiler/state-view.js +18 -28
- package/dist/packages/compiler/state.d.ts +4 -4
- package/dist/packages/compiler/state.js +3 -3
- package/dist/packages/contracts/index.d.ts +1 -1
- package/dist/packages/contracts/lib/preparation-paths.d.ts +117 -0
- package/dist/packages/contracts/lib/preparation-paths.js +177 -0
- package/dist/packages/contracts/lib/schema.d.ts +85 -6
- package/dist/packages/contracts/lib/schema.js +46 -2
- package/dist/packages/execution/lib/schema.d.ts +50 -57
- package/dist/packages/execution/lib/schema.js +1 -2
- package/dist/packages/local-service/action-definitions.d.ts +246 -0
- package/dist/packages/local-service/action-definitions.js +1147 -0
- package/dist/packages/local-service/action-planner.d.ts +9 -0
- package/dist/packages/local-service/action-planner.js +135 -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 +76 -46
- package/dist/packages/local-service/client.js +184 -149
- package/dist/packages/local-service/connection-config.d.ts +38 -0
- package/dist/packages/local-service/connection-config.js +75 -0
- package/dist/packages/local-service/index.d.ts +14 -7
- package/dist/packages/local-service/index.js +8 -4
- package/dist/packages/local-service/instance-paths.d.ts +100 -0
- package/dist/packages/local-service/instance-paths.js +165 -0
- package/dist/packages/local-service/lib/schema.d.ts +689 -2575
- package/dist/packages/local-service/lib/schema.js +260 -101
- 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} +204 -20
- package/dist/packages/local-service/preparation-store.d.ts +92 -0
- package/dist/packages/local-service/preparation-store.js +171 -0
- 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 +33 -11
- package/dist/packages/local-service/routes.js +44 -15
- package/dist/packages/local-service/run-observability.js +25 -27
- package/dist/packages/local-service/runtime-caches.d.ts +76 -0
- package/dist/packages/local-service/runtime-caches.js +191 -0
- package/dist/packages/local-service/runtime-event-applier.d.ts +12 -0
- package/dist/packages/local-service/runtime-event-applier.js +177 -0
- package/dist/packages/local-service/runtime-persistence.d.ts +47 -0
- package/dist/packages/local-service/runtime-persistence.js +137 -0
- package/dist/packages/local-service/runtime-proposal-helpers.d.ts +35 -0
- package/dist/packages/local-service/runtime-proposal-helpers.js +251 -0
- package/dist/packages/local-service/runtime-resource-builders.d.ts +52 -0
- package/dist/packages/local-service/runtime-resource-builders.js +149 -0
- package/dist/packages/local-service/runtime.d.ts +201 -44
- package/dist/packages/local-service/runtime.js +1062 -1106
- package/dist/packages/local-service/server.d.ts +15 -0
- package/dist/packages/local-service/server.js +651 -233
- package/dist/packages/local-service/service-registry.d.ts +47 -0
- package/dist/packages/local-service/service-registry.js +137 -0
- package/dist/packages/method-authoring/method-authoring.d.ts +1 -1
- package/dist/packages/method-authoring/method-authoring.js +2 -2
- package/dist/packages/method-authoring/method-improvement.js +1 -1
- package/dist/packages/method-package/builtin-compiled-method.d.ts +4 -5
- package/dist/packages/method-package/builtin-compiled-method.js +8 -14
- package/dist/packages/method-package/context-interface.d.ts +4 -40
- package/dist/packages/method-package/context-interface.js +1 -23
- package/dist/packages/method-package/interf-method-package.d.ts +4 -4
- package/dist/packages/method-package/interf-method-package.js +21 -33
- package/dist/packages/method-package/local-methods.d.ts +10 -6
- package/dist/packages/method-package/local-methods.js +57 -39
- package/dist/packages/method-package/method-definitions.d.ts +8 -34
- package/dist/packages/method-package/method-definitions.js +49 -37
- package/dist/packages/method-package/method-helpers.d.ts +1 -13
- package/dist/packages/method-package/method-helpers.js +8 -42
- 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/method-package/method-stage-runner.js +2 -2
- package/dist/packages/method-package/user-methods.d.ts +17 -0
- package/dist/packages/method-package/user-methods.js +77 -0
- package/dist/packages/project-model/index.d.ts +1 -1
- package/dist/packages/project-model/index.js +1 -1
- package/dist/packages/project-model/interf-detect.d.ts +8 -3
- package/dist/packages/project-model/interf-detect.js +34 -34
- package/dist/packages/project-model/interf-scaffold.d.ts +3 -3
- package/dist/packages/project-model/interf-scaffold.js +23 -32
- package/dist/packages/project-model/lib/schema.js +38 -1
- 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 +11 -10
- package/dist/packages/project-model/source-config.js +83 -44
- package/dist/packages/project-model/source-folders.d.ts +5 -5
- package/dist/packages/project-model/source-folders.js +14 -14
- package/dist/packages/shared/filesystem.d.ts +7 -0
- package/dist/packages/shared/filesystem.js +97 -10
- package/dist/packages/testing/lib/schema.d.ts +12 -13
- package/dist/packages/testing/lib/schema.js +4 -5
- package/dist/packages/testing/readiness-check-run.d.ts +7 -7
- package/dist/packages/testing/readiness-check-run.js +46 -51
- package/dist/packages/testing/test-execution.js +6 -6
- package/dist/packages/testing/test-paths.js +4 -3
- package/dist/packages/testing/test-sandbox.d.ts +0 -1
- package/dist/packages/testing/test-sandbox.js +14 -30
- package/dist/packages/testing/test-targets.d.ts +1 -1
- package/dist/packages/testing/test-targets.js +6 -6
- package/dist/packages/testing/test.d.ts +1 -1
- package/dist/packages/testing/test.js +1 -1
- package/package.json +6 -26
- package/LICENSE +0 -183
- 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/control-path.d.ts +0 -11
- package/dist/cli/commands/control-path.js +0 -72
- package/dist/cli/commands/create-method-wizard.d.ts +0 -76
- package/dist/cli/commands/create-method-wizard.js +0 -465
- package/dist/cli/commands/create.d.ts +0 -8
- package/dist/cli/commands/create.js +0 -189
- package/dist/cli/commands/default.d.ts +0 -2
- package/dist/cli/commands/default.js +0 -39
- package/dist/cli/commands/executor-flow.d.ts +0 -29
- package/dist/cli/commands/executor-flow.js +0 -163
- package/dist/cli/commands/init.d.ts +0 -11
- package/dist/cli/commands/init.js +0 -784
- package/dist/cli/commands/list.d.ts +0 -2
- package/dist/cli/commands/list.js +0 -30
- package/dist/cli/commands/preparation-selection.d.ts +0 -6
- package/dist/cli/commands/preparation-selection.js +0 -11
- package/dist/cli/commands/source-config-wizard.d.ts +0 -52
- package/dist/cli/commands/source-config-wizard.js +0 -680
- package/dist/cli/commands/test-flow.d.ts +0 -58
- package/dist/cli/commands/test-flow.js +0 -231
- package/dist/cli/commands/verify.d.ts +0 -2
- package/dist/cli/commands/verify.js +0 -94
- 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/packages/compiler/raw-snapshot.d.ts +0 -49
- package/dist/packages/compiler/raw-snapshot.js +0 -101
- package/dist/packages/method-package/index.d.ts +0 -11
- package/dist/packages/method-package/index.js +0 -11
- package/dist/packages/method-package/method-stage-policy.d.ts +0 -5
- package/dist/packages/method-package/method-stage-policy.js +0 -31
- package/dist/packages/project-model/project-paths.d.ts +0 -12
- package/dist/packages/project-model/project-paths.js +0 -33
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → C6vVfy3aeYuIO3d2AoNvC}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → C6vVfy3aeYuIO3d2AoNvC}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → C6vVfy3aeYuIO3d2AoNvC}/_ssgManifest.js +0 -0
- /package/dist/{cli/commands/check-draft.js → packages/local-service/readiness-check-draft.js} +0 -0
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import type { CommandModule } from "yargs";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
preparationConfig: SourcePreparationConfig;
|
|
8
|
-
builtCompiledPath: string | null;
|
|
9
|
-
mode: TestMode;
|
|
10
|
-
rows: AgentTestMatrixRow[];
|
|
2
|
+
interface TestArgs {
|
|
3
|
+
prepId: string;
|
|
4
|
+
target?: "source-files" | "portable-context" | "both";
|
|
5
|
+
url?: string;
|
|
6
|
+
token?: string;
|
|
11
7
|
}
|
|
12
|
-
export
|
|
13
|
-
message: string;
|
|
14
|
-
hints: string[];
|
|
15
|
-
}
|
|
16
|
-
export declare const testCommand: CommandModule;
|
|
17
|
-
export declare function runTestCommand(argv?: Record<string, unknown>): Promise<boolean>;
|
|
8
|
+
export declare const testCommand: CommandModule<unknown, TestArgs>;
|
|
18
9
|
export {};
|
|
@@ -1,351 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `interf test <prep-id>` — start a readiness-check (test) run for a preparation.
|
|
3
|
+
*
|
|
4
|
+
* interf test bristol
|
|
5
|
+
* interf test bristol --target source-files
|
|
6
|
+
* interf test bristol --target portable-context
|
|
7
|
+
* interf test bristol --target both
|
|
8
|
+
*/
|
|
1
9
|
import chalk from "chalk";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { resolveConfiguredPreparationSelection } from "./preparation-selection.js";
|
|
8
|
-
import { printAgentTestFailures, printAgentTestMatrix, printSavedTestComparisonState, } from "./test-flow.js";
|
|
9
|
-
import { createCompiledTestTarget } from "../../packages/testing/test-targets.js";
|
|
10
|
-
import { runReadinessChecksForExecutor, } from "../../packages/testing/readiness-check-run.js";
|
|
11
|
-
import { resolveMethodId } from "../../packages/methods/method-resolution.js";
|
|
12
|
-
import { listRunAgentOptions, promptForTestAgents, resolveNamedLocalExecutor, resolveOrConfigureLocalExecutor, } from "./executor-flow.js";
|
|
13
|
-
import { submitTestRunToLocalService, waitForLocalTestRun, } from "../../packages/local-service/index.js";
|
|
14
|
-
import { resolveCommandControlPath } from "./control-path.js";
|
|
15
|
-
export const testCommand = {
|
|
16
|
-
command: "test",
|
|
17
|
-
describe: "Run readiness checks against source files and Portable Context",
|
|
18
|
-
builder: (yargs) => addExecutionProfileOptions(yargs)
|
|
19
|
-
.option("preparation", {
|
|
20
|
-
type: "string",
|
|
21
|
-
describe: "Preparation id to check when this Source Folder has more than one Preparation",
|
|
22
|
-
})
|
|
23
|
-
.option("target", {
|
|
24
|
-
choices: ["both", "source-files", "portable-context"],
|
|
25
|
-
describe: "Check source files, Portable Context, or both. Default: both when Portable Context exists, otherwise source files.",
|
|
26
|
-
})
|
|
27
|
-
.option("keep-sandboxes", {
|
|
28
|
-
type: "boolean",
|
|
29
|
-
default: false,
|
|
30
|
-
describe: "Keep every readiness-check sandbox for review instead of pruning successful ones",
|
|
31
|
-
})
|
|
32
|
-
.option("agents", {
|
|
33
|
-
type: "string",
|
|
34
|
-
describe: "Comma-separated local agents to use for readiness checks, or `all`. Example: --agents claude-code,codex",
|
|
35
|
-
}),
|
|
36
|
-
handler: async (argv) => {
|
|
37
|
-
await runTestCommand(argv);
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
function readSandboxRetentionMode(argv) {
|
|
41
|
-
const enabled = argv["keep-sandboxes"] ?? argv.keepSandboxes ?? false;
|
|
42
|
-
return enabled ? "always" : "on-failure";
|
|
43
|
-
}
|
|
44
|
-
function readRequestedMode(argv) {
|
|
45
|
-
const value = argv.target;
|
|
46
|
-
const target = value === "source-files" || value === "portable-context" || value === "both"
|
|
47
|
-
? value
|
|
48
|
-
: null;
|
|
49
|
-
if (!target)
|
|
50
|
-
return null;
|
|
51
|
-
return modeFromTargetChoice(target);
|
|
52
|
-
}
|
|
53
|
-
function modeFromTargetChoice(target) {
|
|
54
|
-
if (target === "source-files")
|
|
55
|
-
return "raw";
|
|
56
|
-
if (target === "portable-context")
|
|
57
|
-
return "compiled";
|
|
58
|
-
return "both";
|
|
59
|
-
}
|
|
60
|
-
function reportTestCommandFailure(argv, message, hints = []) {
|
|
61
|
-
process.exitCode = 1;
|
|
62
|
-
console.log(chalk.red(` ${message}`));
|
|
63
|
-
for (const hint of hints) {
|
|
64
|
-
console.log(chalk.dim(` ${hint}`));
|
|
65
|
-
}
|
|
66
|
-
const onFailure = typeof argv.onFailure === "function"
|
|
67
|
-
? argv.onFailure
|
|
68
|
-
: null;
|
|
69
|
-
void onFailure?.({ message, hints });
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
async function promptTestMode(hasBuiltCompiled) {
|
|
73
|
-
if (!hasBuiltCompiled) {
|
|
74
|
-
return "raw";
|
|
75
|
-
}
|
|
76
|
-
const selected = await p.select({
|
|
77
|
-
message: "What do you want to check?",
|
|
78
|
-
options: [
|
|
79
|
-
{
|
|
80
|
-
value: "both",
|
|
81
|
-
label: "Source files and Portable Context (Recommended)",
|
|
82
|
-
hint: "Check whether the data is ready with and without Portable Context",
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
value: "raw",
|
|
86
|
-
label: "Source files only",
|
|
87
|
-
hint: "Measure the current baseline on the Source Folder files",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
value: "compiled",
|
|
91
|
-
label: "Portable Context only",
|
|
92
|
-
hint: "Run the saved readiness checks against the current Portable Context",
|
|
93
|
-
},
|
|
94
|
-
],
|
|
10
|
+
import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/local-service/connection-config.js";
|
|
11
|
+
function resolveConnection(args) {
|
|
12
|
+
const conn = readActiveConnection({
|
|
13
|
+
urlOverride: args.url,
|
|
14
|
+
authTokenOverride: args.token,
|
|
95
15
|
});
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
function parseRequestedAgents(argv) {
|
|
101
|
-
const raw = argv.agents;
|
|
102
|
-
if (typeof raw !== "string" || raw.trim().length === 0)
|
|
103
|
-
return null;
|
|
104
|
-
if (raw.trim() === "all") {
|
|
105
|
-
return listRunAgentOptions().map((agent) => agent.name);
|
|
16
|
+
if (!conn) {
|
|
17
|
+
console.error(CONNECT_OR_ERROR_HINT);
|
|
18
|
+
process.exit(1);
|
|
106
19
|
}
|
|
107
|
-
return
|
|
108
|
-
.split(",")
|
|
109
|
-
.map((value) => value.trim())
|
|
110
|
-
.filter((value) => value.length > 0);
|
|
20
|
+
return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
|
|
111
21
|
}
|
|
112
|
-
async function
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
const option = listRunAgentOptions().find((agent) => agent.name === agentName);
|
|
126
|
-
selected.push({
|
|
127
|
-
name: agentName,
|
|
128
|
-
label: option?.displayName ?? agentName,
|
|
129
|
-
executor: resolved.executor,
|
|
130
|
-
});
|
|
22
|
+
async function callJson(url, token, init = {}) {
|
|
23
|
+
const headers = new Headers(init.headers ?? {});
|
|
24
|
+
if (token)
|
|
25
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
26
|
+
if (init.body && !headers.has("content-type"))
|
|
27
|
+
headers.set("content-type", "application/json");
|
|
28
|
+
const response = await fetch(url, { ...init, headers });
|
|
29
|
+
const raw = await response.text();
|
|
30
|
+
let body = null;
|
|
31
|
+
if (raw.length > 0) {
|
|
32
|
+
try {
|
|
33
|
+
body = JSON.parse(raw);
|
|
131
34
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
135
|
-
const prompted = await promptForTestAgents();
|
|
136
|
-
if (prompted.cancelled)
|
|
137
|
-
return null;
|
|
138
|
-
if (prompted.agents.length > 0) {
|
|
139
|
-
const selected = [];
|
|
140
|
-
for (const agent of prompted.agents) {
|
|
141
|
-
const resolved = resolveNamedLocalExecutor(agent.name, {
|
|
142
|
-
executionProfile: options.executionProfile,
|
|
143
|
-
});
|
|
144
|
-
if (!resolved.executor) {
|
|
145
|
-
process.exitCode = 1;
|
|
146
|
-
console.log(chalk.red(` ${resolved.error ?? `Could not resolve local agent \"${agent.name}\".`}`));
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
selected.push({
|
|
150
|
-
name: agent.name,
|
|
151
|
-
label: agent.displayName,
|
|
152
|
-
executor: resolved.executor,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
return selected;
|
|
35
|
+
catch {
|
|
36
|
+
body = null;
|
|
156
37
|
}
|
|
157
38
|
}
|
|
158
|
-
|
|
159
|
-
preflight: true,
|
|
160
|
-
executionProfile: options.executionProfile,
|
|
161
|
-
purpose: "test",
|
|
162
|
-
});
|
|
163
|
-
if (!resolved.executor) {
|
|
164
|
-
if (resolved.cancelled)
|
|
165
|
-
return null;
|
|
166
|
-
process.exitCode = 1;
|
|
167
|
-
console.log(chalk.red(resolved.error ?? "No local agent detected."));
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
return [
|
|
171
|
-
{
|
|
172
|
-
name: resolved.executor.name,
|
|
173
|
-
label: resolved.executor.displayName,
|
|
174
|
-
executor: resolved.executor,
|
|
175
|
-
},
|
|
176
|
-
];
|
|
39
|
+
return { status: response.status, body, raw };
|
|
177
40
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
})
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const sourcePath = typeof argv.sourcePath === "string" && argv.sourcePath.trim().length > 0
|
|
201
|
-
? argv.sourcePath.trim()
|
|
202
|
-
: (detected ? resolveSourceControlPath(detected.path) : resolveCommandControlPath(cwd));
|
|
203
|
-
const requestedPreparation = argv.preparation;
|
|
204
|
-
const requestedPreparationName = typeof requestedPreparation === "string" && requestedPreparation.trim().length > 0
|
|
205
|
-
? requestedPreparation.trim()
|
|
206
|
-
: null;
|
|
207
|
-
const hintedPreparationConfig = (argv.preparationConfig ?? null);
|
|
208
|
-
const selectedCompiled = detected
|
|
209
|
-
? (() => {
|
|
210
|
-
const targetName = requestedPreparationName ?? hintedPreparationConfig?.name ?? detected.config.name;
|
|
211
|
-
return resolveConfiguredPreparationSelection({
|
|
212
|
-
sourcePath,
|
|
213
|
-
requestedPreparationName: targetName,
|
|
214
|
-
hintedPreparationConfig,
|
|
215
|
-
}) ?? (targetName === detected.config.name
|
|
216
|
-
? (loadCompiledPreparationConfig(detected.path)
|
|
217
|
-
?? sourcePreparationConfigFromInterfConfig(detected.config))
|
|
218
|
-
: null);
|
|
219
|
-
})()
|
|
220
|
-
: requestedPreparationName || hintedPreparationConfig
|
|
221
|
-
? resolveConfiguredPreparationSelection({
|
|
222
|
-
sourcePath,
|
|
223
|
-
requestedPreparationName,
|
|
224
|
-
hintedPreparationConfig,
|
|
225
|
-
})
|
|
226
|
-
: await chooseCompiledConfigToBuild({
|
|
227
|
-
sourcePath,
|
|
228
|
-
selectMessage: "Which saved Preparation do you want to test?",
|
|
229
|
-
});
|
|
230
|
-
if (selectedCompiled === undefined)
|
|
231
|
-
return false;
|
|
232
|
-
if (!selectedCompiled) {
|
|
233
|
-
if (requestedPreparationName) {
|
|
234
|
-
return reportTestCommandFailure(argv, `Preparation "${requestedPreparationName}" is not saved in this Source Folder.`, ["Run `interf list` to see the saved Preparations."]);
|
|
235
|
-
}
|
|
236
|
-
return reportTestCommandFailure(argv, "No saved Preparations are configured for this Source Folder yet.", ["Start with `interf` or `interf init`."]);
|
|
237
|
-
}
|
|
238
|
-
if (selectedCompiled.checks.length === 0) {
|
|
239
|
-
return reportTestCommandFailure(argv, `Preparation "${selectedCompiled.name}" does not have any readiness checks yet.`, [
|
|
240
|
-
"Run `interf`, edit this Preparation, and add a few readiness checks first.",
|
|
241
|
-
"Then rerun `interf test`.",
|
|
242
|
-
]);
|
|
243
|
-
}
|
|
244
|
-
const executionProfile = executionProfileFromArgv(argv);
|
|
245
|
-
const preserveSandboxes = readSandboxRetentionMode(argv);
|
|
246
|
-
const builtCompiledPath = detected?.config.name === selectedCompiled.name
|
|
247
|
-
? detected.path
|
|
248
|
-
: findBuiltCompiledPath(sourcePath, selectedCompiled.name);
|
|
249
|
-
const hasBuiltCompiled = builtCompiledPath
|
|
250
|
-
? createCompiledTestTarget(builtCompiledPath, selectedCompiled.name, resolveMethodId(selectedCompiled)).eligible
|
|
251
|
-
: false;
|
|
252
|
-
const requestedMode = readRequestedMode(argv);
|
|
253
|
-
const selectedMode = requestedMode ?? (process.stdin.isTTY && process.stdout.isTTY
|
|
254
|
-
? await promptTestMode(hasBuiltCompiled)
|
|
255
|
-
: (hasBuiltCompiled ? "both" : "raw"));
|
|
256
|
-
if (!selectedMode)
|
|
257
|
-
return false;
|
|
258
|
-
if (selectedMode === "compiled" && !hasBuiltCompiled) {
|
|
259
|
-
return reportTestCommandFailure(argv, `Preparation "${selectedCompiled.name}" does not have Portable Context agents can use yet.`, ["Run `interf compile` first."]);
|
|
260
|
-
}
|
|
261
|
-
if (selectedMode === "both" && !hasBuiltCompiled) {
|
|
262
|
-
return reportTestCommandFailure(argv, `Preparation "${selectedCompiled.name}" does not have Portable Context agents can use yet, so Interf cannot compare source files and Portable Context.`, ["Run `interf compile` first, or rerun with `--target source-files`."]);
|
|
263
|
-
}
|
|
264
|
-
const mode = selectedMode;
|
|
265
|
-
if (argv.skipService !== true) {
|
|
266
|
-
const submitted = await submitTestRunToLocalService({
|
|
267
|
-
projectPath: sourcePath,
|
|
268
|
-
request: {
|
|
269
|
-
preparation: selectedCompiled.name,
|
|
270
|
-
mode,
|
|
271
|
-
},
|
|
272
|
-
});
|
|
273
|
-
if (submitted) {
|
|
274
|
-
console.log(chalk.dim(` Visible in Interf: ${submitted.serviceUrl}/`));
|
|
275
|
-
let lastStatus = "";
|
|
276
|
-
const completed = await waitForLocalTestRun({
|
|
277
|
-
serviceUrl: submitted.serviceUrl,
|
|
278
|
-
runId: submitted.resource.run_id,
|
|
279
|
-
onUpdate(resource) {
|
|
280
|
-
if (resource.status === lastStatus)
|
|
281
|
-
return;
|
|
282
|
-
lastStatus = resource.status;
|
|
283
|
-
console.log(chalk.dim(` Readiness check run: ${resource.status}`));
|
|
284
|
-
},
|
|
285
|
-
});
|
|
286
|
-
if (completed.status !== "succeeded") {
|
|
287
|
-
return reportTestCommandFailure(argv, `Readiness check run ${completed.status}.`, completed.error ? [completed.error] : []);
|
|
288
|
-
}
|
|
289
|
-
const compiledScore = completed.comparison?.compiled;
|
|
290
|
-
const rawScore = completed.comparison?.raw;
|
|
291
|
-
if (compiledScore) {
|
|
292
|
-
console.log(chalk.green(` Portable Context readiness checks: ${compiledScore.passed_cases}/${compiledScore.total_cases}`));
|
|
293
|
-
}
|
|
294
|
-
if (rawScore) {
|
|
295
|
-
console.log(chalk.dim(` Source files readiness checks: ${rawScore.passed_cases}/${rawScore.total_cases}`));
|
|
296
|
-
}
|
|
297
|
-
return true;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
const selectedAgents = await resolveSelectedTestAgents({
|
|
301
|
-
argv,
|
|
302
|
-
executionProfile,
|
|
303
|
-
});
|
|
304
|
-
if (!selectedAgents || selectedAgents.length === 0) {
|
|
305
|
-
return false;
|
|
306
|
-
}
|
|
307
|
-
const rows = await Promise.all(selectedAgents.map((agent) => runModeForAgent({
|
|
308
|
-
sourcePath,
|
|
309
|
-
preparationConfig: selectedCompiled,
|
|
310
|
-
builtCompiledPath: builtCompiledPath ?? null,
|
|
311
|
-
mode,
|
|
312
|
-
preserveSandboxes,
|
|
313
|
-
executor: agent.executor,
|
|
314
|
-
saveLatest: selectedAgents.length === 1,
|
|
315
|
-
})));
|
|
316
|
-
if ((mode === "compiled" || mode === "both") && rows.some((row) => !row.compiledOutcome)) {
|
|
317
|
-
return reportTestCommandFailure(argv, `Preparation "${selectedCompiled.name}" does not have Portable Context agents can use yet.`, ["Run `interf compile` first."]);
|
|
318
|
-
}
|
|
319
|
-
printAgentTestMatrix(rows);
|
|
320
|
-
printAgentTestFailures(rows);
|
|
321
|
-
const resultSummary = {
|
|
322
|
-
sourcePath,
|
|
323
|
-
preparationConfig: selectedCompiled,
|
|
324
|
-
builtCompiledPath: builtCompiledPath ?? null,
|
|
325
|
-
mode,
|
|
326
|
-
rows,
|
|
327
|
-
};
|
|
328
|
-
const onComplete = typeof argv.onComplete === "function"
|
|
329
|
-
? argv.onComplete
|
|
330
|
-
: null;
|
|
331
|
-
if (rows.length === 1) {
|
|
332
|
-
const row = rows[0];
|
|
333
|
-
const comparisonRunPath = row?.comparisonRunPath ?? null;
|
|
334
|
-
const latestComparison = row?.comparison ?? null;
|
|
335
|
-
if (latestComparison) {
|
|
336
|
-
if (mode === "both") {
|
|
337
|
-
console.log();
|
|
338
|
-
console.log(chalk.dim(` Saved summary: ${comparisonRunPath}`));
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
printSavedTestComparisonState(latestComparison, comparisonRunPath);
|
|
342
|
-
}
|
|
41
|
+
export const testCommand = {
|
|
42
|
+
command: "test <prep-id>",
|
|
43
|
+
describe: "Run readiness checks for a preparation",
|
|
44
|
+
builder: (yargs) => yargs
|
|
45
|
+
.positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" })
|
|
46
|
+
.option("target", {
|
|
47
|
+
type: "string",
|
|
48
|
+
choices: ["source-files", "portable-context", "both"],
|
|
49
|
+
default: "both",
|
|
50
|
+
describe: "Which surface to test against",
|
|
51
|
+
})
|
|
52
|
+
.option("url", { type: "string", describe: "Override the active connection URL" })
|
|
53
|
+
.option("token", { type: "string", describe: "Override the active bearer token" }),
|
|
54
|
+
handler: async (args) => {
|
|
55
|
+
const { url, token } = resolveConnection(args);
|
|
56
|
+
const mode = args.target === "portable-context" ? "compiled" : args.target === "source-files" ? "source-files" : "both";
|
|
57
|
+
const { status, body, raw } = await callJson(`${url}/v1/preparations/${encodeURIComponent(args.prepId)}/test-runs`, token, { method: "POST", body: JSON.stringify({ mode }) });
|
|
58
|
+
if (status !== 201 && status !== 200) {
|
|
59
|
+
console.error(chalk.red(`Failed to start test run for ${args.prepId} (HTTP ${status}).`));
|
|
60
|
+
if (raw)
|
|
61
|
+
console.error(raw);
|
|
62
|
+
process.exit(1);
|
|
343
63
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
64
|
+
console.log();
|
|
65
|
+
console.log(` Run ${chalk.bold(body?.run_id ?? "(?)")} ${chalk.dim(`(${body?.status ?? "started"})`)}`);
|
|
66
|
+
if (body?.readiness?.status)
|
|
67
|
+
console.log(` Readiness: ${body.readiness.status}`);
|
|
68
|
+
if (body?.error)
|
|
69
|
+
console.log(chalk.red(` Error: ${body.error}`));
|
|
70
|
+
console.log();
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -1,11 +1,2 @@
|
|
|
1
1
|
import type { CommandModule } from "yargs";
|
|
2
2
|
export declare const webCommand: CommandModule;
|
|
3
|
-
export interface WebProjectPaths {
|
|
4
|
-
controlPath: string;
|
|
5
|
-
sourceFolderPath: string | null;
|
|
6
|
-
}
|
|
7
|
-
export declare function resolveWebProjectPaths(argv?: Record<string, unknown>, cwd?: string): WebProjectPaths;
|
|
8
|
-
export declare function ensureWebProjectInitialized(controlPath: string, options?: {
|
|
9
|
-
sourceFolderPath?: string | null;
|
|
10
|
-
}): void;
|
|
11
|
-
export declare function runWebCommand(argv?: Record<string, unknown>): Promise<void>;
|