@farming-labs/docs 0.2.107 → 0.2.108

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 (40) hide show
  1. package/dist/{agent-B0eRMIyt.mjs → agent--fSgaVIK.mjs} +169 -10
  2. package/dist/{agent-DCTGj6J7.mjs → agent-BDrflLmt.mjs} +1 -1
  3. package/dist/{agent-evals-D-sPJfXz.mjs → agent-evals-3m5FXStK.mjs} +26 -7
  4. package/dist/{agent-export-GcTZPLfB.mjs → agent-export-CSdby81L.mjs} +6 -6
  5. package/dist/agent-skills-bundle.d.mts +1 -1
  6. package/dist/{agent-skills-server-D34054x5.d.mts → agent-skills-server-CF6iVTBR.d.mts} +2 -2
  7. package/dist/agent-skills-vite.d.mts +3 -3
  8. package/dist/{agents-e1SYT64z.mjs → agents-DDt41QR8.mjs} +5 -5
  9. package/dist/{analytics-aeXwEvQX.d.mts → analytics-CwXxM9oL.d.mts} +1 -1
  10. package/dist/{authoring-Do87QzBd.mjs → authoring-ct8s0Z_X.mjs} +3 -3
  11. package/dist/{authoring-mcp-Be7quE5R.mjs → authoring-mcp-Wy-h93DM.mjs} +1 -1
  12. package/dist/browser.d.mts +2 -2
  13. package/dist/cli/index.mjs +19 -16
  14. package/dist/client/react.d.mts +1 -1
  15. package/dist/{cloud-ask-ai-BqfiQaNZ.d.mts → cloud-ask-ai-C9dvEBpW.d.mts} +1 -1
  16. package/dist/{content-change-hydration-CoYRs3pC.d.mts → content-change-hydration-CDuohygf.d.mts} +2 -2
  17. package/dist/docs-cloud-server.d.mts +2 -2
  18. package/dist/{doctor-CPGUlDVt.mjs → doctor-DESIZy7v.mjs} +126 -30
  19. package/dist/{golden-evaluations-Bnlljxq3.mjs → golden-evaluations-Dc06CZM-.mjs} +1 -1
  20. package/dist/index.d.mts +6 -6
  21. package/dist/index.mjs +4 -4
  22. package/dist/{mcp-DsjWxF7g.mjs → mcp-CC74oNj3.mjs} +5 -5
  23. package/dist/mcp.d.mts +3 -3
  24. package/dist/mcp.mjs +16 -2
  25. package/dist/{openapi-mcp-DQ3xptKo.mjs → openapi-mcp-CFWUsMUr.mjs} +1 -1
  26. package/dist/{prompt-references-1Wce71c7.mjs → prompt-references-DVhk8W6r.mjs} +2 -2
  27. package/dist/{retrieval-digest-DyNRD-mt.d.mts → retrieval-digest-VUlhYMUW.d.mts} +10 -3
  28. package/dist/{review-BvjSFiD_.mjs → review-glShh1or.mjs} +4 -4
  29. package/dist/{robots-CzKesbdX.mjs → robots-D6RgVpll.mjs} +2 -2
  30. package/dist/{robots-BOjWB1ky.mjs → robots-dNbBnlVh.mjs} +1 -1
  31. package/dist/{search-DwAoC9X7.mjs → search-BOOiOwTS.mjs} +5 -5
  32. package/dist/server.d.mts +6 -6
  33. package/dist/server.mjs +5 -5
  34. package/dist/{sidebar-CJze8SBi.d.mts → sidebar-Bne72SU-.d.mts} +1 -1
  35. package/dist/{sitemap-DOaJIKJf.mjs → sitemap-Ck1YKSAJ.mjs} +5 -5
  36. package/dist/{sitemap-server-NeVu8W38.mjs → sitemap-server-BKNIqgvq.mjs} +1 -1
  37. package/dist/{skills-BILSESek.mjs → skills-Bucp3wjq.mjs} +5 -5
  38. package/dist/{standards-discovery-Xm84bS4M.d.mts → standards-discovery-CjyUCxdy.d.mts} +1 -1
  39. package/dist/{types-QhYMnKvb.d.mts → types-BkAk6B2d.d.mts} +13 -1
  40. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import { v as normalizePageAgentFrontmatter, x as stripGeneratedPageAgentContractMarkdown } from "./markdown-sections-BKy4labo.mjs";
2
- import { V as findDocsMarkdownPage, ot as renderDocsMarkdownDocument } from "./agent-DCTGj6J7.mjs";
3
- import { d as GENERATED_AGENT_PROVENANCE_VERSION, f as hashGeneratedAgentContent, h as serializeGeneratedAgentDocument, m as parseGeneratedAgentDocument } from "./openapi-mcp-DQ3xptKo.mjs";
2
+ import { V as findDocsMarkdownPage, ot as renderDocsMarkdownDocument } from "./agent-BDrflLmt.mjs";
3
+ import { d as GENERATED_AGENT_PROVENANCE_VERSION, f as hashGeneratedAgentContent, h as serializeGeneratedAgentDocument, m as parseGeneratedAgentDocument } from "./openapi-mcp-CFWUsMUr.mjs";
4
4
  import { createFilesystemDocsMcpSource } from "./mcp.mjs";
5
5
  import { _ as resolveDocsContentDir, a as loadDocsConfigModule, c as loadProjectEnv, d as readNavTitle, f as readNumberProperty, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, p as readStringProperty, t as extractNestedObjectLiteral, u as readEnvReferenceProperty } from "./config-DrZ3fXgf.mjs";
6
6
  import { createRequire } from "node:module";
7
7
  import matter from "gray-matter";
8
- import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
8
+ import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
9
9
  import path from "node:path";
10
10
  import { execFileSync } from "node:child_process";
11
11
  import pc from "picocolors";
