@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
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `interf prep` — preparation CRUD against a connected instance.
|
|
3
|
+
*
|
|
4
|
+
* interf prep ls
|
|
5
|
+
* interf prep create <id> --source <path> --method <id> [--about <text>]
|
|
6
|
+
* interf prep show <id>
|
|
7
|
+
* interf prep rm <id>
|
|
8
|
+
*
|
|
9
|
+
* Every subcommand requires an active connection. If `~/.interf/connection.json`
|
|
10
|
+
* is missing or unreachable, the command exits non-zero with the
|
|
11
|
+
* connect-or-error hint.
|
|
12
|
+
*/
|
|
13
|
+
import { resolve } from "node:path";
|
|
14
|
+
import chalk from "chalk";
|
|
15
|
+
import { CONNECT_OR_ERROR_HINT, readActiveConnection, } from "../../packages/local-service/connection-config.js";
|
|
16
|
+
import { preparationResourcePath } from "../../packages/local-service/routes.js";
|
|
17
|
+
function requireConnection(args) {
|
|
18
|
+
const conn = readActiveConnection({
|
|
19
|
+
urlOverride: args.url,
|
|
20
|
+
authTokenOverride: args.token,
|
|
21
|
+
});
|
|
22
|
+
if (!conn) {
|
|
23
|
+
console.error(CONNECT_OR_ERROR_HINT);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
|
|
27
|
+
}
|
|
28
|
+
async function callJson(url, token, init = {}) {
|
|
29
|
+
const headers = new Headers(init.headers ?? {});
|
|
30
|
+
if (token)
|
|
31
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
32
|
+
if (init.body && !headers.has("content-type")) {
|
|
33
|
+
headers.set("content-type", "application/json");
|
|
34
|
+
}
|
|
35
|
+
const response = await fetch(url, { ...init, headers });
|
|
36
|
+
const raw = await response.text();
|
|
37
|
+
let body = null;
|
|
38
|
+
if (raw.length > 0) {
|
|
39
|
+
try {
|
|
40
|
+
body = JSON.parse(raw);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
body = null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { status: response.status, body, raw };
|
|
47
|
+
}
|
|
48
|
+
export const prepCommand = {
|
|
49
|
+
command: "prep <subcommand>",
|
|
50
|
+
describe: "Manage preparations on the connected instance",
|
|
51
|
+
builder: (yargs) => yargs
|
|
52
|
+
.option("url", { type: "string", describe: "Override the active connection URL" })
|
|
53
|
+
.option("token", { type: "string", describe: "Override the active bearer token" })
|
|
54
|
+
.command("ls", "List preparations", (y) => y, async (args) => {
|
|
55
|
+
const { url, token } = requireConnection(args);
|
|
56
|
+
const { status, body, raw } = await callJson(`${url}/v1/preparations`, token);
|
|
57
|
+
if (status !== 200 || !body) {
|
|
58
|
+
console.error(chalk.red(`Failed to list preparations (HTTP ${status}).`));
|
|
59
|
+
if (raw)
|
|
60
|
+
console.error(raw);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
const preparations = body.preparations ?? [];
|
|
64
|
+
if (preparations.length === 0) {
|
|
65
|
+
console.log(chalk.dim(" No preparations yet. Create one with `interf prep create <id> --source <path> --method <method-id>`."));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
console.log();
|
|
69
|
+
console.log(chalk.bold(" Preparations"));
|
|
70
|
+
console.log();
|
|
71
|
+
for (const prep of preparations) {
|
|
72
|
+
const sourceLabel = prep.source?.locator ?? prep.source_path ?? "(no source)";
|
|
73
|
+
const method = prep.method_id ?? "(no method)";
|
|
74
|
+
const readiness = prep.readiness?.status ?? "—";
|
|
75
|
+
console.log(` ${prep.id}`);
|
|
76
|
+
console.log(chalk.dim(` source: ${sourceLabel}`));
|
|
77
|
+
console.log(chalk.dim(` method: ${method}`));
|
|
78
|
+
console.log(chalk.dim(` readiness: ${readiness}`));
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
.command("create <prep-id>", "Create a preparation", (y) => y
|
|
82
|
+
.positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id (lowercase, dash-separated)" })
|
|
83
|
+
.option("source", { type: "string", demandOption: true, describe: "Path to the Source Folder" })
|
|
84
|
+
.option("method", { type: "string", demandOption: true, describe: "Method id (e.g. interf-default)" })
|
|
85
|
+
.option("about", { type: "string", describe: "One-line description of the agent work" }), async (args) => {
|
|
86
|
+
const { url, token } = requireConnection(args);
|
|
87
|
+
const sourceAbs = resolve(process.cwd(), args.source);
|
|
88
|
+
const requestBody = {
|
|
89
|
+
id: args.prepId,
|
|
90
|
+
source: { kind: "local-folder", locator: sourceAbs },
|
|
91
|
+
method_id: args.method,
|
|
92
|
+
about: args.about,
|
|
93
|
+
checks: [],
|
|
94
|
+
};
|
|
95
|
+
const { status, body, raw } = await callJson(`${url}/v1/preparations`, token, { method: "POST", body: JSON.stringify(requestBody) });
|
|
96
|
+
if (status !== 201 && status !== 200) {
|
|
97
|
+
console.error(chalk.red(`Failed to create preparation (HTTP ${status}).`));
|
|
98
|
+
if (raw)
|
|
99
|
+
console.error(raw);
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
console.log(chalk.green(`Created preparation ${chalk.bold(args.prepId)}.`));
|
|
103
|
+
if (body?.portable_context?.value) {
|
|
104
|
+
console.log(chalk.dim(` portable context (locator): ${body.portable_context.value}`));
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
.command("show <prep-id>", "Show a preparation's full record", (y) => y.positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" }), async (args) => {
|
|
108
|
+
const { url, token } = requireConnection(args);
|
|
109
|
+
const { status, body, raw } = await callJson(`${url}${preparationResourcePath(args.prepId)}`, token);
|
|
110
|
+
if (status !== 200) {
|
|
111
|
+
console.error(chalk.red(`Failed to read preparation ${args.prepId} (HTTP ${status}).`));
|
|
112
|
+
if (raw)
|
|
113
|
+
console.error(raw);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
console.log(JSON.stringify(body, null, 2));
|
|
117
|
+
})
|
|
118
|
+
.command("rm <prep-id>", "Delete a preparation", (y) => y.positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" }), async (args) => {
|
|
119
|
+
const { url, token } = requireConnection(args);
|
|
120
|
+
const { status, raw } = await callJson(`${url}${preparationResourcePath(args.prepId)}`, token, { method: "DELETE" });
|
|
121
|
+
if (status !== 200 && status !== 204) {
|
|
122
|
+
console.error(chalk.red(`Failed to delete preparation ${args.prepId} (HTTP ${status}).`));
|
|
123
|
+
if (raw)
|
|
124
|
+
console.error(raw);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
console.log(chalk.green(`Deleted preparation ${chalk.bold(args.prepId)}.`));
|
|
128
|
+
})
|
|
129
|
+
.demandCommand(1)
|
|
130
|
+
.strict(),
|
|
131
|
+
handler: () => {
|
|
132
|
+
/* yargs subcommand handlers do the work */
|
|
133
|
+
},
|
|
134
|
+
};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import type { CommandModule } from "yargs";
|
|
2
|
-
|
|
2
|
+
interface ResetArgs {
|
|
3
|
+
prepId: string;
|
|
4
|
+
mode?: "compile" | "all";
|
|
5
|
+
url?: string;
|
|
6
|
+
token?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const resetCommand: CommandModule<unknown, ResetArgs>;
|
|
9
|
+
export {};
|
|
@@ -1,22 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `interf reset <prep-id>` — reset a preparation's compile output (or all state).
|
|
3
|
+
*
|
|
4
|
+
* interf reset bristol # default mode = compile
|
|
5
|
+
* interf reset bristol --mode all # also clear method draft / runs
|
|
6
|
+
*/
|
|
1
7
|
import chalk from "chalk";
|
|
2
|
-
import {
|
|
3
|
-
|
|
8
|
+
import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/local-service/connection-config.js";
|
|
9
|
+
function resolveConnection(args) {
|
|
10
|
+
const conn = readActiveConnection({
|
|
11
|
+
urlOverride: args.url,
|
|
12
|
+
authTokenOverride: args.token,
|
|
13
|
+
});
|
|
14
|
+
if (!conn) {
|
|
15
|
+
console.error(CONNECT_OR_ERROR_HINT);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
|
|
19
|
+
}
|
|
20
|
+
async function callJson(url, token, init = {}) {
|
|
21
|
+
const headers = new Headers(init.headers ?? {});
|
|
22
|
+
if (token)
|
|
23
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
24
|
+
if (init.body && !headers.has("content-type"))
|
|
25
|
+
headers.set("content-type", "application/json");
|
|
26
|
+
const response = await fetch(url, { ...init, headers });
|
|
27
|
+
const raw = await response.text();
|
|
28
|
+
return { status: response.status, raw };
|
|
29
|
+
}
|
|
4
30
|
export const resetCommand = {
|
|
5
|
-
command: "reset <
|
|
6
|
-
describe: "Reset
|
|
7
|
-
builder: (yargs) => yargs
|
|
31
|
+
command: "reset <prep-id>",
|
|
32
|
+
describe: "Reset a preparation's compile output",
|
|
33
|
+
builder: (yargs) => yargs
|
|
34
|
+
.positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" })
|
|
35
|
+
.option("mode", {
|
|
8
36
|
type: "string",
|
|
9
37
|
choices: ["compile", "all"],
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
38
|
+
default: "compile",
|
|
39
|
+
describe: "Scope of the reset",
|
|
40
|
+
})
|
|
41
|
+
.option("url", { type: "string", describe: "Override the active connection URL" })
|
|
42
|
+
.option("token", { type: "string", describe: "Override the active bearer token" }),
|
|
43
|
+
handler: async (args) => {
|
|
44
|
+
const { url, token } = resolveConnection(args);
|
|
45
|
+
const { status, raw } = await callJson(`${url}/v1/preparations/${encodeURIComponent(args.prepId)}/reset`, token, { method: "POST", body: JSON.stringify({ scope: args.mode }) });
|
|
46
|
+
if (status !== 200 && status !== 204) {
|
|
47
|
+
console.error(chalk.red(`Failed to reset ${args.prepId} (HTTP ${status}).`));
|
|
48
|
+
if (raw)
|
|
49
|
+
console.error(raw);
|
|
50
|
+
process.exit(1);
|
|
17
51
|
}
|
|
18
|
-
|
|
19
|
-
resetCompiledGeneratedState(compiledPath, argv.scope);
|
|
20
|
-
console.log(chalk.green(" Portable Context reset complete."));
|
|
52
|
+
console.log(chalk.green(`Reset ${chalk.bold(args.prepId)} (${args.mode}).`));
|
|
21
53
|
},
|
|
22
54
|
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `interf runs` — observe / cancel / fetch run records on the connected instance.
|
|
3
|
+
*
|
|
4
|
+
* interf runs ls [--prep <id>]
|
|
5
|
+
* interf runs status <run-id>
|
|
6
|
+
* interf runs cancel <run-id>
|
|
7
|
+
* interf runs fetch <run-id> --to <path>
|
|
8
|
+
*/
|
|
9
|
+
import chalk from "chalk";
|
|
10
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { dirname, isAbsolute, resolve } from "node:path";
|
|
12
|
+
import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/local-service/connection-config.js";
|
|
13
|
+
function resolveConnection(args) {
|
|
14
|
+
const conn = readActiveConnection({
|
|
15
|
+
urlOverride: args.url,
|
|
16
|
+
authTokenOverride: args.token,
|
|
17
|
+
});
|
|
18
|
+
if (!conn) {
|
|
19
|
+
console.error(CONNECT_OR_ERROR_HINT);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
|
|
23
|
+
}
|
|
24
|
+
async function callJson(url, token, init = {}) {
|
|
25
|
+
const headers = new Headers(init.headers ?? {});
|
|
26
|
+
if (token)
|
|
27
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
28
|
+
if (init.body && !headers.has("content-type"))
|
|
29
|
+
headers.set("content-type", "application/json");
|
|
30
|
+
const response = await fetch(url, { ...init, headers });
|
|
31
|
+
const raw = await response.text();
|
|
32
|
+
let body = null;
|
|
33
|
+
if (raw) {
|
|
34
|
+
try {
|
|
35
|
+
body = JSON.parse(raw);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
body = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return { status: response.status, body, raw };
|
|
42
|
+
}
|
|
43
|
+
export const runsCommand = {
|
|
44
|
+
command: "runs <subcommand>",
|
|
45
|
+
describe: "Inspect runs on the connected instance",
|
|
46
|
+
builder: (yargs) => yargs
|
|
47
|
+
.option("url", { type: "string", describe: "Override the active connection URL" })
|
|
48
|
+
.option("token", { type: "string", describe: "Override the active bearer token" })
|
|
49
|
+
.command("ls", "List runs (optionally filtered by preparation)", (y) => y.option("prep", { type: "string", describe: "Filter by preparation id" }), async (args) => {
|
|
50
|
+
const { url, token } = resolveConnection(args);
|
|
51
|
+
const path = args.prep
|
|
52
|
+
? `/v1/preparations/${encodeURIComponent(args.prep)}/runs`
|
|
53
|
+
: "/v1/runs";
|
|
54
|
+
const { status, body, raw } = await callJson(`${url}${path}`, token);
|
|
55
|
+
if (status !== 200) {
|
|
56
|
+
console.error(chalk.red(`Failed to list runs (HTTP ${status}).`));
|
|
57
|
+
if (raw)
|
|
58
|
+
console.error(raw);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
const runs = body?.runs
|
|
62
|
+
?? (body?.compile_runs ?? []).map((r) => r.run).filter(Boolean);
|
|
63
|
+
if (runs.length === 0) {
|
|
64
|
+
console.log(chalk.dim(" No runs."));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
console.log();
|
|
68
|
+
for (const run of runs) {
|
|
69
|
+
console.log(` ${chalk.bold(run.run_id)} ${chalk.dim(`(${run.status ?? "?"})`)}`);
|
|
70
|
+
if (run.preparation)
|
|
71
|
+
console.log(chalk.dim(` prep: ${run.preparation}`));
|
|
72
|
+
if (run.started_at)
|
|
73
|
+
console.log(chalk.dim(` started: ${run.started_at}`));
|
|
74
|
+
}
|
|
75
|
+
console.log();
|
|
76
|
+
})
|
|
77
|
+
.command("status <run-id>", "Show full record for a run", (y) => y.positional("run-id", { type: "string", demandOption: true, describe: "Run id" }), async (args) => {
|
|
78
|
+
const { url, token } = resolveConnection(args);
|
|
79
|
+
const { status, raw } = await callJson(`${url}/v1/runs/${encodeURIComponent(args.runId)}`, token);
|
|
80
|
+
if (status !== 200) {
|
|
81
|
+
console.error(chalk.red(`Failed to read run ${args.runId} (HTTP ${status}).`));
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
console.log(raw);
|
|
85
|
+
})
|
|
86
|
+
.command("cancel <run-id>", "Cancel a running run", (y) => y.positional("run-id", { type: "string", demandOption: true, describe: "Run id" }), async (args) => {
|
|
87
|
+
const { url, token } = resolveConnection(args);
|
|
88
|
+
const { status, raw } = await callJson(`${url}/v1/runs/${encodeURIComponent(args.runId)}/cancel`, token, { method: "POST", body: JSON.stringify({}) });
|
|
89
|
+
if (status !== 200 && status !== 202 && status !== 204) {
|
|
90
|
+
console.error(chalk.red(`Failed to cancel ${args.runId} (HTTP ${status}).`));
|
|
91
|
+
if (raw)
|
|
92
|
+
console.error(raw);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
console.log(chalk.green(`Cancelled ${chalk.bold(args.runId)}.`));
|
|
96
|
+
})
|
|
97
|
+
.command("fetch <run-id>", "Download a run's portable context", (y) => y
|
|
98
|
+
.positional("run-id", { type: "string", demandOption: true, describe: "Run id" })
|
|
99
|
+
.option("to", { type: "string", demandOption: true, describe: "Target path" }), async (args) => {
|
|
100
|
+
const { url, token } = resolveConnection(args);
|
|
101
|
+
const headers = new Headers();
|
|
102
|
+
if (token)
|
|
103
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
104
|
+
const response = await fetch(`${url}/v1/runs/${encodeURIComponent(args.runId)}/artifacts/portable-context`, { headers });
|
|
105
|
+
if (response.status !== 200) {
|
|
106
|
+
console.error(chalk.red(`Failed to fetch artifact (HTTP ${response.status}).`));
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
const target = isAbsolute(args.to) ? args.to : resolve(process.cwd(), args.to);
|
|
110
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
111
|
+
const buffer = Buffer.from(await response.arrayBuffer());
|
|
112
|
+
writeFileSync(target, buffer);
|
|
113
|
+
console.log(chalk.green(`Wrote ${target} (${buffer.length} bytes).`));
|
|
114
|
+
})
|
|
115
|
+
.demandCommand(1)
|
|
116
|
+
.strict(),
|
|
117
|
+
handler: () => {
|
|
118
|
+
/* yargs subcommand handlers do the work */
|
|
119
|
+
},
|
|
120
|
+
};
|
|
@@ -1,237 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `interf status` — print connection state + preparation summary.
|
|
3
|
+
*/
|
|
1
4
|
import chalk from "chalk";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return chalk.dim;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function publicReadinessStatus(status) {
|
|
22
|
-
return status === "compiled" ? "ready" : "not ready";
|
|
23
|
-
}
|
|
24
|
-
function publicPrepareState(status) {
|
|
25
|
-
if (status === "compiled")
|
|
26
|
-
return "prepared";
|
|
27
|
-
if (status === "idle")
|
|
28
|
-
return "not prepared";
|
|
29
|
-
return status;
|
|
30
|
-
}
|
|
31
|
-
function publicHealthSummary(health) {
|
|
32
|
-
const completedStages = health.metrics.completed_stages;
|
|
33
|
-
const stageTotal = health.metrics.stage_total;
|
|
34
|
-
if (typeof completedStages === "number" && typeof stageTotal === "number") {
|
|
35
|
-
if (health.status === "compiled") {
|
|
36
|
-
return `Portable Context ready — ${completedStages}/${stageTotal} Method stages satisfied.`;
|
|
37
|
-
}
|
|
38
|
-
if (health.status === "stale") {
|
|
39
|
-
return `Portable Context not ready — ${completedStages}/${stageTotal} Method stages satisfied.`;
|
|
5
|
+
import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/local-service/connection-config.js";
|
|
6
|
+
async function callJson(url, token) {
|
|
7
|
+
const headers = new Headers();
|
|
8
|
+
if (token)
|
|
9
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
10
|
+
try {
|
|
11
|
+
const response = await fetch(url, { headers });
|
|
12
|
+
const raw = await response.text();
|
|
13
|
+
let body = null;
|
|
14
|
+
if (raw) {
|
|
15
|
+
try {
|
|
16
|
+
body = JSON.parse(raw);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
body = null;
|
|
20
|
+
}
|
|
40
21
|
}
|
|
22
|
+
return { status: response.status, body };
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return { status: 0, body: null };
|
|
41
26
|
}
|
|
42
|
-
return health.summary
|
|
43
|
-
.replace(/\bCompiled\b/g, "Prepared")
|
|
44
|
-
.replace(/\bcompiled\b/g, "prepared")
|
|
45
|
-
.replace(/\bmethod stages\b/g, "Method stages")
|
|
46
|
-
.replace(/\bmethod stage\b/g, "Method stage");
|
|
47
27
|
}
|
|
48
28
|
export const statusCommand = {
|
|
49
29
|
command: "status",
|
|
50
|
-
describe: "Show
|
|
51
|
-
builder: (yargs) => yargs
|
|
52
|
-
type: "
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const detected = detectInterf(process.cwd());
|
|
59
|
-
const serviceProjectPath = detected ? resolveSourceControlPath(detected.path) : resolveCommandControlPath();
|
|
60
|
-
const service = await findLocalService({
|
|
61
|
-
projectPath: serviceProjectPath,
|
|
62
|
-
timeoutMs: 200,
|
|
30
|
+
describe: "Show connection + preparation summary",
|
|
31
|
+
builder: (yargs) => yargs
|
|
32
|
+
.option("url", { type: "string", describe: "Override the active connection URL" })
|
|
33
|
+
.option("token", { type: "string", describe: "Override the active bearer token" }),
|
|
34
|
+
handler: async (args) => {
|
|
35
|
+
const conn = readActiveConnection({
|
|
36
|
+
urlOverride: args.url,
|
|
37
|
+
authTokenOverride: args.token,
|
|
63
38
|
});
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
await watchLocalServiceStatus(service.serviceUrl);
|
|
68
|
-
}
|
|
69
|
-
return;
|
|
39
|
+
if (!conn) {
|
|
40
|
+
console.error(CONNECT_OR_ERROR_HINT);
|
|
41
|
+
process.exit(1);
|
|
70
42
|
}
|
|
71
|
-
|
|
72
|
-
|
|
43
|
+
const url = conn.url.replace(/\/+$/, "");
|
|
44
|
+
const token = conn.auth_token;
|
|
45
|
+
const instance = await callJson(`${url}/v1/instance`, token);
|
|
46
|
+
if (instance.status === 0) {
|
|
47
|
+
console.error(chalk.red(`Connection ${url} is unreachable.`));
|
|
48
|
+
console.error(CONNECT_OR_ERROR_HINT);
|
|
49
|
+
process.exit(1);
|
|
73
50
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
console.log(chalk.dim(" Run `interf`, save readiness checks, and compile Portable Context agents can use first."));
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (local.length === 1) {
|
|
87
|
-
compiledPath = local[0].path;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
const selected = await p.select({
|
|
91
|
-
message: "Which Portable Context?",
|
|
92
|
-
options: local.map((entry) => ({ value: entry.path, label: entry.name })),
|
|
93
|
-
});
|
|
94
|
-
if (p.isCancel(selected))
|
|
95
|
-
return;
|
|
96
|
-
compiledPath = selected;
|
|
97
|
-
}
|
|
51
|
+
console.log();
|
|
52
|
+
console.log(chalk.bold(" Interf engine"));
|
|
53
|
+
console.log(` URL: ${url}`);
|
|
54
|
+
if (instance.body?.pid)
|
|
55
|
+
console.log(` PID: ${instance.body.pid}`);
|
|
56
|
+
if (instance.body?.package_version)
|
|
57
|
+
console.log(` Version: ${instance.body.package_version}`);
|
|
58
|
+
if (instance.body?.uptime_seconds !== undefined) {
|
|
59
|
+
console.log(` Uptime: ${instance.body.uptime_seconds}s`);
|
|
98
60
|
}
|
|
99
|
-
|
|
100
|
-
const
|
|
61
|
+
console.log(` Auth: ${instance.body?.auth_required ? "required (token in connection.json)" : "open (loopback)"}`);
|
|
62
|
+
const preps = await callJson(`${url}/v1/preparations`, token);
|
|
63
|
+
const list = preps.body?.preparations ?? [];
|
|
101
64
|
console.log();
|
|
102
|
-
console.log(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
console.log(chalk.dim(` ${publicHealthSummary(health)}`));
|
|
106
|
-
const compiledConfig = readInterfConfig(compiledPath);
|
|
107
|
-
const sourcePath = resolveSourceControlPath(compiledPath);
|
|
108
|
-
const latestComparisonState = compiledConfig
|
|
109
|
-
? readCurrentSavedTestComparison({
|
|
110
|
-
projectPath: sourcePath,
|
|
111
|
-
preparationName: compiledConfig.name,
|
|
112
|
-
checks: (loadCompiledPreparationConfig(compiledPath)
|
|
113
|
-
?? sourcePreparationConfigFromInterfConfig(compiledConfig)).checks,
|
|
114
|
-
})
|
|
115
|
-
: { comparison: null, stale: false };
|
|
116
|
-
const latestComparison = latestComparisonState.comparison;
|
|
117
|
-
if (latestComparison) {
|
|
118
|
-
printSavedTestComparisonState(latestComparison);
|
|
65
|
+
console.log(chalk.bold(` Preparations (${list.length})`));
|
|
66
|
+
if (list.length === 0) {
|
|
67
|
+
console.log(chalk.dim(" No preparations yet. `interf prep create <id> --source <path> --method <id>`."));
|
|
119
68
|
}
|
|
120
69
|
else {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
70
|
+
for (const prep of list) {
|
|
71
|
+
const readiness = prep.readiness?.status ?? "—";
|
|
72
|
+
console.log(` ${chalk.bold(prep.id)} ${chalk.dim(`(${prep.method_id} · ${readiness})`)}`);
|
|
73
|
+
console.log(chalk.dim(` source: ${prep.source.locator}`));
|
|
74
|
+
}
|
|
125
75
|
}
|
|
126
76
|
console.log();
|
|
127
|
-
const metricOrder = [
|
|
128
|
-
"source_total",
|
|
129
|
-
"stage_total",
|
|
130
|
-
"completed_stages",
|
|
131
|
-
"warnings",
|
|
132
|
-
"errors",
|
|
133
|
-
];
|
|
134
|
-
const printed = new Set();
|
|
135
|
-
for (const key of metricOrder) {
|
|
136
|
-
const value = health.metrics[key];
|
|
137
|
-
if (typeof value !== "number")
|
|
138
|
-
continue;
|
|
139
|
-
printed.add(key);
|
|
140
|
-
console.log(chalk.dim(` ${key}: ${value}`));
|
|
141
|
-
}
|
|
142
|
-
for (const [key, value] of Object.entries(health.metrics)) {
|
|
143
|
-
if (printed.has(key))
|
|
144
|
-
continue;
|
|
145
|
-
console.log(chalk.dim(` ${key}: ${value}`));
|
|
146
|
-
}
|
|
147
77
|
},
|
|
148
78
|
};
|
|
149
|
-
function formatEventTime(value) {
|
|
150
|
-
const date = new Date(value);
|
|
151
|
-
if (Number.isNaN(date.valueOf()))
|
|
152
|
-
return value;
|
|
153
|
-
return date.toLocaleTimeString([], {
|
|
154
|
-
hour: "2-digit",
|
|
155
|
-
minute: "2-digit",
|
|
156
|
-
second: "2-digit",
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
function testScore(run) {
|
|
160
|
-
const compiled = run.comparison?.compiled;
|
|
161
|
-
const raw = run.comparison?.raw;
|
|
162
|
-
if (compiled)
|
|
163
|
-
return `${compiled.passed_cases}/${compiled.total_cases}`;
|
|
164
|
-
if (raw)
|
|
165
|
-
return `${raw.passed_cases}/${raw.total_cases}`;
|
|
166
|
-
return "pending";
|
|
167
|
-
}
|
|
168
|
-
function compileRunEventDetail(event) {
|
|
169
|
-
if ("message" in event && typeof event.message === "string")
|
|
170
|
-
return event.message;
|
|
171
|
-
if ("summary" in event && typeof event.summary === "string")
|
|
172
|
-
return event.summary;
|
|
173
|
-
if ("error" in event && typeof event.error === "string")
|
|
174
|
-
return event.error;
|
|
175
|
-
if ("stage_id" in event && typeof event.stage_id === "string")
|
|
176
|
-
return event.stage_id;
|
|
177
|
-
return "recorded";
|
|
178
|
-
}
|
|
179
|
-
async function printLocalServiceStatus(serviceUrl) {
|
|
180
|
-
const { jobs, compileRuns, testRuns } = await readLocalServiceRunSnapshot({ serviceUrl });
|
|
181
|
-
const latestJob = jobs[0] ?? null;
|
|
182
|
-
const latestCompile = compileRuns[0]?.run ?? null;
|
|
183
|
-
const latestTest = testRuns[0] ?? null;
|
|
184
|
-
console.log();
|
|
185
|
-
console.log(chalk.green(" Interf local service is running"));
|
|
186
|
-
console.log(chalk.dim(` Interf: ${serviceUrl}/`));
|
|
187
|
-
if (latestJob) {
|
|
188
|
-
console.log();
|
|
189
|
-
console.log(chalk.bold(` Latest local job: ${latestJob.title}`));
|
|
190
|
-
console.log(chalk.dim(` run: ${latestJob.run_id}`));
|
|
191
|
-
console.log(chalk.dim(` type: ${latestJob.job_type}`));
|
|
192
|
-
console.log(chalk.dim(` status: ${latestJob.status}`));
|
|
193
|
-
const stepSummary = latestJob.steps
|
|
194
|
-
.map((step) => `${step.id}:${step.status}`)
|
|
195
|
-
.join(", ");
|
|
196
|
-
if (stepSummary)
|
|
197
|
-
console.log(chalk.dim(` steps: ${stepSummary}`));
|
|
198
|
-
for (const event of latestJob.events.slice(-4)) {
|
|
199
|
-
const detail = event.message ?? event.step_id ?? "recorded";
|
|
200
|
-
console.log(chalk.dim(` ${formatEventTime(event.timestamp)} ${event.type} ${detail}`));
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (latestCompile) {
|
|
204
|
-
console.log();
|
|
205
|
-
console.log(chalk.bold(` Latest prepare run: ${latestCompile.preparation}`));
|
|
206
|
-
console.log(chalk.dim(` run: ${latestCompile.run_id}`));
|
|
207
|
-
console.log(chalk.dim(` status: ${latestCompile.status}`));
|
|
208
|
-
console.log(chalk.dim(` Method: ${latestCompile.method}`));
|
|
209
|
-
const stageSummary = latestCompile.stages
|
|
210
|
-
.map((stage) => `${stage.stage_id}:${stage.status}`)
|
|
211
|
-
.join(", ");
|
|
212
|
-
if (stageSummary)
|
|
213
|
-
console.log(chalk.dim(` stages: ${stageSummary}`));
|
|
214
|
-
const events = latestCompile.events.slice(-6);
|
|
215
|
-
for (const event of events) {
|
|
216
|
-
const detail = compileRunEventDetail(event);
|
|
217
|
-
console.log(chalk.dim(` ${formatEventTime(event.timestamp)} ${event.type} ${detail}`));
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
console.log(chalk.dim(" No prepare runs recorded by the local service yet."));
|
|
222
|
-
}
|
|
223
|
-
if (latestTest) {
|
|
224
|
-
console.log();
|
|
225
|
-
console.log(chalk.bold(` Latest readiness check run: ${latestTest.preparation}`));
|
|
226
|
-
console.log(chalk.dim(` status: ${latestTest.status}`));
|
|
227
|
-
console.log(chalk.dim(` mode: ${latestTest.mode}`));
|
|
228
|
-
console.log(chalk.dim(` readiness checks: ${testScore(latestTest)}`));
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
async function watchLocalServiceStatus(serviceUrl) {
|
|
232
|
-
while (true) {
|
|
233
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
234
|
-
console.clear();
|
|
235
|
-
await printLocalServiceStatus(serviceUrl);
|
|
236
|
-
}
|
|
237
|
-
}
|