htchry 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. package/README.md +16 -2
  2. package/dist/cli.js +223 -35
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -16,8 +16,22 @@ 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 --template harbor
19
+ hatchery init my-task
20
20
  cd my-task
21
21
  ```
22
22
 
23
- Local `run`, `check`, and `regrade` commands require the Python bridge and the tools selected by the task environment. Commands that retain Git artifacts require Git. Hosted and remote commands require network access and the credentials described by `hatchery <command> --help`.
23
+ `init` creates a task with instructions, an environment, a reference solution, and a verifier.
24
+
25
+ ## Pull project tasks
26
+
27
+ Download every task's latest revision into an empty working directory:
28
+
29
+ ```sh
30
+ mkdir my-benchmark
31
+ cd my-benchmark
32
+ hatchery pull --project your-project-id
33
+ ```
34
+
35
+ 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.
36
+
37
+ 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
@@ -15410,8 +15410,11 @@ import { dirname as dirname5, join as join10 } from "path";
15410
15410
 
15411
15411
  // apps/cli/src/artifacts-git.ts
15412
15412
  import { chmod as chmod2, mkdir as mkdir3, mkdtemp, rm } from "fs/promises";
15413
+ import { createWriteStream } from "fs";
15413
15414
  import { tmpdir } from "os";
15414
15415
  import { dirname as dirname4, join as join5 } from "path";
15416
+ import { Readable } from "stream";
15417
+ import { pipeline } from "stream/promises";
15415
15418
  var COMMIT_IDENTITY = {
15416
15419
  GIT_AUTHOR_NAME: "Hatchery",
15417
15420
  GIT_AUTHOR_EMAIL: "tasks@hatchery.build",
@@ -15532,8 +15535,18 @@ var fetchRevision = async (access, tag, commit, target, signal) => {
15532
15535
  const destination = join5(target, ...entry.path.split("/"));
15533
15536
  await mkdir3(dirname4(destination), { recursive: true });
15534
15537
  const child = Bun.spawn(["git", "cat-file", "blob", entry.oid], { env: { ...process.env, GIT_DIR: gitDir }, stdout: "pipe", stderr: "ignore", ...options });
15535
- await Bun.write(destination, new Response(child.stdout));
15536
- if (await child.exited !== 0)
15538
+ let code;
15539
+ try {
15540
+ const [, exited] = await Promise.all([pipeline(Readable.fromWeb(child.stdout), createWriteStream(destination, { flags: "wx" })), child.exited]);
15541
+ code = exited;
15542
+ } catch (cause) {
15543
+ child.kill();
15544
+ await child.exited.catch(() => {
15545
+ return;
15546
+ });
15547
+ throw cause;
15548
+ }
15549
+ if (code !== 0)
15537
15550
  throw new Error(`git cat-file could not read ${entry.path}.`);
15538
15551
  await chmod2(destination, entry.mode === "100755" ? 493 : 420);
15539
15552
  }
@@ -16427,12 +16440,12 @@ var materializeTask = async (context, project, root, id, revision, expectedDiges
16427
16440
  throw new Error(`${label} names ${file.path} as ${file.digest} with ${file.size} bytes, and the repository returned ${actual} with ${size} bytes.`);
16428
16441
  bytes += size;
16429
16442
  }
16430
- return { source: { kind: "task", id, revision, digest: stored.digest }, directory, files: files.length, bytes };
16443
+ return { source: { kind: "task", id, revision, digest: stored.digest }, name, directory, files: files.length, bytes };
16431
16444
  };
16432
16445
  var materializeRevision = async (context, project, kind, id, revision, root, expectedDigest) => {
16433
16446
  if (kind === "task") {
16434
16447
  const task = await materializeTask(context, project, root, id, revision, expectedDigest);
16435
- return { source: task.source, taskPaths: [task.directory], files: task.files, bytes: task.bytes };
16448
+ return { source: task.source, taskPaths: [task.directory], taskNames: [task.name], files: task.files, bytes: task.bytes };
16436
16449
  }
16437
16450
  const stored = await storedRevision(context, project, "dataset", id, revision, expectedDigest);
16438
16451
  const label = `dataset ${id} revision ${revision}`;
@@ -16440,6 +16453,7 @@ var materializeRevision = async (context, project, kind, id, revision, root, exp
16440
16453
  if (!Array.isArray(pinned) || pinned.length === 0)
16441
16454
  throw new Error(`${label} pins no Harbor task revisions.`);
16442
16455
  const taskPaths = [];
16456
+ const taskNames = [];
16443
16457
  let files = 0;
16444
16458
  let bytes = 0;
16445
16459
  for (const value of pinned) {
@@ -16452,10 +16466,11 @@ var materializeRevision = async (context, project, kind, id, revision, root, exp
16452
16466
  throw cause;
16453
16467
  });
16454
16468
  taskPaths.push(task.directory);
16469
+ taskNames.push(task.name);
16455
16470
  files += task.files;
16456
16471
  bytes += task.bytes;
16457
16472
  }
16458
- return { source: { kind: "dataset", id, revision, digest: stored.digest }, taskPaths, files, bytes };
16473
+ return { source: { kind: "dataset", id, revision, digest: stored.digest }, taskPaths, taskNames, files, bytes };
16459
16474
  };
16460
16475
 
16461
16476
  // apps/cli/src/harbor-process.ts
@@ -52435,6 +52450,178 @@ var pushCommand = {
52435
52450
  }
52436
52451
  };
52437
52452
 
52453
+ // apps/cli/src/commands/pull.ts
52454
+ 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";
52455
+ import { basename as basename7, dirname as dirname10, join as join22, relative as relative8, resolve as resolve18 } from "path";
52456
+ import { pathToFileURL as pathToFileURL2 } from "url";
52457
+ var missing3 = async (path) => {
52458
+ try {
52459
+ await lstat8(path);
52460
+ return false;
52461
+ } catch (cause) {
52462
+ if (cause instanceof Error && "code" in cause && cause.code === "ENOENT")
52463
+ return true;
52464
+ throw cause;
52465
+ }
52466
+ };
52467
+ var taskHeads = async (context, project) => {
52468
+ const tasks = [];
52469
+ let cursor;
52470
+ const cursors = new Set;
52471
+ do {
52472
+ 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 } : {} });
52473
+ if (!response.ok)
52474
+ throw new Error(`Listing tasks returned HTTP ${response.status}: ${(await response.text()).slice(0, 500)}`);
52475
+ const page = await response.json();
52476
+ if (!Array.isArray(page.items))
52477
+ throw new Error(`Project ${project} returned an invalid task list.`);
52478
+ for (const value of page.items) {
52479
+ if (!value || typeof value !== "object")
52480
+ throw new Error(`Project ${project} returned an invalid task.`);
52481
+ const task = value;
52482
+ if (typeof task.id !== "string" || typeof task.name !== "string" || !isHarborPackageName(task.name) || !Number.isSafeInteger(task.latestRevision) || Number(task.latestRevision) < 1)
52483
+ throw new Error(`Project ${project} returned an invalid task.`);
52484
+ tasks.push(task);
52485
+ }
52486
+ if (page.next === undefined || page.next === null || page.next === "")
52487
+ cursor = undefined;
52488
+ else if (typeof page.next === "string" || typeof page.next === "number") {
52489
+ cursor = String(page.next);
52490
+ if (cursors.has(cursor))
52491
+ throw new Error(`Project ${project} repeated task-list cursor ${cursor}.`);
52492
+ cursors.add(cursor);
52493
+ } else
52494
+ throw new Error(`Project ${project} returned an invalid task-list cursor.`);
52495
+ } while (cursor !== undefined);
52496
+ return tasks;
52497
+ };
52498
+ var selectedTask = (tasks, selector) => {
52499
+ const exact = tasks.filter((task) => task.id === selector || task.name === selector);
52500
+ if (exact.length === 1)
52501
+ return exact[0];
52502
+ const short = tasks.filter((task) => task.name.split("/")[1] === selector);
52503
+ if (short.length === 1)
52504
+ return short[0];
52505
+ if (short.length > 1)
52506
+ throw new Error(`${selector} matches more than one task: ${short.map((task) => task.name).join(", ")}. Use the package name or task id.`);
52507
+ throw new Error(`Project stores no task ${selector}.`);
52508
+ };
52509
+ var configProject = async (path) => {
52510
+ if (await missing3(path))
52511
+ return;
52512
+ const loaded = await import(`${pathToFileURL2(path).href}?hatchery=${Date.now()}`);
52513
+ const project = loaded.default?.project ?? loaded.project;
52514
+ return typeof project === "string" ? project : null;
52515
+ };
52516
+ var outputPath = async (requested) => {
52517
+ const exists = !await missing3(requested);
52518
+ if (exists && (await lstat8(requested)).isSymbolicLink())
52519
+ throw new Error(`Pull output ${requested} is a symbolic link.`);
52520
+ const suffix = [];
52521
+ let anchor = requested;
52522
+ while (await missing3(anchor)) {
52523
+ suffix.unshift(basename7(anchor));
52524
+ anchor = dirname10(anchor);
52525
+ }
52526
+ const canonicalAnchor = await realpath5(anchor);
52527
+ if (!(await lstat8(canonicalAnchor)).isDirectory())
52528
+ throw new Error(`Pull output parent ${anchor} is not a directory.`);
52529
+ const output = join22(canonicalAnchor, ...suffix);
52530
+ if (exists && !(await lstat8(output)).isDirectory())
52531
+ throw new Error(`Pull output ${output} is not a directory.`);
52532
+ return { output, exists };
52533
+ };
52534
+ var pullCommand = {
52535
+ 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 },
52536
+ run: async (context, parsed) => {
52537
+ const selector = parsed.operands.task;
52538
+ if (!selector && parsed.values.revision !== undefined)
52539
+ throw new UsageError("--revision requires one selected task", "pull");
52540
+ const project = await projectFrom(context, parsed);
52541
+ const requestedOutput = resolve18(context.cwd, parsed.values.output ?? ".");
52542
+ const { output, exists: outputExists } = await outputPath(requestedOutput);
52543
+ const configPath = join22(output, "hatchery.config.ts");
52544
+ const configured = outputExists ? await configProject(configPath) : undefined;
52545
+ if (configured !== undefined && configured !== project)
52546
+ throw new Error(configured === null ? `${configPath} does not select a project.` : `${configPath} selects project ${configured}, not ${project}.`);
52547
+ const listed = await taskHeads(context, project);
52548
+ const chosen = selector ? [selectedTask(listed, selector)] : listed;
52549
+ const selectorRevision = parsed.values.revision ?? "latest";
52550
+ if (selectorRevision !== "latest" && (!/^\d+$/.test(selectorRevision) || Number(selectorRevision) < 1 || !Number.isSafeInteger(Number(selectorRevision))))
52551
+ throw new UsageError("--revision must be a positive integer or latest", "pull");
52552
+ const plans = chosen.map((task) => ({ ...task, revision: selectorRevision === "latest" || !selector ? task.latestRevision : Number(selectorRevision), destination: join22(output, ...task.name.split("/")) }));
52553
+ for (const plan of plans) {
52554
+ if (!await missing3(plan.destination))
52555
+ throw new Error(`Refusing to overwrite existing task destination ${plan.destination}.`);
52556
+ const organization = dirname10(plan.destination);
52557
+ if (!await missing3(organization) && !(await lstat8(organization)).isDirectory())
52558
+ throw new Error(`Task parent ${organization} is not a directory.`);
52559
+ }
52560
+ await mkdir8(dirname10(output), { recursive: true });
52561
+ const staging = await mkdtemp6(join22(outputExists ? output : dirname10(output), ".hatchery-pull-"));
52562
+ const stagedOutput = join22(staging, "checkout");
52563
+ const pulled = [];
52564
+ const published = [];
52565
+ try {
52566
+ await mkdir8(stagedOutput);
52567
+ for (const plan of plans) {
52568
+ const privateRoot = join22(staging, `task-${pulled.length}`);
52569
+ await mkdir8(privateRoot);
52570
+ const materialized = await materializeRevision(context, project, "task", plan.id, plan.revision, privateRoot);
52571
+ if (materialized.taskNames[0] !== plan.name)
52572
+ throw new Error(`Task ${plan.id} is listed as ${plan.name}, and revision ${plan.revision} is named ${String(materialized.taskNames[0])}.`);
52573
+ const destination = join22(stagedOutput, ...plan.name.split("/"));
52574
+ await mkdir8(dirname10(destination), { recursive: true });
52575
+ await rename5(materialized.taskPaths[0], destination);
52576
+ pulled.push({ id: plan.id, name: plan.name, revision: materialized.source.revision, digest: materialized.source.digest, path: plan.destination });
52577
+ }
52578
+ if (configured === undefined)
52579
+ await writeFile7(join22(stagedOutput, "hatchery.config.ts"), `export default ${JSON.stringify({ project }, null, 2)}
52580
+ `, { flag: "wx" });
52581
+ if (!outputExists) {
52582
+ if (!await missing3(output))
52583
+ throw new Error(`Pull output ${output} appeared while tasks were downloading.`);
52584
+ await rename5(stagedOutput, output);
52585
+ } else {
52586
+ for (const plan of plans) {
52587
+ if (!await missing3(plan.destination))
52588
+ throw new Error(`Task destination ${plan.destination} appeared while tasks were downloading.`);
52589
+ const parent = dirname10(plan.destination);
52590
+ if (await missing3(parent))
52591
+ await mkdir8(parent);
52592
+ else if ((await lstat8(parent)).isSymbolicLink() || !(await lstat8(parent)).isDirectory())
52593
+ throw new Error(`Task parent ${parent} changed while tasks were downloading.`);
52594
+ await mkdir8(plan.destination);
52595
+ published.push(plan.destination);
52596
+ const source = join22(stagedOutput, ...plan.name.split("/"));
52597
+ for (const entry of await readdir7(source))
52598
+ await cp3(join22(source, entry), join22(plan.destination, entry), { recursive: true, force: false, errorOnExist: true });
52599
+ }
52600
+ if (configured === undefined) {
52601
+ if (!await missing3(configPath))
52602
+ throw new Error(`${configPath} appeared while tasks were downloading.`);
52603
+ await link2(join22(stagedOutput, "hatchery.config.ts"), configPath);
52604
+ }
52605
+ }
52606
+ } catch (cause) {
52607
+ const detail = cause instanceof Error ? cause.message : String(cause);
52608
+ if (published.length > 0)
52609
+ throw new Error(`${detail} Already published task directories were preserved because they may contain concurrent local edits: ${published.join(", ")}.`);
52610
+ throw cause;
52611
+ } finally {
52612
+ await rm7(staging, { recursive: true, force: true });
52613
+ }
52614
+ const answer = { project, output, tasks: pulled };
52615
+ if (context.json)
52616
+ context.io.out(JSON.stringify(answer));
52617
+ else if (answer.tasks.length === 0)
52618
+ context.io.out("No tasks.");
52619
+ else
52620
+ for (const task of answer.tasks)
52621
+ context.io.out(`${task.name} ${task.id} revision ${task.revision} ${task.digest} ${relative8(context.cwd, task.path) || "."}`);
52622
+ }
52623
+ };
52624
+
52438
52625
  // apps/cli/src/commands/run.ts
52439
52626
  var runCommand = {
52440
52627
  spec: { name: "run", operands: [], options: harborRunOptions, summary: "Run a Harbor task, stored revision, or native job configuration", usage: "hatchery run (--path task | (--task id | --dataset id) --revision (n | latest) [--revision-digest sha256:hex] | --config job.json) [--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]", namespaced: false },
@@ -52444,9 +52631,9 @@ var runCommand = {
52444
52631
  };
52445
52632
 
52446
52633
  // apps/cli/src/commands/runner.ts
52447
- import { chmod as chmod5, mkdir as mkdir8, mkdtemp as mkdtemp6, rename as rename5, rm as rm7, writeFile as writeFile7 } from "fs/promises";
52634
+ import { chmod as chmod5, mkdir as mkdir9, mkdtemp as mkdtemp7, rename as rename6, rm as rm8, writeFile as writeFile8 } from "fs/promises";
52448
52635
  import { homedir as homedir2, tmpdir as tmpdir5 } from "os";
52449
- import { join as join22 } from "path";
52636
+ import { join as join23 } from "path";
52450
52637
  import process2 from "process";
52451
52638
  var RUNNER_EXIT = Object.freeze({ recorded: 0, failed: 1, refused: 2, trialErrors: 3 });
52452
52639
  var RUNNER_VALUES = [
@@ -52511,16 +52698,16 @@ var runJob = async (context, starting) => {
52511
52698
  const tokenSecret = set4(env, "MODAL_TOKEN_SECRET");
52512
52699
  if (!tokenId || !tokenSecret)
52513
52700
  return refuse("Modal hosted jobs require the platform MODAL_TOKEN_ID and MODAL_TOKEN_SECRET pair");
52514
- modalHome = await mkdtemp6(join22(tmpdir5(), "hatchery-modal-"));
52701
+ modalHome = await mkdtemp7(join23(tmpdir5(), "hatchery-modal-"));
52515
52702
  await chmod5(modalHome, 448);
52516
- const modalConfig = join22(modalHome, ".modal.toml");
52703
+ const modalConfig = join23(modalHome, ".modal.toml");
52517
52704
  const staged = `${modalConfig}.next`;
52518
- await writeFile7(staged, `[default]
52705
+ await writeFile8(staged, `[default]
52519
52706
  token_id = ${JSON.stringify(tokenId)}
52520
52707
  token_secret = ${JSON.stringify(tokenSecret)}
52521
52708
  `, { mode: 384 });
