@agentskit/doc-bridge 1.10.1 → 1.11.1

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 (43) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +8 -4
  3. package/action.yml +1 -1
  4. package/dist/cli/program.js +111 -6
  5. package/dist/cli/program.js.map +1 -1
  6. package/dist/config/index.d.ts +1 -1
  7. package/dist/config/index.js +2 -0
  8. package/dist/config/index.js.map +1 -1
  9. package/dist/{index-7wYGbllW.d.ts → index-CimDq6_e.d.ts} +2 -0
  10. package/dist/index.d.ts +51 -5
  11. package/dist/index.js +98 -4
  12. package/dist/index.js.map +1 -1
  13. package/docs/agent-corpus/audit.md +25 -0
  14. package/docs/agent-corpus/bin.md +26 -0
  15. package/docs/agent-corpus/budget.md +26 -0
  16. package/docs/agent-corpus/config.md +33 -0
  17. package/docs/agent-corpus/federation.md +25 -0
  18. package/docs/agent-corpus/findings.md +25 -0
  19. package/docs/agent-corpus/fixes.md +25 -0
  20. package/docs/agent-corpus/lib.md +29 -0
  21. package/docs/agent-corpus/metrics.md +26 -0
  22. package/docs/agent-corpus/parity.md +33 -0
  23. package/docs/agent-corpus/playbook.md +22 -0
  24. package/docs/agent-corpus/plugins.md +23 -0
  25. package/docs/agent-corpus/report.md +27 -0
  26. package/docs/agent-corpus/retrieval.md +33 -0
  27. package/docs/agent-corpus/rules.md +30 -0
  28. package/docs/agent-corpus/safety.md +23 -0
  29. package/docs/agent-corpus/schemas.md +34 -0
  30. package/docs/agent-corpus/scripts.md +29 -0
  31. package/docs/agent-corpus/shims.md +26 -0
  32. package/docs/parity/public-claims-v1.json +18 -1
  33. package/docs/spec/config-v1.md +23 -1
  34. package/mcpb/manifest.json +1 -1
  35. package/package.json +2 -2
  36. package/skills/doc-bridge-handoff/scripts/resolve-handoff.mjs +1 -1
  37. package/src/cli/program.ts +23 -2
  38. package/src/config/schema.ts +2 -0
  39. package/src/discovery/reproducibility.ts +118 -0
  40. package/src/doctor/run-doctor.ts +24 -0
  41. package/src/gates/run-gates.ts +44 -0
  42. package/src/index.ts +5 -0
  43. package/src/version.ts +1 -1
