@mrciphersmith/keryx 0.4.50 → 0.4.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.js CHANGED
@@ -13721,7 +13721,7 @@ var init_provenance = __esm(() => {
13721
13721
 
13722
13722
  // src/gdgraph/staleness.ts
13723
13723
  import { spawn as spawn2 } from "child_process";
13724
- import { stat as stat7 } from "fs/promises";
13724
+ import { lstat as lstat7, readFile as readFile15, stat as stat7 } from "fs/promises";
13725
13725
  import path39 from "path";
13726
13726
  function gitStatusPorcelain(cwd) {
13727
13727
  return new Promise((resolve) => {
@@ -13791,6 +13791,28 @@ function categorizeStatusEntries(entries, rootPrefix) {
13791
13791
  }
13792
13792
  return { added, deleted, renamed, modified };
13793
13793
  }
13794
+ async function graphAdditions(cwd, rootPrefix, added) {
13795
+ let nodes;
13796
+ const relevant = [];
13797
+ for (const candidate of added) {
13798
+ if (candidate.endsWith("/") && candidate.startsWith(rootPrefix)) {
13799
+ const relative = candidate.slice(rootPrefix.length);
13800
+ const marker = await lstat7(path39.join(cwd, relative, ".git")).catch(() => {
13801
+ return;
13802
+ });
13803
+ if (marker?.isFile() || marker?.isDirectory()) {
13804
+ nodes ??= await readFile15(nodesJsonlPath(cwd), "utf8").catch(() => {
13805
+ return;
13806
+ });
13807
+ const prefix = `"path":${JSON.stringify(relative).slice(0, -1)}`;
13808
+ if (nodes !== undefined && !nodes.includes(prefix))
13809
+ continue;
13810
+ }
13811
+ }
13812
+ relevant.push(candidate);
13813
+ }
13814
+ return relevant;
13815
+ }
13794
13816
  function nameFiles(message, files) {
13795
13817
  if (files.length === 0) {
13796
13818
  return message;
@@ -13855,8 +13877,9 @@ async function checkGraphStaleness(cwd, statusObservation) {
13855
13877
  } else {
13856
13878
  const entries = porcelain.split("\x00").filter((entry) => entry.length > 0);
13857
13879
  const { added, deleted, renamed, modified } = categorizeStatusEntries(entries, rootPrefix);
13858
- if (added.length > 0) {
13859
- reasons.push(nameFiles("an untracked or newly added file exists in the working tree", added));
13880
+ const relevantAdditions = await graphAdditions(cwd, rootPrefix, added);
13881
+ if (relevantAdditions.length > 0) {
13882
+ reasons.push(nameFiles("an untracked or newly added file exists in the working tree", relevantAdditions));
13860
13883
  }
13861
13884
  if (deleted.length > 0) {
13862
13885
  reasons.push(nameFiles("a tracked file was deleted in the working tree", deleted));
@@ -14527,7 +14550,7 @@ var init_metaproject_projection = __esm(() => {
14527
14550
  // src/openspec/catalog.ts
14528
14551
  var MAX_DISCOVERY_ENTRIES = 1e4, RESERVED_COLLECTION_ENTRIES, MAX_FILE_BYTES, MAX_TOTAL_BYTES;
14529
14552
  var init_catalog3 = __esm(() => {
14530
- init_contained_read();
14553
+ init_descriptor_read();
14531
14554
  RESERVED_COLLECTION_ENTRIES = Math.floor(MAX_DISCOVERY_ENTRIES / 3) - 1;
14532
14555
  MAX_FILE_BYTES = 1024 * 1024;
14533
14556
  MAX_TOTAL_BYTES = 64 * MAX_FILE_BYTES;
@@ -14601,7 +14624,7 @@ var init_integrations = __esm(() => {
14601
14624
 
14602
14625
  // src/security/audit-harness/surfaces.ts
14603
14626
  import path40 from "path";
14604
- import { lstat as lstat7, readdir as readdir6, realpath as realpath10, stat as stat8 } from "fs/promises";
14627
+ import { lstat as lstat8, readdir as readdir6, realpath as realpath10, stat as stat8 } from "fs/promises";
14605
14628
  async function resolvesInsideRoot(root, absolute) {
14606
14629
  try {
14607
14630
  const rootReal = await realpath10(root).catch(() => path40.resolve(root));
@@ -14698,7 +14721,7 @@ async function walkScripts(root, dirRelative, depth, visited, acc) {
14698
14721
  if (!await pathExists(dirAbsolute)) {
14699
14722
  return;
14700
14723
  }
14701
- const lst = await lstat7(dirAbsolute).catch(() => {
14724
+ const lst = await lstat8(dirAbsolute).catch(() => {
14702
14725
  return;
14703
14726
  });
14704
14727
  if (lst?.isSymbolicLink() && !await resolvesInsideRoot(root, dirAbsolute)) {
@@ -16874,7 +16897,7 @@ var init_checks = __esm(() => {
16874
16897
 
16875
16898
  // src/security/audit-harness/baseline.ts
16876
16899
  import path41 from "path";
16877
- import { readFile as readFile15 } from "fs/promises";
16900
+ import { readFile as readFile16 } from "fs/promises";
16878
16901
  function defaultBaselinePath(root) {
16879
16902
  return path41.join(root, ".metaproject", "security-audit-baseline.json");
16880
16903
  }
@@ -16949,7 +16972,7 @@ function indefiniteSuppressionFindings(applicableEntries) {
16949
16972
  }
16950
16973
  async function readRawBaselineFindingIds(filePath) {
16951
16974
  try {
16952
- const text = await readFile15(filePath, "utf8");
16975
+ const text = await readFile16(filePath, "utf8");
16953
16976
  const parsed = JSON.parse(text);
16954
16977
  if (!parsed || typeof parsed !== "object" || !Array.isArray(parsed.entries)) {
16955
16978
  return [];
@@ -16974,7 +16997,7 @@ async function addBaselineEntry(root, entry, options = {}) {
16974
16997
  }
16975
16998
  const now = options.now ? options.now() : new Date;
16976
16999
  backupPath = `${filePath}.bak-${now.toISOString().replace(/[:.]/g, "-")}`;
16977
- const preResealBytes = await readFile15(filePath);
17000
+ const preResealBytes = await readFile16(filePath);
16978
17001
  await writeContained(root, path41.relative(root, backupPath), preResealBytes);
16979
17002
  entries = loaded.state.entries;
16980
17003
  const rawIds = await readRawBaselineFindingIds(filePath);
@@ -17081,7 +17104,7 @@ var init_types2 = __esm(() => {
17081
17104
 
17082
17105
  // src/security/audit-harness/proposals.ts
17083
17106
  import path42 from "path";
17084
- import { readFile as readFile16, realpath as realpath11 } from "fs/promises";
17107
+ import { readFile as readFile17, realpath as realpath11 } from "fs/promises";
17085
17108
  async function assertContained2(rootReal, absolute, label) {
17086
17109
  if (!isPathInside(rootReal, absolute)) {
17087
17110
  throw new Error(`Refusing to write ${label}: path escapes project root ${rootReal}.`);
@@ -17195,7 +17218,7 @@ function countOccurrences(haystack, needle) {
17195
17218
  async function applyTextEdit(rootReal, edit) {
17196
17219
  const absolute = path42.resolve(rootReal, edit.path);
17197
17220
  await assertContained2(rootReal, absolute, `target file "${edit.path}"`);
17198
- const content = await readFile16(absolute, "utf8");
17221
+ const content = await readFile17(absolute, "utf8");
17199
17222
  const occurrences = countOccurrences(content, edit.from);
17200
17223
  if (occurrences === 0) {
17201
17224
  throw new Error(`Cannot apply proposal: expected text not found in ${edit.path}.`);
@@ -17276,7 +17299,7 @@ var init_proposals = __esm(() => {
17276
17299
  // src/security/audit-harness/index.ts
17277
17300
  import { createHash as createHash6 } from "crypto";
17278
17301
  import path43 from "path";
17279
- import { readFile as readFile17 } from "fs/promises";
17302
+ import { readFile as readFile18 } from "fs/promises";
17280
17303
  function findingId(f) {
17281
17304
  const pointerOrLine = f.location?.pointer ?? (f.location?.line !== undefined ? `line:${f.location.line}` : "");
17282
17305
  const policyId = f.evidence.policyId ?? "";
@@ -17301,14 +17324,14 @@ function compareFindings(a, b) {
17301
17324
  }
17302
17325
  async function safeReadText(absolute) {
17303
17326
  try {
17304
- return await readFile17(absolute, "utf8");
17327
+ return await readFile18(absolute, "utf8");
17305
17328
  } catch {
17306
17329
  return;
17307
17330
  }
17308
17331
  }
17309
17332
  async function safeReadBuffer(absolute) {
17310
17333
  try {
17311
- return await readFile17(absolute);
17334
+ return await readFile18(absolute);
17312
17335
  } catch {
17313
17336
  return;
17314
17337
  }
@@ -17909,7 +17932,7 @@ __export(exports_service, {
17909
17932
  verifyConfigChecksum: () => verifyConfigChecksum
17910
17933
  });
17911
17934
  import path44 from "path";
17912
- import { readFile as readFile18 } from "fs/promises";
17935
+ import { readFile as readFile19 } from "fs/promises";
17913
17936
  import { randomBytes as randomBytes3 } from "crypto";
17914
17937
  function validateSerializedOutput(content, exemptExfil) {
17915
17938
  return validateSerializedContentForTransport(content, exemptExfil);
@@ -18081,7 +18104,7 @@ async function readLatestReport(cwd) {
18081
18104
  }
18082
18105
  let parsed;
18083
18106
  try {
18084
- parsed = JSON.parse(await readFile18(file, "utf8"));
18107
+ parsed = JSON.parse(await readFile19(file, "utf8"));
18085
18108
  } catch {
18086
18109
  return { kind: "unusable" };
18087
18110
  }
@@ -18515,7 +18538,7 @@ var init_types3 = __esm(() => {
18515
18538
  });
18516
18539
 
18517
18540
  // src/memory/store.ts
18518
- import { lstat as lstat9, readdir as readdir13, readFile as readFile29 } from "fs/promises";
18541
+ import { lstat as lstat10, readdir as readdir13, readFile as readFile30 } from "fs/promises";
18519
18542
  import path63 from "path";
18520
18543
  function decodeStrictUtf8(bytes) {
18521
18544
  return STRICT_UTF8_DECODER.decode(bytes);
@@ -18533,7 +18556,7 @@ async function collectEntries(cwd) {
18533
18556
  const dir = path63.join(root, folder);
18534
18557
  let dirStats;
18535
18558
  try {
18536
- dirStats = await lstat9(dir);
18559
+ dirStats = await lstat10(dir);
18537
18560
  } catch {
18538
18561
  continue;
18539
18562
  }
@@ -18547,14 +18570,14 @@ async function collectEntries(cwd) {
18547
18570
  const abs = path63.join(dir, name);
18548
18571
  let stats;
18549
18572
  try {
18550
- stats = await lstat9(abs);
18573
+ stats = await lstat10(abs);
18551
18574
  } catch {
18552
18575
  continue;
18553
18576
  }
18554
18577
  if (!stats.isFile()) {
18555
18578
  continue;
18556
18579
  }
18557
- const content = await readFile29(abs, "utf8");
18580
+ const content = await readFile30(abs, "utf8");
18558
18581
  entries.push(parseEntry(abs, `${folder}/${name}`, type, content));
18559
18582
  }
18560
18583
  }
@@ -18565,7 +18588,7 @@ async function collectEntriesStrict(root) {
18565
18588
  const problems = [];
18566
18589
  let rootStats;
18567
18590
  try {
18568
- rootStats = await lstat9(root);
18591
+ rootStats = await lstat10(root);
18569
18592
  } catch (error) {
18570
18593
  if (isNotFound(error)) {
18571
18594
  return { status: "complete", entries: [], problems: [] };
@@ -18582,7 +18605,7 @@ async function collectEntriesStrict(root) {
18582
18605
  const dir = path63.join(root, folder);
18583
18606
  let dirStats;
18584
18607
  try {
18585
- dirStats = await lstat9(dir);
18608
+ dirStats = await lstat10(dir);
18586
18609
  } catch (error) {
18587
18610
  if (isNotFound(error)) {
18588
18611
  continue;
@@ -18606,7 +18629,7 @@ async function collectEntriesStrict(root) {
18606
18629
  const abs = path63.join(dir, name);
18607
18630
  let entryStats;
18608
18631
  try {
18609
- entryStats = await lstat9(abs);
18632
+ entryStats = await lstat10(abs);
18610
18633
  } catch {
18611
18634
  problems.push({ path: relativePath, reason: "unreadable-file" });
18612
18635
  continue;
@@ -18631,7 +18654,7 @@ async function collectEntriesStrict(root) {
18631
18654
  }
18632
18655
  let raw;
18633
18656
  try {
18634
- raw = await readFile29(abs);
18657
+ raw = await readFile30(abs);
18635
18658
  } catch {
18636
18659
  problems.push({ path: relativePath, reason: "unreadable-file" });
18637
18660
  continue;
@@ -18699,7 +18722,7 @@ async function collectUnexpectedMarkdown(dir, relativeDir, problems) {
18699
18722
  const relativePath = `${relativeDir}/${name}`;
18700
18723
  let stats;
18701
18724
  try {
18702
- stats = await lstat9(abs);
18725
+ stats = await lstat10(abs);
18703
18726
  } catch {
18704
18727
  continue;
18705
18728
  }
@@ -18732,7 +18755,7 @@ async function collectUnexpectedTopLevel(root, problems) {
18732
18755
  const abs = path63.join(root, name);
18733
18756
  let stats;
18734
18757
  try {
18735
- stats = await lstat9(abs);
18758
+ stats = await lstat10(abs);
18736
18759
  } catch {
18737
18760
  continue;
18738
18761
  }
@@ -20948,7 +20971,7 @@ var init_provenance2 = __esm(() => {
20948
20971
  });
20949
20972
 
20950
20973
  // src/wiki/collect.ts
20951
- import { readFile as readFile41, readdir as readdir16 } from "fs/promises";
20974
+ import { readFile as readFile42, readdir as readdir16 } from "fs/promises";
20952
20975
  import path88 from "path";
20953
20976
  function wikiRootPath(cwd) {
20954
20977
  return path88.join(cwd, ".metaproject", "wiki");
@@ -20975,7 +20998,7 @@ async function collectPages(cwd) {
20975
20998
  const absolutePath = path88.join(dir, entry);
20976
20999
  let content;
20977
21000
  try {
20978
- content = await readFile41(absolutePath, "utf8");
21001
+ content = await readFile42(absolutePath, "utf8");
20979
21002
  } catch (error) {
20980
21003
  const message = error instanceof Error ? error.message : String(error);
20981
21004
  throw new WikiCollectionError(absolutePath, `the wiki store could not be read (${message}). This is not the same as "no pages": ` + `${absolutePath} exists but could not be read.`);
@@ -21832,7 +21855,7 @@ var MEMORY_EMBEDDING_ID = "memory.embedding", DEFAULT_EMBED_DIMS = 96;
21832
21855
 
21833
21856
  // src/memory/embedding/index.ts
21834
21857
  import { createHash as createHash15 } from "crypto";
21835
- import { mkdir as mkdir15, readFile as readFile42, writeFile as writeFile9 } from "fs/promises";
21858
+ import { mkdir as mkdir15, readFile as readFile43, writeFile as writeFile9 } from "fs/promises";
21836
21859
  import path89 from "path";
21837
21860
  function embeddingsDir(cwd) {
21838
21861
  return path89.join(cwd, ".metaproject", "data", "memory", "embeddings");
@@ -21879,9 +21902,9 @@ async function loadEmbeddingIndex(cwd) {
21879
21902
  return null;
21880
21903
  }
21881
21904
  try {
21882
- const meta = JSON.parse(await readFile42(metaPath, "utf8"));
21905
+ const meta = JSON.parse(await readFile43(metaPath, "utf8"));
21883
21906
  const records = [];
21884
- for (const line of (await readFile42(vectorsPath, "utf8")).split(`
21907
+ for (const line of (await readFile43(vectorsPath, "utf8")).split(`
21885
21908
  `)) {
21886
21909
  if (line.trim().length === 0) {
21887
21910
  continue;
@@ -22259,7 +22282,7 @@ var init_section_tombstone = __esm(() => {
22259
22282
  });
22260
22283
 
22261
22284
  // src/memory/cross-layer.ts
22262
- import { readFile as readFile43 } from "fs/promises";
22285
+ import { readFile as readFile44 } from "fs/promises";
22263
22286
  import path91 from "path";
22264
22287
  function extractWikiReferences(entryRelativePath, entryAbsolutePath, content, wikiRoot) {
22265
22288
  const references = [];
@@ -22311,7 +22334,7 @@ async function loadWikiKnowledgeView(cwd) {
22311
22334
  const pages = await collectPages(cwd);
22312
22335
  const index = buildSectionIndex(await Promise.all(pages.map(async (page) => ({
22313
22336
  page,
22314
- content: await readFile43(page.absolutePath, "utf8").catch(() => "")
22337
+ content: await readFile44(page.absolutePath, "utf8").catch(() => "")
22315
22338
  }))));
22316
22339
  return {
22317
22340
  index,
@@ -22424,7 +22447,7 @@ async function checkMemoryCrossLayer(cwd, entries, view) {
22424
22447
  const resolved = view ?? await loadWikiKnowledgeView(cwd);
22425
22448
  const findings = [];
22426
22449
  for (const entry of entries) {
22427
- const content = await readFile43(entry.absolutePath, "utf8").catch(() => null);
22450
+ const content = await readFile44(entry.absolutePath, "utf8").catch(() => null);
22428
22451
  if (content === null) {
22429
22452
  findings.push({
22430
22453
  reference: {
@@ -22595,7 +22618,7 @@ var init_check = __esm(() => {
22595
22618
  });
22596
22619
 
22597
22620
  // src/memory/write.ts
22598
- import { mkdir as mkdir16, open as open3, readFile as readFile44, rename as rename5, rm as rm5, writeFile as writeFile10 } from "fs/promises";
22621
+ import { mkdir as mkdir16, open as open3, readFile as readFile45, rename as rename5, rm as rm5, writeFile as writeFile10 } from "fs/promises";
22599
22622
  import path93 from "path";
22600
22623
  async function resolveCanonicalEntryPath(cwd, relativePath) {
22601
22624
  const root = path93.resolve(memoryRoot(cwd));
@@ -22636,7 +22659,7 @@ async function writeCanonicalPair(input) {
22636
22659
  return asPair(secondGuard.result, [first.value.relativePath]);
22637
22660
  const prepared = [firstGuard.value, secondGuard.value];
22638
22661
  const warnings = prepared.flatMap((entry) => entry.warnings);
22639
- const [originalFirst, originalSecond] = await Promise.all(prepared.map((entry) => readFile44(entry.absolutePath, "utf8")));
22662
+ const [originalFirst, originalSecond] = await Promise.all(prepared.map((entry) => readFile45(entry.absolutePath, "utf8")));
22640
22663
  try {
22641
22664
  await replaceAtomically(prepared[0].absolutePath, prepared[0].content);
22642
22665
  if (input.failReplaceAt === 2)
@@ -22748,14 +22771,14 @@ var init_write = __esm(() => {
22748
22771
 
22749
22772
  // src/memory/ingest.ts
22750
22773
  import { existsSync as existsSync10 } from "fs";
22751
- import { readFile as readFile45 } from "fs/promises";
22774
+ import { readFile as readFile46 } from "fs/promises";
22752
22775
  import path94 from "path";
22753
22776
  async function ingestMemory(cwd, source, filePath, config, now) {
22754
22777
  const absolute = path94.resolve(cwd, filePath);
22755
22778
  if (!await pathExists(absolute)) {
22756
22779
  throw new Error(`Ingest source not found: ${filePath}`);
22757
22780
  }
22758
- const content = await readFile45(absolute, "utf8");
22781
+ const content = await readFile46(absolute, "utf8");
22759
22782
  const candidates = extractCandidates2(content);
22760
22783
  const type = SOURCE_TYPE[source] ?? "lesson";
22761
22784
  const confidence = SOURCE_CONFIDENCE[source] ?? "low";
@@ -22835,7 +22858,7 @@ async function ingestMemory(cwd, source, filePath, config, now) {
22835
22858
  return result;
22836
22859
  }
22837
22860
  async function reconcileEntry(cwd, relativePath, absolutePath, source, link, date) {
22838
- const content = await readFile45(absolutePath, "utf8");
22861
+ const content = await readFile46(absolutePath, "utf8");
22839
22862
  const note = `- Reconciled: ${source} ${date}${link ? ` (${link})` : ""}`;
22840
22863
  if (content.includes(note)) {
22841
22864
  return { changed: false };
@@ -22984,7 +23007,7 @@ var init_ingest = __esm(() => {
22984
23007
  });
22985
23008
 
22986
23009
  // src/memory/supersede.ts
22987
- import { readFile as readFile46 } from "fs/promises";
23010
+ import { readFile as readFile47 } from "fs/promises";
22988
23011
  import path95 from "path";
22989
23012
  async function supersedeEntry(input, now) {
22990
23013
  const date = input.date ?? now.toISOString().slice(0, 10);
@@ -22997,8 +23020,8 @@ async function supersedeEntry(input, now) {
22997
23020
  if (!newResolved) {
22998
23021
  throw new Error(`Superseding entry not found: ${input.newPath}`);
22999
23022
  }
23000
- const oldContent = await readFile46(oldResolved.absolute, "utf8");
23001
- const newContent = await readFile46(newResolved.absolute, "utf8");
23023
+ const oldContent = await readFile47(oldResolved.absolute, "utf8");
23024
+ const newContent = await readFile47(newResolved.absolute, "utf8");
23002
23025
  if (headerValue(oldContent, "Superseded-By") === newResolved.relative && headerValue(newContent, "Supersedes") === oldResolved.relative) {
23003
23026
  return {
23004
23027
  superseded: oldResolved.relative,
@@ -23245,7 +23268,7 @@ __export(exports_service3, {
23245
23268
  selectHandoffEntries: () => selectHandoffEntries
23246
23269
  });
23247
23270
  import { createHash as createHash16 } from "crypto";
23248
- import { mkdir as mkdir17, readFile as readFile47, writeFile as writeFile11 } from "fs/promises";
23271
+ import { mkdir as mkdir17, readFile as readFile48, writeFile as writeFile11 } from "fs/promises";
23249
23272
  import path96 from "path";
23250
23273
  function dataRoot2(cwd) {
23251
23274
  return path96.join(cwd, ".metaproject", "data", "memory");
@@ -23372,7 +23395,7 @@ function createMemoryService() {
23372
23395
  }
23373
23396
  let content;
23374
23397
  try {
23375
- content = await readFile47(resolved.absolutePath, "utf8");
23398
+ content = await readFile48(resolved.absolutePath, "utf8");
23376
23399
  } catch {
23377
23400
  return { path: resolved.relativePath, from: "draft", to: input.to, changed: false, error: { code: "not-found", message: `Memory entry not found: ${resolved.relativePath}` } };
23378
23401
  }
@@ -23563,7 +23586,7 @@ var init_service4 = __esm(() => {
23563
23586
  });
23564
23587
 
23565
23588
  // src/wiki/ask.ts
23566
- import { readFile as readFile48 } from "fs/promises";
23589
+ import { readFile as readFile49 } from "fs/promises";
23567
23590
  async function wikiAsk(input) {
23568
23591
  const k = input.k && input.k > 0 ? input.k : DEFAULT_K;
23569
23592
  const asOf = input.asOf ? validateAsOf(input.asOf, new Date) : undefined;
@@ -23730,7 +23753,7 @@ async function wikiCandidates(cwd, observedAt, historicalMode, asOf) {
23730
23753
  }
23731
23754
  const index = buildSectionIndex(await Promise.all(admitted.map(async (page) => ({
23732
23755
  page,
23733
- content: await readFile48(page.absolutePath, "utf8").catch(() => "")
23756
+ content: await readFile49(page.absolutePath, "utf8").catch(() => "")
23734
23757
  }))));
23735
23758
  const result = [];
23736
23759
  for (const section of index.sections) {
@@ -24528,7 +24551,7 @@ var init_config4 = __esm(() => {
24528
24551
 
24529
24552
  // src/wiki/history.ts
24530
24553
  import { createHash as createHash18, randomBytes as randomBytes5 } from "crypto";
24531
- import { appendFile as appendFile4, mkdir as mkdir19, open as open4, readFile as readFile49, rm as rm6, stat as stat14, writeFile as writeFile13 } from "fs/promises";
24554
+ import { appendFile as appendFile4, mkdir as mkdir19, open as open4, readFile as readFile50, rm as rm6, stat as stat14, writeFile as writeFile13 } from "fs/promises";
24532
24555
  import path100 from "path";
24533
24556
  function wikiRootPath2(cwd) {
24534
24557
  return path100.join(cwd, ".metaproject", "wiki");
@@ -24596,7 +24619,7 @@ function parseVersionLabel(value) {
24596
24619
  }
24597
24620
  async function readBufferOrNull(file) {
24598
24621
  try {
24599
- return await readFile49(file);
24622
+ return await readFile50(file);
24600
24623
  } catch (error) {
24601
24624
  if (isNotFound(error))
24602
24625
  return null;
@@ -24665,7 +24688,7 @@ async function storeVersion(cwd, page, version, at, content) {
24665
24688
  const target = path100.join(pageHistoryDir(cwd, page), fileName);
24666
24689
  await mkdir19(path100.dirname(target), { recursive: true });
24667
24690
  await writeFile13(target, content);
24668
- if (sha2562(await readFile49(target)) !== sha2562(content)) {
24691
+ if (sha2562(await readFile50(target)) !== sha2562(content)) {
24669
24692
  throw new Error(`history: stored version does not match the page bytes: ${target}`);
24670
24693
  }
24671
24694
  return fileName;
@@ -24741,7 +24764,7 @@ async function appendRun(cwd, entry) {
24741
24764
  await withFileLock(path100.join(root, ".runs.lock"), async () => {
24742
24765
  if ((await stat14(file)).size <= MAX_RUNS_BYTES)
24743
24766
  return;
24744
- const lines = (await readFile49(file, "utf8")).split(`
24767
+ const lines = (await readFile50(file, "utf8")).split(`
24745
24768
  `).filter((line) => line.trim().length > 0);
24746
24769
  await writeFileAtomic(file, `${lines.slice(Math.floor(lines.length / 2)).join(`
24747
24770
  `)}
@@ -24842,7 +24865,7 @@ async function readVersionContent(cwd, page, row) {
24842
24865
  if (!VERSION_FILE.test(row.file)) {
24843
24866
  throw new Error(`${versionLabel(row.version)} of ${page} has no stored copy (${row.file})`);
24844
24867
  }
24845
- const content = await readFile49(versionFilePath(cwd, page, row.file));
24868
+ const content = await readFile50(versionFilePath(cwd, page, row.file));
24846
24869
  if (sha2562(content) !== row.sha) {
24847
24870
  throw new Error(`${versionLabel(row.version)} of ${page} does not match its recorded sha256`);
24848
24871
  }
@@ -25409,7 +25432,7 @@ __export(exports_service4, {
25409
25432
  });
25410
25433
  import { spawn as spawn3 } from "child_process";
25411
25434
  import { createHash as createHash19 } from "crypto";
25412
- import { mkdir as mkdir20, readFile as readFile50, readdir as readdir17, writeFile as writeFile14 } from "fs/promises";
25435
+ import { mkdir as mkdir20, readFile as readFile51, readdir as readdir17, writeFile as writeFile14 } from "fs/promises";
25413
25436
  import path102 from "path";
25414
25437
  function wikiRootPath3(cwd) {
25415
25438
  return path102.join(cwd, ".metaproject", "wiki");
@@ -25441,7 +25464,7 @@ async function findPagesWithThinkTags(pages) {
25441
25464
  const flagged = [];
25442
25465
  for (const page of pages) {
25443
25466
  try {
25444
- const content = await readFile50(page.absolutePath, "utf8");
25467
+ const content = await readFile51(page.absolutePath, "utf8");
25445
25468
  if (containsThinkTags(content)) {
25446
25469
  flagged.push(page.relativePath);
25447
25470
  }
@@ -25477,7 +25500,7 @@ async function wikiGenerateIndex(cwd, history) {
25477
25500
  const managedBlock = `${WIKI_INDEX_BEGIN}
25478
25501
  ${renderIndexBody(pages, generatedAt)}
25479
25502
  ${WIKI_INDEX_END}`;
25480
- const existing = await pathExists(indexPath) ? await readFile50(indexPath, "utf8") : renderWikiIndexScaffold();
25503
+ const existing = await pathExists(indexPath) ? await readFile51(indexPath, "utf8") : renderWikiIndexScaffold();
25481
25504
  const pattern = new RegExp(`${escapeRegExp3(WIKI_INDEX_BEGIN)}[\\s\\S]*?${escapeRegExp3(WIKI_INDEX_END)}`);
25482
25505
  const replaced = pattern.test(existing) ? existing.replace(pattern, managedBlock) : `${existing.trimEnd()}
25483
25506
 
@@ -25501,7 +25524,7 @@ async function wikiCheckLinks(cwd) {
25501
25524
  let checkedLinks = 0;
25502
25525
  let skippedExternal = 0;
25503
25526
  for (const absolutePath of files) {
25504
- const content = await readFile50(absolutePath, "utf8");
25527
+ const content = await readFile51(absolutePath, "utf8");
25505
25528
  const pageRelative = path102.relative(cwd, absolutePath);
25506
25529
  for (const target of extractLinkTargets(content)) {
25507
25530
  if (EXTERNAL_LINK.test(target)) {
@@ -25652,7 +25675,7 @@ async function wikiPruneOrphans(cwd, history) {
25652
25675
  continue;
25653
25676
  }
25654
25677
  const filePath = path102.join(componentsDir, entry);
25655
- const current = await readFile50(filePath, "utf8");
25678
+ const current = await readFile51(filePath, "utf8");
25656
25679
  const isUnmodifiedDraft = /\nStatus:\s*draft\s*\n/.test(current) && current.includes("Generated by `keryx wiki collect`");
25657
25680
  if (isUnmodifiedDraft) {
25658
25681
  run ??= history ?? await openWikiWriteContext(cwd, "wiki prune");
@@ -25674,7 +25697,7 @@ async function moduleFileCounts(cwd, dataDir) {
25674
25697
  return;
25675
25698
  }
25676
25699
  const counts = new Map;
25677
- for (const node of parseJsonl(await readFile50(nodesPath, "utf8"))) {
25700
+ for (const node of parseJsonl(await readFile51(nodesPath, "utf8"))) {
25678
25701
  if (node.kind === "asset")
25679
25702
  continue;
25680
25703
  const nodePath = String(node.path ?? node.id ?? "unknown");
@@ -25706,7 +25729,7 @@ async function wikiEvidence(input) {
25706
25729
  const pages = await collectPages(input.cwd);
25707
25730
  const index = buildSectionIndex(await Promise.all(pages.map(async (page) => ({
25708
25731
  page,
25709
- content: await readFile50(page.absolutePath, "utf8").catch(() => "")
25732
+ content: await readFile51(page.absolutePath, "utf8").catch(() => "")
25710
25733
  }))));
25711
25734
  const registry = await readSectionRegistryState(input.cwd);
25712
25735
  const pageStatus = {};
@@ -25783,7 +25806,7 @@ async function collectGraphWikiCandidates(cwd, generatedAt, limit, onlyModules,
25783
25806
  let nodes = 0;
25784
25807
  let files = 0;
25785
25808
  let assets = 0;
25786
- for (const node of parseJsonl(await readFile50(nodesPath, "utf8"))) {
25809
+ for (const node of parseJsonl(await readFile51(nodesPath, "utf8"))) {
25787
25810
  nodes += 1;
25788
25811
  const nodePath = String(node.path ?? node.id ?? "unknown");
25789
25812
  if (node.kind === "asset") {
@@ -25805,7 +25828,7 @@ async function collectGraphWikiCandidates(cwd, generatedAt, limit, onlyModules,
25805
25828
  let edges = 0;
25806
25829
  let imports = 0;
25807
25830
  let unresolved = 0;
25808
- for (const edge of parseJsonl(await readFile50(edgesPath, "utf8"))) {
25831
+ for (const edge of parseJsonl(await readFile51(edgesPath, "utf8"))) {
25809
25832
  edges += 1;
25810
25833
  const kind = String(edge.kind ?? "");
25811
25834
  if (kind === "unresolved") {
@@ -25974,7 +25997,7 @@ async function readModuleReadme(cwd, moduleName, pageLink) {
25974
25997
  return null;
25975
25998
  }
25976
25999
  try {
25977
- const content = await readFile50(readmePath, "utf8");
26000
+ const content = await readFile51(readmePath, "utf8");
25978
26001
  const paragraph = content.split(/\n\s*\n/).map((block) => block.trim()).find((block) => block.length > 0 && !block.startsWith("#"));
25979
26002
  if (!paragraph) {
25980
26003
  return null;
@@ -25995,7 +26018,7 @@ async function extractModuleExports(cwd, files) {
25995
26018
  continue;
25996
26019
  }
25997
26020
  try {
25998
- const content = (await readFile50(filePath, "utf8")).slice(0, 40000);
26021
+ const content = (await readFile51(filePath, "utf8")).slice(0, 40000);
25999
26022
  let match;
26000
26023
  while ((match = declRe.exec(content)) !== null) {
26001
26024
  if (match[1]) {
@@ -26028,7 +26051,7 @@ async function extractModuleApi(cwd, files, dataDir) {
26028
26051
  const fileSet = new Set(files);
26029
26052
  const kindByName = new Map;
26030
26053
  try {
26031
- for (const raw of parseJsonl(await readFile50(symbolsPath, "utf8"))) {
26054
+ for (const raw of parseJsonl(await readFile51(symbolsPath, "utf8"))) {
26032
26055
  const symbol = raw;
26033
26056
  if (!symbol.name || !symbol.path || symbol.container != null)
26034
26057
  continue;
@@ -26051,7 +26074,7 @@ async function collectHealthWikiCandidates(cwd, generatedAt) {
26051
26074
  if (!await pathExists(healthPath)) {
26052
26075
  return [];
26053
26076
  }
26054
- const report = JSON.parse(await readFile50(healthPath, "utf8"));
26077
+ const report = JSON.parse(await readFile51(healthPath, "utf8"));
26055
26078
  const metrics = Array.isArray(report.metrics) ? report.metrics : [];
26056
26079
  const project = metrics.find((metric) => metric.key === "project") ?? {};
26057
26080
  const counts = project.findingCounts ?? {};
@@ -26093,7 +26116,7 @@ async function collectTestingWikiCandidates(cwd, generatedAt) {
26093
26116
  if (!await pathExists(contextPath)) {
26094
26117
  return [];
26095
26118
  }
26096
- const context = await readFile50(contextPath, "utf8");
26119
+ const context = await readFile51(contextPath, "utf8");
26097
26120
  const summary = firstMeaningfulLine(context) ?? "Generated from testing context.";
26098
26121
  return [{
26099
26122
  type: "architecture",
@@ -26128,7 +26151,7 @@ async function writeCollectedPage(cwd, candidate, force, history) {
26128
26151
  }
26129
26152
  let content = candidate.content;
26130
26153
  if (exists && force) {
26131
- const current = await readFile50(filePath, "utf8");
26154
+ const current = await readFile51(filePath, "utf8");
26132
26155
  const isGeneratedDraft = /\nStatus:\s*draft\s*\n/.test(current) && current.includes("Generated by `keryx wiki collect`");
26133
26156
  if (!isGeneratedDraft) {
26134
26157
  return { path: relativePath, type: candidate.type, source: candidate.source, action: "skipped" };
@@ -26173,7 +26196,7 @@ async function wikiPagesForFile(cwd, targetRepoPath) {
26173
26196
  const pages = await collectPages(cwd);
26174
26197
  const refs = await Promise.all(pages.map(async (page) => ({
26175
26198
  repoPath: path102.relative(cwd, page.absolutePath).split(path102.sep).join("/"),
26176
- content: await readFile50(page.absolutePath, "utf8")
26199
+ content: await readFile51(page.absolutePath, "utf8")
26177
26200
  })));
26178
26201
  return backlinksFor(buildBacklinkIndex(refs), targetRepoPath);
26179
26202
  }
@@ -26215,7 +26238,7 @@ async function isIndexStale(cwd, pages) {
26215
26238
  if (!await pathExists(indexPath)) {
26216
26239
  return true;
26217
26240
  }
26218
- const content = await readFile50(indexPath, "utf8");
26241
+ const content = await readFile51(indexPath, "utf8");
26219
26242
  const managed = content.match(new RegExp(`${escapeRegExp3(WIKI_INDEX_BEGIN)}([\\s\\S]*?)${escapeRegExp3(WIKI_INDEX_END)}`));
26220
26243
  if (!managed?.[1]) {
26221
26244
  return true;
@@ -26290,7 +26313,7 @@ async function readIndexGeneratedAt(cwd) {
26290
26313
  if (!await pathExists(indexPath)) {
26291
26314
  return null;
26292
26315
  }
26293
- const content = await readFile50(indexPath, "utf8");
26316
+ const content = await readFile51(indexPath, "utf8");
26294
26317
  const match = content.match(/<!--\s*generated:\s*([^|]+?)\s*\|/);
26295
26318
  const value = match?.[1]?.trim();
26296
26319
  return value && value !== "never" ? value : null;
@@ -26300,7 +26323,7 @@ async function readLinkCheckState(cwd) {
26300
26323
  if (!await pathExists(reportPath)) {
26301
26324
  return null;
26302
26325
  }
26303
- const content = await readFile50(reportPath, "utf8");
26326
+ const content = await readFile51(reportPath, "utf8");
26304
26327
  const matches = [...content.matchAll(/```json\n([\s\S]*?)```/g)];
26305
26328
  const last = matches.at(-1);
26306
26329
  if (!last?.[1]) {
@@ -26501,7 +26524,7 @@ async function validateStructure(cwd, pages, issues) {
26501
26524
  for (const page of pages) {
26502
26525
  let content;
26503
26526
  try {
26504
- content = await readFile50(page.absolutePath, "utf8");
26527
+ content = await readFile51(page.absolutePath, "utf8");
26505
26528
  } catch {
26506
26529
  continue;
26507
26530
  }
@@ -26561,7 +26584,7 @@ async function validateStructure(cwd, pages, issues) {
26561
26584
  }
26562
26585
  async function validatePageInvariants(cwd, pages, issues) {
26563
26586
  for (const page of pages) {
26564
- const content = await readFile50(page.absolutePath, "utf8");
26587
+ const content = await readFile51(page.absolutePath, "utf8");
26565
26588
  const version = pageVersion(content);
26566
26589
  const newest = newestChangelogVersion(parseChangelog(content));
26567
26590
  if (version !== null && newest !== null && compareVersions(version, newest) < 0) {
@@ -27022,7 +27045,7 @@ var init_repomap = __esm(() => {
27022
27045
  });
27023
27046
 
27024
27047
  // src/gdskills/contracts.ts
27025
- import { readFile as readFile62 } from "fs/promises";
27048
+ import { readFile as readFile63 } from "fs/promises";
27026
27049
  import { existsSync as existsSync20 } from "fs";
27027
27050
  import path130 from "path";
27028
27051
  import { fileURLToPath as fileURLToPath2 } from "url";
@@ -27031,7 +27054,7 @@ async function loadSchema(name) {
27031
27054
  if (!contract) {
27032
27055
  throw new Error(`Unknown contract schema: ${name}`);
27033
27056
  }
27034
- const raw = await readFile62(contractPath(contract), "utf8");
27057
+ const raw = await readFile63(contractPath(contract), "utf8");
27035
27058
  return JSON.parse(raw);
27036
27059
  }
27037
27060
  function contractPath(contract) {
@@ -27355,7 +27378,7 @@ var init_preservation = __esm(() => {
27355
27378
  });
27356
27379
 
27357
27380
  // src/session/slate.ts
27358
- import { mkdir as mkdir32, readFile as readFile66, readdir as readdir23, stat as stat18 } from "fs/promises";
27381
+ import { mkdir as mkdir32, readFile as readFile67, readdir as readdir23, stat as stat18 } from "fs/promises";
27359
27382
  import path139 from "path";
27360
27383
  function isSlateSeedKind(value) {
27361
27384
  return typeof value === "string" && SLATE_SEED_KINDS.includes(value);
@@ -27368,7 +27391,7 @@ function slateLockPath(dir) {
27368
27391
  }
27369
27392
  async function readSlate(dir) {
27370
27393
  try {
27371
- const raw = await readFile66(slatePath(dir), "utf8");
27394
+ const raw = await readFile67(slatePath(dir), "utf8");
27372
27395
  return JSON.parse(raw);
27373
27396
  } catch (error) {
27374
27397
  if (isNotFound(error))
@@ -27890,7 +27913,7 @@ function completionExceptionQuestion(id, selected, context) {
27890
27913
  // src/flow/service.ts
27891
27914
  init_fs();
27892
27915
  init_validator();
27893
- import { mkdir as mkdir13, readFile as readFile40 } from "fs/promises";
27916
+ import { mkdir as mkdir13, readFile as readFile41 } from "fs/promises";
27894
27917
  import path82 from "path";
27895
27918
 
27896
27919
  // src/flow/machine.ts
@@ -29072,7 +29095,7 @@ var encoder = new TextEncoder;
29072
29095
 
29073
29096
  // src/review/coverage.ts
29074
29097
  import { existsSync as existsSync8 } from "fs";
29075
- import { readFile as readFile24, realpath as realpath13 } from "fs/promises";
29098
+ import { readFile as readFile25, realpath as realpath13 } from "fs/promises";
29076
29099
  import path55 from "path";
29077
29100
 
29078
29101
  // src/review/git-base.ts
@@ -29331,7 +29354,7 @@ function scopeReviewerByStack(reviewer, requires, detected) {
29331
29354
 
29332
29355
  // src/review/reviewers.ts
29333
29356
  init_catalog();
29334
- import { readFile as readFile21, readdir as readdir8 } from "fs/promises";
29357
+ import { readFile as readFile22, readdir as readdir8 } from "fs/promises";
29335
29358
  import path49 from "path";
29336
29359
 
29337
29360
  // src/gdskills/project-skills.ts
@@ -29341,7 +29364,7 @@ init_json();
29341
29364
  init_guard();
29342
29365
  import { createHash as createHash7 } from "crypto";
29343
29366
  import { homedir } from "os";
29344
- import { readFile as readFile19, stat as stat9 } from "fs/promises";
29367
+ import { readFile as readFile20, stat as stat9 } from "fs/promises";
29345
29368
  import path46 from "path";
29346
29369
  var VERSION = "0.1.0";
29347
29370
  var PROJECT_SKILLS_DIR = ".metaproject/project-skills";
@@ -29445,7 +29468,7 @@ async function readSkillOrigin(projectRoot, ref, now = () => new Date) {
29445
29468
  const resolved = resolveOriginPath(ref, projectRoot);
29446
29469
  let content;
29447
29470
  try {
29448
- content = await readFile19(resolved, "utf8");
29471
+ content = await readFile20(resolved, "utf8");
29449
29472
  } catch (cause) {
29450
29473
  throw new Error(`Cannot read the origin file ${ref} (resolved to ${resolved}): ${cause instanceof Error ? cause.message : String(cause)}`);
29451
29474
  }
@@ -29818,7 +29841,7 @@ async function updateSkillsCatalog(projectRoot) {
29818
29841
  |---|---|---|---|
29819
29842
  ${rows}
29820
29843
  ${PROJECT_SKILLS_CATALOG_END}`;
29821
- const current = await pathExists(catalogPath) ? await readFile19(catalogPath, "utf8") : `# Metaproject Skills Catalog
29844
+ const current = await pathExists(catalogPath) ? await readFile20(catalogPath, "utf8") : `# Metaproject Skills Catalog
29822
29845
  `;
29823
29846
  const start = PROJECT_SKILLS_CATALOG_START;
29824
29847
  const end = PROJECT_SKILLS_CATALOG_END;
@@ -29863,7 +29886,7 @@ function today() {
29863
29886
  }
29864
29887
 
29865
29888
  // src/gdskills/project-reviewers.ts
29866
- import { readdir as readdir7, readFile as readFile20 } from "fs/promises";
29889
+ import { readdir as readdir7, readFile as readFile21 } from "fs/promises";
29867
29890
  import path47 from "path";
29868
29891
 
29869
29892
  // src/gdskills/reviewer-triggers.ts
@@ -29969,7 +29992,7 @@ async function skillPackageNames(root) {
29969
29992
  if (!entry.isDirectory())
29970
29993
  continue;
29971
29994
  try {
29972
- await readFile20(path47.join(root, entry.name, "SKILL.md"), "utf8");
29995
+ await readFile21(path47.join(root, entry.name, "SKILL.md"), "utf8");
29973
29996
  names.push(entry.name);
29974
29997
  } catch {}
29975
29998
  }
@@ -30310,7 +30333,7 @@ async function driftFor(projectRoot, origin, recordedHash) {
30310
30333
  return "clean";
30311
30334
  }
30312
30335
  try {
30313
- const content = await readFile21(resolveOriginPath(origin, projectRoot), "utf8");
30336
+ const content = await readFile22(resolveOriginPath(origin, projectRoot), "utf8");
30314
30337
  return hashOriginContent(content) === recordedHash ? "clean" : "changed";
30315
30338
  } catch {
30316
30339
  return "missing";
@@ -30325,7 +30348,7 @@ async function directoryExists(dir) {
30325
30348
  }
30326
30349
  }
30327
30350
  async function bundledReviewerFromFile(name, skillMdPath, projectRelativePath) {
30328
- const content = await readFile21(skillMdPath, "utf8").catch(() => {
30351
+ const content = await readFile22(skillMdPath, "utf8").catch(() => {
30329
30352
  return;
30330
30353
  });
30331
30354
  const engine = content !== undefined ? metadataList(content, "engine")[0] : undefined;
@@ -30369,7 +30392,7 @@ async function collectReviewers(projectRoot, deps = {}) {
30369
30392
  const project = [];
30370
30393
  for (const name of await skillPackageNames(projectRoot_)) {
30371
30394
  const relative = path49.posix.join(PROJECT_SKILLS_DIR, PROJECT_REVIEWER_MODULE, name);
30372
- const content = await readFile21(path49.join(projectRoot_, name, "SKILL.md"), "utf8");
30395
+ const content = await readFile22(path49.join(projectRoot_, name, "SKILL.md"), "utf8");
30373
30396
  const origin = metadataLine(content, "Origin");
30374
30397
  const originHash = metadataLine(content, "Origin Hash");
30375
30398
  const importedAt = metadataLine(content, "Imported At");
@@ -30432,7 +30455,7 @@ var identityCache = new Map;
30432
30455
  // src/flow/store.ts
30433
30456
  init_fs();
30434
30457
  import { createHash as createHash8 } from "crypto";
30435
- import { appendFile as appendFile2, mkdir as mkdir8, readFile as readFile22, readdir as readdir9 } from "fs/promises";
30458
+ import { appendFile as appendFile2, mkdir as mkdir8, readFile as readFile23, readdir as readdir9 } from "fs/promises";
30436
30459
  import path50 from "path";
30437
30460
  function flowsRoot(cwd) {
30438
30461
  return path50.join(cwd, ".metaproject", "flows");
@@ -30516,7 +30539,7 @@ async function readFlow(cwd, dir) {
30516
30539
  if (!await pathExists(file)) {
30517
30540
  throw new Error(`flow.json missing in ${dir}`);
30518
30541
  }
30519
- const parsed = JSON.parse(await readFile22(file, "utf8"));
30542
+ const parsed = JSON.parse(await readFile23(file, "utf8"));
30520
30543
  return migrateFlow(parsed);
30521
30544
  }
30522
30545
  function migrateFlow(flow) {
@@ -30589,7 +30612,7 @@ async function readAcCriteria(cwd, dir) {
30589
30612
  if (!await pathExists(file)) {
30590
30613
  return [];
30591
30614
  }
30592
- const content = await readFile22(file, "utf8");
30615
+ const content = await readFile23(file, "utf8");
30593
30616
  const ids = [];
30594
30617
  for (const line of content.split(`
30595
30618
  `)) {
@@ -30653,7 +30676,7 @@ function acBlockEnd(lines, start) {
30653
30676
  }
30654
30677
  async function writeAcCriterion(cwd, dir, criterion, text) {
30655
30678
  const file = acPath(cwd, dir);
30656
- const content = await pathExists(file) ? await readFile22(file, "utf8") : "";
30679
+ const content = await pathExists(file) ? await readFile23(file, "utf8") : "";
30657
30680
  const lines = splitAcLines(content);
30658
30681
  const rendered = `- ${criterion}: ${text}`;
30659
30682
  let previousText;
@@ -30698,7 +30721,7 @@ async function writeAcCriterion(cwd, dir, criterion, text) {
30698
30721
  return { previousText };
30699
30722
  }
30700
30723
  async function acChecksum(cwd, dir) {
30701
- const content = await readFile22(acPath(cwd, dir), "utf8");
30724
+ const content = await readFile23(acPath(cwd, dir), "utf8");
30702
30725
  const normalized = content.replace(/\r\n/g, `
30703
30726
  `).split(`
30704
30727
  `).map((line) => line.trimEnd()).join(`
@@ -30961,7 +30984,7 @@ function decisionWriters(kind, packageArg = "<review-dir>") {
30961
30984
 
30962
30985
  // src/review/mutate.ts
30963
30986
  import { constants as constants2, existsSync as existsSync7, writeFileSync as writeFileSync2 } from "fs";
30964
- import { cp, lstat as lstat8, mkdir as mkdir9, mkdtemp, open as open2, readFile as readFile23, readdir as readdir11, realpath as realpath12, rm as rm3, stat as stat11, symlink, utimes as utimes2, writeFile as writeFile6 } from "fs/promises";
30987
+ import { cp, lstat as lstat9, mkdir as mkdir9, mkdtemp, open as open2, readFile as readFile24, readdir as readdir11, realpath as realpath12, rm as rm3, stat as stat11, symlink, utimes as utimes2, writeFile as writeFile6 } from "fs/promises";
30965
30988
  import path53 from "path";
30966
30989
 
30967
30990
  // src/lib/git-env.ts
@@ -31049,7 +31072,7 @@ async function doneMutantIds(packageDir) {
31049
31072
  const done = new Set;
31050
31073
  for (const name of await mutationRecordNames(packageDir)) {
31051
31074
  try {
31052
- const record = JSON.parse(await readFile23(path53.join(dir, name), "utf8"));
31075
+ const record = JSON.parse(await readFile24(path53.join(dir, name), "utf8"));
31053
31076
  for (const m of record.mutants)
31054
31077
  if (m.status !== "invalid")
31055
31078
  done.add(m.id);
@@ -31070,7 +31093,7 @@ async function pendingMutants(packageDir) {
31070
31093
  return [];
31071
31094
  let specs;
31072
31095
  try {
31073
- const raw = JSON.parse(await readFile23(specFile, "utf8"));
31096
+ const raw = JSON.parse(await readFile24(specFile, "utf8"));
31074
31097
  if (raw?.runnable === false)
31075
31098
  return [];
31076
31099
  specs = parseMutantSpec(raw);
@@ -31237,7 +31260,7 @@ async function autoDepth(root, input) {
31237
31260
  }
31238
31261
  var ROUND_DEPTH_FILE = "round-depth.json";
31239
31262
  async function packageDepthBasis(packageDir) {
31240
- const manifest = await readFile24(path55.join(packageDir, "manifest.json"), "utf8").then((t) => JSON.parse(t)).catch(() => {
31263
+ const manifest = await readFile25(path55.join(packageDir, "manifest.json"), "utf8").then((t) => JSON.parse(t)).catch(() => {
31241
31264
  return;
31242
31265
  });
31243
31266
  const head = manifest?.target?.head;
@@ -31246,7 +31269,7 @@ async function packageDepthBasis(packageDir) {
31246
31269
  }
31247
31270
  async function packageChangedLines(packageDir) {
31248
31271
  try {
31249
- const parsed = JSON.parse(await readFile24(path55.join(packageDir, "scope-files.json"), "utf8"));
31272
+ const parsed = JSON.parse(await readFile25(path55.join(packageDir, "scope-files.json"), "utf8"));
31250
31273
  return typeof parsed?.changedLines === "number" && Number.isFinite(parsed.changedLines) && parsed.changedLines >= 0 ? parsed.changedLines : undefined;
31251
31274
  } catch {
31252
31275
  return;
@@ -31255,7 +31278,7 @@ async function packageChangedLines(packageDir) {
31255
31278
  async function packageRoundDepth(packageDir) {
31256
31279
  let parsed;
31257
31280
  try {
31258
- parsed = JSON.parse(await readFile24(path55.join(packageDir, ROUND_DEPTH_FILE), "utf8"));
31281
+ parsed = JSON.parse(await readFile25(path55.join(packageDir, ROUND_DEPTH_FILE), "utf8"));
31259
31282
  } catch {
31260
31283
  return;
31261
31284
  }
@@ -31309,7 +31332,7 @@ function derivedFromFiles(files) {
31309
31332
  }
31310
31333
  async function readSkill(root, relativePath) {
31311
31334
  const file = path55.join(root, relativePath, "SKILL.md");
31312
- return existsSync8(file) ? readFile24(file, "utf8").catch(() => {
31335
+ return existsSync8(file) ? readFile25(file, "utf8").catch(() => {
31313
31336
  return;
31314
31337
  }) : undefined;
31315
31338
  }
@@ -31558,7 +31581,7 @@ async function packageDiffStats(options) {
31558
31581
  return packageDiffStatsCached({ packageDir: options.packageDir, root: options.root, target: { ...target, head: target.head } });
31559
31582
  }
31560
31583
  async function readPackageTarget(packageDir) {
31561
- const manifest = await readFile24(path55.join(packageDir, "manifest.json"), "utf8").then((t) => JSON.parse(t)).catch(() => {
31584
+ const manifest = await readFile25(path55.join(packageDir, "manifest.json"), "utf8").then((t) => JSON.parse(t)).catch(() => {
31562
31585
  return;
31563
31586
  });
31564
31587
  const target = asRecord(asRecord(manifest)?.target) ?? {};
@@ -31630,7 +31653,7 @@ async function effectiveDepth(record, options) {
31630
31653
  }
31631
31654
  async function packageHead(packageDir) {
31632
31655
  try {
31633
- const manifest = JSON.parse(await readFile24(path55.join(packageDir, "manifest.json"), "utf8"));
31656
+ const manifest = JSON.parse(await readFile25(path55.join(packageDir, "manifest.json"), "utf8"));
31634
31657
  return typeof manifest.target?.head === "string" && manifest.target.head.trim() !== "" ? manifest.target.head.trim() : undefined;
31635
31658
  } catch {
31636
31659
  return;
@@ -31687,7 +31710,7 @@ async function mutationErrors(record, options, depth) {
31687
31710
  }
31688
31711
  async function packageHasBlastRadius(packageDir, name = "blast-radius.json") {
31689
31712
  try {
31690
- const parsed = JSON.parse(await readFile24(path55.join(packageDir, name), "utf8"));
31713
+ const parsed = JSON.parse(await readFile25(path55.join(packageDir, name), "utf8"));
31691
31714
  return Array.isArray(parsed?.files) && Array.isArray(parsed?.changedFiles);
31692
31715
  } catch {
31693
31716
  return false;
@@ -31787,7 +31810,7 @@ function dispatchSkips(dispatch) {
31787
31810
  }
31788
31811
  async function packageScopeFiles(packageDir) {
31789
31812
  try {
31790
- const parsed = JSON.parse(await readFile24(path55.join(packageDir, "scope-files.json"), "utf8"));
31813
+ const parsed = JSON.parse(await readFile25(path55.join(packageDir, "scope-files.json"), "utf8"));
31791
31814
  if (!Array.isArray(parsed?.files) || !parsed.files.every((file) => typeof file === "string"))
31792
31815
  return;
31793
31816
  const manifest = await readJsonFileOr(path55.join(packageDir, "slices", "manifest.json"), undefined);
@@ -32290,7 +32313,7 @@ function dispatchErrors(value) {
32290
32313
  }
32291
32314
 
32292
32315
  // src/review/research.ts
32293
- import { readFile as readFile25 } from "fs/promises";
32316
+ import { readFile as readFile26 } from "fs/promises";
32294
32317
  import path58 from "path";
32295
32318
  function researchErrors(value, findings) {
32296
32319
  const ledger = asRecord(value);
@@ -32355,7 +32378,7 @@ async function packageResearchErrors(packageDir, artifacts, findings, options =
32355
32378
  if (a.research !== "research.json")
32356
32379
  return ["invalid research artifact locator"];
32357
32380
  try {
32358
- const ledger = JSON.parse(await readFile25(path58.join(packageDir, "research.json"), "utf8"));
32381
+ const ledger = JSON.parse(await readFile26(path58.join(packageDir, "research.json"), "utf8"));
32359
32382
  const recorded = ledger?.dispatch !== undefined;
32360
32383
  const checked = a.reviewerDispatch !== undefined || recorded;
32361
32384
  const mismatch = recorded && a.reviewerDispatch === undefined ? ['research.json records a reviewer dispatch but manifest.json does not declare it: restore artifacts.reviewerDispatch "research.json"'] : [];
@@ -32417,11 +32440,11 @@ var CARRIED_PREMISE_CONTEXT = new Set(["judge", "model", "operator"]);
32417
32440
 
32418
32441
  // src/flow/review-gate.ts
32419
32442
  init_fs();
32420
- import { readFile as readFile28 } from "fs/promises";
32443
+ import { readFile as readFile29 } from "fs/promises";
32421
32444
  import path61 from "path";
32422
32445
 
32423
32446
  // src/review/package-location.ts
32424
- import { readdir as readdir12, readFile as readFile26 } from "fs/promises";
32447
+ import { readdir as readdir12, readFile as readFile27 } from "fs/promises";
32425
32448
  import path59 from "path";
32426
32449
 
32427
32450
  // src/lib/map-bounded.ts
@@ -32446,7 +32469,7 @@ function flowReviewsRoot(cwd, flowDir) {
32446
32469
  async function readManifestHead(packageDir) {
32447
32470
  let manifest;
32448
32471
  try {
32449
- manifest = JSON.parse(await readFile26(path59.join(packageDir, "manifest.json"), "utf8"));
32472
+ manifest = JSON.parse(await readFile27(path59.join(packageDir, "manifest.json"), "utf8"));
32450
32473
  } catch {
32451
32474
  return;
32452
32475
  }
@@ -32528,7 +32551,7 @@ function normalizeText(value) {
32528
32551
 
32529
32552
  // src/review/pr-comments.ts
32530
32553
  init_fs();
32531
- import { readFile as readFile27 } from "fs/promises";
32554
+ import { readFile as readFile28 } from "fs/promises";
32532
32555
  import path60 from "path";
32533
32556
  var SEVERITY_SET = new Set(["blocker", "major", "minor", "info"]);
32534
32557
  var KNOWN_REVIEW_STATES = new Set(["APPROVED", "CHANGES_REQUESTED", "COMMENTED", "DISMISSED", "PENDING"]);
@@ -32555,7 +32578,7 @@ function emptyPrCommentState(repo, number) {
32555
32578
  async function readPrCommentState(cwd, repo, number) {
32556
32579
  const file = prCommentsStatePath(cwd, repo, number);
32557
32580
  try {
32558
- const parsed = JSON.parse(await readFile27(file, "utf8"));
32581
+ const parsed = JSON.parse(await readFile28(file, "utf8"));
32559
32582
  return {
32560
32583
  ...emptyPrCommentState(repo, number),
32561
32584
  ...parsed,
@@ -32599,7 +32622,7 @@ async function readReviewGateConfig(cwd) {
32599
32622
  }
32600
32623
  let raw;
32601
32624
  try {
32602
- raw = await readFile28(file, "utf8");
32625
+ raw = await readFile29(file, "utf8");
32603
32626
  } catch (error) {
32604
32627
  const code = safeFsErrorCode(error);
32605
32628
  return {
@@ -32811,14 +32834,14 @@ async function readJson3(file) {
32811
32834
  return null;
32812
32835
  }
32813
32836
  try {
32814
- return JSON.parse(await readFile28(file, "utf8"));
32837
+ return JSON.parse(await readFile29(file, "utf8"));
32815
32838
  } catch {
32816
32839
  return null;
32817
32840
  }
32818
32841
  }
32819
32842
  async function readScopeMarkdown(file) {
32820
32843
  try {
32821
- return await readFile28(file, "utf8");
32844
+ return await readFile29(file, "utf8");
32822
32845
  } catch {
32823
32846
  return null;
32824
32847
  }
@@ -33651,7 +33674,7 @@ function describeIdentity(identity) {
33651
33674
 
33652
33675
  // src/review/flow-move.ts
33653
33676
  init_fs();
33654
- import { readdir as readdir14, readFile as readFile30, rename as rename3 } from "fs/promises";
33677
+ import { readdir as readdir14, readFile as readFile31, rename as rename3 } from "fs/promises";
33655
33678
  import path65 from "path";
33656
33679
 
33657
33680
  // src/review/review-notes.ts
@@ -33736,7 +33759,7 @@ async function planJson(plan, file, finalOf, rewrite) {
33736
33759
  if (!await pathExists(file)) {
33737
33760
  return;
33738
33761
  }
33739
- const before = await readFile30(file, "utf8");
33762
+ const before = await readFile31(file, "utf8");
33740
33763
  let parsed;
33741
33764
  try {
33742
33765
  parsed = JSON.parse(before);
@@ -33755,7 +33778,7 @@ async function planText(plan, file, finalOf, rewrite) {
33755
33778
  if (!await pathExists(file)) {
33756
33779
  return;
33757
33780
  }
33758
- const before = await readFile30(file, "utf8");
33781
+ const before = await readFile31(file, "utf8");
33759
33782
  const after = rewrite(before);
33760
33783
  if (after !== before) {
33761
33784
  plan.rewrites.push({ current: file, final: finalOf(file), before, after });
@@ -34182,7 +34205,7 @@ function flowStateSchema() {
34182
34205
  // src/flow/context.ts
34183
34206
  init_fs();
34184
34207
  init_config2();
34185
- import { readFile as readFile31 } from "fs/promises";
34208
+ import { readFile as readFile32 } from "fs/promises";
34186
34209
  import path69 from "path";
34187
34210
 
34188
34211
  // src/memory/inject.ts
@@ -34355,7 +34378,7 @@ Use \`keryx gdgraph affected <file>\` for blast radius.`);
34355
34378
  const healthLatest = path69.join(cwd, ".metaproject", "data", "health", "artifacts", "latest.json");
34356
34379
  if (await pathExists(healthLatest)) {
34357
34380
  try {
34358
- const report = JSON.parse(await readFile31(healthLatest, "utf8"));
34381
+ const report = JSON.parse(await readFile32(healthLatest, "utf8"));
34359
34382
  sections.push(`## Code Health
34360
34383
 
34361
34384
  - gate: ${report.gate?.status ?? "unknown"} (as of ${report.generatedAt ?? "?"})
@@ -34365,7 +34388,7 @@ Use \`keryx gdgraph affected <file>\` for blast radius.`);
34365
34388
  const manifestPath = path69.join(cwd, ".metaproject", "metaproject.json");
34366
34389
  if (await pathExists(manifestPath)) {
34367
34390
  try {
34368
- const manifest = JSON.parse(await readFile31(manifestPath, "utf8"));
34391
+ const manifest = JSON.parse(await readFile32(manifestPath, "utf8"));
34369
34392
  const enabled = Object.entries(manifest.modules ?? {}).filter(([, config]) => config?.enabled).map(([name]) => name);
34370
34393
  if (enabled.length > 0) {
34371
34394
  sections.push(`## Enabled Metaproject Modules
@@ -34437,7 +34460,7 @@ async function canonicalPath(target) {
34437
34460
  }
34438
34461
 
34439
34462
  // src/flow/allocation.ts
34440
- import { appendFile as appendFile3, mkdir as mkdir11, readFile as readFile32 } from "fs/promises";
34463
+ import { appendFile as appendFile3, mkdir as mkdir11, readFile as readFile33 } from "fs/promises";
34441
34464
  import path71 from "path";
34442
34465
  init_fs();
34443
34466
  function projectKey(toplevel, cwd) {
@@ -34468,7 +34491,7 @@ async function readAllocationLedger(scope) {
34468
34491
  if (!scope.ledgerPath || !await pathExists(scope.ledgerPath)) {
34469
34492
  return [];
34470
34493
  }
34471
- const content = await readFile32(scope.ledgerPath, "utf8");
34494
+ const content = await readFile33(scope.ledgerPath, "utf8");
34472
34495
  const records = [];
34473
34496
  for (const line of content.split(`
34474
34497
  `)) {
@@ -34563,7 +34586,7 @@ var DEFAULT_TASKS = [
34563
34586
  // src/flow/confirm-token.ts
34564
34587
  init_fs();
34565
34588
  import { createHash as createHash11, randomBytes as randomBytes4 } from "crypto";
34566
- import { readFile as readFile33 } from "fs/promises";
34589
+ import { readFile as readFile34 } from "fs/promises";
34567
34590
  import path73 from "path";
34568
34591
  var CONFIRMATION_TOKEN_TTL_MS = 10 * 60000;
34569
34592
  var CONFIRMATION_CAVEAT = "The token proves an interactive confirmation step ran outside the agent's tool roster, within its TTL, " + "for this criteria checksum \u2014 not that a human ran it, and not who.";
@@ -34622,7 +34645,7 @@ async function checkConfirmationToken(cwd, dir, binding, token, now) {
34622
34645
  }
34623
34646
  let raw;
34624
34647
  try {
34625
- raw = JSON.parse(await readFile33(confirmTokenPath(cwd, dir), "utf8"));
34648
+ raw = JSON.parse(await readFile34(confirmTokenPath(cwd, dir), "utf8"));
34626
34649
  } catch (error) {
34627
34650
  return { ok: false, reason: isNotFound(error) ? "token_not_minted" : "token_unreadable" };
34628
34651
  }
@@ -34685,7 +34708,7 @@ function describeConfirmationFailure(reason, flowId) {
34685
34708
  }
34686
34709
  async function readRequireConfirmationDefault(cwd) {
34687
34710
  try {
34688
- const parsed = JSON.parse(await readFile33(path73.join(cwd, REVIEW_GATE_CONFIG_PATH), "utf8"));
34711
+ const parsed = JSON.parse(await readFile34(path73.join(cwd, REVIEW_GATE_CONFIG_PATH), "utf8"));
34689
34712
  if (typeof parsed !== "object" || parsed === null)
34690
34713
  return false;
34691
34714
  const completion = parsed["completion"];
@@ -35091,7 +35114,7 @@ function readAcKindRecords(value) {
35091
35114
  return out;
35092
35115
  }
35093
35116
  // src/flow/description-intent.ts
35094
- import { readFile as readFile34 } from "fs/promises";
35117
+ import { readFile as readFile35 } from "fs/promises";
35095
35118
  import path75 from "path";
35096
35119
  var OUTCOME_HINT = 'State an outcome criterion: what you would look at afterwards to see this helped, as a bullet. Or write "- not measured \u2014 <reason>".';
35097
35120
  var PLACEHOLDERS = ["Describe the problem precisely", "What must be true when this flow is done"];
@@ -35205,7 +35228,7 @@ function initIntentNote(description) {
35205
35228
  }
35206
35229
  async function intentNoteForNewFlow(cwd, dir) {
35207
35230
  try {
35208
- return initIntentNote(await readFile34(path75.join(cwd, dir, "description.md"), "utf8"));
35231
+ return initIntentNote(await readFile35(path75.join(cwd, dir, "description.md"), "utf8"));
35209
35232
  } catch {
35210
35233
  return null;
35211
35234
  }
@@ -35214,7 +35237,7 @@ async function intentNoteForNewFlow(cwd, dir) {
35214
35237
  init_service3();
35215
35238
  init_fs();
35216
35239
  import { createHash as createHash12 } from "crypto";
35217
- import { chmod as chmod4, mkdir as mkdir12, readFile as readFile35 } from "fs/promises";
35240
+ import { chmod as chmod4, mkdir as mkdir12, readFile as readFile36 } from "fs/promises";
35218
35241
  import path76 from "path";
35219
35242
  var AC_LINE2 = /^\s*[-*]\s*(AC\d+)\s*:\s?(.*)$/i;
35220
35243
  function parseAcceptanceCriteria(content) {
@@ -35394,7 +35417,7 @@ function factsOnlyVerdict(item) {
35394
35417
  }
35395
35418
  async function readAcCheckEnabled(cwd) {
35396
35419
  try {
35397
- const parsed = JSON.parse(await readFile35(path76.join(cwd, REVIEW_GATE_CONFIG_PATH), "utf8"));
35420
+ const parsed = JSON.parse(await readFile36(path76.join(cwd, REVIEW_GATE_CONFIG_PATH), "utf8"));
35398
35421
  if (typeof parsed !== "object" || parsed === null)
35399
35422
  return false;
35400
35423
  const review = parsed["review"];
@@ -35421,7 +35444,7 @@ async function readAcCheckCache(cachePath) {
35421
35444
  if (!await pathExists(cachePath))
35422
35445
  return;
35423
35446
  try {
35424
- return JSON.parse(await readFile35(cachePath, "utf8"));
35447
+ return JSON.parse(await readFile36(cachePath, "utf8"));
35425
35448
  } catch {
35426
35449
  return;
35427
35450
  }
@@ -35744,12 +35767,12 @@ function renderJournal(createdAt) {
35744
35767
  }
35745
35768
 
35746
35769
  // src/flow/task-project-context.ts
35747
- import { readFile as readFile39 } from "fs/promises";
35770
+ import { readFile as readFile40 } from "fs/promises";
35748
35771
  import path81 from "path";
35749
35772
 
35750
35773
  // src/gdskills/project-context-config.ts
35751
35774
  init_fs();
35752
- import { readFile as readFile36 } from "fs/promises";
35775
+ import { readFile as readFile37 } from "fs/promises";
35753
35776
  import path78 from "path";
35754
35777
  var PROJECT_CONTEXT_CONFIG_PATH = ".metaproject/tasks.config.json";
35755
35778
  var DEFAULT_MAX_BYTES = 131072;
@@ -35760,7 +35783,7 @@ function isValidMaxBytes(value) {
35760
35783
  }
35761
35784
  async function readRoot(projectRoot) {
35762
35785
  try {
35763
- const parsed = JSON.parse(await readFile36(path78.join(projectRoot, PROJECT_CONTEXT_CONFIG_PATH), "utf8"));
35786
+ const parsed = JSON.parse(await readFile37(path78.join(projectRoot, PROJECT_CONTEXT_CONFIG_PATH), "utf8"));
35764
35787
  return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : undefined;
35765
35788
  } catch {
35766
35789
  return;
@@ -35803,7 +35826,7 @@ async function readProjectContextConfig(projectRoot) {
35803
35826
  }
35804
35827
 
35805
35828
  // src/gdskills/resolved-context-check.ts
35806
- import { readFile as readFile38 } from "fs/promises";
35829
+ import { readFile as readFile39 } from "fs/promises";
35807
35830
  import path80 from "path";
35808
35831
 
35809
35832
  // src/gdskills/project-rules.ts
@@ -35816,7 +35839,7 @@ function sha256Hex(content) {
35816
35839
  }
35817
35840
 
35818
35841
  // src/gdskills/reference-proof.ts
35819
- import { readFile as readFile37 } from "fs/promises";
35842
+ import { readFile as readFile38 } from "fs/promises";
35820
35843
  import path79 from "path";
35821
35844
 
35822
35845
  // src/gdskills/references-section.ts
@@ -35926,7 +35949,7 @@ async function currentSection(projectRoot, entry) {
35926
35949
  const file = path79.isAbsolute(entry.path) ? entry.path : path79.join(projectRoot, entry.path);
35927
35950
  let text;
35928
35951
  try {
35929
- text = await readFile37(file, "utf8");
35952
+ text = await readFile38(file, "utf8");
35930
35953
  } catch (error) {
35931
35954
  return { ok: false, why: `${entry.path} cannot be read now (${error instanceof Error ? error.message : String(error)})` };
35932
35955
  }
@@ -35984,7 +36007,7 @@ async function proofFailures(input) {
35984
36007
  async function readResolvedFile(file) {
35985
36008
  let parsed;
35986
36009
  try {
35987
- parsed = JSON.parse(await readFile38(file, "utf8"));
36010
+ parsed = JSON.parse(await readFile39(file, "utf8"));
35988
36011
  } catch (error) {
35989
36012
  throw new Error(`--resolved ${file}: cannot read it as JSON (${error instanceof Error ? error.message : String(error)}).`, { cause: error });
35990
36013
  }
@@ -36015,7 +36038,7 @@ function appliedOf(result) {
36015
36038
  }
36016
36039
  async function currentSha(projectRoot, entryPath) {
36017
36040
  try {
36018
- return sha256Hex(await readFile38(path80.isAbsolute(entryPath) ? entryPath : path80.join(projectRoot, entryPath), "utf8"));
36041
+ return sha256Hex(await readFile39(path80.isAbsolute(entryPath) ? entryPath : path80.join(projectRoot, entryPath), "utf8"));
36019
36042
  } catch {
36020
36043
  return;
36021
36044
  }
@@ -36108,7 +36131,7 @@ async function checkTaskProjectContext(input) {
36108
36131
  }
36109
36132
  async function readResultFile(file) {
36110
36133
  try {
36111
- return JSON.parse(await readFile39(file, "utf8"));
36134
+ return JSON.parse(await readFile40(file, "utf8"));
36112
36135
  } catch (error) {
36113
36136
  throw new Error(`--result ${file}: cannot read it as JSON (${error instanceof Error ? error.message : String(error)}).`, { cause: error });
36114
36137
  }
@@ -36116,7 +36139,7 @@ async function readResultFile(file) {
36116
36139
 
36117
36140
  // src/flow/service.ts
36118
36141
  async function deriveAcKinds(cwd, dir, flowId) {
36119
- const { report } = buildAcKindReport(flowId, await readFile40(acPath(cwd, dir), "utf8"));
36142
+ const { report } = buildAcKindReport(flowId, await readFile41(acPath(cwd, dir), "utf8"));
36120
36143
  return { ...report.criteria };
36121
36144
  }
36122
36145
  function prMergeState(pr, gates) {
@@ -36763,7 +36786,7 @@ function createFlowService(deps) {
36763
36786
  },
36764
36787
  async acKinds({ cwd, id }) {
36765
36788
  const { dir, flow } = await load(cwd, id);
36766
- return buildAcKindReport(flow.id, await readFile40(acPath(cwd, dir), "utf8"));
36789
+ return buildAcKindReport(flow.id, await readFile41(acPath(cwd, dir), "utf8"));
36767
36790
  },
36768
36791
  async acReseal({ cwd, id, reason }) {
36769
36792
  if (!reason?.trim()) {
@@ -37251,7 +37274,7 @@ async function appendIdMap(cwd, entry) {
37251
37274
  const file = path82.join(flowsRoot(cwd), "id-map.json");
37252
37275
  let entries = [];
37253
37276
  if (await pathExists(file)) {
37254
- const raw = await readFile40(file, "utf8");
37277
+ const raw = await readFile41(file, "utf8");
37255
37278
  try {
37256
37279
  const parsed = JSON.parse(raw);
37257
37280
  if (!Array.isArray(parsed)) {
@@ -37546,8 +37569,8 @@ async function acCriterionKnown(input) {
37546
37569
  }
37547
37570
  // src/gdgraph/build.ts
37548
37571
  init_data_dir();
37549
- import { mkdir as mkdir22, readdir as readdir18, readFile as readFile51, writeFile as writeFile16 } from "fs/promises";
37550
- import { existsSync as existsSync11 } from "fs";
37572
+ import { mkdir as mkdir22, readdir as readdir18, readFile as readFile52, writeFile as writeFile16 } from "fs/promises";
37573
+ import { existsSync as existsSync11, lstatSync as lstatSync3 } from "fs";
37551
37574
  import path104 from "path";
37552
37575
 
37553
37576
  // src/gdgraph/types.ts
@@ -37616,7 +37639,7 @@ async function buildGraph(projectRoot, options = {}) {
37616
37639
  const fileRecords = [];
37617
37640
  for (const file of files) {
37618
37641
  const absolutePath = path104.join(projectRoot, file);
37619
- const content = await readFile51(absolutePath, "utf8");
37642
+ const content = await readFile52(absolutePath, "utf8");
37620
37643
  fileRecords.push({ path: file, content });
37621
37644
  const language = getLanguage(file);
37622
37645
  const resolver = pickResolver(resolvers, language);
@@ -37624,7 +37647,7 @@ async function buildGraph(projectRoot, options = {}) {
37624
37647
  const records = extractImportRecords(content, language, file);
37625
37648
  for (const { specifier, kind: importKind } of records) {
37626
37649
  const resolved = resolveImport(projectRoot, file, specifier, fileSet, resolver);
37627
- const asset = resolved ? null : resolveAssetImport(projectRoot, file, specifier, resolver);
37650
+ const asset = resolved ? null : resolveAssetImport(projectRoot, file, specifier, resolver, collection.checkoutBoundaries);
37628
37651
  const shouldTrackUnresolved = specifier.startsWith(".") || resolver.matchesAlias(specifier) || isLanguageAware;
37629
37652
  if (!resolved && !asset && !shouldTrackUnresolved) {
37630
37653
  continue;
@@ -37667,9 +37690,16 @@ async function buildGraph(projectRoot, options = {}) {
37667
37690
  async function collectSourceFiles(projectRoot) {
37668
37691
  const result = [];
37669
37692
  const skippedDirectories = [];
37693
+ const checkoutBoundaries = new Map;
37670
37694
  async function walk(relativeDir) {
37671
37695
  const absoluteDir = path104.join(projectRoot, relativeDir);
37672
37696
  const entries = await readdir18(absoluteDir, { withFileTypes: true });
37697
+ const nestedCheckout = relativeDir !== "." && entries.some((entry) => entry.name === ".git" && (entry.isFile() || entry.isDirectory()));
37698
+ checkoutBoundaries.set(relativeDir, nestedCheckout);
37699
+ if (nestedCheckout) {
37700
+ skippedDirectories.push(relativeDir);
37701
+ return;
37702
+ }
37673
37703
  for (const entry of entries) {
37674
37704
  if (entry.isDirectory()) {
37675
37705
  if (IGNORE_DIRS.has(entry.name)) {
@@ -37689,7 +37719,7 @@ async function collectSourceFiles(projectRoot) {
37689
37719
  }
37690
37720
  }
37691
37721
  await walk(".");
37692
- return { files: result.sort(), skippedDirectories: skippedDirectories.sort() };
37722
+ return { files: result.sort(), skippedDirectories: skippedDirectories.sort(), checkoutBoundaries };
37693
37723
  }
37694
37724
  function extractImportRecords(content, language, filePath) {
37695
37725
  if (language === "java" || language === "python") {
@@ -37765,15 +37795,34 @@ function resolveImport(projectRoot, fromFile, specifier, fileSet, resolver) {
37765
37795
  }
37766
37796
  return null;
37767
37797
  }
37768
- function resolveAssetImport(projectRoot, fromFile, specifier, resolver) {
37798
+ function resolveAssetImport(projectRoot, fromFile, specifier, resolver, checkoutBoundaries) {
37769
37799
  for (const candidate of importCandidateBases(projectRoot, fromFile, specifier, resolver)) {
37770
37800
  const extension = path104.posix.extname(candidate);
37771
- if (ASSET_EXTENSIONS.includes(extension) && existsSync11(path104.join(projectRoot, candidate))) {
37801
+ if (ASSET_EXTENSIONS.includes(extension) && existsSync11(path104.join(projectRoot, candidate)) && !inNestedCheckout(projectRoot, candidate, checkoutBoundaries)) {
37772
37802
  return candidate;
37773
37803
  }
37774
37804
  }
37775
37805
  return null;
37776
37806
  }
37807
+ function inNestedCheckout(projectRoot, candidate, boundaries) {
37808
+ let parent = path104.posix.dirname(candidate);
37809
+ while (parent !== "." && parent !== ".." && !parent.startsWith("../") && parent !== "/") {
37810
+ let isCheckout = boundaries.get(parent);
37811
+ if (isCheckout === undefined) {
37812
+ try {
37813
+ const marker = lstatSync3(path104.join(projectRoot, parent, ".git"), { throwIfNoEntry: false });
37814
+ isCheckout = marker?.isFile() === true || marker?.isDirectory() === true;
37815
+ boundaries.set(parent, isCheckout);
37816
+ } catch {
37817
+ return true;
37818
+ }
37819
+ }
37820
+ if (isCheckout)
37821
+ return true;
37822
+ parent = path104.posix.dirname(parent);
37823
+ }
37824
+ return false;
37825
+ }
37777
37826
  function importCandidateBases(projectRoot, fromFile, specifier, resolver) {
37778
37827
  const normalizedSpecifier = stripImportSuffix(specifier);
37779
37828
  if (normalizedSpecifier.startsWith(".") && getLanguage(fromFile) !== "python") {
@@ -37820,7 +37869,7 @@ async function discoverJavaSourceRoots(projectRoot) {
37820
37869
  const pomPath = path104.join(projectRoot, "pom.xml");
37821
37870
  if (existsSync11(pomPath)) {
37822
37871
  try {
37823
- const roots = parseMavenSourceRoots(await readFile51(pomPath, "utf8"));
37872
+ const roots = parseMavenSourceRoots(await readFile52(pomPath, "utf8"));
37824
37873
  if (roots.length > 0) {
37825
37874
  return roots;
37826
37875
  }
@@ -37830,7 +37879,7 @@ async function discoverJavaSourceRoots(projectRoot) {
37830
37879
  const gradlePath = path104.join(projectRoot, gradleName);
37831
37880
  if (existsSync11(gradlePath)) {
37832
37881
  try {
37833
- const roots = parseGradleSourceRoots(await readFile51(gradlePath, "utf8"));
37882
+ const roots = parseGradleSourceRoots(await readFile52(gradlePath, "utf8"));
37834
37883
  if (roots.length > 0) {
37835
37884
  return roots;
37836
37885
  }
@@ -37937,7 +37986,7 @@ function toProjectRelativeDir(projectRoot, absoluteDir) {
37937
37986
  }
37938
37987
  async function readTsconfigJson(configPath) {
37939
37988
  try {
37940
- const raw = await readFile51(configPath, "utf8");
37989
+ const raw = await readFile52(configPath, "utf8");
37941
37990
  return JSON.parse(stripJsonComments(raw));
37942
37991
  } catch {
37943
37992
  return null;
@@ -38200,7 +38249,7 @@ init_affected();
38200
38249
  init_config3();
38201
38250
 
38202
38251
  // src/gdgraph/query.ts
38203
- import { readFile as readFile52 } from "fs/promises";
38252
+ import { readFile as readFile53 } from "fs/promises";
38204
38253
  import path105 from "path";
38205
38254
  init_data_dir();
38206
38255
  init_target();
@@ -38271,7 +38320,7 @@ async function bunfigPreloadRoots(projectRoot) {
38271
38320
  const roots = new Set;
38272
38321
  let text;
38273
38322
  try {
38274
- text = await readFile52(path105.join(projectRoot, "bunfig.toml"), "utf8");
38323
+ text = await readFile53(path105.join(projectRoot, "bunfig.toml"), "utf8");
38275
38324
  } catch {
38276
38325
  return roots;
38277
38326
  }
@@ -38335,7 +38384,7 @@ function getCycles(graph) {
38335
38384
  async function readJsonl(filePath) {
38336
38385
  let content;
38337
38386
  try {
38338
- content = await readFile52(filePath, "utf8");
38387
+ content = await readFile53(filePath, "utf8");
38339
38388
  } catch {
38340
38389
  return [];
38341
38390
  }
@@ -38440,7 +38489,7 @@ init_section_tombstone();
38440
38489
 
38441
38490
  // src/forgetting/journal.ts
38442
38491
  init_fs();
38443
- import { appendFile as appendFile5, mkdir as mkdir24, readFile as readFile53, stat as stat16 } from "fs/promises";
38492
+ import { appendFile as appendFile5, mkdir as mkdir24, readFile as readFile54, stat as stat16 } from "fs/promises";
38444
38493
  import path107 from "path";
38445
38494
  function forgettingDataDir(cwd) {
38446
38495
  return path107.join(cwd, ".metaproject", "data", "forgetting");
@@ -38465,7 +38514,7 @@ async function readDeletionJournal(cwd) {
38465
38514
  }
38466
38515
  let content;
38467
38516
  try {
38468
- content = await readFile53(file, "utf8");
38517
+ content = await readFile54(file, "utf8");
38469
38518
  } catch (error) {
38470
38519
  const message = error instanceof Error ? error.message : String(error);
38471
38520
  return {
@@ -39091,7 +39140,7 @@ import path111 from "path";
39091
39140
 
39092
39141
  // src/health/util.ts
39093
39142
  init_fs();
39094
- import { mkdir as mkdir25, readFile as readFile54, readdir as readdir19, writeFile as writeFile18 } from "fs/promises";
39143
+ import { mkdir as mkdir25, readFile as readFile55, readdir as readdir19, writeFile as writeFile18 } from "fs/promises";
39095
39144
  import path109 from "path";
39096
39145
  var IGNORED_DIRS = new Set([
39097
39146
  "node_modules",
@@ -39294,7 +39343,7 @@ function rankHotspots(files, churn, sourceAnalysis) {
39294
39343
 
39295
39344
  // src/health/source-analysis.ts
39296
39345
  init_fs();
39297
- import { readFile as readFile55 } from "fs/promises";
39346
+ import { readFile as readFile56 } from "fs/promises";
39298
39347
  import path110 from "path";
39299
39348
 
39300
39349
  // src/health/metrics/complexity.ts
@@ -39533,7 +39582,7 @@ async function analyzeSourceFile(cwd, file) {
39533
39582
  if (!await pathExists(abs)) {
39534
39583
  return null;
39535
39584
  }
39536
- const content = await readFile55(abs, "utf8");
39585
+ const content = await readFile56(abs, "utf8");
39537
39586
  return [
39538
39587
  file,
39539
39588
  {
@@ -39657,7 +39706,7 @@ function tally2(values) {
39657
39706
 
39658
39707
  // src/health/baseline.ts
39659
39708
  init_fs();
39660
- import { mkdir as mkdir26, readFile as readFile56, writeFile as writeFile19 } from "fs/promises";
39709
+ import { mkdir as mkdir26, readFile as readFile57, writeFile as writeFile19 } from "fs/promises";
39661
39710
  import path112 from "path";
39662
39711
  var LEGACY_BASELINE_SOURCES = Object.freeze([
39663
39712
  "complexity",
@@ -39691,7 +39740,7 @@ async function readBaselineFile(cwd) {
39691
39740
  return null;
39692
39741
  }
39693
39742
  try {
39694
- return JSON.parse(await readFile56(file, "utf8"));
39743
+ return JSON.parse(await readFile57(file, "utf8"));
39695
39744
  } catch {
39696
39745
  return null;
39697
39746
  }
@@ -39785,7 +39834,7 @@ async function getChurn(cwd, windowDays) {
39785
39834
  }
39786
39835
 
39787
39836
  // src/health/metrics/wiki-freshness.ts
39788
- import { readFile as readFile57, stat as stat17 } from "fs/promises";
39837
+ import { readFile as readFile58, stat as stat17 } from "fs/promises";
39789
39838
  import path113 from "path";
39790
39839
  var DEFAULT_STALE_EVIDENCE_DAYS = 7;
39791
39840
  function freshnessReportPath(cwd) {
@@ -39797,7 +39846,7 @@ async function readWikiFreshnessMetric(cwd, options = {}) {
39797
39846
  const now = (options.now ?? (() => new Date))();
39798
39847
  let raw;
39799
39848
  try {
39800
- raw = await readFile57(file, "utf8");
39849
+ raw = await readFile58(file, "utf8");
39801
39850
  } catch {
39802
39851
  return {
39803
39852
  status: "no-report",
@@ -40119,7 +40168,7 @@ function renderWikiFreshness(metric) {
40119
40168
 
40120
40169
  // src/health/skills.ts
40121
40170
  init_fs();
40122
- import { readFile as readFile58 } from "fs/promises";
40171
+ import { readFile as readFile59 } from "fs/promises";
40123
40172
  import path116 from "path";
40124
40173
  var EMPTY = { skills: [], skillForFile: () => null };
40125
40174
  async function loadSkillOwnership(cwd) {
@@ -40129,7 +40178,7 @@ async function loadSkillOwnership(cwd) {
40129
40178
  }
40130
40179
  let registry;
40131
40180
  try {
40132
- const manifest = JSON.parse(await readFile58(manifestPath, "utf8"));
40181
+ const manifest = JSON.parse(await readFile59(manifestPath, "utf8"));
40133
40182
  registry = manifest.modules?.gdskills?.projectSkillRegistry ?? [];
40134
40183
  } catch {
40135
40184
  return EMPTY;
@@ -40418,12 +40467,12 @@ var typescriptAdapter = {
40418
40467
  init_fs();
40419
40468
  init_contained_write();
40420
40469
  import { existsSync as existsSync17 } from "fs";
40421
- import { readFile as readFile61, readdir as readdir20 } from "fs/promises";
40470
+ import { readFile as readFile62, readdir as readdir20 } from "fs/promises";
40422
40471
  import path123 from "path";
40423
40472
  // src/metrics/lifecycle.ts
40424
40473
  init_fs();
40425
40474
  init_guard();
40426
- import { readFile as readFile59 } from "fs/promises";
40475
+ import { readFile as readFile60 } from "fs/promises";
40427
40476
  import path120 from "path";
40428
40477
 
40429
40478
  // src/metrics/record.ts
@@ -40444,7 +40493,7 @@ async function readArtifactPointer(root, expected) {
40444
40493
  return { status: "missing", pointer: null };
40445
40494
  let pointer;
40446
40495
  try {
40447
- pointer = JSON.parse(await readFile59(pointerFile, "utf8"));
40496
+ pointer = JSON.parse(await readFile60(pointerFile, "utf8"));
40448
40497
  } catch {
40449
40498
  return { status: "stale", pointer: null, reason: "latest pointer is invalid JSON" };
40450
40499
  }
@@ -40491,7 +40540,7 @@ async function isTestingCapabilityEnabled(cwd, capability) {
40491
40540
  // src/testing/coverage-map.ts
40492
40541
  init_fs();
40493
40542
  init_guard();
40494
- import { readFile as readFile60, mkdir as mkdir27, writeFile as writeFile20 } from "fs/promises";
40543
+ import { readFile as readFile61, mkdir as mkdir27, writeFile as writeFile20 } from "fs/promises";
40495
40544
  import path122 from "path";
40496
40545
  var COVERAGE_MAP_SCHEMA_VERSION = 1;
40497
40546
  function coverageMapPath(cwd, cfg) {
@@ -40503,7 +40552,7 @@ async function loadCoverageMap(cwd, cfg) {
40503
40552
  return null;
40504
40553
  }
40505
40554
  try {
40506
- const parsed = JSON.parse(await readFile60(file, "utf8"));
40555
+ const parsed = JSON.parse(await readFile61(file, "utf8"));
40507
40556
  if (!parsed || typeof parsed !== "object" || typeof parsed.map !== "object") {
40508
40557
  return null;
40509
40558
  }
@@ -40810,7 +40859,7 @@ async function loadTestingContext(cwd) {
40810
40859
  return null;
40811
40860
  }
40812
40861
  try {
40813
- return JSON.parse(await readFile61(file, "utf8"));
40862
+ return JSON.parse(await readFile62(file, "utf8"));
40814
40863
  } catch {
40815
40864
  return null;
40816
40865
  }
@@ -40821,7 +40870,7 @@ async function loadTestingReport(cwd) {
40821
40870
  return null;
40822
40871
  }
40823
40872
  try {
40824
- const latest = JSON.parse(await readFile61(file, "utf8"));
40873
+ const latest = JSON.parse(await readFile62(file, "utf8"));
40825
40874
  if (typeof latest.record === "string") {
40826
40875
  const pointer = await readArtifactPointer(path123.join(testingDataRoot(cwd), "artifacts"), await collectGitProvenance(cwd));
40827
40876
  if (pointer.status !== "fresh")
@@ -40831,7 +40880,7 @@ async function loadTestingReport(cwd) {
40831
40880
  return null;
40832
40881
  if (!await pathExists(recordFile))
40833
40882
  return null;
40834
- return JSON.parse(await readFile61(recordFile, "utf8"));
40883
+ return JSON.parse(await readFile62(recordFile, "utf8"));
40835
40884
  }
40836
40885
  return latest;
40837
40886
  } catch {
@@ -40961,7 +41010,7 @@ async function readPackageJson(cwd) {
40961
41010
  return null;
40962
41011
  }
40963
41012
  try {
40964
- return JSON.parse(await readFile61(file, "utf8"));
41013
+ return JSON.parse(await readFile62(file, "utf8"));
40965
41014
  } catch {
40966
41015
  return null;
40967
41016
  }
@@ -40972,7 +41021,7 @@ async function loadTestingConfig(cwd) {
40972
41021
  return DEFAULT_TESTING_CONFIG;
40973
41022
  }
40974
41023
  try {
40975
- const parsed = JSON.parse(await readFile61(file, "utf8"));
41024
+ const parsed = JSON.parse(await readFile62(file, "utf8"));
40976
41025
  return {
40977
41026
  schemaVersion: parsed.schemaVersion ?? DEFAULT_TESTING_CONFIG.schemaVersion,
40978
41027
  enabled: parsed.enabled ?? DEFAULT_TESTING_CONFIG.enabled,
@@ -41036,7 +41085,7 @@ async function extractConventions(cwd, files) {
41036
41085
  if (!await pathExists(abs)) {
41037
41086
  continue;
41038
41087
  }
41039
- const text = await readFile61(abs, "utf8");
41088
+ const text = await readFile62(abs, "utf8");
41040
41089
  for (const line of text.split(`
41041
41090
  `)) {
41042
41091
  if (/test|testing|spec|coverage|playwright|vitest|jest|bun:test/i.test(line)) {
@@ -41166,7 +41215,7 @@ async function findTestsByImportedTargets(cwd, targets, testFiles) {
41166
41215
  if (!await pathExists(absoluteTest)) {
41167
41216
  continue;
41168
41217
  }
41169
- const content = await readFile61(absoluteTest, "utf8");
41218
+ const content = await readFile62(absoluteTest, "utf8");
41170
41219
  const imports = extractImportPaths(content);
41171
41220
  if (imports.length === 0) {
41172
41221
  continue;
@@ -43092,7 +43141,7 @@ function defaultPlan(intent) {
43092
43141
  init_validator();
43093
43142
  init_contracts();
43094
43143
  init_fs();
43095
- import { appendFile as appendFile6, mkdir as mkdir29, readFile as readFile63, readdir as readdir21 } from "fs/promises";
43144
+ import { appendFile as appendFile6, mkdir as mkdir29, readFile as readFile64, readdir as readdir21 } from "fs/promises";
43096
43145
  import path131 from "path";
43097
43146
  function jobsRoot(cwd) {
43098
43147
  return path131.join(cwd, ".metaproject", "jobs");
@@ -43127,7 +43176,7 @@ async function readJob(cwd, name) {
43127
43176
  const known = await listJobNames(cwd);
43128
43177
  throw new Error(`Job not found: ${name}.` + (known.length > 0 ? ` Known: ${known.join(", ")}` : " Run: keryx job list"));
43129
43178
  }
43130
- return JSON.parse(await readFile63(file, "utf8"));
43179
+ return JSON.parse(await readFile64(file, "utf8"));
43131
43180
  }
43132
43181
  async function writeJob(cwd, name, state) {
43133
43182
  const schema = await loadSchema("job-orchestrator-state");
@@ -43374,7 +43423,7 @@ init_config_dir();
43374
43423
  init_fs();
43375
43424
  init_preservation();
43376
43425
  import { randomUUID as randomUUID8 } from "crypto";
43377
- import { lstat as lstat10, readdir as readdir26 } from "fs/promises";
43426
+ import { lstat as lstat11, readdir as readdir26 } from "fs/promises";
43378
43427
  import path147 from "path";
43379
43428
 
43380
43429
  // src/session/paths.ts
@@ -43423,11 +43472,11 @@ function sessionDir(projectPath, sessionId, dataDir) {
43423
43472
  // src/sac/proposal-lifecycle.ts
43424
43473
  init_fs();
43425
43474
  import { createHash as createHash32, randomUUID as randomUUID7 } from "crypto";
43426
- import { appendFile as appendFile7, mkdir as mkdir34, readdir as readdir25, readFile as readFile73 } from "fs/promises";
43475
+ import { appendFile as appendFile7, mkdir as mkdir34, readdir as readdir25, readFile as readFile74 } from "fs/promises";
43427
43476
  import path146 from "path";
43428
43477
 
43429
43478
  // src/sac/index.ts
43430
- import { access as access3, readFile as readFile64, realpath as realpath15 } from "fs/promises";
43479
+ import { access as access3, readFile as readFile65, realpath as realpath15 } from "fs/promises";
43431
43480
  import { createHash as createHash24 } from "crypto";
43432
43481
  import path136 from "path";
43433
43482
  import { fileURLToPath as fileURLToPath3 } from "url";
@@ -43549,7 +43598,7 @@ function isRecord6(value) {
43549
43598
  async function loadNormativeSchema(schema) {
43550
43599
  let pending = normativeSchemas.get(schema);
43551
43600
  if (!pending) {
43552
- pending = resolveSacNormativeSchemaPath(normativeSchemaFiles[schema]).then((file) => readFile64(file, "utf8")).then((source) => JSON.parse(source));
43601
+ pending = resolveSacNormativeSchemaPath(normativeSchemaFiles[schema]).then((file) => readFile65(file, "utf8")).then((source) => JSON.parse(source));
43553
43602
  normativeSchemas.set(schema, pending);
43554
43603
  }
43555
43604
  return pending;
@@ -44239,7 +44288,7 @@ async function evaluateStrictSacGuard(input) {
44239
44288
 
44240
44289
  // src/sac/workspace-service.ts
44241
44290
  init_fs();
44242
- import { mkdir as mkdir31, readdir as readdir22, readFile as readFile65 } from "fs/promises";
44291
+ import { mkdir as mkdir31, readdir as readdir22, readFile as readFile66 } from "fs/promises";
44243
44292
  import { createHash as createHash25, randomUUID as randomUUID4 } from "crypto";
44244
44293
  import path138 from "path";
44245
44294
 
@@ -44301,7 +44350,7 @@ class WorkspaceService {
44301
44350
  await mkdir31(this.storageRoot, { recursive: true, mode: 448 });
44302
44351
  await withFileLock(this.lockPath(manifest.id), async () => {
44303
44352
  try {
44304
- await readFile65(this.manifestPath(manifest.id), "utf8");
44353
+ await readFile66(this.manifestPath(manifest.id), "utf8");
44305
44354
  throw new WorkspaceServiceError("conflict", "workspace already exists");
44306
44355
  } catch (error) {
44307
44356
  if (error instanceof WorkspaceServiceError || !isNotFound(error))
@@ -44592,7 +44641,7 @@ class WorkspaceService {
44592
44641
  throw new WorkspaceServiceError("not_found", "workspace not found");
44593
44642
  let parsed;
44594
44643
  try {
44595
- parsed = JSON.parse(await readFile65(this.manifestPath(id), "utf8"));
44644
+ parsed = JSON.parse(await readFile66(this.manifestPath(id), "utf8"));
44596
44645
  } catch (error) {
44597
44646
  if (isNotFound(error))
44598
44647
  throw new WorkspaceServiceError("not_found", "workspace not found");
@@ -45140,7 +45189,7 @@ async function resolveSessionWrapUp(input) {
45140
45189
  // src/sac/review-confirm-token.ts
45141
45190
  init_fs();
45142
45191
  import { createHash as createHash29, randomBytes as randomBytes6 } from "crypto";
45143
- import { readFile as readFile67 } from "fs/promises";
45192
+ import { readFile as readFile68 } from "fs/promises";
45144
45193
  import path142 from "path";
45145
45194
  var CONFIRM_TOKEN_TTL_MS = 2 * 60000;
45146
45195
  function confirmTokenPath2(cwd, workspaceId, proposalId) {
@@ -45163,7 +45212,7 @@ async function consumeConfirmToken(cwd, workspaceId, proposalId, idempotencyKey,
45163
45212
  return { ok: false, reason: "token_required" };
45164
45213
  let stored;
45165
45214
  try {
45166
- stored = JSON.parse(await readFile67(file, "utf8"));
45215
+ stored = JSON.parse(await readFile68(file, "utf8"));
45167
45216
  } catch (error) {
45168
45217
  return { ok: false, reason: isNotFound(error) ? "token_required" : "token_invalid" };
45169
45218
  }
@@ -45186,14 +45235,14 @@ async function consumeConfirmToken(cwd, workspaceId, proposalId, idempotencyKey,
45186
45235
  init_dedup();
45187
45236
  init_store();
45188
45237
  init_config2();
45189
- import { readFile as readFile69, readdir as readdir24 } from "fs/promises";
45238
+ import { readFile as readFile70, readdir as readdir24 } from "fs/promises";
45190
45239
  import { randomUUID as randomUUID6 } from "crypto";
45191
45240
  import path144 from "path";
45192
45241
 
45193
45242
  // src/sac/proposal-evidence.ts
45194
45243
  init_fs();
45195
45244
  import { createHash as createHash30 } from "crypto";
45196
- import { readFile as readFile68, rm as rm7 } from "fs/promises";
45245
+ import { readFile as readFile69, rm as rm7 } from "fs/promises";
45197
45246
  import path143 from "path";
45198
45247
  function proposalPath(cwd, workspaceId, proposalId) {
45199
45248
  return path143.join(cwd, ".metaproject", "workspaces", workspaceId, "proposals", `${proposalId}.json`);
@@ -45207,7 +45256,7 @@ function proposalNotePath(cwd, workspaceId, proposalId) {
45207
45256
  async function readVerifiedProposalEvidence(cwd, workspaceId, proposalId) {
45208
45257
  let proposal;
45209
45258
  try {
45210
- proposal = JSON.parse(await readFile68(proposalPath(cwd, workspaceId, proposalId), "utf8"));
45259
+ proposal = JSON.parse(await readFile69(proposalPath(cwd, workspaceId, proposalId), "utf8"));
45211
45260
  } catch {
45212
45261
  return { ok: false, code: "proposal_record_unreadable" };
45213
45262
  }
@@ -45216,7 +45265,7 @@ async function readVerifiedProposalEvidence(cwd, workspaceId, proposalId) {
45216
45265
  return { ok: false, code: "no_evidence_to_write" };
45217
45266
  let content;
45218
45267
  try {
45219
- content = await readFile68(path143.join(cwd, evidence.uri), "utf8");
45268
+ content = await readFile69(path143.join(cwd, evidence.uri), "utf8");
45220
45269
  } catch {
45221
45270
  return { ok: false, code: "evidence_file_unreadable" };
45222
45271
  }
@@ -45226,7 +45275,7 @@ async function readVerifiedProposalEvidence(cwd, workspaceId, proposalId) {
45226
45275
  return { proposal, evidence, content };
45227
45276
  }
45228
45277
  async function readSidecarNote(cwd, workspaceId, proposalId) {
45229
- return readFile68(proposalNotePath(cwd, workspaceId, proposalId), "utf8").catch(() => {
45278
+ return readFile69(proposalNotePath(cwd, workspaceId, proposalId), "utf8").catch(() => {
45230
45279
  return;
45231
45280
  });
45232
45281
  }
@@ -45235,7 +45284,7 @@ function digestOf2(content) {
45235
45284
  }
45236
45285
  async function readTargetVersion(absolutePath) {
45237
45286
  try {
45238
- return digestOf2(await readFile68(absolutePath, "utf8"));
45287
+ return digestOf2(await readFile69(absolutePath, "utf8"));
45239
45288
  } catch (error) {
45240
45289
  if (isNotFound(error))
45241
45290
  return null;
@@ -45265,7 +45314,7 @@ function ownerConflictDir(cwd, owner, workspaceId, idempotencyKey) {
45265
45314
  }
45266
45315
  async function readJson4(file) {
45267
45316
  try {
45268
- return JSON.parse(await readFile68(file, "utf8"));
45317
+ return JSON.parse(await readFile69(file, "utf8"));
45269
45318
  } catch {
45270
45319
  return;
45271
45320
  }
@@ -45427,7 +45476,7 @@ async function collectWikiDecisionEntries(cwd) {
45427
45476
  for (const file of files) {
45428
45477
  const absolutePath = path144.join(dir, file);
45429
45478
  try {
45430
- const content = await readFile69(absolutePath, "utf8");
45479
+ const content = await readFile70(absolutePath, "utf8");
45431
45480
  entries.push({
45432
45481
  absolutePath,
45433
45482
  relativePath: path144.posix.join("decisions", file),
@@ -45544,7 +45593,7 @@ ${candidates}`;
45544
45593
 
45545
45594
  // src/sac/memory-owner-writer.ts
45546
45595
  init_write();
45547
- import { readFile as readFile70 } from "fs/promises";
45596
+ import { readFile as readFile71 } from "fs/promises";
45548
45597
  function renderWrapUpMemoryEntry(input) {
45549
45598
  const note = input.note?.trim();
45550
45599
  return `# ${input.title}
@@ -45603,7 +45652,7 @@ function createRealMemoryOwnerWriter(cwd, opts) {
45603
45652
  },
45604
45653
  async recover(intent) {
45605
45654
  try {
45606
- const raw = await readFile70(ownerReceiptPath(cwd, "memory", intent.workspaceId, intent.idempotencyKey), "utf8");
45655
+ const raw = await readFile71(ownerReceiptPath(cwd, "memory", intent.workspaceId, intent.idempotencyKey), "utf8");
45607
45656
  return JSON.parse(raw);
45608
45657
  } catch {
45609
45658
  return;
@@ -45651,7 +45700,7 @@ function createRealMemoryOwnerWriter(cwd, opts) {
45651
45700
  // src/sac/wiki-owner-writer.ts
45652
45701
  init_service5();
45653
45702
  init_guard();
45654
- import { readFile as readFile71 } from "fs/promises";
45703
+ import { readFile as readFile72 } from "fs/promises";
45655
45704
  import path145 from "path";
45656
45705
  function renderWrapUpDecisionPage(input) {
45657
45706
  const note = input.note?.trim();
@@ -45710,7 +45759,7 @@ function createRealWikiOwnerWriter(cwd, opts) {
45710
45759
  },
45711
45760
  async recover(intent) {
45712
45761
  try {
45713
- const raw = await readFile71(ownerReceiptPath(cwd, "wiki", intent.workspaceId, intent.idempotencyKey), "utf8");
45762
+ const raw = await readFile72(ownerReceiptPath(cwd, "wiki", intent.workspaceId, intent.idempotencyKey), "utf8");
45714
45763
  return JSON.parse(raw);
45715
45764
  } catch {
45716
45765
  return;
@@ -45761,7 +45810,7 @@ function createRealWikiOwnerWriter(cwd, opts) {
45761
45810
  }
45762
45811
 
45763
45812
  // src/sac/skill-owner-writer.ts
45764
- import { readFile as readFile72 } from "fs/promises";
45813
+ import { readFile as readFile73 } from "fs/promises";
45765
45814
  function titleFrom(evidenceContent, proposalId) {
45766
45815
  const titleLine = evidenceContent.split(`
45767
45816
  `).find((line) => line.startsWith("# "));
@@ -45792,7 +45841,7 @@ function createRealSkillOwnerWriter(cwd, opts) {
45792
45841
  },
45793
45842
  async recover(intent) {
45794
45843
  try {
45795
- const raw = await readFile72(ownerReceiptPath(cwd, "skill", intent.workspaceId, intent.idempotencyKey), "utf8");
45844
+ const raw = await readFile73(ownerReceiptPath(cwd, "skill", intent.workspaceId, intent.idempotencyKey), "utf8");
45796
45845
  return JSON.parse(raw);
45797
45846
  } catch {
45798
45847
  return;
@@ -45876,7 +45925,7 @@ class ProposalLifecycleService {
45876
45925
  if (consume !== "ok")
45877
45926
  throw new ProposalLifecycleError("trusted_wrap_up_required", `trusted wrap-up ${consume}`);
45878
45927
  try {
45879
- await readFile73(file, "utf8");
45928
+ await readFile74(file, "utf8");
45880
45929
  throw new ProposalLifecycleError("conflict", "proposal already exists");
45881
45930
  } catch (error) {
45882
45931
  if (error instanceof ProposalLifecycleError)
@@ -45952,7 +46001,7 @@ class ProposalLifecycleService {
45952
46001
  const proposals = [];
45953
46002
  for (const entry of entries) {
45954
46003
  try {
45955
- const parsed = JSON.parse(await readFile73(path146.join(proposalsDir, entry), "utf8"));
46004
+ const parsed = JSON.parse(await readFile74(path146.join(proposalsDir, entry), "utf8"));
45956
46005
  if (parsed.recordType === "proposal-created")
45957
46006
  proposals.push(parsed);
45958
46007
  } catch {}
@@ -46037,7 +46086,7 @@ class ProposalLifecycleService {
46037
46086
  }
46038
46087
  async loadOwnerWriteAttempt(workspaceId, proposalId, key) {
46039
46088
  try {
46040
- return JSON.parse(await readFile73(this.attemptPath(workspaceId, proposalId, key), "utf8"));
46089
+ return JSON.parse(await readFile74(this.attemptPath(workspaceId, proposalId, key), "utf8"));
46041
46090
  } catch (error) {
46042
46091
  if (isNotFound(error))
46043
46092
  return;
@@ -46052,7 +46101,7 @@ class ProposalLifecycleService {
46052
46101
  async ensureReviewDecision(proposal, actor, reviewerAuthority, input, outcome, targetWrite, policyRevision) {
46053
46102
  const file = this.decisionPath(proposal.workspaceId, proposal.id, input.idempotencyKey);
46054
46103
  try {
46055
- const existing = JSON.parse(await readFile73(file, "utf8"));
46104
+ const existing = JSON.parse(await readFile74(file, "utf8"));
46056
46105
  const existingWrite = existing.targetWrite;
46057
46106
  if (existing.proposalId !== proposal.id || existing.proposalRevision !== proposal.proposalRevision || existing.workspaceId !== proposal.workspaceId || existing.correlationId !== input.requestCorrelationId || existing.idempotencyKey !== input.idempotencyKey || existing.decision !== outcome) {
46058
46107
  throw new ProposalLifecycleError("conflict", "review decision does not match the recovery request");
@@ -46085,7 +46134,7 @@ class ProposalLifecycleService {
46085
46134
  const approvalRef = this.approvalRef(proposal.id, input.idempotencyKey);
46086
46135
  const approvalPath = this.approvalPath(proposal.workspaceId, proposal.id, input.idempotencyKey);
46087
46136
  try {
46088
- const existing = JSON.parse(await readFile73(approvalPath, "utf8"));
46137
+ const existing = JSON.parse(await readFile74(approvalPath, "utf8"));
46089
46138
  if (existing.proposalId !== proposal.id || existing.proposalRevision !== proposal.proposalRevision || existing.workspaceId !== proposal.workspaceId || existing.correlationId !== input.requestCorrelationId || existing.idempotencyKey !== input.idempotencyKey || existing.policyRevision !== policyRevision || JSON.stringify(existing.reviewer) !== JSON.stringify({ subject: actor.subject, authority: reviewerAuthority }))
46090
46139
  throw new ProposalLifecycleError("conflict", "approval does not match the recovery request");
46091
46140
  return { approvalRef };
@@ -46105,7 +46154,7 @@ class ProposalLifecycleService {
46105
46154
  if (existing)
46106
46155
  return { intentRef };
46107
46156
  try {
46108
- const recovered = JSON.parse(await readFile73(this.intentPath(proposal.workspaceId, proposal.id, input.idempotencyKey), "utf8"));
46157
+ const recovered = JSON.parse(await readFile74(this.intentPath(proposal.workspaceId, proposal.id, input.idempotencyKey), "utf8"));
46109
46158
  await this.validateRecord(recovered);
46110
46159
  if (recovered.proposalId !== proposal.id || recovered.proposalRevision !== proposal.proposalRevision || recovered.correlationId !== input.requestCorrelationId || recovered.idempotencyKey !== input.idempotencyKey || recovered.workspaceId !== proposal.workspaceId)
46111
46160
  throw new ProposalLifecycleError("conflict", "write intent does not match the recovery request");
@@ -46198,7 +46247,7 @@ class ProposalLifecycleService {
46198
46247
  }
46199
46248
  async loadProposal(workspaceId, proposalId) {
46200
46249
  try {
46201
- const item = JSON.parse(await readFile73(this.proposalPath(workspaceId, proposalId), "utf8"));
46250
+ const item = JSON.parse(await readFile74(this.proposalPath(workspaceId, proposalId), "utf8"));
46202
46251
  await this.validateProposal(item);
46203
46252
  return item;
46204
46253
  } catch (error) {
@@ -46209,7 +46258,7 @@ class ProposalLifecycleService {
46209
46258
  }
46210
46259
  async records(ledger) {
46211
46260
  try {
46212
- return (await readFile73(ledger, "utf8")).trim().split(`
46261
+ return (await readFile74(ledger, "utf8")).trim().split(`
46213
46262
  `).filter(Boolean).map((line) => JSON.parse(line));
46214
46263
  } catch (error) {
46215
46264
  if (isNotFound(error))
@@ -46246,7 +46295,7 @@ class ProposalLifecycleService {
46246
46295
  }
46247
46296
  async loadWriteResult(workspaceId, proposalId, key) {
46248
46297
  try {
46249
- return JSON.parse(await readFile73(this.writeResultPath(workspaceId, proposalId, key), "utf8"));
46298
+ return JSON.parse(await readFile74(this.writeResultPath(workspaceId, proposalId, key), "utf8"));
46250
46299
  } catch (error) {
46251
46300
  if (isNotFound(error))
46252
46301
  return;
@@ -46255,7 +46304,7 @@ class ProposalLifecycleService {
46255
46304
  }
46256
46305
  async writeImmutable(file, record) {
46257
46306
  try {
46258
- const existing = await readFile73(file, "utf8");
46307
+ const existing = await readFile74(file, "utf8");
46259
46308
  if (existing !== `${JSON.stringify(record)}
46260
46309
  `)
46261
46310
  throw new ProposalLifecycleError("conflict", "immutable lifecycle record already exists");
@@ -46369,7 +46418,7 @@ function normalizeProposalLifecycleResult(value) {
46369
46418
 
46370
46419
  // src/sac/preservation-replay.ts
46371
46420
  async function readReplayJson(file) {
46372
- if (!(await lstat10(file)).isFile())
46421
+ if (!(await lstat11(file)).isFile())
46373
46422
  throw new Error("nonregular replay record");
46374
46423
  const result = readConfigFile(file);
46375
46424
  if (!result.ok)
@@ -46554,7 +46603,7 @@ async function boundedReplay(input, scan) {
46554
46603
  // src/sac/fwk-service.ts
46555
46604
  import { createHash as createHash35, randomUUID as randomUUID9 } from "crypto";
46556
46605
  init_assembly();
46557
- import { appendFile as appendFile8, mkdir as mkdir35, open as open5, readFile as readFile74, rename as rename7, rm as rm8, stat as stat19, writeFile as writeFile23 } from "fs/promises";
46606
+ import { appendFile as appendFile8, mkdir as mkdir35, open as open5, readFile as readFile75, rename as rename7, rm as rm8, stat as stat19, writeFile as writeFile23 } from "fs/promises";
46558
46607
  import path148 from "path";
46559
46608
  init_fs();
46560
46609
 
@@ -47164,7 +47213,7 @@ function parseCheckpoint(value) {
47164
47213
  }
47165
47214
  async function readCheckpoint(checkpointPath) {
47166
47215
  try {
47167
- const raw = await readFile74(checkpointPath, "utf8");
47216
+ const raw = await readFile75(checkpointPath, "utf8");
47168
47217
  try {
47169
47218
  const checkpoint = parseCheckpoint(JSON.parse(raw));
47170
47219
  return checkpoint ? { present: true, checkpoint } : { present: true };
@@ -47232,7 +47281,7 @@ async function fastCheckpointState(ledger, checkpoint, ledgerBytes) {
47232
47281
  }
47233
47282
  }
47234
47283
  async function auditLedger(ledger, checkpointPath, verifier) {
47235
- const bytes = await readFile74(ledger);
47284
+ const bytes = await readFile75(ledger);
47236
47285
  const raw = bytes.toString("utf8");
47237
47286
  if (raw.length > 0 && !raw.endsWith(`
47238
47287
  `))
@@ -47282,7 +47331,7 @@ var isEvaluationReport = (report) => report.schemaVersion === "1.0" && asString2
47282
47331
  var isConfigRecord = (value) => typeof value.enabled === "boolean" && typeof value.killSwitch === "boolean";
47283
47332
  async function readPinnedJson(input) {
47284
47333
  const ref = await resolveWorkspaceReference({ workspaceRoot: input.workspaceRoot, kind: "artifact", uri: input.uri });
47285
- const raw = await readFile74(ref, "utf8");
47334
+ const raw = await readFile75(ref, "utf8");
47286
47335
  const digest = createHash35("sha256").update(raw).digest("hex");
47287
47336
  if (digest !== input.digest)
47288
47337
  throw new Error("policy experiment pinned artifact digest mismatch");
@@ -47290,7 +47339,7 @@ async function readPinnedJson(input) {
47290
47339
  }
47291
47340
  async function readWorkspaceJson(input) {
47292
47341
  const ref = await resolveWorkspaceReference({ workspaceRoot: input.workspaceRoot, kind: "artifact", uri: input.uri });
47293
- const raw = await readFile74(ref, "utf8");
47342
+ const raw = await readFile75(ref, "utf8");
47294
47343
  return { artifact: JSON.parse(raw), raw };
47295
47344
  }
47296
47345
  function hasReportIntegrity(report) {
@@ -47301,7 +47350,7 @@ async function resolvePolicySelection(workspaceRoot, canonicalFallback) {
47301
47350
  const configPath = path148.join(workspaceRoot, ...policyExperimentConfigPath);
47302
47351
  let configJson;
47303
47352
  try {
47304
- const raw = await readFile74(configPath, "utf8").catch((error) => {
47353
+ const raw = await readFile75(configPath, "utf8").catch((error) => {
47305
47354
  if (isMissing(error))
47306
47355
  return;
47307
47356
  throw error;
@@ -47634,7 +47683,7 @@ async function proposeFromSession(input) {
47634
47683
  return { ok: true, result: normalizeProposalLifecycleResult(proposal) };
47635
47684
  }
47636
47685
  // src/sac/collaboration-service.ts
47637
- import { appendFile as appendFile9, mkdir as mkdir36, readFile as readFile75 } from "fs/promises";
47686
+ import { appendFile as appendFile9, mkdir as mkdir36, readFile as readFile76 } from "fs/promises";
47638
47687
  import { randomUUID as randomUUID11 } from "crypto";
47639
47688
  import path149 from "path";
47640
47689
  class CollaborationServiceError extends Error {
@@ -47660,7 +47709,7 @@ class CollaborationService {
47660
47709
  async activity(input) {
47661
47710
  await this.input.workspaces.show(input);
47662
47711
  try {
47663
- return (await readFile75(this.file(input.workspaceId), "utf8")).trim().split(`
47712
+ return (await readFile76(this.file(input.workspaceId), "utf8")).trim().split(`
47664
47713
  `).filter(Boolean).map((line) => this.validate(JSON.parse(line)));
47665
47714
  } catch (error) {
47666
47715
  if (typeof error === "object" && error && "code" in error && error.code === "ENOENT")
@@ -47737,7 +47786,7 @@ function normalizeCollaborationResult(value) {
47737
47786
  }
47738
47787
  // src/session/external-slate.ts
47739
47788
  init_fs();
47740
- import { mkdir as mkdir38, readdir as readdir27, readFile as readFile76 } from "fs/promises";
47789
+ import { mkdir as mkdir38, readdir as readdir27, readFile as readFile77 } from "fs/promises";
47741
47790
  import path151 from "path";
47742
47791
 
47743
47792
  // src/sac/machine-wrap-up.ts
@@ -48189,7 +48238,7 @@ function externalSlateEvidenceDir(cwd, externalSessionId) {
48189
48238
  }
48190
48239
  async function readExternalSlate(cwd, externalSessionId) {
48191
48240
  try {
48192
- const raw = await readFile76(externalSlatePath(cwd, externalSessionId), "utf8");
48241
+ const raw = await readFile77(externalSlatePath(cwd, externalSessionId), "utf8");
48193
48242
  return JSON.parse(raw);
48194
48243
  } catch (error) {
48195
48244
  if (isNotFound(error))
@@ -48270,12 +48319,12 @@ init_service3();
48270
48319
  // src/standard/service.ts
48271
48320
  init_fs();
48272
48321
  import path154 from "path";
48273
- import { readFile as readFile79 } from "fs/promises";
48322
+ import { readFile as readFile80 } from "fs/promises";
48274
48323
 
48275
48324
  // src/standard/validate.ts
48276
48325
  init_fs();
48277
48326
  import path153 from "path";
48278
- import { readFile as readFile78 } from "fs/promises";
48327
+ import { readFile as readFile79 } from "fs/promises";
48279
48328
 
48280
48329
  // src/standard/schemas.ts
48281
48330
  var MODULE_SCHEMA = {
@@ -48405,7 +48454,7 @@ var SCHEMA_REGISTRY2 = {
48405
48454
  init_fs();
48406
48455
  init_entrypoint_targets();
48407
48456
  import path152 from "path";
48408
- import { readFile as readFile77 } from "fs/promises";
48457
+ import { readFile as readFile78 } from "fs/promises";
48409
48458
  var AGENT_MODULES = ["gdgraph", "gdctx", "gdskills", "gdwiki", "memory"];
48410
48459
  var CI_MODULES = ["health", "testing"];
48411
48460
  var INDEX_LINK = ".metaproject/index.md";
@@ -48433,7 +48482,7 @@ async function rootEntrypointLinksIndex(cwd, manifest) {
48433
48482
  if (!await pathExists(filePath)) {
48434
48483
  continue;
48435
48484
  }
48436
- const content = await readFile77(filePath, "utf8");
48485
+ const content = await readFile78(filePath, "utf8");
48437
48486
  if (content.includes(INDEX_LINK)) {
48438
48487
  return true;
48439
48488
  }
@@ -48664,7 +48713,7 @@ async function validateWorkspace2(cwd) {
48664
48713
  }
48665
48714
  let manifest;
48666
48715
  try {
48667
- manifest = JSON.parse(await readFile78(manifestPath, "utf8"));
48716
+ manifest = JSON.parse(await readFile79(manifestPath, "utf8"));
48668
48717
  } catch (error) {
48669
48718
  const detail = error instanceof Error ? error.message : String(error);
48670
48719
  errors.push(issue("invalid-manifest-json", `.metaproject/metaproject.json is not valid JSON: ${detail}`, "Fix the JSON syntax or regenerate it with `keryx init`."));
@@ -48720,7 +48769,7 @@ async function validateWorkspace2(cwd) {
48720
48769
  if (!await pathExists(filePath)) {
48721
48770
  continue;
48722
48771
  }
48723
- const content = await readFile78(filePath, "utf8");
48772
+ const content = await readFile79(filePath, "utf8");
48724
48773
  if (!content.includes(INDEX_LINK2)) {
48725
48774
  errors.push(issue("entrypoint-missing-index-link", `Root entrypoint ${name} does not link ${INDEX_LINK2}`, scope === "local" ? `Run \`keryx update\` to put the managed block back into ${name}.` : `Add a reference to ${INDEX_LINK2} in ${name} (\`keryx rules sync\` does this).`));
48726
48775
  }
@@ -49767,7 +49816,7 @@ async function readManifest3(cwd) {
49767
49816
  throw new Error("Metaproject is not initialized (missing .metaproject/metaproject.json). Run `keryx init` first.");
49768
49817
  }
49769
49818
  try {
49770
- return JSON.parse(await readFile79(manifestPath, "utf8"));
49819
+ return JSON.parse(await readFile80(manifestPath, "utf8"));
49771
49820
  } catch (error) {
49772
49821
  const detail = error instanceof Error ? error.message : String(error);
49773
49822
  throw new Error(`Invalid .metaproject/metaproject.json: ${detail}`);