@@ -29,8 +29,11 @@ var __exportAll = (all, no_symbols) => {
29
29
  //#endregion
30
30
  //#region src/cli/agent.ts
31
31
  var agent_exports = /* @__PURE__ */ __exportAll({
32
+ AGENT_COMPACTION_REVIEW_MANIFEST_VERSION: () => AGENT_COMPACTION_REVIEW_MANIFEST_VERSION,
33
+ DEFAULT_AGENT_COMPACTION_REVIEW_MANIFEST_PATH: () => DEFAULT_AGENT_COMPACTION_REVIEW_MANIFEST_PATH,
32
34
  compactAgentDocs: () => compactAgentDocs,
33
35
  inspectAgentCompactionState: () => inspectAgentCompactionState,
36
+ loadAgentCompactionReviews: () => loadAgentCompactionReviews,
34
37
  parseAgentCompactArgs: () => parseAgentCompactArgs,
35
38
  printAgentCompactHelp: () => printAgentCompactHelp,
36
39
  readPageTokenBudget: () => readPageTokenBudget,
@@ -46,6 +49,8 @@ const INDEX_PAGE_BASENAMES = new Set([
46
49
  "page",
47
50
  "+page"
48
51
  ]);
52
+ const DEFAULT_AGENT_COMPACTION_REVIEW_MANIFEST_PATH = ".farming-labs/agent-compaction-reviews.json";
53
+ const AGENT_COMPACTION_REVIEW_MANIFEST_VERSION = 1;
49
54
  function parseBooleanFlag(raw) {
50
55
  if (raw === "true") return true;
51
56
  if (raw === "false") return false;
@@ -81,6 +86,10 @@ function parseAgentCompactArgs(argv) {
81
86
  parsed.check = true;
82
87
  continue;
83
88
  }
89
+ if (arg === "--review") {
90
+ parsed.review = true;
91
+ continue;
92
+ }
84
93
  if (arg === "--changed") {
85
94
  parsed.changed = true;
86
95
  continue;
@@ -146,6 +155,15 @@ function parseAgentCompactArgs(argv) {
146
155
  case "protect-json":
147
156
  parsed.protectJson = parseBooleanFlag(value);
148
157
  break;
158
+ case "reviewed-by":
159
+ parsed.reviewedBy = value;
160
+ break;
161
+ case "reason":
162
+ parsed.reviewReason = value;
163
+ break;
164
+ case "review-manifest":
165
+ parsed.reviewManifestPath = value;
166
+ break;
149
167
  default: throw new Error(`Unknown agent compact flag: --${key}.`);
150
168
  }
151
169
  }
@@ -159,6 +177,80 @@ function normalizeUrlPath(value) {
159
177
  if (normalized === "/") return normalized;
160
178
  return normalized.replace(/\/+$/, "");
161
179
  }
180
+ function resolveReviewManifestPath(rootDir, configuredPath) {
181
+ const relativePath = configuredPath?.trim() || DEFAULT_AGENT_COMPACTION_REVIEW_MANIFEST_PATH;
182
+ if (path.isAbsolute(relativePath)) throw new Error("Agent compaction reviewManifestPath must be project-relative.");
183
+ const resolved = path.resolve(rootDir, relativePath);
184
+ const relative = path.relative(rootDir, resolved);
185
+ if (relative.startsWith("..") || path.isAbsolute(relative)) throw new Error("Agent compaction reviewManifestPath must stay inside the project root.");
186
+ return resolved;
187
+ }
188
+ function normalizeReviewRecord(value, index) {
189
+ const pathLabel = `reviews[${index}]`;
190
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`${pathLabel} must be an object.`);
191
+ const record = value;
192
+ const readString = (key) => {
193
+ const field = record[key];
194
+ if (typeof field !== "string" || !field.trim()) throw new Error(`${pathLabel}.${key} must be a non-empty string.`);
195
+ return field.trim();
196
+ };
197
+ const route = normalizeUrlPath(readString("route"));
198
+ if (!route.startsWith("/") || route.includes("?") || route.includes("#")) throw new Error(`${pathLabel}.route must be an absolute docs route without query or hash.`);
199
+ const sourceHash = readString("sourceHash");
200
+ const settingsHash = readString("settingsHash");
201
+ const outputHash = readString("outputHash");
202
+ for (const [key, hash] of Object.entries({
203
+ sourceHash,
204
+ settingsHash,
205
+ outputHash
206
+ })) if (!/^fnv1a64:[0-9a-f]{16}$/u.test(hash)) throw new Error(`${pathLabel}.${key} must be an fnv1a64 content hash.`);
207
+ const reviewedAt = readString("reviewedAt");
208
+ if (!Number.isFinite(Date.parse(reviewedAt))) throw new Error(`${pathLabel}.reviewedAt must be an ISO-compatible timestamp.`);
209
+ return {
210
+ route,
211
+ sourceHash,
212
+ settingsHash,
213
+ outputHash,
214
+ reviewedAt,
215
+ reviewedBy: readString("reviewedBy"),
216
+ reason: readString("reason")
217
+ };
218
+ }
219
+ function loadAgentCompactionReviews(rootDir, configuredPath) {
220
+ const manifestPath = resolveReviewManifestPath(rootDir, configuredPath);
221
+ if (!existsSync(manifestPath)) return [];
222
+ const manifestStat = lstatSync(manifestPath);
223
+ if (manifestStat.isSymbolicLink() || !manifestStat.isFile()) throw new Error("Agent compaction review manifest must be a regular non-symlink file.");
224
+ let parsed;
225
+ try {
226
+ parsed = JSON.parse(readFileSync(manifestPath, "utf-8"));
227
+ } catch (error) {
228
+ throw new Error(`Could not parse agent compaction review manifest ${path.relative(rootDir, manifestPath)}: ${error instanceof Error ? error.message : String(error)}`);
229
+ }
230
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Agent compaction review manifest must be a JSON object.");
231
+ const manifest = parsed;
232
+ if (manifest.version !== AGENT_COMPACTION_REVIEW_MANIFEST_VERSION) throw new Error(`Agent compaction review manifest version must be ${AGENT_COMPACTION_REVIEW_MANIFEST_VERSION}.`);
233
+ if (!Array.isArray(manifest.reviews)) throw new Error("Agent compaction review manifest reviews must be an array.");
234
+ const reviews = manifest.reviews.map(normalizeReviewRecord);
235
+ const routes = /* @__PURE__ */ new Set();
236
+ for (const review of reviews) {
237
+ if (routes.has(review.route)) throw new Error(`Agent compaction review route is duplicated: ${review.route}.`);
238
+ routes.add(review.route);
239
+ }
240
+ return reviews;
241
+ }
242
+ function writeAgentCompactionReviews(rootDir, configuredPath, reviews) {
243
+ const manifestPath = resolveReviewManifestPath(rootDir, configuredPath);
244
+ const manifest = {
245
+ version: AGENT_COMPACTION_REVIEW_MANIFEST_VERSION,
246
+ reviews: [...reviews].sort((left, right) => left.route.localeCompare(right.route))
247
+ };
248
+ mkdirSync(path.dirname(manifestPath), { recursive: true });
249
+ const temporaryPath = `${manifestPath}.tmp-${process.pid}`;
250
+ writeFileSync(temporaryPath, `${JSON.stringify(manifest, null, 2)}\n`, "utf-8");
251
+ renameSync(temporaryPath, manifestPath);
252
+ return manifestPath;
253
+ }
162
254
  function normalizeRequestedPage(entry, rawValue) {
163
255
  const trimmed = rawValue.trim();
164
256
  if (!trimmed || trimmed === ".") return `/${normalizePathSegment(entry) || "docs"}`;
@@ -291,7 +383,8 @@ function readAgentCompactConfig(content) {
291
383
  aggressiveness: readNumberProperty(compactBlock, "aggressiveness"),
292
384
  maxOutputTokens: readNumberProperty(compactBlock, "maxOutputTokens"),
293
385
  minOutputTokens: readNumberProperty(compactBlock, "minOutputTokens"),
294
- protectJson: readBooleanProperty(compactBlock, "protectJson")
386
+ protectJson: readBooleanProperty(compactBlock, "protectJson"),
387
+ reviewManifestPath: readStringProperty(compactBlock, "reviewManifestPath")
295
388
  };
296
389
  }
297
390
  function readCloudApiKeyConfigFromModule(config) {
@@ -309,7 +402,8 @@ function readAgentCompactConfigFromModule(config) {
309
402
  aggressiveness: compact.aggressiveness,
310
403
  maxOutputTokens: compact.maxOutputTokens,
311
404
  minOutputTokens: compact.minOutputTokens,
312
- protectJson: compact.protectJson
405
+ protectJson: compact.protectJson,
406
+ reviewManifestPath: compact.reviewManifestPath
313
407
  };
314
408
  }
315
409
  function mergeAgentCompactOptions(defaults, overrides) {
@@ -392,6 +486,23 @@ function inspectAgentCompactionState(page, target, defaults) {
392
486
  };
393
487
  const sourceKind = resolveSourceKindForCompaction(target, currentDocument);
394
488
  const sourceDocument = buildSourceDocumentForCompaction(page, sourceKind);
489
+ const review = defaults.reviewRecords?.find((candidate) => normalizeUrlPath(candidate.route) === normalizeUrlPath(target.url));
490
+ if (review) {
491
+ const reviewMismatches = [];
492
+ if (hashGeneratedAgentContent(buildResolvedPageSourceDocument(page)) !== review.sourceHash) reviewMismatches.push("source");
493
+ if (buildCompactionSettingsHash(pageOptions) !== review.settingsHash) reviewMismatches.push("settings");
494
+ if (hashGeneratedAgentContent(currentDocument.content) !== review.outputHash) reviewMismatches.push("output");
495
+ return {
496
+ status: reviewMismatches.length === 0 ? "reviewed" : "review-invalid",
497
+ sourceKind,
498
+ pageOptions,
499
+ sourceDocument,
500
+ provenance: currentDocument.provenance,
501
+ review,
502
+ reviewMismatches,
503
+ tokenBudget
504
+ };
505
+ }
395
506
  if (!currentDocument.provenance) return {
396
507
  status: "unknown",
397
508
  sourceKind,
@@ -521,14 +632,20 @@ async function compactAgentDocs(options = {}) {
521
632
  const loadedConfigModule = await loadDocsConfigModule(rootDir, options.configPath);
522
633
  const configContent = readFileSync(loadedConfigModule?.path ?? resolveDocsConfigPath(rootDir, options.configPath), "utf-8");
523
634
  const resolvedOptions = mergeAgentCompactOptions(mergeAgentCompactOptions(mergeAgentCompactOptions(readCloudApiKeyConfig(configContent), loadedConfigModule?.config ? readCloudApiKeyConfigFromModule(loadedConfigModule.config) : {}), mergeAgentCompactOptions(readAgentCompactConfig(configContent), loadedConfigModule?.config ? readAgentCompactConfigFromModule(loadedConfigModule.config) : {})), options);
635
+ resolvedOptions.reviewRecords = loadAgentCompactionReviews(rootDir, resolvedOptions.reviewManifestPath);
524
636
  const entry = normalizePathSegment(loadedConfigModule?.config.entry ?? readTopLevelStringProperty(configContent, "entry") ?? "docs") || "docs";
525
637
  const contentDir = typeof loadedConfigModule?.config.contentDir === "string" ? loadedConfigModule.config.contentDir : resolveDocsContentDir(rootDir, configContent, entry);
526
638
  const siteTitle = typeof loadedConfigModule?.config.nav?.title === "string" ? loadedConfigModule.config.nav.title : readNavTitle(configContent) ?? "Documentation";
527
639
  if (resolvedOptions.all && resolvedOptions.pages && resolvedOptions.pages.length > 0) throw new Error("Use either --all or specific page arguments, not both.");
528
640
  if (resolvedOptions.includeMissing && !resolvedOptions.stale) throw new Error("Use --include-missing together with --stale.");
641
+ if ((resolvedOptions.reviewedBy || resolvedOptions.reviewReason) && resolvedOptions.review !== true) throw new Error("Use --reviewed-by and --reason together with --review.");
529
642
  const requestedPages = resolvedOptions.pages?.filter((value) => value.trim().length > 0) ?? [];
530
- if (resolvedOptions.check && (resolvedOptions.all || resolvedOptions.stale || resolvedOptions.changed || resolvedOptions.includeMissing || resolvedOptions.dryRun || requestedPages.length > 0)) throw new Error("Use --check by itself; it inspects every compactable docs page without writing.");
531
- if (!resolvedOptions.all && requestedPages.length === 0 && !resolvedOptions.stale && !resolvedOptions.changed && !resolvedOptions.check) throw new Error("Pass --all, --changed, --stale, or at least one docs page slug/path to compact.");
643
+ if (resolvedOptions.check && (resolvedOptions.all || resolvedOptions.stale || resolvedOptions.changed || resolvedOptions.includeMissing || resolvedOptions.review || resolvedOptions.dryRun || requestedPages.length > 0)) throw new Error("Use --check by itself; it inspects every compactable docs page without writing.");
644
+ if (resolvedOptions.review && (resolvedOptions.all || resolvedOptions.stale || resolvedOptions.changed || resolvedOptions.includeMissing || resolvedOptions.check)) throw new Error("Use --review with explicit page arguments, not selection or check flags.");
645
+ if (resolvedOptions.review && requestedPages.length === 0) throw new Error("Pass at least one explicit docs page with --review.");
646
+ if (resolvedOptions.review && !resolvedOptions.reviewedBy?.trim()) throw new Error("Pass --reviewed-by <name> with --review.");
647
+ if (resolvedOptions.review && !resolvedOptions.reviewReason?.trim()) throw new Error("Pass --reason <text> with --review.");
648
+ if (!resolvedOptions.all && requestedPages.length === 0 && !resolvedOptions.stale && !resolvedOptions.changed && !resolvedOptions.check && !resolvedOptions.review) throw new Error("Pass --all, --changed, --stale, or at least one docs page slug/path to compact.");
532
649
  const pages = await createFilesystemDocsMcpSource({
533
650
  rootDir,
534
651
  entry,
@@ -545,8 +662,33 @@ async function compactAgentDocs(options = {}) {
545
662
  }
546
663
  throw new Error("No compactable docs pages matched the request.");
547
664
  }
665
+ if (resolvedOptions.review) {
666
+ const reviewsByRoute = new Map((resolvedOptions.reviewRecords ?? []).map((review) => [review.route, review]));
667
+ for (const { page, target } of filteredPages) {
668
+ const currentDocument = readCurrentAgentDocument(target);
669
+ if (!currentDocument) throw new Error(`Cannot review ${page.url}: ${target.agentPath} does not exist.`);
670
+ reviewsByRoute.set(page.url, {
671
+ route: page.url,
672
+ sourceHash: hashGeneratedAgentContent(buildResolvedPageSourceDocument(page)),
673
+ settingsHash: buildCompactionSettingsHash(buildPageOptions(resolvedOptions, target.pagePath).pageOptions),
674
+ outputHash: hashGeneratedAgentContent(currentDocument.content),
675
+ reviewedAt: (/* @__PURE__ */ new Date()).toISOString(),
676
+ reviewedBy: resolvedOptions.reviewedBy.trim(),
677
+ reason: resolvedOptions.reviewReason.trim()
678
+ });
679
+ }
680
+ if (resolvedOptions.dryRun) {
681
+ console.log(pc.green(`Dry run: would record ${filteredPages.length} reviewed agent.md page${filteredPages.length === 1 ? "" : "s"}.`));
682
+ return;
683
+ }
684
+ const manifestPath = writeAgentCompactionReviews(rootDir, resolvedOptions.reviewManifestPath, [...reviewsByRoute.values()]);
685
+ console.log(pc.green(`Recorded ${filteredPages.length} reviewed agent.md page${filteredPages.length === 1 ? "" : "s"} in ${path.relative(rootDir, manifestPath)}.`));
686
+ return;
687
+ }
548
688
  if (resolvedOptions.check) {
549
689
  let fresh = 0;
690
+ let reviewed = 0;
691
+ let reviewInvalid = 0;
550
692
  let stale = 0;
551
693
  let modified = 0;
552
694
  let unknown = 0;
@@ -555,14 +697,18 @@ async function compactAgentDocs(options = {}) {
555
697
  for (const { page, target } of filteredPages) {
556
698
  const state = inspectAgentCompactionState(page, target, resolvedOptions);
557
699
  if (state.status === "fresh") fresh += 1;
700
+ else if (state.status === "reviewed") reviewed += 1;
701
+ else if (state.status === "review-invalid") reviewInvalid += 1;
558
702
  else if (state.status === "stale") stale += 1;
559
703
  else if (state.status === "modified" || state.status === "stale-modified") modified += 1;
560
704
  else if (state.status === "unknown") unknown += 1;
561
705
  else if (state.tokenBudget !== void 0) requiredMissing += 1;
562
706
  else optionalMissing += 1;
563
707
  }
564
- const summary = `${fresh} fresh, ${stale} stale, ${modified} modified, ${unknown} unknown, ${requiredMissing} required missing, and ${optionalMissing} optional missing`;
565
- if (stale > 0 || requiredMissing > 0) throw new Error(`Agent compaction freshness check failed: ${summary}. Run docs agent compact --stale --include-missing, then review generated changes.`);
708
+ const targetRoutes = new Set(filteredPages.map(({ target }) => normalizeUrlPath(target.url)));
709
+ const orphanedReviews = (resolvedOptions.reviewRecords ?? []).filter((review) => !targetRoutes.has(normalizeUrlPath(review.route))).length;
710
+ const summary = `${fresh} fresh, ${reviewed} reviewed, ${reviewInvalid} invalid reviews, ${orphanedReviews} orphaned reviews, ${stale} stale, ${modified} modified, ${unknown} unknown, ${requiredMissing} required missing, and ${optionalMissing} optional missing`;
711
+ if (reviewInvalid > 0 || orphanedReviews > 0 || stale > 0 || requiredMissing > 0) throw new Error(`Agent compaction freshness check failed: ${summary}. Refresh stale output, or re-review intentional agent.md content after inspecting every changed hash.`);
566
712
  console.log(pc.green(`Agent compaction freshness check passed: ${summary}.`));
567
713
  return;
568
714
  }
@@ -581,6 +727,14 @@ async function compactAgentDocs(options = {}) {
581
727
  skippedFresh += 1;
582
728
  continue;
583
729
  }
730
+ if (state.status === "reviewed") {
731
+ skippedFresh += 1;
732
+ continue;
733
+ }
734
+ if (state.status === "review-invalid") {
735
+ skippedModified += 1;
736
+ continue;
737
+ }
584
738
  if (state.status === "modified" || state.status === "stale-modified") {
585
739
  skippedModified += 1;
586
740
  continue;
@@ -633,6 +787,7 @@ ${pc.dim("Examples:")}
633
787
  ${pc.cyan("npx @farming-labs/docs@latest agent compact --stale")}
634
788
  ${pc.cyan("npx @farming-labs/docs@latest agent compact --stale --include-missing")}
635
789
  ${pc.cyan("npx @farming-labs/docs@latest agent compact --check")}
790
+ ${pc.cyan("npx @farming-labs/docs@latest agent compact --review --reviewed-by \"docs-team\" --reason \"Preserve operator guidance\" /docs/configuration")}
636
791
 
637
792
  ${pc.dim("Per-page override:")}
638
793
  Add ${pc.cyan("agent.tokenBudget")} to a page frontmatter block to override the compact output target for that page.
@@ -644,6 +799,10 @@ ${pc.dim("Options:")}
644
799
  ${pc.cyan("--stale")} Re-compact only stale generated agent.md files
645
800
  ${pc.cyan("--include-missing")} With ${pc.cyan("--stale")}, also create missing agent.md files for explicit pages or pages that define ${pc.cyan("agent.tokenBudget")}
646
801
  ${pc.cyan("--check")} Check generated agent.md freshness without an API key, network request, or file write
802
+ ${pc.cyan("--review")} Record hash-bound human review for explicit existing agent.md pages without rewriting them
803
+ ${pc.cyan("--reviewed-by <name>")} Reviewer recorded with ${pc.cyan("--review")}
804
+ ${pc.cyan("--reason <text>")} Review rationale recorded with ${pc.cyan("--review")}
805
+ ${pc.cyan("--review-manifest <path>")} Project-relative review manifest path
647
806
  ${pc.cyan("--config <path>")} Use a custom docs config path instead of ${pc.dim("docs.config.ts[x]")}
648
807
  ${pc.cyan("--api-key <key>")} Use an API key directly; prefer ${pc.dim("cloud.apiKey.env")}
649
808
  ${pc.cyan("--api-key-env <name>")} Env var name for the Docs Cloud API key; prefer ${pc.dim("cloud.apiKey.env")}
@@ -658,4 +817,4 @@ ${pc.dim("Options:")}
658
817
  }
659
818
 
660
819
  //#endregion
661
- export { scanDocsPageTargets as i, compactAgentDocs as n, inspectAgentCompactionState as r, agent_exports as t };
820
+ export { scanDocsPageTargets as a, loadAgentCompactionReviews as i, compactAgentDocs as n, inspectAgentCompactionState as r, agent_exports as t };
@@ -6189,7 +6189,7 @@ function createDocsSitemapResponse({ request, apiRoute, sitemap, entry = "docs",
6189
6189
  });
6190
6190
  const headers = new Headers({
6191
6191
  "Content-Type": format === "xml" ? "application/xml; charset=utf-8" : "text/markdown; charset=utf-8",
6192
- "Cache-Control": "public, max-age=0, must-revalidate",
6192
+ "Cache-Control": "public, max-age=0, s-maxage=3600, stale-while-revalidate=86400",
6193
6193
  ETag: hashString(body)
6194
6194
  });
6195
6195
  const lastModified = newestLastmod(nextManifest.pages);
@@ -1,5 +1,5 @@
1
1
  import { S as upsertPageAgentContractMarkdown, l as stripDocsGeneratedAgentContractMarkers, o as findDocsMarkdownSection } from "./markdown-sections-BKy4labo.mjs";
2
- import { An as normalizeAgentFramework, Dn as agentVersionConstraintGroupsOverlap, Mn as normalizeAgentScopeValues, Nn as normalizeAgentVersion, On as agentVersionConstraintMatches, Qt as buildDocsAskAIContext, dn as normalizeDocsSearchFilters, en as buildDocsRetrievalDigestProjection, fn as performDocsSearch, jn as normalizeAgentLocale, kn as agentVersionConstraintsOverlap, xn as resolveSearchRequestConfig } from "./agent-DCTGj6J7.mjs";
2
+ import { An as normalizeAgentFramework, Dn as agentVersionConstraintGroupsOverlap, Mn as normalizeAgentScopeValues, Nn as normalizeAgentVersion, On as agentVersionConstraintMatches, Qt as buildDocsAskAIContext, dn as normalizeDocsSearchFilters, en as buildDocsRetrievalDigestProjection, fn as performDocsSearch, jn as normalizeAgentLocale, kn as agentVersionConstraintsOverlap, xn as resolveSearchRequestConfig } from "./agent-BDrflLmt.mjs";
3
3
  import { n as digestDocsRetrievalContent } from "./retrieval-digest-B-SgtXKK.mjs";
4
4
  import { t as getDocsAgentSkillsConfiguredPaths } from "./agent-skills-server-Ddbf15pY.mjs";
5
5
  import { buildDocsMcpContext } from "./mcp.mjs";
@@ -841,6 +841,14 @@ function normalizeRuntimeExamples(value, path, issues) {
841
841
  }];
842
842
  });
843
843
  }
844
+ function normalizeRuntimeCoverageExpectation(value, path, issues) {
845
+ if (value === void 0) return void 0;
846
+ if (!isRecord(value)) {
847
+ issues.push(`${path} must be an object.`);
848
+ return {};
849
+ }
850
+ return { executableExamples: normalizeRuntimeEnum(value.executableExamples, `${path}.executableExamples`, issues, ["applicable", "not-applicable"]) };
851
+ }
844
852
  function normalizeGoldenTaskInput(value, index, initialIssues = []) {
845
853
  const issues = [...initialIssues];
846
854
  const path = `tasks[${index}]`;
@@ -882,9 +890,11 @@ function normalizeGoldenTaskInput(value, index, initialIssues = []) {
882
890
  maximum: 1
883
891
  });
884
892
  const examples = normalizeRuntimeExamples(expectation.examples, `${expectPath}.examples`, issues);
893
+ const coverage = normalizeRuntimeCoverageExpectation(expectation.coverage, `${expectPath}.coverage`, issues);
885
894
  const scope = normalizeRuntimeFilters(expectation.scope, `${expectPath}.scope`, issues);
886
895
  const answer = normalizeRuntimeAnswerExpectation(expectation.answer, `${expectPath}.answer`, issues);
887
896
  const safety = normalizeRuntimeSafetyExpectation(expectation.safety, `${expectPath}.safety`, issues);
897
+ if (coverage?.executableExamples === "not-applicable" && examples?.some((example) => resolveExampleVerification(example) === "execute")) issues.push(`${expectPath}.coverage.executableExamples cannot be not-applicable when an example uses verification: execute.`);
888
898
  const forbidden = forbiddenSources ?? [];
889
899
  for (const [name, sources] of [
890
900
  ["relevantSources", relevantSources],
@@ -911,6 +921,7 @@ function normalizeGoldenTaskInput(value, index, initialIssues = []) {
911
921
  maxFirstRelevantRank,
912
922
  minUsefulByteRatio,
913
923
  examples,
924
+ coverage,
914
925
  scope,
915
926
  answer,
916
927
  safety
@@ -2523,6 +2534,7 @@ async function evaluateTask(pages, task, configurationIssues = [], runOptions =
2523
2534
  selection,
2524
2535
  examples,
2525
2536
  usage,
2537
+ coverageApplicability: { executableExamples: task.expect.coverage?.executableExamples ?? "applicable" },
2526
2538
  issues
2527
2539
  };
2528
2540
  }
@@ -2533,11 +2545,14 @@ async function evaluateTask(pages, task, configurationIssues = [], runOptions =
2533
2545
  */
2534
2546
  function buildGoldenEvaluationCoverage(tasks) {
2535
2547
  const totalTaskCount = tasks.length;
2536
- const dimension = (measuredTaskCount) => {
2537
- const coveragePercent = totalTaskCount === 0 ? 0 : Math.round(measuredTaskCount / totalTaskCount * 100);
2548
+ const dimension = (measuredTaskCount, notApplicableTaskCount = 0) => {
2549
+ const applicableTaskCount = totalTaskCount - notApplicableTaskCount;
2550
+ const coveragePercent = totalTaskCount === 0 ? 0 : applicableTaskCount === 0 ? 100 : Math.round(measuredTaskCount / applicableTaskCount * 100);
2538
2551
  return {
2539
- status: measuredTaskCount === 0 ? "unmeasured" : measuredTaskCount === totalTaskCount ? "measured" : "partially-measured",
2552
+ status: totalTaskCount > 0 && applicableTaskCount === 0 ? "not-applicable" : measuredTaskCount === 0 ? "unmeasured" : measuredTaskCount === applicableTaskCount ? "measured" : "partially-measured",
2540
2553
  measuredTaskCount,
2554
+ applicableTaskCount,
2555
+ notApplicableTaskCount,
2541
2556
  totalTaskCount,
2542
2557
  coveragePercent
2543
2558
  };
@@ -2545,15 +2560,19 @@ function buildGoldenEvaluationCoverage(tasks) {
2545
2560
  const dimensions = {
2546
2561
  safety: dimension(tasks.filter((task) => task.safety.cases.length > 0 || task.safety.queryVariants.length > 0).length),
2547
2562
  answerQuality: dimension(tasks.filter((task) => task.answer.expected).length),
2548
- executableExamples: dimension(tasks.filter((task) => task.examples.results.some((result) => result.verification === "execute")).length)
2563
+ executableExamples: dimension(tasks.filter((task) => task.examples.results.some((result) => result.verification === "execute")).length, tasks.filter((task) => task.coverageApplicability.executableExamples === "not-applicable").length)
2549
2564
  };
2550
2565
  const dimensionValues = Object.values(dimensions);
2551
2566
  const measuredTaskDimensions = dimensionValues.reduce((total, value) => total + value.measuredTaskCount, 0);
2567
+ const applicableTaskDimensions = dimensionValues.reduce((total, value) => total + value.applicableTaskCount, 0);
2568
+ const notApplicableTaskDimensions = dimensionValues.reduce((total, value) => total + value.notApplicableTaskCount, 0);
2552
2569
  const totalTaskDimensions = totalTaskCount * dimensionValues.length;
2553
- const coveragePercent = totalTaskDimensions === 0 ? 0 : Math.round(measuredTaskDimensions / totalTaskDimensions * 100);
2570
+ const coveragePercent = totalTaskDimensions === 0 ? 0 : applicableTaskDimensions === 0 ? 100 : Math.round(measuredTaskDimensions / applicableTaskDimensions * 100);
2554
2571
  return {
2555
- status: coveragePercent === 100 ? "measured" : coveragePercent === 0 ? "unmeasured" : "partially-measured",
2572
+ status: totalTaskDimensions > 0 && applicableTaskDimensions === 0 ? "not-applicable" : coveragePercent === 100 ? "measured" : coveragePercent === 0 ? "unmeasured" : "partially-measured",
2556
2573
  measuredTaskDimensions,
2574
+ applicableTaskDimensions,
2575
+ notApplicableTaskDimensions,
2557
2576
  totalTaskDimensions,
2558
2577
  coveragePercent,
2559
2578
  dimensions
@@ -1,14 +1,14 @@
1
1
  import { w as isDocsAgentPageAccessible } from "./markdown-sections-BKy4labo.mjs";
2
- import { A as buildDocsAgentDiscoverySpec, Ft as renderDocsSitemapMarkdown, It as renderDocsSitemapXml, Lt as resolveDocsSitemapConfig, Mt as buildDocsSitemapManifest, S as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, Tt as toDocsMarkdownUrl, a as DEFAULT_AGENT_MD_ROUTE, ar as buildDocsOkfBundle, at as renderDocsLlmsTxt, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, ct as renderDocsSkillDocument, g as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, it as renderDocsAgentsDocument, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, ot as renderDocsMarkdownDocument, sr as resolveDocsOkfConfig, t as DEFAULT_AGENTS_MD_ROUTE, ut as resolveDocsAgentFeedbackConfig, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE, y as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE } from "./agent-DCTGj6J7.mjs";
2
+ import { A as buildDocsAgentDiscoverySpec, Ft as renderDocsSitemapMarkdown, It as renderDocsSitemapXml, Lt as resolveDocsSitemapConfig, Mt as buildDocsSitemapManifest, S as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, Tt as toDocsMarkdownUrl, a as DEFAULT_AGENT_MD_ROUTE, ar as buildDocsOkfBundle, at as renderDocsLlmsTxt, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, ct as renderDocsSkillDocument, g as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, it as renderDocsAgentsDocument, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, ot as renderDocsMarkdownDocument, sr as resolveDocsOkfConfig, t as DEFAULT_AGENTS_MD_ROUTE, ut as resolveDocsAgentFeedbackConfig, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE, y as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE } from "./agent-BDrflLmt.mjs";
3
3
  import { A as buildDocsLegacySkillsIndex, D as buildDocsA2AAgentCard, L as resolveDocsPublishedAgentSkill, O as buildDocsAgentSkillsIndex, V as formatDocsContentDigest, W as resolveDocsHttpDate, a as DEFAULT_A2A_AGENT_CARD_ROUTE, b as DEFAULT_LEGACY_SKILLS_INDEX_ROUTE, f as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, x as DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX } from "./standards-discovery-Bpz90VYq.mjs";
4
- import "./openapi-mcp-DQ3xptKo.mjs";
4
+ import "./openapi-mcp-CFWUsMUr.mjs";
5
5
  import { t as resolveDocsI18n } from "./i18n-B1gJ9EW0.mjs";
6
- import { c as renderDocsRobotsGeneratedBlock, f as upsertDocsRobotsGeneratedBlock, i as DOCS_ROBOTS_GENERATED_BLOCK_START, r as DOCS_ROBOTS_GENERATED_BLOCK_END, u as resolveDocsRobotsConfig } from "./robots-BOjWB1ky.mjs";
7
- import "./sitemap-server-NeVu8W38.mjs";
6
+ import { c as renderDocsRobotsGeneratedBlock, f as upsertDocsRobotsGeneratedBlock, i as DOCS_ROBOTS_GENERATED_BLOCK_START, r as DOCS_ROBOTS_GENERATED_BLOCK_END, u as resolveDocsRobotsConfig } from "./robots-dNbBnlVh.mjs";
7
+ import "./sitemap-server-BKNIqgvq.mjs";
8
8
  import { r as resolveConfiguredAgentSkills } from "./agent-skills-server-Ddbf15pY.mjs";
9
- import "./agent-evals-D-sPJfXz.mjs";
9
+ import "./agent-evals-3m5FXStK.mjs";
10
10
  import { createFilesystemDocsMcpSource, resolveDocsMcpConfig } from "./mcp.mjs";
11
- import "./authoring-mcp-Be7quE5R.mjs";
11
+ import "./authoring-mcp-Wy-h93DM.mjs";
12
12
  import "./code-blocks-D90CCJFs.mjs";
13
13
  import "./server.mjs";
14
14
  import { _ as resolveDocsContentDir, a as loadDocsConfigModule, d as readNavTitle, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, m as readTopLevelBooleanProperty, p as readStringProperty, r as extractTopLevelConfigObject, t as extractNestedObjectLiteral } from "./config-DrZ3fXgf.mjs";
@@ -1,4 +1,4 @@
1
- import { z as DocsPublishedAgentSkill } from "./standards-discovery-Xm84bS4M.mjs";
1
+ import { z as DocsPublishedAgentSkill } from "./standards-discovery-CjyUCxdy.mjs";
2
2
 
3
3
  //#region src/agent-skills-bundle.d.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { lt as DocsAgentSkillsInput } from "./types-QhYMnKvb.mjs";
2
- import { z as DocsPublishedAgentSkill } from "./standards-discovery-Xm84bS4M.mjs";
1
+ import { ut as DocsAgentSkillsInput } from "./types-BkAk6B2d.mjs";
2
+ import { z as DocsPublishedAgentSkill } from "./standards-discovery-CjyUCxdy.mjs";
3
3
 
4
4
  //#region src/agent-skills-server.d.ts
5
5
  interface ResolveConfiguredAgentSkillsOptions {
@@ -1,6 +1,6 @@
1
- import { lt as DocsAgentSkillsInput } from "./types-QhYMnKvb.mjs";
2
- import { z as DocsPublishedAgentSkill } from "./standards-discovery-Xm84bS4M.mjs";
3
- import { t as ResolveConfiguredAgentSkillsOptions } from "./agent-skills-server-D34054x5.mjs";
1
+ import { ut as DocsAgentSkillsInput } from "./types-BkAk6B2d.mjs";
2
+ import { z as DocsPublishedAgentSkill } from "./standards-discovery-CjyUCxdy.mjs";
3
+ import { t as ResolveConfiguredAgentSkillsOptions } from "./agent-skills-server-CF6iVTBR.mjs";
4
4
 
5
5
  //#region src/agent-skills-vite.d.ts
6
6
  declare const DOCS_AGENT_SKILLS_BUNDLE_MODULE = "@farming-labs/docs/agent-skills-bundle";
@@ -1,12 +1,12 @@
1
1
  import "./markdown-sections-BKy4labo.mjs";
2
- import { a as DEFAULT_AGENT_MD_ROUTE, it as renderDocsAgentsDocument, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, ut as resolveDocsAgentFeedbackConfig } from "./agent-DCTGj6J7.mjs";
2
+ import { a as DEFAULT_AGENT_MD_ROUTE, it as renderDocsAgentsDocument, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, ut as resolveDocsAgentFeedbackConfig } from "./agent-BDrflLmt.mjs";
3
3
  import "./standards-discovery-Bpz90VYq.mjs";
4
- import "./openapi-mcp-DQ3xptKo.mjs";
5
- import { C as resolveApiReferenceOpenApiDiscovery } from "./sitemap-server-NeVu8W38.mjs";
4
+ import "./openapi-mcp-CFWUsMUr.mjs";
5
+ import { C as resolveApiReferenceOpenApiDiscovery } from "./sitemap-server-BKNIqgvq.mjs";
6
6
  import "./agent-skills-server-Ddbf15pY.mjs";
7
- import "./agent-evals-D-sPJfXz.mjs";
7
+ import "./agent-evals-3m5FXStK.mjs";
8
8
  import { resolveDocsMcpConfig } from "./mcp.mjs";
9
- import "./authoring-mcp-Be7quE5R.mjs";
9
+ import "./authoring-mcp-Wy-h93DM.mjs";
10
10
  import "./code-blocks-D90CCJFs.mjs";
11
11
  import "./server.mjs";
12
12
  import { a as loadDocsConfigModule, d as readNavTitle, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, p as readStringProperty, t as extractNestedObjectLiteral } from "./config-DrZ3fXgf.mjs";
@@ -1,4 +1,4 @@
1
- import { dt as DocsAgentTraceEventInput, fn as DocsObservabilityConfig, gt as DocsAnalyticsEventInput, ht as DocsAnalyticsEvent, mn as DocsObservabilityEventInput, mt as DocsAnalyticsConfig, pn as DocsObservabilityEvent } from "./types-QhYMnKvb.mjs";
1
+ import { _t as DocsAnalyticsEventInput, ft as DocsAgentTraceEventInput, gt as DocsAnalyticsEvent, hn as DocsObservabilityEventInput, ht as DocsAnalyticsConfig, mn as DocsObservabilityEvent, pn as DocsObservabilityConfig } from "./types-BkAk6B2d.mjs";
2
2
 
3
3
  //#region src/analytics.d.ts
4
4
  declare const DOCS_AGENT_TRACE_EVENT_TYPES: readonly ["run.start", "run.end", "run.error", "user.input", "prompt.build", "retrieval.query", "retrieval.result", "retrieval.error", "model.call", "model.response", "model.stream", "model.error", "tool.call", "tool.result", "tool.error", "retry", "timeout", "error", "agent.final"];
@@ -1,8 +1,8 @@
1
1
  import "./markdown-sections-BKy4labo.mjs";
2
- import "./agent-DCTGj6J7.mjs";
2
+ import "./agent-BDrflLmt.mjs";
3
3
  import "./standards-discovery-Bpz90VYq.mjs";
4
- import "./openapi-mcp-DQ3xptKo.mjs";
5
- import { r as runDocsAuthoringMcpStdio } from "./authoring-mcp-Be7quE5R.mjs";
4
+ import "./openapi-mcp-CFWUsMUr.mjs";
5
+ import { r as runDocsAuthoringMcpStdio } from "./authoring-mcp-Wy-h93DM.mjs";
6
6
  import { _ as resolveDocsContentDir, d as readNavTitle, g as resolveDocsConfigPath, o as loadDocsConfigModuleResult, p as readStringProperty } from "./config-DrZ3fXgf.mjs";
7
7
  import { readFileSync } from "node:fs";
8
8
  import path from "node:path";
@@ -1,4 +1,4 @@
1
- import { ot as renderDocsMarkdownDocument } from "./agent-DCTGj6J7.mjs";
1
+ import { ot as renderDocsMarkdownDocument } from "./agent-BDrflLmt.mjs";
2
2
  import { createFilesystemDocsMcpSource } from "./mcp.mjs";
3
3
  import { n as analyzeDocsAgentFeedback, r as readDocsAgentFeedbackFile } from "./agent-feedback-loop-vaC-M1sx.mjs";
4
4
  import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
@@ -1,4 +1,4 @@
1
- import { c as emitDocsAnalyticsEvent, d as resolveDocsAnalyticsConfig } from "./analytics-aeXwEvQX.mjs";
2
- import { t as applySidebarFolderIndexBehavior } from "./sidebar-CJze8SBi.mjs";
1
+ import { c as emitDocsAnalyticsEvent, d as resolveDocsAnalyticsConfig } from "./analytics-CwXxM9oL.mjs";
2
+ import { t as applySidebarFolderIndexBehavior } from "./sidebar-Bne72SU-.mjs";
3
3
  import { n as resolveDocsAudienceExposure, t as DocsContentAudience } from "./audience-exposure-CkNZNeVX.mjs";
4
4
  export { type DocsContentAudience, applySidebarFolderIndexBehavior, emitDocsAnalyticsEvent, resolveDocsAnalyticsConfig, resolveDocsAudienceExposure };