htchry 0.0.1 → 0.0.3
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 +26 -2
- package/dist/cli.js +489 -152
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,8 +16,32 @@ The package also installs `htchry` as an alias for `hatchery`.
|
|
|
16
16
|
## Start a task
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
|
-
hatchery init my-task
|
|
19
|
+
hatchery init my-task
|
|
20
20
|
cd my-task
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
`init` creates a task with instructions, an environment, a reference solution, and a verifier.
|
|
24
|
+
|
|
25
|
+
## Run locally or on Hatchery
|
|
26
|
+
|
|
27
|
+
`hatchery run --path . --agent oracle` runs the task locally. Add `--remote` to push the task and run that exact revision on Hatchery using your selected project:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
hatchery run --path . --agent oracle --remote --project your-project-id
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The command waits for the remote job. The job continues if you close the terminal. Use named project secrets with `--secret NAME` when the agent needs credentials.
|
|
34
|
+
|
|
35
|
+
## Pull project tasks
|
|
36
|
+
|
|
37
|
+
Download every task's latest revision into an empty working directory:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
mkdir my-benchmark
|
|
41
|
+
cd my-benchmark
|
|
42
|
+
hatchery pull --project your-project-id
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Each task lands under its full package name, such as `acme/hello`. Pull one task by name or id with `hatchery pull acme/hello`. The command downloads task sources only and refuses to merge with or overwrite an existing task directory.
|
|
46
|
+
|
|
47
|
+
Pushing and pulling tasks requires Git. Local `run`, `check`, and `regrade` commands require the Python bridge and the tools selected by the task environment. Hosted and remote commands require network access and the credentials described by `hatchery <command> --help`.
|
package/dist/cli.js
CHANGED
|
@@ -14131,9 +14131,17 @@ var parseCommand = (spec, argv) => {
|
|
|
14131
14131
|
const ordered = [];
|
|
14132
14132
|
let rest = false;
|
|
14133
14133
|
for (let index = 0;index < argv.length; index += 1) {
|
|
14134
|
-
const
|
|
14135
|
-
if (
|
|
14134
|
+
const raw = argv[index];
|
|
14135
|
+
if (raw === undefined)
|
|
14136
14136
|
continue;
|
|
14137
|
+
let argument = raw;
|
|
14138
|
+
if (!rest && /^-[^-]$/.test(raw)) {
|
|
14139
|
+
const short = raw.slice(1);
|
|
14140
|
+
const name = spec.shortOptions?.[short];
|
|
14141
|
+
if (name === undefined)
|
|
14142
|
+
throw new UsageError(`unknown option -${short}`, spec.name);
|
|
14143
|
+
argument = `--${name}`;
|
|
14144
|
+
}
|
|
14137
14145
|
if (rest || !argument.startsWith("--")) {
|
|
14138
14146
|
positional.push(argument);
|
|
14139
14147
|
continue;
|
|
@@ -15025,6 +15033,12 @@ var runBridge = async (command, request, options) => {
|
|
|
15025
15033
|
child.stdin.end(JSON.stringify(request));
|
|
15026
15034
|
});
|
|
15027
15035
|
};
|
|
15036
|
+
async function filterHarborPackageNames(names, taskNames, excludeTaskNames, options) {
|
|
15037
|
+
const response = object(await runBridge("filter-tasks", { names, task_names: taskNames, exclude_task_names: excludeTaskNames }, options), "Harbor task filter response");
|
|
15038
|
+
if (response.harborVersion !== HARBOR_VERSION || !Array.isArray(response.names) || response.names.some((name) => typeof name !== "string"))
|
|
15039
|
+
throw new Error("Harbor task filter response is invalid");
|
|
15040
|
+
return response.names;
|
|
15041
|
+
}
|
|
15028
15042
|
var object = (value, label) => {
|
|
15029
15043
|
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
15030
15044
|
throw new Error(`${label} must be a JSON object`);
|
|
@@ -15355,7 +15369,7 @@ function configuredTaskBinding(binding, parsed) {
|
|
|
15355
15369
|
|
|
15356
15370
|
// apps/cli/src/harbor-runtime.ts
|
|
15357
15371
|
import { rmSync as rmSync2 } from "fs";
|
|
15358
|
-
import { chmod as chmod4, lstat as lstat7, mkdtemp as mkdtemp4, readdir as readdir6, rename as rename4, rm as rm5, writeFile as writeFile6 } from "fs/promises";
|
|
15372
|
+
import { chmod as chmod4, lstat as lstat7, mkdtemp as mkdtemp4, readFile as readFile14, readdir as readdir6, rename as rename4, rm as rm5, writeFile as writeFile6 } from "fs/promises";
|
|
15359
15373
|
import { tmpdir as tmpdir3 } from "os";
|
|
15360
15374
|
import { join as join20, resolve as resolve15 } from "path";
|
|
15361
15375
|
|
|
@@ -15410,8 +15424,11 @@ import { dirname as dirname5, join as join10 } from "path";
|
|
|
15410
15424
|
|
|
15411
15425
|
// apps/cli/src/artifacts-git.ts
|
|
15412
15426
|
import { chmod as chmod2, mkdir as mkdir3, mkdtemp, rm } from "fs/promises";
|
|
15427
|
+
import { createWriteStream } from "fs";
|
|
15413
15428
|
import { tmpdir } from "os";
|
|
15414
15429
|
import { dirname as dirname4, join as join5 } from "path";
|
|
15430
|
+
import { Readable } from "stream";
|
|
15431
|
+
import { pipeline } from "stream/promises";
|
|
15415
15432
|
var COMMIT_IDENTITY = {
|
|
15416
15433
|
GIT_AUTHOR_NAME: "Hatchery",
|
|
15417
15434
|
GIT_AUTHOR_EMAIL: "tasks@hatchery.build",
|
|
@@ -15532,8 +15549,18 @@ var fetchRevision = async (access, tag, commit, target, signal) => {
|
|
|
15532
15549
|
const destination = join5(target, ...entry.path.split("/"));
|
|
15533
15550
|
await mkdir3(dirname4(destination), { recursive: true });
|
|
15534
15551
|
const child = Bun.spawn(["git", "cat-file", "blob", entry.oid], { env: { ...process.env, GIT_DIR: gitDir }, stdout: "pipe", stderr: "ignore", ...options });
|
|
15535
|
-
|
|
15536
|
-
|
|
15552
|
+
let code;
|
|
15553
|
+
try {
|
|
15554
|
+
const [, exited] = await Promise.all([pipeline(Readable.fromWeb(child.stdout), createWriteStream(destination, { flags: "wx" })), child.exited]);
|
|
15555
|
+
code = exited;
|
|
15556
|
+
} catch (cause) {
|
|
15557
|
+
child.kill();
|
|
15558
|
+
await child.exited.catch(() => {
|
|
15559
|
+
return;
|
|
15560
|
+
});
|
|
15561
|
+
throw cause;
|
|
15562
|
+
}
|
|
15563
|
+
if (code !== 0)
|
|
15537
15564
|
throw new Error(`git cat-file could not read ${entry.path}.`);
|
|
15538
15565
|
await chmod2(destination, entry.mode === "100755" ? 493 : 420);
|
|
15539
15566
|
}
|
|
@@ -16427,12 +16454,12 @@ var materializeTask = async (context, project, root, id, revision, expectedDiges
|
|
|
16427
16454
|
throw new Error(`${label} names ${file.path} as ${file.digest} with ${file.size} bytes, and the repository returned ${actual} with ${size} bytes.`);
|
|
16428
16455
|
bytes += size;
|
|
16429
16456
|
}
|
|
16430
|
-
return { source: { kind: "task", id, revision, digest: stored.digest }, directory, files: files.length, bytes };
|
|
16457
|
+
return { source: { kind: "task", id, revision, digest: stored.digest }, directory, name, files: files.length, bytes };
|
|
16431
16458
|
};
|
|
16432
16459
|
var materializeRevision = async (context, project, kind, id, revision, root, expectedDigest) => {
|
|
16433
16460
|
if (kind === "task") {
|
|
16434
16461
|
const task = await materializeTask(context, project, root, id, revision, expectedDigest);
|
|
16435
|
-
return { source: task.source, taskPaths: [task.directory], files: task.files, bytes: task.bytes };
|
|
16462
|
+
return { source: task.source, taskPaths: [task.directory], taskNames: [task.name], files: task.files, bytes: task.bytes };
|
|
16436
16463
|
}
|
|
16437
16464
|
const stored = await storedRevision(context, project, "dataset", id, revision, expectedDigest);
|
|
16438
16465
|
const label = `dataset ${id} revision ${revision}`;
|
|
@@ -16440,6 +16467,7 @@ var materializeRevision = async (context, project, kind, id, revision, root, exp
|
|
|
16440
16467
|
if (!Array.isArray(pinned) || pinned.length === 0)
|
|
16441
16468
|
throw new Error(`${label} pins no Harbor task revisions.`);
|
|
16442
16469
|
const taskPaths = [];
|
|
16470
|
+
const taskNames = [];
|
|
16443
16471
|
let files = 0;
|
|
16444
16472
|
let bytes = 0;
|
|
16445
16473
|
for (const value of pinned) {
|
|
@@ -16452,10 +16480,11 @@ var materializeRevision = async (context, project, kind, id, revision, root, exp
|
|
|
16452
16480
|
throw cause;
|
|
16453
16481
|
});
|
|
16454
16482
|
taskPaths.push(task.directory);
|
|
16483
|
+
taskNames.push(task.name);
|
|
16455
16484
|
files += task.files;
|
|
16456
16485
|
bytes += task.bytes;
|
|
16457
16486
|
}
|
|
16458
|
-
return { source: { kind: "dataset", id, revision, digest: stored.digest }, taskPaths, files, bytes };
|
|
16487
|
+
return { source: { kind: "dataset", id, revision, digest: stored.digest }, taskPaths, taskNames, files, bytes };
|
|
16459
16488
|
};
|
|
16460
16489
|
|
|
16461
16490
|
// apps/cli/src/harbor-process.ts
|
|
@@ -51875,6 +51904,9 @@ var harborRunOptions = {
|
|
|
51875
51904
|
dataset: "value",
|
|
51876
51905
|
revision: "value",
|
|
51877
51906
|
"revision-digest": "value",
|
|
51907
|
+
"include-task-name": "list",
|
|
51908
|
+
"exclude-task-name": "list",
|
|
51909
|
+
"task-names-file": "value",
|
|
51878
51910
|
env: "value",
|
|
51879
51911
|
agent: "value",
|
|
51880
51912
|
model: "value",
|
|
@@ -51885,6 +51917,8 @@ var harborRunOptions = {
|
|
|
51885
51917
|
"idempotency-key": "value",
|
|
51886
51918
|
wait: "flag",
|
|
51887
51919
|
"wait-poll-ms": "value",
|
|
51920
|
+
remote: "flag",
|
|
51921
|
+
secret: "list",
|
|
51888
51922
|
python: "value",
|
|
51889
51923
|
"bridge-module": "value",
|
|
51890
51924
|
"bridge-output-bytes": "value",
|
|
@@ -51987,7 +52021,7 @@ var storedTasks = async (context, parsed) => {
|
|
|
51987
52021
|
try {
|
|
51988
52022
|
const stored = await materializeRevision(context, project, kind, id, revision, root, expectedDigest);
|
|
51989
52023
|
context.io.err(`${selector === "latest" ? "Resolved latest to" : "Materialized"} ${kind} ${id} revision ${stored.source.revision} ${stored.source.digest} from project ${project}: ${stored.taskPaths.length} tasks, ${stored.files} files, ${stored.bytes} bytes verified`);
|
|
51990
|
-
return { source: stored.source, taskPaths: stored.taskPaths, close };
|
|
52024
|
+
return { source: stored.source, taskPaths: stored.taskPaths, taskNames: stored.taskNames, close };
|
|
51991
52025
|
} catch (cause) {
|
|
51992
52026
|
await close();
|
|
51993
52027
|
throw cause;
|
|
@@ -51998,6 +52032,14 @@ var HARBOR_ENVIRONMENT_ALIASES = Object.freeze({
|
|
|
51998
52032
|
"managed-sandbox": "hatchery_harbor.sandbox:ManagedSandboxEnvironment"
|
|
51999
52033
|
});
|
|
52000
52034
|
var nonempty = (value) => Array.isArray(value) ? value.length > 0 : value !== undefined && value !== null;
|
|
52035
|
+
var taskFilters = async (context, parsed) => {
|
|
52036
|
+
const included = [...parsed.lists["include-task-name"] ?? []];
|
|
52037
|
+
if (parsed.values["task-names-file"] !== undefined) {
|
|
52038
|
+
const contents = await readFile14(resolve15(context.cwd, parsed.values["task-names-file"]), "utf8");
|
|
52039
|
+
included.push(...contents.split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== ""));
|
|
52040
|
+
}
|
|
52041
|
+
return { included, excluded: [...parsed.lists["exclude-task-name"] ?? []] };
|
|
52042
|
+
};
|
|
52001
52043
|
var harborJobConfig = async (context, parsed, stored) => {
|
|
52002
52044
|
if (parsed.values.path && parsed.values.config)
|
|
52003
52045
|
throw new UsageError("Choose --path or --config", "run");
|
|
@@ -52028,6 +52070,14 @@ var harborJobConfig = async (context, parsed, stored) => {
|
|
|
52028
52070
|
config = { tasks: taskPaths.map((path) => ({ path })) };
|
|
52029
52071
|
} else
|
|
52030
52072
|
throw new UsageError("run needs --path Harbor task, --task or --dataset with --revision, or --config Harbor job.json", "run");
|
|
52073
|
+
const filters = await taskFilters(context, parsed);
|
|
52074
|
+
if (filters.included.length > 0 || filters.excluded.length > 0) {
|
|
52075
|
+
if (!stored || stored.source.kind !== "dataset")
|
|
52076
|
+
throw new UsageError("Task name filters require a stored --dataset revision", "run");
|
|
52077
|
+
const names = stored.taskNames;
|
|
52078
|
+
const selected = new Set(await filterHarborPackageNames(names, filters.included, filters.excluded, harborProcessOptions(context, parsed)));
|
|
52079
|
+
config.tasks = stored.taskPaths.filter((_, index) => selected.has(names[index])).map((path) => ({ path }));
|
|
52080
|
+
}
|
|
52031
52081
|
if (parsed.values.agent !== undefined || parsed.values.model !== undefined) {
|
|
52032
52082
|
if (!parsed.values.agent)
|
|
52033
52083
|
throw new UsageError("--model requires --agent", "run");
|
|
@@ -52435,18 +52485,404 @@ var pushCommand = {
|
|
|
52435
52485
|
}
|
|
52436
52486
|
};
|
|
52437
52487
|
|
|
52488
|
+
// apps/cli/src/commands/pull.ts
|
|
52489
|
+
import { cp as cp3, link as link2, lstat as lstat8, mkdir as mkdir8, mkdtemp as mkdtemp6, readdir as readdir7, realpath as realpath5, rename as rename5, rm as rm7, writeFile as writeFile7 } from "fs/promises";
|
|
52490
|
+
import { basename as basename7, dirname as dirname10, join as join22, relative as relative8, resolve as resolve18 } from "path";
|
|
52491
|
+
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
52492
|
+
var missing3 = async (path) => {
|
|
52493
|
+
try {
|
|
52494
|
+
await lstat8(path);
|
|
52495
|
+
return false;
|
|
52496
|
+
} catch (cause) {
|
|
52497
|
+
if (cause instanceof Error && "code" in cause && cause.code === "ENOENT")
|
|
52498
|
+
return true;
|
|
52499
|
+
throw cause;
|
|
52500
|
+
}
|
|
52501
|
+
};
|
|
52502
|
+
var taskHeads = async (context, project) => {
|
|
52503
|
+
const tasks = [];
|
|
52504
|
+
let cursor;
|
|
52505
|
+
const cursors = new Set;
|
|
52506
|
+
do {
|
|
52507
|
+
const response = await context.client.platformResponse("GET", `/v1/projects/${encodeURIComponent(project)}/tasks${cursor === undefined ? "" : `?cursor=${encodeURIComponent(cursor)}`}`, { accept: "application/json", ...context.signal ? { signal: context.signal } : {} });
|
|
52508
|
+
if (!response.ok)
|
|
52509
|
+
throw new Error(`Listing tasks returned HTTP ${response.status}: ${(await response.text()).slice(0, 500)}`);
|
|
52510
|
+
const page = await response.json();
|
|
52511
|
+
if (!Array.isArray(page.items))
|
|
52512
|
+
throw new Error(`Project ${project} returned an invalid task list.`);
|
|
52513
|
+
for (const value of page.items) {
|
|
52514
|
+
if (!value || typeof value !== "object")
|
|
52515
|
+
throw new Error(`Project ${project} returned an invalid task.`);
|
|
52516
|
+
const task = value;
|
|
52517
|
+
if (typeof task.id !== "string" || typeof task.name !== "string" || !isHarborPackageName(task.name) || !Number.isSafeInteger(task.latestRevision) || Number(task.latestRevision) < 1)
|
|
52518
|
+
throw new Error(`Project ${project} returned an invalid task.`);
|
|
52519
|
+
tasks.push(task);
|
|
52520
|
+
}
|
|
52521
|
+
if (page.next === undefined || page.next === null || page.next === "")
|
|
52522
|
+
cursor = undefined;
|
|
52523
|
+
else if (typeof page.next === "string" || typeof page.next === "number") {
|
|
52524
|
+
cursor = String(page.next);
|
|
52525
|
+
if (cursors.has(cursor))
|
|
52526
|
+
throw new Error(`Project ${project} repeated task-list cursor ${cursor}.`);
|
|
52527
|
+
cursors.add(cursor);
|
|
52528
|
+
} else
|
|
52529
|
+
throw new Error(`Project ${project} returned an invalid task-list cursor.`);
|
|
52530
|
+
} while (cursor !== undefined);
|
|
52531
|
+
return tasks;
|
|
52532
|
+
};
|
|
52533
|
+
var selectedTask = (tasks, selector) => {
|
|
52534
|
+
const exact = tasks.filter((task) => task.id === selector || task.name === selector);
|
|
52535
|
+
if (exact.length === 1)
|
|
52536
|
+
return exact[0];
|
|
52537
|
+
const short = tasks.filter((task) => task.name.split("/")[1] === selector);
|
|
52538
|
+
if (short.length === 1)
|
|
52539
|
+
return short[0];
|
|
52540
|
+
if (short.length > 1)
|
|
52541
|
+
throw new Error(`${selector} matches more than one task: ${short.map((task) => task.name).join(", ")}. Use the package name or task id.`);
|
|
52542
|
+
throw new Error(`Project stores no task ${selector}.`);
|
|
52543
|
+
};
|
|
52544
|
+
var configProject = async (path) => {
|
|
52545
|
+
if (await missing3(path))
|
|
52546
|
+
return;
|
|
52547
|
+
const loaded = await import(`${pathToFileURL2(path).href}?hatchery=${Date.now()}`);
|
|
52548
|
+
const project = loaded.default?.project ?? loaded.project;
|
|
52549
|
+
return typeof project === "string" ? project : null;
|
|
52550
|
+
};
|
|
52551
|
+
var outputPath = async (requested) => {
|
|
52552
|
+
const exists = !await missing3(requested);
|
|
52553
|
+
if (exists && (await lstat8(requested)).isSymbolicLink())
|
|
52554
|
+
throw new Error(`Pull output ${requested} is a symbolic link.`);
|
|
52555
|
+
const suffix = [];
|
|
52556
|
+
let anchor = requested;
|
|
52557
|
+
while (await missing3(anchor)) {
|
|
52558
|
+
suffix.unshift(basename7(anchor));
|
|
52559
|
+
anchor = dirname10(anchor);
|
|
52560
|
+
}
|
|
52561
|
+
const canonicalAnchor = await realpath5(anchor);
|
|
52562
|
+
if (!(await lstat8(canonicalAnchor)).isDirectory())
|
|
52563
|
+
throw new Error(`Pull output parent ${anchor} is not a directory.`);
|
|
52564
|
+
const output = join22(canonicalAnchor, ...suffix);
|
|
52565
|
+
if (exists && !(await lstat8(output)).isDirectory())
|
|
52566
|
+
throw new Error(`Pull output ${output} is not a directory.`);
|
|
52567
|
+
return { output, exists };
|
|
52568
|
+
};
|
|
52569
|
+
var pullCommand = {
|
|
52570
|
+
spec: { name: "pull", operands: ["task?"], options: { revision: "value", output: "value" }, summary: "Pull verified task revisions from a project", usage: "hatchery pull [task] [--revision n|latest] [--output directory] [--project id]", namespaced: false },
|
|
52571
|
+
run: async (context, parsed) => {
|
|
52572
|
+
const selector = parsed.operands.task;
|
|
52573
|
+
if (!selector && parsed.values.revision !== undefined)
|
|
52574
|
+
throw new UsageError("--revision requires one selected task", "pull");
|
|
52575
|
+
const project = await projectFrom(context, parsed);
|
|
52576
|
+
const requestedOutput = resolve18(context.cwd, parsed.values.output ?? ".");
|
|
52577
|
+
const { output, exists: outputExists } = await outputPath(requestedOutput);
|
|
52578
|
+
const configPath = join22(output, "hatchery.config.ts");
|
|
52579
|
+
const configured = outputExists ? await configProject(configPath) : undefined;
|
|
52580
|
+
if (configured !== undefined && configured !== project)
|
|
52581
|
+
throw new Error(configured === null ? `${configPath} does not select a project.` : `${configPath} selects project ${configured}, not ${project}.`);
|
|
52582
|
+
const listed = await taskHeads(context, project);
|
|
52583
|
+
const chosen = selector ? [selectedTask(listed, selector)] : listed;
|
|
52584
|
+
const selectorRevision = parsed.values.revision ?? "latest";
|
|
52585
|
+
if (selectorRevision !== "latest" && (!/^\d+$/.test(selectorRevision) || Number(selectorRevision) < 1 || !Number.isSafeInteger(Number(selectorRevision))))
|
|
52586
|
+
throw new UsageError("--revision must be a positive integer or latest", "pull");
|
|
52587
|
+
const plans = chosen.map((task) => ({ ...task, revision: selectorRevision === "latest" || !selector ? task.latestRevision : Number(selectorRevision), destination: join22(output, ...task.name.split("/")) }));
|
|
52588
|
+
for (const plan of plans) {
|
|
52589
|
+
if (!await missing3(plan.destination))
|
|
52590
|
+
throw new Error(`Refusing to overwrite existing task destination ${plan.destination}.`);
|
|
52591
|
+
const organization = dirname10(plan.destination);
|
|
52592
|
+
if (!await missing3(organization) && !(await lstat8(organization)).isDirectory())
|
|
52593
|
+
throw new Error(`Task parent ${organization} is not a directory.`);
|
|
52594
|
+
}
|
|
52595
|
+
await mkdir8(dirname10(output), { recursive: true });
|
|
52596
|
+
const staging = await mkdtemp6(join22(outputExists ? output : dirname10(output), ".hatchery-pull-"));
|
|
52597
|
+
const stagedOutput = join22(staging, "checkout");
|
|
52598
|
+
const pulled = [];
|
|
52599
|
+
const published = [];
|
|
52600
|
+
try {
|
|
52601
|
+
await mkdir8(stagedOutput);
|
|
52602
|
+
for (const plan of plans) {
|
|
52603
|
+
const privateRoot = join22(staging, `task-${pulled.length}`);
|
|
52604
|
+
await mkdir8(privateRoot);
|
|
52605
|
+
const materialized = await materializeRevision(context, project, "task", plan.id, plan.revision, privateRoot);
|
|
52606
|
+
if (materialized.taskNames[0] !== plan.name)
|
|
52607
|
+
throw new Error(`Task ${plan.id} is listed as ${plan.name}, and revision ${plan.revision} is named ${String(materialized.taskNames[0])}.`);
|
|
52608
|
+
const destination = join22(stagedOutput, ...plan.name.split("/"));
|
|
52609
|
+
await mkdir8(dirname10(destination), { recursive: true });
|
|
52610
|
+
await rename5(materialized.taskPaths[0], destination);
|
|
52611
|
+
pulled.push({ id: plan.id, name: plan.name, revision: materialized.source.revision, digest: materialized.source.digest, path: plan.destination });
|
|
52612
|
+
}
|
|
52613
|
+
if (configured === undefined)
|
|
52614
|
+
await writeFile7(join22(stagedOutput, "hatchery.config.ts"), `export default ${JSON.stringify({ project }, null, 2)}
|
|
52615
|
+
`, { flag: "wx" });
|
|
52616
|
+
if (!outputExists) {
|
|
52617
|
+
if (!await missing3(output))
|
|
52618
|
+
throw new Error(`Pull output ${output} appeared while tasks were downloading.`);
|
|
52619
|
+
await rename5(stagedOutput, output);
|
|
52620
|
+
} else {
|
|
52621
|
+
for (const plan of plans) {
|
|
52622
|
+
if (!await missing3(plan.destination))
|
|
52623
|
+
throw new Error(`Task destination ${plan.destination} appeared while tasks were downloading.`);
|
|
52624
|
+
const parent = dirname10(plan.destination);
|
|
52625
|
+
if (await missing3(parent))
|
|
52626
|
+
await mkdir8(parent);
|
|
52627
|
+
else if ((await lstat8(parent)).isSymbolicLink() || !(await lstat8(parent)).isDirectory())
|
|
52628
|
+
throw new Error(`Task parent ${parent} changed while tasks were downloading.`);
|
|
52629
|
+
await mkdir8(plan.destination);
|
|
52630
|
+
published.push(plan.destination);
|
|
52631
|
+
const source = join22(stagedOutput, ...plan.name.split("/"));
|
|
52632
|
+
for (const entry of await readdir7(source))
|
|
52633
|
+
await cp3(join22(source, entry), join22(plan.destination, entry), { recursive: true, force: false, errorOnExist: true });
|
|
52634
|
+
}
|
|
52635
|
+
if (configured === undefined) {
|
|
52636
|
+
if (!await missing3(configPath))
|
|
52637
|
+
throw new Error(`${configPath} appeared while tasks were downloading.`);
|
|
52638
|
+
await link2(join22(stagedOutput, "hatchery.config.ts"), configPath);
|
|
52639
|
+
}
|
|
52640
|
+
}
|
|
52641
|
+
} catch (cause) {
|
|
52642
|
+
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
52643
|
+
if (published.length > 0)
|
|
52644
|
+
throw new Error(`${detail} Already published task directories were preserved because they may contain concurrent local edits: ${published.join(", ")}.`);
|
|
52645
|
+
throw cause;
|
|
52646
|
+
} finally {
|
|
52647
|
+
await rm7(staging, { recursive: true, force: true });
|
|
52648
|
+
}
|
|
52649
|
+
const answer = { project, output, tasks: pulled };
|
|
52650
|
+
if (context.json)
|
|
52651
|
+
context.io.out(JSON.stringify(answer));
|
|
52652
|
+
else if (answer.tasks.length === 0)
|
|
52653
|
+
context.io.out("No tasks.");
|
|
52654
|
+
else
|
|
52655
|
+
for (const task of answer.tasks)
|
|
52656
|
+
context.io.out(`${task.name} ${task.id} revision ${task.revision} ${task.digest} ${relative8(context.cwd, task.path) || "."}`);
|
|
52657
|
+
}
|
|
52658
|
+
};
|
|
52659
|
+
|
|
52438
52660
|
// apps/cli/src/commands/run.ts
|
|
52661
|
+
import { resolve as resolve20 } from "path";
|
|
52662
|
+
import { lstat as lstat9 } from "fs/promises";
|
|
52663
|
+
|
|
52664
|
+
// apps/cli/src/commands/hosted.ts
|
|
52665
|
+
import { readFile as readFile15 } from "fs/promises";
|
|
52666
|
+
import { resolve as resolve19 } from "path";
|
|
52667
|
+
var DEFAULT_HOSTED_POLL_MS = 5000;
|
|
52668
|
+
var TERMINAL = new Set(["succeeded", "failed", "cancelled"]);
|
|
52669
|
+
var positive5 = (raw, what) => {
|
|
52670
|
+
const value = integerFrom(raw, what);
|
|
52671
|
+
if (value === 0)
|
|
52672
|
+
throw new UsageError(`${what} must be positive`, "hosted");
|
|
52673
|
+
return value;
|
|
52674
|
+
};
|
|
52675
|
+
var summary = (job) => [
|
|
52676
|
+
`hosted job ${job.id}: ${job.status}`,
|
|
52677
|
+
job.source ? `source: ${job.source.kind} ${job.source.id} r${job.source.revision}${job.source.digest ? ` ${job.source.digest}` : ""}` : "source: Harbor API JobConfig",
|
|
52678
|
+
...job.agent ? [`agent: ${job.agent}${job.model ? ` (${job.model})` : ""}`] : [],
|
|
52679
|
+
...job.task_names?.length ? [`include tasks: ${job.task_names.join(", ")}`] : [],
|
|
52680
|
+
...job.exclude_task_names?.length ? [`exclude tasks: ${job.exclude_task_names.join(", ")}`] : [],
|
|
52681
|
+
...job.exitCode === undefined ? [] : [`exit code: ${job.exitCode}`],
|
|
52682
|
+
...job.harborJobId ? [`harbor job: ${job.harborJobId}`] : [],
|
|
52683
|
+
...job.failure === undefined ? [] : [`failure: ${typeof job.failure === "string" ? job.failure : JSON.stringify(job.failure)}`]
|
|
52684
|
+
].join(`
|
|
52685
|
+
`);
|
|
52686
|
+
var show = (context, job) => context.io.out(context.json ? JSON.stringify({ job }) : summary(job));
|
|
52687
|
+
var sleep5 = (ms, signal) => new Promise((resolve, reject) => {
|
|
52688
|
+
if (signal?.aborted)
|
|
52689
|
+
return reject(signal.reason);
|
|
52690
|
+
const timer = setTimeout(() => {
|
|
52691
|
+
signal?.removeEventListener("abort", abort);
|
|
52692
|
+
resolve();
|
|
52693
|
+
}, ms);
|
|
52694
|
+
const abort = () => {
|
|
52695
|
+
clearTimeout(timer);
|
|
52696
|
+
reject(signal?.reason);
|
|
52697
|
+
};
|
|
52698
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
52699
|
+
});
|
|
52700
|
+
var hostedCommand = {
|
|
52701
|
+
spec: {
|
|
52702
|
+
name: "hosted",
|
|
52703
|
+
operands: ["action", "id?"],
|
|
52704
|
+
options: { task: "value", dataset: "value", revision: "value", agent: "value", model: "value", "n-attempts": "value", concurrency: "value", "include-task-name": "list", "exclude-task-name": "list", "task-names-file": "value", secret: "list", config: "value", wait: "flag", "poll-ms": "value" },
|
|
52705
|
+
shortOptions: { i: "include-task-name", x: "exclude-task-name" },
|
|
52706
|
+
summary: "Start, read, and cancel hosted Harbor jobs",
|
|
52707
|
+
usage: `hatchery hosted start (--task id | --dataset id) --revision n [-i glob | --include-task-name glob ...] [-x glob | --exclude-task-name glob ...] [--task-names-file path] [--agent a] [--model m] [--n-attempts n] [--concurrency n] [--secret NAME ...] [--config job.json] [--wait] [--poll-ms n, default ${DEFAULT_HOSTED_POLL_MS}] [--project id] [--json]
|
|
52708
|
+
hatchery hosted status <id> [--project id] [--json]
|
|
52709
|
+
hatchery hosted cancel <id> [--project id] [--json]`,
|
|
52710
|
+
namespaced: false
|
|
52711
|
+
},
|
|
52712
|
+
run: async (context, parsed) => {
|
|
52713
|
+
const action = parsed.operands.action;
|
|
52714
|
+
if (action !== "start" && action !== "status" && action !== "cancel")
|
|
52715
|
+
throw new UsageError("hosted accepts start, status, or cancel", "hosted");
|
|
52716
|
+
const signal = context.signal ? { signal: context.signal } : {};
|
|
52717
|
+
const id = parsed.operands.id;
|
|
52718
|
+
if (action !== "start") {
|
|
52719
|
+
if (!id)
|
|
52720
|
+
throw new UsageError(`hosted ${action} needs <id>`, "hosted");
|
|
52721
|
+
const path = `/v1/projects/${encodeURIComponent(await projectFrom(context, parsed))}/hosted-jobs/${encodeURIComponent(id)}`;
|
|
52722
|
+
if (action === "cancel") {
|
|
52723
|
+
const body = await context.client.platformJson("POST", `${path}/cancel`, signal);
|
|
52724
|
+
context.io.out(context.json ? JSON.stringify(body ?? { id, cancelRequested: true }) : `cancel requested for hosted job ${id}`);
|
|
52725
|
+
return;
|
|
52726
|
+
}
|
|
52727
|
+
const read = await context.client.platformJson("GET", path, signal);
|
|
52728
|
+
if (!read?.job)
|
|
52729
|
+
throw new Error("the service returned no hosted job");
|
|
52730
|
+
show(context, read.job);
|
|
52731
|
+
return;
|
|
52732
|
+
}
|
|
52733
|
+
if (id)
|
|
52734
|
+
throw new UsageError("hosted start takes no operand", "hosted");
|
|
52735
|
+
const { task, dataset, revision, agent, model, config } = parsed.values;
|
|
52736
|
+
if (task === undefined === (dataset === undefined))
|
|
52737
|
+
throw new UsageError("hosted start needs exactly one of --task or --dataset", "hosted");
|
|
52738
|
+
if (revision === undefined)
|
|
52739
|
+
throw new UsageError("hosted start needs --revision n", "hosted");
|
|
52740
|
+
const pollMs = parsed.values["poll-ms"] === undefined ? DEFAULT_HOSTED_POLL_MS : positive5(parsed.values["poll-ms"], "--poll-ms");
|
|
52741
|
+
const attempts = parsed.values["n-attempts"] === undefined ? undefined : positive5(parsed.values["n-attempts"], "--n-attempts");
|
|
52742
|
+
const concurrency = parsed.values.concurrency === undefined ? undefined : positive5(parsed.values.concurrency, "--concurrency");
|
|
52743
|
+
const secrets = parsed.lists.secret ?? [];
|
|
52744
|
+
const taskNames = [...parsed.lists["include-task-name"] ?? []];
|
|
52745
|
+
if (parsed.values["task-names-file"] !== undefined) {
|
|
52746
|
+
const names = await readFile15(resolve19(context.cwd, parsed.values["task-names-file"]), "utf8");
|
|
52747
|
+
taskNames.push(...names.split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== ""));
|
|
52748
|
+
}
|
|
52749
|
+
const excludeTaskNames = [...parsed.lists["exclude-task-name"] ?? []];
|
|
52750
|
+
if (task !== undefined && (taskNames.length > 0 || excludeTaskNames.length > 0))
|
|
52751
|
+
throw new UsageError("Task name filters require --dataset", "hosted");
|
|
52752
|
+
const body = {
|
|
52753
|
+
source: { kind: task === undefined ? "dataset" : "task", id: task ?? dataset, revision: positive5(revision, "--revision") },
|
|
52754
|
+
...agent ? { agent } : {},
|
|
52755
|
+
...model ? { model } : {},
|
|
52756
|
+
...attempts === undefined ? {} : { attempts },
|
|
52757
|
+
...concurrency === undefined ? {} : { concurrency },
|
|
52758
|
+
...secrets.length ? { secrets } : {},
|
|
52759
|
+
...taskNames.length ? { task_names: taskNames } : {},
|
|
52760
|
+
...excludeTaskNames.length ? { exclude_task_names: excludeTaskNames } : {},
|
|
52761
|
+
...config ? { config: await jsonFile(context.cwd, config) } : {}
|
|
52762
|
+
};
|
|
52763
|
+
const base = `/v1/projects/${encodeURIComponent(await projectFrom(context, parsed))}/hosted-jobs`;
|
|
52764
|
+
const created = await context.client.platformJson("POST", base, { body, headers: { "Hatchery-Agent": "hatchery-cli" }, ...signal });
|
|
52765
|
+
if (!created?.job)
|
|
52766
|
+
throw new Error("hosted job creation returned no job");
|
|
52767
|
+
let job = created.job;
|
|
52768
|
+
if (!parsed.flags.has("wait")) {
|
|
52769
|
+
show(context, job);
|
|
52770
|
+
return;
|
|
52771
|
+
}
|
|
52772
|
+
context.io.err(`hatchery: waiting for hosted job ${job.id}, reading its status every ${pollMs} ms`);
|
|
52773
|
+
while (!TERMINAL.has(job.status)) {
|
|
52774
|
+
await sleep5(pollMs, context.signal);
|
|
52775
|
+
const read = await context.client.platformJson("GET", `${base}/${encodeURIComponent(job.id)}`, signal);
|
|
52776
|
+
if (!read?.job)
|
|
52777
|
+
throw new Error("the service returned no hosted job");
|
|
52778
|
+
job = read.job;
|
|
52779
|
+
}
|
|
52780
|
+
show(context, job);
|
|
52781
|
+
if (job.status === "succeeded")
|
|
52782
|
+
return 0;
|
|
52783
|
+
if (job.logTail)
|
|
52784
|
+
context.io.err(job.logTail);
|
|
52785
|
+
return 1;
|
|
52786
|
+
}
|
|
52787
|
+
};
|
|
52788
|
+
|
|
52789
|
+
// apps/cli/src/commands/run.ts
|
|
52790
|
+
var remoteLocalValues2 = ["config", "revision-digest", "env", "output", "python", "bridge-module", "bridge-output-bytes", "storage", "trial-port", "trial-listen", "trial-base-url", "trial-idle-timeout-seconds", "job-id", "max-invalid-retries", "participant-timeout-ms", "terminal-timeout-ms", "token-refresh-ms", "tdg-account", "tdg-actor", "tdg-url", "tdg-credential-file"];
|
|
52791
|
+
var remoteLocalFlags = ["dry-run", "no-upload", "trusted-local", "yes"];
|
|
52792
|
+
var remotePositive = (raw, option) => {
|
|
52793
|
+
if (raw === undefined)
|
|
52794
|
+
return;
|
|
52795
|
+
const value = integerFrom(raw, option);
|
|
52796
|
+
if (value < 1 || !Number.isSafeInteger(value))
|
|
52797
|
+
throw new UsageError(`${option} must be a positive safe integer`, "run");
|
|
52798
|
+
};
|
|
52799
|
+
var exists2 = async (path) => {
|
|
52800
|
+
try {
|
|
52801
|
+
await lstat9(path);
|
|
52802
|
+
return true;
|
|
52803
|
+
} catch (cause) {
|
|
52804
|
+
if (cause instanceof Error && "code" in cause && cause.code === "ENOENT")
|
|
52805
|
+
return false;
|
|
52806
|
+
throw cause;
|
|
52807
|
+
}
|
|
52808
|
+
};
|
|
52809
|
+
var remoteRun = async (context, parsed) => {
|
|
52810
|
+
if (parsed.values.server !== undefined || context.env.HARBOR_SERVER_URL)
|
|
52811
|
+
throw new UsageError("--remote cannot be combined with --server or HARBOR_SERVER_URL", "run");
|
|
52812
|
+
for (const name of remoteLocalValues2)
|
|
52813
|
+
if (parsed.values[name] !== undefined)
|
|
52814
|
+
throw new UsageError(`--${name} is not supported by run --remote`, "run");
|
|
52815
|
+
for (const name of remoteLocalFlags)
|
|
52816
|
+
if (parsed.flags.has(name))
|
|
52817
|
+
throw new UsageError(`--${name} is not supported by run --remote`, "run");
|
|
52818
|
+
for (const name of ["role", "agent-kwarg", "ak"])
|
|
52819
|
+
if ((parsed.lists[name]?.length ?? 0) > 0)
|
|
52820
|
+
throw new UsageError(`--${name} is not supported by run --remote`, "run");
|
|
52821
|
+
if (parsed.values["idempotency-key"] !== undefined || parsed.values["wait-poll-ms"] !== undefined)
|
|
52822
|
+
throw new UsageError("Harbor API server options are not supported by run --remote", "run");
|
|
52823
|
+
const { path, task, dataset } = parsed.values;
|
|
52824
|
+
if ([path, task, dataset].filter((value) => value !== undefined).length !== 1)
|
|
52825
|
+
throw new UsageError("run --remote needs exactly one of --path, --task, or --dataset", "run");
|
|
52826
|
+
const hasTaskFilters = (parsed.lists["include-task-name"]?.length ?? 0) > 0 || (parsed.lists["exclude-task-name"]?.length ?? 0) > 0 || parsed.values["task-names-file"] !== undefined;
|
|
52827
|
+
if (hasTaskFilters && dataset === undefined)
|
|
52828
|
+
throw new UsageError("Task name filters require a stored --dataset revision", "run");
|
|
52829
|
+
if (path !== undefined && parsed.values.revision !== undefined)
|
|
52830
|
+
throw new UsageError("--revision requires a stored --task or --dataset", "run");
|
|
52831
|
+
if (parsed.values.model !== undefined && parsed.values.agent === undefined)
|
|
52832
|
+
throw new UsageError("--model requires --agent", "run");
|
|
52833
|
+
remotePositive(parsed.values["n-attempts"], "--n-attempts");
|
|
52834
|
+
remotePositive(parsed.values.concurrency, "--concurrency");
|
|
52835
|
+
remotePositive(parsed.values["poll-ms"], "--poll-ms");
|
|
52836
|
+
const directory = path === undefined ? undefined : resolve20(context.cwd, path);
|
|
52837
|
+
if (directory !== undefined && await exists2(resolve20(directory, "hatchery.toml")))
|
|
52838
|
+
throw new UsageError("run --remote does not yet support role tasks with hatchery.toml; use the local cast or swarm workflow", "run");
|
|
52839
|
+
const project = await projectFrom(context, parsed);
|
|
52840
|
+
let kind;
|
|
52841
|
+
let id;
|
|
52842
|
+
let revision;
|
|
52843
|
+
if (path !== undefined) {
|
|
52844
|
+
if (!await hasHarborTask(directory))
|
|
52845
|
+
throw new UsageError("run --remote --path currently supports one Harbor task directory", "run");
|
|
52846
|
+
const items = await pushHarbor(context, project, directory);
|
|
52847
|
+
const item = items.find((candidate) => candidate.kind === "task");
|
|
52848
|
+
if (!item)
|
|
52849
|
+
throw new Error("Pushing the remote task returned no task revision.");
|
|
52850
|
+
kind = "task";
|
|
52851
|
+
id = item.id;
|
|
52852
|
+
revision = item.revision;
|
|
52853
|
+
context.io.err(`Pushed ${item.name} as task ${id} revision ${revision} ${item.digest}${item.unchanged ? " unchanged" : ""}`);
|
|
52854
|
+
} else {
|
|
52855
|
+
kind = task !== undefined ? "task" : "dataset";
|
|
52856
|
+
id = task ?? dataset;
|
|
52857
|
+
const selector = parsed.values.revision;
|
|
52858
|
+
if (selector === undefined)
|
|
52859
|
+
throw new UsageError(`--${kind} requires --revision with an exact number or latest`, "run");
|
|
52860
|
+
if (selector !== "latest" && !/^[1-9]\d{0,14}$/.test(selector))
|
|
52861
|
+
throw new UsageError("--revision must be a positive integer or latest", "run");
|
|
52862
|
+
revision = selector === "latest" ? await latestRevision(context, project, kind, id) : Number(selector);
|
|
52863
|
+
if (selector === "latest")
|
|
52864
|
+
context.io.err(`Resolved latest to ${kind} ${id} revision ${revision} in project ${project}`);
|
|
52865
|
+
}
|
|
52866
|
+
const values = { project, [kind]: id, revision: String(revision), ...parsed.values.agent ? { agent: parsed.values.agent } : {}, ...parsed.values.model ? { model: parsed.values.model } : {}, ...parsed.values["n-attempts"] ? { "n-attempts": parsed.values["n-attempts"] } : {}, ...parsed.values.concurrency ? { concurrency: parsed.values.concurrency } : {}, ...parsed.values["poll-ms"] ? { "poll-ms": parsed.values["poll-ms"] } : {}, ...parsed.values["task-names-file"] ? { "task-names-file": parsed.values["task-names-file"] } : {} };
|
|
52867
|
+
const hosted = { name: "hosted", operands: { action: "start" }, values, flags: new Set(["wait"]), lists: { ...parsed.lists.secret ? { secret: parsed.lists.secret } : {}, ...parsed.lists["include-task-name"] ? { "include-task-name": parsed.lists["include-task-name"] } : {}, ...parsed.lists["exclude-task-name"] ? { "exclude-task-name": parsed.lists["exclude-task-name"] } : {} }, pairs: {}, ordered: [] };
|
|
52868
|
+
return hostedCommand.run(context, hosted);
|
|
52869
|
+
};
|
|
52439
52870
|
var runCommand = {
|
|
52440
|
-
spec: { name: "run", operands: [], options: harborRunOptions, summary: "Run a Harbor task
|
|
52871
|
+
spec: { name: "run", operands: [], options: harborRunOptions, shortOptions: { i: "include-task-name", x: "exclude-task-name" }, summary: "Run a Harbor task locally or remotely", usage: `hatchery run (--path task | (--task id | --dataset id) --revision (n | latest) [--revision-digest sha256:hex] | --config job.json) [-i glob | --include-task-name glob ...] [-x glob | --exclude-task-name glob ...] [--task-names-file path] [--server url [--idempotency-key key] [--wait [--wait-poll-ms ms]]] [--agent name --model name] [--env provider] [--n-attempts n] [--project id] [--python path] [--yes] [--token-refresh-ms ms] [--dry-run]
|
|
52872
|
+
hatchery run (--path task | (--task id | --dataset id) --revision (n | latest)) --remote [-i glob | -x glob | --task-names-file path] [--agent name --model name] [--n-attempts n] [--concurrency n] [--secret NAME] [--poll-ms n] [--project id] (waits by default; task filters require --dataset)`, namespaced: false },
|
|
52441
52873
|
run: async (context, parsed) => {
|
|
52874
|
+
if (parsed.flags.has("remote"))
|
|
52875
|
+
return remoteRun(context, parsed);
|
|
52876
|
+
if ((parsed.lists.secret?.length ?? 0) > 0)
|
|
52877
|
+
throw new UsageError("--secret requires --remote", "run");
|
|
52442
52878
|
return executeHarborCommand(context, parsed);
|
|
52443
52879
|
}
|
|
52444
52880
|
};
|
|
52445
52881
|
|
|
52446
52882
|
// apps/cli/src/commands/runner.ts
|
|
52447
|
-
import { chmod as chmod5, mkdir as
|
|
52883
|
+
import { chmod as chmod5, mkdir as mkdir9, mkdtemp as mkdtemp7, rename as rename6, rm as rm8, writeFile as writeFile8 } from "fs/promises";
|
|
52448
52884
|
import { homedir as homedir2, tmpdir as tmpdir5 } from "os";
|
|
52449
|
-
import { join as
|
|
52885
|
+
import { join as join23 } from "path";
|
|
52450
52886
|
import process2 from "process";
|
|
52451
52887
|
var RUNNER_EXIT = Object.freeze({ recorded: 0, failed: 1, refused: 2, trialErrors: 3 });
|
|
52452
52888
|
var RUNNER_VALUES = [
|
|
@@ -52488,11 +52924,21 @@ var runnerArguments = (env, configPath) => {
|
|
|
52488
52924
|
throw new UsageError("HATCHERY_RUN_ALLOW_HOST_ENV must be true or false");
|
|
52489
52925
|
const hosted = set4(env, "HATCHERY_HOSTED_JOB_ID") !== undefined;
|
|
52490
52926
|
const valueOf = (option, value) => option === "env" && hosted && Object.hasOwn(HOSTED_ENVIRONMENT_ALIASES, value) ? HOSTED_ENVIRONMENT_ALIASES[value] : value;
|
|
52927
|
+
const patterns = (name, option) => {
|
|
52928
|
+
if (!set4(env, name))
|
|
52929
|
+
return [];
|
|
52930
|
+
const values = JSON.parse(set4(env, name));
|
|
52931
|
+
if (!Array.isArray(values) || values.some((value) => typeof value !== "string" || value === ""))
|
|
52932
|
+
throw new UsageError(`${name} must hold a nonempty string array`);
|
|
52933
|
+
return values.flatMap((value) => [`--${option}`, value]);
|
|
52934
|
+
};
|
|
52491
52935
|
return [
|
|
52492
52936
|
...task ? ["--task", task] : [],
|
|
52493
52937
|
...dataset ? ["--dataset", dataset] : [],
|
|
52494
52938
|
...configPath === undefined ? [] : ["--config", configPath],
|
|
52495
52939
|
...RUNNER_VALUES.flatMap(([name, option]) => set4(env, name) ? [`--${option}`, valueOf(option, set4(env, name))] : []),
|
|
52940
|
+
...patterns("HATCHERY_RUN_TASK_NAMES", "include-task-name"),
|
|
52941
|
+
...patterns("HATCHERY_RUN_EXCLUDE_TASK_NAMES", "exclude-task-name"),
|
|
52496
52942
|
...consent === "true" ? ["--yes"] : []
|
|
52497
52943
|
];
|
|
52498
52944
|
};
|
|
@@ -52511,16 +52957,16 @@ var runJob = async (context, starting) => {
|
|
|
52511
52957
|
const tokenSecret = set4(env, "MODAL_TOKEN_SECRET");
|
|
52512
52958
|
if (!tokenId || !tokenSecret)
|
|
52513
52959
|
return refuse("Modal hosted jobs require the platform MODAL_TOKEN_ID and MODAL_TOKEN_SECRET pair");
|
|
52514
|
-
modalHome = await
|
|
52960
|
+
modalHome = await mkdtemp7(join23(tmpdir5(), "hatchery-modal-"));
|
|
52515
52961
|
await chmod5(modalHome, 448);
|
|
52516
|
-
const modalConfig =
|
|
52962
|
+
const modalConfig = join23(modalHome, ".modal.toml");
|
|
52517
52963
|
const staged = `${modalConfig}.next`;
|
|
52518
|
-
await
|
|
52964
|
+
await writeFile8(staged, `[default]
|
|
52519
52965
|
token_id = ${JSON.stringify(tokenId)}
|
|
52520
52966
|
token_secret = ${JSON.stringify(tokenSecret)}
|
|
52521
52967
|
`, { mode: 384 });
|
|
52522
52968
|
await chmod5(staged, 384);
|
|
52523
|
-
await
|
|
52969
|
+
await rename6(staged, modalConfig);
|
|
52524
52970
|
const { MODAL_TOKEN_ID: _tokenId, MODAL_TOKEN_SECRET: _tokenSecret, ...withoutModalTokens } = env;
|
|
52525
52971
|
env = { ...withoutModalTokens, HOME: modalHome, MODAL_CONFIG_PATH: modalConfig };
|
|
52526
52972
|
context = { ...context, env };
|
|
@@ -52535,9 +52981,9 @@ token_secret = ${JSON.stringify(tokenSecret)}
|
|
|
52535
52981
|
}
|
|
52536
52982
|
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
52537
52983
|
return refuse(`${ACTORCTL_CREDENTIALS_ENV} must hold a JSON object`);
|
|
52538
|
-
const home =
|
|
52539
|
-
await
|
|
52540
|
-
await
|
|
52984
|
+
const home = join23(set4(env, "HOME") ?? homedir2(), ".actorctl");
|
|
52985
|
+
await mkdir9(home, { recursive: true, mode: 448 });
|
|
52986
|
+
await writeFile8(join23(home, "credentials.json"), credentials, { mode: 384 });
|
|
52541
52987
|
}
|
|
52542
52988
|
if (set4(env, "HATCHERY_RUN_CHECK_SET")) {
|
|
52543
52989
|
const argv = ["--dataset", set4(env, "HATCHERY_RUN_DATASET") ?? "", "--revision", set4(env, "HATCHERY_RUN_REVISION") ?? "", "--check-set", set4(env, "HATCHERY_RUN_CHECK_SET")];
|
|
@@ -52571,12 +53017,12 @@ token_secret = ${JSON.stringify(tokenSecret)}
|
|
|
52571
53017
|
if (config === null || typeof config !== "object" || Array.isArray(config)) {
|
|
52572
53018
|
return refuse("HATCHERY_RUN_CONFIG_JSON must hold a JSON object");
|
|
52573
53019
|
}
|
|
52574
|
-
directory = await
|
|
52575
|
-
await
|
|
53020
|
+
directory = await mkdtemp7(join23(tmpdir5(), "hatchery-runner-"));
|
|
53021
|
+
await writeFile8(join23(directory, "job.json"), inline, { mode: 384 });
|
|
52576
53022
|
}
|
|
52577
53023
|
let argv;
|
|
52578
53024
|
try {
|
|
52579
|
-
argv = runnerArguments(env, directory === undefined ? undefined :
|
|
53025
|
+
argv = runnerArguments(env, directory === undefined ? undefined : join23(directory, "job.json"));
|
|
52580
53026
|
} catch (cause) {
|
|
52581
53027
|
if (!(cause instanceof UsageError))
|
|
52582
53028
|
throw cause;
|
|
@@ -52611,9 +53057,9 @@ token_secret = ${JSON.stringify(tokenSecret)}
|
|
|
52611
53057
|
}
|
|
52612
53058
|
} finally {
|
|
52613
53059
|
if (directory !== undefined)
|
|
52614
|
-
await
|
|
53060
|
+
await rm8(directory, { recursive: true, force: true });
|
|
52615
53061
|
if (modalHome !== undefined)
|
|
52616
|
-
await
|
|
53062
|
+
await rm8(modalHome, { recursive: true, force: true });
|
|
52617
53063
|
}
|
|
52618
53064
|
};
|
|
52619
53065
|
var DEFAULT_RUNNER_LOG_TAIL_BYTES = 65536;
|
|
@@ -52817,13 +53263,13 @@ var runnerCommand = {
|
|
|
52817
53263
|
};
|
|
52818
53264
|
|
|
52819
53265
|
// apps/cli/src/commands/regrade.ts
|
|
52820
|
-
import { resolve as
|
|
53266
|
+
import { resolve as resolve21 } from "path";
|
|
52821
53267
|
var regradeCommand = {
|
|
52822
53268
|
spec: { name: "regrade", operands: ["run"], options: { path: "value", python: "value", "bridge-module": "value", "no-upload": "flag", "token-refresh-ms": "value", yes: "flag" }, summary: "Regrade a retained Harbor job with its separate verifier", usage: "hatchery regrade <job-directory> --path task [--python path] [--project id] [--yes]", namespaced: false },
|
|
52823
53269
|
run: async (context, parsed) => {
|
|
52824
53270
|
if (parsed.values.path) {
|
|
52825
53271
|
const upload = await harborUpload(context, parsed);
|
|
52826
|
-
const result = await runHarborRegrade({ ...harborProcessOptions(context, parsed), sourceJobDirectory:
|
|
53272
|
+
const result = await runHarborRegrade({ ...harborProcessOptions(context, parsed), sourceJobDirectory: resolve21(context.cwd, parsed.operands.run ?? ""), taskDirectory: resolve21(context.cwd, parsed.values.path), plugins: upload.plugins, confirmHostEnvAccess: parsed.flags.has("yes") }).finally(upload.close);
|
|
52827
53273
|
context.io.out(context.json ? JSON.stringify(result) : `Regraded ${result.result.trial_results.length} Harbor trials in ${result.directory}`);
|
|
52828
53274
|
return;
|
|
52829
53275
|
}
|
|
@@ -52845,8 +53291,8 @@ var openCommand = {
|
|
|
52845
53291
|
};
|
|
52846
53292
|
|
|
52847
53293
|
// apps/cli/src/commands/page.ts
|
|
52848
|
-
import { readFile as
|
|
52849
|
-
import { resolve as
|
|
53294
|
+
import { readFile as readFile17, writeFile as writeFile9 } from "fs/promises";
|
|
53295
|
+
import { resolve as resolve23 } from "path";
|
|
52850
53296
|
|
|
52851
53297
|
// packages/pages/src/types.ts
|
|
52852
53298
|
var PAGE_MERMAID_RENDER_OPTIONS = { links: false, images: false, autoDirection: false };
|
|
@@ -69491,7 +69937,7 @@ function Ri(e) {
|
|
|
69491
69937
|
}
|
|
69492
69938
|
var Sr;
|
|
69493
69939
|
var Ti = new Map;
|
|
69494
|
-
function
|
|
69940
|
+
function rm9(e, t) {
|
|
69495
69941
|
let n = Sr, r = Ti;
|
|
69496
69942
|
Sr = e, Ti = new Map;
|
|
69497
69943
|
try {
|
|
@@ -70537,7 +70983,7 @@ function E_(e, t) {
|
|
|
70537
70983
|
}
|
|
70538
70984
|
function S_(e, t = {}) {
|
|
70539
70985
|
return Om(() => {
|
|
70540
|
-
let { type: n, mermaidType: r, diagram: i, model: s, config: a } = E_(e, t), o = a[i.section ?? n], c = typeof o == "object" && o !== null && !Array.isArray(o) && o.useMaxWidth === false, l = t.responsive ?? !c, u = t.icons, h = u && ((p) => u(gt(p))), d = Dm({ type: n, mermaidType: r }, () => Im(Nm(n, a), () =>
|
|
70986
|
+
let { type: n, mermaidType: r, diagram: i, model: s, config: a } = E_(e, t), o = a[i.section ?? n], c = typeof o == "object" && o !== null && !Array.isArray(o) && o.useMaxWidth === false, l = t.responsive ?? !c, u = t.icons, h = u && ((p) => u(gt(p))), d = Dm({ type: n, mermaidType: r }, () => Im(Nm(n, a), () => rm9(i.math ? t.math : undefined, () => tm(h, () => i.render(s, a, { ...t, responsive: l, icons: h }))))), m = t.outputLimit ?? g_;
|
|
70541
70987
|
if (d.svg.length > m)
|
|
70542
70988
|
throw new qe(`Diagram output is longer than the limit of ${m} characters.`, "limit", { type: n, mermaidType: r });
|
|
70543
70989
|
for (let p of d.links)
|
|
@@ -89133,7 +89579,7 @@ var xA = 10;
|
|
|
89133
89579
|
var ap = 26;
|
|
89134
89580
|
var AA = 8;
|
|
89135
89581
|
var Vk = 320;
|
|
89136
|
-
var
|
|
89582
|
+
var cp4 = 10;
|
|
89137
89583
|
var SA = 8;
|
|
89138
89584
|
var wA = ' fill="var(--_s)" stroke="var(--_b)"';
|
|
89139
89585
|
var md = ' fill="none" stroke="var(--_b)"';
|
|
@@ -89355,7 +89801,7 @@ function MA(e, t, n, r) {
|
|
|
89355
89801
|
}
|
|
89356
89802
|
for (let Me of we) {
|
|
89357
89803
|
let Ie = b[Me];
|
|
89358
|
-
ne += gd(Ie.x - Ie.w / 2 + u, Ie.y - Ie.h / 2 + u, Ie.w, Ie.h, ` class="pele-divider" rx="${
|
|
89804
|
+
ne += gd(Ie.x - Ie.w / 2 + u, Ie.y - Ie.h / 2 + u, Ie.w, Ie.h, ` class="pele-divider" rx="${cp4}"`);
|
|
89359
89805
|
}
|
|
89360
89806
|
};
|
|
89361
89807
|
J(j, u / 2, u / 2, A - u / 2, D - u / 2);
|
|
@@ -89367,7 +89813,7 @@ function MA(e, t, n, r) {
|
|
|
89367
89813
|
switch (X.kind) {
|
|
89368
89814
|
case 8: {
|
|
89369
89815
|
let Re = we - Ae.w / 2, be = Ee - Ae.h / 2;
|
|
89370
|
-
Tn(de.shape) && Y.push({ box: [Re, be, Re + Ae.w, be + Ae.h], shape: de.shape }), xe = gd(Re, be, Ae.w, Ae.h, ` rx="${
|
|
89816
|
+
Tn(de.shape) && Y.push({ box: [Re, be, Re + Ae.w, be + Ae.h], shape: de.shape }), xe = gd(Re, be, Ae.w, Ae.h, ` rx="${cp4}" fill="var(--_a)"${Dn(de.shape) ? "" : ' fill-opacity="0.5"'} stroke="var(--_b)"${de.shape}`), X.titleH > 0 && (xe += `<path d="M${f(Re)},${f(be + X.titleH)}H${f(Re + Ae.w)}"${md}${de.line}/>` + Ce(X.label, Qk(Ae, X.label.width, B) + u, be + X.titleH / 2, ` class="pele-cluster-label"${Ie}${de.text}`, h)), J(F[V], Re, be + X.titleH, Re + Ae.w, be + Ae.h);
|
|
89371
89817
|
break;
|
|
89372
89818
|
}
|
|
89373
89819
|
case 2:
|
|
@@ -89389,7 +89835,7 @@ function MA(e, t, n, r) {
|
|
|
89389
89835
|
break;
|
|
89390
89836
|
}
|
|
89391
89837
|
default: {
|
|
89392
|
-
if (xe = gd(-Te / 2, -Me / 2, Te, Me, ` rx="${f(Math.min(
|
|
89838
|
+
if (xe = gd(-Te / 2, -Me / 2, Te, Me, ` rx="${f(Math.min(cp4, Me / 2))}"${wA}${de.shape}`), X.kind === 0) {
|
|
89393
89839
|
xe += Ce(X.label, 0, 0, ge, h);
|
|
89394
89840
|
break;
|
|
89395
89841
|
}
|
|
@@ -94002,8 +94448,8 @@ var liftStandaloneComponents = (node) => {
|
|
|
94002
94448
|
return { ...node, children };
|
|
94003
94449
|
};
|
|
94004
94450
|
// apps/cli/src/page-assets.ts
|
|
94005
|
-
import { readFile as
|
|
94006
|
-
import { dirname as
|
|
94451
|
+
import { readFile as readFile16 } from "fs/promises";
|
|
94452
|
+
import { dirname as dirname11, extname, resolve as resolve22 } from "path";
|
|
94007
94453
|
var DEFAULT_PAGE_ASSET_LIMITS = {
|
|
94008
94454
|
pageAssets: 24,
|
|
94009
94455
|
pageAssetBytes: 2097152
|
|
@@ -94033,14 +94479,14 @@ var localPageAssets = async (pageFile, paths, limits = DEFAULT_PAGE_ASSET_LIMITS
|
|
|
94033
94479
|
if (paths.length > limits.pageAssets) {
|
|
94034
94480
|
return { ok: false, problems: [problem(`Page defines ${paths.length} image assets, above the applied pageAssets limit of ${limits.pageAssets}.`)] };
|
|
94035
94481
|
}
|
|
94036
|
-
const root =
|
|
94482
|
+
const root = dirname11(pageFile);
|
|
94037
94483
|
const inspected = await Promise.all(paths.map(async (path) => {
|
|
94038
94484
|
const expected = extensionContentType(path);
|
|
94039
94485
|
if (expected === undefined)
|
|
94040
94486
|
return problem(`Image asset ${path} must use a .png, .jpg, .jpeg, or .webp extension.`);
|
|
94041
94487
|
let bytes;
|
|
94042
94488
|
try {
|
|
94043
|
-
bytes = await
|
|
94489
|
+
bytes = await readFile16(resolve22(root, path));
|
|
94044
94490
|
} catch {
|
|
94045
94491
|
return problem(`Image asset ${path} could not be read relative to ${pageFile}.`);
|
|
94046
94492
|
}
|
|
@@ -94110,8 +94556,8 @@ var reportProblems = (context, file, problems) => {
|
|
|
94110
94556
|
context.io.err(`${file}:${problem.line}:${problem.column} ${problem.message}`);
|
|
94111
94557
|
};
|
|
94112
94558
|
var checkedPage = async (context, file) => {
|
|
94113
|
-
const pageFile =
|
|
94114
|
-
const source = await
|
|
94559
|
+
const pageFile = resolve23(context.cwd, file);
|
|
94560
|
+
const source = await readFile17(pageFile, "utf8");
|
|
94115
94561
|
const parsed = parsePage(source, PAGE_CHECK_LIMITS);
|
|
94116
94562
|
if (!parsed.ok)
|
|
94117
94563
|
return { source, problems: parsed.problems };
|
|
@@ -94144,8 +94590,8 @@ var pageCommand = {
|
|
|
94144
94590
|
const action = parsed.operands.action;
|
|
94145
94591
|
if (action === "init") {
|
|
94146
94592
|
const file = parsed.operands.target ?? "page.mdx";
|
|
94147
|
-
const target =
|
|
94148
|
-
await
|
|
94593
|
+
const target = resolve23(context.cwd, file);
|
|
94594
|
+
await writeFile9(target, PAGE_TEMPLATE, { encoding: "utf8", flag: "wx", mode: 420 });
|
|
94149
94595
|
context.io.out(`Created ${target}`);
|
|
94150
94596
|
return;
|
|
94151
94597
|
}
|
|
@@ -94425,116 +94871,6 @@ var secretsCommandWith = (terminal) => ({
|
|
|
94425
94871
|
});
|
|
94426
94872
|
var secretsCommand = secretsCommandWith(() => process.stdin.isTTY === true);
|
|
94427
94873
|
|
|
94428
|
-
// apps/cli/src/commands/hosted.ts
|
|
94429
|
-
var DEFAULT_HOSTED_POLL_MS = 5000;
|
|
94430
|
-
var TERMINAL = new Set(["succeeded", "failed", "cancelled"]);
|
|
94431
|
-
var positive5 = (raw, what) => {
|
|
94432
|
-
const value = integerFrom(raw, what);
|
|
94433
|
-
if (value === 0)
|
|
94434
|
-
throw new UsageError(`${what} must be positive`, "hosted");
|
|
94435
|
-
return value;
|
|
94436
|
-
};
|
|
94437
|
-
var summary = (job) => [
|
|
94438
|
-
`hosted job ${job.id}: ${job.status}`,
|
|
94439
|
-
job.source ? `source: ${job.source.kind} ${job.source.id} r${job.source.revision}${job.source.digest ? ` ${job.source.digest}` : ""}` : "source: Harbor API JobConfig",
|
|
94440
|
-
...job.agent ? [`agent: ${job.agent}${job.model ? ` (${job.model})` : ""}`] : [],
|
|
94441
|
-
...job.exitCode === undefined ? [] : [`exit code: ${job.exitCode}`],
|
|
94442
|
-
...job.harborJobId ? [`harbor job: ${job.harborJobId}`] : [],
|
|
94443
|
-
...job.failure === undefined ? [] : [`failure: ${typeof job.failure === "string" ? job.failure : JSON.stringify(job.failure)}`]
|
|
94444
|
-
].join(`
|
|
94445
|
-
`);
|
|
94446
|
-
var show = (context, job) => context.io.out(context.json ? JSON.stringify({ job }) : summary(job));
|
|
94447
|
-
var sleep5 = (ms, signal) => new Promise((resolve, reject) => {
|
|
94448
|
-
if (signal?.aborted)
|
|
94449
|
-
return reject(signal.reason);
|
|
94450
|
-
const timer = setTimeout(() => {
|
|
94451
|
-
signal?.removeEventListener("abort", abort);
|
|
94452
|
-
resolve();
|
|
94453
|
-
}, ms);
|
|
94454
|
-
const abort = () => {
|
|
94455
|
-
clearTimeout(timer);
|
|
94456
|
-
reject(signal?.reason);
|
|
94457
|
-
};
|
|
94458
|
-
signal?.addEventListener("abort", abort, { once: true });
|
|
94459
|
-
});
|
|
94460
|
-
var hostedCommand = {
|
|
94461
|
-
spec: {
|
|
94462
|
-
name: "hosted",
|
|
94463
|
-
operands: ["action", "id?"],
|
|
94464
|
-
options: { task: "value", dataset: "value", revision: "value", agent: "value", model: "value", "n-attempts": "value", concurrency: "value", secret: "list", config: "value", wait: "flag", "poll-ms": "value" },
|
|
94465
|
-
summary: "Start, read, and cancel hosted Harbor jobs",
|
|
94466
|
-
usage: `hatchery hosted start (--task id | --dataset id) --revision n [--agent a] [--model m] [--n-attempts n] [--concurrency n] [--secret NAME ...] [--config job.json] [--wait] [--poll-ms n, default ${DEFAULT_HOSTED_POLL_MS}] [--project id] [--json]
|
|
94467
|
-
hatchery hosted status <id> [--project id] [--json]
|
|
94468
|
-
hatchery hosted cancel <id> [--project id] [--json]`,
|
|
94469
|
-
namespaced: false
|
|
94470
|
-
},
|
|
94471
|
-
run: async (context, parsed) => {
|
|
94472
|
-
const action = parsed.operands.action;
|
|
94473
|
-
if (action !== "start" && action !== "status" && action !== "cancel")
|
|
94474
|
-
throw new UsageError("hosted accepts start, status, or cancel", "hosted");
|
|
94475
|
-
const signal = context.signal ? { signal: context.signal } : {};
|
|
94476
|
-
const id = parsed.operands.id;
|
|
94477
|
-
if (action !== "start") {
|
|
94478
|
-
if (!id)
|
|
94479
|
-
throw new UsageError(`hosted ${action} needs <id>`, "hosted");
|
|
94480
|
-
const path = `/v1/projects/${encodeURIComponent(await projectFrom(context, parsed))}/hosted-jobs/${encodeURIComponent(id)}`;
|
|
94481
|
-
if (action === "cancel") {
|
|
94482
|
-
const body = await context.client.platformJson("POST", `${path}/cancel`, signal);
|
|
94483
|
-
context.io.out(context.json ? JSON.stringify(body ?? { id, cancelRequested: true }) : `cancel requested for hosted job ${id}`);
|
|
94484
|
-
return;
|
|
94485
|
-
}
|
|
94486
|
-
const read = await context.client.platformJson("GET", path, signal);
|
|
94487
|
-
if (!read?.job)
|
|
94488
|
-
throw new Error("the service returned no hosted job");
|
|
94489
|
-
show(context, read.job);
|
|
94490
|
-
return;
|
|
94491
|
-
}
|
|
94492
|
-
if (id)
|
|
94493
|
-
throw new UsageError("hosted start takes no operand", "hosted");
|
|
94494
|
-
const { task, dataset, revision, agent, model, config } = parsed.values;
|
|
94495
|
-
if (task === undefined === (dataset === undefined))
|
|
94496
|
-
throw new UsageError("hosted start needs exactly one of --task or --dataset", "hosted");
|
|
94497
|
-
if (revision === undefined)
|
|
94498
|
-
throw new UsageError("hosted start needs --revision n", "hosted");
|
|
94499
|
-
const pollMs = parsed.values["poll-ms"] === undefined ? DEFAULT_HOSTED_POLL_MS : positive5(parsed.values["poll-ms"], "--poll-ms");
|
|
94500
|
-
const attempts = parsed.values["n-attempts"] === undefined ? undefined : positive5(parsed.values["n-attempts"], "--n-attempts");
|
|
94501
|
-
const concurrency = parsed.values.concurrency === undefined ? undefined : positive5(parsed.values.concurrency, "--concurrency");
|
|
94502
|
-
const secrets = parsed.lists.secret ?? [];
|
|
94503
|
-
const body = {
|
|
94504
|
-
source: { kind: task === undefined ? "dataset" : "task", id: task ?? dataset, revision: positive5(revision, "--revision") },
|
|
94505
|
-
...agent ? { agent } : {},
|
|
94506
|
-
...model ? { model } : {},
|
|
94507
|
-
...attempts === undefined ? {} : { attempts },
|
|
94508
|
-
...concurrency === undefined ? {} : { concurrency },
|
|
94509
|
-
...secrets.length ? { secrets } : {},
|
|
94510
|
-
...config ? { config: await jsonFile(context.cwd, config) } : {}
|
|
94511
|
-
};
|
|
94512
|
-
const base = `/v1/projects/${encodeURIComponent(await projectFrom(context, parsed))}/hosted-jobs`;
|
|
94513
|
-
const created = await context.client.platformJson("POST", base, { body, headers: { "Hatchery-Agent": "hatchery-cli" }, ...signal });
|
|
94514
|
-
if (!created?.job)
|
|
94515
|
-
throw new Error("hosted job creation returned no job");
|
|
94516
|
-
let job = created.job;
|
|
94517
|
-
if (!parsed.flags.has("wait")) {
|
|
94518
|
-
show(context, job);
|
|
94519
|
-
return;
|
|
94520
|
-
}
|
|
94521
|
-
context.io.err(`hatchery: waiting for hosted job ${job.id}, reading its status every ${pollMs} ms`);
|
|
94522
|
-
while (!TERMINAL.has(job.status)) {
|
|
94523
|
-
await sleep5(pollMs, context.signal);
|
|
94524
|
-
const read = await context.client.platformJson("GET", `${base}/${encodeURIComponent(job.id)}`, signal);
|
|
94525
|
-
if (!read?.job)
|
|
94526
|
-
throw new Error("the service returned no hosted job");
|
|
94527
|
-
job = read.job;
|
|
94528
|
-
}
|
|
94529
|
-
show(context, job);
|
|
94530
|
-
if (job.status === "succeeded")
|
|
94531
|
-
return 0;
|
|
94532
|
-
if (job.logTail)
|
|
94533
|
-
context.io.err(job.logTail);
|
|
94534
|
-
return 1;
|
|
94535
|
-
}
|
|
94536
|
-
};
|
|
94537
|
-
|
|
94538
94874
|
// apps/cli/src/commands/projects.ts
|
|
94539
94875
|
var projectsCommand = {
|
|
94540
94876
|
spec: { name: "projects", operands: ["action", "name?"], options: {}, summary: "List and create the projects of your organization", usage: "hatchery projects list|create <name> [--json] (create derives the project id from the name and prints it)", namespaced: false },
|
|
@@ -94587,6 +94923,7 @@ var COMMANDS = [
|
|
|
94587
94923
|
projectsCommand,
|
|
94588
94924
|
initCommand,
|
|
94589
94925
|
pushCommand,
|
|
94926
|
+
pullCommand,
|
|
94590
94927
|
checkCommand,
|
|
94591
94928
|
runCommand,
|
|
94592
94929
|
runnerCommand,
|