yolont 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -153,7 +153,7 @@ that replay your last 20 reviews with the new weights before you save.
153
153
  - **It knows a refactor from a feature.** A refactor that changes behavior gets flagged. A bug
154
154
  fix without a regression test gets asked for one.
155
155
  - **Fails closed.** No gitleaks, no LLM call. Tokens are only ever sent to their own host.
156
- No telemetry.
156
+ No telemetry (just an opt-out npm version check).
157
157
 
158
158
  ---
159
159
 
package/dist/cli.js CHANGED
@@ -1,8 +1,77 @@
1
1
  #!/usr/bin/env node
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __esm = (fn, res, err) => function __init() {
5
+ if (err) throw err[0];
6
+ try {
7
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
+ } catch (e) {
9
+ throw err = [e], e;
10
+ }
11
+ };
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
16
+
17
+ // local/setup/version.ts
18
+ var version_exports = {};
19
+ __export(version_exports, {
20
+ installKind: () => installKind,
21
+ installLatest: () => installLatest,
22
+ isNewer: () => isNewer,
23
+ latestVersion: () => latestVersion,
24
+ ownVersion: () => ownVersion
25
+ });
26
+ import { spawnSync } from "node:child_process";
27
+ import { existsSync as existsSync11, readFileSync as readFileSync13 } from "node:fs";
28
+ import { dirname as dirname7, join as join14 } from "node:path";
29
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
30
+ function ownVersion(from = dirname7(fileURLToPath2(import.meta.url))) {
31
+ for (let dir = from, i = 0; i < 5; dir = dirname7(dir), i++) {
32
+ const file = join14(dir, "package.json");
33
+ if (!existsSync11(file)) continue;
34
+ try {
35
+ const pkg = JSON.parse(readFileSync13(file, "utf8"));
36
+ if (pkg.name === "yolont") return pkg.version;
37
+ } catch {
38
+ }
39
+ }
40
+ return void 0;
41
+ }
42
+ function isNewer(latest, current) {
43
+ const parts = (v) => v.split(/[-+]/)[0].split(".").map((n) => Number(n) || 0);
44
+ const [a, b] = [parts(latest), parts(current)];
45
+ for (let i = 0; i < 3; i++) if ((a[i] ?? 0) !== (b[i] ?? 0)) return (a[i] ?? 0) > (b[i] ?? 0);
46
+ return false;
47
+ }
48
+ async function latestVersion(timeoutMs = 1500) {
49
+ if (process.env.YOLONT_NO_UPDATE_CHECK || process.env.CI) return void 0;
50
+ try {
51
+ const res = await fetch("https://registry.npmjs.org/yolont/latest", { signal: AbortSignal.timeout(timeoutMs) });
52
+ if (!res.ok) return void 0;
53
+ return (await res.json()).version;
54
+ } catch {
55
+ return void 0;
56
+ }
57
+ }
58
+ function installKind(script = process.argv[1] ?? "") {
59
+ if (/[\\/]_npx[\\/]/.test(script)) return "npx";
60
+ if (/[\\/]node_modules[\\/]yolont[\\/]/.test(script) || /[\\/]bin[\\/]yolont$/.test(script)) return "npm";
61
+ return "source";
62
+ }
63
+ function installLatest(version) {
64
+ return spawnSync("npm", ["install", "-g", `yolont@${version}`], { stdio: "inherit", shell: process.platform === "win32" }).status === 0;
65
+ }
66
+ var init_version = __esm({
67
+ "local/setup/version.ts"() {
68
+ "use strict";
69
+ }
70
+ });
2
71
 
3
72
  // local/cli.ts
4
- import { existsSync as existsSync14 } from "node:fs";
5
- import { join as join17, resolve as resolve2 } from "node:path";
73
+ import { existsSync as existsSync15 } from "node:fs";
74
+ import { join as join18, resolve as resolve2 } from "node:path";
6
75
  import { parseArgs } from "node:util";
7
76
 
8
77
  // local/db/client.ts
@@ -5602,12 +5671,12 @@ async function startDashboard(opts = {}) {
5602
5671
  }
