@ora-ai/cli 0.27.0 → 0.29.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/dist/command-tree.d.ts +5 -0
- package/dist/command-tree.d.ts.map +1 -1
- package/dist/command-tree.js +41 -6
- package/dist/command-tree.js.map +1 -1
- package/dist/core/body-flags.d.ts +39 -0
- package/dist/core/body-flags.d.ts.map +1 -0
- package/dist/core/body-flags.js +229 -0
- package/dist/core/body-flags.js.map +1 -0
- package/dist/core/body-help.d.ts +11 -0
- package/dist/core/body-help.d.ts.map +1 -0
- package/dist/core/body-help.js +78 -0
- package/dist/core/body-help.js.map +1 -0
- package/dist/core/body-values.d.ts +64 -0
- package/dist/core/body-values.d.ts.map +1 -0
- package/dist/core/body-values.js +250 -0
- package/dist/core/body-values.js.map +1 -0
- package/dist/core/cli-arguments.d.ts +1 -1
- package/dist/core/cli-arguments.d.ts.map +1 -1
- package/dist/core/cli-arguments.js.map +1 -1
- package/dist/core/run-operation.d.ts +2 -2
- package/dist/core/run-operation.d.ts.map +1 -1
- package/dist/core/run-operation.js +1 -1
- package/dist/core/run-operation.js.map +1 -1
- package/dist/generated/operations.d.ts +32 -1
- package/dist/generated/operations.d.ts.map +1 -1
- package/dist/generated/operations.js +7286 -84
- package/dist/generated/operations.js.map +1 -1
- package/dist/generated/types.d.ts +5 -0
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/generated/types.js +1 -1
- package/dist/study-ci/ci-command.d.ts +3 -1
- package/dist/study-ci/ci-command.d.ts.map +1 -1
- package/dist/study-ci/ci-command.js +49 -14
- package/dist/study-ci/ci-command.js.map +1 -1
- package/dist/study-ci/ci-run.d.ts +28 -6
- package/dist/study-ci/ci-run.d.ts.map +1 -1
- package/dist/study-ci/ci-run.js +26 -3
- package/dist/study-ci/ci-run.js.map +1 -1
- package/dist/study-ci/create-body.d.ts +32 -0
- package/dist/study-ci/create-body.d.ts.map +1 -0
- package/dist/study-ci/create-body.js +70 -0
- package/dist/study-ci/create-body.js.map +1 -0
- package/dist/study-ci/run-command.d.ts +5 -0
- package/dist/study-ci/run-command.d.ts.map +1 -0
- package/dist/study-ci/run-command.js +85 -0
- package/dist/study-ci/run-command.js.map +1 -0
- package/dist/watch.d.ts +1 -1
- package/dist/watch.d.ts.map +1 -1
- package/dist/watch.js +6 -14
- package/dist/watch.js.map +1 -1
- package/package.json +1 -1
package/dist/generated/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// GENERATED by scripts/generate.mjs — DO NOT EDIT.
|
|
2
|
-
// Source: openapi/ora-public.openapi.json (sha256
|
|
2
|
+
// Source: openapi/ora-public.openapi.json (sha256 f177bc9eace1b4d72a06b0641d1d816e308c341e56a6ab369ed4d559da77780e)
|
|
3
3
|
// Regenerate: yarn nx run ora-cli:generate
|
|
4
4
|
export {};
|
|
5
5
|
//# sourceMappingURL=types.js.map
|
|
@@ -7,9 +7,11 @@ export declare function ciPathsOf(operations?: readonly {
|
|
|
7
7
|
pathTemplate: string;
|
|
8
8
|
}[]): CiPaths;
|
|
9
9
|
interface CiRunFlags {
|
|
10
|
-
file
|
|
10
|
+
file?: string;
|
|
11
11
|
gate: string;
|
|
12
12
|
param: string[];
|
|
13
|
+
set?: string[];
|
|
14
|
+
printBody?: boolean;
|
|
13
15
|
series?: string;
|
|
14
16
|
/** `--carry` is true, `--no-carry` false; neither leaves the body file's own policy. */
|
|
15
17
|
carry?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-command.d.ts","sourceRoot":"","sources":["../../src/study-ci/ci-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ci-command.d.ts","sourceRoot":"","sources":["../../src/study-ci/ci-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,KAAK,EAA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AO,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOhH;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CA8GxE"}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { bodyHelpLines } from "../core/body-help.js";
|
|
3
|
+
import { BodyValueError } from "../core/body-values.js";
|
|
2
4
|
import { credentials } from "../core/run-operation.js";
|
|
3
5
|
import { OPERATIONS } from "../generated/operations.js";
|
|
4
6
|
import { CiRunError, EXIT, exitCodeOf, runStudyCi } from "./ci-run.js";
|
|
5
7
|
import { attachStudyCiRehearse } from "./ci-rehearse-command.js";
|
|
6
8
|
import { gateReportMarkdown } from "./gate-report.js";
|
|
7
|
-
import {
|
|
9
|
+
import { attachCreateBody, createOperation, NO_BODY_MESSAGE } from "./create-body.js";
|
|
10
|
+
import { StudyParamError } from "./params.js";
|
|
11
|
+
import { attachStudyRun } from "./run-command.js";
|
|
8
12
|
/**
|
|
9
13
|
* `ora study ci run` — the hand-written companion to the generated `ora study
|
|
10
14
|
* …` commands (as `ora tunnel` is to `ora tunnels`): it runs one study from a
|
|
11
|
-
* body file to a gate verdict, for a CI job. See
|
|
12
|
-
* and the exit codes.
|
|
15
|
+
* body (flags, a file, or both) to a gate verdict, for a CI job. See
|
|
16
|
+
* ./ci-run.ts for the sequence and the exit codes.
|
|
17
|
+
*
|
|
18
|
+
* THE STUDY'S FLAGS ARE NOT WRITTEN HERE: they are the create operation's own,
|
|
19
|
+
* from the generated manifest (./create-body.ts). An option this command
|
|
20
|
+
* declares itself (`--series`, `--carry`) keeps its meaning.
|
|
13
21
|
*
|
|
14
22
|
* WHERE EACH OPERATION LIVES is read from the generated manifest by id, so a
|
|
15
23
|
* path that moves in the API moves here with the next `yarn regen:openapi`,
|
|
@@ -24,6 +32,7 @@ const OPERATION_IDS = {
|
|
|
24
32
|
stream: "study.stream",
|
|
25
33
|
rerunInfraFailures: "study.rerunInfraFailures",
|
|
26
34
|
gate: "study.gate",
|
|
35
|
+
settlement: "study.settlement",
|
|
27
36
|
};
|
|
28
37
|
/** The CI run's paths, from the manifest. Throws naming the operation this build of the CLI lacks. */
|
|
29
38
|
export function ciPathsOf(operations = OPERATIONS) {
|
|
@@ -70,11 +79,15 @@ export function attachStudyCi(program, deps) {
|
|
|
70
79
|
const ci = study.commands.find((c) => c.name() === "ci") ?? study.command("ci").description("run a study as a CI gate");
|
|
71
80
|
// The step before a run: one real run per group, to prove the design is wired (./ci-rehearse-command.ts).
|
|
72
81
|
attachStudyCiRehearse(ci, deps);
|
|
73
|
-
|
|
82
|
+
// The same sequence without a gate: one study from the command line to its settled result (./run-command.ts).
|
|
83
|
+
attachStudyRun(study, deps, ciPathsOf);
|
|
84
|
+
const create = createOperation();
|
|
85
|
+
const run = ci
|
|
86
|
+
.command("run")
|
|
74
87
|
.description("Create, launch and wait for one study, then answer a gate: exit 0 pass, 1 fail, 2 undecided, 3 error")
|
|
75
|
-
.
|
|
88
|
+
.option("--file <path>", "the study's create body (JSON); strings may name ${param} placeholders. A flag wins over the same field")
|
|
76
89
|
.requiredOption("--gate <path>", "the gate (JSON): a floor and/or a maxDrop against a baseline")
|
|
77
|
-
.option("--param <name=value>", "fill a ${name} placeholder of the body (repeatable)", collect, [])
|
|
90
|
+
.option("--param <name=value>", "fill a ${name} placeholder of the --file body (repeatable); a flag's value is taken as written", collect, [])
|
|
78
91
|
.option("--series <key>", "the series this study belongs to (the gate's series baseline is found in it)")
|
|
79
92
|
.option("--carry", "reuse unchanged runs from the series' previous study, when the body file declares no carry policy")
|
|
80
93
|
.option("--no-carry", "run every job: ignore the body file's carry policy for this study")
|
|
@@ -99,21 +112,39 @@ export function attachStudyCi(program, deps) {
|
|
|
99
112
|
process.exitCode = EXIT.error;
|
|
100
113
|
return;
|
|
101
114
|
}
|
|
115
|
+
// The study, before anything is asked of the API: a flag that cannot be read is told here, with nothing created.
|
|
116
|
+
let studyBody;
|
|
117
|
+
try {
|
|
118
|
+
const body = createBody.read(flags);
|
|
119
|
+
if (body === null)
|
|
120
|
+
throw new BodyValueError(NO_BODY_MESSAGE);
|
|
121
|
+
const ref = refOf(flags, deps.env);
|
|
122
|
+
studyBody = carryChoiceOf({
|
|
123
|
+
...body,
|
|
124
|
+
...(flags.series ? { series: flags.series } : {}),
|
|
125
|
+
...(Object.keys(ref).length > 0 ? { ref } : {}),
|
|
126
|
+
}, flags.carry);
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
if (!(err instanceof BodyValueError) && !(err instanceof StudyParamError))
|
|
130
|
+
throw err;
|
|
131
|
+
deps.errOut(`ora study ci: ${err.message}`);
|
|
132
|
+
process.exitCode = EXIT.error;
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (flags.printBody) {
|
|
136
|
+
deps.out(JSON.stringify(studyBody, null, 2));
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
102
139
|
const creds = credentials(deps, flags.apiUrl);
|
|
103
140
|
if (!creds) {
|
|
104
141
|
process.exitCode = EXIT.error;
|
|
105
142
|
return;
|
|
106
143
|
}
|
|
107
144
|
try {
|
|
108
|
-
const body = applyParams(JSON.parse(readFileSync(flags.file, "utf8")), parseParams(flags.param));
|
|
109
|
-
const ref = refOf(flags, deps.env);
|
|
110
145
|
const gate = JSON.parse(readFileSync(flags.gate, "utf8"));
|
|
111
146
|
const run = await runStudyCi({
|
|
112
|
-
body:
|
|
113
|
-
...body,
|
|
114
|
-
...(flags.series ? { series: flags.series } : {}),
|
|
115
|
-
...(Object.keys(ref).length > 0 ? { ref } : {}),
|
|
116
|
-
}, flags.carry),
|
|
147
|
+
body: studyBody,
|
|
117
148
|
gate,
|
|
118
149
|
timeoutMs: timeoutMinutes * 60_000,
|
|
119
150
|
infraReruns,
|
|
@@ -143,9 +174,13 @@ export function attachStudyCi(program, deps) {
|
|
|
143
174
|
catch (err) {
|
|
144
175
|
const hint = err instanceof CiRunError && err.studyId ? ` (study ${err.studyId})` : "";
|
|
145
176
|
// Anything else is told as this caller's error: an API refusal in its credential's own words.
|
|
146
|
-
deps.errOut(err instanceof
|
|
177
|
+
deps.errOut(err instanceof CiRunError ? `ora study ci: ${err.message}${hint}` : creds.renderError(err));
|
|
147
178
|
process.exitCode = EXIT.error;
|
|
148
179
|
}
|
|
149
180
|
});
|
|
181
|
+
// The create body's own flags, added after this command's: an option declared above keeps its name and its meaning.
|
|
182
|
+
// (The action above runs later, when the command is used: it reads the body through this.)
|
|
183
|
+
const createBody = attachCreateBody(run, create);
|
|
184
|
+
run.addHelpText("after", ["", ...bodyHelpLines(create)].join("\n"));
|
|
150
185
|
}
|
|
151
186
|
//# sourceMappingURL=ci-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-command.js","sourceRoot":"","sources":["../../src/study-ci/ci-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAsC,MAAM,aAAa,CAAC;AAC3G,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ci-command.js","sourceRoot":"","sources":["../../src/study-ci/ci-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MA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C,CAAC,CAAC;IACL,oHAAoH;IACpH,2FAA2F;IAC3F,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACjD,GAAG,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -48,19 +48,24 @@ export interface CiPaths {
|
|
|
48
48
|
stream: string;
|
|
49
49
|
rerunInfraFailures: string;
|
|
50
50
|
gate: string;
|
|
51
|
+
/** What a study still owes, asked without a gate (`ora study run`). */
|
|
52
|
+
settlement: string;
|
|
51
53
|
}
|
|
52
|
-
|
|
54
|
+
/** What every sequence that runs one study needs: the body, and how long it may wait. */
|
|
55
|
+
export interface StudyRunOptions {
|
|
53
56
|
/** The create body, parameters already applied. */
|
|
54
57
|
body: Record<string, unknown>;
|
|
55
|
-
/** The gate spec (the gate door's request body). */
|
|
56
|
-
gate: unknown;
|
|
57
58
|
/** How long the whole run may take, from launch. */
|
|
58
59
|
timeoutMs: number;
|
|
59
|
-
/** How many times infra-failed runs are re-run in place before the gate's refusal stands. */
|
|
60
|
-
infraReruns: number;
|
|
61
60
|
/** How long to wait between two asks while grading settles. */
|
|
62
61
|
settlePollMs: number;
|
|
63
62
|
}
|
|
63
|
+
export interface CiRunOptions extends StudyRunOptions {
|
|
64
|
+
/** The gate spec (the gate door's request body). */
|
|
65
|
+
gate: unknown;
|
|
66
|
+
/** How many times infra-failed runs are re-run in place before the gate's refusal stands. */
|
|
67
|
+
infraReruns: number;
|
|
68
|
+
}
|
|
64
69
|
export interface CiRunDeps {
|
|
65
70
|
client: CiClient;
|
|
66
71
|
paths: CiPaths;
|
|
@@ -69,12 +74,24 @@ export interface CiRunDeps {
|
|
|
69
74
|
/** Progress lines, for a human reading the job log. */
|
|
70
75
|
log: (line: string) => void;
|
|
71
76
|
}
|
|
72
|
-
|
|
77
|
+
/** The study a sequence created and launched. */
|
|
78
|
+
export interface StartedStudy {
|
|
73
79
|
studyId: string;
|
|
74
80
|
studyName: string;
|
|
75
81
|
plannedRunCount: number | null;
|
|
82
|
+
}
|
|
83
|
+
export interface CiRunResult extends StartedStudy {
|
|
76
84
|
result: GateReportInput;
|
|
77
85
|
}
|
|
86
|
+
/** What the settlement door answers: `settled` once nothing is owed. */
|
|
87
|
+
export interface StudySettlement {
|
|
88
|
+
state: string;
|
|
89
|
+
owed: string[];
|
|
90
|
+
}
|
|
91
|
+
export interface StudyRunResult extends StartedStudy {
|
|
92
|
+
/** The last answer before the sequence ended: `pending` here means the time ran out first. */
|
|
93
|
+
settlement: StudySettlement;
|
|
94
|
+
}
|
|
78
95
|
export declare class CiRunError extends Error {
|
|
79
96
|
readonly studyId?: string | undefined;
|
|
80
97
|
constructor(message: string, studyId?: string | undefined);
|
|
@@ -83,5 +100,10 @@ export declare class CiRunError extends Error {
|
|
|
83
100
|
export declare const STREAM_RETRY_MS = 5000;
|
|
84
101
|
/** The process exit code for a decision, under the caller's policy for "cannot tell yet". */
|
|
85
102
|
export declare function exitCodeOf(decision: string, undecided?: UndecidedPolicy): number;
|
|
103
|
+
/**
|
|
104
|
+
* `ora study run` — ONE study, start to settled, with no gate asked: the same start, then the settlement door
|
|
105
|
+
* until it says `settled` or the time runs out. Whether a study has settled is that door's answer, never a rule here.
|
|
106
|
+
*/
|
|
107
|
+
export declare function runStudy(options: StudyRunOptions, deps: CiRunDeps): Promise<StudyRunResult>;
|
|
86
108
|
export declare function runStudyCi(options: CiRunOptions, deps: CiRunDeps): Promise<CiRunResult>;
|
|
87
109
|
//# sourceMappingURL=ci-run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-run.d.ts","sourceRoot":"","sources":["../../src/study-ci/ci-run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;;;;;;;;;;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,WAAW,WAAY,SAAQ,YAAY;IAC/C,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,8FAA8F;IAC9F,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED,qBAAa,UAAW,SAAQ,KAAK;IAGjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM;gBADzB,OAAO,EAAE,MAAM,EACN,OAAO,CAAC,EAAE,MAAM,YAAA;CAK5B;AAGD,2DAA2D;AAC3D,eAAO,MAAM,eAAe,OAAQ,CAAC;AAIrC,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAE,eAA6B,GAAG,MAAM,CAI7F;AAuCD;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAQjG;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAsB7F"}
|
package/dist/study-ci/ci-run.js
CHANGED
|
@@ -40,7 +40,11 @@ export function exitCodeOf(decision, undecided = "undecided") {
|
|
|
40
40
|
return EXIT.fail;
|
|
41
41
|
return undecided === "pass" ? EXIT.pass : undecided === "fail" ? EXIT.fail : EXIT.undecided;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* The steps every sequence starts with: preflight, create, launch, then wait until the runs end. Answers the study
|
|
45
|
+
* and the moment the whole run must be over by.
|
|
46
|
+
*/
|
|
47
|
+
async function startStudy(options, deps) {
|
|
44
48
|
const { client, paths, log } = deps;
|
|
45
49
|
const plan = (await client.call({ method: "post", path: paths.preflight, body: options.body }));
|
|
46
50
|
const plannedRunCount = typeof plan?.plannedRunCount === "number" ? plan.plannedRunCount : null;
|
|
@@ -54,13 +58,32 @@ export async function runStudyCi(options, deps) {
|
|
|
54
58
|
const studyName = created?.study?.name ?? studyId;
|
|
55
59
|
log(`created study ${studyId} (${created?.study?.status ?? "unknown status"})`);
|
|
56
60
|
if (created?.study?.status !== "ready") {
|
|
57
|
-
// A corpus that still has to be generated is a review step, not a
|
|
58
|
-
throw new CiRunError(`the study is '${created?.study?.status}', not 'ready': a
|
|
61
|
+
// A corpus that still has to be generated is a review step, not a one-command step: its tasks would differ run to run.
|
|
62
|
+
throw new CiRunError(`the study is '${created?.study?.status}', not 'ready': a study run in one command needs its tasks in the body (\`tasks\`) or a pinned benchmark version`, studyId);
|
|
59
63
|
}
|
|
60
64
|
await client.call({ method: "post", path: at(paths.launch, studyId) });
|
|
61
65
|
const deadline = deps.now() + options.timeoutMs;
|
|
62
66
|
log("launched; waiting for the runs to end");
|
|
63
67
|
await waitForRuns(studyId, deadline, deps);
|
|
68
|
+
return { studyId, studyName, plannedRunCount, deadline };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* `ora study run` — ONE study, start to settled, with no gate asked: the same start, then the settlement door
|
|
72
|
+
* until it says `settled` or the time runs out. Whether a study has settled is that door's answer, never a rule here.
|
|
73
|
+
*/
|
|
74
|
+
export async function runStudy(options, deps) {
|
|
75
|
+
const { deadline, ...started } = await startStudy(options, deps);
|
|
76
|
+
for (;;) {
|
|
77
|
+
const settlement = (await deps.client.call({ method: "get", path: at(deps.paths.settlement, started.studyId) }));
|
|
78
|
+
if (settlement.state === "settled" || deps.now() >= deadline)
|
|
79
|
+
return { ...started, settlement };
|
|
80
|
+
deps.log(`not settled yet (${settlement.owed.join(", ") || "work owed"}); asking again`);
|
|
81
|
+
await deps.sleep(options.settlePollMs);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export async function runStudyCi(options, deps) {
|
|
85
|
+
const { client, paths, log } = deps;
|
|
86
|
+
const { studyId, studyName, plannedRunCount, deadline } = await startStudy(options, deps);
|
|
64
87
|
let rerunsLeft = options.infraReruns;
|
|
65
88
|
for (;;) {
|
|
66
89
|
const result = (await client.call({ method: "post", path: at(paths.gate, studyId), body: options.gate }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-run.js","sourceRoot":"","sources":["../../src/study-ci/ci-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ci-run.js","sourceRoot":"","sources":["../../src/study-ci/ci-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAW,CAAC;AAwE1E,MAAM,OAAO,UAAW,SAAQ,KAAK;IAGxB;IAFX,YACE,OAAe,EACN,OAAgB;QAEzB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFN,YAAO,GAAP,OAAO,CAAS;QAGzB,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AACtF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAErC,MAAM,EAAE,GAAG,CAAC,QAAgB,EAAE,EAAU,EAAU,EAAE,CAAC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uB,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAClH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type OperationMeta } from "../generated/operations.js";
|
|
3
|
+
/**
|
|
4
|
+
* A STUDY'S CREATE BODY, for the hand-written commands that run a whole study (`ora study run`, `ora study ci
|
|
5
|
+
* run`). Their sequencing is written by hand; THE BODY'S INTERFACE IS NOT: its flags are the `study.create`
|
|
6
|
+
* operation's own, read from the generated manifest (core/body-flags.ts), so these commands take exactly the flags
|
|
7
|
+
* `ora study create` takes, and gain a flag when the API gains a field.
|
|
8
|
+
*
|
|
9
|
+
* A --file is the base, a flag wins over the same field, and `--set` changes one place last. `--param name=value`
|
|
10
|
+
* fills the `${name}` placeholders of the FILE (a body committed to a repository names its values that way); a
|
|
11
|
+
* flag's value is taken as written, because the shell has already filled it: a task about `${HOME}` stays one.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CREATE_OPERATION_ID = "study.create";
|
|
14
|
+
export declare function createOperation(operations?: readonly OperationMeta[]): OperationMeta;
|
|
15
|
+
export interface CreateBodyFlags {
|
|
16
|
+
file?: string;
|
|
17
|
+
set?: string[];
|
|
18
|
+
param?: string[];
|
|
19
|
+
}
|
|
20
|
+
/** What reads a command's flags into the create body: made once, when the command is declared. */
|
|
21
|
+
export interface CreateBodyReader {
|
|
22
|
+
/** The body, or null when neither a file nor a flag gave any of it. Throws BodyValueError or StudyParamError. */
|
|
23
|
+
read(flags: CreateBodyFlags & Record<string, unknown>): Record<string, unknown> | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Adds the create operation's body flags to `command` (after its own options, which keep their names) and
|
|
27
|
+
* answers the reader of the body they make.
|
|
28
|
+
*/
|
|
29
|
+
export declare function attachCreateBody(command: Command, create?: OperationMeta): CreateBodyReader;
|
|
30
|
+
/** The one sentence for a command that was given no body at all. */
|
|
31
|
+
export declare const NO_BODY_MESSAGE = "give the study: its fields as flags (--name, --agent, --task, \u2026 see --help), or a JSON file with --file";
|
|
32
|
+
//# sourceMappingURL=create-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-body.d.ts","sourceRoot":"","sources":["../../src/study-ci/create-body.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG5E;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAElD,wBAAgB,eAAe,CAAC,UAAU,GAAE,SAAS,aAAa,EAAe,GAAG,aAAa,CAIhG;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,kGAAkG;AAClG,MAAM,WAAW,gBAAgB;IAC/B,iHAAiH;IACjH,IAAI,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACxF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,GAAE,aAAiC,GAAG,gBAAgB,CAe9G;AAuBD,oEAAoE;AACpE,eAAO,MAAM,eAAe,iHAC+E,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { applySets, attachBodyFlags, bodyFromFlags } from "../core/body-flags.js";
|
|
3
|
+
import { BodyValueError } from "../core/body-values.js";
|
|
4
|
+
import { OPERATIONS } from "../generated/operations.js";
|
|
5
|
+
import { applyParams, parseParams } from "./params.js";
|
|
6
|
+
/**
|
|
7
|
+
* A STUDY'S CREATE BODY, for the hand-written commands that run a whole study (`ora study run`, `ora study ci
|
|
8
|
+
* run`). Their sequencing is written by hand; THE BODY'S INTERFACE IS NOT: its flags are the `study.create`
|
|
9
|
+
* operation's own, read from the generated manifest (core/body-flags.ts), so these commands take exactly the flags
|
|
10
|
+
* `ora study create` takes, and gain a flag when the API gains a field.
|
|
11
|
+
*
|
|
12
|
+
* A --file is the base, a flag wins over the same field, and `--set` changes one place last. `--param name=value`
|
|
13
|
+
* fills the `${name}` placeholders of the FILE (a body committed to a repository names its values that way); a
|
|
14
|
+
* flag's value is taken as written, because the shell has already filled it: a task about `${HOME}` stays one.
|
|
15
|
+
*/
|
|
16
|
+
export const CREATE_OPERATION_ID = "study.create";
|
|
17
|
+
export function createOperation(operations = OPERATIONS) {
|
|
18
|
+
const found = operations.find((op) => op.id === CREATE_OPERATION_ID);
|
|
19
|
+
if (!found)
|
|
20
|
+
throw new Error(`this CLI's API manifest has no '${CREATE_OPERATION_ID}' operation`);
|
|
21
|
+
return found;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Adds the create operation's body flags to `command` (after its own options, which keep their names) and
|
|
25
|
+
* answers the reader of the body they make.
|
|
26
|
+
*/
|
|
27
|
+
export function attachCreateBody(command, create = createOperation()) {
|
|
28
|
+
const attached = attachBodyFlags(command, create);
|
|
29
|
+
const io = { read: (path) => readFileSync(path, "utf8") };
|
|
30
|
+
return {
|
|
31
|
+
read(flags) {
|
|
32
|
+
const params = parseParams(flags.param ?? []);
|
|
33
|
+
let fromFile;
|
|
34
|
+
if (flags.file !== undefined)
|
|
35
|
+
fromFile = applyParams(fileBody(flags.file), params);
|
|
36
|
+
// With no file a --param has nothing to fill: it is refused as unused, as an unused one is with a file.
|
|
37
|
+
else if (params.size > 0)
|
|
38
|
+
applyParams({}, params);
|
|
39
|
+
const fromFlags = bodyFromFlags(attached, flags, io);
|
|
40
|
+
if (fromFile === undefined && Object.keys(fromFlags).length === 0 && !flags.set?.length)
|
|
41
|
+
return null;
|
|
42
|
+
return applySets({ ...fromFile, ...fromFlags }, flags.set, io);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** The JSON object in a --file ("-" is stdin). Every way it can fail is told naming the file. */
|
|
47
|
+
function fileBody(file) {
|
|
48
|
+
const name = file === "-" ? "stdin" : file;
|
|
49
|
+
let text;
|
|
50
|
+
try {
|
|
51
|
+
text = readFileSync(file === "-" ? 0 : file, "utf8");
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
throw new BodyValueError(`could not read ${name}: ${err.message}`);
|
|
55
|
+
}
|
|
56
|
+
let parsed;
|
|
57
|
+
try {
|
|
58
|
+
parsed = JSON.parse(text);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
throw new BodyValueError(`${name} is not valid JSON: ${err.message}`);
|
|
62
|
+
}
|
|
63
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
64
|
+
throw new BodyValueError(`the body in ${name} must be a JSON object`);
|
|
65
|
+
}
|
|
66
|
+
return parsed;
|
|
67
|
+
}
|
|
68
|
+
/** The one sentence for a command that was given no body at all. */
|
|
69
|
+
export const NO_BODY_MESSAGE = "give the study: its fields as flags (--name, --agent, --task, … see --help), or a JSON file with --file";
|
|
70
|
+
//# sourceMappingURL=create-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-body.js","sourceRoot":"","sources":["../../src/study-ci/create-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAsB,MAAM,4BAA4B,CAAC;AAC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 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import type { ResolvedDeps } from "../program.js";
|
|
3
|
+
import { type CiPaths } from "./ci-run.js";
|
|
4
|
+
export declare function attachStudyRun(study: Command, deps: ResolvedDeps, paths: () => CiPaths): void;
|
|
5
|
+
//# sourceMappingURL=run-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-command.d.ts","sourceRoot":"","sources":["../../src/study-ci/run-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAA8B,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AA2BvE,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,OAAO,GAAG,IAAI,CAmF7F"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { bodyHelpLines } from "../core/body-help.js";
|
|
2
|
+
import { BodyValueError } from "../core/body-values.js";
|
|
3
|
+
import { renderError, renderResult } from "../core/output.js";
|
|
4
|
+
import { credentials } from "../core/run-operation.js";
|
|
5
|
+
import { resolveOutputMode } from "../render/mode.js";
|
|
6
|
+
import { CiRunError, EXIT, runStudy } from "./ci-run.js";
|
|
7
|
+
import { attachCreateBody, createOperation, NO_BODY_MESSAGE } from "./create-body.js";
|
|
8
|
+
import { StudyParamError } from "./params.js";
|
|
9
|
+
const collect = (value, previous) => [...(previous ?? []), value];
|
|
10
|
+
export function attachStudyRun(study, deps, paths) {
|
|
11
|
+
const create = createOperation();
|
|
12
|
+
const command = study
|
|
13
|
+
.command("run")
|
|
14
|
+
.summary("Create a study, launch it, wait until it has settled, and print it")
|
|
15
|
+
.description("Create a study, launch it, wait until its runs have ended and its grading has settled, and print it.\n\n" +
|
|
16
|
+
"The study is given as flags (every field of the create body is one), as a JSON file, or both: a flag wins " +
|
|
17
|
+
"over the same field of the file. Its tasks must be in the body (--task, or `tasks` in the file) or come " +
|
|
18
|
+
"from a pinned benchmark version. For a pass / fail answer in a pipeline, use `ora study ci run`.")
|
|
19
|
+
.option("--file <path>", 'the study\'s create body (JSON), or "-" for stdin')
|
|
20
|
+
.option("--param <name=value>", "fill a ${name} placeholder of the --file body (repeatable); a flag's value is taken as written", collect)
|
|
21
|
+
.option("--timeout <minutes>", "how long the run may take from launch", "60")
|
|
22
|
+
.option("--json", "print the study as JSON")
|
|
23
|
+
.option("--plain", "force plain non-visual output")
|
|
24
|
+
.option("--api-url <url>", "override the API base URL");
|
|
25
|
+
const body = attachCreateBody(command, create);
|
|
26
|
+
command.addHelpText("after", ["", ...bodyHelpLines(create)].join("\n"));
|
|
27
|
+
command.action(async (flags) => {
|
|
28
|
+
const mode = resolveOutputMode({ json: Boolean(flags.json), plain: Boolean(flags.plain) }, deps.env, deps.stdoutIsTty);
|
|
29
|
+
const usage = (message) => {
|
|
30
|
+
deps.errOut(renderError(new Error(message), { mode }));
|
|
31
|
+
process.exitCode = EXIT.error;
|
|
32
|
+
};
|
|
33
|
+
const timeoutMinutes = Number(flags.timeout);
|
|
34
|
+
if (!(timeoutMinutes > 0))
|
|
35
|
+
return usage("--timeout takes minutes (> 0)");
|
|
36
|
+
let studyBody;
|
|
37
|
+
try {
|
|
38
|
+
studyBody = body.read(flags);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
if (err instanceof BodyValueError || err instanceof StudyParamError)
|
|
42
|
+
return usage(err.message);
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
if (studyBody === null)
|
|
46
|
+
return usage(NO_BODY_MESSAGE);
|
|
47
|
+
if (flags.printBody) {
|
|
48
|
+
deps.out(JSON.stringify(studyBody, null, 2));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const creds = credentials(deps, flags.apiUrl, mode);
|
|
52
|
+
if (!creds) {
|
|
53
|
+
process.exitCode = EXIT.error;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const client = deps.makeClient(creds);
|
|
57
|
+
const where = paths();
|
|
58
|
+
try {
|
|
59
|
+
const run = await runStudy({ body: studyBody, timeoutMs: timeoutMinutes * 60_000, settlePollMs: 10_000 }, {
|
|
60
|
+
client,
|
|
61
|
+
paths: where,
|
|
62
|
+
now: deps.now,
|
|
63
|
+
sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
64
|
+
// Progress goes to stderr: stdout is the study, so it stays parseable under --json.
|
|
65
|
+
log: (line) => deps.errOut(`ora study run: ${line}`),
|
|
66
|
+
});
|
|
67
|
+
const detail = await client.call({
|
|
68
|
+
method: "get",
|
|
69
|
+
path: where.get.replace("{id}", encodeURIComponent(run.studyId)),
|
|
70
|
+
});
|
|
71
|
+
deps.out(renderResult(detail, { mode }));
|
|
72
|
+
if (run.settlement.state !== "settled") {
|
|
73
|
+
const owed = run.settlement.owed.join(", ") || "work";
|
|
74
|
+
deps.errOut(`ora study run: the time ran out before the study settled (it still owes ${owed}). It keeps running: study ${run.studyId}`);
|
|
75
|
+
process.exitCode = EXIT.undecided;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
const hint = err instanceof CiRunError && err.studyId ? ` (study ${err.studyId})` : "";
|
|
80
|
+
deps.errOut(err instanceof CiRunError ? `ora study run: ${err.message}${hint}` : creds.renderError(err, { mode }));
|
|
81
|
+
process.exitCode = EXIT.error;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=run-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-command.js","sourceRoot":"","sources":["../../src/study-ci/run-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,C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IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC;gBACtD,IAAI,CAAC,MAAM,CACT,2EAA2E,IAAI,8BAA8B,GAAG,CAAC,OAAO,EAAE,CAC3H,CAAC;gBACF,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;YACpC,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,GAAG,GAAG,YAAY,UAAU,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACvF,IAAI,CAAC,MAAM,CACT,GAAG,YAAY,UAAU,CAAC,CAAC,CAAC,kBAAkB,GAAG,CAAC,OAAO,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CACtG,CAAC;YACF,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC;QAChC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/watch.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { type SseEvent } from "./core/sse.js";
|
|
|
14
14
|
import type { OperationMeta } from "./generated/operations.js";
|
|
15
15
|
import type { ResolvedDeps } from "./program.js";
|
|
16
16
|
import type { OutputMode } from "./render/mode.js";
|
|
17
|
-
export declare function helpEpilog(meta: Pick<OperationMeta, "scope" | "help" | "bodyFields" | "secretFields">): string;
|
|
17
|
+
export declare function helpEpilog(meta: Pick<OperationMeta, "scope" | "help" | "bodyFields" | "bodyFlags" | "bodyShorthands" | "secretFields">): string;
|
|
18
18
|
/**
|
|
19
19
|
* Follow a create response's server-provided streamUrl (hypermedia — the
|
|
20
20
|
* client never constructs the URL). Absent streamUrl means the operation
|
package/dist/watch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAYjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKnD,wBAAgB,UAAU,CACxB,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,gBAAgB,GAAG,cAAc,CAAC,GAC3G,MAAM,CAoBR;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,OAAO,EACb,GAAG,EAAE;IACH,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC1C,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC,CAAC;IAC9D,IAAI,EAAE,UAAU,CAAC;CAClB,GACA,OAAO,CAAC,IAAI,CAAC,CAiCf;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM9C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,EAC/B,GAAG,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GACvF,OAAO,CAAC,IAAI,CAAC,CAqHf"}
|
package/dist/watch.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import chalk from "chalk";
|
|
13
13
|
import { renderResult } from "./core/output.js";
|
|
14
14
|
import { readSse } from "./core/sse.js";
|
|
15
|
+
import { bodyHelpLines } from "./core/body-help.js";
|
|
15
16
|
import { GLYPHS, accent, eventGlyph } from "./render/glyphs.js";
|
|
16
17
|
import { activityLabel, buildJourneyTree, drawJourneyTree, journeySummary, } from "./render/journey-graph.js";
|
|
17
18
|
import { LivePanel } from "./render/live-panel.js";
|
|
@@ -29,20 +30,11 @@ export function helpEpilog(meta) {
|
|
|
29
30
|
for (const bodyLine of meta.help.body.split("\n"))
|
|
30
31
|
lines.push(` ${bodyLine}`);
|
|
31
32
|
}
|
|
32
|
-
// The
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
lines.push("", "Body fields (* = required):");
|
|
38
|
-
const label = (f) => `${f.name}${f.required ? "*" : ""}`;
|
|
39
|
-
const width = Math.max(...meta.bodyFields.map((f) => label(f).length));
|
|
40
|
-
for (const f of meta.bodyFields) {
|
|
41
|
-
const type = f.enum?.length ? f.enum.join("|") : f.kind;
|
|
42
|
-
const desc = f.description ? ` — ${f.description}` : "";
|
|
43
|
-
lines.push(` ${label(f).padEnd(width)} ${type}${desc}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
33
|
+
// The same call with flags instead of a file (the generator's, from the body's required fields).
|
|
34
|
+
if (meta.help.flags)
|
|
35
|
+
lines.push("", " with flags instead of a file:", ` ${meta.help.flags}`);
|
|
36
|
+
// The request body: each field as the flag it is, and the document's short forms (core/body-help.ts).
|
|
37
|
+
lines.push(...bodyHelpLines(meta));
|
|
46
38
|
// An answer the document marks as holding a secret: which field it is, so it can be routed straight to where it
|
|
47
39
|
// belongs (`--json` piped into a secret store), never printed or logged on the way.
|
|
48
40
|
if (meta.secretFields?.length) {
|