archctx 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/archctx.mjs CHANGED
@@ -696,13 +696,13 @@ function productVersionManifest() {
696
696
  sqliteMigrations: "0001_runtime_state..0004_changeset_journal",
697
697
  codeGraph: {
698
698
  packageName: "@colbymchenry/codegraph",
699
- requiredVersion: "1.0.1",
699
+ requiredVersion: "1.4.0",
700
700
  adapter: "codegraph-cli"
701
701
  }
702
702
  }
703
703
  };
704
704
  }
705
- var ARCHCONTEXT_PRODUCT_NAME = "archctx", ARCHCONTEXT_PRODUCT_VERSION = "0.2.2", ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.3.10", ARCHCONTEXT_NODE_RANGE = ">=24 <26", LOCAL_RUNTIME_RPC_SCHEMA_VERSION = "archcontext.runtime-rpc/v1", ARCHCONTEXT_SCHEMA_SET_VERSION = "2026-06-25.al0-ledger";
705
+ var ARCHCONTEXT_PRODUCT_NAME = "archctx", ARCHCONTEXT_PRODUCT_VERSION = "0.2.3", ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.3.10", ARCHCONTEXT_NODE_RANGE = ">=24 <26", LOCAL_RUNTIME_RPC_SCHEMA_VERSION = "archcontext.runtime-rpc/v1", ARCHCONTEXT_SCHEMA_SET_VERSION = "2026-06-25.al0-ledger";
706
706
  // packages/contracts/src/index.ts