52522
52709
  await chmod5(staged, 384);
52523
- await rename5(staged, modalConfig);
52710
+ await rename6(staged, modalConfig);
52524
52711
  const { MODAL_TOKEN_ID: _tokenId, MODAL_TOKEN_SECRET: _tokenSecret, ...withoutModalTokens } = env;
52525
52712
  env = { ...withoutModalTokens, HOME: modalHome, MODAL_CONFIG_PATH: modalConfig };
52526
52713
  context = { ...context, env };
@@ -52535,9 +52722,9 @@ token_secret = ${JSON.stringify(tokenSecret)}
52535
52722
  }
52536
52723
  if (value === null || typeof value !== "object" || Array.isArray(value))
52537
52724
  return refuse(`${ACTORCTL_CREDENTIALS_ENV} must hold a JSON object`);
52538
- const home = join22(set4(env, "HOME") ?? homedir2(), ".actorctl");
52539
- await mkdir8(home, { recursive: true, mode: 448 });
52540
- await writeFile7(join22(home, "credentials.json"), credentials, { mode: 384 });
52725
+ const home = join23(set4(env, "HOME") ?? homedir2(), ".actorctl");
52726
+ await mkdir9(home, { recursive: true, mode: 448 });
52727
+ await writeFile8(join23(home, "credentials.json"), credentials, { mode: 384 });
52541
52728
  }