5603
5672
 
5604
5673
  // local/cli.ts
5605
- import { mkdirSync as mkdirSync11, readFileSync as readFileSync14, writeFileSync as writeFileSync11 } from "node:fs";
5674
+ import { mkdirSync as mkdirSync11, readFileSync as readFileSync15, writeFileSync as writeFileSync11 } from "node:fs";
5606
5675
  import { parseEnv } from "node:util";
5607
5676
  import { password as password2 } from "@clack/prompts";
5608
5677
 
5609
5678
  // local/setup/wizard.ts
5610
- import { execFileSync as execFileSync3, spawnSync } from "node:child_process";
5679
+ import { execFileSync as execFileSync3, spawnSync as spawnSync2 } from "node:child_process";
5611
5680
 
5612
5681
  // local/setup/ui.ts
5613
5682
  import pc2 from "picocolors";
@@ -5687,12 +5756,13 @@ function panel(title, rows) {
5687
5756
  }
5688
5757
 
5689
5758
  // local/setup/wizard.ts
5690
- import { existsSync as existsSync11, mkdtempSync, readFileSync as readFileSync13, rmSync as rmSync3, statSync, writeFileSync as writeFileSync9 } from "node:fs";
5759
+ import { existsSync as existsSync12, mkdtempSync, readFileSync as readFileSync14, rmSync as rmSync3, statSync, writeFileSync as writeFileSync9 } from "node:fs";
5691
5760
  import { homedir as homedir2, tmpdir as tmpdir2, userInfo as userInfo2 } from "node:os";
5692
5761
  import { emitKeypressEvents } from "node:readline";
5693
- import { join as join14, resolve } from "node:path";
5762
+ import { join as join15, resolve } from "node:path";
5694
5763
  import { autocompleteMultiselect, confirm as confirm2, intro as intro2, isCancel as isCancel2, log as log2, multiselect as multiselect2, note, outro as outro2, password, select as select2, spinner as spinner2, text as text2 } from "@clack/prompts";
5695
5764
  import pc3 from "picocolors";
5765
+ init_version();
5696
5766
  var Cancelled = class extends Error {
5697
5767
  };
