@exorcist-98/cli 0.3.5 → 0.3.6

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 +8 -8
  2. package/dist/index.mjs +107 -115
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -11,7 +11,7 @@ Needs Node 20 or newer.
11
11
  ## Scan a project
12
12
 
13
13
  ```sh
14
- npx -y @exorcist-98/cli@0.3.5 scan .
14
+ npx -y @exorcist-98/cli@0.3.6 scan .
15
15
  ```
16
16
 
17
17
  Every finding shows the file, line, the exact text, how serious it is and how
@@ -39,7 +39,7 @@ request.
39
39
  ## Map the haunted house
40
40
 
41
41
  ```sh
42
- npx -y @exorcist-98/cli@0.3.5 map .
42
+ npx -y @exorcist-98/cli@0.3.6 map .
43
43
  ```
44
44
 
45
45
  For every MCP config in the folder, lists which servers sit in the three rooms
@@ -52,8 +52,8 @@ data. The rules are in `definitions/capabilities.yaml`.
52
52
  ## Disinfect (exorcise)
53
53
 
54
54
  ```sh
55
- npx -y @exorcist-98/cli@0.3.5 exorcise . # dry run: prints a unified diff
56
- npx -y @exorcist-98/cli@0.3.5 exorcise . --write # apply, with a vault backup first
55
+ npx -y @exorcist-98/cli@0.3.6 exorcise . # dry run: prints a unified diff
56
+ npx -y @exorcist-98/cli@0.3.6 exorcise . --write # apply, with a vault backup first
57
57
  ```
58
58
 
59
59
  Only threats with one safe, mechanical fix are repaired: hidden characters
@@ -67,7 +67,7 @@ human"), and `exorcist vault restore <id>` puts every file back byte for byte.
67
67
  ## Protect your MCP servers
68
68
 
69
69
  ```sh
70
- npx -y @exorcist-98/cli@0.3.5 wrap .kiro/settings/mcp.json
70
+ npx -y @exorcist-98/cli@0.3.6 wrap .kiro/settings/mcp.json
71
71
  ```
72
72
 
73
73
  `wrap` puts every server in the file, local or remote, behind the Real-Time
@@ -79,9 +79,9 @@ instruct your agent. `unwrap` restores the file exactly. See
79
79
  ## Share approved tools with your team: exorcist.lock
80
80
 
81
81
  ```sh
82
- npx -y @exorcist-98/cli@0.3.5 lock # write exorcist.lock, then commit it
83
- npx -y @exorcist-98/cli@0.3.5 lock --check # exit 1 if any tool or program changed
84
- npx -y @exorcist-98/cli@0.3.5 lock --check --static # starts nothing: names, programs, URLs only
82
+ npx -y @exorcist-98/cli@0.3.6 lock # write exorcist.lock, then commit it
83
+ npx -y @exorcist-98/cli@0.3.6 lock --check # exit 1 if any tool or program changed
84
+ npx -y @exorcist-98/cli@0.3.6 lock --check --static # starts nothing: names, programs, URLs only
85
85
  ```
86
86
 
87
87
  `exorcist.lock` records the fingerprint of every tool your MCP servers list,
package/dist/index.mjs CHANGED
@@ -21762,7 +21762,7 @@ function checkPathSegment(name) {
21762
21762
  }
21763
21763
 
21764
21764
  // ../core/src/lifecycle-scripts.ts
21765
- import { closeSync, existsSync as existsSync2, lstatSync, openSync, readdirSync, readSync, realpathSync as realpathSync2, statSync as statSync2 } from "node:fs";
21765
+ import { closeSync, existsSync, lstatSync, openSync, readdirSync, readSync, realpathSync as realpathSync2, statSync as statSync2 } from "node:fs";
21766
21766
  import { isAbsolute as isAbsolute5, join as join7, posix as posix2, relative as relative5, resolve as resolve5, sep } from "node:path";
21767
21767
 
21768
21768
  // ../core/src/install-hooks.ts