52542
52729
  if (set4(env, "HATCHERY_RUN_CHECK_SET")) {
52543
52730
  const argv = ["--dataset", set4(env, "HATCHERY_RUN_DATASET") ?? "", "--revision", set4(env, "HATCHERY_RUN_REVISION") ?? "", "--check-set", set4(env, "HATCHERY_RUN_CHECK_SET")];
@@ -52571,12 +52758,12 @@ token_secret = ${JSON.stringify(tokenSecret)}
52571
52758
  if (config === null || typeof config !== "object" || Array.isArray(config)) {
52572
52759
  return refuse("HATCHERY_RUN_CONFIG_JSON must hold a JSON object");
52573
52760
  }
52574
- directory = await mkdtemp6(join22(tmpdir5(), "hatchery-runner-"));
52575
- await writeFile7(join22(directory, "job.json"), inline, { mode: 384 });
52761
+ directory = await mkdtemp7(join23(tmpdir5(), "hatchery-runner-"));
52762
+ await writeFile8(join23(directory, "job.json"), inline, { mode: 384 });
52576
52763
  }
52577
52764
  let argv;
52578
52765
  try {
52579
- argv = runnerArguments(env, directory === undefined ? undefined : join22(directory, "job.json"));
52766
+ argv = runnerArguments(env, directory === undefined ? undefined : join23(directory, "job.json"));
52580
52767
  } catch (cause) {
52581
52768
  if (!(cause instanceof UsageError))
52582
52769
  throw cause;
@@ -52611,9 +52798,9 @@ token_secret = ${JSON.stringify(tokenSecret)}
52611
52798
  }
