yolont 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,29 +1,24 @@
1
1
  #!/usr/bin/env node
2
-
3
- // local/cli.ts
4
- import { existsSync as existsSync14 } from "node:fs";
5
- import { join as join17, resolve as resolve2 } from "node:path";
6
- import { parseArgs } from "node:util";
7
-
8
- // local/db/client.ts
9
- import { DatabaseSync } from "node:sqlite";
10
- import { mkdirSync, readFileSync } from "node:fs";
11
- import { dirname as dirname2, join as join2 } from "node:path";
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
+ };
12
16
 
13
17
  // local/paths.ts
14
18
  import { existsSync, renameSync } from "node:fs";
15
19
  import { homedir } from "node:os";
16
20
  import { dirname, join } from "node:path";
17
21
  import { fileURLToPath } from "node:url";
18
- var __dirname = dirname(fileURLToPath(import.meta.url));
19
- var INSTALL_ROOT = join(__dirname, "..");
20
- var DEFAULT_RUBRIC_PATH = join(INSTALL_ROOT, ".pr-reviewer", "rubric.yml");
21
- var BUILTIN_CONVENTIONS_DIR = join(INSTALL_ROOT, "conventions");
22
- var DEFAULT_CONVENTIONS_PATH = join(BUILTIN_CONVENTIONS_DIR, "default.md");
23
- var ZONE_TEMPLATES_DIR = join(INSTALL_ROOT, "templates", "zones");
24
- var env = process.env;
25
- var win = process.platform === "win32";
26
- for (const [k, v] of Object.entries(env)) if (k.startsWith("ETHOS_") && env[`YOLONT_${k.slice(6)}`] === void 0) env[`YOLONT_${k.slice(6)}`] = v;
27
22
  function adopt(base) {
28
23
  const dir = join(base, "yolont");
29
24
  const old = join(base, "ethos");
@@ -35,22 +30,171 @@ function adopt(base) {
35
30
  return old;
36
31
  }
37
32
  }
38
- var CONFIG_DIR = env.YOLONT_CONFIG_DIR ?? adopt(win ? env.APPDATA ?? join(homedir(), "AppData", "Roaming") : env.XDG_CONFIG_HOME || join(homedir(), ".config"));
39
- var DATA_DIR = env.YOLONT_DATA_DIR ?? adopt(win ? env.LOCALAPPDATA ?? join(homedir(), "AppData", "Local") : env.XDG_DATA_HOME || join(homedir(), ".local", "share"));
40
- var DB_PATH = join(DATA_DIR, "yolont.db");
41
- if (!existsSync(DB_PATH) && existsSync(join(DATA_DIR, "ethos.db"))) {
42
- for (const ext of ["", "-wal", "-shm"]) {
43
- const from = join(DATA_DIR, `ethos.db${ext}`);
44
- if (existsSync(from)) renameSync(from, `${DB_PATH}${ext}`);
45
- }
46
- }
47
- var SESSIONS_PATH = join(DATA_DIR, "sessions.json");
48
33
  function userProjectDir(host, pathWithNamespace) {
49
34
  return join(CONFIG_DIR, "projects", bareHost(host).replace(/:/g, "_"), ...pathWithNamespace.toLowerCase().split("/"));
50
35
  }