@@ -22592,7 +22592,7 @@ function parseShell(command, sub = false) {
22592
22592
 
22593
22593
  // ../core/src/dev-tools.ts
22594
22594
  init_zod();
22595
- import { existsSync, readFileSync as readFileSync3, statSync } from "node:fs";
22595
+ import { readFileSync as readFileSync3, statSync } from "node:fs";
22596
22596
  import { homedir as homedir2 } from "node:os";
22597
22597
  import { isAbsolute as isAbsolute4, join as join6, normalize as normalize2, relative as relative4, resolve as resolve3 } from "node:path";
22598
22598
 
@@ -22912,27 +22912,19 @@ function unlockedValueRisk(name, value, cwd, dynamic) {
22912
22912
  const runtime = dynamic || /[$`]/.test(value);
22913
22913
  const say = `${name} is set to a path inside the project, or to a value built at run time, and a tool config can name a program to run or a daemon to reach`;
22914
22914
  if (runtime) return say;
22915
- if (PATH_VAR.test(name) && anyInside(value, cwd)) return say;
22916
- const parts2 = value.split(/[\s:,;=]+/u).filter((x) => x !== "");
22917
- if (PROGRAM_VAR.test(name)) {
22918
- const only = parts2.length === 1 && value.trim() === parts2[0] ? parts2[0] : void 0;
22919
- const ok2 = only !== void 0 && (isAbsolute4(only) ? !insideProject(only, cwd) : !/[/\\~]/u.test(only) && cwd !== void 0 && !existsSync(resolve3(cwd, only)));
22920
- if (!ok2) return `${name} names a program or arguments for the tool, and only one word is allowed: an absolute path outside the project, or a program name that is not a file in the project`;
22921
- }
22922
- for (const part of parts2) {
22923
- if (/^[./~]/u.test(part) || part.includes("/")) {
22924
- if (insideProject(part, cwd)) return say;
22925
- } else {
22926
- const bare = part.replace(/^-+/u, "");
22927
- if (bare !== "" && (cwd === void 0 || existsSync(resolve3(cwd, bare)))) return say;
22928
- }
22929
- }
22930
22915
  if (ENDPOINT_VAR.test(name)) {
22931
22916
  const m = /^(?:unix|npipe|file):\/\/(.*)$/.exec(value);
22932
22917
  const target = m === null ? value : m[1];
22933
- if ((m !== null || /^[./~]/.test(target)) && insideProject(target, cwd)) return say;
22918
+ return (m !== null || /^[./~]/.test(target)) && insideProject(target, cwd) ? say : null;
22934
22919
  }
22935
- return null;
22920
+ let v = value.trim();
22921
+ if (v.startsWith("~")) v = expandTilde(v, cwd) ?? v;
22922
+ const one = `${name} takes one plain word here: an absolute path outside the project, or a name with no dot, slash or tilde (a value that could be a file in the project is refused)`;
22923
+ if (v === "") return null;
22924
+ if (/[\s:,;=]/u.test(v)) return one;
22925
+ if (isAbsolute4(v)) return insideProject(v, cwd) ? say : null;
22926
+ if (PATH_VAR.test(name) || PROGRAM_VAR.test(name)) return /^[A-Za-z0-9_-]+$/u.test(v) && !PATH_VAR.test(name) ? null : one;
22927
+ return /[./\\~]/u.test(v) ? one : null;
22936
22928
  }
22937
22929
  function envAssignRisk(name, value, cwd, dynamic = false, known, prog) {
22938
22930
  const owners = envFamilyOwners(name);
@@ -24830,7 +24822,7 @@ function readLocalText(pkgDir, rel) {
24830
24822
  const r = relative5(root, p);
24831
24823
  return r !== "" && !r.startsWith("..") && !isAbsolute5(r) && !r.split(sep).includes("..");
24832
24824
  };
24833
- if (!within(pkgDir, abs) || !existsSync2(abs)) return null;
24825
+ if (!within(pkgDir, abs) || !existsSync(abs)) return null;
24834
24826
  const real = realpathSync2(abs);
24835
24827
  if (!within(realpathSync2(pkgDir), real)) return null;
24836
24828
  const st = statSync2(real);
@@ -25789,7 +25781,7 @@ async function* scanRepo(root, options) {
25789
25781
  init_zod();
25790
25782
 
25791
25783
  // ../core/src/version.ts
25792
- var SCANNER_VERSION = "0.3.5";
25784
+ var SCANNER_VERSION = "0.3.6";
25793
25785
 
25794
25786
  // ../core/src/reporters/json-reporter.ts
25795
25787
  var ScanStatsSchema = external_exports.object({
@@ -27155,7 +27147,7 @@ import { isAbsolute as isAbsolute7, join as join12, relative as relative6, resol
27155
27147
 
27156
27148
  // ../core/src/repo-config-guard.ts
27157
27149
  import { execFile } from "node:child_process";
27158
- import { existsSync as existsSync3, readFileSync as readFileSync5, realpathSync as realpathSync3, statSync as statSync4 } from "node:fs";
27150
+ import { existsSync as existsSync2, readFileSync as readFileSync5, realpathSync as realpathSync3, statSync as statSync4 } from "node:fs";
27159
27151
  import { tmpdir } from "node:os";
27160
27152
  import { dirname as dirname3, isAbsolute as isAbsolute6, join as join11, resolve as resolve7 } from "node:path";
27161
27153
  function stripComment(s) {
@@ -27243,7 +27235,7 @@ function locateRepo(start) {
27243
27235
  }
27244
27236
  for (; ; ) {
27245
27237
  const dotGit = join11(dir, ".git");
27246
- if (existsSync3(dotGit)) {
27238
+ if (existsSync2(dotGit)) {
27247
27239
  let gitDir = null;
27248
27240
  try {
27249
27241
  if (statSync4(dotGit).isDirectory()) gitDir = dotGit;
@@ -27254,14 +27246,14 @@ function locateRepo(start) {
27254
27246
  } catch {
27255
27247
  return null;
27256
27248
  }
27257
- if (!gitDir || !existsSync3(gitDir)) return null;
27249
+ if (!gitDir || !existsSync2(gitDir)) return null;
27258
27250
  let commonDir = gitDir;
27259
27251
  const commonFile = join11(gitDir, "commondir");
27260
- if (existsSync3(commonFile)) {
27252
+ if (existsSync2(commonFile)) {
27261
27253
  const c = readFileSync5(commonFile, "utf8").trim();
27262
27254
  commonDir = isAbsolute6(c) ? c : resolve7(gitDir, c);
27263
27255
  }
27264
- const configFiles = [join11(commonDir, "config"), join11(gitDir, "config.worktree")].filter((f, i, all) => all.indexOf(f) === i && existsSync3(f));
27256
+ const configFiles = [join11(commonDir, "config"), join11(gitDir, "config.worktree")].filter((f, i, all) => all.indexOf(f) === i && existsSync2(f));
27265
27257
  return { workTree: dir, gitDir, configFiles };
27266
27258
  }
27267
27259
  const up = dirname3(dir);
@@ -27688,7 +27680,7 @@ function buildTimeline(traced) {
27688
27680
  // ../core/src/hook-guard.ts
27689
27681
  init_secrets_check();
27690
27682
  init_canary();
27691
- import { existsSync as existsSync4, readFileSync as readFileSync6, statSync as statSync5 } from "node:fs";
27683
+ import { existsSync as existsSync3, readFileSync as readFileSync6, statSync as statSync5 } from "node:fs";
27692
27684
  import { homedir as homedir4 } from "node:os";
27693
27685
  import { dirname as dirname4, join as join13, resolve as resolve9 } from "node:path";
27694
27686
  function strings3(value, out = [], depth = 0) {
@@ -27719,7 +27711,7 @@ function readAliases(cwd, home) {
27719
27711
  const files = [join13(home, ".gitconfig"), join13(home, ".config", "git", "config")];
27720
27712
  let d = resolve9(cwd);
27721
27713
  for (let i = 0; i < 40; i++) {
27722
- if (existsSync4(join13(d, ".git"))) {
27714
+ if (existsSync3(join13(d, ".git"))) {
27723
27715
  files.push(join13(d, ".git", "config"));
27724
27716
  break;
27725
27717
  }
@@ -27828,14 +27820,14 @@ A trap token has been copied out of its trap. Find what copied it, remove the co
27828
27820
  }
27829
27821
 
27830
27822
  // ../core/src/on-access.ts
27831
- import { closeSync as closeSync2, existsSync as existsSync7, openSync as openSync2, readdirSync as readdirSync3, readFileSync as readFileSync8, readSync as readSync2, realpathSync as realpathSync5, statSync as statSync7 } from "node:fs";
27823
+ import { closeSync as closeSync2, existsSync as existsSync6, openSync as openSync2, readdirSync as readdirSync3, readFileSync as readFileSync8, readSync as readSync2, realpathSync as realpathSync5, statSync as statSync7 } from "node:fs";
27832
27824
  import { createHash as createHash3 } from "node:crypto";
27833
27825
  import { basename as basename5, isAbsolute as isAbsolute11, relative as relative8, resolve as resolve13 } from "node:path";
27834
27826
 
27835
27827
  // ../core/src/allowed-reads.ts
27836
27828
  init_zod();
27837
27829
  import { createHash as createHash2 } from "node:crypto";
27838
- import { existsSync as existsSync5, mkdirSync, readFileSync as readFileSync7, realpathSync as realpathSync4, renameSync, statSync as statSync6, writeFileSync } from "node:fs";
27830
+ import { existsSync as existsSync4, mkdirSync, readFileSync as readFileSync7, realpathSync as realpathSync4, renameSync, statSync as statSync6, writeFileSync } from "node:fs";
27839
27831
  import { homedir as homedir5 } from "node:os";
27840
27832
  import { basename as basename4, dirname as dirname5, isAbsolute as isAbsolute8, join as join14, parse, relative as relative7, resolve as resolve10 } from "node:path";
27841
27833
  var Hash = external_exports.string().regex(/^[0-9a-f]{64}$/);
@@ -27847,7 +27839,7 @@ function sha256Bytes(data) {
27847
27839
  }
27848
27840
  function sha256File(file) {
27849
27841
  try {
27850
- if (!existsSync5(file) || !statSync6(file).isFile()) return null;
27842
+ if (!existsSync4(file) || !statSync6(file).isFile()) return null;
27851
27843
  return sha256Bytes(readFileSync7(file));
27852
27844
  } catch {
27853
27845
  return null;
@@ -27869,7 +27861,7 @@ function findProjectRoot(cwd) {
27869
27861
  const start = realPath(cwd);
27870
27862
  const { root } = parse(start);
27871
27863
  for (let dir = start; ; dir = dirname5(dir)) {
27872
- if (PROJECT_MARKERS.some((m) => existsSync5(join14(dir, m)))) return dir;
27864
+ if (PROJECT_MARKERS.some((m) => existsSync4(join14(dir, m)))) return dir;
27873
27865
  if (dir === root || dirname5(dir) === dir) break;
27874
27866
  }
27875
27867
  return start;
@@ -27893,7 +27885,7 @@ function allowKey(realAbsPath, sha2564) {
27893
27885
  }
27894
27886
  function readAllowedReads(cwd, env = process.env) {
27895
27887
  const loc = allowedReadsLocation(cwd, env);
27896
- if (!loc.ok || !existsSync5(loc.file)) return /* @__PURE__ */ new Set();
27888
+ if (!loc.ok || !existsSync4(loc.file)) return /* @__PURE__ */ new Set();
27897
27889
  try {
27898
27890
  if (isInside2(loc.file, loc.project)) return /* @__PURE__ */ new Set();
27899
27891
  const result = AllowedReadsSchema.safeParse(JSON.parse(readFileSync7(loc.file, "utf8")));
@@ -27911,7 +27903,7 @@ function addAllowedRead(cwd, file, env = process.env, expected) {
27911
27903
  const loc = allowedReadsLocation(cwd, env);
27912
27904
  if (!loc.ok) return loc;
27913
27905
  let entries = [];
27914
- if (existsSync5(loc.file)) {
27906
+ if (existsSync4(loc.file)) {
27915
27907
  try {
27916
27908
  const parsed = AllowedReadsSchema.safeParse(JSON.parse(readFileSync7(loc.file, "utf8")));
27917
27909
  if (parsed.success && parsed.data.project === loc.project) entries = parsed.data.entries;
@@ -27928,7 +27920,7 @@ function addAllowedRead(cwd, file, env = process.env, expected) {
27928
27920
  }
27929
27921
 
27930
27922
  // ../core/src/fs-expand.ts
27931
- import { existsSync as existsSync6, lstatSync as lstatSync2, readdirSync as readdirSync2 } from "node:fs";
27923
+ import { existsSync as existsSync5, lstatSync as lstatSync2, readdirSync as readdirSync2 } from "node:fs";
27932
27924
  import { isAbsolute as isAbsolute9, resolve as resolve11 } from "node:path";
27933
27925
  var MAX_TARGETS = 100;
27934
27926
  var MAX_RECURSIVE_FILES = 500;
@@ -28007,7 +27999,7 @@ function expandGlob(word, dir) {
28007
27999
  level = next;
28008
28000
  }
28009
28001
  for (const p of level) {
28010
- if (!existsSync6(p)) continue;
28002
+ if (!existsSync5(p)) continue;
28011
28003
  out.push(p);
28012
28004
  if (out.length >= cap3) return out;
28013
28005
  }
@@ -28467,7 +28459,7 @@ function decideRead(event, defs, opts = {}) {
28467
28459
  let text;
28468
28460
  let bytes;
28469
28461
  try {
28470
- if (!existsSync7(abs)) continue;
28462
+ if (!existsSync6(abs)) continue;
28471
28463
  const stat4 = statSync7(abs);
28472
28464
  if (!stat4.isFile()) continue;
28473
28465
  if (stat4.size > MAX_SCAN_BYTES) {
@@ -29160,7 +29152,7 @@ function webFetchBlockMessage(d) {
29160
29152
  init_zod();
29161
29153
 
29162
29154
  // ../core/src/gitignore.ts
29163
- import { existsSync as existsSync8, readFileSync as readFileSync10, statSync as statSync9 } from "node:fs";
29155
+ import { existsSync as existsSync7, readFileSync as readFileSync10, statSync as statSync9 } from "node:fs";
29164
29156
  import { dirname as dirname7, join as join16, relative as relative9, resolve as resolve15, sep as sep3 } from "node:path";
29165
29157
  var MAX_IGNORE_BYTES = 256 * 1024;
29166
29158
  function globToRe(glob) {
@@ -29222,7 +29214,7 @@ function parseGitignore(text) {
29222
29214
  }
29223
29215
  function readIgnore(path) {
29224
29216
  try {
29225
- if (!existsSync8(path) || statSync9(path).size > MAX_IGNORE_BYTES) return [];
29217
+ if (!existsSync7(path) || statSync9(path).size > MAX_IGNORE_BYTES) return [];
29226
29218
  return parseGitignore(readFileSync10(path, "utf8"));
29227
29219
  } catch {
29228
29220
  return [];
@@ -29231,7 +29223,7 @@ function readIgnore(path) {
29231
29223
  function repoRootOf(from) {
29232
29224
  let d = resolve15(from);
29233
29225
  for (let i = 0; i < 40; i++) {
29234
- if (existsSync8(join16(d, ".git"))) return d;
29226
+ if (existsSync7(join16(d, ".git"))) return d;
29235
29227
  const up = dirname7(d);
29236
29228
  if (up === d) return null;
29237
29229
  d = up;
@@ -30385,7 +30377,7 @@ var SessionJsonSchema = external_exports.object({
30385
30377
  }).passthrough();
30386
30378
 
30387
30379
  // ../core/src/run-scripts-guard.ts
30388
- import { existsSync as existsSync9, readFileSync as readFileSync13, realpathSync as realpathSync7, statSync as statSync11 } from "node:fs";
30380
+ import { existsSync as existsSync8, readFileSync as readFileSync13, realpathSync as realpathSync7, statSync as statSync11 } from "node:fs";
30389
30381
  import { isAbsolute as isAbsolute14, join as join19, relative as relative11, resolve as resolve18, sep as sep4 } from "node:path";
30390
30382
  var MAX_PKG_BYTES = 1048576;
30391
30383
  var MAX_WORKSPACE_PACKAGES = 300;
@@ -30407,7 +30399,7 @@ var insideOf = (root, p) => {
30407
30399
  function readPackage(dir) {
30408
30400
  try {
30409
30401
  const p = join19(dir, "package.json");
30410
- if (!existsSync9(p) || statSync11(p).size > MAX_PKG_BYTES) return null;
30402
+ if (!existsSync8(p) || statSync11(p).size > MAX_PKG_BYTES) return null;
30411
30403
  return readFileSync13(p, "utf8");
30412
30404
  } catch {
30413
30405
  return null;
@@ -30468,7 +30460,7 @@ function expandGlob2(root, pattern) {
30468
30460
  } else if (/[*?]/.test(seg)) {
30469
30461
  const re2 = new RegExp(`^${seg.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]")}$`);
30470
30462
  for (const e of listLocal(base, ".") ?? []) if (e.endsWith("/") && re2.test(e.slice(0, -1)) && e !== "node_modules/") next.push(join19(base, e.slice(0, -1)));
30471
- } else if (existsSync9(join19(base, seg))) next.push(join19(base, seg));
30463
+ } else if (existsSync8(join19(base, seg))) next.push(join19(base, seg));
30472
30464
  }
