@brucewaynedecoy/make-docs 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +1 -1
  2. package/dist/{backup-GCM64IPN.js → backup-CM7RL2Q7.js} +5 -5
  3. package/dist/chunk-3EXHM5L2.js +1225 -0
  4. package/dist/chunk-3EXHM5L2.js.map +1 -0
  5. package/dist/{chunk-4LLSMDWJ.js → chunk-52FTNVXS.js} +242 -76
  6. package/dist/{chunk-4LLSMDWJ.js.map → chunk-52FTNVXS.js.map} +1 -1
  7. package/dist/{chunk-DNDM7DUQ.js → chunk-65QWMODG.js} +2 -2
  8. package/dist/{chunk-57GN6ALR.js → chunk-7R2PPKTB.js} +2 -2
  9. package/dist/{chunk-GPVKIBFC.js → chunk-ADVNSMA7.js} +3 -3
  10. package/dist/{chunk-2HNJCJJE.js → chunk-GERMRLJ2.js} +2 -2
  11. package/dist/{chunk-IHMZ2OCS.js → chunk-J5QDGRZ7.js} +3 -3
  12. package/dist/{chunk-O2UZ35PV.js → chunk-LV3CBXZB.js} +20 -20
  13. package/dist/{chunk-O2UZ35PV.js.map → chunk-LV3CBXZB.js.map} +1 -1
  14. package/dist/{chunk-DFQJENNL.js → chunk-M7DMFIKU.js} +2 -2
  15. package/dist/{chunk-C2IBRVUA.js → chunk-OR5ZVGLG.js} +6 -5
  16. package/dist/chunk-OR5ZVGLG.js.map +1 -0
  17. package/dist/{chunk-U25GFKNZ.js → chunk-YVSASZMT.js} +3 -3
  18. package/dist/chunk-YVSASZMT.js.map +1 -0
  19. package/dist/index.js +118 -110
  20. package/dist/index.js.map +1 -1
  21. package/dist/{self-UHPM4A2U.js → self-36ULRIJ6.js} +17 -17
  22. package/dist/{self-UHPM4A2U.js.map → self-36ULRIJ6.js.map} +1 -1
  23. package/dist/{server-N7XAAV3X.js → server-H754TA4Q.js} +9 -9
  24. package/dist/{setup-system-JUHGDZJW.js → setup-system-JI36YJ6D.js} +15 -15
  25. package/dist/{setup-system-JUHGDZJW.js.map → setup-system-JI36YJ6D.js.map} +1 -1
  26. package/dist/{skills-command-W3SE3OFP.js → skills-command-IGDVLNKY.js} +28 -28
  27. package/dist/{skills-command-W3SE3OFP.js.map → skills-command-IGDVLNKY.js.map} +1 -1
  28. package/dist/{uninstall-BGMJ6KCI.js → uninstall-VBGMQQLA.js} +8 -8
  29. package/dist/{virtual_make-docs-first-party-skills-VXSUUHTL.js → virtual_make-docs-first-party-skills-H3FC47C2.js} +2 -2
  30. package/dist/{virtual_make-docs-first-party-skills-VXSUUHTL.js.map → virtual_make-docs-first-party-skills-H3FC47C2.js.map} +1 -1
  31. package/package.json +4 -4
  32. package/template/.make-docs/system/contracts/output-contract.md +3 -1
  33. package/template/.make-docs/system/references/prd-change-management.md +14 -2
  34. package/dist/chunk-C2IBRVUA.js.map +0 -1
  35. package/dist/chunk-U25GFKNZ.js.map +0 -1
  36. package/dist/chunk-Z5K4FHYP.js +0 -922
  37. package/dist/chunk-Z5K4FHYP.js.map +0 -1
  38. /package/dist/{backup-GCM64IPN.js.map → backup-CM7RL2Q7.js.map} +0 -0
  39. /package/dist/{chunk-DNDM7DUQ.js.map → chunk-65QWMODG.js.map} +0 -0
  40. /package/dist/{chunk-57GN6ALR.js.map → chunk-7R2PPKTB.js.map} +0 -0
  41. /package/dist/{chunk-GPVKIBFC.js.map → chunk-ADVNSMA7.js.map} +0 -0
  42. /package/dist/{chunk-2HNJCJJE.js.map → chunk-GERMRLJ2.js.map} +0 -0
  43. /package/dist/{chunk-IHMZ2OCS.js.map → chunk-J5QDGRZ7.js.map} +0 -0
  44. /package/dist/{chunk-DFQJENNL.js.map → chunk-M7DMFIKU.js.map} +0 -0
  45. /package/dist/{server-N7XAAV3X.js.map → server-H754TA4Q.js.map} +0 -0
  46. /package/dist/{uninstall-BGMJ6KCI.js.map → uninstall-VBGMQQLA.js.map} +0 -0