51
36
  function bareHost(hostOrUrl) {
52
37
  return (/^[a-z]+:\/\//i.test(hostOrUrl) ? new URL(hostOrUrl).host : hostOrUrl).toLowerCase();
53
38
  }
39
+ var __dirname, INSTALL_ROOT, DEFAULT_RUBRIC_PATH, BUILTIN_CONVENTIONS_DIR, DEFAULT_CONVENTIONS_PATH, ZONE_TEMPLATES_DIR, env, win, CONFIG_DIR, DATA_DIR, DB_PATH, SESSIONS_PATH;
40
+ var init_paths = __esm({
41
+ "local/paths.ts"() {
42
+ "use strict";
43
+ __dirname = dirname(fileURLToPath(import.meta.url));
44
+ INSTALL_ROOT = join(__dirname, "..");
45
+ DEFAULT_RUBRIC_PATH = join(INSTALL_ROOT, ".pr-reviewer", "rubric.yml");
46
+ BUILTIN_CONVENTIONS_DIR = join(INSTALL_ROOT, "conventions");
47
+ DEFAULT_CONVENTIONS_PATH = join(BUILTIN_CONVENTIONS_DIR, "default.md");
48
+ ZONE_TEMPLATES_DIR = join(INSTALL_ROOT, "templates", "zones");
49
+ env = process.env;
50
+ win = process.platform === "win32";
51
+ for (const [k, v] of Object.entries(env)) if (k.startsWith("ETHOS_") && env[`YOLONT_${k.slice(6)}`] === void 0) env[`YOLONT_${k.slice(6)}`] = v;
52
+ CONFIG_DIR = env.YOLONT_CONFIG_DIR ?? adopt(win ? env.APPDATA ?? join(homedir(), "AppData", "Roaming") : env.XDG_CONFIG_HOME || join(homedir(), ".config"));
53
+ DATA_DIR = env.YOLONT_DATA_DIR ?? adopt(win ? env.LOCALAPPDATA ?? join(homedir(), "AppData", "Local") : env.XDG_DATA_HOME || join(homedir(), ".local", "share"));
54
+ DB_PATH = join(DATA_DIR, "yolont.db");
55
+ if (!existsSync(DB_PATH) && existsSync(join(DATA_DIR, "ethos.db"))) {
56
+ for (const ext of ["", "-wal", "-shm"]) {
57
+ const from = join(DATA_DIR, `ethos.db${ext}`);
58
+ if (existsSync(from)) renameSync(from, `${DB_PATH}${ext}`);
59
+ }
60
+ }
61
+ SESSIONS_PATH = join(DATA_DIR, "sessions.json");
62
+ }
63
+ });
64
+
65
+ // local/setup/gitleaks.ts
66
+ var gitleaks_exports = {};
67
+ __export(gitleaks_exports, {
68
+ GITLEAKS_VERSION: () => GITLEAKS_VERSION,
69
+ LOCAL_GITLEAKS: () => LOCAL_GITLEAKS,
70
+ gitleaksAsset: () => gitleaksAsset,
71
+ gitleaksWorks: () => gitleaksWorks,
72
+ installGitleaks: () => installGitleaks,
73
+ useLocalGitleaks: () => useLocalGitleaks
74
+ });
75
+ import { spawnSync } from "node:child_process";
76
+ import { createHash } from "node:crypto";
77
+ import { chmodSync as chmodSync2, copyFileSync as copyFileSync2, existsSync as existsSync11, mkdirSync as mkdirSync10, mkdtempSync, rmSync as rmSync3, writeFileSync as writeFileSync9 } from "node:fs";
78
+ import { tmpdir as tmpdir2 } from "node:os";
79
+ import { join as join14 } from "node:path";
80
+ function useLocalGitleaks(env2 = process.env) {
81
+ if (!env2.YOLONT_GITLEAKS && existsSync11(LOCAL_GITLEAKS)) env2.YOLONT_GITLEAKS = LOCAL_GITLEAKS;
82
+ }
83
+ function gitleaksAsset(platform = process.platform, arch = process.arch) {
84
+ const os = platform === "win32" ? "windows" : platform;
85
+ const key2 = `${os}_${arch === "x64" ? "x64" : arch === "arm64" ? "arm64" : arch}`;
86
+ const sha256 = SHA256[key2];
87
+ return sha256 ? { name: `gitleaks_${GITLEAKS_VERSION}_${key2}.${os === "windows" ? "zip" : "tar.gz"}`, sha256 } : void 0;
88
+ }
89
+ async function installGitleaks() {
90
+ const asset = gitleaksAsset();
91
+ if (!asset) throw new Error(`No official gitleaks build for ${process.platform}/${process.arch}.`);
92
+ const res = await fetch(`https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/${asset.name}`, { signal: AbortSignal.timeout(12e4) });
93
+ if (!res.ok) throw new Error(`Download failed: HTTP ${res.status}`);
94
+ const bytes = Buffer.from(await res.arrayBuffer());
95
+ const got = createHash("sha256").update(bytes).digest("hex");
96
+ if (got !== asset.sha256) throw new Error(`Checksum mismatch for ${asset.name} (got ${got}). Not installed.`);
97
+ const dir = mkdtempSync(join14(tmpdir2(), "yolont-gitleaks-dl-"));
98
+ try {
99
+ const archive = join14(dir, asset.name);
100
+ writeFileSync9(archive, bytes);
101
+ const exe = win2 ? "gitleaks.exe" : "gitleaks";
102
+ const tar = spawnSync("tar", ["-xf", archive, "-C", dir, exe], { stdio: "ignore" });
103
+ if (tar.status !== 0 || !existsSync11(join14(dir, exe))) throw new Error("Couldn't unpack the archive (is `tar` installed?).");
104
+ mkdirSync10(join14(DATA_DIR, "bin"), { recursive: true });
105
+ copyFileSync2(join14(dir, exe), LOCAL_GITLEAKS);
106
+ if (!win2) chmodSync2(LOCAL_GITLEAKS, 493);
107
+ } finally {
108
+ rmSync3(dir, { recursive: true, force: true });
109
+ }
110
+ process.env.YOLONT_GITLEAKS = LOCAL_GITLEAKS;
111
+ return LOCAL_GITLEAKS;
112
+ }
113
+ var GITLEAKS_VERSION, SHA256, win2, LOCAL_GITLEAKS, gitleaksWorks;
114
+ var init_gitleaks = __esm({
115
+ "local/setup/gitleaks.ts"() {
116
+ "use strict";
117
+ init_paths();
118
+ GITLEAKS_VERSION = "8.30.1";
119
+ SHA256 = {
120
+ darwin_arm64: "b40ab0ae55c505963e365f271a8d3846efbc170aa17f2607f13df610a9aeb6a5",
121
+ darwin_x64: "dfe101a4db2255fc85120ac7f3d25e4342c3c20cf749f2c20a18081af1952709",
122
+ linux_arm64: "e4a487ee7ccd7d3a7f7ec08657610aa3606637dab924210b3aee62570fb4b080",
123
+ linux_x64: "551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb",
124
+ windows_arm64: "b95f5e4f5c425cedca7ee203d9afd29597e692c4924a12ed42f970537c72cc0f",
125
+ windows_x64: "d29144deff3a68aa93ced33dddf84b7fdc26070add4aa0f4513094c8332afc4e"
126
+ };
127
+ win2 = process.platform === "win32";
128
+ LOCAL_GITLEAKS = join14(DATA_DIR, "bin", win2 ? "gitleaks.exe" : "gitleaks");
129
+ gitleaksWorks = () => spawnSync(process.env.YOLONT_GITLEAKS || "gitleaks", ["version"], { stdio: "ignore" }).status === 0;
130
+ }
131
+ });
132
+
133
+ // local/setup/version.ts
134
+ var version_exports = {};
135
+ __export(version_exports, {
136
+ installKind: () => installKind,
137
+ installLatest: () => installLatest,
138
+ isNewer: () => isNewer,
139
+ latestVersion: () => latestVersion,
140
+ ownVersion: () => ownVersion
141
+ });
142
+ import { spawnSync as spawnSync2 } from "node:child_process";
143
+ import { existsSync as existsSync12, readFileSync as readFileSync13 } from "node:fs";
144
+ import { dirname as dirname7, join as join15 } from "node:path";
145
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
146
+ function ownVersion(from = dirname7(fileURLToPath2(import.meta.url))) {
147
+ for (let dir = from, i = 0; i < 5; dir = dirname7(dir), i++) {
148
+ const file = join15(dir, "package.json");
149
+ if (!existsSync12(file)) continue;
150
+ try {
151
+ const pkg = JSON.parse(readFileSync13(file, "utf8"));
152
+ if (pkg.name === "yolont") return pkg.version;
153
+ } catch {
154
+ }
155
+ }
156
+ return void 0;
157
+ }
158
+ function isNewer(latest, current) {
159
+ const parts = (v) => v.split(/[-+]/)[0].split(".").map((n) => Number(n) || 0);
160
+ const [a, b] = [parts(latest), parts(current)];
161
+ for (let i = 0; i < 3; i++) if ((a[i] ?? 0) !== (b[i] ?? 0)) return (a[i] ?? 0) > (b[i] ?? 0);
162
+ return false;
163
+ }
164
+ async function latestVersion(timeoutMs = 1500) {
165
+ if (process.env.YOLONT_NO_UPDATE_CHECK || process.env.CI) return void 0;
166
+ try {
167
+ const res = await fetch("https://registry.npmjs.org/yolont/latest", { signal: AbortSignal.timeout(timeoutMs) });
168
+ if (!res.ok) return void 0;
169
+ return (await res.json()).version;
170
+ } catch {
171
+ return void 0;
172
+ }
173
+ }
174
+ function installKind(script = process.argv[1] ?? "") {
175
+ if (/[\\/]_npx[\\/]/.test(script)) return "npx";
176
+ if (/[\\/]node_modules[\\/]yolont[\\/]/.test(script) || /[\\/]bin[\\/]yolont$/.test(script)) return "npm";
177
+ return "source";
178
+ }
179
+ function installLatest(version) {
180
+ return spawnSync2("npm", ["install", "-g", `yolont@${version}`], { stdio: "inherit", shell: process.platform === "win32" }).status === 0;
181
+ }
182
+ var init_version = __esm({
183
+ "local/setup/version.ts"() {
184
+ "use strict";
185
+ }
186
+ });
187
+
188
+ // local/cli.ts
189
+ import { existsSync as existsSync16 } from "node:fs";
190
+ import { join as join19, resolve as resolve2 } from "node:path";
191
+ import { parseArgs } from "node:util";
192
+
193
+ // local/db/client.ts
194
+ init_paths();
195
+ import { DatabaseSync } from "node:sqlite";
196
+ import { mkdirSync, readFileSync } from "node:fs";
197
+ import { dirname as dirname2, join as join2 } from "node:path";
54
198
 
55
199
  // src/rubric/schema.ts
56
200
  import { z } from "zod";
@@ -166,6 +310,7 @@ function clamp(value, min, max) {
166
310
  }
167
311
 
168
312
  // local/db/repo.ts
313
+ init_paths();
169
314
  var DEFAULT_PENALTIES = SeverityPenaltiesSchema.parse({});
170
315
  function upsertProject(db, project2) {
171
316
  const row = db.prepare(
@@ -782,13 +927,36 @@ import { tmpdir } from "node:os";
782
927
  import { join as join3 } from "node:path";
783
928
  import { promisify } from "node:util";
784
929
  var execFileAsync = promisify(execFile);
930
+ function locateInDiff(diffText, patchLine) {
931
+ let file = "(diff)";
932
+ let oldLine = 0;
933
+ let newLine = 0;
934
+ const lines = diffText.split("\n");
935
+ for (let i = 0; i < Math.min(patchLine, lines.length); i++) {
936
+ const l = lines[i];
937
+ const hunk = /^@@ -(\d+)(?:,\d+)? \+(\d+)/.exec(l);
938
+ const isLast = i === patchLine - 1;
939
+ if (l.startsWith("diff --git ")) file = l.replace(/^diff --git a\/.* b\//, "");
940
+ else if (l.startsWith("+++ ") && l !== "+++ /dev/null") file = l.slice(4).replace(/^b\//, "");
941
+ else if (hunk) [oldLine, newLine] = [Number(hunk[1]), Number(hunk[2])];
942
+ else if (l.startsWith("-") && !l.startsWith("--- ")) {
943
+ if (isLast) return { file, line: oldLine };
944
+ oldLine++;
945
+ } else if (l.startsWith("+") || l.startsWith(" ")) {
946
+ if (isLast) return { file, line: newLine };
947
+ newLine++;
948
+ if (l.startsWith(" ")) oldLine++;
949
+ }
950
+ }
951
+ return { file, line: 0 };
952
+ }
785
953
  async function scanDiffForSecrets(diffText) {
786
954
  const dir = await mkdtemp(join3(tmpdir(), "yolont-gitleaks-"));
787
955
  const sourceFile = join3(dir, "diff.patch");
788
956
  const reportFile = join3(dir, "report.json");
789
957
  try {
790
958
  await writeFile(sourceFile, diffText, "utf8");
791
- await execFileAsync("gitleaks", [
959
+ await execFileAsync(process.env.YOLONT_GITLEAKS || "gitleaks", [
792
960
  "detect",
793
961
  "--no-git",
794
962
  "--source",
@@ -805,8 +973,7 @@ async function scanDiffForSecrets(diffText) {
805
973
  const entries = raw.trim().length > 0 ? JSON.parse(raw) : [];
806
974
  const findings = entries.map((e) => ({
807
975
  ruleId: e.RuleID ?? "unknown-rule",
808
- file: e.File ?? sourceFile,
809
- line: e.StartLine ?? 0,
976
+ ...locateInDiff(diffText, e.StartLine ?? 0),
810
977
  description: e.Description ?? "Potential secret detected"
811
978
  }));
812
979
  return { score: findings.length === 0 ? 100 : 0, findings, scannerFailed: false };
@@ -1940,6 +2107,7 @@ function nodeId(zoneId) {
1940
2107
  }
1941
2108
 
1942
2109
  // local/conventions/resolve.ts
2110
+ init_paths();
1943
2111
  import { execFileSync } from "node:child_process";
1944
2112
  import { existsSync as existsSync6, readdirSync as readdirSync2 } from "node:fs";
1945
2113
  import { join as join8 } from "node:path";
@@ -2540,12 +2708,14 @@ async function probeForgeType(host, fetchImpl = fetch) {
2540
2708
  }
2541
2709
 
2542
2710
  // local/config/config.ts
2711
+ init_paths();
2543
2712
  import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
2544
2713
  import { dirname as dirname4, join as join5 } from "node:path";
2545
2714
  import yaml3 from "js-yaml";
2546
2715
  import { z as z5 } from "zod";
2547
2716
 
2548
2717
  // local/config/secrets.ts
2718
+ init_paths();
2549
2719
  import { createCipheriv, createDecipheriv, randomBytes, scryptSync } from "node:crypto";
2550
2720
  import { chmodSync, existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync } from "node:fs";
2551
2721
  import { createRequire } from "node:module";
@@ -2757,7 +2927,11 @@ function reapplyConfigToEnv(env2 = process.env) {
2757
2927
  return applyConfigToEnv(loadConfig(), env2);
2758
2928
  }
2759
2929
 
2930
+ // local/sync/source.ts
2931
+ init_paths();
2932
+
2760
2933
  // local/forge.ts
2934
+ init_paths();
2761
2935
  function envToken(type, host, env2) {
2762
2936
  if (type === "gitlab") return env2.CI_SERVER_URL && bareHost(env2.CI_SERVER_URL) === host ? env2.GITLAB_API_TOKEN : void 0;
2763
2937
  return host === "github.com" ? env2.GITHUB_TOKEN || env2.GH_TOKEN || void 0 : void 0;
@@ -3610,6 +3784,7 @@ function resolveProjectFiles(host, pathWithNamespace, cwd) {
3610
3784
  }
3611
3785
 
3612
3786
  // local/mining/backfill.ts
3787
+ init_paths();
3613
3788
  async function runBackfill(opts) {
3614
3789
  const db = openDb();
3615
3790
  const client = opts.forge;
@@ -3993,7 +4168,11 @@ function leastSquaresSlope(values) {
3993
4168
  return denominator === 0 ? 0 : numerator / denominator;
3994
4169
  }
3995
4170
 
4171
+ // local/review/interactiveReview.ts
4172
+ init_paths();
4173
+
3996
4174
  // local/review/sessionCache.ts
4175
+ init_paths();
3997
4176
  import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync8, writeFileSync as writeFileSync5 } from "node:fs";
3998
4177
  import { dirname as dirname6 } from "node:path";
3999
4178
  var MAX_SESSIONS = 3;
@@ -4125,8 +4304,18 @@ async function runInteractiveReview(opts) {
4125
4304
  s.stop(
4126
4305
  secretsResult.scannerFailed ? "gitleaks failed to run" : secretsResult.findings.length > 0 ? `${secretsResult.findings.length} potential secret(s) found` : "clean"
4127
4306
  );
4128
- if (secretsBlocked) {
4129
- log.warn("Secrets check flagged this diff (or the scanner failed) \u2014 LLM will be skipped, same fail-closed policy as CI.");
4307
+ if (secretsResult.scannerFailed) {
4308
+ log.warn(
4309
+ `gitleaks couldn't run: ${secretsResult.scannerError}
4310
+ Install or update it (v8+): https://github.com/gitleaks/gitleaks#installing \u2014 the LLM is skipped until it runs (fail-closed, same as CI).`
4311
+ );
4312
+ } else if (secretsResult.findings.length > 0) {
4313
+ const list = secretsResult.findings.map((f) => ` ${f.file}:${f.line} ${f.ruleId} (${f.description})`).join("\n");
4314
+ log.warn(
4315
+ `gitleaks flagged these lines, so the LLM is skipped (fail-closed, same as CI):
4316
+ ${list}
4317
+ Not a real secret (a test fixture, a hash)? Add a \`gitleaks:allow\` comment on that line and push again.`
4318
+ );
4130
4319
  }
4131
4320
  if (typeMode === "label") {
4132
4321
  const h = hintFromMr(mr);
@@ -4566,6 +4755,7 @@ async function runSyncReplies(opts) {
4566
4755
 
4567
4756
  // local/backoffice/server.ts
4568
4757
  import fastifyStatic from "@fastify/static";
4758
+ init_paths();
4569
4759
  import Fastify from "fastify";
4570
4760
  import { randomBytes as randomBytes3, timingSafeEqual } from "node:crypto";
4571
4761
  import { join as join13 } from "node:path";
@@ -4620,6 +4810,7 @@ import { existsSync as existsSync10, readFileSync as readFileSync12 } from "node
4620
4810
  import { execFileSync as execFileSync2 } from "node:child_process";
4621
4811
  import { existsSync as existsSync8, lstatSync, mkdirSync as mkdirSync7, readdirSync as readdirSync3, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "node:fs";
4622
4812
  import { join as join10 } from "node:path";
4813
+ init_paths();
4623
4814
  var DEFAULT_CONVENTIONS_MAX_LINES = 300;
4624
4815
  var conventionsMaxLines = () => loadConfig().conventionsMaxLines ?? DEFAULT_CONVENTIONS_MAX_LINES;
4625
4816
  var targetLines = () => Math.floor(conventionsMaxLines() * 0.8);
@@ -4892,10 +5083,14 @@ function currentConventions(host, path) {
4892
5083
  return { path: p, fromRepo: !!p && !p.startsWith(projectSettingsDir(host, path)) };
4893
5084
  }
4894
5085
 
5086
+ // local/backoffice/settings.ts
5087
+ init_paths();
5088
+
4895
5089
  // local/setup/state.ts
4896
5090
  import { existsSync as existsSync9, mkdirSync as mkdirSync8, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "node:fs";
4897
5091
  import { join as join11 } from "node:path";
4898
5092
  import yaml5 from "js-yaml";
5093
+ init_paths();
4899
5094
  var statePath = (host, path) => join11(userProjectDir(host, path), "setup.yaml");
4900
5095
  function readSetupState(host, path) {
4901
5096
  const p = statePath(host, path);
@@ -5041,6 +5236,7 @@ function currentWeights(host, path) {
5041
5236
  import { mkdirSync as mkdirSync9, readFileSync as readFileSync11, writeFileSync as writeFileSync8 } from "node:fs";
5042
5237
  import { join as join12 } from "node:path";
5043
5238
  import yaml6 from "js-yaml";
5239
+ init_paths();
5044
5240
  function templatesFor(stack) {
5045
5241
  const ids = [];
5046
5242
  if (stack.includes("nextjs")) ids.push("nextjs");
@@ -5602,12 +5798,12 @@ async function startDashboard(opts = {}) {
5602
5798
  }
5603
5799
 
5604
5800
  // local/cli.ts
5605
- import { mkdirSync as mkdirSync11, readFileSync as readFileSync14, writeFileSync as writeFileSync11 } from "node:fs";
5801
+ import { mkdirSync as mkdirSync12, readFileSync as readFileSync15, writeFileSync as writeFileSync12 } from "node:fs";
5606
5802
  import { parseEnv } from "node:util";
5607
5803
  import { password as password2 } from "@clack/prompts";
5608
5804
 
5609
5805
  // local/setup/wizard.ts
5610
- import { execFileSync as execFileSync3, spawnSync } from "node:child_process";
5806
+ import { execFileSync as execFileSync3, spawnSync as spawnSync3 } from "node:child_process";
5611
5807
 
5612
5808
  // local/setup/ui.ts
5613
5809
  import pc2 from "picocolors";
@@ -5687,12 +5883,15 @@ function panel(title, rows) {
5687
5883
  }
5688
5884
 
5689
5885
  // local/setup/wizard.ts
5690
- import { existsSync as existsSync11, mkdtempSync, readFileSync as readFileSync13, rmSync as rmSync3, statSync, writeFileSync as writeFileSync9 } from "node:fs";
5691
- import { homedir as homedir2, tmpdir as tmpdir2, userInfo as userInfo2 } from "node:os";
5886
+ import { existsSync as existsSync13, mkdtempSync as mkdtempSync2, readFileSync as readFileSync14, rmSync as rmSync4, statSync, writeFileSync as writeFileSync10 } from "node:fs";
5887
+ import { homedir as homedir2, tmpdir as tmpdir3, userInfo as userInfo2 } from "node:os";
5692
5888
  import { emitKeypressEvents } from "node:readline";
5693
- import { join as join14, resolve } from "node:path";
5889
+ import { join as join16, resolve } from "node:path";
5694
5890
  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
5891
  import pc3 from "picocolors";
5892
+ init_paths();
5893
+ init_gitleaks();
5894
+ init_version();
5696
5895
  var Cancelled = class extends Error {
5697
5896
  };
5698
5897
  var Back = class extends Error {
@@ -5744,8 +5943,11 @@ function originAddress() {
5744
5943
  }
5745
5944
  var gitlabBases2 = () => loadConfig().forges.filter((f) => f.type === "gitlab" && f.url).map(forgeUrl);
5746
5945
  async function runSetup(opts) {
5747
- header("PR reviews that look twice \xB7 Esc = back \xB7 Ctrl-C = quit");
5946
+ const version = ownVersion();
5947
+ latestCheck = latestVersion();
5948
+ header(`${version ? `v${version} \xB7 ` : ""}PR reviews that look twice \xB7 Esc = back \xB7 Ctrl-C = quit`);
5748
5949
  await offerInstallOnce();
5950
+ await ensureGitleaks();
5749
5951
  await askIconsOnce();
5750
5952
  intro2(opts.review ? "Yolont" : "Yolont setup");
5751
5953
  trackKeys();
@@ -5804,14 +6006,32 @@ async function reviewThenCheckQuit(ctx, mrIid) {
5804
6006
  if (lastKey === "ctrl-c") throw new Cancelled();
5805
6007
  }
5806
6008
  var STEP_ICONS = { forge: "git", llm: "llm", conventions: "conventions", zones: "zones", weights: "weights" };
5807
- var runningFromNpx = (script = process.argv[1] ?? "") => /[\\/]_npx[\\/]/.test(script);
6009
+ var runningFromNpx = (script = process.argv[1] ?? "") => installKind(script) === "npx";
6010
+ var latestCheck = Promise.resolve(void 0);
6011
+ async function newerVersion() {
6012
+ const [current, latest] = [ownVersion(), await Promise.race([latestCheck, new Promise((r) => setTimeout(() => r(void 0), 300))])];
6013
+ return current && latest && isNewer(latest, current) ? latest : void 0;
6014
+ }
6015
+ async function updateMenu(latest) {
6016
+ const kind = installKind();
6017
+ if (kind === "source") {
6018
+ 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}`)}`);
6019
+ return;
6020
+ }
6021
+ if (kind === "npx") {
6022
+ log2.info(`Run ${pc3.bold("npx yolont@latest")} next time, or install it once: ${pc3.bold(`npm install -g yolont@${latest}`)}`);
6023
+ return;
6024
+ }
6025
+ if (!await ask(confirm2({ message: `Update to v${latest}? (npm install -g yolont@${latest})`, initialValue: true }))) return;
6026
+ if (installLatest(latest)) {
6027
+ outro2(`Updated to v${latest}. Run ${pc3.bold("yolont")} again to use it.`);
6028
+ process.exit(0);
6029
+ }
6030
+ log2.warn("npm couldn't update it (often a permissions issue): https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally");
6031
+ }
5808
6032
  async function offerInstallOnce() {
5809
6033
  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
- }
6034
+ const version = ownVersion() ?? "latest";
5815
6035
  const ok = await confirm2({ message: `Install the \`yolont\` command, so next time you just type \`yolont\`? (npm install -g yolont@${version})`, initialValue: true });
5816
6036
  if (isCancel2(ok)) return;
5817
6037
  saveConfig({ ...loadConfig(), installOffered: true });
@@ -5819,13 +6039,37 @@ async function offerInstallOnce() {
5819
6039
  log2.info(pc3.dim("OK. Install it any time with `npm install -g yolont`."));
5820
6040
  return;
5821
6041
  }
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).`);
6042
+ if (installLatest(version)) log2.success(`Installed. From now on run ${pc3.bold("yolont")} (no npx).`);
5824
6043
  else
5825
6044
  log2.warn(
5826
6045
  `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`
5827
6046
  );
5828
6047
  }
6048
+ async function ensureGitleaks() {
6049
+ if (gitleaksWorks() || !process.stdout.isTTY) return;
6050
+ const help = "https://github.com/gitleaks/gitleaks#installing";
6051
+ if (!gitleaksAsset()) {
6052
+ log2.warn(`gitleaks (the secret scanner) isn't installed, so reviews will skip the LLM. Install it: ${help}`);
6053
+ return;
6054
+ }
6055
+ const ok = await confirm2({
6056
+ message: `gitleaks (the secret scanner) isn't installed. Without it, reviews never reach the LLM. Download the official v${GITLEAKS_VERSION} (checksum-verified) into ${LOCAL_GITLEAKS}?`,
6057
+ initialValue: true
6058
+ });
6059
+ if (isCancel2(ok) || !ok) {
6060
+ log2.warn(`Reviews will skip the LLM until gitleaks is installed: ${help}`);
6061
+ return;
6062
+ }
6063
+ const s = spinner2();
6064
+ s.start(`Downloading gitleaks v${GITLEAKS_VERSION}`);
6065
+ try {
6066
+ await installGitleaks();
6067
+ s.stop(gitleaksWorks() ? `gitleaks v${GITLEAKS_VERSION} installed.` : pc3.yellow("Downloaded, but it doesn't run on this machine."));
6068
+ } catch (err) {
6069
+ s.stop(pc3.red(`gitleaks install failed: ${describeFetchError(err)}`));
6070
+ log2.warn(`Install it yourself: ${help}`);
6071
+ }
6072
+ }
5829
6073
  async function askIconsOnce() {
5830
6074
  if (loadConfig().icons || !process.stdout.isTTY) return;
5831
6075
  const ok = await confirm2({ message: `Do these look like icons (not boxes or "?")? ${iconSample()}`, initialValue: true });
@@ -5833,19 +6077,21 @@ async function askIconsOnce() {
5833
6077
  saveConfig({ ...loadConfig(), icons: ok ? "nerd" : "plain" });
5834
6078
  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
6079
  }
5836
- function statusPanel(ctx, teamLabel) {
6080
+ function statusPanel(ctx, teamLabel, latest) {
5837
6081
  const config = loadConfig();
5838
6082
  const llm = config.llmProfiles.find((p) => p.name === config.defaultLlmProfile);
5839
6083
  panel("Yolont", [
5840
6084
  [`${icon(ctx.forge.type === "github" ? "github" : "gitlab")}Project`, `${pc3.bold(ctx.address.projectPath)} ${pc3.dim(`\xB7 ${ctx.address.host}`)}`],
5841
6085
  [`${icon("llm")}LLM`, llm ? `${llm.name} ${pc3.dim(`\xB7 ${llm.model}`)}` : pc3.yellow("not set")],
5842
6086
  [`${icon("memory")}Memory`, teamLabel.replace(/^Memory repo( · )?/, "") || "\u2014"],
5843
- [`${icon("type")}Change type`, CHANGE_TYPE_MODES[config.changeType ?? "label"].label]
6087
+ [`${icon("type")}Change type`, CHANGE_TYPE_MODES[config.changeType ?? "label"].label],
6088
+ [`${icon("sync")}Version`, `v${ownVersion() ?? "?"}${latest ? pc3.yellow(` \xB7 v${latest} is out`) : ""}`]
5844
6089
  ]);
5845
6090
  }
5846
6091
  var STEP_LABELS = { forge: "Git host & token", llm: "LLM", conventions: "Conventions", zones: "Zones", weights: "Scoring weights" };
5847
6092
  async function mainMenu(ctx, opts) {
5848
- statusPanel(ctx, await teamMenuLabel(ctx.address));
6093
+ const latest = await newerVersion();
6094
+ statusPanel(ctx, await teamMenuLabel(ctx.address), latest);
5849
6095
  for (; ; ) {
5850
6096
  const missing = missingSteps({ host: ctx.address.host, projectPath: ctx.address.projectPath });
5851
6097
  const teamLabel = await teamMenuLabel(ctx.address);
@@ -5856,6 +6102,7 @@ async function mainMenu(ctx, opts) {
5856
6102
  message: `${ctx.address.projectPath} \xB7 ${ctx.address.host}`,
5857
6103
  options: [
5858
6104
  { value: "review", label: `${icon("review")}${pc3.bold("Review an open MR/PR")}` },
6105
+ ...latest ? [{ value: "update", label: pc3.yellow(`${icon("sync")}Update to v${latest}`), hint: `you have v${ownVersion()}` }] : [],
5859
6106
  ...Object.keys(STEP_LABELS).map((s) => ({
5860
6107
  value: s,
5861
6108
  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 +6119,10 @@ async function mainMenu(ctx, opts) {
5872
6119
  throw err;
5873
6120
  }
5874
6121
  if (choice === "exit") return;
6122
+ if (choice === "update") {
6123
+ await orBack(() => updateMenu(latest));
6124
+ continue;
6125
+ }
5875
6126
  if (choice === "remove") {
5876
6127
  await orBack(() => removeMenu(ctx.address));
5877
6128
  continue;
@@ -6305,16 +6556,16 @@ async function testOrConfirm(profile, key2) {
6305
6556
  }
6306
6557
  }
6307
6558
  function editInEditor(initial, name = "conventions.md") {
6308
- const dir = mkdtempSync(join14(tmpdir2(), "yolont-edit-"));
6309
- const file = join14(dir, name);
6559
+ const dir = mkdtempSync2(join16(tmpdir3(), "yolont-edit-"));
6560
+ const file = join16(dir, name);
6310
6561
  try {
6311
- writeFileSync9(file, initial);
6562
+ writeFileSync10(file, initial);
6312
6563
  const editor = process.env.VISUAL || process.env.EDITOR || "vi";
6313
- const r = spawnSync(`${editor} "${file}"`, { stdio: "inherit", shell: true });
6564
+ const r = spawnSync3(`${editor} "${file}"`, { stdio: "inherit", shell: true });
6314
6565
  if (r.status !== 0) log2.warn(`${editor} exited with ${r.status ?? r.signal}; keeping what was saved.`);
6315
- return readFileSync13(file, "utf8");
6566
+ return readFileSync14(file, "utf8");
6316
6567
  } finally {
6317
- rmSync3(dir, { recursive: true, force: true });
6568
+ rmSync4(dir, { recursive: true, force: true });
6318
6569
  }
6319
6570
  }
6320
6571
  function llmOrNull2() {
@@ -6345,9 +6596,9 @@ async function conventionsStep(forge, address, change, opts) {
6345
6596
  log2.info(`Conventions come from the repo's ${cur.path} \u2014 edit them there (it's what CI uses too).`);
6346
6597
  return;
6347
6598
  }
6348
- if (cur.path && opts.conventions === "edit") return approve(host, projectPath, editInEditor(readFileSync13(cur.path, "utf8")), "", null);
6599
+ if (cur.path && opts.conventions === "edit") return approve(host, projectPath, editInEditor(readFileSync14(cur.path, "utf8")), "", null);
6349
6600
  if (cur.path && !opts.conventions) {
6350
- const text0 = readFileSync13(cur.path, "utf8");
6601
+ const text0 = readFileSync14(cur.path, "utf8");
6351
6602
  const keep = await ask(
6352
6603
  select2({
6353
6604
  message: `Conventions: ${cur.path} (${lineCount(text0)} lines)`,
@@ -6380,7 +6631,7 @@ async function conventionsStep(forge, address, change, opts) {
6380
6631
  })
6381
6632
  );
6382
6633
  if (how === "repo") return approve(host, projectPath, repoFile, "", null);
6383
- if (how === "suggest") return approve(host, projectPath, readFileSync13(suggestion, "utf8"), "", null);
6634
+ if (how === "suggest") return approve(host, projectPath, readFileSync14(suggestion, "utf8"), "", null);
6384
6635
  if (how === "editor") return approve(host, projectPath, "", "", null);
6385
6636
  if (how === "file") {
6386
6637
  const text0 = await pickConventionsFile();
@@ -6447,7 +6698,7 @@ async function pickConventionsFile() {
6447
6698
  const input = normalizePastedPath(raw, homedir2());
6448
6699
  if (!input) return null;
6449
6700
  const p = resolve(input);
6450
- if (!existsSync11(p)) {
6701
+ if (!existsSync13(p)) {
6451
6702
  log2.warn(`Not found: ${p}`);
6452
6703
  continue;
6453
6704
  }
@@ -6455,7 +6706,7 @@ async function pickConventionsFile() {
6455
6706
  log2.warn(`That's a folder, not a file: ${p}`);
6456
6707
  continue;
6457
6708
  }
6458
- const text0 = readFileSync13(p, "utf8");
6709
+ const text0 = readFileSync14(p, "utf8");
6459
6710
  if (text0.includes("\0")) {
6460
6711
  log2.warn("That looks like a binary file.");
6461
6712
  continue;
@@ -6507,7 +6758,7 @@ async function zonesStep(forge, address, change, opts) {
6507
6758
  return;
6508
6759
  }
6509
6760
  if (cur.path && (opts.zones === "edit" || !opts.zones)) {
6510
- const raw0 = readFileSync13(cur.path, "utf8");
6761
+ const raw0 = readFileSync14(cur.path, "utf8");
6511
6762
  if (opts.zones === "edit") return saveZonesLoop(host, projectPath, editInEditor(raw0, "zones.yaml"), cur.graph);
6512
6763
  const keep = await ask(
6513
6764
  select2({
@@ -6706,27 +6957,28 @@ function importEnv(env2, base) {
6706
6957
  }
6707
6958
 
6708
6959
  // 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";
6960
+ import { copyFileSync as copyFileSync3, existsSync as existsSync14, mkdirSync as mkdirSync11, writeFileSync as writeFileSync11 } from "node:fs";
6961
+ import { join as join17 } from "node:path";
6711
6962
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
6712
- var MARKER = join15(DATA_DIR, ".legacy-migrated");
6963
+ init_paths();
6964
+ var MARKER = join17(DATA_DIR, ".legacy-migrated");
6713
6965
  function migrateLegacyState(host, installRoot = INSTALL_ROOT) {
6714
- if (existsSync12(MARKER)) return [];
6966
+ if (existsSync14(MARKER)) return [];
6715
6967
  const copied = [];
6716
- mkdirSync10(DATA_DIR, { recursive: true });
6717
- const legacyDb = join15(installRoot, "local", "data", "pr-score.db");
6718
- if (existsSync12(legacyDb) && !existsSync12(DB_PATH)) {
6968
+ mkdirSync11(DATA_DIR, { recursive: true });
6969
+ const legacyDb = join17(installRoot, "local", "data", "pr-score.db");
6970
+ if (existsSync14(legacyDb) && !existsSync14(DB_PATH)) {
6719
6971
  const src = new DatabaseSync2(legacyDb);
6720
6972
  src.exec(`VACUUM INTO '${DB_PATH.replace(/'/g, "''")}'`);
6721
6973
  src.close();
6722
6974
  copied.push(DB_PATH);
6723
6975
  }
6724
- const legacySessions = join15(installRoot, "local", "data", "review-sessions.json");
6725
- if (existsSync12(legacySessions) && !existsSync12(SESSIONS_PATH)) {
6726
- copyFileSync2(legacySessions, SESSIONS_PATH);
6976
+ const legacySessions = join17(installRoot, "local", "data", "review-sessions.json");
6977
+ if (existsSync14(legacySessions) && !existsSync14(SESSIONS_PATH)) {
6978
+ copyFileSync3(legacySessions, SESSIONS_PATH);
6727
6979
  copied.push(SESSIONS_PATH);
6728
6980
  }
6729
- if (host && existsSync12(DB_PATH)) {
6981
+ if (host && existsSync14(DB_PATH)) {
6730
6982
  const db = new DatabaseSync2(DB_PATH);
6731
6983
  const hasProjects = !!db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'projects'").get();
6732
6984
  const projects = hasProjects ? db.prepare("SELECT path_with_namespace FROM projects").all() : [];
@@ -6734,40 +6986,43 @@ function migrateLegacyState(host, installRoot = INSTALL_ROOT) {
6734
6986
  for (const { path_with_namespace: path } of projects) {
6735
6987
  const slug = slugifyProjectPath(path);
6736
6988
  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"]
6989
+ [join17(installRoot, "conventions", `${slug}.md`), "conventions.md"],
6990
+ [join17(installRoot, "zones", `${slug}.yaml`), "zones.yaml"],
6991
+ [join17(installRoot, "zones", `${slug}.graph.json`), "zones.graph.json"]
6740
6992
  ];
6741
6993
  for (const [from, name] of pairs) {
6742
- const to = join15(userProjectDir(host, path), name);
6743
- if (!existsSync12(from) || existsSync12(to)) continue;
6744
- mkdirSync10(userProjectDir(host, path), { recursive: true });
6745
- copyFileSync2(from, to);
6994
+ const to = join17(userProjectDir(host, path), name);
6995
+ if (!existsSync14(from) || existsSync14(to)) continue;
6996
+ mkdirSync11(userProjectDir(host, path), { recursive: true });
6997
+ copyFileSync3(from, to);
6746
6998
  copied.push(to);
6747
6999
  }
6748
7000
  }
6749
7001
  }
6750
- if (host) writeFileSync10(MARKER, `${(/* @__PURE__ */ new Date()).toISOString()}
7002
+ if (host) writeFileSync11(MARKER, `${(/* @__PURE__ */ new Date()).toISOString()}
6751
7003
  `);
6752
7004
  return copied;
6753
7005
  }
6754
7006
 
7007
+ // local/cli.ts
7008
+ init_paths();
7009
+
6755
7010
  // local/zones/graph.ts
6756
7011
  import { execFileSync as execFileSync4 } from "node:child_process";
6757
- import { existsSync as existsSync13 } from "node:fs";
6758
- import { join as join16 } from "node:path";
7012
+ import { existsSync as existsSync15 } from "node:fs";
7013
+ import { join as join18 } from "node:path";
6759
7014
  import madge from "madge";
6760
7015
  var CODE_FILE = /\.[cm]?[jt]sx?$/;
6761
7016
  async function buildZoneGraph(repo, zones) {
6762
7017
  const git4 = (...args) => execFileSync4("git", ["-C", repo, ...args], { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 });
6763
7018
  const repoFiles = git4("ls-files").split("\n").filter((f) => CODE_FILE.test(f) && !f.endsWith(".d.ts"));
6764
- const tsConfig = join16(repo, "tsconfig.json");
7019
+ const tsConfig = join18(repo, "tsconfig.json");
6765
7020
  const result = await madge(
6766
- repoFiles.map((f) => join16(repo, f)),
7021
+ repoFiles.map((f) => join18(repo, f)),
6767
7022
  {
6768
7023
  baseDir: repo,
6769
7024
  fileExtensions: ["ts", "tsx", "js", "jsx", "mjs", "cjs"],
6770
- tsConfig: existsSync13(tsConfig) ? tsConfig : void 0,
7025
+ tsConfig: existsSync15(tsConfig) ? tsConfig : void 0,
6771
7026
  excludeRegExp: [/node_modules/],
6772
7027
  // Lazy routes (`import()`) are exactly what must NOT count as first-load; type-only
6773
7028
  // imports never reach the bundle.
@@ -6805,8 +7060,8 @@ async function runConfigCommand(args) {
6805
7060
  if (sub === "import-env") {
6806
7061
  if (!arg) throw new Error("Usage: yolont config import-env <path to .env>");
6807
7062
  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);
7063
+ if (!existsSync16(path)) throw new Error(`No env file at ${path}`);
7064
+ const { config: next, secrets, skipped } = importEnv(parseEnv(readFileSync15(path, "utf8")), config);
6810
7065
  for (const [name, value] of Object.entries(secrets)) setSecret(name, value);
6811
7066
  saveConfig(next);
6812
7067
  console.log(`Wrote ${CONFIG_PATH}; ${Object.keys(secrets).length} secret(s) saved to ${secretBackend()}.`);
@@ -6828,7 +7083,7 @@ async function runConfigCommand(args) {
6828
7083
  return;
6829
7084
  }
6830
7085
  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)"}`);
7086
+ console.log(`Config: ${CONFIG_PATH}${existsSync16(CONFIG_PATH) ? "" : " (not created yet)"}`);
6832
7087
  console.log(`Secrets: ${secretBackend()}${secretBackend() === "keychain" ? "" : ` \u2014 ${CREDENTIALS_PATH}`}`);
6833
7088
  console.log("\nForges:");
6834
7089
  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,7 +7096,13 @@ Jev: key ${maskSecret(getSecret("jev"))}${config.jev?.disabled ? " (disabled)" :
6841
7096
  async function main() {
6842
7097
  const [command, ...rest] = process.argv.slice(2);
6843
7098
  if (command === "config") return runConfigCommand(rest);
7099
+ if (command === "--version" || command === "-v" || command === "version") {
7100
+ const { ownVersion: ownVersion2 } = await Promise.resolve().then(() => (init_version(), version_exports));
7101
+ console.log(ownVersion2() ?? "unknown");
7102
+ return;
7103
+ }
6844
7104
  applyConfigToEnv(loadConfig());
7105
+ (await Promise.resolve().then(() => (init_gitleaks(), gitleaks_exports))).useLocalGitleaks();
6845
7106
  const sandboxed = !!(process.env.YOLONT_CONFIG_DIR || process.env.YOLONT_DATA_DIR);
6846
7107
  const migrated = sandboxed ? [] : migrateLegacyState(process.env.CI_SERVER_URL);
6847
7108
  if (migrated.length > 0) console.error(`[yolont] copied pre-Yolont data to the user dirs:
@@ -6964,9 +7225,9 @@ ${migrated.map((p) => ` ${p}`).join("\n")}`);
6964
7225
  }
6965
7226
  console.log(`[zones] building import graph of ${values.repo} (can take a while on big repos)\u2026`);
6966
7227
  const graph = await buildZoneGraph(values.repo, zones);
6967
- mkdirSync11(files.dir, { recursive: true });
6968
- const out = join17(files.dir, "zones.graph.json");
6969
- writeFileSync11(out, `${JSON.stringify(graph, null, 2)}
7228
+ mkdirSync12(files.dir, { recursive: true });
7229
+ const out = join19(files.dir, "zones.graph.json");
7230
+ writeFileSync12(out, `${JSON.stringify(graph, null, 2)}
6970
7231
  `);
6971
7232
  for (const [id, files2] of Object.entries(graph.reachable)) console.log(` ${id}: ${files2.length} file(s) reachable via import`);
6972
7233
  console.log(`[zones] wrote ${out}${graph.sha ? ` (@ ${graph.sha.slice(0, 8)})` : ""} \u2014 for CI, commit it to the target repo as .yolont/zones.graph.json`);