5698
5768
  var Back = class extends Error {
@@ -5744,7 +5814,9 @@ function originAddress() {
5744
5814
  }
5745
5815
  var gitlabBases2 = () => loadConfig().forges.filter((f) => f.type === "gitlab" && f.url).map(forgeUrl);
5746
5816
  async function runSetup(opts) {
5747
- header("PR reviews that look twice \xB7 Esc = back \xB7 Ctrl-C = quit");
5817
+ const version = ownVersion();
5818
+ latestCheck = latestVersion();
5819
+ header(`${version ? `v${version} \xB7 ` : ""}PR reviews that look twice \xB7 Esc = back \xB7 Ctrl-C = quit`);
5748
5820
  await offerInstallOnce();
5749
5821
  await askIconsOnce();
5750
5822
  intro2(opts.review ? "Yolont" : "Yolont setup");
@@ -5804,14 +5876,32 @@ async function reviewThenCheckQuit(ctx, mrIid) {
5804
5876
  if (lastKey === "ctrl-c") throw new Cancelled();
5805
5877
  }
5806
5878
  var STEP_ICONS = { forge: "git", llm: "llm", conventions: "conventions", zones: "zones", weights: "weights" };
5807
- var runningFromNpx = (script = process.argv[1] ?? "") => /[\\/]_npx[\\/]/.test(script);
5879
+ var runningFromNpx = (script = process.argv[1] ?? "") => installKind(script) === "npx";
5880
+ var latestCheck = Promise.resolve(void 0);
5881
+ async function newerVersion() {
5882
+ const [current, latest] = [ownVersion(), await Promise.race([latestCheck, new Promise((r) => setTimeout(() => r(void 0), 300))])];
5883
+ return current && latest && isNewer(latest, current) ? latest : void 0;
5884
+ }
5885
+ async function updateMenu(latest) {
5886
+ const kind = installKind();
5887
+ if (kind === "source") {
5888
+ log2.info(`This is a source checkout. Update it with ${pc3.bold("git pull && npm ci")}, or install the package: ${pc3.bold(`npm install -g yolont@${latest}`)}`);
5889
+ return;
5890
+ }
5891
+ if (kind === "npx") {
5892
+ log2.info(`Run ${pc3.bold("npx yolont@latest")} next time, or install it once: ${pc3.bold(`npm install -g yolont@${latest}`)}`);
5893
+ return;
5894
+ }
5895
+ if (!await ask(confirm2({ message: `Update to v${latest}? (npm install -g yolont@${latest})`, initialValue: true }))) return;
5896
+ if (installLatest(latest)) {
5897
+ outro2(`Updated to v${latest}. Run ${pc3.bold("yolont")} again to use it.`);
5898
+ process.exit(0);
5899
+ }
5900
+ log2.warn("npm couldn't update it (often a permissions issue): https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally");
5901
+ }
5808
5902
  async function offerInstallOnce() {
5809
5903
  if (!runningFromNpx() || loadConfig().installOffered || !process.stdout.isTTY) return;
5810
- let version = "latest";
5811
- try {
5812
- version = JSON.parse(readFileSync13(new URL("../package.json", import.meta.url), "utf8")).version ?? version;
5813
- } catch {
5814
- }
5904
+ const version = ownVersion() ?? "latest";
5815
5905
  const ok = await confirm2({ message: `Install the \`yolont\` command, so next time you just type \`yolont\`? (npm install -g yolont@${version})`, initialValue: true });
5816
5906
  if (isCancel2(ok)) return;
5817
5907
  saveConfig({ ...loadConfig(), installOffered: true });
@@ -5819,8 +5909,7 @@ async function offerInstallOnce() {
5819
5909
  log2.info(pc3.dim("OK. Install it any time with `npm install -g yolont`."));
5820
5910
  return;
5821
5911
  }
5822
- const res = spawnSync("npm", ["install", "-g", `yolont@${version}`], { stdio: "inherit", shell: process.platform === "win32" });
5823
- if (res.status === 0) log2.success(`Installed. From now on run ${pc3.bold("yolont")} (no npx).`);
5912
+ if (installLatest(version)) log2.success(`Installed. From now on run ${pc3.bold("yolont")} (no npx).`);
5824
5913
  else
5825
5914
  log2.warn(
5826
5915
  `Couldn't install it (often a permissions issue with npm's global folder). Run \`npm install -g yolont\` yourself; for permission errors see https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally`
@@ -5833,19 +5922,21 @@ async function askIconsOnce() {
5833
5922
  saveConfig({ ...loadConfig(), icons: ok ? "nerd" : "plain" });
5834
5923
  log2.info(pc3.dim(ok ? "Nerd Font icons on. Turn off with `icons: plain` in config.yaml." : "Plain text. Install a Nerd Font and set `icons: nerd` in config.yaml for icons."));
5835
5924
  }
5836
- function statusPanel(ctx, teamLabel) {
5925
+ function statusPanel(ctx, teamLabel, latest) {
5837
5926
  const config = loadConfig();
5838
5927
  const llm = config.llmProfiles.find((p) => p.name === config.defaultLlmProfile);
5839
5928
  panel("Yolont", [
5840
5929
  [`${icon(ctx.forge.type === "github" ? "github" : "gitlab")}Project`, `${pc3.bold(ctx.address.projectPath)} ${pc3.dim(`\xB7 ${ctx.address.host}`)}`],
5841
5930
  [`${icon("llm")}LLM`, llm ? `${llm.name} ${pc3.dim(`\xB7 ${llm.model}`)}` : pc3.yellow("not set")],
5842
5931
  [`${icon("memory")}Memory`, teamLabel.replace(/^Memory repo( · )?/, "") || "\u2014"],
5843
- [`${icon("type")}Change type`, CHANGE_TYPE_MODES[config.changeType ?? "label"].label]
5932
+ [`${icon("type")}Change type`, CHANGE_TYPE_MODES[config.changeType ?? "label"].label],
5933
+ [`${icon("sync")}Version`, `v${ownVersion() ?? "?"}${latest ? pc3.yellow(` \xB7 v${latest} is out`) : ""}`]
5844
5934
  ]);
5845
5935
  }
5846
5936
  var STEP_LABELS = { forge: "Git host & token", llm: "LLM", conventions: "Conventions", zones: "Zones", weights: "Scoring weights" };
5847
5937
  async function mainMenu(ctx, opts) {
5848
- statusPanel(ctx, await teamMenuLabel(ctx.address));
5938
+ const latest = await newerVersion();
5939
+ statusPanel(ctx, await teamMenuLabel(ctx.address), latest);
5849
5940
  for (; ; ) {
5850
5941
  const missing = missingSteps({ host: ctx.address.host, projectPath: ctx.address.projectPath });
5851
5942
  const teamLabel = await teamMenuLabel(ctx.address);
@@ -5856,6 +5947,7 @@ async function mainMenu(ctx, opts) {
5856
5947
  message: `${ctx.address.projectPath} \xB7 ${ctx.address.host}`,
5857
5948
  options: [
5858
5949
  { value: "review", label: `${icon("review")}${pc3.bold("Review an open MR/PR")}` },
5950
+ ...latest ? [{ value: "update", label: pc3.yellow(`${icon("sync")}Update to v${latest}`), hint: `you have v${ownVersion()}` }] : [],
5859
5951
  ...Object.keys(STEP_LABELS).map((s) => ({
5860
5952
  value: s,
5861
5953
  label: `${missing.includes(s) ? pc3.red(nerdIcons() ? icon("missing") : "\u2717 ") : pc3.green(nerdIcons() ? icon("ok") : "\u2713 ")}${icon(STEP_ICONS[s])}${STEP_LABELS[s]}`
@@ -5872,6 +5964,10 @@ async function mainMenu(ctx, opts) {
5872
5964
  throw err;
5873
5965
  }
5874
5966
  if (choice === "exit") return;
5967
+ if (choice === "update") {
5968
+ await orBack(() => updateMenu(latest));
5969
+ continue;
5970
+ }
5875
5971
  if (choice === "remove") {
5876
5972
  await orBack(() => removeMenu(ctx.address));
5877
5973
  continue;
@@ -6305,14 +6401,14 @@ async function testOrConfirm(profile, key2) {
6305
6401
  }
6306
6402
  }
6307
6403
  function editInEditor(initial, name = "conventions.md") {
6308
- const dir = mkdtempSync(join14(tmpdir2(), "yolont-edit-"));
6309
- const file = join14(dir, name);
6404
+ const dir = mkdtempSync(join15(tmpdir2(), "yolont-edit-"));
6405
+ const file = join15(dir, name);
6310
6406
  try {
6311
6407
  writeFileSync9(file, initial);
6312
6408
  const editor = process.env.VISUAL || process.env.EDITOR || "vi";
6313
- const r = spawnSync(`${editor} "${file}"`, { stdio: "inherit", shell: true });
6409
+ const r = spawnSync2(`${editor} "${file}"`, { stdio: "inherit", shell: true });
6314
6410
  if (r.status !== 0) log2.warn(`${editor} exited with ${r.status ?? r.signal}; keeping what was saved.`);
6315
- return readFileSync13(file, "utf8");
6411
+ return readFileSync14(file, "utf8");
6316
6412
  } finally {
6317
6413
  rmSync3(dir, { recursive: true, force: true });
6318
6414
  }
@@ -6345,9 +6441,9 @@ async function conventionsStep(forge, address, change, opts) {
6345
6441
  log2.info(`Conventions come from the repo's ${cur.path} \u2014 edit them there (it's what CI uses too).`);
6346
6442
  return;
6347
6443
  }
6348
- if (cur.path && opts.conventions === "edit") return approve(host, projectPath, editInEditor(readFileSync13(cur.path, "utf8")), "", null);
6444
+ if (cur.path && opts.conventions === "edit") return approve(host, projectPath, editInEditor(readFileSync14(cur.path, "utf8")), "", null);
6349
6445
  if (cur.path && !opts.conventions) {
6350
- const text0 = readFileSync13(cur.path, "utf8");
6446
+ const text0 = readFileSync14(cur.path, "utf8");
6351
6447
  const keep = await ask(
6352
6448
  select2({
6353
6449
  message: `Conventions: ${cur.path} (${lineCount(text0)} lines)`,
@@ -6380,7 +6476,7 @@ async function conventionsStep(forge, address, change, opts) {
6380
6476
  })
6381
6477
  );
6382
6478
  if (how === "repo") return approve(host, projectPath, repoFile, "", null);
6383
- if (how === "suggest") return approve(host, projectPath, readFileSync13(suggestion, "utf8"), "", null);
6479
+ if (how === "suggest") return approve(host, projectPath, readFileSync14(suggestion, "utf8"), "", null);
6384
6480
  if (how === "editor") return approve(host, projectPath, "", "", null);
6385
6481
  if (how === "file") {
6386
6482
  const text0 = await pickConventionsFile();
@@ -6447,7 +6543,7 @@ async function pickConventionsFile() {
6447
6543
  const input = normalizePastedPath(raw, homedir2());
6448
6544
  if (!input) return null;
6449
6545
  const p = resolve(input);
6450
- if (!existsSync11(p)) {
6546
+ if (!existsSync12(p)) {
6451
6547
  log2.warn(`Not found: ${p}`);
6452
6548
  continue;
6453
6549
  }
@@ -6455,7 +6551,7 @@ async function pickConventionsFile() {
6455
6551
  log2.warn(`That's a folder, not a file: ${p}`);
6456
6552
  continue;
6457
6553
  }
6458
- const text0 = readFileSync13(p, "utf8");
6554
+ const text0 = readFileSync14(p, "utf8");
6459
6555
  if (text0.includes("\0")) {
6460
6556
  log2.warn("That looks like a binary file.");
6461
6557
  continue;
@@ -6507,7 +6603,7 @@ async function zonesStep(forge, address, change, opts) {
6507
6603
  return;
6508
6604
  }
6509
6605
  if (cur.path && (opts.zones === "edit" || !opts.zones)) {
6510
- const raw0 = readFileSync13(cur.path, "utf8");
6606
+ const raw0 = readFileSync14(cur.path, "utf8");
6511
6607
  if (opts.zones === "edit") return saveZonesLoop(host, projectPath, editInEditor(raw0, "zones.yaml"), cur.graph);
6512
6608
  const keep = await ask(
6513
6609
  select2({
@@ -6706,27 +6802,27 @@ function importEnv(env2, base) {
6706
6802
  }
6707
6803
 
6708
6804
  // local/legacyMigrate.ts
6709
- import { copyFileSync as copyFileSync2, existsSync as existsSync12, mkdirSync as mkdirSync10, writeFileSync as writeFileSync10 } from "node:fs";
6710
- import { join as join15 } from "node:path";
6805
+ import { copyFileSync as copyFileSync2, existsSync as existsSync13, mkdirSync as mkdirSync10, writeFileSync as writeFileSync10 } from "node:fs";
6806
+ import { join as join16 } from "node:path";
6711
6807
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
6712
- var MARKER = join15(DATA_DIR, ".legacy-migrated");
6808
+ var MARKER = join16(DATA_DIR, ".legacy-migrated");
6713
6809
  function migrateLegacyState(host, installRoot = INSTALL_ROOT) {
6714
- if (existsSync12(MARKER)) return [];
6810
+ if (existsSync13(MARKER)) return [];
6715
6811
  const copied = [];
6716
6812
  mkdirSync10(DATA_DIR, { recursive: true });
6717
- const legacyDb = join15(installRoot, "local", "data", "pr-score.db");
6718
- if (existsSync12(legacyDb) && !existsSync12(DB_PATH)) {
6813
+ const legacyDb = join16(installRoot, "local", "data", "pr-score.db");
6814
+ if (existsSync13(legacyDb) && !existsSync13(DB_PATH)) {
6719
6815
  const src = new DatabaseSync2(legacyDb);
6720
6816
  src.exec(`VACUUM INTO '${DB_PATH.replace(/'/g, "''")}'`);
6721
6817
  src.close();
6722
6818
  copied.push(DB_PATH);
6723
6819
  }
6724
- const legacySessions = join15(installRoot, "local", "data", "review-sessions.json");
6725
- if (existsSync12(legacySessions) && !existsSync12(SESSIONS_PATH)) {
6820
+ const legacySessions = join16(installRoot, "local", "data", "review-sessions.json");
6821
+ if (existsSync13(legacySessions) && !existsSync13(SESSIONS_PATH)) {
6726
6822
  copyFileSync2(legacySessions, SESSIONS_PATH);
6727
6823
  copied.push(SESSIONS_PATH);
6728
6824
  }
6729
- if (host && existsSync12(DB_PATH)) {
6825
+ if (host && existsSync13(DB_PATH)) {
6730
6826
  const db = new DatabaseSync2(DB_PATH);
6731
6827
  const hasProjects = !!db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'projects'").get();
6732
6828
  const projects = hasProjects ? db.prepare("SELECT path_with_namespace FROM projects").all() : [];
@@ -6734,13 +6830,13 @@ function migrateLegacyState(host, installRoot = INSTALL_ROOT) {
6734
6830
  for (const { path_with_namespace: path } of projects) {
6735
6831
  const slug = slugifyProjectPath(path);
6736
6832
  const pairs = [
6737
- [join15(installRoot, "conventions", `${slug}.md`), "conventions.md"],
6738
- [join15(installRoot, "zones", `${slug}.yaml`), "zones.yaml"],
6739
- [join15(installRoot, "zones", `${slug}.graph.json`), "zones.graph.json"]
6833
+ [join16(installRoot, "conventions", `${slug}.md`), "conventions.md"],
6834
+ [join16(installRoot, "zones", `${slug}.yaml`), "zones.yaml"],
6835
+ [join16(installRoot, "zones", `${slug}.graph.json`), "zones.graph.json"]
6740
6836
  ];
6741
6837
  for (const [from, name] of pairs) {
6742
- const to = join15(userProjectDir(host, path), name);
6743
- if (!existsSync12(from) || existsSync12(to)) continue;
6838
+ const to = join16(userProjectDir(host, path), name);
6839
+ if (!existsSync13(from) || existsSync13(to)) continue;
6744
6840
  mkdirSync10(userProjectDir(host, path), { recursive: true });
6745
6841
  copyFileSync2(from, to);
6746
6842
  copied.push(to);
@@ -6754,20 +6850,20 @@ function migrateLegacyState(host, installRoot = INSTALL_ROOT) {
6754
6850
 
6755
6851
  // local/zones/graph.ts
6756
6852
  import { execFileSync as execFileSync4 } from "node:child_process";
6757
- import { existsSync as existsSync13 } from "node:fs";
6758
- import { join as join16 } from "node:path";
6853
+ import { existsSync as existsSync14 } from "node:fs";
6854
+ import { join as join17 } from "node:path";
6759
6855
  import madge from "madge";
6760
6856
  var CODE_FILE = /\.[cm]?[jt]sx?$/;
6761
6857
  async function buildZoneGraph(repo, zones) {
6762
6858
  const git4 = (...args) => execFileSync4("git", ["-C", repo, ...args], { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 });
6763
6859
  const repoFiles = git4("ls-files").split("\n").filter((f) => CODE_FILE.test(f) && !f.endsWith(".d.ts"));
6764
- const tsConfig = join16(repo, "tsconfig.json");
6860
+ const tsConfig = join17(repo, "tsconfig.json");
6765
6861
  const result = await madge(
6766
- repoFiles.map((f) => join16(repo, f)),
6862
+ repoFiles.map((f) => join17(repo, f)),
6767
6863
  {
6768
6864
  baseDir: repo,
6769
6865
  fileExtensions: ["ts", "tsx", "js", "jsx", "mjs", "cjs"],
6770
- tsConfig: existsSync13(tsConfig) ? tsConfig : void 0,
6866
+ tsConfig: existsSync14(tsConfig) ? tsConfig : void 0,
6771
6867
  excludeRegExp: [/node_modules/],
6772
6868
  // Lazy routes (`import()`) are exactly what must NOT count as first-load; type-only
6773
6869
  // imports never reach the bundle.
@@ -6805,8 +6901,8 @@ async function runConfigCommand(args) {
6805
6901
  if (sub === "import-env") {
6806
6902
  if (!arg) throw new Error("Usage: yolont config import-env <path to .env>");
6807
6903
  const path = resolve2(arg);
6808
- if (!existsSync14(path)) throw new Error(`No env file at ${path}`);
6809
- const { config: next, secrets, skipped } = importEnv(parseEnv(readFileSync14(path, "utf8")), config);
6904
+ if (!existsSync15(path)) throw new Error(`No env file at ${path}`);
6905
+ const { config: next, secrets, skipped } = importEnv(parseEnv(readFileSync15(path, "utf8")), config);
6810
6906
  for (const [name, value] of Object.entries(secrets)) setSecret(name, value);
6811
6907
  saveConfig(next);
6812
6908
  console.log(`Wrote ${CONFIG_PATH}; ${Object.keys(secrets).length} secret(s) saved to ${secretBackend()}.`);
@@ -6828,7 +6924,7 @@ async function runConfigCommand(args) {
6828
6924
  return;
6829
6925
  }
6830
6926
  if (sub && sub !== "show") throw new Error("Usage: yolont config [show | import-env <path> | set-secret <name> | delete-secret <name>]");
6831
- console.log(`Config: ${CONFIG_PATH}${existsSync14(CONFIG_PATH) ? "" : " (not created yet)"}`);
6927
+ console.log(`Config: ${CONFIG_PATH}${existsSync15(CONFIG_PATH) ? "" : " (not created yet)"}`);
6832
6928
  console.log(`Secrets: ${secretBackend()}${secretBackend() === "keychain" ? "" : ` \u2014 ${CREDENTIALS_PATH}`}`);
6833
6929
  console.log("\nForges:");
6834
6930
  for (const f of config.forges) console.log(` ${f.host === config.defaultForge ? "*" : " "} ${f.host} ${f.type} ${forgeUrl(f)} token ${maskSecret(getSecret(`forge:${f.host}`))}`);
@@ -6841,6 +6937,11 @@ Jev: key ${maskSecret(getSecret("jev"))}${config.jev?.disabled ? " (disabled)" :
6841
6937
  async function main() {
6842
6938
  const [command, ...rest] = process.argv.slice(2);
6843
6939
  if (command === "config") return runConfigCommand(rest);
6940
+ if (command === "--version" || command === "-v" || command === "version") {
6941
+ const { ownVersion: ownVersion2 } = await Promise.resolve().then(() => (init_version(), version_exports));
6942
+ console.log(ownVersion2() ?? "unknown");
6943
+ return;
6944
+ }
6844
6945
  applyConfigToEnv(loadConfig());
6845
6946
  const sandboxed = !!(process.env.YOLONT_CONFIG_DIR || process.env.YOLONT_DATA_DIR);
6846
6947
  const migrated = sandboxed ? [] : migrateLegacyState(process.env.CI_SERVER_URL);
@@ -6965,7 +7066,7 @@ ${migrated.map((p) => ` ${p}`).join("\n")}`);
6965
7066
  console.log(`[zones] building import graph of ${values.repo} (can take a while on big repos)\u2026`);
6966
7067
  const graph = await buildZoneGraph(values.repo, zones);
6967
7068
  mkdirSync11(files.dir, { recursive: true });
6968
- const out = join17(files.dir, "zones.graph.json");
7069
+ const out = join18(files.dir, "zones.graph.json");
6969
7070
  writeFileSync11(out, `${JSON.stringify(graph, null, 2)}
6970
7071
  `);
6971
7072
  for (const [id, files2] of Object.entries(graph.reachable)) console.log(` ${id}: ${files2.length} file(s) reachable via import`);