@@ -18,7 +18,7 @@ import {
18
18
  recordWorkEvidence,
19
19
  resolveProjectIdentity,
20
20
  transitionLifecycleRun
21
- } from "./chunk-IHMZ2OCS.js";
21
+ } from "./chunk-J5QDGRZ7.js";
22
22
  import {
23
23
  SYSTEM_RESOURCE_ENSURE_APPROVAL,
24
24
  SYSTEM_RESOURCE_ORIGINS,
@@ -40,12 +40,12 @@ import {
40
40
  planProjectHarnessIntegrationWrite,
41
41
  registerSkillAdoptionRecovery,
42
42
  resolveEffectiveHarnessIntegration
43
- } from "./chunk-C2IBRVUA.js";
43
+ } from "./chunk-OR5ZVGLG.js";
44
44
  import {
45
45
  assertLifecyclePlanSnapshotCurrent,
46
46
  createLifecycleMutationReceipt,
47
47
  createLifecyclePlanSnapshot
48
- } from "./chunk-57GN6ALR.js";
48
+ } from "./chunk-7R2PPKTB.js";
49
49
  import {
50
50
  HARNESS_CALLER_IDENTITY_ENV,
51
51
  NO_ACCESS,
@@ -63,7 +63,7 @@ import {
63
63
  sha256,
64
64
  validateHarnessMethodSelection,
65
65
  verifyMakeDocsExecutable
66
- } from "./chunk-DFQJENNL.js";
66
+ } from "./chunk-M7DMFIKU.js";
67
67
  import {
68
68
  CURRENT_STORE_SCHEMA_VERSION,
69
69
  HARNESS_TO_INSTRUCTION,
@@ -123,7 +123,7 @@ import {
123
123
  withStoreDatabase,
124
124
  writeManifest,
125
125
  writeTextFile
126
- } from "./chunk-U25GFKNZ.js";
126
+ } from "./chunk-YVSASZMT.js";
127
127
  import {
128
128
  __export
129
129
  } from "./chunk-D4HDZEJT.js";
@@ -20755,10 +20755,13 @@ import path15 from "path";
20755
20755
 
20756
20756
  // src/operations/prd/authority.ts
20757
20757
  import {
20758
+ closeSync,
20758
20759
  existsSync as existsSync7,
20759
20760
  lstatSync as lstatSync7,
20761
+ openSync,
20760
20762
  readdirSync as readdirSync6,
20761
20763
  readFileSync as readFileSync9,
20764
+ readSync,
20762
20765
  realpathSync as realpathSync5,
20763
20766
  statSync as statSync3
20764
20767
  } from "fs";
@@ -20881,8 +20884,6 @@ var STRUCTURED_PROVENANCE_CONTAINER_KEYS = /* @__PURE__ */ new Set([
20881
20884
  "historicalprovenance",
20882
20885
  "archiveprovenance"
20883
20886
  ]);
20884
- var STRUCTURED_EXTENSIONS = /* @__PURE__ */ new Set([".json", ".jsonl", ".yaml", ".yml"]);
20885
- var SKIPPED_SCAN_DIRECTORIES = /* @__PURE__ */ new Set([".git", "node_modules", "dist", "coverage"]);
20886
20887
  function posixPath(value) {
20887
20888
  return value.split(path14.sep).join("/");
20888
20889
  }
@@ -20931,40 +20932,125 @@ function inspectScanRoot(targetRoot2, requestedRoot) {
20931
20932
  };
20932
20933
  }
20933
20934
  }