52612
52799
  } finally {
52613
52800
  if (directory !== undefined)
52614
- await rm7(directory, { recursive: true, force: true });
52801
+ await rm8(directory, { recursive: true, force: true });
52615
52802
  if (modalHome !== undefined)
52616
- await rm7(modalHome, { recursive: true, force: true });
52803
+ await rm8(modalHome, { recursive: true, force: true });
52617
52804
  }
52618
52805
  };
52619
52806
  var DEFAULT_RUNNER_LOG_TAIL_BYTES = 65536;
@@ -52817,13 +53004,13 @@ var runnerCommand = {
52817
53004
  };
52818
53005
 
52819
53006
  // apps/cli/src/commands/regrade.ts
52820
- import { resolve as resolve18 } from "path";
53007
+ import { resolve as resolve19 } from "path";
52821
53008
  var regradeCommand = {
52822
53009
  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
53010
  run: async (context, parsed) => {
52824
53011
  if (parsed.values.path) {
52825
53012
  const upload = await harborUpload(context, parsed);
52826
- const result = await runHarborRegrade({ ...harborProcessOptions(context, parsed), sourceJobDirectory: resolve18(context.cwd, parsed.operands.run ?? ""), taskDirectory: resolve18(context.cwd, parsed.values.path), plugins: upload.plugins, confirmHostEnvAccess: parsed.flags.has("yes") }).finally(upload.close);
53013
+ const result = await runHarborRegrade({ ...harborProcessOptions(context, parsed), sourceJobDirectory: resolve19(context.cwd, parsed.operands.run ?? ""), taskDirectory: resolve19(context.cwd, parsed.values.path), plugins: upload.plugins, confirmHostEnvAccess: parsed.flags.has("yes") }).finally(upload.close);
52827
53014
  context.io.out(context.json ? JSON.stringify(result) : `Regraded ${result.result.trial_results.length} Harbor trials in ${result.directory}`);
52828
53015
  return;
52829
53016
  }
@@ -52845,8 +53032,8 @@ var openCommand = {
52845
53032
  };
52846
53033
 
52847
53034
  // apps/cli/src/commands/page.ts
52848
- import { readFile as readFile15, writeFile as writeFile8 } from "fs/promises";
52849
- import { resolve as resolve20 } from "path";
53035
+ import { readFile as readFile15, writeFile as writeFile9 } from "fs/promises";
53036
+ import { resolve as resolve21 } from "path";
52850
53037
 
52851
53038
  // packages/pages/src/types.ts
52852
53039
  var PAGE_MERMAID_RENDER_OPTIONS = { links: false, images: false, autoDirection: false };
@@ -69491,7 +69678,7 @@ function Ri(e) {
69491
69678
  }
69492
69679
  var Sr;
69493
69680
  var Ti = new Map;
69494
- function rm8(e, t) {
69681
+ function rm9(e, t) {
69495
69682
  let n = Sr, r = Ti;
69496
69683
  Sr = e, Ti = new Map;
69497
69684
  try {
@@ -70537,7 +70724,7 @@ function E_(e, t) {
70537
70724
  }
70538
70725
  function S_(e, t = {}) {
70539
70726
  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), () => rm8(i.math ? t.math : undefined, () => tm(h, () => i.render(s, a, { ...t, responsive: l, icons: h }))))), m = t.outputLimit ?? g_;
70727
+ 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
70728
  if (d.svg.length > m)
70542
70729
  throw new qe(`Diagram output is longer than the limit of ${m} characters.`, "limit", { type: n, mermaidType: r });
70543
70730
  for (let p of d.links)
@@ -89133,7 +89320,7 @@ var xA = 10;
89133
89320
  var ap = 26;
89134
89321
  var AA = 8;
89135
89322
  var Vk = 320;
89136
- var cp3 = 10;
89323
+ var cp4 = 10;
89137
89324
  var SA = 8;
89138
89325
  var wA = ' fill="var(--_s)" stroke="var(--_b)"';
89139
89326
  var md = ' fill="none" stroke="var(--_b)"';
@@ -89355,7 +89542,7 @@ function MA(e, t, n, r) {
89355
89542
  }
89356
89543
  for (let Me of we) {
89357
89544
  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="${cp3}"`);
89545
+ ne += gd(Ie.x - Ie.w / 2 + u, Ie.y - Ie.h / 2 + u, Ie.w, Ie.h, ` class="pele-divider" rx="${cp4}"`);
89359
89546
  }
89360
89547
  };
89361
89548
  J(j, u / 2, u / 2, A - u / 2, D - u / 2);
@@ -89367,7 +89554,7 @@ function MA(e, t, n, r) {
89367
89554
  switch (X.kind) {
89368
89555
  case 8: {
89369
89556
  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="${cp3}" 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);
89557
+ 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
89558
  break;
89372
89559
  }
89373
89560
  case 2:
@@ -89389,7 +89576,7 @@ function MA(e, t, n, r) {
89389
89576
  break;
89390
89577
  }
89391
89578
  default: {
89392
- if (xe = gd(-Te / 2, -Me / 2, Te, Me, ` rx="${f(Math.min(cp3, Me / 2))}"${wA}${de.shape}`), X.kind === 0) {
89579
+ if (xe = gd(-Te / 2, -Me / 2, Te, Me, ` rx="${f(Math.min(cp4, Me / 2))}"${wA}${de.shape}`), X.kind === 0) {
89393
89580
  xe += Ce(X.label, 0, 0, ge, h);
89394
89581
  break;
89395
89582
  }
@@ -94003,7 +94190,7 @@ var liftStandaloneComponents = (node) => {
94003
94190
  };
94004
94191
  // apps/cli/src/page-assets.ts
94005
94192
  import { readFile as readFile14 } from "fs/promises";
94006
- import { dirname as dirname10, extname, resolve as resolve19 } from "path";
94193
+ import { dirname as dirname11, extname, resolve as resolve20 } from "path";
94007
94194
  var DEFAULT_PAGE_ASSET_LIMITS = {
94008
94195
  pageAssets: 24,
94009
94196
  pageAssetBytes: 2097152
@@ -94033,14 +94220,14 @@ var localPageAssets = async (pageFile, paths, limits = DEFAULT_PAGE_ASSET_LIMITS
94033
94220
  if (paths.length > limits.pageAssets) {
94034
94221
  return { ok: false, problems: [problem(`Page defines ${paths.length} image assets, above the applied pageAssets limit of ${limits.pageAssets}.`)] };
94035
94222
  }
94036
- const root = dirname10(pageFile);
94223
+ const root = dirname11(pageFile);
94037
94224
  const inspected = await Promise.all(paths.map(async (path) => {
94038
94225
  const expected = extensionContentType(path);
94039
94226
  if (expected === undefined)
94040
94227
  return problem(`Image asset ${path} must use a .png, .jpg, .jpeg, or .webp extension.`);
94041
94228
  let bytes;
94042
94229
  try {
94043
- bytes = await readFile14(resolve19(root, path));
94230
+ bytes = await readFile14(resolve20(root, path));
94044
94231
  } catch {
94045
94232
  return problem(`Image asset ${path} could not be read relative to ${pageFile}.`);
94046
94233
  }
@@ -94110,7 +94297,7 @@ var reportProblems = (context, file, problems) => {
94110
94297
  context.io.err(`${file}:${problem.line}:${problem.column} ${problem.message}`);
94111
94298
  };
94112
94299
  var checkedPage = async (context, file) => {
94113
- const pageFile = resolve20(context.cwd, file);
94300
+ const pageFile = resolve21(context.cwd, file);
94114
94301
  const source = await readFile15(pageFile, "utf8");
94115
94302
  const parsed = parsePage(source, PAGE_CHECK_LIMITS);
94116
94303
  if (!parsed.ok)
@@ -94144,8 +94331,8 @@ var pageCommand = {
94144
94331
  const action = parsed.operands.action;
94145
94332
  if (action === "init") {
94146
94333
  const file = parsed.operands.target ?? "page.mdx";
94147
- const target = resolve20(context.cwd, file);
94148
- await writeFile8(target, PAGE_TEMPLATE, { encoding: "utf8", flag: "wx", mode: 420 });
94334
+ const target = resolve21(context.cwd, file);
94335
+ await writeFile9(target, PAGE_TEMPLATE, { encoding: "utf8", flag: "wx", mode: 420 });
94149
94336
  context.io.out(`Created ${target}`);
94150
94337
  return;
94151
94338
  }
@@ -94587,6 +94774,7 @@ var COMMANDS = [
94587
94774
  projectsCommand,
94588
94775
  initCommand,
94589
94776
  pushCommand,
94777
+ pullCommand,
94590
94778
  checkCommand,
94591
94779
  runCommand,
94592
94780
  runnerCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "htchry",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "hatchery, the command line client for Hatchery.",
5
5
  "author": "Clavia, Inc.",
6
6
  "license": "UNLICENSED",