@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.
- package/CHANGELOG.md +52 -0
- package/README.md +8 -4
- package/action.yml +1 -1
- package/dist/cli/program.js +111 -6
- package/dist/cli/program.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -1
- package/dist/{index-7wYGbllW.d.ts → index-CimDq6_e.d.ts} +2 -0
- package/dist/index.d.ts +51 -5
- package/dist/index.js +98 -4
- package/dist/index.js.map +1 -1
- package/docs/agent-corpus/audit.md +25 -0
- package/docs/agent-corpus/bin.md +26 -0
- package/docs/agent-corpus/budget.md +26 -0
- package/docs/agent-corpus/config.md +33 -0
- package/docs/agent-corpus/federation.md +25 -0
- package/docs/agent-corpus/findings.md +25 -0
- package/docs/agent-corpus/fixes.md +25 -0
- package/docs/agent-corpus/lib.md +29 -0
- package/docs/agent-corpus/metrics.md +26 -0
- package/docs/agent-corpus/parity.md +33 -0
- package/docs/agent-corpus/playbook.md +22 -0
- package/docs/agent-corpus/plugins.md +23 -0
- package/docs/agent-corpus/report.md +27 -0
- package/docs/agent-corpus/retrieval.md +33 -0
- package/docs/agent-corpus/rules.md +30 -0
- package/docs/agent-corpus/safety.md +23 -0
- package/docs/agent-corpus/schemas.md +34 -0
- package/docs/agent-corpus/scripts.md +29 -0
- package/docs/agent-corpus/shims.md +26 -0
- package/docs/parity/public-claims-v1.json +18 -1
- package/docs/spec/config-v1.md +23 -1
- package/mcpb/manifest.json +1 -1
- package/package.json +2 -2
- package/skills/doc-bridge-handoff/scripts/resolve-handoff.mjs +1 -1
- package/src/cli/program.ts +23 -2
- package/src/config/schema.ts +2 -0
- package/src/discovery/reproducibility.ts +118 -0
- package/src/doctor/run-doctor.ts +24 -0
- package/src/gates/run-gates.ts +44 -0
- package/src/index.ts +5 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-audit
|
|
4
|
+
editRoot: src/audit
|
|
5
|
+
humanDoc: /docs/spec/documentation-standard-v1
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/audit
|
|
9
|
+
validationPath: pnpm test && node bin/ak-docs.js audit documentation --json
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/audit
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Audit
|
|
16
|
+
|
|
17
|
+
Owns deterministic documentation quality, coverage, and structural validation. Every finding maps to code evidence.
|
|
18
|
+
|
|
19
|
+
`auditDocumentation` ingests a `DiscoverySnapshotV1`, declared snapshot, `ReconciliationReportV1`, and audit config,
|
|
20
|
+
then produces a `DocumentationAuditReportV1` with findings categorized as quality, coverage, structure-gap, contradiction,
|
|
21
|
+
stale, redundancy, generated-freshness, or limitation. It validates document metadata (owner, lifecycle, source-of-truth,
|
|
22
|
+
validation-path), checks for title and example presence, verifies generated region integrity against stored hashes,
|
|
23
|
+
detects exact content duplicates, and maps reconciliation diagnostics into audit findings. Coverage is measured against
|
|
24
|
+
packages (or areas in single-package repositories). Generated documents receive freshness-boundary checking only;
|
|
25
|
+
their semantic proof comes from their generation commands, not this audit.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-bin
|
|
4
|
+
editRoot: bin
|
|
5
|
+
humanDoc: /docs/spec/cli
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: bin
|
|
9
|
+
validationPath: pnpm test && pnpm smoke:packaged
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:bin
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Entry points
|
|
16
|
+
|
|
17
|
+
Owns the two executables `package.json` publishes, and nothing else. Both are deliberately thin: logic
|
|
18
|
+
belongs in `src`, where it is typechecked and tested.
|
|
19
|
+
|
|
20
|
+
`ak-docs.js` imports `runCli` from **`../dist/cli/program.js`** — the built output, not the source — and
|
|
21
|
+
sets `process.exitCode` from what it returns, awaiting it when it is a promise. Running from `dist` is
|
|
22
|
+
why `scripts/prepare.mjs` has to build on a git install; a change here that reaches into `src` would
|
|
23
|
+
break the published package.
|
|
24
|
+
|
|
25
|
+
`ak-verify.js` resolves the `@agentskit/harness` CLI through `import.meta.resolve` and spawns it as a
|
|
26
|
+
child process with inherited stdio, so the harness owns its own output and exit code.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-budget
|
|
4
|
+
editRoot: src/budget
|
|
5
|
+
humanDoc: /docs/spec/config-v1
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/budget
|
|
9
|
+
validationPath: pnpm test && pnpm typecheck
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/budget
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Budget
|
|
16
|
+
|
|
17
|
+
Owns token counting and message trimming under a budget, mirroring `@agentskit/core` algorithms
|
|
18
|
+
synchronously for MCP handlers.
|
|
19
|
+
|
|
20
|
+
`compileBudget` drops oldest messages until the remainder fits a budget, keeping at least one
|
|
21
|
+
recent message. The `approximateCounter` uses the four-characters-per-token rule and stays
|
|
22
|
+
deterministic. `applyBudget` splits a payload into named sections, each costing one message,
|
|
23
|
+
and drops sections front-to-back until the trimmed payload fits a token budget, reporting what
|
|
24
|
+
was dropped and whether it all fit. Every call over the same payload and budget produces the
|
|
25
|
+
same report.
|
|
26
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-config
|
|
4
|
+
editRoot: src/config
|
|
5
|
+
humanDoc: /docs/spec/config-v1
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/config
|
|
9
|
+
validationPath: pnpm test && pnpm typecheck
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/config
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Config
|
|
16
|
+
|
|
17
|
+
Owns finding, parsing, validating and defaulting the repository's configuration, and the enums every
|
|
18
|
+
other area validates against.
|
|
19
|
+
|
|
20
|
+
`loadConfig` walks up from a start directory for the first `doc-bridge.config.{ts,js,mjs,json}`, or a
|
|
21
|
+
`package.json` carrying a `docBridge` key. A `.ts`/`.js` config is read as a **static object literal**
|
|
22
|
+
through `parseStaticJsObject` — nothing is executed, so a config that computes its value at runtime
|
|
23
|
+
will not load. `doc-bridge.config.yaml` is in the candidate list but rejected on purpose: the loader
|
|
24
|
+
throws `YAML config is not supported yet`. Do not document YAML as a supported format.
|
|
25
|
+
|
|
26
|
+
Input is validated by `DocBridgeConfigV1Schema`, then `applyConfigDefaults` fills what the caller left
|
|
27
|
+
out — corpus `include`/`exclude`, `index.outFile` of `.doc-bridge/index.json`, `contentHash` of
|
|
28
|
+
`sha256-normalized-v1`, the llms.txt and capabilities outputs, `gates.preset` of `minimal` and
|
|
29
|
+
`rules.mode` of `default`.
|
|
30
|
+
|
|
31
|
+
`schema.ts` is also where `RuleIdSchema` and the gate id enums live, so adding a gate or a rule means
|
|
32
|
+
editing this area as well as the one that implements it. `resolveProjectRoot` climbs at most twelve
|
|
33
|
+
levels and falls back to the directory it started from rather than failing.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-federation
|
|
4
|
+
editRoot: src/federation
|
|
5
|
+
humanDoc: /docs/spec/config-v1
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/federation
|
|
9
|
+
validationPath: pnpm test && pnpm typecheck
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/federation
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Federation
|
|
16
|
+
|
|
17
|
+
Owns loading external llms.txt sources, parsing chunks from remote and local markdown, scoring
|
|
18
|
+
them against queries, and formatting ecosystem product blocks for federation.
|
|
19
|
+
|
|
20
|
+
`loadFederatedChunks` fetches llms.txt sources from configuration, parses markdown sections into
|
|
21
|
+
searchable chunks, and follows same-origin links to collect more content. `retrieveHybridChunks`
|
|
22
|
+
merges local retrieval results and federated chunks, deduplicating by key and re-ranking by
|
|
23
|
+
query relevance. `parseLlmsTxtLinks` extracts markdown links and bare URLs from prose. The
|
|
24
|
+
ecosystem formatter generates a canonical markdown block for llms.txt sections across products.
|
|
25
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-findings
|
|
4
|
+
editRoot: src/findings
|
|
5
|
+
humanDoc: /docs/spec/documentation-standard-v1
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/findings
|
|
9
|
+
validationPath: pnpm test && pnpm typecheck
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/findings
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Findings
|
|
16
|
+
|
|
17
|
+
Owns normalizing internal diagnostics to the ecosystem `Finding` shape. Severity and confidence remain independent.
|
|
18
|
+
|
|
19
|
+
`findingFromDiagnostic` and `findingsFromDiagnostics` convert `KnowledgeDiagnostic`, `RuleFinding`, and
|
|
20
|
+
`DocumentationAuditFinding` into a canonical shape that Code Review, dashboards, and language-model integrations
|
|
21
|
+
consume without their own parser. Internal severities (error, warn, info, off) map to ecosystem levels
|
|
22
|
+
(high, medium, low, info); critical is never emitted, since documentation findings do not interrupt production.
|
|
23
|
+
Confidence derives from finding status: confirmed and undocumented are high-confidence; conflicts and unresolved
|
|
24
|
+
are medium; stale or unverified are low; not-analyzed is lowest. Each Finding carries evidence path and line,
|
|
25
|
+
remediation text, and source diagnostic code for traceability.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-fixes
|
|
4
|
+
editRoot: src/fixes
|
|
5
|
+
humanDoc: /docs/POSITIONING
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/fixes
|
|
9
|
+
validationPath: pnpm test && pnpm typecheck
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/fixes
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Fixes
|
|
16
|
+
|
|
17
|
+
Owns proposing and applying fix proposals with approval gates and integrity verification.
|
|
18
|
+
|
|
19
|
+
`createMarkdownLinkFixProposal` and `createArtifactNormalizationProposal` generate `FixProposalV1` instances
|
|
20
|
+
from detected issues: broken markdown links and JSON formatting. A proposal captures the base revision, affected
|
|
21
|
+
file hashes, unified diffs, and pre/postconditions. `approveFixProposal` binds approval identity and timestamp
|
|
22
|
+
to a proposal; `applyFixProposal` verifies the proposal content matches its approval, checks that affected
|
|
23
|
+
files have not changed, writes atomically to temp files, and renames into place, or rolls back all changes on
|
|
24
|
+
failure. The proposal always remains advisory: applications require explicit human or policy approval before
|
|
25
|
+
execution, never automatic.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-lib
|
|
4
|
+
editRoot: src/lib
|
|
5
|
+
humanDoc: /docs/POSITIONING
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/lib
|
|
9
|
+
validationPath: pnpm test && pnpm typecheck
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/lib
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Lib
|
|
16
|
+
|
|
17
|
+
Owns the small shared helpers the rest of the tree depends on. Nothing here reaches back into a feature
|
|
18
|
+
area, which is what keeps it importable from anywhere.
|
|
19
|
+
|
|
20
|
+
`bounded-text.ts` caps reads at `MAX_DOCUMENT_BYTES` (4 MiB) per file and `MAX_CORPUS_BYTES` (64 MiB)
|
|
21
|
+
per corpus, both overridable per call — the budget is enforced while reading, not checked afterwards.
|
|
22
|
+
`static-js-literal.ts` exports `parseStaticJsObject`, which is how a `.ts`/`.js` config becomes an
|
|
23
|
+
object without being executed; comment stripping is a step inside it, not its purpose.
|
|
24
|
+
|
|
25
|
+
`fuzzy-match.ts` implements Jaro-Winkler mirrored from `@agentskit/core` rather than imported, so
|
|
26
|
+
discovery stays synchronous and never loads an optional peer. `paths.ts` normalises to POSIX and checks
|
|
27
|
+
containment within the project root; `walk.ts` traverses by extension; `glob-expand.ts` turns workspace
|
|
28
|
+
globs into directories; `markdown.ts` reads frontmatter; `package-manager.ts` detects the package
|
|
29
|
+
manager from lockfiles and builds the matching check commands.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-metrics
|
|
4
|
+
editRoot: src/metrics
|
|
5
|
+
humanDoc: /docs/query
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/metrics
|
|
9
|
+
validationPath: pnpm test && pnpm typecheck
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/metrics
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Metrics
|
|
16
|
+
|
|
17
|
+
Owns benchmark measurement for entity, relation, and finding precision and recall, and efficiency
|
|
18
|
+
metrics for agent latency, response bytes, and tokens.
|
|
19
|
+
|
|
20
|
+
`measureBenchmark` compares observations against a fixture of supported and excluded items,
|
|
21
|
+
counts true positives, false positives and negatives per category, and reports regressions when
|
|
22
|
+
precision or recall falls below thresholds. `measureAgentEfficiency` calculates hit rate, latency
|
|
23
|
+
percentiles, and response compression ratio from query runs. `measureAgentTaskEfficiency` tracks
|
|
24
|
+
per-task correctness and resource cost. `compareBenchmarkSnapshots` diffs two snapshots by
|
|
25
|
+
classification state.
|
|
26
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-parity
|
|
4
|
+
editRoot: src/parity
|
|
5
|
+
humanDoc: /docs/RELEASE
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/parity
|
|
9
|
+
validationPath: pnpm test && pnpm typecheck
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/parity
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Parity
|
|
16
|
+
|
|
17
|
+
Owns detecting when public sentences have drifted from repository facts and reporting findings
|
|
18
|
+
with remediation.
|
|
19
|
+
|
|
20
|
+
A `PublicClaim` binds a sentence to a canonical value by naming where the value lives (`evidence`),
|
|
21
|
+
how it appears in prose (`template`), and which surfaces must carry it. Evidence kinds are
|
|
22
|
+
`package-field`, `artifact-field`, `artifact-sum`, `snapshot-count`, `doctor-metric`, and
|
|
23
|
+
`cli-command`. The registry carries its own `contentHash` over everything but that field, so a claim cannot be
|
|
24
|
+
edited without resealing it.
|
|
25
|
+
`checkPublicParity` compares what public surfaces state against what the registry resolves, reporting
|
|
26
|
+
`PARITY_STALE` when a surface states a moved value, `PARITY_MISSING` when a surface omits a claim,
|
|
27
|
+
and `PARITY_CONTRADICTION` when two surfaces disagree.
|
|
28
|
+
|
|
29
|
+
The eight claims are keyed by `claimId`: `study-token-reduction`, `study-token-pairs`,
|
|
30
|
+
`study-completion-bridge`, `study-completion-baseline`, `study-latency-p95`, `study-executions`,
|
|
31
|
+
`cli-parity-command` and `checked-in-package-version`. Six resolve from an artifact field, one sums a
|
|
32
|
+
field across artifacts, and one runs a CLI command.
|
|
33
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-playbook
|
|
4
|
+
editRoot: src/playbook
|
|
5
|
+
humanDoc: /docs/playbook/doc-bridge-pattern
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/playbook
|
|
9
|
+
validationPath: pnpm test && node bin/ak-docs.js index
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/playbook
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Playbook
|
|
16
|
+
|
|
17
|
+
Owns the Doc Bridge Pattern playbook content and metadata. Exports `DOC_BRIDGE_PATTERN_META`
|
|
18
|
+
with pattern id, title, slug, license (CC-BY-4.0), and links to the public playbook URL and
|
|
19
|
+
npm package. `docBridgePatternMarkdown()` generates the pattern description — problem, solution
|
|
20
|
+
with three artifacts (AgentHandoff, DocBridgeIndex, self-describe), four operational loops
|
|
21
|
+
(act, bridge, learn, explain), MCP contract, CI gate, coverage metrics, and use-case guidance.
|
|
22
|
+
`docBridgePatternPayload()` returns the complete pattern object for registration.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-plugins
|
|
4
|
+
editRoot: src/plugins
|
|
5
|
+
humanDoc: /docs/spec/config-v1
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/plugins
|
|
9
|
+
validationPath: pnpm test && node bin/ak-docs.js index
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/plugins
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Plugins
|
|
16
|
+
|
|
17
|
+
Owns the analyzer plugin contract and registry. `AnalyzerPluginManifestSchema` defines a plugin's
|
|
18
|
+
identity, languages, frameworks, capabilities, and resource limits. `AnalyzerPluginOutputSchema`
|
|
19
|
+
validates entities, relations, coverage, and diagnostics. `createAnalyzerRegistry` registers
|
|
20
|
+
plugins and routes `analyze` calls; it enforces pipeline major version compatibility, detects
|
|
21
|
+
resource overruns (file count, byte size), and catches plugin failures gracefully — returning
|
|
22
|
+
a coverage entry with failure reason rather than throwing. Output coverage records always
|
|
23
|
+
include the analyzer id and version.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-report
|
|
4
|
+
editRoot: src/report
|
|
5
|
+
humanDoc: /docs/for-agents
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/report
|
|
9
|
+
validationPath: pnpm test && pnpm typecheck
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/report
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Report
|
|
16
|
+
|
|
17
|
+
Owns the offline HTML report: a snapshot and its reconciliation rendered into something a person can
|
|
18
|
+
open without a server, an index, or the CLI. One file, `html.ts`.
|
|
19
|
+
|
|
20
|
+
The exported surface is `renderOfflineReport` and `renderOfflineReportArtifact`, taking
|
|
21
|
+
`OfflineReportInput` and `OfflineReportOptions` and returning an `OfflineReportArtifact` — a single
|
|
22
|
+
self-contained page, or a directory of files with a manifest for an artifact store. The view model it
|
|
23
|
+
renders from is built internally and is not part of the API; the artifact shape is.
|
|
24
|
+
|
|
25
|
+
Options cover privacy (private and anonymised modes) and whether snippets are embedded, because a
|
|
26
|
+
report is the one output likely to leave the repository and land in a CI artifact or a ticket. Large
|
|
27
|
+
graphs are chunked per group and package so the page stays openable.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-retrieval
|
|
4
|
+
editRoot: src/retrieval
|
|
5
|
+
humanDoc: /docs/query
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/retrieval
|
|
9
|
+
validationPath: pnpm test && node bin/ak-docs.js index
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/retrieval
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Retrieval
|
|
16
|
+
|
|
17
|
+
Owns the projection from a discovery snapshot to the sealed retrieval index, and the ranking over it.
|
|
18
|
+
|
|
19
|
+
`projectRetrievalIndex` is the only writer of `RetrievalIndexV1`. It seals over **what the snapshot
|
|
20
|
+
observed** — `pipelineVersion`, `analyzerVersions`, entities and relations, hashed by
|
|
21
|
+
`snapshotObservationHash` — and never over the revision the snapshot was taken at. `snapshotHash`
|
|
22
|
+
survives in the projection as provenance only; reading it as a seal input is what made a committed
|
|
23
|
+
index go stale the moment it landed, fixed in 1.10.1 by bumping `RETRIEVAL_PROJECTION_VERSION` to 2.
|
|
24
|
+
|
|
25
|
+
Each area and module carries `graph.coveredBy` and `graph.mentionedBy`, built from the `covers`,
|
|
26
|
+
`mentions` and `mentions-symbol` relations pointing into it. The doctor reads exactly those two
|
|
27
|
+
lists to decide whether an area is documented, so a document earns connectivity by declaring an
|
|
28
|
+
edge, never by sitting in the corpus.
|
|
29
|
+
|
|
30
|
+
Ranking is deterministic: `bm25.ts` builds a field-weighted BM25 index at `BM25_VERSION`, `rank.ts`
|
|
31
|
+
scores an entry from named components and returns a `RankExplanation` for every hit, and
|
|
32
|
+
`weights.ts` holds the shares those components divide. A hit below `RELEVANCE_FLOOR` is dropped
|
|
33
|
+
rather than returned with a low score, so the benchmark measures answers, not near-misses.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-rules
|
|
4
|
+
editRoot: src/rules
|
|
5
|
+
humanDoc: /docs/spec/documentation-standard-v1
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/rules
|
|
9
|
+
validationPath: pnpm test && pnpm typecheck
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/rules
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Rules
|
|
16
|
+
|
|
17
|
+
Owns turning reconciliation diagnostics into severity-carrying findings. One file, `engine.ts`.
|
|
18
|
+
|
|
19
|
+
`evaluateRules` maps a diagnostic code to a rule id through `diagnosticRules` and gives it a severity.
|
|
20
|
+
The eleven rule ids are defined by `RuleIdSchema` in `src/config/schema.ts`, not here, so this area
|
|
21
|
+
evaluates ids it does not own: `documentation-quality`, `graph-undocumented-relation`,
|
|
22
|
+
`declared-unobserved-relation`, `unresolved-reference`, `conflicting-declaration`,
|
|
23
|
+
`not-analyzed-coverage`, `stale-documentation`, `centrality-risk`, `critical-path-risk`, `freshness`
|
|
24
|
+
and `ownership`. The mapping is not one-to-one: `OWNERSHIP_GAP` and `OWNERSHIP_PATH_UNOBSERVED` both
|
|
25
|
+
become `ownership`, and `IMPORT_CYCLE` and `CENTRALITY_RISK` both become `centrality-risk`.
|
|
26
|
+
|
|
27
|
+
Severity comes from the mode — `default` reports everything as `info`, `recommended` raises it to
|
|
28
|
+
`warn`, `strict` to `error` — with `not-analyzed-coverage` held one step lower in both raised modes,
|
|
29
|
+
because a suite that does not exist is not a failure to report. An explicit `severity` override beats
|
|
30
|
+
the mode, and an `ignore` entry drops the rule entirely.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-safety
|
|
4
|
+
editRoot: src/safety
|
|
5
|
+
humanDoc: /docs/spec/config-v1
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/safety
|
|
9
|
+
validationPath: pnpm test && node bin/ak-docs.js index
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/safety
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Safety
|
|
16
|
+
|
|
17
|
+
Owns safe file discovery and secret detection. The `safeWalkFiles` function walks a repository
|
|
18
|
+
with resource limits (file count, byte size, memory, time) and respects exclusion globs from
|
|
19
|
+
`safety.exclude` in config or `DEFAULT_SAFETY_EXCLUDES` — paths matching `.git`, `node_modules`,
|
|
20
|
+
dist, build, coverage directories, and patterns for `.env`, `.pem`, `.key`, and secret-like names.
|
|
21
|
+
`redactSecrets` detects and redacts patterns for API keys (Stripe, GitHub, AWS) and
|
|
22
|
+
credentials (password, token, api-key style). Symbolic links are skipped; containment checks
|
|
23
|
+
prevent escapes via symlink resolution.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-schemas
|
|
4
|
+
editRoot: src/schemas
|
|
5
|
+
humanDoc: /docs/schemas/doc-bridge-index-v1
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/schemas
|
|
9
|
+
validationPath: pnpm test && pnpm typecheck
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/schemas
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Schemas
|
|
16
|
+
|
|
17
|
+
Owns the artifact contracts: every sealed artifact this repository writes or reads is shaped here, and
|
|
18
|
+
the schema is the contract, not the code that happens to produce it.
|
|
19
|
+
|
|
20
|
+
`knowledge.ts` holds `DiscoverySnapshotV1Schema` and the shared `Provenance` and finding vocabulary;
|
|
21
|
+
`retrieval-index.ts` the projection, including `ConfidenceSchema` and `AudienceSchema` and the bounded
|
|
22
|
+
`coveredBy`/`mentionedBy` lists the doctor reads; `doc-bridge-index.ts` the committed index that wraps
|
|
23
|
+
both; `agent-handoff.ts`, `memory-candidate.ts`, `enrichment.ts` and `budget.ts` the remaining
|
|
24
|
+
artifacts; `json-schemas.ts` the published JSON Schema forms of three of them.
|
|
25
|
+
|
|
26
|
+
Get the two hashes the right way round. **`contentHash` is the seal**: `contentHashForArtifactV1`
|
|
27
|
+
removes that field and hashes everything else, so the value is a hash *of the rest of the artifact*.
|
|
28
|
+
`snapshotHash` inside the projection is **provenance** and deliberately not a seal input — sealing over
|
|
29
|
+
it was the 1.10.0 defect, because the snapshot's revision changes when the tree does and a committed
|
|
30
|
+
index then went stale the moment it landed. 1.10.1 replaced it with `snapshotObservationHash` and bumped
|
|
31
|
+
`RETRIEVAL_PROJECTION_VERSION`.
|
|
32
|
+
|
|
33
|
+
Field bounds are part of the contract, not hygiene: shortening a `max()` here rejects artifacts that
|
|
34
|
+
were valid before.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-scripts
|
|
4
|
+
editRoot: scripts
|
|
5
|
+
humanDoc: /docs/RELEASE
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: scripts
|
|
9
|
+
validationPath: pnpm test && pnpm check:ecosystem-upstream
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:scripts
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Scripts
|
|
16
|
+
|
|
17
|
+
Owns the repository's build, release and verification tasks — the checks that cannot live in the test
|
|
18
|
+
suite because they reach outside the process: a packed tarball, a built docsite, an upstream digest.
|
|
19
|
+
|
|
20
|
+
`prepare.mjs` builds when `dist/cli/program.js` is missing, so a git install works; a published tarball
|
|
21
|
+
already ships `dist` and it no-ops. `sync-version.mjs` propagates one version across `package.json`,
|
|
22
|
+
`action.yml`, and the plugin, MCP and manifest files, so the published surfaces cannot disagree about
|
|
23
|
+
which release they are. `check-ecosystem-upstream.mjs` compares `ecosystem.json` and
|
|
24
|
+
`ecosystem-claims.json` against their upstream digests, failing when this repository has drifted from
|
|
25
|
+
the contract it claims to implement.
|
|
26
|
+
|
|
27
|
+
The `smoke-*.mjs` scripts exercise what is actually shipped — the packed tarball, the docsite builds,
|
|
28
|
+
the MCP bundle — and the `*-contract.test.mjs` scripts assert the artifact shapes consumers depend on.
|
|
29
|
+
A check belongs here when passing it requires the real thing, and in `tests/` otherwise.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: module
|
|
3
|
+
id: doc-bridge-shims
|
|
4
|
+
editRoot: src/shims
|
|
5
|
+
humanDoc: /docs/POSITIONING
|
|
6
|
+
owner: doc-bridge-maintainers
|
|
7
|
+
lifecycle: active
|
|
8
|
+
sourceOfTruth: src/shims
|
|
9
|
+
validationPath: pnpm typecheck && pnpm test
|
|
10
|
+
docbridge:
|
|
11
|
+
covers:
|
|
12
|
+
- area:src/shims
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Shims
|
|
16
|
+
|
|
17
|
+
Owns ambient type declarations for what the published packages do not type correctly themselves. Two
|
|
18
|
+
files, and both exist to keep `pnpm typecheck` honest rather than to change behaviour.
|
|
19
|
+
|
|
20
|
+
`agentskit-peers.d.ts` declares the optional AgentsKit peers (`@agentskit/rag`, `memory`, `adapters`,
|
|
21
|
+
`core`, `ink`) plus `ink` and `react`, so the tree typechecks whether or not those packages are
|
|
22
|
+
installed. `graphology.d.ts` covers the mismatch between the library's CommonJS declarations and its
|
|
23
|
+
ESM build under `moduleResolution: NodeNext`.
|
|
24
|
+
|
|
25
|
+
A shim is a claim about someone else's API, so it can drift silently: nothing here fails when the
|
|
26
|
+
upstream types change, only the code that trusted them.
|
|
@@ -137,9 +137,26 @@
|
|
|
137
137
|
],
|
|
138
138
|
"severity": "error",
|
|
139
139
|
"remediation": "Document `ak-docs parity` in the CLI reference, or remove the command."
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"claimId": "checked-in-package-version",
|
|
143
|
+
"statement": "The README states which package version this checkout carries",
|
|
144
|
+
"owner": "platform",
|
|
145
|
+
"valueType": "semver",
|
|
146
|
+
"template": "checked-in package version is `{value}`",
|
|
147
|
+
"evidence": {
|
|
148
|
+
"kind": "artifact-field",
|
|
149
|
+
"path": "package.json",
|
|
150
|
+
"field": "version"
|
|
151
|
+
},
|
|
152
|
+
"required": [
|
|
153
|
+
"README.md"
|
|
154
|
+
],
|
|
155
|
+
"severity": "error",
|
|
156
|
+
"remediation": "Restate the version from package.json on every surface that quotes it, or drop the sentence."
|
|
140
157
|
}
|
|
141
158
|
],
|
|
142
159
|
"exceptions": [],
|
|
143
|
-
"contentHash": "
|
|
160
|
+
"contentHash": "981acc99a59c6ba5d3cf79ac3c6d040353c4733d60800f48c22ed4756d0fdd99",
|
|
144
161
|
"contentHashAlgo": "sha256-normalized-v1"
|
|
145
162
|
}
|
package/docs/spec/config-v1.md
CHANGED
|
@@ -343,6 +343,7 @@ type GatesConfig = {
|
|
|
343
343
|
|
|
344
344
|
type GateId =
|
|
345
345
|
| 'index-freshness'
|
|
346
|
+
| 'index-reproducible' // opt-in; in no preset
|
|
346
347
|
| 'human-guide-links'
|
|
347
348
|
| 'link-rot' // reserved; emits a diagnostic and is not executed
|
|
348
349
|
| 'okf-type'
|
|
@@ -358,7 +359,7 @@ type GateId =
|
|
|
358
359
|
| `standard` | + `human-guide-links` in v1 |
|
|
359
360
|
| `strict` | + `okf-type` in v1 |
|
|
360
361
|
|
|
361
|
-
Implemented gates include `index-freshness`, `human-guide-links`, `okf-type`, `docs-style`, and the opt-in `documentation-standard-v1`. For v1 compatibility, `link-rot`, `routing-currency`, and `bootstrap-size` remain accepted as reserved IDs; including one emits `AK_DOCS_RESERVED_GATE` and does not claim that the gate ran. Unknown IDs are rejected.
|
|
362
|
+
Implemented gates include `index-freshness`, `human-guide-links`, `okf-type`, `docs-style`, and the opt-in `index-reproducible` and `documentation-standard-v1`. For v1 compatibility, `link-rot`, `routing-currency`, and `bootstrap-size` remain accepted as reserved IDs; including one emits `AK_DOCS_RESERVED_GATE` and does not claim that the gate ran. Unknown IDs are rejected.
|
|
362
363
|
|
|
363
364
|
### Structural vs style validation
|
|
364
365
|
|
|
@@ -367,10 +368,31 @@ These gates are deterministic lint checks, not editorial grading:
|
|
|
367
368
|
| Gate | Kind | What it proves |
|
|
368
369
|
|------|------|----------------|
|
|
369
370
|
| `index-freshness` | structural | Generated index matches current docs/config |
|
|
371
|
+
| `index-reproducible` | structural | Every indexed path is committed, so a clean checkout rebuilds the same index |
|
|
370
372
|
| `human-guide-links` | structural | Local `humanDoc` links resolve through configured human-doc adapters |
|
|
371
373
|
| `okf-type` | OKF lint | Agent docs have required `type:` frontmatter when strict/required |
|
|
372
374
|
| `docs-style` | style lint | Opt-in deterministic profile checks for title, purpose, audience, examples, owner/source, task orientation, and stale wording |
|
|
373
375
|
|
|
376
|
+
### Why `index-reproducible` is opt-in
|
|
377
|
+
|
|
378
|
+
A scan walks what is on disk and has no reason to consult `.gitignore`, so a generated module or
|
|
379
|
+
document joins the corpus on a machine that has built and leaves it on one that has not. That is
|
|
380
|
+
harmless while the index is regenerated on every run, and a defect the moment the index is
|
|
381
|
+
committed for a gate to verify: two checkouts of the same commit produce different artifacts,
|
|
382
|
+
`index-freshness` reports staleness that nothing caused, and regenerating cannot fix it because the
|
|
383
|
+
next machine disagrees in the other direction.
|
|
384
|
+
|
|
385
|
+
`index-reproducible` asks Git which of the indexed paths it ignores, and names each one with the
|
|
386
|
+
rule that matched (`apps/docs-next/.gitignore:13:lib/ask-context.ts`) so the fix is one lookup
|
|
387
|
+
away: add the path to `safety.exclude`. It reports success, not failure, when the index is not
|
|
388
|
+
committed or the project is not a Git checkout — there is nothing to reproduce in either case. A
|
|
389
|
+
file that is both tracked and matched by an ignore rule is not flagged; being committed is the
|
|
390
|
+
point.
|
|
391
|
+
|
|
392
|
+
It is in no preset, because enabling it for every consumer would fail gates that pass for good
|
|
393
|
+
reasons. `ak-docs index` and `ak-docs doctor` report the same finding unconditionally — as a
|
|
394
|
+
diagnostic and a `warn` issue — so a repository learns about it before deciding to enforce it.
|
|
395
|
+
|
|
374
396
|
`docs-style` supports `google-dev-docs`, `playbook-okf`, and `custom` profiles. It is not part of the default path and does not grade prose quality; it checks for explicit structural signals. LLM critique remains planned optional behavior.
|
|
375
397
|
|
|
376
398
|
---
|
package/mcpb/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifest_version": "0.3",
|
|
3
3
|
"name": "doc-bridge",
|
|
4
4
|
"display_name": "Doc Bridge",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.11.1",
|
|
6
6
|
"description": "Deterministic repository handoffs for coding agents, running locally without an LLM or API key.",
|
|
7
7
|
"long_description": "Doc Bridge turns a repository's own documentation and ownership metadata into deterministic handoffs: where an agent should start, which paths it may edit, which checks it must run, and when a human must take over. The local connector exposes the same read-only contract available through Doc Bridge CLI and CI.",
|
|
8
8
|
"author": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentskit/doc-bridge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"mcpName": "io.github.AgentsKit-io/doc-bridge",
|
|
5
5
|
"description": "Human↔agent documentation bridge — deterministic handoffs, doc-site links, memory→docs, optional AgentsKit RAG/chat.",
|
|
6
6
|
"type": "module",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"@agentskit/ink": "0.10.9",
|
|
128
128
|
"@agentskit/react": "0.8.3",
|
|
129
129
|
"@anthropic-ai/mcpb": "2.1.2",
|
|
130
|
-
"@changesets/cli": "^3.0.
|
|
130
|
+
"@changesets/cli": "^3.0.3",
|
|
131
131
|
"@lhci/cli": "^0.15.1",
|
|
132
132
|
"@playwright/test": "1.63.0",
|
|
133
133
|
"@tailwindcss/postcss": "4.3.3",
|