20934
- function listFiles(root, accepts, skipDirectories = false) {
20935
+ var FRONTMATTER_BYTE_LIMIT = 64 * 1024;
20936
+ var NUMBERED_MARKDOWN = /^\d{2,}-.+\.md$/i;
20937
+ var DATED_DESIGN = /^\d{4}-\d{2}-\d{2}-.+\.md$/i;
20938
+ var DATED_PACKAGE = /^\d{4}-\d{2}-\d{2}-w\d+-r\d+-.+$/i;
20939
+ var PLAN_DOCUMENT = /^(?:00-overview|(?:0[1-9]|[1-9]\d+)-.+)\.md$/i;
20940
+ var WORK_DOCUMENT = /^(?:00-index|(?:0[1-9]|[1-9]\d+)-.+)\.md$/i;
20941
+ function directMarkdownFiles(root, filePattern) {
20935
20942
  if (!root) {
20936
20943
  return [];
20937
20944
  }
20938
- const files = [];
20939
- const visit2 = (directory) => {
20940
- for (const entry of readdirSync6(directory).sort()) {
20941
- if (skipDirectories && SKIPPED_SCAN_DIRECTORIES.has(entry)) {
20942
- continue;
20943
- }
20944
- const absolutePath = path14.join(directory, entry);
20945
- const stats = lstatSync7(absolutePath);
20946
- if (stats.isSymbolicLink()) {
20947
- continue;
20945
+ return readdirSync6(root).sort().flatMap((entry) => {
20946
+ if (!filePattern.test(entry)) return [];
20947
+ const absolutePath = path14.join(root, entry);
20948
+ const stats = lstatSync7(absolutePath);
20949
+ return stats.isFile() && !stats.isSymbolicLink() ? [absolutePath] : [];
20950
+ });
20951
+ }
20952
+ function packageMarkdownFiles(docsRoot, family) {
20953
+ if (!docsRoot) return [];
20954
+ const familyRoot = path14.join(docsRoot, family);
20955
+ if (!existsSync7(familyRoot) || lstatSync7(familyRoot).isSymbolicLink()) return [];
20956
+ if (!statSync3(familyRoot).isDirectory()) return [];
20957
+ const pattern = family === "plans" ? PLAN_DOCUMENT : WORK_DOCUMENT;
20958
+ return readdirSync6(familyRoot).sort().flatMap((entry) => {
20959
+ if (!DATED_PACKAGE.test(entry)) return [];
20960
+ const packageRoot = path14.join(familyRoot, entry);
20961
+ const stats = lstatSync7(packageRoot);
20962
+ if (stats.isSymbolicLink() || !stats.isDirectory()) return [];
20963
+ return directMarkdownFiles(packageRoot, pattern);
20964
+ });
20965
+ }
20966
+ function addInvalidCustomSource(diagnostics, message2) {
20967
+ addDiagnostic(diagnostics, {
20968
+ code: "PRD-AUTH-009",
20969
+ severity: "error",
20970
+ path: ".make-docs/config.yaml",
20971
+ line: 1,
20972
+ message: message2,
20973
+ remediation: "Declare exact existing Markdown files under docs/ in prd_authority.markdown_sources."
20974
+ });
20975
+ }
20976
+ function declaredMarkdownSources(targetRoot2, diagnostics) {
20977
+ const configDirectory = path14.join(targetRoot2, ".make-docs");
20978
+ const configPath = path14.join(configDirectory, "config.yaml");
20979
+ if (!existsSync7(configDirectory)) return [];
20980
+ if (lstatSync7(configDirectory).isSymbolicLink()) {
20981
+ addInvalidCustomSource(diagnostics, "Project config directory is a symbolic link.");
20982
+ return [];
20983
+ }
20984
+ if (!existsSync7(configPath)) return [];
20985
+ if (lstatSync7(configPath).isSymbolicLink()) {
20986
+ addInvalidCustomSource(diagnostics, "Project config file is a symbolic link.");
20987
+ return [];
20988
+ }
20989
+ let parsed;
20990
+ let emptyDocument = false;
20991
+ try {
20992
+ const document = parseDocument(readFileSync9(configPath, "utf8"));
20993
+ if (document.errors.length > 0) throw new Error(document.errors[0].message);
20994
+ emptyDocument = document.contents === null;
20995
+ parsed = document.toJS({ maxAliasCount: 100 });
20996
+ } catch (error51) {
20997
+ addInvalidCustomSource(diagnostics, `Project config cannot be read as YAML: ${error51 instanceof Error ? error51.message : String(error51)}.`);
20998
+ return [];
20999
+ }
21000
+ if (emptyDocument) return [];
21001
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
21002
+ addInvalidCustomSource(diagnostics, "Project config must be a YAML map.");
21003
+ return [];
21004
+ }
21005
+ const section2 = parsed.prd_authority;
21006
+ if (section2 === void 0) return [];
21007
+ if (section2 === null || typeof section2 !== "object" || Array.isArray(section2)) {
21008
+ addInvalidCustomSource(diagnostics, "prd_authority must be a YAML map.");
21009
+ return [];
21010
+ }
21011
+ const values = section2.markdown_sources;
21012
+ if (!Array.isArray(values)) {
21013
+ addInvalidCustomSource(diagnostics, "prd_authority.markdown_sources must be a list of exact paths.");
21014
+ return [];
21015
+ }
21016
+ const paths = [];
21017
+ for (const [index, value] of values.entries()) {
21018
+ if (typeof value !== "string" || !/^docs\//.test(value) || !value.endsWith(".md") || /[\\*?\[\]{}]/.test(value) || value.split("/").some((part) => ["", ".", "..", "archive", "archives"].includes(part.toLowerCase()))) {
21019
+ addInvalidCustomSource(diagnostics, `Custom source at index ${index} must be an exact .md path under docs/ without glob or archive segments.`);
21020
+ continue;
21021
+ }
21022
+ const absolutePath = path14.join(targetRoot2, value);
21023
+ try {
21024
+ let currentPath = targetRoot2;
21025
+ for (const part of value.split("/")) {
21026
+ currentPath = path14.join(currentPath, part);
21027
+ if (lstatSync7(currentPath).isSymbolicLink()) throw new Error("path contains a symbolic link");
20948
21028
  }
20949
- if (stats.isDirectory()) {
20950
- visit2(absolutePath);
20951
- } else if (stats.isFile() && accepts(entry)) {
20952
- files.push(absolutePath);
21029
+ if (!isWithinRoot2(targetRoot2, realpathSync5(absolutePath)) || !statSync3(absolutePath).isFile()) {
21030
+ throw new Error("path is not a regular file inside the project");
20953
21031
  }
21032
+ paths.push(absolutePath);
21033
+ } catch (error51) {
21034
+ addInvalidCustomSource(diagnostics, `Custom source ${value} is missing or unsafe: ${error51 instanceof Error ? error51.message : String(error51)}.`);
20954
21035
  }
20955
- };
20956
- visit2(root);
20957
- return files;
20958
- }
20959
- function markdownFiles2(root) {
20960
- return listFiles(root, (fileName) => fileName.toLowerCase().endsWith(".md"));
21036
+ }
21037
+ return paths;
20961
21038
  }
20962
- function structuredFiles(root) {
20963
- return listFiles(
20964
- root,
20965
- (fileName) => STRUCTURED_EXTENSIONS.has(path14.extname(fileName).toLowerCase()),
20966
- true
20967
- );
21039
+ function workingMarkdownSources(targetRoot2, docsRoot, prdFiles, diagnostics) {
21040
+ const sources = /* @__PURE__ */ new Map();
21041
+ for (const file2 of prdFiles) sources.set(file2, "prd");
21042
+ if (docsRoot) {
21043
+ const designRoot = path14.join(docsRoot, "designs");
21044
+ if (existsSync7(designRoot) && !lstatSync7(designRoot).isSymbolicLink() && statSync3(designRoot).isDirectory()) {
21045
+ for (const file2 of directMarkdownFiles(designRoot, DATED_DESIGN)) sources.set(file2, "design");
21046
+ }
21047
+ for (const file2 of packageMarkdownFiles(docsRoot, "plans")) sources.set(file2, "plan");
21048
+ for (const file2 of packageMarkdownFiles(docsRoot, "work")) sources.set(file2, "work");
21049
+ }
21050
+ for (const file2 of declaredMarkdownSources(targetRoot2, diagnostics)) {
21051
+ if (!sources.has(file2)) sources.set(file2, "custom");
21052
+ }
21053
+ return new Map([...sources].sort(([left], [right]) => left.localeCompare(right)));
20968
21054
  }
20969
21055
  function fencedLineMask(lines) {
20970
21056
  const mask = [];
@@ -20999,10 +21085,6 @@ function editorialKind(value) {
20999
21085
  }
21000
21086
  return normalized.split(/[^a-z]+/).find((part) => INDEX_EDITORIAL_KINDS.has(part)) ?? null;
21001
21087
  }
21002
- function isCanonicalArchiveSource(relativePath3) {
21003
- const normalized = posixPath(relativePath3).toLowerCase();
21004
- return normalized.startsWith(".make-docs/archive/");
21005
- }
21006
21088
  function resolveMarkdownTarget(targetRoot2, sourcePath, rawTarget) {
21007
21089
  const withoutWrapper = rawTarget.trim().replace(/^<|>$/g, "");
21008
21090
  const clean = withoutWrapper.split("#", 1)[0].split("?", 1)[0];
@@ -21100,7 +21182,7 @@ function yamlAuthorityReferences(contents, context, lineOffset = 0, topLevelPath
21100
21182
  return references;
21101
21183
  }
21102
21184
  function markdownFrontmatter(lines) {
21103
- if (lines[0]?.trim() !== "---") {
21185
+ if (lines[0]?.replace(/^\uFEFF/, "").trim() !== "---") {
21104
21186
  return null;
21105
21187
  }
21106
21188
  const endLineIndex = lines.findIndex((line, index) => index > 0 && line.trim() === "---");
@@ -21109,6 +21191,73 @@ function markdownFrontmatter(lines) {
21109
21191
  }
21110
21192
  return { contents: lines.slice(1, endLineIndex).join("\n"), endLineIndex };
21111
21193
  }
21194
+ function frontmatterMetadataProblem(contents, sourceKind) {
21195
+ let metadata;
21196
+ try {
21197
+ const document = parseDocument(contents);
21198
+ if (document.errors.length > 0) throw new Error(document.errors[0].message);
21199
+ metadata = document.toJS({ maxAliasCount: 100 });
21200
+ } catch (error51) {
21201
+ return { message: `Frontmatter is malformed: ${error51 instanceof Error ? error51.message : String(error51)}`, fatal: true };
21202
+ }
21203
+ if (metadata === null || typeof metadata !== "object" || Array.isArray(metadata)) {
21204
+ return { message: "Frontmatter must be a YAML map", fatal: true };
21205
+ }
21206
+ const values = metadata;
21207
+ const kind = values.kind;
21208
+ if (kind !== void 0 && (typeof kind !== "string" || !kind.trim())) {
21209
+ return { message: "Frontmatter kind must be a non-empty string", fatal: false };
21210
+ }
21211
+ if (typeof kind === "string" && sourceKind !== "custom" && kind.toLowerCase() !== sourceKind) {
21212
+ return { message: `Frontmatter kind ${kind} conflicts with the ${sourceKind} working path`, fatal: false };
21213
+ }
21214
+ if (typeof kind === "string" && sourceKind === "custom" && !["design", "plan", "prd", "work", "history", "guide"].includes(kind.toLowerCase())) {
21215
+ return { message: `Frontmatter kind ${kind} is not a Make Docs document kind`, fatal: false };
21216
+ }
21217
+ const status = values.status;
21218
+ if (status !== void 0 && (typeof status !== "string" || !status.trim())) {
21219
+ return { message: "Frontmatter status must be a non-empty string", fatal: false };
21220
+ }
21221
+ return null;
21222
+ }
21223
+ function frontmatterProblem(absolutePath, sourceKind) {
21224
+ const descriptor = openSync(absolutePath, "r");
21225
+ const chunks = [];
21226
+ let byteCount = 0;
21227
+ let sample = "";
21228
+ let reachedEnd = false;
21229
+ try {
21230
+ while (byteCount <= FRONTMATTER_BYTE_LIMIT) {
21231
+ const buffer = Buffer.alloc(Math.min(4096, FRONTMATTER_BYTE_LIMIT + 1 - byteCount));
21232
+ const count2 = readSync(descriptor, buffer, 0, buffer.length, null);
21233
+ if (count2 === 0) {
21234
+ reachedEnd = true;
21235
+ break;
21236
+ }
21237
+ chunks.push(buffer.subarray(0, count2));
21238
+ byteCount += count2;
21239
+ sample = Buffer.concat(chunks).toString("utf8");
21240
+ if (sample.length >= 5 && !/^(?:\uFEFF)?---\r?\n/.test(sample)) return null;
21241
+ const match = sample.match(/^(?:\uFEFF)?---\r?\n([\s\S]*?)\r?\n---\r?\n/);
21242
+ if (match) {
21243
+ if (Buffer.byteLength(match[0], "utf8") > FRONTMATTER_BYTE_LIMIT) break;
21244
+ return frontmatterMetadataProblem(match[1], sourceKind);
21245
+ }
21246
+ }
21247
+ } finally {
21248
+ closeSync(descriptor);
21249
+ }
21250
+ if (reachedEnd) {
21251
+ const terminalMatch = sample.match(/^(?:\uFEFF)?---\r?\n([\s\S]*?)\r?\n---$/);
21252
+ if (terminalMatch && Buffer.byteLength(terminalMatch[0], "utf8") <= FRONTMATTER_BYTE_LIMIT) {
21253
+ return frontmatterMetadataProblem(terminalMatch[1], sourceKind);
21254
+ }
21255
+ if (/^(?:\uFEFF)?---\r?$/.test(sample)) {
21256
+ return { message: "Frontmatter has no closing delimiter", fatal: true };
21257
+ }
21258
+ }
21259
+ return /^(?:\uFEFF)?---\r?\n/.test(sample) ? { message: `Frontmatter has no closing delimiter within ${FRONTMATTER_BYTE_LIMIT} bytes`, fatal: true } : null;
21260
+ }
21112
21261
  function validateAuthorityReference(diagnostics, targetRoot2, sourcePath, relativePath3, reference) {
21113
21262
  const resolved = resolveAuthorityFieldTarget(targetRoot2, sourcePath, reference.target);
21114
21263
  if (!resolved || !isActionPrdTarget(targetRoot2, resolved)) {
@@ -21203,6 +21352,7 @@ function emptyReport(targetRoot2, targetRootStatus, prdSetStatus, diagnostics) {
21203
21352
  prdSetStatus,
21204
21353
  prdFilesScanned: 0,
21205
21354
  markdownFilesScanned: 0,
21355
+ markdownSourceCoverage: { prd: 0, design: 0, plan: 0, work: 0, custom: 0, customPaths: [] },
21206
21356
  structuredFilesScanned: 0,
21207
21357
  linksScanned: 0,
21208
21358
  diagnostics
@@ -21263,8 +21413,44 @@ function validatePrdAuthority(targetRootInput) {
21263
21413
  remediation: "Use a real documentation directory contained by the target root."
21264
21414
  });
21265
21415
  }
21266
- const prdFiles = markdownFiles2(prdScanRoot.realPath);
21416
+ const prdFiles = directMarkdownFiles(prdScanRoot.realPath, NUMBERED_MARKDOWN);
21417
+ const markdownSources = workingMarkdownSources(
21418
+ targetRoot2,
21419
+ docsScanRoot.realPath,
21420
+ prdFiles,
21421
+ diagnostics
21422
+ );
21423
+ const readableMarkdown = /* @__PURE__ */ new Set();
21424
+ for (const [absolutePath, sourceKind] of markdownSources) {
21425
+ const relativePath3 = posixPath(path14.relative(targetRoot2, absolutePath));
21426
+ try {
21427
+ const problem = frontmatterProblem(absolutePath, sourceKind);
21428
+ if (problem) {
21429
+ addDiagnostic(diagnostics, {
21430
+ code: "PRD-AUTH-010",
21431
+ severity: "error",
21432
+ path: relativePath3,
21433
+ line: 1,
21434
+ message: problem.message,
21435
+ remediation: "Repair the selected document frontmatter or remove an invalid custom source declaration."
21436
+ });
21437
+ }
21438
+ if (!problem?.fatal) {
21439
+ readableMarkdown.add(absolutePath);
21440
+ }
21441
+ } catch (error51) {
21442
+ addDiagnostic(diagnostics, {
21443
+ code: "PRD-AUTH-010",
21444
+ severity: "error",
21445
+ path: relativePath3,
21446
+ line: 1,
21447
+ message: `Selected Markdown header cannot be read: ${error51 instanceof Error ? error51.message : String(error51)}`,
21448
+ remediation: "Make the selected document readable and repair its frontmatter."
21449
+ });
21450
+ }
21451
+ }
21267
21452
  for (const absolutePath of prdFiles) {
21453
+ if (!readableMarkdown.has(absolutePath)) continue;
21268
21454
  const relativePath3 = posixPath(path14.relative(targetRoot2, absolutePath));
21269
21455
  const fileName = path14.basename(absolutePath);
21270
21456
  const contents = readFileSync9(absolutePath, "utf8");
@@ -21347,12 +21533,19 @@ function validatePrdAuthority(targetRootInput) {
21347
21533
  }
21348
21534
  }
21349
21535
  let linksScanned = 0;
21350
- const markdownDocs = markdownFiles2(docsScanRoot.realPath);
21351
- for (const absolutePath of markdownDocs) {
21536
+ const markdownSourceCoverage = {
21537
+ prd: 0,
21538
+ design: 0,
21539
+ plan: 0,
21540
+ work: 0,
21541
+ custom: 0,
21542
+ customPaths: []
21543
+ };
21544
+ for (const [absolutePath, sourceKind] of markdownSources) {
21545
+ if (!readableMarkdown.has(absolutePath)) continue;
21352
21546
  const relativePath3 = posixPath(path14.relative(targetRoot2, absolutePath));
21353
- if (isCanonicalArchiveSource(relativePath3)) {
21354
- continue;
21355
- }
21547
+ markdownSourceCoverage[sourceKind] += 1;
21548
+ if (sourceKind === "custom") markdownSourceCoverage.customPaths.push(relativePath3);
21356
21549
  const contents = readFileSync9(absolutePath, "utf8");
21357
21550
  const lines = contents.split(/\r?\n/);
21358
21551
  const fencedLines = fencedLineMask(lines);
@@ -21407,34 +21600,6 @@ function validatePrdAuthority(targetRootInput) {
21407
21600
  }
21408
21601
  }
21409
21602
  }
21410
- const structuredDocs = structuredFiles(targetRoot2);
21411
- for (const absolutePath of structuredDocs) {
21412
- const relativePath3 = posixPath(path14.relative(targetRoot2, absolutePath));
21413
- if (isCanonicalArchiveSource(relativePath3)) {
21414
- continue;
21415
- }
21416
- const contents = readFileSync9(absolutePath, "utf8");
21417
- const references = [];
21418
- if (path14.extname(absolutePath).toLowerCase() === ".jsonl") {
21419
- for (const [index, line] of contents.split(/\r?\n/).entries()) {
21420
- if (line.trim()) {
21421
- references.push(...yamlAuthorityReferences(line, "structured", index));
21422
- }
21423
- }
21424
- } else {
21425
- references.push(...yamlAuthorityReferences(contents, "structured"));
21426
- }
21427
- linksScanned += references.length;
21428
- for (const reference of references) {
21429
- validateAuthorityReference(
21430
- diagnostics,
21431
- targetRoot2,
21432
- absolutePath,
21433
- relativePath3,
21434
- reference
21435
- );
21436
- }
21437
- }
21438
21603
  diagnostics.sort(
21439
21604
  (left, right) => left.path.localeCompare(right.path) || left.line - right.line || left.code.localeCompare(right.code)
21440
21605
  );
@@ -21445,8 +21610,9 @@ function validatePrdAuthority(targetRootInput) {
21445
21610
  prdRoot: path14.join(requestedTargetRoot, "docs", "prd"),
21446
21611
  prdSetStatus: prdScanRoot.status,
21447
21612
  prdFilesScanned: prdFiles.length,
21448
- markdownFilesScanned: markdownDocs.length,
21449
- structuredFilesScanned: structuredDocs.length,
21613
+ markdownFilesScanned: readableMarkdown.size,
21614
+ markdownSourceCoverage,
21615
+ structuredFilesScanned: 0,
21450
21616
  linksScanned,
21451
21617
  diagnostics
21452
21618
  };
@@ -24671,4 +24837,4 @@ export {
24671
24837
  getInstallPlanMigrationReviewBlock,
24672
24838
  executeStoreCheckpoint9Migration
24673
24839
  };
24674
- //# sourceMappingURL=chunk-4LLSMDWJ.js.map
24840
+ //# sourceMappingURL=chunk-52FTNVXS.js.map