package/dist/index.js CHANGED
@@ -161,6 +161,7 @@ var GatesConfigSchema = z.object({
161
161
  include: z.array(
162
162
  z.enum([
163
163
  "index-freshness",
164
+ "index-reproducible",
164
165
  "human-guide-links",
165
166
  "link-rot",
166
167
  "okf-type",
@@ -173,6 +174,7 @@ var GatesConfigSchema = z.object({
173
174
  exclude: z.array(
174
175
  z.enum([
175
176
  "index-freshness",
177
+ "index-reproducible",
176
178
  "human-guide-links",
177
179
  "link-rot",
178
180
  "okf-type",
@@ -4398,7 +4400,7 @@ var buildLookup = (config, packages, corpus, indexOutFile, humanDocs = {}, root
4398
4400
  };
4399
4401
 
4400
4402
  // src/version.ts
4401
- var PACKAGE_VERSION = "1.10.1";
4403
+ var PACKAGE_VERSION = "1.11.1";
4402
4404
 
4403
4405
  // src/index-builder/capabilities.ts
4404
4406
  var renderCapabilitiesJson = (config, index, paths) => {
@@ -7081,6 +7083,50 @@ var buildDocBridgeIndex = (opts) => {
7081
7083
  };
7082
7084
  };
7083
7085
 
7086
+ // src/discovery/reproducibility.ts
7087
+ import { execFileSync as execFileSync2 } from "child_process";
7088
+ var NOT_CHECKED = (skipped) => ({
7089
+ checked: false,
7090
+ skipped,
7091
+ ignored: []
7092
+ });
7093
+ var git = (root, args, options = {}) => {
7094
+ try {
7095
+ return execFileSync2("git", args, {
7096
+ cwd: root,
7097
+ encoding: "utf8",
7098
+ stdio: ["pipe", "pipe", "ignore"],
7099
+ maxBuffer: 64 * 1024 * 1024,
7100
+ ...options.input === void 0 ? {} : { input: options.input }
7101
+ });
7102
+ } catch (error) {
7103
+ const status = error.status;
7104
+ if (options.allowExit1 && status === 1) return error.stdout ?? "";
7105
+ return void 0;
7106
+ }
7107
+ };
7108
+ var checkIndexReproducibility = (root, indexPath, paths) => {
7109
+ if (git(root, ["rev-parse", "--is-inside-work-tree"]) === void 0) return NOT_CHECKED("no-git");
7110
+ if (git(root, ["ls-files", "--error-unmatch", "--", indexPath]) === void 0) {
7111
+ return NOT_CHECKED("index-untracked");
7112
+ }
7113
+ if (paths.length === 0) return { checked: true, ignored: [] };
7114
+ const unique3 = [...new Set(paths)].sort();
7115
+ const output = git(root, ["check-ignore", "--verbose", "-z", "--stdin"], {
7116
+ input: `${unique3.join("\0")}\0`,
7117
+ allowExit1: true
7118
+ });
7119
+ if (output === void 0) return NOT_CHECKED("no-git");
7120
+ const fields = output.split("\0");
7121
+ const ignored = [];
7122
+ for (let index = 0; index + 3 < fields.length; index += 4) {
7123
+ const [source, line, pattern, path] = [fields[index], fields[index + 1], fields[index + 2], fields[index + 3]];
7124
+ if (!path || pattern?.startsWith("!")) continue;
7125
+ ignored.push({ path, rule: `${source ?? "?"}:${line ?? "?"}:${pattern ?? "?"}` });
7126
+ }
7127
+ return { checked: true, ignored: ignored.sort((left, right) => left.path.localeCompare(right.path)) };
7128
+ };
7129
+
7084
7130
  // src/retrieval/rank.ts
7085
7131
  var BM25_SCALE = 50;
7086
7132
  var EXACT_ID = 200;
@@ -11047,6 +11093,38 @@ var runGate = (root, config, id) => {
11047
11093
  if (id === "human-guide-links") return runHumanGuideLinksGate(root, config);
11048
11094
  if (id === "okf-type") return runOkfTypeGate(root, config);
11049
11095
  if (id === "docs-style") return runDocsStyleGate(root, config);
11096
+ if (id === "index-reproducible") {
11097
+ let index;
11098
+ try {
11099
+ index = loadDocBridgeIndex(root, config);
11100
+ } catch (error) {
11101
+ if (error instanceof IndexNotFoundError) return { id, ok: false, message: error.message };
11102
+ throw error;
11103
+ }
11104
+ const result = checkIndexReproducibility(
11105
+ root,
11106
+ config.index?.outFile ?? ".doc-bridge/index.json",
11107
+ index.knowledge.map((entry) => entry.path)
11108
+ );
11109
+ if (!result.checked) {
11110
+ return {
11111
+ id,
11112
+ ok: true,
11113
+ message: result.skipped === "index-untracked" ? "Index is not committed, so nothing has to reproduce it" : "Not a Git checkout; reproducibility was not checked"
11114
+ };
11115
+ }
11116
+ if (result.ignored.length === 0) {
11117
+ return { id, ok: true, message: "Every indexed path is committed" };
11118
+ }
11119
+ const sample = result.ignored.slice(0, 5).map((entry) => `${entry.path} (${entry.rule})`);
11120
+ return {
11121
+ id,
11122
+ ok: false,
11123
+ message: `${result.ignored.length} indexed path(s) are ignored by Git, so a clean checkout builds a different index. Add them to safety.exclude.`,
11124
+ expected: "every indexed path is committed",
11125
+ actual: sample.join(", ")
11126
+ };
11127
+ }
11050
11128
  if (id !== "index-freshness") throw new Error(`Unsupported gate "${id}"`);
11051
11129
  let current;
11052
11130
  try {
@@ -13290,6 +13368,16 @@ var buildIssues = (coverage) => {
13290
13368
  action: "ak-docs index"
13291
13369
  });
13292
13370
  }
13371
+ const { ignored } = coverage.reproducibility;
13372
+ if (ignored.length > 0) {
13373
+ const sample = ignored.slice(0, 5).map((entry) => `${entry.path} (${entry.rule})`);
13374
+ issues.push({
13375
+ severity: "warn",
13376
+ code: "index-not-reproducible",
13377
+ message: `${ignored.length} indexed path(s) are ignored by Git, so a clean checkout builds a different index: ${sample.join(", ")}${ignored.length > sample.length ? `, and ${ignored.length - sample.length} more` : ""}.`,
13378
+ action: "edit doc-bridge.config.json # add the generated paths to safety.exclude"
13379
+ });
13380
+ }
13293
13381
  for (const id of coverage.packages.missingAgentDoc) {
13294
13382
  issues.push({
13295
13383
  severity: "warn",
@@ -13427,7 +13515,12 @@ var runDoctor = (root, config) => {
13427
13515
  message: freshnessMessage,
13428
13516
  hasIndex
13429
13517
  },
13430
- gates
13518
+ gates,
13519
+ reproducibility: checkIndexReproducibility(
13520
+ root,
13521
+ config.index?.outFile ?? ".doc-bridge/index.json",
13522
+ index.knowledge.map((entry) => entry.path)
13523
+ )
13431
13524
  };
13432
13525
  const issues = buildIssues(coverage);
13433
13526
  const score = computeScore(coverage);
@@ -13624,7 +13717,7 @@ var evaluateQualityScorecard = (input) => {
13624
13717
  };
13625
13718
 
13626
13719
  // src/memory/github-pr.ts
13627
- import { execFileSync as execFileSync2, spawnSync } from "child_process";
13720
+ import { execFileSync as execFileSync3, spawnSync } from "child_process";
13628
13721
  import { existsSync as existsSync21, mkdirSync as mkdirSync8, writeFileSync as writeFileSync9 } from "fs";
13629
13722
  import { join as join19 } from "path";
13630
13723
  var run = (cmd, args, cwd) => {
@@ -13751,7 +13844,7 @@ ${auth.out}`
13751
13844
  ];
13752
13845
  let prUrl = "";
13753
13846
  try {
13754
- prUrl = execFileSync2("gh", prArgs, { cwd: root, encoding: "utf8" }).trim();
13847
+ prUrl = execFileSync3("gh", prArgs, { cwd: root, encoding: "utf8" }).trim();
13755
13848
  } catch (error) {
13756
13849
  const message = error instanceof Error ? error.message : String(error);
13757
13850
  return {
@@ -17625,6 +17718,7 @@ export {
17625
17718
  canonicality,
17626
17719
  centrality,
17627
17720
  changeDigestView,
17721
+ checkIndexReproducibility,
17628
17722
  checkPublicParity,
17629
17723
  checkStudyExpectations,
17630
17724
  chunksFromMarkdown,