30473
30465
  level = next;
30474
30466
  if (level.length > MAX_WORKSPACE_PACKAGES) break;
@@ -30481,13 +30473,13 @@ function workspacePackages(root) {
30481
30473
  const include = globs.filter((g) => !g.startsWith("!"));
30482
30474
  const exclude = globs.filter((g) => g.startsWith("!")).flatMap((g) => expandGlob2(root, g.slice(1)));
30483
30475
  const dirs = /* @__PURE__ */ new Set();
30484
- for (const g of include) for (const d of expandGlob2(root, g)) if (!exclude.includes(d) && existsSync9(join19(d, "package.json"))) dirs.add(d);
30476
+ for (const g of include) for (const d of expandGlob2(root, g)) if (!exclude.includes(d) && existsSync8(join19(d, "package.json"))) dirs.add(d);
30485
30477
  return [...dirs].slice(0, MAX_WORKSPACE_PACKAGES).map((dir) => ({ dir, name: packageInfo(dir).name }));
30486
30478
  }
30487
30479
  function nearestPackageDir(from) {
30488
30480
  let d = from;
30489
30481
  for (let i = 0; i < 10; i++) {
30490
- if (existsSync9(join19(d, "package.json"))) return d;
30482
+ if (existsSync8(join19(d, "package.json"))) return d;
30491
30483
  const up = resolve18(d, "..");
30492
30484
  if (up === d) break;
30493
30485
  d = up;
@@ -30498,7 +30490,7 @@ function findWorkspaceRoot(from) {
30498
30490
  let d = from;
30499
30491
  let best = null;
30500
30492
  for (let i = 0; i < 10; i++) {
30501
- if (existsSync9(join19(d, "pnpm-workspace.yaml")) || packageInfo(d).workspaces.length > 0) best = d;
30493
+ if (existsSync8(join19(d, "pnpm-workspace.yaml")) || packageInfo(d).workspaces.length > 0) best = d;
30502
30494
  const up = resolve18(d, "..");
30503
30495
  if (up === d) break;
30504
30496
  d = up;
@@ -30559,7 +30551,7 @@ function checkReadable(dir, rels, label) {
30559
30551
  const abs = resolve18(dir, rel);
30560
30552
  let isFile = false;
30561
30553
  try {
30562
- isFile = existsSync9(abs) && statSync11(abs).isFile();
30554
+ isFile = existsSync8(abs) && statSync11(abs).isFile();
30563
30555
  } catch {
30564
30556
  isFile = false;
30565
30557
  }
@@ -30579,7 +30571,7 @@ function findLocalBin(dir, bin) {
30579
30571
  let d = dir;
30580
30572
  for (let i = 0; i < 8; i++) {
30581
30573
  const link = join19(d, "node_modules", ".bin", bin);
30582
- if (existsSync9(link)) return link;
30574
+ if (existsSync8(link)) return link;
30583
30575
  const up = resolve18(d, "..");
30584
30576
  if (up === d) break;
30585
30577
  d = up;
@@ -30610,7 +30602,7 @@ function runExec(e, dirs, ctx) {
30610
30602
  for (const dir of dirs) {
30611
30603
  if (e.localPath !== null) {
30612
30604
  const abs = resolve18(dir, e.localPath);
30613
- if (existsSync9(abs)) {
30605
+ if (existsSync8(abs)) {
30614
30606
  checkReadable(dir, [e.localPath], e.localPath);
30615
30607
  const v = evaluateTargets(targetsOfExec(e), fsFor(dir), true);
30616
30608
  if (v) blockHit(e.rawProg, e.rawProg, v, dir);
@@ -30657,7 +30649,7 @@ function runAction(a, e, dir, dirs, ctx) {
30657
30649
  });
30658
30650
  const hit = hits[0];
30659
30651
  if (hit) throw new Stop({ block: true, hit, dir: pkgDir });
30660
- if (a.serverJs && existsSync9(join19(pkgDir, "server.js"))) {
30652
+ if (a.serverJs && existsSync8(join19(pkgDir, "server.js"))) {
30661
30653
  const v = evaluateTargets({ files: ["server.js"], inline: [], scripts: [], runners: [], dotenv: false, unclear: [] }, fsFor(pkgDir), true);
30662
30654
  if (v) blockHit("npm start (server.js)", "node server.js", v, pkgDir);
30663
30655
  }
@@ -31182,7 +31174,7 @@ function decideShellRead(event, defs, opts = {}, fallbackCwd = process.cwd()) {
31182
31174
  }
31183
31175
 
31184
31176
  // src/commands/approve.ts
31185
- import { existsSync as existsSync19, readFileSync as readFileSync27 } from "node:fs";
31177
+ import { existsSync as existsSync18, readFileSync as readFileSync27 } from "node:fs";
31186
31178
 
31187
31179
  // ../shield/src/hash.ts
31188
31180
  import { createHash as createHash7 } from "node:crypto";
@@ -31288,7 +31280,7 @@ var LineSplitter = class {
31288
31280
 
31289
31281
  // ../shield/src/policy.ts
31290
31282
  init_zod();
31291
- import { existsSync as existsSync10, lstatSync as lstatSync6, readFileSync as readFileSync15, writeFileSync as writeFileSync3 } from "node:fs";
31283
+ import { existsSync as existsSync9, lstatSync as lstatSync6, readFileSync as readFileSync15, writeFileSync as writeFileSync3 } from "node:fs";
31292
31284
  import { join as join21 } from "node:path";
31293
31285
 
31294
31286
  // ../shield/src/userkey.ts
@@ -31549,7 +31541,7 @@ function loadPolicy(path) {
31549
31541
  const user = loadUserPolicy(notes);
31550
31542
  if (!user.ok) return user;
31551
31543
  let merged = { ...user.raw };
31552
- if (existsSync10(path)) {
31544
+ if (existsSync9(path)) {
31553
31545
  let text;
31554
31546
  try {
31555
31547
  text = readFileSync15(path, "utf8");
@@ -32540,7 +32532,7 @@ function defaultOsAuth(o = {}) {
32540
32532
 
32541
32533
  // ../shield/src/state.ts
32542
32534
  init_zod();
32543
- import { appendFileSync, existsSync as existsSync11, mkdirSync as mkdirSync5, readFileSync as readFileSync19, renameSync as renameSync6, writeFileSync as writeFileSync5 } from "node:fs";
32535
+ import { appendFileSync, existsSync as existsSync10, mkdirSync as mkdirSync5, readFileSync as readFileSync19, renameSync as renameSync6, writeFileSync as writeFileSync5 } from "node:fs";
32544
32536
  import { dirname as dirname9, join as join26 } from "node:path";
32545
32537
  var Sha256 = external_exports.string().regex(/^[0-9a-f]{64}$/);
32546
32538
  var PinSchema = external_exports.object({
@@ -32599,7 +32591,7 @@ function pinsText(raw) {
32599
32591
  return canonicalJson({ version: raw.version, servers: raw.servers });
32600
32592
  }
32601
32593
  function loadState(path) {
32602
- if (!existsSync11(path)) return { ok: true, state: emptyState() };
32594
+ if (!existsSync10(path)) return { ok: true, state: emptyState() };
32603
32595
  let json2;
32604
32596
  try {
32605
32597
  json2 = JSON.parse(readFileSync19(path, "utf8"));
@@ -33284,7 +33276,7 @@ function throttle(o = {}) {
33284
33276
  }
33285
33277
 
33286
33278
  // ../shield/src/canary.ts
33287
- import { existsSync as existsSync12, lstatSync as lstatSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync20, readdirSync as readdirSync9, realpathSync as realpathSync8, rmdirSync, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "node:fs";
33279
+ import { existsSync as existsSync11, lstatSync as lstatSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync20, readdirSync as readdirSync9, realpathSync as realpathSync8, rmdirSync, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "node:fs";
33288
33280
  import { dirname as dirname10, isAbsolute as isAbsolute17, join as join27, resolve as resolve21 } from "node:path";
33289
33281
  var TRAPS = [
33290
33282
  {
@@ -33329,18 +33321,18 @@ function plantCanaries(root, o = {}) {
33329
33321
  }
33330
33322
  for (const d of [".exorcist", CANARY_TRAP_DIR]) {
33331
33323
  const path = join27(root, d);
33332
- if (existsSync12(path) || isSymlink(path)) {
33324
+ if (existsSync11(path) || isSymlink(path)) {
33333
33325
  if (!isRealDir(path)) return { ok: false, error: `${path} is not a real folder (a symlink or a file); no traps were planted.` };
33334
33326
  }
33335
33327
  }
33336
33328
  const traps = TRAPS.slice(0, count);
33337
33329
  for (const t2 of traps) {
33338
33330
  const path = join27(root, CANARY_TRAP_DIR, t2.name);
33339
- if (existsSync12(path)) return { ok: false, error: `${path} already exists; it was not overwritten.` };
33331
+ if (existsSync11(path)) return { ok: false, error: `${path} already exists; it was not overwritten.` };
33340
33332
  }
33341
33333
  const created = (o.now ? o.now() : /* @__PURE__ */ new Date()).toISOString();
33342
33334
  const records = [];
33343
- const madeDirs = [".exorcist", CANARY_TRAP_DIR].filter((d) => !existsSync12(join27(root, d)));
33335
+ const madeDirs = [".exorcist", CANARY_TRAP_DIR].filter((d) => !existsSync11(join27(root, d)));
33344
33336
  try {
33345
33337
  mkdirSync6(join27(root, CANARY_TRAP_DIR), { recursive: true });
33346
33338
  for (const t2 of traps) {
@@ -33467,7 +33459,7 @@ function removeCanaries(root, o = {}) {
33467
33459
  }
33468
33460
  function readPolicyObject(stateDir2) {
33469
33461
  const path = policyPath(stateDir2);
33470
- if (!existsSync12(path)) return { ok: true, obj: {} };
33462
+ if (!existsSync11(path)) return { ok: true, obj: {} };
33471
33463
  try {
33472
33464
  const json2 = JSON.parse(readFileSync20(path, "utf8"));
33473
33465
  if (!json2 || typeof json2 !== "object" || Array.isArray(json2)) return { ok: false, error: `${path} is not a JSON object.` };
@@ -33482,7 +33474,7 @@ function setPolicyCanaries(stateDir2, recordsFile) {
33482
33474
  try {
33483
33475
  mkdirSync6(stateDir2, { recursive: true });
33484
33476
  const file = policyPath(stateDir2);
33485
- const sign = !existsSync12(file) || policyIsSigned(file);
33477
+ const sign = !existsSync11(file) || policyIsSigned(file);
33486
33478
  writeFileSync6(file, `${JSON.stringify({ ...p.obj, canaries: resolve21(recordsFile) }, null, 2)}
33487
33479
  `);
33488
33480
  if (sign) signPolicyFile(file);
@@ -34780,11 +34772,11 @@ var ShieldEngine = class {
34780
34772
 
34781
34773
  // ../shield/src/proxy.ts
34782
34774
  import { spawn as spawn3 } from "node:child_process";
34783
- import { existsSync as existsSync16, mkdirSync as mkdirSync9, readFileSync as readFileSync26, statSync as statSync15 } from "node:fs";
34775
+ import { existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync26, statSync as statSync15 } from "node:fs";
34784
34776
  import { dirname as dirname14 } from "node:path";
34785
34777
 
34786
34778
  // ../shield/src/lockfile.ts
34787
- import { existsSync as existsSync13 } from "node:fs";
34779
+ import { existsSync as existsSync12 } from "node:fs";
34788
34780
  import { dirname as dirname11, join as join28, parse as parsePath, resolve as resolve22 } from "node:path";
34789
34781
  init_zod();
34790
34782
  var Sha2562 = external_exports.string().regex(/^[0-9a-f]{64}$/);
@@ -34961,8 +34953,8 @@ function findLockFile(starts) {
34961
34953
  const { root } = parsePath(resolve22(start));
34962
34954
  for (let dir = resolve22(start); ; dir = dirname11(dir)) {
34963
34955
  const candidate = join28(dir, LOCK_FILE);
34964
- if (existsSync13(candidate)) return candidate;
34965
- if (PROJECT_MARKERS2.some((m) => existsSync13(join28(dir, m)))) break;
34956
+ if (existsSync12(candidate)) return candidate;
34957
+ if (PROJECT_MARKERS2.some((m) => existsSync12(join28(dir, m)))) break;
34966
34958
  if (dir === root || dirname11(dir) === dir) break;
34967
34959
  }
34968
34960
  }
@@ -34971,7 +34963,7 @@ function findLockFile(starts) {
34971
34963
 
34972
34964
  // ../shield/src/vault.ts
34973
34965
  import { createHash as createHash11, randomBytes as randomBytes7 } from "node:crypto";
34974
- import { closeSync as closeSync7, constants as constants6, copyFileSync, existsSync as existsSync14, fstatSync as fstatSync3, lstatSync as lstatSync11, mkdirSync as mkdirSync7, openSync as openSync7, readFileSync as readFileSync21, readdirSync as readdirSync10, realpathSync as realpathSync9, rmSync as rmSync4, statSync as statSync13, writeFileSync as writeFileSync7, writeSync as writeSync4 } from "node:fs";
34966
+ import { closeSync as closeSync7, constants as constants6, copyFileSync, existsSync as existsSync13, fstatSync as fstatSync3, lstatSync as lstatSync11, mkdirSync as mkdirSync7, openSync as openSync7, readFileSync as readFileSync21, readdirSync as readdirSync10, realpathSync as realpathSync9, rmSync as rmSync4, statSync as statSync13, writeFileSync as writeFileSync7, writeSync as writeSync4 } from "node:fs";
34975
34967
  import { basename as basename8, dirname as dirname12, isAbsolute as isAbsolute18, join as join29, resolve as resolve23, sep as sep6 } from "node:path";
34976
34968
  init_zod();
34977
34969
  var SafeRel = external_exports.string().min(1).max(1024).refine(
@@ -35057,7 +35049,7 @@ function targetProblem(e) {
35057
35049
  const dir = e.kind === "exorcise" ? e.target : dirname12(e.target);
35058
35050
  let real;
35059
35051
  try {
35060
- real = realpathSync9(existsSync14(dir) ? dir : dirname12(dir));
35052
+ real = realpathSync9(existsSync13(dir) ? dir : dirname12(dir));
35061
35053
  } catch {
35062
35054
  return `${e.target} cannot be resolved.`;
35063
35055
  }
@@ -35089,12 +35081,12 @@ function writeManifest(vaultDir, e) {
35089
35081
  `);
35090
35082
  }
35091
35083
  function listEntries(vaultDir) {
35092
- if (!existsSync14(vaultDir)) return [];
35084
+ if (!existsSync13(vaultDir)) return [];
35093
35085
  const key = getUserKey();
35094
35086
  const out = [];
35095
35087
  for (const name of readdirSync10(vaultDir)) {
35096
35088
  const file = join29(vaultDir, name, "manifest.json");
35097
- if (!existsSync14(file)) continue;
35089
+ if (!existsSync13(file)) continue;
35098
35090
  try {
35099
35091
  const st = lstatSync11(file);
35100
35092
  if (!st.isFile()) continue;
@@ -35169,7 +35161,7 @@ function quarantineServer(o) {
35169
35161
  }
35170
35162
  function quarantineFile(o) {
35171
35163
  const target = resolve23(o.filePath);
35172
- if (!existsSync14(target) || !statSync13(target).isFile()) return fail3(`${target} is not a file.`);
35164
+ if (!existsSync13(target) || !statSync13(target).isFile()) return fail3(`${target} is not a file.`);
35173
35165
  if (activeFor(o.vaultDir, target)) return fail3(`${target} is already in the vault.`);
35174
35166
  const safe2 = ensureSafeVault(o.vaultDir);
35175
35167
  if (safe2 !== null) return fail3(safe2);
@@ -35197,7 +35189,7 @@ function backupAndRewrite(o) {
35197
35189
  for (const f of o.files) {
35198
35190
  if (!SafeRel.safeParse(f.rel).success) return fail3(`Refusing to write outside ${root}: ${f.rel}`);
35199
35191
  const path = join29(root, f.rel);
35200
- if (!existsSync14(path)) return fail3(`${f.rel} is gone; nothing was changed.`);
35192
+ if (!existsSync13(path)) return fail3(`${f.rel} is gone; nothing was changed.`);
35201
35193
  if (sha2562(readFileSync21(path)) !== sha2562(Buffer.from(f.before, "utf8"))) {
35202
35194
  return fail3(`${f.rel} changed since it was scanned; nothing was changed. Run exorcise again.`);
35203
35195
  }
@@ -35241,7 +35233,7 @@ function restoreExorcised(vaultDir, e, force) {
35241
35233
  const files = e.files ?? [];
35242
35234
  const blocked2 = files.filter((f) => {
35243
35235
  const path = join29(e.target, f.rel);
35244
- if (!existsSync14(path)) return false;
35236
+ if (!existsSync13(path)) return false;
35245
35237
  const now = sha2562(readFileSync21(path));
35246
35238
  return now !== f.after && now !== f.sha256;
35247
35239
  });
@@ -35269,7 +35261,7 @@ function diffEntry(vaultDir, id) {
35269
35261
  const parts2 = (e.files ?? []).map((f) => {
35270
35262
  const path = join29(e.target, f.rel);
35271
35263
  const before2 = readFileSync21(join29(entryDir(vaultDir, e.id), "files", f.rel), "utf8");
35272
- const after2 = existsSync14(path) ? readFileSync21(path, "utf8") : "";
35264
+ const after2 = existsSync13(path) ? readFileSync21(path, "utf8") : "";
35273
35265
  return createTwoFilesPatch(`${f.rel} (backup)`, `${f.rel} (now)`, before2, after2, "", "", { context: 3 });
35274
35266
  });
35275
35267
  return { ok: true, value: parts2.join("") };
@@ -35281,7 +35273,7 @@ function diffEntry(vaultDir, id) {
35281
35273
  const now = cfg.ok ? cfg.value.mcpServers?.[e.serverName ?? ""] : void 0;
35282
35274
  after = now ? `${JSON.stringify(now, null, 2)}
35283
35275
  ` : "";
35284
- } else if (existsSync14(e.target)) {
35276
+ } else if (existsSync13(e.target)) {
35285
35277
  after = readFileSync21(e.target, "utf8");
35286
35278
  }
35287
35279
  const label = e.kind === "mcp-server" ? `${e.serverName} in ${basename8(e.target)}` : basename8(e.target);
@@ -35318,7 +35310,7 @@ function restoreEntry(vaultDir, id, opts = {}) {
35318
35310
  writeConfig(e.target, cfg.value);
35319
35311
  } else {
35320
35312
  const stored = backupFile(vaultDir, e);
35321
- if (existsSync14(e.target) && sha2562(readFileSync21(e.target)) !== e.sha256 && !opts.force) {
35313
+ if (existsSync13(e.target) && sha2562(readFileSync21(e.target)) !== e.sha256 && !opts.force) {
35322
35314
  return fail3(`${e.target} exists and is different from the quarantined file. Use --force to overwrite it.`);
35323
35315
  }
35324
35316
  mkdirSync7(resolve23(e.target, ".."), { recursive: true });
@@ -36240,7 +36232,7 @@ var EventTail = class {
36240
36232
 
36241
36233
  // ../shield/src/launch.ts
36242
36234
  import { createHash as createHash13 } from "node:crypto";
36243
- import { existsSync as existsSync15, readFileSync as readFileSync25, statSync as statSync14 } from "node:fs";
36235
+ import { existsSync as existsSync14, readFileSync as readFileSync25, statSync as statSync14 } from "node:fs";
36244
36236
  import { dirname as dirname13, isAbsolute as isAbsolute19, join as join32, parse as parsePath2, relative as relative13, resolve as resolve24, sep as sep7 } from "node:path";
36245
36237
  var sha2563 = (b) => createHash13("sha256").update(b).digest("hex");
36246
36238
  var MAX_HASHED_BYTES = 64 * 1024 * 1024;
@@ -36318,7 +36310,7 @@ function configLabel(configPath) {
36318
36310
  const abs = resolve24(configPath);
36319
36311
  const { root } = parsePath2(abs);
36320
36312
  for (let dir = dirname13(abs); ; dir = dirname13(dir)) {
36321
- if (PROJECT_MARKERS3.some((m) => existsSync15(join32(dir, m)))) return relative13(dir, abs).split(sep7).join("/");
36313
+ if (PROJECT_MARKERS3.some((m) => existsSync14(join32(dir, m)))) return relative13(dir, abs).split(sep7).join("/");
36322
36314
  if (dir === root || dirname13(dir) === dir) return abs;
36323
36315
  }
36324
36316
  }
@@ -36499,13 +36491,13 @@ async function prepareShield(o) {
36499
36491
  log(canariesFile.error);
36500
36492
  return FAIL_CLOSED_EXIT;
36501
36493
  }
36502
- if (policy.policy.canaries && !existsSync16(canariesAt)) log(`The policy names canary records at ${canariesAt}, but there is no such file; no canary traps are active.`);
36494
+ if (policy.policy.canaries && !existsSync15(canariesAt)) log(`The policy names canary records at ${canariesAt}, but there is no such file; no canary traps are active.`);
36503
36495
  const canaries = canariesFile.canaries.map((r) => ({ token: r.token, file: r.file }));
36504
36496
  if (canaries.length > 0) log(`Watching for ${canaries.length} canary token${canaries.length === 1 ? "" : "s"} (EX-022).`);
36505
36497
  let lockExpected;
36506
36498
  let lockLaunch;
36507
36499
  const lockFile = o.lockPath === void 0 ? findLockFile([...o.configPath ? [dirname14(o.configPath)] : [], process.cwd()]) : o.lockPath;
36508
- if (lockFile && existsSync16(lockFile)) {
36500
+ if (lockFile && existsSync15(lockFile)) {
36509
36501
  let text;
36510
36502
  try {
36511
36503
  text = readFileSync26(lockFile, "utf8");
@@ -37079,7 +37071,7 @@ async function runRemoteProxy(o) {
37079
37071
  }
37080
37072
 
37081
37073
  // ../shield/src/locate.ts
37082
- import { existsSync as existsSync17, readdirSync as readdirSync11, statSync as statSync16 } from "node:fs";
37074
+ import { existsSync as existsSync16, readdirSync as readdirSync11, statSync as statSync16 } from "node:fs";
37083
37075
  import { dirname as dirname15, isAbsolute as isAbsolute20, join as join33, parse as parse2, resolve as resolve25 } from "node:path";
37084
37076
  import { fileURLToPath } from "node:url";
37085
37077
  function hasDefinitions(dir) {
@@ -37110,7 +37102,7 @@ function findStateDir(o = {}) {
37110
37102
  if (fromEnv) return isAbsolute20(fromEnv) ? fromEnv : resolve25(cwd, fromEnv);
37111
37103
  const { root } = parse2(cwd);
37112
37104
  for (let dir = cwd; ; dir = dirname15(dir)) {
37113
- if (PROJECT_MARKERS4.some((m) => existsSync17(join33(dir, m)))) return join33(dir, ".exorcist");
37105
+ if (PROJECT_MARKERS4.some((m) => existsSync16(join33(dir, m)))) return join33(dir, ".exorcist");
37114
37106
  if (dir === root || dirname15(dir) === dir) break;
37115
37107
  }
37116
37108
  return join33(cwd, ".exorcist");
@@ -37296,7 +37288,7 @@ var DEFAULT_DIR = "the project's .exorcist folder (or EXORCIST_DIR)";
37296
37288
  // src/commands/on-access.ts
37297
37289
  import { randomBytes as randomBytes10 } from "node:crypto";
37298
37290
  import { execFile as execFile3 } from "node:child_process";
37299
- import { existsSync as existsSync18, statSync as statSync17 } from "node:fs";
37291
+ import { existsSync as existsSync17, statSync as statSync17 } from "node:fs";
37300
37292
  import { resolve as resolve26 } from "node:path";
37301
37293
  import { createInterface } from "node:readline";
37302
37294
  var ALLOW_READ_HELP = `Usage: exorcist allow-read <file>
@@ -37490,7 +37482,7 @@ ${ALLOW_READ_HELP}`);
37490
37482
  return 1;
37491
37483
  }
37492
37484
  const file = resolve26(target);
37493
- if (!existsSync18(file) || !statSync17(file).isFile()) {
37485
+ if (!existsSync17(file) || !statSync17(file).isFile()) {
37494
37486
  io.err(`Not a readable file: ${shownName(target)}`);
37495
37487
  return 1;
37496
37488
  }
@@ -37597,7 +37589,7 @@ ${APPROVE_HELP}`);
37597
37589
  return 1;
37598
37590
  }
37599
37591
  const file = policyPath(stateDir(str4(p.values["dir"])));
37600
- if (!existsSync19(file)) {
37592
+ if (!existsSync18(file)) {
37601
37593
  io.err(`There is no policy file at ${file}.`);
37602
37594
  return 1;
37603
37595
  }
@@ -37658,7 +37650,7 @@ async function alertsCommand(argv, io) {
37658
37650
  if (!h.ok) io.out(`Event log head: unreadable (${h.error.replace(/[^\x20-\x7e]/g, "?")}).`);
37659
37651
  else io.out(h.value === null ? "Event log head: none yet (nothing has been logged in this folder)." : `Event log head: ${h.value.hash} (event ${h.value.seq})`);
37660
37652
  };
37661
- if (!existsSync19(file)) {
37653
+ if (!existsSync18(file)) {
37662
37654
  io.out("No alerts.");
37663
37655
  printHead();
37664
37656
  return 0;
@@ -37681,12 +37673,12 @@ import { statSync as statSync20, writeFileSync as writeFileSync9 } from "node:fs
37681
37673
  import { join as join36, resolve as resolve29 } from "node:path";
37682
37674
 
37683
37675
  // src/commands/scan.ts
37684
- import { existsSync as existsSync21, readFileSync as readFileSync29, realpathSync as realpathSync10, statSync as statSync19, writeFileSync as writeFileSync8 } from "node:fs";
37676
+ import { existsSync as existsSync20, readFileSync as readFileSync29, realpathSync as realpathSync10, statSync as statSync19, writeFileSync as writeFileSync8 } from "node:fs";
37685
37677
  import { basename as basename10, dirname as dirname16, isAbsolute as isAbsolute21, join as join35, relative as relative14, resolve as resolve28 } from "node:path";
37686
37678
  init_bedrock();
37687
37679
 
37688
37680
  // src/commands/detonate.ts
37689
- import { existsSync as existsSync20, readFileSync as readFileSync28, statSync as statSync18 } from "node:fs";
37681
+ import { existsSync as existsSync19, readFileSync as readFileSync28, statSync as statSync18 } from "node:fs";
37690
37682
  import { basename as basename9, join as join34, resolve as resolve27 } from "node:path";
37691
37683
  init_bedrock();
37692
37684
  var DEFAULT_DETONATE_MAX = 10;
@@ -37830,7 +37822,7 @@ ${DETONATE_HELP}`);
37830
37822
  return 2;
37831
37823
  }
37832
37824
  const abs = resolve27(target);
37833
- if (!existsSync20(abs) || !statSync18(abs).isFile()) {
37825
+ if (!existsSync19(abs) || !statSync18(abs).isFile()) {
37834
37826
  io.err(`File not found: ${target}`);
37835
37827
  return 2;
37836
37828
  }
@@ -37914,7 +37906,7 @@ function readIgnoreFile(root) {
37914
37906
  return readIgnoreEntries(join35(root, ".exorcistignore"));
37915
37907
  }
37916
37908
  function readIgnoreEntries(file) {
37917
- if (!existsSync21(file)) return [];
37909
+ if (!existsSync20(file)) return [];
37918
37910
  return readFileSync29(file, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
37919
37911
  }
37920
37912
  function isIgnored(rel, prefixes) {
@@ -38020,7 +38012,7 @@ async function makeAiClient(rawMax, io, real) {
38020
38012
  }
38021
38013
  async function runScan(opts, io) {
38022
38014
  const abs = resolve28(opts.target);
38023
- if (!existsSync21(abs)) {
38015
+ if (!existsSync20(abs)) {
38024
38016
  io.err(`Path not found: ${opts.target}`);
38025
38017
  return { ok: false, code: 2 };
38026
38018
  }
@@ -38177,7 +38169,7 @@ ${SCAN_HELP}`);
38177
38169
  const ignoreFilePath = str4(p.values["ignore-file"]);
38178
38170
  let userIgnore = [];
38179
38171
  if (ignoreFilePath !== void 0) {
38180
- if (!existsSync21(resolve28(ignoreFilePath))) {
38172
+ if (!existsSync20(resolve28(ignoreFilePath))) {
38181
38173
  io.err(`Could not read the ignore file ${ignoreFilePath}. Check the path.`);
38182
38174
  return 2;
38183
38175
  }
@@ -38428,7 +38420,7 @@ function remove(io, dir, state) {
38428
38420
 
38429
38421
  // src/commands/config.ts
38430
38422
  import { createHash as createHash14 } from "node:crypto";
38431
- import { existsSync as existsSync22, mkdirSync as mkdirSync10, readFileSync as readFileSync30, rmSync as rmSync5, writeFileSync as writeFileSync10 } from "node:fs";
38423
+ import { existsSync as existsSync21, mkdirSync as mkdirSync10, readFileSync as readFileSync30, rmSync as rmSync5, writeFileSync as writeFileSync10 } from "node:fs";
38432
38424
  import { join as join37, resolve as resolve31 } from "node:path";
38433
38425
  var WRAP_HELP = `Usage: exorcist wrap <mcp.json> [options]
38434
38426
  exorcist unwrap <mcp.json>
@@ -38440,7 +38432,7 @@ unwrap Put the original file back byte for byte, if it was not edited since
38440
38432
 
38441
38433
  Options (wrap):
38442
38434
  --bin <command> Command that runs the shield (default: exorcist)
38443
- --bin-arg <arg> Argument before "shield" (repeatable), e.g. --bin npx --bin-arg -y --bin-arg @exorcist-98/cli@0.3.5
38435
+ --bin-arg <arg> Argument before "shield" (repeatable), e.g. --bin npx --bin-arg -y --bin-arg @exorcist-98/cli@0.3.6
38444
38436
  --dir <folder> State folder (default: ${DEFAULT_DIR})
38445
38437
  --dry-run Show the result without writing the file
38446
38438
  `;
@@ -38467,7 +38459,7 @@ function dirsInConfig(cfg) {
38467
38459
  return out;
38468
38460
  }
38469
38461
  function readConfig2(path, io) {
38470
- if (!existsSync22(path)) {
38462
+ if (!existsSync21(path)) {
38471
38463
  io.err(`File not found: ${path}`);
38472
38464
  return null;
38473
38465
  }
@@ -39760,7 +39752,7 @@ ${CONSOLE_HELP}`);
39760
39752
  }
39761
39753
 
39762
39754
  // src/commands/exorcise.ts
39763
- import { existsSync as existsSync23, readFileSync as readFileSync31, statSync as statSync21 } from "node:fs";
39755
+ import { existsSync as existsSync22, readFileSync as readFileSync31, statSync as statSync21 } from "node:fs";
39764
39756
  import { basename as basename11, dirname as dirname17, isAbsolute as isAbsolute22, relative as relative15, resolve as resolve32 } from "node:path";
39765
39757
  var EXORCISE_HELP = `Usage: exorcist exorcise [path] [options]
39766
39758
 
@@ -39846,7 +39838,7 @@ ${EXORCISE_HELP}`);
39846
39838
  }
39847
39839
  const target = p.positionals[0] ?? ".";
39848
39840
  const abs = resolve32(target);
39849
- if (!existsSync23(abs)) {
39841
+ if (!existsSync22(abs)) {
39850
39842
  io.err(`Path not found: ${target}`);
39851
39843
  return 2;
39852
39844
  }
@@ -39938,7 +39930,7 @@ ${EXORCISE_HELP}`);
39938
39930
  }
39939
39931
 
39940
39932
  // src/commands/gate.ts
39941
- import { existsSync as existsSync24 } from "node:fs";
39933
+ import { existsSync as existsSync23 } from "node:fs";
39942
39934
  import { lstat as lstat2, readFile as readFile6 } from "node:fs/promises";
39943
39935
  import { resolve as resolve33 } from "node:path";
39944
39936
  var GATE_HELP = `Usage: exorcist gate [dir] [--fail-on <critical|high|medium|low>] [--dir <state folder>]
@@ -40025,7 +40017,7 @@ ${GATE_HELP}`);
40025
40017
  return 2;
40026
40018
  }
40027
40019
  const start = resolve33(p.positionals[0] ?? ".");
40028
- if (!existsSync24(start)) return nothingChecked(io, "that folder does not exist");
40020
+ if (!existsSync23(start)) return nothingChecked(io, "that folder does not exist");
40029
40021
  const top = await gitRepoRoot(start);
40030
40022
  if (!top) return nothingChecked(io, "this folder is not a git repository, or git is not available");
40031
40023
  const repo = { root: top };
@@ -40368,7 +40360,7 @@ async function guardShellReadCommand(stdin, io) {
40368
40360
  }
40369
40361
 
40370
40362
  // src/commands/hook-scan.ts
40371
- import { existsSync as existsSync25, statSync as statSync22 } from "node:fs";
40363
+ import { existsSync as existsSync24, statSync as statSync22 } from "node:fs";
40372
40364
  import { resolve as resolve34 } from "node:path";
40373
40365
  async function hookScanCommand(stdin, io) {
40374
40366
  let event;
@@ -40380,12 +40372,12 @@ async function hookScanCommand(stdin, io) {
40380
40372
  if (typeof event.file_path !== "string" || event.file_path === "") return 0;
40381
40373
  const base = typeof event.cwd === "string" && event.cwd ? event.cwd : process.cwd();
40382
40374
  const file = resolve34(base, event.file_path);
40383
- if (!existsSync25(file) || !statSync22(file).isFile()) return 0;
40375
+ if (!existsSync24(file) || !statSync22(file).isFile()) return 0;
40384
40376
  return await scanCommand([file, "--fail-on", "high"], { out: io.err, err: io.err });
40385
40377
  }
40386
40378
 
40387
40379
  // src/commands/init.ts
40388
- import { chmodSync, existsSync as existsSync26, lstatSync as lstatSync15, mkdirSync as mkdirSync11, readFileSync as readFileSync33, writeFileSync as writeFileSync12 } from "node:fs";
40380
+ import { chmodSync, existsSync as existsSync25, lstatSync as lstatSync15, mkdirSync as mkdirSync11, readFileSync as readFileSync33, writeFileSync as writeFileSync12 } from "node:fs";
40389
40381
  import { dirname as dirname18, join as join39, resolve as resolve35 } from "node:path";
40390
40382
 
40391
40383
  // src/kiro-hook-script.ts
@@ -40514,8 +40506,8 @@ function reviewerAgentForProject(mcpCommand) {
40514
40506
  }
40515
40507
 
40516
40508
  // src/commands/init.ts
40517
- var DEFAULT_BIN = "npx -y @exorcist-98/cli@0.3.5";
40518
- var DEFAULT_MCP_BIN = "npx -y @exorcist-98/mcp-server@0.3.5";
40509
+ var DEFAULT_BIN = "npx -y @exorcist-98/cli@0.3.6";
40510
+ var DEFAULT_MCP_BIN = "npx -y @exorcist-98/mcp-server@0.3.6";
40519
40511
  var MISSING_FROM_DEFAULT_BIN = /* @__PURE__ */ new Set();
40520
40512
  var INIT_HELP = `Usage: exorcist init [folder] [--kiro] [--shield] [--sandbox] [--no-agent] [--force]
40521
40513
  [--bin <command>] [--mcp-bin <command>]
@@ -40628,7 +40620,7 @@ function splitCommand(s) {
40628
40620
  }
40629
40621
  var MAX_NAME = 60;
40630
40622
  function describeMcpConfig(path) {
40631
- if (!existsSync26(path)) return { exists: false, warnings: [], line: "no .kiro/settings/mcp.json yet (the mcp-scan hook scans it once you add one)" };
40623
+ if (!existsSync25(path)) return { exists: false, warnings: [], line: "no .kiro/settings/mcp.json yet (the mcp-scan hook scans it once you add one)" };
40632
40624
  try {
40633
40625
  const cfg = JSON.parse(readFileSync33(path, "utf8"));
40634
40626
  const entries = Object.entries(cfg.mcpServers ?? {});
@@ -40813,7 +40805,7 @@ ${INIT_HELP}`);
40813
40805
  const done = [];
40814
40806
  for (const f of files) {
40815
40807
  const path = join39(root, f.rel);
40816
- if (existsSync26(path) && !force) {
40808
+ if (existsSync25(path) && !force) {
40817
40809
  io.err(`Kept existing ${f.rel} (use --force to replace it).`);
40818
40810
  done.push({ f, wrote: false });
40819
40811
  continue;
@@ -40884,7 +40876,7 @@ ${INIT_HELP}`);
40884
40876
  "then reconnect MCP servers in the MCP panel so they start through the Shield."
40885
40877
  ];
40886
40878
  if (isDefaultBin) {
40887
- lines.push("Commands run through npx (@exorcist-98/cli@0.3.5). If Kiro cannot start a wrapped server or a hook cannot find npx,");
40879
+ lines.push("Commands run through npx (@exorcist-98/cli@0.3.6). If Kiro cannot start a wrapped server or a hook cannot find npx,");
40888
40880
  lines.push('rerun with --bin "<absolute path to node> <absolute path to the exorcist CLI>" and --force.');
40889
40881
  }
40890
40882
  io.out(lines.join("\n"));
@@ -40893,7 +40885,7 @@ ${INIT_HELP}`);
40893
40885
  }
40894
40886
 
40895
40887
  // src/commands/lock.ts
40896
- import { existsSync as existsSync27, readFileSync as readFileSync34, writeFileSync as writeFileSync13 } from "node:fs";
40888
+ import { existsSync as existsSync26, readFileSync as readFileSync34, writeFileSync as writeFileSync13 } from "node:fs";
40897
40889
  import { isAbsolute as isAbsolute27, join as join40, resolve as resolve36 } from "node:path";
40898
40890
 
40899
40891
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/core.js
@@ -48267,7 +48259,7 @@ var RawToolsPage = external_exports.object({ tools: external_exports.array(exter
48267
48259
  var firstLine2 = (err) => (err instanceof Error ? err.message : String(err)).split("\n")[0]?.slice(0, 300) ?? "unknown error";
48268
48260
  async function listTools(o) {
48269
48261
  const transport = new StdioClientTransport({ command: o.command, args: o.args, env: o.env, cwd: o.cwd, stderr: "ignore" });
48270
- const client = new Client({ name: "exorcist-lock", version: "0.3.5" }, { capabilities: {} });
48262
+ const client = new Client({ name: "exorcist-lock", version: "0.3.6" }, { capabilities: {} });
48271
48263
  let timer;
48272
48264
  const timedOut = new Promise((res) => {
48273
48265
  timer = setTimeout(() => res({ ok: false, error: `it did not list its tools within ${o.timeoutMs} ms.` }), o.timeoutMs);
@@ -48432,7 +48424,7 @@ ${LOCK_HELP}`);
48432
48424
  return 2;
48433
48425
  }
48434
48426
  let previous;
48435
- if (existsSync27(lockPath2)) {
48427
+ if (existsSync26(lockPath2)) {
48436
48428
  let text2;
48437
48429
  try {
48438
48430
  text2 = readFileSync34(lockPath2, "utf8");
@@ -48461,7 +48453,7 @@ ${LOCK_HELP}`);
48461
48453
  current = pinsToLock(st.state);
48462
48454
  } else {
48463
48455
  const configPath = resolve36(str4(p.values["config"]) ?? DEFAULT_CONFIG);
48464
- if (!existsSync27(configPath)) {
48456
+ if (!existsSync26(configPath)) {
48465
48457
  io.err(`MCP config not found: ${configPath}. Pass --config <file>, or --from-shield.`);
48466
48458
  return 2;
48467
48459
  }
@@ -48509,7 +48501,7 @@ ${LOCK_HELP}`);
48509
48501
  }
48510
48502
 
48511
48503
  // src/commands/map.ts
48512
- import { existsSync as existsSync28, statSync as statSync23 } from "node:fs";
48504
+ import { existsSync as existsSync27, statSync as statSync23 } from "node:fs";
48513
48505
  import { resolve as resolve37 } from "node:path";
48514
48506
  var MAP_HELP = `Usage: exorcist map [dir] [options]
48515
48507
 
@@ -48606,7 +48598,7 @@ ${MAP_HELP}`);
48606
48598
  }
48607
48599
  const target = p.positionals[0] ?? ".";
48608
48600
  const root = resolve37(target);
48609
- if (!existsSync28(root) || !statSync23(root).isDirectory()) {
48601
+ if (!existsSync27(root) || !statSync23(root).isDirectory()) {
48610
48602
  io.err(`Folder not found: ${target}`);
48611
48603
  return 2;
48612
48604
  }
@@ -48628,7 +48620,7 @@ ${MAP_HELP}`);
48628
48620
  }
48629
48621
 
48630
48622
  // src/commands/origin.ts
48631
- import { existsSync as existsSync29, realpathSync as realpathSync11, statSync as statSync24 } from "node:fs";
48623
+ import { existsSync as existsSync28, realpathSync as realpathSync11, statSync as statSync24 } from "node:fs";
48632
48624
  import { posix as posix3, relative as relative16, resolve as resolve38, sep as sep8 } from "node:path";
48633
48625
  var ORIGIN_HELP = `Usage: exorcist origin [dir] [options]
48634
48626
 
@@ -48752,7 +48744,7 @@ ${ORIGIN_HELP}`);
48752
48744
  return 2;
48753
48745
  }
48754
48746
  const target = resolve38(p.positionals[0] ?? ".");
48755
- if (!existsSync29(target) || !statSync24(target).isDirectory()) {
48747
+ if (!existsSync28(target) || !statSync24(target).isDirectory()) {
48756
48748
  io.err(`Not a directory: ${target}`);
48757
48749
  return 2;
48758
48750
  }
@@ -49165,7 +49157,7 @@ ${VAULT_HELP}`);
49165
49157
  }
49166
49158
 
49167
49159
  // src/index.ts
49168
- var VERSION = "0.3.5";
49160
+ var VERSION = "0.3.6";
49169
49161
  var HELP = `Exorcist 98 ${VERSION}: antivirus for AI coding agents
49170
49162
 
49171
49163
  Usage: exorcist <command> [options]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exorcist-98/cli",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Exorcist 98: antivirus for AI coding agents. Scan repos, shield MCP servers, quarantine threats.",