707
707
  var init_src = __esm(() => {
708
708
  init_control_plane_routes();
@@ -5145,8 +5145,8 @@ var init_src7 = __esm(() => {
5145
5145
 
5146
5146
  // packages/surfaces/cli/src/main.ts
5147
5147
  import { execFileSync as execFileSync8, spawn as spawn2, spawnSync as spawnSync3 } from "child_process";
5148
- import { accessSync, chmodSync as chmodSync5, closeSync as closeSync7, constants, existsSync as existsSync15, mkdirSync as mkdirSync9, openSync as openSync7, readFileSync as readFileSync13, rmSync as rmSync10, statSync as statSync8, writeFileSync as writeFileSync8 } from "fs";
5149
- import { dirname as dirname10, join as join10, resolve as resolve17 } from "path";
5148
+ import { accessSync as accessSync2, chmodSync as chmodSync5, closeSync as closeSync7, constants, existsSync as existsSync15, mkdirSync as mkdirSync9, openSync as openSync7, readFileSync as readFileSync14, rmSync as rmSync10, statSync as statSync8, writeFileSync as writeFileSync8 } from "fs";
5149
+ import { dirname as dirname11, join as join10, resolve as resolve18 } from "path";
5150
5150
  import { fileURLToPath as fileURLToPath2 } from "url";
5151
5151
 
5152
5152
  // packages/contracts/src/index.ts
@@ -5292,8 +5292,8 @@ var UNTRUSTED_TOOL_ESCAPE_KEYS = new Set([
5292
5292
  ]);
5293
5293
 
5294
5294
  // packages/cloud/hardening/src/index.ts
5295
- import { readdirSync as readdirSync3, readFileSync as readFileSync3, statSync as statSync4 } from "node:fs";
5296
- import { resolve as resolve3 } from "node:path";
5295
+ import { readdirSync as readdirSync3, readFileSync as readFileSync4, statSync as statSync4 } from "node:fs";
5296
+ import { resolve as resolve4 } from "node:path";
5297
5297
 
5298
5298
  // packages/core/architecture-domain/src/index.ts
5299
5299
  init_src();
@@ -5654,8 +5654,9 @@ init_src2();
5654
5654
 
5655
5655
  // packages/local-runtime/codegraph-adapter/src/index.ts
5656
5656
  import { execFileSync } from "node:child_process";
5657
- import { closeSync, existsSync, openSync, readSync, realpathSync as realpathSync3, statSync as statSync3 } from "node:fs";
5658
- import { basename as basename2, delimiter, isAbsolute, join, posix } from "node:path";
5657
+ import { accessSync, closeSync, constants as fsConstants, existsSync, openSync, readFileSync as readFileSync3, readSync, realpathSync as realpathSync3, statSync as statSync3 } from "node:fs";
5658
+ import { createRequire as createRequire2 } from "node:module";
5659
+ import { basename as basename2, delimiter, dirname, isAbsolute, join, posix, resolve as resolve3 } from "node:path";
5659
5660
 
5660
5661
  // packages/core/architecture-delta/src/index.ts
5661
5662
  init_src();
@@ -6582,9 +6583,11 @@ function numberExtension(value) {
6582
6583
  // packages/local-runtime/codegraph-adapter/src/index.ts
6583
6584
  init_src();
6584
6585
  var REQUIRED_CODEGRAPH_PACKAGE = "@colbymchenry/codegraph";
6585
- var REQUIRED_CODEGRAPH_VERSION = "1.0.1";
6586
+ var REQUIRED_CODEGRAPH_VERSION = "1.4.0";
6586
6587
  var CODEGRAPH_TELEMETRY_ENV = "DO_NOT_TRACK";
6587
6588
  var CODEGRAPH_TELEMETRY_DISABLED_VALUE = "1";
6589
+ var DEFAULT_CODEGRAPH_BINARY = "codegraph";
6590
+ var requireFromAdapter = createRequire2(import.meta.url);
6588
6591
  function disableCodeGraphTelemetryByDefault(env = process.env) {
6589
6592
  env[CODEGRAPH_TELEMETRY_ENV] ??= CODEGRAPH_TELEMETRY_DISABLED_VALUE;
6590
6593
  return env[CODEGRAPH_TELEMETRY_ENV] ?? CODEGRAPH_TELEMETRY_DISABLED_VALUE;
@@ -6595,7 +6598,7 @@ class CodeGraphCliProvider {
6595
6598
  version = REQUIRED_CODEGRAPH_VERSION;
6596
6599
  capabilities = ["index", "context", "impact"];
6597
6600
  workspaceRoot;
6598
- constructor(workspaceRoot = process.cwd(), binary = "codegraph") {
6601
+ constructor(workspaceRoot = process.cwd(), binary = DEFAULT_CODEGRAPH_BINARY) {
6599
6602
  this.binary = binary;
6600
6603
  this.workspaceRoot = workspaceRoot;
6601
6604
  }
@@ -6679,27 +6682,56 @@ class CodeGraphCliProvider {
6679
6682
  }
6680
6683
  }
6681
6684
  }
6682
- function codeGraphCliInvocation(binary, cwd) {
6683
- const resolved = resolveExecutable(binary, cwd);
6685
+ function codeGraphCliInvocation(binary, cwd, pathValue = process.env.PATH ?? "") {
6686
+ const resolved = resolveExecutable(binary, cwd, pathValue);
6684
6687
  if (resolved && isNodeRuntimeScript(resolved)) {
6685
6688
  return { command: process.execPath, argsPrefix: [resolved] };
6686
6689
  }
6690
+ if (!resolved && binary === DEFAULT_CODEGRAPH_BINARY) {
6691
+ const packagedShim = resolvePackagedCodeGraphShim();
6692
+ if (packagedShim)
6693
+ return { command: process.execPath, argsPrefix: [packagedShim] };
6694
+ }
6687
6695
  return { command: binary, argsPrefix: [] };
6688
6696
  }
6689
- function resolveExecutable(binary, cwd) {
6697
+ function resolveExecutable(binary, cwd, pathValue) {
6690
6698
  if (binary.includes("/") || binary.includes("\\")) {
6691
6699
  const path = isAbsolute(binary) ? binary : join(cwd, binary);
6692
6700
  return existsSync(path) ? realpathSync3.native(path) : undefined;
6693
6701
  }
6694
- for (const dir of (process.env.PATH ?? "").split(delimiter)) {
6702
+ for (const dir of pathValue.split(delimiter)) {
6695
6703
  if (!dir)
6696
6704
  continue;
6697
6705
  const path = join(dir, binary);
6698
- if (existsSync(path))
6706
+ if (isExecutablePath(path))
6699
6707
  return realpathSync3.native(path);
6700
6708
  }
6701
6709
  return;
6702
6710
  }
6711
+ function isExecutablePath(path) {
6712
+ try {
6713
+ if (!statSync3(path).isFile())
6714
+ return false;
6715
+ if (process.platform !== "win32")
6716
+ accessSync(path, fsConstants.X_OK);
6717
+ return true;
6718
+ } catch {
6719
+ return false;
6720
+ }
6721
+ }
6722
+ function resolvePackagedCodeGraphShim() {
6723
+ try {
6724
+ const manifestPath = requireFromAdapter.resolve(`${REQUIRED_CODEGRAPH_PACKAGE}/package.json`);
6725
+ const manifest = JSON.parse(readFileSync3(manifestPath, "utf8"));
6726
+ const relativeBin = manifest.bin?.codegraph;
6727
+ if (manifest.version !== REQUIRED_CODEGRAPH_VERSION || !relativeBin)
6728
+ return;
6729
+ const shimPath = resolve3(dirname(manifestPath), relativeBin);
6730
+ return existsSync(shimPath) ? realpathSync3.native(shimPath) : undefined;
6731
+ } catch {
6732
+ return;
6733
+ }
6734
+ }
6703
6735
  function isNodeRuntimeScript(path) {
6704
6736
  if (/\.[cm]?js$/i.test(path))
6705
6737
  return true;
@@ -7094,7 +7126,7 @@ function uninstallMarker(content, host) {
7094
7126
  `).trim();
7095
7127
  }
7096
7128
  function dependencyAudit(root) {
7097
- const packageJson = JSON.parse(readFileSync3(resolve3(root, "package.json"), "utf8"));
7129
+ const packageJson = JSON.parse(readFileSync4(resolve4(root, "package.json"), "utf8"));
7098
7130
  const issues = [];
7099
7131
  if (!packageJson.engines?.node?.includes(">=24"))
7100
7132
  issues.push("node engine must include >=24");
@@ -7107,7 +7139,7 @@ function secretScan(root) {
7107
7139
  continue;
7108
7140
  if (file === "packages/cloud/hardening/src/index.ts" || file.includes("/test/"))
7109
7141
  continue;
7110
- const body = readFileSync3(resolve3(root, file), "utf8");
7142
+ const body = readFileSync4(resolve4(root, file), "utf8");
7111
7143
  if (/(sk-[A-Za-z0-9]{20,}|ghp_[A-Za-z0-9]{20,}|BEGIN PRIVATE KEY)/.test(body))
7112
7144
  findings.push(file);
7113
7145
  }
@@ -7141,11 +7173,11 @@ function listFiles(root) {
7141
7173
  walk(".");
7142
7174
  return out;
7143
7175
  function walk(relativeDir) {
7144
- for (const entry of readdirSync3(resolve3(root, relativeDir), { withFileTypes: true })) {
7176
+ for (const entry of readdirSync3(resolve4(root, relativeDir), { withFileTypes: true })) {
7145
7177
  if ([".git", "node_modules", "coverage"].includes(entry.name))
7146
7178
  continue;
7147
7179
  const child = relativeDir === "." ? entry.name : `${relativeDir}/${entry.name}`;
7148
- const full = resolve3(root, child);
7180
+ const full = resolve4(root, child);
7149
7181
  if (entry.isDirectory())
7150
7182
  walk(child);
7151
7183
  if (entry.isFile() && statSync4(full).size < 1e6)
@@ -7157,10 +7189,10 @@ function listFiles(root) {
7157
7189
  // packages/local-runtime/local-store-sqlite/src/index.ts
7158
7190
  import { execFileSync as execFileSync2 } from "node:child_process";
7159
7191
  import { createHash as createHash5, randomUUID } from "node:crypto";
7160
- import { chmodSync, closeSync as closeSync2, existsSync as existsSync2, fsyncSync, lstatSync, mkdirSync, openSync as openSync2, readFileSync as readFileSync4, realpathSync as realpathSync4, renameSync, rmSync, writeFileSync } from "node:fs";
7161
- import { createRequire as createRequire2 } from "node:module";
7192
+ import { chmodSync, closeSync as closeSync2, existsSync as existsSync2, fsyncSync, lstatSync, mkdirSync, openSync as openSync2, readFileSync as readFileSync5, realpathSync as realpathSync4, renameSync, rmSync, writeFileSync } from "node:fs";
7193
+ import { createRequire as createRequire3 } from "node:module";
7162
7194
  import { homedir } from "node:os";
7163
- import { dirname, isAbsolute as isAbsolute2, join as join2, relative as relative3, resolve as resolve4 } from "node:path";
7195
+ import { dirname as dirname2, isAbsolute as isAbsolute2, join as join2, relative as relative3, resolve as resolve5 } from "node:path";
7164
7196
 
7165
7197
  // packages/core/architecture-ledger/src/index.ts
7166
7198
  init_src();
@@ -8994,7 +9026,7 @@ function assertRecord(value, label) {
8994
9026
 
8995
9027
  // packages/local-runtime/local-store-sqlite/src/index.ts
8996
9028
  init_src();
8997
- var runtimeRequire = createRequire2(import.meta.url);
9029
+ var runtimeRequire = createRequire3(import.meta.url);
8998
9030
  var SQLITE_SIDECAR_SUFFIXES = ["", "-wal", "-shm"];
8999
9031
  var LEGACY_MIGRATION_MARKER_FILE = "runtime.sqlite.migration.json";
9000
9032
  var LEGACY_MIGRATION_LOCK_FILE = "runtime.sqlite.migration.lock";
@@ -9567,7 +9599,7 @@ var ARCHCONTEXT_LOCAL_STORE_PATH_ENV = "ARCHCONTEXT_LOCAL_STORE_PATH";
9567
9599
  function defaultArchContextStateRoot(env = process.env, platform = process.platform, home = homedir()) {
9568
9600
  const override = env[ARCHCONTEXT_STATE_DIR_ENV];
9569
9601
  if (override)
9570
- return { path: resolve4(override), source: "environment" };
9602
+ return { path: resolve5(override), source: "environment" };
9571
9603
  if (platform === "darwin")
9572
9604
  return { path: join2(home, "Library", "Application Support", "ArchContext"), source: "os-user-data" };
9573
9605
  if (platform === "win32")
@@ -9585,7 +9617,7 @@ function runtimeStatePaths(root = process.cwd(), env = process.env) {
9585
9617
  const stateRoot = defaultArchContextStateRoot(env);
9586
9618
  const repositoryStateDir = join2(stateRoot.path, "repositories", storageRepositoryId);
9587
9619
  const workspaceStateDir = join2(repositoryStateDir, "worktrees", storageWorkspaceId);
9588
- const legacyControlDir = resolve4(canonicalRepositoryRoot3, ".archcontext", ".local");
9620
+ const legacyControlDir = resolve5(canonicalRepositoryRoot3, ".archcontext", ".local");
9589
9621
  return {
9590
9622
  schemaVersion: "archcontext.runtime-state-paths/v1",
9591
9623
  stateRoot: stateRoot.path,
@@ -9653,7 +9685,7 @@ function migrateLegacyLocalStoreIfNeeded(root = process.cwd(), env = process.env
9653
9685
  status: "explicit-local-store-override"
9654
9686
  });
9655
9687
  }
9656
- ensurePrivateDir(dirname(paths.localStorePath));
9688
+ ensurePrivateDir(dirname2(paths.localStorePath));
9657
9689
  const legacyExists = existsSync2(paths.legacyLocalStorePath);
9658
9690
  const integrityCheck = {};
9659
9691
  const quarantinedFiles = [];
@@ -9751,7 +9783,7 @@ function readAppliedLocalSqliteMigrations(db) {
9751
9783
  }
9752
9784
  function openSqliteDatabaseSync(databasePath) {
9753
9785
  if (databasePath !== ":memory:")
9754
- ensurePrivateDir(dirname(databasePath));
9786
+ ensurePrivateDir(dirname2(databasePath));
9755
9787
  try {
9756
9788
  const nodeSqlite = runtimeRequire("node:sqlite");
9757
9789
  const db2 = new nodeSqlite.DatabaseSync(databasePath);
@@ -9928,7 +9960,7 @@ function publishStagedLocalStore(stagingPath, targetPath) {
9928
9960
  }
9929
9961
  renameSync(stagingPath, targetPath);
9930
9962
  makePrivateFile(targetPath);
9931
- fsyncDirectory(dirname(targetPath));
9963
+ fsyncDirectory(dirname2(targetPath));
9932
9964
  }
9933
9965
  function writeLegacyMigrationMarker(paths, integrityCheck, quarantinedFiles) {
9934
9966
  const markerPath = legacyMigrationMarkerPath(paths);
@@ -9944,7 +9976,7 @@ function writeLegacyMigrationMarker(paths, integrityCheck, quarantinedFiles) {
9944
9976
  }
9945
9977
  function acquireLegacyMigrationLock(paths) {
9946
9978
  const lockPath = legacyMigrationLockPath(paths);
9947
- ensurePrivateDir(dirname(lockPath));
9979
+ ensurePrivateDir(dirname2(lockPath));
9948
9980
  try {
9949
9981
  const fd = openSync2(lockPath, "wx", 384);
9950
9982
  writeFileSync(fd, JSON.stringify({
@@ -9973,7 +10005,7 @@ function releaseLegacyMigrationLock(lock) {
9973
10005
  }
9974
10006
  function isStaleMigrationLock(lockPath) {
9975
10007
  try {
9976
- const parsed = JSON.parse(readFileSync4(lockPath, "utf8"));
10008
+ const parsed = JSON.parse(readFileSync5(lockPath, "utf8"));
9977
10009
  if (typeof parsed.pid !== "number" || parsed.pid <= 0)
9978
10010
  return true;
9979
10011
  return !isProcessAlive(parsed.pid);
@@ -10008,7 +10040,7 @@ function quarantineExistingLocalStore(paths) {
10008
10040
  quarantinedFiles.push(target);
10009
10041
  }
10010
10042
  fsyncDirectory(quarantineDir);
10011
- fsyncDirectory(dirname(paths.localStorePath));
10043
+ fsyncDirectory(dirname2(paths.localStorePath));
10012
10044
  return quarantinedFiles;
10013
10045
  }
10014
10046
  function legacyMigrationMarkerPath(paths) {
@@ -10018,7 +10050,7 @@ function legacyMigrationLockPath(paths) {
10018
10050
  return join2(paths.workspaceStateDir, LEGACY_MIGRATION_LOCK_FILE);
10019
10051
  }
10020
10052
  function writePrivateJson(path, value) {
10021
- ensurePrivateDir(dirname(path));
10053
+ ensurePrivateDir(dirname2(path));
10022
10054
  const fd = openSync2(path, "w", 384);
10023
10055
  try {
10024
10056
  writeFileSync(fd, JSON.stringify(value, null, 2), "utf8");
@@ -10027,7 +10059,7 @@ function writePrivateJson(path, value) {
10027
10059
  closeSync2(fd);
10028
10060
  }
10029
10061
  makePrivateFile(path);
10030
- fsyncDirectory(dirname(path));
10062
+ fsyncDirectory(dirname2(path));
10031
10063
  }
10032
10064
  function ensurePrivateDir(path) {
10033
10065
  mkdirSync(path, { recursive: true, mode: 448 });
@@ -10057,10 +10089,10 @@ function readGitPath(root, args) {
10057
10089
  }
10058
10090
  }
10059
10091
  function resolveMaybeRelative(base, path) {
10060
- return isAbsolute2(path) ? resolve4(path) : resolve4(base, path);
10092
+ return isAbsolute2(path) ? resolve5(path) : resolve5(base, path);
10061
10093
  }
10062
10094
  function canonicalPath(path) {
10063
- const resolved = resolve4(path);
10095
+ const resolved = resolve5(path);
10064
10096
  try {
10065
10097
  return realpathSync4.native(resolved);
10066
10098
  } catch {
@@ -10068,8 +10100,8 @@ function canonicalPath(path) {
10068
10100
  }
10069
10101
  }
10070
10102
  function isPathInsideOrSame(path, parent) {
10071
- const child = resolve4(path);
10072
- const base = resolve4(parent);
10103
+ const child = resolve5(path);
10104
+ const base = resolve5(parent);
10073
10105
  const fromBase = relative3(base, child);
10074
10106
  return fromBase === "" || !!fromBase && !fromBase.startsWith("..") && !isAbsolute2(fromBase);
10075
10107
  }
@@ -10100,21 +10132,21 @@ function isIgnorableDirectoryFsyncError(error) {
10100
10132
  // packages/local-runtime/git-adapter/src/index.ts
10101
10133
  import { execFileSync as execFileSync3, spawnSync } from "node:child_process";
10102
10134
  import { existsSync as existsSync3, mkdirSync as mkdirSync2, mkdtempSync, rmSync as rmSync2 } from "node:fs";
10103
- import { dirname as dirname2, join as join3, resolve as resolve5 } from "node:path";
10135
+ import { dirname as dirname3, join as join3, resolve as resolve6 } from "node:path";
10104
10136
  init_src();
10105
10137
  function findRepositoryRoot(start) {
10106
10138
  try {
10107
- return resolve5(execFileSync3("git", ["rev-parse", "--show-toplevel"], {
10139
+ return resolve6(execFileSync3("git", ["rev-parse", "--show-toplevel"], {
10108
10140
  cwd: start,
10109
10141
  encoding: "utf8",
10110
10142
  stdio: ["ignore", "pipe", "ignore"]
10111
10143
  }).trim());
10112
10144
  } catch {
10113
- let cursor = resolve5(start);
10145
+ let cursor = resolve6(start);
10114
10146
  while (true) {
10115
- if (existsSync3(resolve5(cursor, ".git")))
10147
+ if (existsSync3(resolve6(cursor, ".git")))
10116
10148
  return cursor;
10117
- const parent = dirname2(cursor);
10149
+ const parent = dirname3(cursor);
10118
10150
  if (parent === cursor)
10119
10151
  break;
10120
10152
  cursor = parent;
@@ -10137,19 +10169,19 @@ function readHeadSha(root) {
10137
10169
  // packages/local-runtime/runtime-daemon/src/index.ts
10138
10170
  import { randomBytes } from "node:crypto";
10139
10171
  import { execFileSync as execFileSync6 } from "node:child_process";
10140
- import { chmodSync as chmodSync3, closeSync as closeSync5, existsSync as existsSync13, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync4, openSync as openSync5, readdirSync as readdirSync8, readFileSync as readFileSync11, rmSync as rmSync8, statSync as statSync6, writeFileSync as writeFileSync6 } from "node:fs";
10172
+ import { chmodSync as chmodSync3, closeSync as closeSync5, existsSync as existsSync13, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync4, openSync as openSync5, readdirSync as readdirSync8, readFileSync as readFileSync12, rmSync as rmSync8, statSync as statSync6, writeFileSync as writeFileSync6 } from "node:fs";
10141
10173
  import { createServer } from "node:http";
10142
10174
  import { tmpdir as tmpdir3 } from "node:os";
10143
- import { dirname as dirname8, join as join8, resolve as resolve15 } from "node:path";
10175
+ import { dirname as dirname9, join as join8, resolve as resolve16 } from "node:path";
10144
10176
 
10145
10177
  // packages/core/changeset-engine/src/index.ts
10146
10178
  init_src();
10147
- import { closeSync as closeSync3, existsSync as existsSync5, fsyncSync as fsyncSync2, lstatSync as lstatSync2, mkdirSync as mkdirSync3, openSync as openSync3, readFileSync as readFileSync5, renameSync as renameSync2, rmSync as rmSync3, writeFileSync as writeFileSync2 } from "node:fs";
10148
- import { dirname as dirname3, resolve as resolve7 } from "node:path";
10179
+ import { closeSync as closeSync3, existsSync as existsSync5, fsyncSync as fsyncSync2, lstatSync as lstatSync2, mkdirSync as mkdirSync3, openSync as openSync3, readFileSync as readFileSync6, renameSync as renameSync2, rmSync as rmSync3, writeFileSync as writeFileSync2 } from "node:fs";
10180
+ import { dirname as dirname4, resolve as resolve8 } from "node:path";
10149
10181
 
10150
10182
  // packages/core/policy-engine/src/index.ts
10151
10183
  import { existsSync as existsSync4, realpathSync as realpathSync5 } from "node:fs";
10152
- import { isAbsolute as isAbsolute3, relative as relative4, resolve as resolve6, sep as sep3 } from "node:path";
10184
+ import { isAbsolute as isAbsolute3, relative as relative4, resolve as resolve7, sep as sep3 } from "node:path";
10153
10185
  init_src();
10154
10186
  var INVALID_COMPAT_REASONS = new Set(["just in case", "safer to keep", "many internal callers", "large diff", "old code already exists"]);
10155
10187
  var PLACEHOLDER_DIGEST = `sha256:${"0".repeat(64)}`;
@@ -10190,8 +10222,8 @@ function assertAllowedArchContextPath(root, relativePath) {
10190
10222
  if (!ALLOWLIST.some((prefix) => normalized.startsWith(prefix))) {
10191
10223
  throw new Error(`Path is outside ArchContext write allowlist: ${relativePath}`);
10192
10224
  }
10193
- const absoluteRoot = resolve6(root);
10194
- const absoluteTarget = resolve6(root, relativePath);
10225
+ const absoluteRoot = resolve7(root);
10226
+ const absoluteTarget = resolve7(root, relativePath);
10195
10227
  const targetFromRoot = relative4(absoluteRoot, absoluteTarget);
10196
10228
  if (targetFromRoot === "" || targetFromRoot === ".." || targetFromRoot.startsWith(`..${sep3}`) || isAbsolute3(targetFromRoot)) {
10197
10229
  throw new Error(`Path escapes repository: ${relativePath}`);
@@ -10201,7 +10233,7 @@ function assertAllowedArchContextPath(root, relativePath) {
10201
10233
  const canonicalRoot = realpathSync5.native(absoluteRoot);
10202
10234
  let existingAncestor = absoluteTarget;
10203
10235
  while (!existsSync4(existingAncestor)) {
10204
- const parent = resolve6(existingAncestor, "..");
10236
+ const parent = resolve7(existingAncestor, "..");
10205
10237
  if (parent === existingAncestor)
10206
10238
  throw new Error(`Path has no existing repository ancestor: ${relativePath}`);
10207
10239
  existingAncestor = parent;
@@ -10344,7 +10376,7 @@ class ChangeSetEngine {
10344
10376
  async applyFileOperation(root, path, expectedHash, body, operation, backups, journalId, sequence) {
10345
10377
  assertSafeTarget(root, path);
10346
10378
  const deps = this.requireDeps();
10347
- const absolute = resolve7(root, path);
10379
+ const absolute = resolve8(root, path);
10348
10380
  const existed = existsSync5(absolute);
10349
10381
  const backupPath = `${absolute}.archctx-backup`;
10350
10382
  const tempPath = operation === "delete_entity" ? undefined : `${absolute}.archctx-tmp-${process.pid}-${sequence}`;
@@ -10367,7 +10399,7 @@ class ChangeSetEngine {
10367
10399
  backups.push(backup);
10368
10400
  if (existed) {
10369
10401
  renameSync2(absolute, backupPath);
10370
- fsyncDirectory2(dirname3(absolute));
10402
+ fsyncDirectory2(dirname4(absolute));
10371
10403
  }
10372
10404
  if (operation === "delete_entity") {
10373
10405
  rmSync3(absolute, { force: true });
@@ -10378,22 +10410,22 @@ class ChangeSetEngine {
10378
10410
  }
10379
10411
  function assertSafeTarget(root, path) {
10380
10412
  assertAllowedArchContextPath(root, path);
10381
- const absolute = resolve7(root, path);
10413
+ const absolute = resolve8(root, path);
10382
10414
  if (existsSync5(absolute) && lstatSync2(absolute).isSymbolicLink()) {
10383
10415
  throw new Error(`Refusing to write symlink target: ${path}`);
10384
10416
  }
10385
10417
  }
10386
10418
  function assertExpectedHash(path, expectedHash) {
10387
- const actual = digestJson({ body: readFileSync5(path, "utf8") });
10419
+ const actual = digestJson({ body: readFileSync6(path, "utf8") });
10388
10420
  if (expectedHash !== actual)
10389
10421
  throw new Error(`Expected hash mismatch: ${path}`);
10390
10422
  }
10391
10423
  function atomicWriteFile(path, tempPath, body) {
10392
- mkdirSync3(dirname3(path), { recursive: true });
10424
+ mkdirSync3(dirname4(path), { recursive: true });
10393
10425
  writeFileSync2(tempPath, body, "utf8");
10394
10426
  fsyncFile(tempPath);
10395
10427
  renameSync2(tempPath, path);
10396
- fsyncDirectory2(dirname3(path));
10428
+ fsyncDirectory2(dirname4(path));
10397
10429
  }
10398
10430
  function fsyncFile(path) {
10399
10431
  const fd = openSync3(path, process.platform === "win32" ? "r+" : "r");
@@ -10462,7 +10494,7 @@ function rollback(backups) {
10462
10494
  } else {
10463
10495
  rmSync3(backup.path, { recursive: true, force: true });
10464
10496
  }
10465
- fsyncDirectory2(dirname3(backup.path));
10497
+ fsyncDirectory2(dirname4(backup.path));
10466
10498
  }
10467
10499
  }
10468
10500
  function cleanupBackups(backups) {
@@ -10668,18 +10700,18 @@ function digestSuffix2(digest) {
10668
10700
 
10669
10701
  // packages/core/application/src/index.ts
10670
10702
  import { existsSync as existsSync8, statSync as statSync5 } from "node:fs";
10671
- import { extname, resolve as resolve10 } from "node:path";
10703
+ import { extname, resolve as resolve11 } from "node:path";
10672
10704
 
10673
10705
  // packages/core/context-compiler/src/index.ts
10674
10706
  init_src();
10675
10707
 
10676
10708
  // packages/core/practice-catalog/src/index.ts
10677
10709
  init_src();
10678
- import { existsSync as existsSync6, lstatSync as lstatSync3, readdirSync as readdirSync4, readFileSync as readFileSync6, realpathSync as realpathSync6 } from "node:fs";
10679
- import { dirname as dirname4, relative as relative5, resolve as resolve8, sep as sep4 } from "node:path";
10710
+ import { existsSync as existsSync6, lstatSync as lstatSync3, readdirSync as readdirSync4, readFileSync as readFileSync7, realpathSync as realpathSync6 } from "node:fs";
10711
+ import { dirname as dirname5, relative as relative5, resolve as resolve9, sep as sep4 } from "node:path";
10680
10712
  import { fileURLToPath } from "node:url";
10681
10713
  var PRACTICE_CATALOG_VERSION = "2026.06.0";
10682
- var BUILTIN_PRACTICE_ASSETS_DIR = resolve8(dirname4(fileURLToPath(import.meta.url)), "../assets");
10714
+ var BUILTIN_PRACTICE_ASSETS_DIR = resolve9(dirname5(fileURLToPath(import.meta.url)), "../assets");
10683
10715
  var ALLOWED_CHECK_IDS = new Set([
10684
10716
  "compatibility-contract-required",
10685
10717
  "no-new-cycle",
@@ -10731,13 +10763,13 @@ var PRACTICE_ROOT_KEYS = new Set([
10731
10763
  "overlay"
10732
10764
  ]);
10733
10765
  function loadPracticeCatalog(options = {}) {
10734
- const root = options.root ? resolve8(options.root) : process.cwd();
10766
+ const root = options.root ? resolve9(options.root) : process.cwd();
10735
10767
  const builtInAssetsDir = options.builtInAssetsDir ?? BUILTIN_PRACTICE_ASSETS_DIR;
10736
10768
  const errors = [];
10737
10769
  const warnings = [];
10738
- const builtIn = loadAssetFiles(resolve8(builtInAssetsDir, "practices"), "curated-static", errors);
10739
- const profiles = loadProfileFiles(resolve8(builtInAssetsDir, "profiles"), errors);
10740
- const sources = loadSourceFiles(resolve8(builtInAssetsDir, "sources"), errors);
10770
+ const builtIn = loadAssetFiles(resolve9(builtInAssetsDir, "practices"), "curated-static", errors);
10771
+ const profiles = loadProfileFiles(resolve9(builtInAssetsDir, "profiles"), errors);
10772
+ const sources = loadSourceFiles(resolve9(builtInAssetsDir, "sources"), errors);
10741
10773
  const overlays = options.includeRepoOverlay === false ? [] : loadRepoOverlayAssets(root, errors);
10742
10774
  const merged = mergeCatalogAssets(builtIn, overlays, errors, options.now ?? new Date().toISOString());
10743
10775
  const sourceIds = new Set(sources.map((source) => source.id));
@@ -10923,7 +10955,7 @@ function loadProfileFiles(dir, errors) {
10923
10955
  return profiles.sort((a, b) => a.id.localeCompare(b.id));
10924
10956
  }
10925
10957
  function loadRepoOverlayAssets(root, errors) {
10926
- const overlayRoot = resolve8(root, ".archcontext/practices");
10958
+ const overlayRoot = resolve9(root, ".archcontext/practices");
10927
10959
  if (!existsSync6(overlayRoot))
10928
10960
  return [];
10929
10961
  const out = [];
@@ -11287,7 +11319,7 @@ function listDataFiles(dir, allowedRoot, errors) {
11287
11319
  }
11288
11320
  if (stat.isDirectory()) {
11289
11321
  for (const entry of readdirSync4(current, { withFileTypes: true }))
11290
- walk(resolve8(current, entry.name));
11322
+ walk(resolve9(current, entry.name));
11291
11323
  return;
11292
11324
  }
11293
11325
  if (!/\.(ya?ml|json)$/.test(current))
@@ -11302,7 +11334,7 @@ function listDataFiles(dir, allowedRoot, errors) {
11302
11334
  }
11303
11335
  function parseDataFile(path, errors) {
11304
11336
  try {
11305
- const body = readFileSync6(path, "utf8").replace(/^\uFEFF/, "").trim();
11337
+ const body = readFileSync7(path, "utf8").replace(/^\uFEFF/, "").trim();
11306
11338
  const withoutDocumentMarker = body.startsWith("---") ? body.replace(/^---\s*/, "").trim() : body;
11307
11339
  return JSON.parse(withoutDocumentMarker);
11308
11340
  } catch (error) {
@@ -11331,12 +11363,12 @@ function safeRealpath(path) {
11331
11363
  try {
11332
11364
  return realpathSync6.native(path);
11333
11365
  } catch {
11334
- return resolve8(path);
11366
+ return resolve9(path);
11335
11367
  }
11336
11368
  }
11337
11369
  function isRealChild(rootReal, pathReal) {
11338
11370
  const rel = relative5(rootReal, pathReal);
11339
- return rel === "" || !rel.startsWith("..") && !rel.includes(`..${sep4}`) && !resolve8(rel).startsWith("..");
11371
+ return rel === "" || !rel.startsWith("..") && !rel.includes(`..${sep4}`) && !resolve9(rel).startsWith("..");
11340
11372
  }
11341
11373
  function displayPath(path) {
11342
11374
  return path.split(sep4).join("/");
@@ -11900,8 +11932,8 @@ function checkResult(input, result) {
11900
11932
  }
11901
11933
  // packages/core/practice-engine/src/enforcement.ts
11902
11934
  init_src();
11903
- import { existsSync as existsSync7, lstatSync as lstatSync4, readdirSync as readdirSync5, readFileSync as readFileSync7 } from "node:fs";
11904
- import { basename as basename3, join as join4, relative as relative6, resolve as resolve9, sep as sep5 } from "node:path";
11935
+ import { existsSync as existsSync7, lstatSync as lstatSync4, readdirSync as readdirSync5, readFileSync as readFileSync8 } from "node:fs";
11936
+ import { basename as basename3, join as join4, relative as relative6, resolve as resolve10, sep as sep5 } from "node:path";
11905
11937
  var ENFORCEMENT_RANK = { advisory: 0, checkpoint: 1, complete: 2 };
11906
11938
  var POLICY_MODES = new Set(["advisory", "active", "fail-open", "fail-closed"]);
11907
11939
  var DEFAULT_POLICY = {
@@ -11924,7 +11956,7 @@ function shouldEvaluatePracticeEnforcement(policy) {
11924
11956
  return practiceEnforcementPolicyMode(policy) !== "advisory";
11925
11957
  }
11926
11958
  function loadPracticeEnforcementPolicy(root) {
11927
- const path = resolve9(root, ".archcontext/policies/practices.yaml");
11959
+ const path = resolve10(root, ".archcontext/policies/practices.yaml");
11928
11960
  if (!existsSync7(path))
11929
11961
  return defaultPracticeEnforcementPolicy();
11930
11962
  assertRepoPolicyFile(root, path, ".archcontext/policies/practices.yaml");
@@ -11932,7 +11964,7 @@ function loadPracticeEnforcementPolicy(root) {
11932
11964
  return validatePracticeEnforcementPolicy(parsed, ".archcontext/policies/practices.yaml");
11933
11965
  }
11934
11966
  function loadPracticeWaivers(root) {
11935
- const dir = resolve9(root, ".archcontext/waivers");
11967
+ const dir = resolve10(root, ".archcontext/waivers");
11936
11968
  if (!existsSync7(dir))
11937
11969
  return [];
11938
11970
  const stat = lstatSync4(dir);
@@ -11953,17 +11985,17 @@ function loadPracticeWaivers(root) {
11953
11985
  return waivers.sort((left, right) => waiverDigest(left).localeCompare(waiverDigest(right)));
11954
11986
  }
11955
11987
  function loadPracticeWaiverOwnerRegistry(root) {
11956
- const modelDir = resolve9(root, ".archcontext/model/nodes");
11988
+ const modelDir = resolve10(root, ".archcontext/model/nodes");
11957
11989
  const sources = [];
11958
11990
  const subjects = [];
11959
11991
  if (existsSync7(modelDir)) {
11960
11992
  if (lstatSync4(modelDir).isSymbolicLink())
11961
11993
  throw new Error("practice-owner-registry-symlink-denied");
11962
11994
  for (const path of collectFiles(root, ".archcontext/model/nodes")) {
11963
- const absolute = resolve9(root, path);
11995
+ const absolute = resolve10(root, path);
11964
11996
  if (lstatSync4(absolute).isSymbolicLink())
11965
11997
  throw new Error(`practice-owner-registry-symlink-denied: ${path}`);
11966
- const body = readFileSync7(absolute, "utf8");
11998
+ const body = readFileSync8(absolute, "utf8");
11967
11999
  const lifecycleOwners = extractOwnershipOwners(body, "lifecycle");
11968
12000
  const dataOwners = extractOwnershipOwners(body, "data");
11969
12001
  for (const kind of ["lifecycle", "data"]) {
@@ -12238,12 +12270,12 @@ function isVagueReason(reason) {
12238
12270
  return /^(temporary|cleanup later|todo|tbd|later|just in case)$/i.test(trimmed);
12239
12271
  }
12240
12272
  function parseJsonYamlFile(path) {
12241
- const body = readFileSync7(path, "utf8").replace(/^\uFEFF/, "").trim();
12273
+ const body = readFileSync8(path, "utf8").replace(/^\uFEFF/, "").trim();
12242
12274
  const withoutDocumentMarker = body.startsWith("---") ? body.replace(/^---\s*/, "").trim() : body;
12243
12275
  return JSON.parse(withoutDocumentMarker);
12244
12276
  }
12245
12277
  function collectFiles(root, relativeDir) {
12246
- const dir = resolve9(root, relativeDir);
12278
+ const dir = resolve10(root, relativeDir);
12247
12279
  const out = [];
12248
12280
  for (const entry of readdirSync5(dir, { withFileTypes: true })) {
12249
12281
  const child = `${relativeDir}/${entry.name}`;
@@ -12331,8 +12363,8 @@ function assertRepoPolicyFile(root, path, relativePath) {
12331
12363
  assertRepoRelativePath(relativePath);
12332
12364
  if (lstatSync4(path).isSymbolicLink())
12333
12365
  throw new Error(`practice-policy-symlink-denied: ${relativePath}`);
12334
- const rootResolved = resolve9(root);
12335
- const pathResolved = resolve9(path);
12366
+ const rootResolved = resolve10(root);
12367
+ const pathResolved = resolve10(path);
12336
12368
  const rel = relative6(rootResolved, pathResolved);
12337
12369
  if (rel === "" || rel.startsWith("..") || rel.includes(`..${sep5}`))
12338
12370
  throw new Error(`practice-policy-path-escape: ${relativePath}`);
@@ -13768,7 +13800,7 @@ function classifyCheckpointPath(root, path) {
13768
13800
  return "ignored";
13769
13801
  if (isGeneratedCheckpointPath(path))
13770
13802
  return "generated";
13771
- const absolute = resolve10(root, path);
13803
+ const absolute = resolve11(root, path);
13772
13804
  if (!existsSync8(absolute))
13773
13805
  return "deleted";
13774
13806
  try {
@@ -14975,8 +15007,8 @@ function uniqueSorted4(values) {
14975
15007
 
14976
15008
  // packages/core/projection-engine/src/index.ts
14977
15009
  init_src();
14978
- import { existsSync as existsSync9, readdirSync as readdirSync6, readFileSync as readFileSync8 } from "node:fs";
14979
- import { basename as basename4, resolve as resolve11 } from "node:path";
15010
+ import { existsSync as existsSync9, readdirSync as readdirSync6, readFileSync as readFileSync9 } from "node:fs";
15011
+ import { basename as basename4, resolve as resolve12 } from "node:path";
14980
15012
  function nativeNodeSource(node) {
14981
15013
  const value = node.source;
14982
15014
  if (!value || typeof value !== "object" || Array.isArray(value))
@@ -15097,12 +15129,12 @@ function architectureDocumentationSourceDigest(input) {
15097
15129
  });
15098
15130
  }
15099
15131
  function loadArchitectureDecisionRecords(root) {
15100
- const dir = resolve11(root, "docs/adr");
15132
+ const dir = resolve12(root, "docs/adr");
15101
15133
  if (!existsSync9(dir))
15102
15134
  return [];
15103
15135
  return readdirSync6(dir).filter((file) => /^ADR-\d{4}-.+\.md$/.test(file)).sort().map((file) => {
15104
15136
  const path = `docs/adr/${file}`;
15105
- const body = readFileSync8(resolve11(root, path), "utf8");
15137
+ const body = readFileSync9(resolve12(root, path), "utf8");
15106
15138
  const title = body.match(/^#\s+(.+)$/m)?.[1]?.trim() ?? basename4(file, ".md");
15107
15139
  const status = body.match(/^Status:\s*(.+)$/mi)?.[1]?.trim();
15108
15140
  return {
@@ -15124,17 +15156,17 @@ function loadArchitectureDocumentationFiles(root) {
15124
15156
  "docs/architecture/diagrams/architecture.structurizr.json",
15125
15157
  "docs/architecture/.projection-manifest.json"
15126
15158
  ]) {
15127
- const absolute = resolve11(root, entry);
15159
+ const absolute = resolve12(root, entry);
15128
15160
  if (existsSync9(absolute))
15129
- files.push({ path: entry, body: readFileSync8(absolute, "utf8") });
15161
+ files.push({ path: entry, body: readFileSync9(absolute, "utf8") });
15130
15162
  }
15131
15163
  for (const dir of ["docs/architecture/modules", "docs/architecture/relations"]) {
15132
- const absoluteDir = resolve11(root, dir);
15164
+ const absoluteDir = resolve12(root, dir);
15133
15165
  if (!existsSync9(absoluteDir))
15134
15166
  continue;
15135
15167
  for (const file of readdirSync6(absoluteDir).filter((name) => name.endsWith(".md")).sort()) {
15136
15168
  const path = `${dir}/${file}`;
15137
- files.push({ path, body: readFileSync8(resolve11(root, path), "utf8") });
15169
+ files.push({ path, body: readFileSync9(resolve12(root, path), "utf8") });
15138
15170
  }
15139
15171
  }
15140
15172
  return files.sort((left, right) => left.path.localeCompare(right.path));
@@ -15228,8 +15260,8 @@ function exportDocumentationStructurizrWorkspace(model) {
15228
15260
  }
15229
15261
  function loadNativeModelFromArchContext(root) {
15230
15262
  return {
15231
- nodes: readYamlObjects(resolve11(root, ".archcontext/model/nodes")),
15232
- relations: readYamlObjects(resolve11(root, ".archcontext/model/relations"))
15263
+ nodes: readYamlObjects(resolve12(root, ".archcontext/model/nodes")),
15264
+ relations: readYamlObjects(resolve12(root, ".archcontext/model/relations"))
15233
15265
  };
15234
15266
  }
15235
15267
  function mermaidId(id) {
@@ -15239,8 +15271,8 @@ function readYamlObjects(dir) {
15239
15271
  if (!existsSync9(dir))
15240
15272
  return [];
15241
15273
  return readdirSync6(dir).filter((file) => /\.ya?ml$/.test(file)).sort().map((file) => {
15242
- const path = resolve11(dir, file);
15243
- return parseJsonOrStableYaml(readFileSync8(path, "utf8"), path);
15274
+ const path = resolve12(dir, file);
15275
+ return parseJsonOrStableYaml(readFileSync9(path, "utf8"), path);
15244
15276
  });
15245
15277
  }
15246
15278
  function escapeMermaid(value) {
@@ -16798,22 +16830,22 @@ init_src();
16798
16830
  // packages/local-runtime/git-adapter/src/index.ts
16799
16831
  import { execFileSync as execFileSync4, spawnSync as spawnSync2 } from "node:child_process";
16800
16832
  import { existsSync as existsSync10, mkdirSync as mkdirSync4, mkdtempSync as mkdtempSync2, rmSync as rmSync4 } from "node:fs";
16801
- import { dirname as dirname5, join as join5, resolve as resolve12 } from "node:path";
16833
+ import { dirname as dirname6, join as join5, resolve as resolve13 } from "node:path";
16802
16834
  import { tmpdir } from "node:os";
16803
16835
  init_src();
16804
16836
  function findRepositoryRoot2(start) {
16805
16837
  try {
16806
- return resolve12(execFileSync4("git", ["rev-parse", "--show-toplevel"], {
16838
+ return resolve13(execFileSync4("git", ["rev-parse", "--show-toplevel"], {
16807
16839
  cwd: start,
16808
16840
  encoding: "utf8",
16809
16841
  stdio: ["ignore", "pipe", "ignore"]
16810
16842
  }).trim());
16811
16843
  } catch {
16812
- let cursor = resolve12(start);
16844
+ let cursor = resolve13(start);
16813
16845
  while (true) {
16814
- if (existsSync10(resolve12(cursor, ".git")))
16846
+ if (existsSync10(resolve13(cursor, ".git")))
16815
16847
  return cursor;
16816
- const parent = dirname5(cursor);
16848
+ const parent = dirname6(cursor);
16817
16849
  if (parent === cursor)
16818
16850
  break;
16819
16851
  cursor = parent;
@@ -16913,7 +16945,7 @@ function prepareDetachedReviewWorktree(input) {
16913
16945
  observed: {}
16914
16946
  };
16915
16947
  }
16916
- const parent = input.tempRoot ? resolve12(input.tempRoot) : tmpdir();
16948
+ const parent = input.tempRoot ? resolve13(input.tempRoot) : tmpdir();
16917
16949
  mkdirSync4(parent, { recursive: true });
16918
16950
  const temporaryRoot = mkdtempSync2(join5(parent, "archctx-review-worktree-"));
16919
16951
  const worktreeRoot = join5(temporaryRoot, "worktree");
@@ -16965,7 +16997,7 @@ function removeDetachedReviewWorktree(worktree) {
16965
16997
  } catch {
16966
16998
  removePathWithRetry(worktree.worktreeRoot);
16967
16999
  } finally {
16968
- removePathWithRetry(worktree.temporaryRoot || dirname5(worktree.worktreeRoot));
17000
+ removePathWithRetry(worktree.temporaryRoot || dirname6(worktree.worktreeRoot));
16969
17001
  }
16970
17002
  }
16971
17003
  function removePathWithRetry(path) {
@@ -17082,13 +17114,13 @@ function isGitWorktreeError(error) {
17082
17114
  // packages/local-runtime/local-store-sqlite/src/index.ts
17083
17115
  import { execFileSync as execFileSync5 } from "node:child_process";
17084
17116
  import { createHash as createHash6, randomUUID as randomUUID2 } from "node:crypto";
17085
- import { chmodSync as chmodSync2, closeSync as closeSync4, existsSync as existsSync11, fsyncSync as fsyncSync3, lstatSync as lstatSync5, mkdirSync as mkdirSync5, openSync as openSync4, readFileSync as readFileSync9, realpathSync as realpathSync7, renameSync as renameSync3, rmSync as rmSync5, writeFileSync as writeFileSync3 } from "node:fs";
17117
+ import { chmodSync as chmodSync2, closeSync as closeSync4, existsSync as existsSync11, fsyncSync as fsyncSync3, lstatSync as lstatSync5, mkdirSync as mkdirSync5, openSync as openSync4, readFileSync as readFileSync10, realpathSync as realpathSync7, renameSync as renameSync3, rmSync as rmSync5, writeFileSync as writeFileSync3 } from "node:fs";
17086
17118
  import { readdir, readFile } from "node:fs/promises";
17087
- import { createRequire as createRequire3 } from "node:module";
17119
+ import { createRequire as createRequire4 } from "node:module";
17088
17120
  import { homedir as homedir2 } from "node:os";
17089
- import { dirname as dirname6, isAbsolute as isAbsolute4, join as join6, relative as relative7, resolve as resolve13 } from "node:path";
17121
+ import { dirname as dirname7, isAbsolute as isAbsolute4, join as join6, relative as relative7, resolve as resolve14 } from "node:path";
17090
17122
  init_src();
17091
- var runtimeRequire2 = createRequire3(import.meta.url);
17123
+ var runtimeRequire2 = createRequire4(import.meta.url);
17092
17124
  var SQLITE_SIDECAR_SUFFIXES2 = ["", "-wal", "-shm"];
17093
17125
  var LEGACY_MIGRATION_MARKER_FILE2 = "runtime.sqlite.migration.json";
17094
17126
  var LEGACY_MIGRATION_LOCK_FILE2 = "runtime.sqlite.migration.lock";
@@ -17662,7 +17694,7 @@ var ARCHCONTEXT_LOCAL_STORE_PATH_ENV2 = "ARCHCONTEXT_LOCAL_STORE_PATH";
17662
17694
  function defaultArchContextStateRoot2(env = process.env, platform = process.platform, home = homedir2()) {
17663
17695
  const override = env[ARCHCONTEXT_STATE_DIR_ENV2];
17664
17696
  if (override)
17665
- return { path: resolve13(override), source: "environment" };
17697
+ return { path: resolve14(override), source: "environment" };
17666
17698
  if (platform === "darwin")
17667
17699
  return { path: join6(home, "Library", "Application Support", "ArchContext"), source: "os-user-data" };
17668
17700
  if (platform === "win32")
@@ -17680,7 +17712,7 @@ function runtimeStatePaths2(root = process.cwd(), env = process.env) {
17680
17712
  const stateRoot = defaultArchContextStateRoot2(env);
17681
17713
  const repositoryStateDir = join6(stateRoot.path, "repositories", storageRepositoryId);
17682
17714
  const workspaceStateDir = join6(repositoryStateDir, "worktrees", storageWorkspaceId);
17683
- const legacyControlDir = resolve13(canonicalRepositoryRoot3, ".archcontext", ".local");
17715
+ const legacyControlDir = resolve14(canonicalRepositoryRoot3, ".archcontext", ".local");
17684
17716
  return {
17685
17717
  schemaVersion: "archcontext.runtime-state-paths/v1",
17686
17718
  stateRoot: stateRoot.path,
@@ -17714,7 +17746,7 @@ function migrateLegacyLocalStoreIfNeeded2(root = process.cwd(), env = process.en
17714
17746
  status: "explicit-local-store-override"
17715
17747
  });
17716
17748
  }
17717
- ensurePrivateDir2(dirname6(paths.localStorePath));
17749
+ ensurePrivateDir2(dirname7(paths.localStorePath));
17718
17750
  const legacyExists = existsSync11(paths.legacyLocalStorePath);
17719
17751
  const integrityCheck = {};
17720
17752
  const quarantinedFiles = [];
@@ -18568,7 +18600,7 @@ class SqliteLocalStore {
18568
18600
  }
18569
18601
  async backupArchitectureLedger(input) {
18570
18602
  const db = await this.database();
18571
- ensurePrivateDir2(dirname6(input.backupPath));
18603
+ ensurePrivateDir2(dirname7(input.backupPath));
18572
18604
  if (existsSync11(input.backupPath))
18573
18605
  rmSync5(input.backupPath, { force: true });
18574
18606
  db.exec(`VACUUM INTO ${sqliteStringLiteral2(input.backupPath)}`);
@@ -19157,7 +19189,7 @@ function readAppliedLocalSqliteMigrations2(db) {
19157
19189
  async function rebuildDerivedLandscapeState(store, input) {
19158
19190
  const landscapePath = input.landscapePath ?? LANDSCAPE_FILE;
19159
19191
  const relationsDir = input.relationsDir ?? ".archcontext/relations";
19160
- const landscape = parseLandscapeFile(await readFile(resolve13(input.root, landscapePath), "utf8"), landscapePath);
19192
+ const landscape = parseLandscapeFile(await readFile(resolve14(input.root, landscapePath), "utf8"), landscapePath);
19161
19193
  const relations = await readRelationFiles(input.root, relationsDir);
19162
19194
  const scopedRelations = relations.filter((relation) => landscape.relations.includes(relation.id));
19163
19195
  const relationIds = new Set(relations.map((relation) => relation.id));
@@ -19184,7 +19216,7 @@ async function rebuildDerivedLandscapeState(store, input) {
19184
19216
  }
19185
19217
  async function openSqliteDatabase(databasePath) {
19186
19218
  if (databasePath !== ":memory:")
19187
- ensurePrivateDir2(dirname6(databasePath));
19219
+ ensurePrivateDir2(dirname7(databasePath));
19188
19220
  try {
19189
19221
  const nodeSqlite = await import("node:sqlite");
19190
19222
  const db = new nodeSqlite.DatabaseSync(databasePath);
@@ -19205,7 +19237,7 @@ async function openSqliteDatabase(databasePath) {
19205
19237
  }
19206
19238
  function openSqliteDatabaseSync2(databasePath) {
19207
19239
  if (databasePath !== ":memory:")
19208
- ensurePrivateDir2(dirname6(databasePath));
19240
+ ensurePrivateDir2(dirname7(databasePath));
19209
19241
  try {
19210
19242
  const nodeSqlite = runtimeRequire2("node:sqlite");
19211
19243
  const db2 = new nodeSqlite.DatabaseSync(databasePath);
@@ -19360,7 +19392,7 @@ function publishStagedLocalStore2(stagingPath, targetPath) {
19360
19392
  }
19361
19393
  renameSync3(stagingPath, targetPath);
19362
19394
  makePrivateFile2(targetPath);
19363
- fsyncDirectory3(dirname6(targetPath));
19395
+ fsyncDirectory3(dirname7(targetPath));
19364
19396
  }
19365
19397
  function writeLegacyMigrationMarker2(paths, integrityCheck, quarantinedFiles) {
19366
19398
  const markerPath = legacyMigrationMarkerPath2(paths);
@@ -19376,7 +19408,7 @@ function writeLegacyMigrationMarker2(paths, integrityCheck, quarantinedFiles) {
19376
19408
  }
19377
19409
  function acquireLegacyMigrationLock2(paths) {
19378
19410
  const lockPath = legacyMigrationLockPath2(paths);
19379
- ensurePrivateDir2(dirname6(lockPath));
19411
+ ensurePrivateDir2(dirname7(lockPath));
19380
19412
  try {
19381
19413
  const fd = openSync4(lockPath, "wx", 384);
19382
19414
  writeFileSync3(fd, JSON.stringify({
@@ -19405,7 +19437,7 @@ function releaseLegacyMigrationLock2(lock) {
19405
19437
  }
19406
19438
  function isStaleMigrationLock2(lockPath) {
19407
19439
  try {
19408
- const parsed = JSON.parse(readFileSync9(lockPath, "utf8"));
19440
+ const parsed = JSON.parse(readFileSync10(lockPath, "utf8"));
19409
19441
  if (typeof parsed.pid !== "number" || parsed.pid <= 0)
19410
19442
  return true;
19411
19443
  return !isProcessAlive2(parsed.pid);
@@ -19440,7 +19472,7 @@ function quarantineExistingLocalStore2(paths) {
19440
19472
  quarantinedFiles.push(target);
19441
19473
  }
19442
19474
  fsyncDirectory3(quarantineDir);
19443
- fsyncDirectory3(dirname6(paths.localStorePath));
19475
+ fsyncDirectory3(dirname7(paths.localStorePath));
19444
19476
  return quarantinedFiles;
19445
19477
  }
19446
19478
  function legacyMigrationMarkerPath2(paths) {
@@ -19450,7 +19482,7 @@ function legacyMigrationLockPath2(paths) {
19450
19482
  return join6(paths.workspaceStateDir, LEGACY_MIGRATION_LOCK_FILE2);
19451
19483
  }
19452
19484
  function writePrivateJson2(path, value) {
19453
- ensurePrivateDir2(dirname6(path));
19485
+ ensurePrivateDir2(dirname7(path));
19454
19486
  const fd = openSync4(path, "w", 384);
19455
19487
  try {
19456
19488
  writeFileSync3(fd, JSON.stringify(value, null, 2), "utf8");
@@ -19459,7 +19491,7 @@ function writePrivateJson2(path, value) {
19459
19491
  closeSync4(fd);
19460
19492
  }
19461
19493
  makePrivateFile2(path);
19462
- fsyncDirectory3(dirname6(path));
19494
+ fsyncDirectory3(dirname7(path));
19463
19495
  }
19464
19496
  function ensurePrivateDir2(path) {
19465
19497
  mkdirSync5(path, { recursive: true, mode: 448 });
@@ -19489,10 +19521,10 @@ function readGitPath2(root, args) {
19489
19521
  }
19490
19522
  }
19491
19523
  function resolveMaybeRelative2(base, path) {
19492
- return isAbsolute4(path) ? resolve13(path) : resolve13(base, path);
19524
+ return isAbsolute4(path) ? resolve14(path) : resolve14(base, path);
19493
19525
  }
19494
19526
  function canonicalPath2(path) {
19495
- const resolved = resolve13(path);
19527
+ const resolved = resolve14(path);
19496
19528
  try {
19497
19529
  return realpathSync7.native(resolved);
19498
19530
  } catch {
@@ -19500,8 +19532,8 @@ function canonicalPath2(path) {
19500
19532
  }
19501
19533
  }
19502
19534
  function isPathInsideOrSame2(path, parent) {
19503
- const child = resolve13(path);
19504
- const base = resolve13(parent);
19535
+ const child = resolve14(path);
19536
+ const base = resolve14(parent);
19505
19537
  const fromBase = relative7(base, child);
19506
19538
  return fromBase === "" || !!fromBase && !fromBase.startsWith("..") && !isAbsolute4(fromBase);
19507
19539
  }
@@ -19706,7 +19738,7 @@ function isJsonRecord(value) {
19706
19738
  }
19707
19739
  function recoverJournalFiles(root, files) {
19708
19740
  for (const file of [...files].reverse()) {
19709
- const absolute = resolve13(root, file.path);
19741
+ const absolute = resolve14(root, file.path);
19710
19742
  if (file.tempPath)
19711
19743
  rmSync5(file.tempPath, { recursive: true, force: true });
19712
19744
  if (file.existed) {
@@ -19717,7 +19749,7 @@ function recoverJournalFiles(root, files) {
19717
19749
  } else {
19718
19750
  rmSync5(absolute, { recursive: true, force: true });
19719
19751
  }
19720
- fsyncDirectory3(dirname6(absolute));
19752
+ fsyncDirectory3(dirname7(absolute));
19721
19753
  }
19722
19754
  }
19723
19755
  function cleanupCommittedJournalFiles(files) {
@@ -19754,7 +19786,7 @@ function reviewTaskSessionId(result) {
19754
19786
  async function readRelationFiles(root, relationsDir) {
19755
19787
  let entries;
19756
19788
  try {
19757
- entries = await readdir(resolve13(root, relationsDir), { withFileTypes: true });
19789
+ entries = await readdir(resolve14(root, relationsDir), { withFileTypes: true });
19758
19790
  } catch (error) {
19759
19791
  if (error.code === "ENOENT")
19760
19792
  return [];
@@ -19765,15 +19797,15 @@ async function readRelationFiles(root, relationsDir) {
19765
19797
  if (!entry.isFile() || !/\.(json|ya?ml)$/.test(entry.name))
19766
19798
  continue;
19767
19799
  const relativePath = join6(relationsDir, entry.name).split("\\").join("/");
19768
- relations.push(parseCrossRepoRelationFile(await readFile(resolve13(root, relativePath), "utf8"), relativePath));
19800
+ relations.push(parseCrossRepoRelationFile(await readFile(resolve14(root, relativePath), "utf8"), relativePath));
19769
19801
  }
19770
19802
  return relations.sort((a, b) => a.id.localeCompare(b.id));
19771
19803
  }
19772
19804
 
19773
19805
  // packages/local-runtime/model-store-yaml/src/index.ts
19774
19806
  init_src();
19775
- import { existsSync as existsSync12, mkdirSync as mkdirSync6, readdirSync as readdirSync7, readFileSync as readFileSync10, rmSync as rmSync6, writeFileSync as writeFileSync4 } from "node:fs";
19776
- import { dirname as dirname7, resolve as resolve14 } from "node:path";
19807
+ import { existsSync as existsSync12, mkdirSync as mkdirSync6, readdirSync as readdirSync7, readFileSync as readFileSync11, rmSync as rmSync6, writeFileSync as writeFileSync4 } from "node:fs";
19808
+ import { dirname as dirname8, resolve as resolve15 } from "node:path";
19777
19809
  var GENERATED_ARCHITECTURE_PATH = ".archcontext/generated/ARCHITECTURE.md";
19778
19810
  var GENERATED_ARCHITECTURE_BODY = [
19779
19811
  "<!-- Generated by ArchContext. Do not edit by hand. -->",
@@ -19935,7 +19967,7 @@ function initializeArchContextModel(root, productName = "ArchContext Project") {
19935
19967
  function rebuildGeneratedProjection(root) {
19936
19968
  for (const operation of planGeneratedProjection(root)) {
19937
19969
  if (operation.operation === "delete_entity") {
19938
- rmSync6(resolve14(root, operation.path), { force: true });
19970
+ rmSync6(resolve15(root, operation.path), { force: true });
19939
19971
  } else {
19940
19972
  writeFile(root, operation.path, operation.body);
19941
19973
  }
@@ -19943,12 +19975,12 @@ function rebuildGeneratedProjection(root) {
19943
19975
  }
19944
19976
  function planGeneratedProjection(root) {
19945
19977
  const desiredBody = GENERATED_ARCHITECTURE_BODY;
19946
- const desiredAbsolute = resolve14(root, GENERATED_ARCHITECTURE_PATH);
19978
+ const desiredAbsolute = resolve15(root, GENERATED_ARCHITECTURE_PATH);
19947
19979
  const operations = [];
19948
- if (!existsSync12(desiredAbsolute) || readFileSync10(desiredAbsolute, "utf8") !== desiredBody) {
19980
+ if (!existsSync12(desiredAbsolute) || readFileSync11(desiredAbsolute, "utf8") !== desiredBody) {
19949
19981
  operations.push({
19950
19982
  path: GENERATED_ARCHITECTURE_PATH,
19951
- expectedHash: existsSync12(desiredAbsolute) ? digestJson({ body: readFileSync10(desiredAbsolute, "utf8") }) : "missing",
19983
+ expectedHash: existsSync12(desiredAbsolute) ? digestJson({ body: readFileSync11(desiredAbsolute, "utf8") }) : "missing",
19952
19984
  body: desiredBody,
19953
19985
  operation: "render_projection"
19954
19986
  });
@@ -19956,7 +19988,7 @@ function planGeneratedProjection(root) {
19956
19988
  for (const path of collectGeneratedProjectionFiles(root)) {
19957
19989
  if (path === GENERATED_ARCHITECTURE_PATH)
19958
19990
  continue;
19959
- const body = readFileSync10(resolve14(root, path), "utf8");
19991
+ const body = readFileSync11(resolve15(root, path), "utf8");
19960
19992
  operations.push({
19961
19993
  path,
19962
19994
  expectedHash: digestJson({ body }),
@@ -19968,9 +20000,9 @@ function planGeneratedProjection(root) {
19968
20000
  }
19969
20001
  function collectGeneratedProjectionFiles(root) {
19970
20002
  const generatedRoot = ".archcontext/generated";
19971
- if (!existsSync12(resolve14(root, generatedRoot)))
20003
+ if (!existsSync12(resolve15(root, generatedRoot)))
19972
20004
  return [];
19973
- const walk = (relativeDir) => readdirSync7(resolve14(root, relativeDir), { withFileTypes: true }).flatMap((entry) => {
20005
+ const walk = (relativeDir) => readdirSync7(resolve15(root, relativeDir), { withFileTypes: true }).flatMap((entry) => {
19974
20006
  const child = `${relativeDir}/${entry.name}`;
19975
20007
  if (entry.isDirectory())
19976
20008
  return walk(child);
@@ -19981,7 +20013,7 @@ function collectGeneratedProjectionFiles(root) {
19981
20013
 
19982
20014
  class YamlModelStore {
19983
20015
  async loadManifest(workspace) {
19984
- return readFileSync10(resolve14(workspace.root, ".archcontext/manifest.yaml"), "utf8");
20016
+ return readFileSync11(resolve15(workspace.root, ".archcontext/manifest.yaml"), "utf8");
19985
20017
  }
19986
20018
  async loadModel(workspace) {
19987
20019
  return listModelFiles(workspace.root);
@@ -19990,7 +20022,7 @@ class YamlModelStore {
19990
20022
  const errors = [];
19991
20023
  for (const required of [".archcontext/manifest.yaml", ".archcontext/product.yaml"]) {
19992
20024
  try {
19993
- readFileSync10(resolve14(workspace.root, required), "utf8");
20025
+ readFileSync11(resolve15(workspace.root, required), "utf8");
19994
20026
  } catch {
19995
20027
  errors.push(`missing ${required}`);
19996
20028
  }
@@ -20020,7 +20052,7 @@ function listModelFiles(root) {
20020
20052
  "docs/adr"
20021
20053
  ]);
20022
20054
  return paths.map((path) => {
20023
- const body = readFileSync10(resolve14(root, path), "utf8");
20055
+ const body = readFileSync11(resolve15(root, path), "utf8");
20024
20056
  return {
20025
20057
  path,
20026
20058
  body,
@@ -20032,7 +20064,7 @@ function listModelFiles(root) {
20032
20064
  function collectArchContextFiles(root, entries) {
20033
20065
  const files = [];
20034
20066
  for (const entry of entries) {
20035
- const absolute = resolve14(root, entry);
20067
+ const absolute = resolve15(root, entry);
20036
20068
  if (!existsSync12(absolute))
20037
20069
  continue;
20038
20070
  const stat = readdirOrFile(absolute);
@@ -20046,7 +20078,7 @@ function collectArchContextFiles(root, entries) {
20046
20078
  return [...new Set(files)].sort();
20047
20079
  function walk(relativeDir) {
20048
20080
  const out = [];
20049
- const dir = resolve14(root, relativeDir);
20081
+ const dir = resolve15(root, relativeDir);
20050
20082
  for (const entry of readdirSync7(dir, { withFileTypes: true })) {
20051
20083
  const child = `${relativeDir}/${entry.name}`;
20052
20084
  if (entry.isDirectory())
@@ -20087,8 +20119,8 @@ function writeYaml(root, path, value) {
20087
20119
  writeFile(root, path, stableYaml(value));
20088
20120
  }
20089
20121
  function writeFile(root, path, body) {
20090
- const absolute = resolve14(root, path);
20091
- mkdirSync6(dirname7(absolute), { recursive: true });
20122
+ const absolute = resolve15(root, path);
20123
+ mkdirSync6(dirname8(absolute), { recursive: true });
20092
20124
  writeFileSync4(absolute, body.endsWith(`
20093
20125
  `) ? body : `${body}
20094
20126
  `, "utf8");
@@ -21482,10 +21514,10 @@ class ArchctxDaemon {
21482
21514
  return errorEnvelope("practices.waive", "AC_SCHEMA_INVALID", error instanceof Error ? error.message : String(error));
21483
21515
  }
21484
21516
  const path = `.archcontext/waivers/${waiverId}.json`;
21485
- const absolute = resolve15(session.workspace.root, path);
21517
+ const absolute = resolve16(session.workspace.root, path);
21486
21518
  const body = `${JSON.stringify(waiver, null, 2)}
21487
21519
  `;
21488
- const expectedHash = existsSync13(absolute) ? digestJson({ body: readFileSync11(absolute, "utf8") }) : "missing";
21520
+ const expectedHash = existsSync13(absolute) ? digestJson({ body: readFileSync12(absolute, "utf8") }) : "missing";
21489
21521
  const draft = this.changeSetEngine.plan({
21490
21522
  id: input.id ?? `changeset.practice-waiver-${waiverId.replace(/[^A-Za-z0-9_-]/g, "-")}`,
21491
21523
  base: {
@@ -22892,7 +22924,7 @@ class ArchctxDaemon {
22892
22924
  recoverDeveloperReviewRuns(input) {
22893
22925
  this.assertRunning();
22894
22926
  const sourceRoot = findRepositoryRoot2(input.repositoryRoot);
22895
- const stateDir = input.stateDir ? resolve15(input.stateDir) : defaultDeveloperReviewRunStateDir(sourceRoot);
22927
+ const stateDir = input.stateDir ? resolve16(input.stateDir) : defaultDeveloperReviewRunStateDir(sourceRoot);
22896
22928
  const recovery = {
22897
22929
  schemaVersion: "archcontext.developer-review-run-recovery/v1",
22898
22930
  sourceRoot,
@@ -23696,8 +23728,8 @@ class ArchctxRuntimeRpcServer {
23696
23728
  const root = this.options.root ?? process.cwd();
23697
23729
  const connectionPath = this.options.connectionPath ?? defaultDaemonConnectionPath(root);
23698
23730
  const lockPath = this.options.lockPath ?? defaultDaemonLockPath(root);
23699
- mkdirSync7(dirname8(connectionPath), { recursive: true });
23700
- mkdirSync7(dirname8(lockPath), { recursive: true });
23731
+ mkdirSync7(dirname9(connectionPath), { recursive: true });
23732
+ mkdirSync7(dirname9(lockPath), { recursive: true });
23701
23733
  this.lockFd = acquireDaemonLock(lockPath, root);
23702
23734
  const token = this.options.token ?? randomBytes(18).toString("base64url");
23703
23735
  const server = createServer((request, response) => {
@@ -24002,7 +24034,7 @@ function readRuntimeRpcConnectionFile(root = process.cwd()) {
24002
24034
  try {
24003
24035
  if (!isPrivateControlFile(path))
24004
24036
  return;
24005
- const parsed = JSON.parse(readFileSync11(path, "utf8"));
24037
+ const parsed = JSON.parse(readFileSync12(path, "utf8"));
24006
24038
  if (!parsed || typeof parsed !== "object")
24007
24039
  return;
24008
24040
  return {
@@ -24043,7 +24075,7 @@ function readRuntimeRpcConnection(root = process.cwd()) {
24043
24075
  try {
24044
24076
  if (!isPrivateControlFile(path))
24045
24077
  return;
24046
- const parsed = JSON.parse(readFileSync11(path, "utf8"));
24078
+ const parsed = JSON.parse(readFileSync12(path, "utf8"));
24047
24079
  return isValidRuntimeRpcConnection(parsed) ? parsed : undefined;
24048
24080
  } catch {
24049
24081
  return;
@@ -24321,8 +24353,8 @@ function schemaVersionKind(schemaVersion) {
24321
24353
  function createDeveloperReviewRunPaths(input) {
24322
24354
  const safeChallengeId = safeControlFileSegment(input.challengeId);
24323
24355
  const runId = `${safeChallengeId}-${randomBytes(6).toString("hex")}`;
24324
- const stateDir = input.stateDir ? resolve15(input.stateDir) : defaultDeveloperReviewRunStateDir(input.sourceRoot);
24325
- const tempParent = input.tempRoot ? resolve15(input.tempRoot) : tmpdir3();
24356
+ const stateDir = input.stateDir ? resolve16(input.stateDir) : defaultDeveloperReviewRunStateDir(input.sourceRoot);
24357
+ const tempParent = input.tempRoot ? resolve16(input.tempRoot) : tmpdir3();
24326
24358
  mkdirSync7(tempParent, { recursive: true });
24327
24359
  const runRoot = mkdtempSync4(join8(tempParent, `archctx-developer-review-${safeChallengeId.slice(0, 32)}-`));
24328
24360
  return {
@@ -24468,7 +24500,7 @@ function readExactPackageVersion(root, packageName) {
24468
24500
  return;
24469
24501
  }
24470
24502
  function readPackageLockExactVersion(root, packageName) {
24471
- const lock = readJsonFile(resolve15(root, "package-lock.json"));
24503
+ const lock = readJsonFile(resolve16(root, "package-lock.json"));
24472
24504
  if (!lock || typeof lock !== "object" || Array.isArray(lock))
24473
24505
  return;
24474
24506
  const packages = lock.packages;
@@ -24486,7 +24518,7 @@ function readPackageLockExactVersion(root, packageName) {
24486
24518
  return;
24487
24519
  }
24488
24520
  function packageManifestPaths(root) {
24489
- const paths = [resolve15(root, "package.json")];
24521
+ const paths = [resolve16(root, "package.json")];
24490
24522
  const rootManifest = readJsonFile(paths[0]);
24491
24523
  for (const pattern of workspacePatternsFromManifest(rootManifest)) {
24492
24524
  for (const path of expandWorkspacePackageJson(root, pattern))
@@ -24509,15 +24541,15 @@ function expandWorkspacePackageJson(root, pattern) {
24509
24541
  if (pattern.includes("**") || pattern.startsWith("/") || pattern.includes("\\"))
24510
24542
  return [];
24511
24543
  if (!pattern.includes("*")) {
24512
- const path = resolve15(root, pattern, "package.json");
24544
+ const path = resolve16(root, pattern, "package.json");
24513
24545
  return existsSync13(path) ? [path] : [];
24514
24546
  }
24515
24547
  if (!pattern.endsWith("/*"))
24516
24548
  return [];
24517
- const base = resolve15(root, pattern.slice(0, -2));
24549
+ const base = resolve16(root, pattern.slice(0, -2));
24518
24550
  if (!existsSync13(base) || !statSync6(base).isDirectory())
24519
24551
  return [];
24520
- return readdirSync8(base, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => resolve15(base, entry.name, "package.json")).filter((path) => existsSync13(path));
24552
+ return readdirSync8(base, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => resolve16(base, entry.name, "package.json")).filter((path) => existsSync13(path));
24521
24553
  }
24522
24554
  function exactVersionFromManifest(manifest, packageName) {
24523
24555
  if (!manifest || typeof manifest !== "object" || Array.isArray(manifest))
@@ -24536,7 +24568,7 @@ function readJsonFile(path) {
24536
24568
  if (!existsSync13(path))
24537
24569
  return;
24538
24570
  try {
24539
- return JSON.parse(readFileSync11(path, "utf8"));
24571
+ return JSON.parse(readFileSync12(path, "utf8"));
24540
24572
  } catch {
24541
24573
  return;
24542
24574
  }
@@ -24545,7 +24577,7 @@ function isExactPackageVersion(value) {
24545
24577
  return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(value);
24546
24578
  }
24547
24579
  function readContext7Lockfile(root) {
24548
- const path = resolve15(root, CONTEXT7_LOCKFILE);
24580
+ const path = resolve16(root, CONTEXT7_LOCKFILE);
24549
24581
  if (!existsSync13(path)) {
24550
24582
  return {
24551
24583
  schemaVersion: CONTEXT7_LOCKFILE_SCHEMA_VERSION,
@@ -24553,7 +24585,7 @@ function readContext7Lockfile(root) {
24553
24585
  libraries: []
24554
24586
  };
24555
24587
  }
24556
- const parsed = JSON.parse(readFileSync11(path, "utf8"));
24588
+ const parsed = JSON.parse(readFileSync12(path, "utf8"));
24557
24589
  if (parsed.schemaVersion !== CONTEXT7_LOCKFILE_SCHEMA_VERSION || parsed.provider !== "context7" || !Array.isArray(parsed.libraries)) {
24558
24590
  throw new Error("Invalid Context7 lockfile");
24559
24591
  }
@@ -24574,13 +24606,13 @@ function upsertContext7Pin(lock, pin) {
24574
24606
  };
24575
24607
  }
24576
24608
  function writeContext7Lockfile(root, lock) {
24577
- writePrivateJson3(resolve15(root, CONTEXT7_LOCKFILE), lock);
24609
+ writePrivateJson3(resolve16(root, CONTEXT7_LOCKFILE), lock);
24578
24610
  }
24579
24611
  function writeDeveloperReviewRunManifest(manifest) {
24580
24612
  writePrivateJson3(manifest.manifestPath, manifest);
24581
24613
  }
24582
24614
  function writePrivateJson3(path, value, flag = "w") {
24583
- mkdirSync7(dirname8(path), { recursive: true });
24615
+ mkdirSync7(dirname9(path), { recursive: true });
24584
24616
  writeFileSync6(path, JSON.stringify(value, null, 2), { mode: 384, flag });
24585
24617
  chmodSync3(path, 384);
24586
24618
  }
@@ -24604,7 +24636,7 @@ function readDeveloperReviewRunManifest(path) {
24604
24636
  }
24605
24637
  function readJsonObject(path) {
24606
24638
  try {
24607
- const parsed = JSON.parse(readFileSync11(path, "utf8"));
24639
+ const parsed = JSON.parse(readFileSync12(path, "utf8"));
24608
24640
  return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : undefined;
24609
24641
  } catch {
24610
24642
  return;
@@ -24796,8 +24828,8 @@ function auditApproveResultPayload(runId, status, totalCount, issuedIssues) {
24796
24828
  };
24797
24829
  }
24798
24830
  function expectedFileHash(root, path) {
24799
- const absolute = resolve15(root, path);
24800
- return existsSync13(absolute) ? digestJson({ body: readFileSync11(absolute, "utf8") }) : "missing";
24831
+ const absolute = resolve16(root, path);
24832
+ return existsSync13(absolute) ? digestJson({ body: readFileSync12(absolute, "utf8") }) : "missing";
24801
24833
  }
24802
24834
  function architectureProjectionRollbackBackup(files, options = {}) {
24803
24835
  const manifest = {
@@ -24824,7 +24856,7 @@ function architectureProjectionRollbackBackup(files, options = {}) {
24824
24856
  function uniqueBackupPath(root, backupBase) {
24825
24857
  let candidate = backupBase;
24826
24858
  let suffix = 2;
24827
- while (existsSync13(resolve15(root, candidate))) {
24859
+ while (existsSync13(resolve16(root, candidate))) {
24828
24860
  candidate = `${backupBase}-${suffix}`;
24829
24861
  suffix += 1;
24830
24862
  }
@@ -24883,7 +24915,7 @@ function staleConnectionFileReason(path, removeUnhealthyConnection) {
24883
24915
  try {
24884
24916
  if (!isPrivateControlFile(path))
24885
24917
  return "insecure-connection-file";
24886
- const parsed = JSON.parse(readFileSync11(path, "utf8"));
24918
+ const parsed = JSON.parse(readFileSync12(path, "utf8"));
24887
24919
  if (!isValidRuntimeRpcConnection(parsed))
24888
24920
  return "invalid-connection-file";
24889
24921
  if (!isProcessAlive3(parsed.pid))
@@ -24901,7 +24933,7 @@ function isPrivateControlFile(path) {
24901
24933
  }
24902
24934
  function isStaleLock(lockPath) {
24903
24935
  try {
24904
- const lock = JSON.parse(readFileSync11(lockPath, "utf8"));
24936
+ const lock = JSON.parse(readFileSync12(lockPath, "utf8"));
24905
24937
  if (typeof lock.pid !== "number" || lock.pid <= 0)
24906
24938
  return true;
24907
24939
  return !isProcessAlive3(lock.pid);
@@ -24940,7 +24972,7 @@ function parsePracticeCheckpointBaselineState(state, repositoryId, taskSessionId
24940
24972
  return record;
24941
24973
  }
24942
24974
  function completeTaskProjectionDrift(root) {
24943
- if (!existsSync13(resolve15(root, "docs/architecture/.projection-manifest.json")))
24975
+ if (!existsSync13(resolve16(root, "docs/architecture/.projection-manifest.json")))
24944
24976
  return;
24945
24977
  const loaded = loadArchitectureDocumentationInputs(root);
24946
24978
  const sourceDigest = architectureDocumentationSourceDigest({
@@ -25216,10 +25248,10 @@ init_src();
25216
25248
  // packages/local-runtime/runtime-daemon/src/index.ts
25217
25249
  import { randomBytes as randomBytes2 } from "node:crypto";
25218
25250
  import { execFileSync as execFileSync7 } from "node:child_process";
25219
- import { chmodSync as chmodSync4, closeSync as closeSync6, existsSync as existsSync14, mkdirSync as mkdirSync8, mkdtempSync as mkdtempSync5, openSync as openSync6, readdirSync as readdirSync9, readFileSync as readFileSync12, rmSync as rmSync9, statSync as statSync7, writeFileSync as writeFileSync7 } from "node:fs";
25251
+ import { chmodSync as chmodSync4, closeSync as closeSync6, existsSync as existsSync14, mkdirSync as mkdirSync8, mkdtempSync as mkdtempSync5, openSync as openSync6, readdirSync as readdirSync9, readFileSync as readFileSync13, rmSync as rmSync9, statSync as statSync7, writeFileSync as writeFileSync7 } from "node:fs";
25220
25252
  import { createServer as createServer2 } from "node:http";
25221
25253
  import { tmpdir as tmpdir4 } from "node:os";
25222
- import { dirname as dirname9, join as join9, resolve as resolve16 } from "node:path";
25254
+ import { dirname as dirname10, join as join9, resolve as resolve17 } from "node:path";
25223
25255
  init_src();
25224
25256
  var RUNTIME_AGENT_HOOK_DEFAULT_MAX_QUEUED_JOBS2 = 32;
25225
25257
  var RUNTIME_AGENT_HOOK_DEFAULT_PRIORITY2 = 0;
@@ -26363,10 +26395,10 @@ class ArchctxDaemon2 {
26363
26395
  return errorEnvelope("practices.waive", "AC_SCHEMA_INVALID", error instanceof Error ? error.message : String(error));
26364
26396
  }
26365
26397
  const path = `.archcontext/waivers/${waiverId}.json`;
26366
- const absolute = resolve16(session.workspace.root, path);
26398
+ const absolute = resolve17(session.workspace.root, path);
26367
26399
  const body = `${JSON.stringify(waiver, null, 2)}
26368
26400
  `;
26369
- const expectedHash = existsSync14(absolute) ? digestJson({ body: readFileSync12(absolute, "utf8") }) : "missing";
26401
+ const expectedHash = existsSync14(absolute) ? digestJson({ body: readFileSync13(absolute, "utf8") }) : "missing";
26370
26402
  const draft = this.changeSetEngine.plan({
26371
26403
  id: input.id ?? `changeset.practice-waiver-${waiverId.replace(/[^A-Za-z0-9_-]/g, "-")}`,
26372
26404
  base: {
@@ -27773,7 +27805,7 @@ class ArchctxDaemon2 {
27773
27805
  recoverDeveloperReviewRuns(input) {
27774
27806
  this.assertRunning();
27775
27807
  const sourceRoot = findRepositoryRoot2(input.repositoryRoot);
27776
- const stateDir = input.stateDir ? resolve16(input.stateDir) : defaultDeveloperReviewRunStateDir2(sourceRoot);
27808
+ const stateDir = input.stateDir ? resolve17(input.stateDir) : defaultDeveloperReviewRunStateDir2(sourceRoot);
27777
27809
  const recovery = {
27778
27810
  schemaVersion: "archcontext.developer-review-run-recovery/v1",
27779
27811
  sourceRoot,
@@ -28604,7 +28636,7 @@ function readRuntimeRpcConnection2(root = process.cwd()) {
28604
28636
  try {
28605
28637
  if (!isPrivateControlFile2(path))
28606
28638
  return;
28607
- const parsed = JSON.parse(readFileSync12(path, "utf8"));
28639
+ const parsed = JSON.parse(readFileSync13(path, "utf8"));
28608
28640
  return isValidRuntimeRpcConnection2(parsed) ? parsed : undefined;
28609
28641
  } catch {
28610
28642
  return;
@@ -28867,8 +28899,8 @@ function schemaVersionKind2(schemaVersion) {
28867
28899
  function createDeveloperReviewRunPaths2(input) {
28868
28900
  const safeChallengeId = safeControlFileSegment2(input.challengeId);
28869
28901
  const runId = `${safeChallengeId}-${randomBytes2(6).toString("hex")}`;
28870
- const stateDir = input.stateDir ? resolve16(input.stateDir) : defaultDeveloperReviewRunStateDir2(input.sourceRoot);
28871
- const tempParent = input.tempRoot ? resolve16(input.tempRoot) : tmpdir4();
28902
+ const stateDir = input.stateDir ? resolve17(input.stateDir) : defaultDeveloperReviewRunStateDir2(input.sourceRoot);
28903
+ const tempParent = input.tempRoot ? resolve17(input.tempRoot) : tmpdir4();
28872
28904
  mkdirSync8(tempParent, { recursive: true });
28873
28905
  const runRoot = mkdtempSync5(join9(tempParent, `archctx-developer-review-${safeChallengeId.slice(0, 32)}-`));
28874
28906
  return {
@@ -29014,7 +29046,7 @@ function readExactPackageVersion2(root, packageName) {
29014
29046
  return;
29015
29047
  }
29016
29048
  function readPackageLockExactVersion2(root, packageName) {
29017
- const lock = readJsonFile2(resolve16(root, "package-lock.json"));
29049
+ const lock = readJsonFile2(resolve17(root, "package-lock.json"));
29018
29050
  if (!lock || typeof lock !== "object" || Array.isArray(lock))
29019
29051
  return;
29020
29052
  const packages = lock.packages;
@@ -29032,7 +29064,7 @@ function readPackageLockExactVersion2(root, packageName) {
29032
29064
  return;
29033
29065
  }
29034
29066
  function packageManifestPaths2(root) {
29035
- const paths = [resolve16(root, "package.json")];
29067
+ const paths = [resolve17(root, "package.json")];
29036
29068
  const rootManifest = readJsonFile2(paths[0]);
29037
29069
  for (const pattern of workspacePatternsFromManifest2(rootManifest)) {
29038
29070
  for (const path of expandWorkspacePackageJson2(root, pattern))
@@ -29055,15 +29087,15 @@ function expandWorkspacePackageJson2(root, pattern) {
29055
29087
  if (pattern.includes("**") || pattern.startsWith("/") || pattern.includes("\\"))
29056
29088
  return [];
29057
29089
  if (!pattern.includes("*")) {
29058
- const path = resolve16(root, pattern, "package.json");
29090
+ const path = resolve17(root, pattern, "package.json");
29059
29091
  return existsSync14(path) ? [path] : [];
29060
29092
  }
29061
29093
  if (!pattern.endsWith("/*"))
29062
29094
  return [];
29063
- const base = resolve16(root, pattern.slice(0, -2));
29095
+ const base = resolve17(root, pattern.slice(0, -2));
29064
29096
  if (!existsSync14(base) || !statSync7(base).isDirectory())
29065
29097
  return [];
29066
- return readdirSync9(base, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => resolve16(base, entry.name, "package.json")).filter((path) => existsSync14(path));
29098
+ return readdirSync9(base, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => resolve17(base, entry.name, "package.json")).filter((path) => existsSync14(path));
29067
29099
  }
29068
29100
  function exactVersionFromManifest2(manifest, packageName) {
29069
29101
  if (!manifest || typeof manifest !== "object" || Array.isArray(manifest))
@@ -29082,7 +29114,7 @@ function readJsonFile2(path) {
29082
29114
  if (!existsSync14(path))
29083
29115
  return;
29084
29116
  try {
29085
- return JSON.parse(readFileSync12(path, "utf8"));
29117
+ return JSON.parse(readFileSync13(path, "utf8"));
29086
29118
  } catch {
29087
29119
  return;
29088
29120
  }
@@ -29091,7 +29123,7 @@ function isExactPackageVersion2(value) {
29091
29123
  return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(value);
29092
29124
  }
29093
29125
  function readContext7Lockfile2(root) {
29094
- const path = resolve16(root, CONTEXT7_LOCKFILE2);
29126
+ const path = resolve17(root, CONTEXT7_LOCKFILE2);
29095
29127
  if (!existsSync14(path)) {
29096
29128
  return {
29097
29129
  schemaVersion: CONTEXT7_LOCKFILE_SCHEMA_VERSION,
@@ -29099,7 +29131,7 @@ function readContext7Lockfile2(root) {
29099
29131
  libraries: []
29100
29132
  };
29101
29133
  }
29102
- const parsed = JSON.parse(readFileSync12(path, "utf8"));
29134
+ const parsed = JSON.parse(readFileSync13(path, "utf8"));
29103
29135
  if (parsed.schemaVersion !== CONTEXT7_LOCKFILE_SCHEMA_VERSION || parsed.provider !== "context7" || !Array.isArray(parsed.libraries)) {
29104
29136
  throw new Error("Invalid Context7 lockfile");
29105
29137
  }
@@ -29120,13 +29152,13 @@ function upsertContext7Pin2(lock, pin) {
29120
29152
  };
29121
29153
  }
29122
29154
  function writeContext7Lockfile2(root, lock) {
29123
- writePrivateJson4(resolve16(root, CONTEXT7_LOCKFILE2), lock);
29155
+ writePrivateJson4(resolve17(root, CONTEXT7_LOCKFILE2), lock);
29124
29156
  }
29125
29157
  function writeDeveloperReviewRunManifest2(manifest) {
29126
29158
  writePrivateJson4(manifest.manifestPath, manifest);
29127
29159
  }
29128
29160
  function writePrivateJson4(path, value, flag = "w") {
29129
- mkdirSync8(dirname9(path), { recursive: true });
29161
+ mkdirSync8(dirname10(path), { recursive: true });
29130
29162
  writeFileSync7(path, JSON.stringify(value, null, 2), { mode: 384, flag });
29131
29163
  chmodSync4(path, 384);
29132
29164
  }
@@ -29150,7 +29182,7 @@ function readDeveloperReviewRunManifest2(path) {
29150
29182
  }
29151
29183
  function readJsonObject2(path) {
29152
29184
  try {
29153
- const parsed = JSON.parse(readFileSync12(path, "utf8"));
29185
+ const parsed = JSON.parse(readFileSync13(path, "utf8"));
29154
29186
  return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : undefined;
29155
29187
  } catch {
29156
29188
  return;
@@ -29322,8 +29354,8 @@ function auditApproveResultPayload2(runId, status, totalCount, issuedIssues) {
29322
29354
  };
29323
29355
  }
29324
29356
  function expectedFileHash2(root, path) {
29325
- const absolute = resolve16(root, path);
29326
- return existsSync14(absolute) ? digestJson({ body: readFileSync12(absolute, "utf8") }) : "missing";
29357
+ const absolute = resolve17(root, path);
29358
+ return existsSync14(absolute) ? digestJson({ body: readFileSync13(absolute, "utf8") }) : "missing";
29327
29359
  }
29328
29360
  function architectureProjectionRollbackBackup2(files, options = {}) {
29329
29361
  const manifest = {
@@ -29350,7 +29382,7 @@ function architectureProjectionRollbackBackup2(files, options = {}) {
29350
29382
  function uniqueBackupPath2(root, backupBase) {
29351
29383
  let candidate = backupBase;
29352
29384
  let suffix = 2;
29353
- while (existsSync14(resolve16(root, candidate))) {
29385
+ while (existsSync14(resolve17(root, candidate))) {
29354
29386
  candidate = `${backupBase}-${suffix}`;
29355
29387
  suffix += 1;
29356
29388
  }
@@ -29421,7 +29453,7 @@ function parsePracticeCheckpointBaselineState2(state, repositoryId, taskSessionI
29421
29453
  return record;
29422
29454
  }
29423
29455
  function completeTaskProjectionDrift2(root) {
29424
- if (!existsSync14(resolve16(root, "docs/architecture/.projection-manifest.json")))
29456
+ if (!existsSync14(resolve17(root, "docs/architecture/.projection-manifest.json")))
29425
29457
  return;
29426
29458
  const loaded = loadArchitectureDocumentationInputs(root);
29427
29459
  const sourceDigest = architectureDocumentationSourceDigest({
@@ -30007,7 +30039,7 @@ async function runCliUnchecked(command2 = "help", args2 = [], cwd, deps = {}) {
30007
30039
  const subcommand = args2[0] ?? "list";
30008
30040
  if (subcommand === "add") {
30009
30041
  const root = readFlag(args2, "--root") ?? cwd;
30010
- if (resolve17(root) !== resolve17(cwd)) {
30042
+ if (resolve18(root) !== resolve18(cwd)) {
30011
30043
  return errorEnvelope("repo.add", "AC_CAPABILITY_UNSUPPORTED", "Multi-repo architecture context is outside the Local Core MVP; run archctx inside one Git repository.");
30012
30044
  }
30013
30045
  const daemon2 = await runtime();
@@ -30698,8 +30730,8 @@ function architectureDocsRenderProjectionOperation(root, files) {
30698
30730
  };
30699
30731
  }
30700
30732
  function currentBodyHash(root, path) {
30701
- const absolute = resolve17(root, path);
30702
- return existsSync15(absolute) ? digestJson({ body: readFileSync13(absolute, "utf8") }) : "missing";
30733
+ const absolute = resolve18(root, path);
30734
+ return existsSync15(absolute) ? digestJson({ body: readFileSync14(absolute, "utf8") }) : "missing";
30703
30735
  }
30704
30736
  async function runPracticesCommand(args2, cwd, daemon) {
30705
30737
  const subcommand = args2[0] ?? "list";
@@ -31046,12 +31078,12 @@ function auditManifestGateRoot(cwd) {
31046
31078
  }
31047
31079
  }
31048
31080
  function auditGithubIssuesEnabled(cwd) {
31049
- const manifestPath = resolve17(auditManifestGateRoot(cwd), ".archcontext/manifest.yaml");
31081
+ const manifestPath = resolve18(auditManifestGateRoot(cwd), ".archcontext/manifest.yaml");
31050
31082
  if (!existsSync15(manifestPath))
31051
31083
  return false;
31052
31084
  let raw;
31053
31085
  try {
31054
- raw = readFileSync13(manifestPath, "utf8");
31086
+ raw = readFileSync14(manifestPath, "utf8");
31055
31087
  } catch {
31056
31088
  return false;
31057
31089
  }
@@ -31646,11 +31678,11 @@ async function digestReviewChallenge(challenge) {
31646
31678
  }
31647
31679
  function defaultGithubDeveloperReviewStatePath(cwd, pullRequestNumber) {
31648
31680
  const suffix = pullRequestNumber ? `github-developer-review-pr-${pullRequestNumber}.json` : "github-developer-review.json";
31649
- return join10(dirname10(defaultDaemonConnectionPath(cwd)), suffix);
31681
+ return join10(dirname11(defaultDaemonConnectionPath(cwd)), suffix);
31650
31682
  }
31651
31683
  async function writeGithubDeveloperReviewState(cwd, state) {
31652
31684
  const path = defaultGithubDeveloperReviewStatePath(cwd, state.challenge.pullRequestNumber);
31653
- mkdirSync9(dirname10(path), { recursive: true });
31685
+ mkdirSync9(dirname11(path), { recursive: true });
31654
31686
  const serialized = `${JSON.stringify(state, null, 2)}
31655
31687
  `;
31656
31688
  assertNoCliSecretMaterial(serialized);
@@ -31663,7 +31695,7 @@ function readGithubDeveloperReviewState(path) {
31663
31695
  if (!existsSync15(path))
31664
31696
  return;
31665
31697
  try {
31666
- const parsed = JSON.parse(readFileSync13(path, "utf8"));
31698
+ const parsed = JSON.parse(readFileSync14(path, "utf8"));
31667
31699
  if (parsed.schemaVersion !== "archcontext.github-developer-review-state/v1")
31668
31700
  return;
31669
31701
  if (!parsed.challenge || typeof parsed.challenge.pullRequestNumber !== "number")
@@ -31709,13 +31741,13 @@ function sanitizeGithubDeveloperReviewState(state, statePath) {
31709
31741
  return data;
31710
31742
  }
31711
31743
  function defaultGithubConnectionPath(cwd) {
31712
- return join10(dirname10(defaultDaemonConnectionPath(cwd)), "github-connection.json");
31744
+ return join10(dirname11(defaultDaemonConnectionPath(cwd)), "github-connection.json");
31713
31745
  }
31714
31746
  function readGithubConnection(path) {
31715
31747
  if (!existsSync15(path))
31716
31748
  return;
31717
31749
  try {
31718
- const parsed = JSON.parse(readFileSync13(path, "utf8"));
31750
+ const parsed = JSON.parse(readFileSync14(path, "utf8"));
31719
31751
  if (parsed.schemaVersion !== "archcontext.github-connection/v1" || parsed.status !== "connected")
31720
31752
  return;
31721
31753
  return parsed;
@@ -31724,7 +31756,7 @@ function readGithubConnection(path) {
31724
31756
  }
31725
31757
  }
31726
31758
  function writeGithubConnection(path, record) {
31727
- mkdirSync9(dirname10(path), { recursive: true });
31759
+ mkdirSync9(dirname11(path), { recursive: true });
31728
31760
  const serialized = `${JSON.stringify(record, null, 2)}
31729
31761
  `;
31730
31762
  assertNoCliSecretMaterial(serialized);
@@ -31759,7 +31791,7 @@ async function readReviewChallengeV2Arg(args2, cwd, commandName = "github verify
31759
31791
  if (!inline && !challengePath)
31760
31792
  return { ok: false, message: `${commandName} requires --challenge-json or --challenge-path` };
31761
31793
  try {
31762
- const raw = inline ?? readFileSync13(resolve17(cwd, challengePath), "utf8");
31794
+ const raw = inline ?? readFileSync14(resolve18(cwd, challengePath), "utf8");
31763
31795
  const parsed = JSON.parse(raw);
31764
31796
  const attestation = await Promise.resolve().then(() => (init_src7(), exports_src3));
31765
31797
  const assertReviewChallengeV23 = attestation.assertReviewChallengeV2;
@@ -32235,7 +32267,7 @@ function doctorSqlite(cwd) {
32235
32267
  }
32236
32268
  function doctorPermissions(cwd) {
32237
32269
  const paths = runtimeStatePaths(cwd);
32238
- const controlDir = dirname10(defaultDaemonConnectionPath(cwd));
32270
+ const controlDir = dirname11(defaultDaemonConnectionPath(cwd));
32239
32271
  return {
32240
32272
  workspace: pathAccess(cwd),
32241
32273
  stateRoot: pathAccess(paths.stateRoot),
@@ -32271,7 +32303,7 @@ function pathAccess(path) {
32271
32303
  }
32272
32304
  function canAccess(path, mode) {
32273
32305
  try {
32274
- accessSync(path, mode);
32306
+ accessSync2(path, mode);
32275
32307
  return true;
32276
32308
  } catch {
32277
32309
  return false;
@@ -32480,7 +32512,7 @@ async function startBackgroundDaemon(args2, cwd) {
32480
32512
  }
32481
32513
  const recovery = discovered.recovery;
32482
32514
  const connectionPath = defaultDaemonConnectionPath(cwd);
32483
- const controlDir = dirname10(connectionPath);
32515
+ const controlDir = dirname11(connectionPath);
32484
32516
  const logPath = join10(controlDir, "archctxd.log");
32485
32517
  mkdirSync9(controlDir, { recursive: true });
32486
32518
  const logFd = openSync7(logPath, "a", 384);
@@ -32679,11 +32711,11 @@ async function waitForDaemonReady(cwd, timeoutMs, shouldStop) {
32679
32711
  return;
32680
32712
  }
32681
32713
  function sleep(ms) {
32682
- return new Promise((resolve18) => setTimeout(resolve18, ms));
32714
+ return new Promise((resolve19) => setTimeout(resolve19, ms));
32683
32715
  }
32684
32716
  function readFileTail(path, maxBytes = 4096) {
32685
32717
  try {
32686
- const content = readFileSync13(path, "utf8");
32718
+ const content = readFileSync14(path, "utf8");
32687
32719
  return content.slice(Math.max(0, content.length - maxBytes)).replace(/\s+/g, " ").trim();
32688
32720
  } catch {
32689
32721
  return "<unavailable>";
@@ -32692,8 +32724,8 @@ function readFileTail(path, maxBytes = 4096) {
32692
32724
  async function runForegroundDaemon(cwd, args2) {
32693
32725
  const daemon = await createStartedProductionDaemon({ root: cwd });
32694
32726
  let resolveStopped;
32695
- const stopped = new Promise((resolve18) => {
32696
- resolveStopped = resolve18;
32727
+ const stopped = new Promise((resolve19) => {
32728
+ resolveStopped = resolve19;
32697
32729
  });
32698
32730
  const idleTimeoutFlag = readFlag(args2, "--idle-timeout-ms");
32699
32731
  const server = new ArchctxRuntimeRpcServer(daemon, {