@agentskit/doc-bridge 0.1.0-alpha.3 → 1.0.0

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 (50) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +139 -57
  3. package/action.yml +78 -0
  4. package/dist/cli/program.js +987 -69
  5. package/dist/cli/program.js.map +1 -1
  6. package/dist/index.d.ts +238 -26
  7. package/dist/index.js +704 -22
  8. package/dist/index.js.map +1 -1
  9. package/docs/DOGFOOD-ROUND3.md +74 -0
  10. package/docs/POSITIONING.md +2 -0
  11. package/docs/RELEASE.md +5 -3
  12. package/docs/chat-and-rag.md +2 -0
  13. package/docs/getting-started.md +14 -1
  14. package/docs/landing/index.html +299 -0
  15. package/docs/mcp.md +10 -1
  16. package/docs/ollama-demo.md +64 -0
  17. package/docs/playbook/doc-bridge-pattern.md +114 -0
  18. package/docs/recipes/index-pipeline.md +89 -0
  19. package/docs/skills/doc-bridge.md +64 -0
  20. package/docs/spec/cli.md +6 -0
  21. package/docs/spec/playbook-feedback.md +12 -4
  22. package/examples/demo-example/doc-bridge.config.json +23 -0
  23. package/examples/demo-example/docs/for-agents/INDEX.md +3 -0
  24. package/examples/demo-example/docs/for-agents/packages/example.md +14 -0
  25. package/examples/demo-example/package.json +7 -0
  26. package/examples/demo-example/src/.gitkeep +0 -0
  27. package/examples/demo-monorepo/doc-bridge.config.json +37 -0
  28. package/examples/demo-monorepo/docs/for-agents/INDEX.md +4 -0
  29. package/examples/demo-monorepo/docs/for-agents/packages/auth.md +22 -0
  30. package/examples/demo-monorepo/docs/for-agents/packages/billing.md +19 -0
  31. package/examples/demo-monorepo/docs/human/guides/auth.md +7 -0
  32. package/examples/demo-monorepo/package.json +7 -0
  33. package/examples/demo-monorepo/packages/auth/package.json +8 -0
  34. package/examples/demo-monorepo/packages/billing/package.json +7 -0
  35. package/examples/demo-monorepo/pnpm-workspace.yaml +2 -0
  36. package/examples/ollama-chat.config.ts +42 -0
  37. package/package.json +5 -2
  38. package/src/cli/demo.ts +143 -0
  39. package/src/cli/program.ts +194 -14
  40. package/src/doctor/badge.ts +53 -0
  41. package/src/doctor/run-doctor.ts +286 -0
  42. package/src/index-builder/build-handoffs.ts +19 -1
  43. package/src/index-builder/watch-index.ts +94 -0
  44. package/src/index.ts +24 -0
  45. package/src/mcp/install.ts +84 -0
  46. package/src/memory/github-pr.ts +190 -0
  47. package/src/playbook/doc-bridge-pattern.ts +121 -0
  48. package/src/query/query.ts +19 -1
  49. package/src/schemas/agent-handoff.ts +11 -0
  50. package/src/version.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0
4
+
5
+ **Stable** — doctor, CI gate, MCP install, and agent skill are boring-reliable. Tier C polish ships.
6
+
7
+ ### Features
8
+ - **Landing** — `docs/landing/index.html` deployed to GitHub Pages (`https://agentskit-io.github.io/doc-bridge/`)
9
+ - **Playbook pattern** — published `docs/playbook/doc-bridge-pattern.md` + `ak-docs playbook pattern [--text]`
10
+ - **Used by** — public AgentsKit surfaces cited on landing (for-agents, Registry, Playbook)
11
+
12
+ ### Stable criteria met
13
+ - 60s demo path (`ak-docs demo`)
14
+ - Doctor coverage score + badges
15
+ - GitHub Action `doc-bridge-gate` + repo dogfood CI
16
+ - Cursor skill + `mcp install --cursor`
17
+ - Memory promote → draft PR, index `--watch`, Ollama smoke (optional)
18
+
19
+ ### Breaking changes from alpha
20
+ - None intended for Layer 0 config/handoff schemas (still `schemaVersion: 1`)
21
+ - Pin `@v1.0.0` for GitHub Action instead of alpha tags
22
+
23
+ ## 0.1.0-alpha.5
24
+
25
+ Tier B — power-user workflows and production pipeline polish.
26
+
27
+ ### Features
28
+ - **`ak-docs memory promote --pr`** — draft file + `gh pr create --draft` (with `--dry-run`, `--force`)
29
+ - **`ak-docs index --watch`** — debounced rebuild on agent/human doc changes
30
+ - **`ak-docs doctor --badge`** / **`--write-badge`** — shields.io markdown + `.doc-bridge/coverage-badge.json`
31
+ - **Ollama demo** — `examples/ollama-chat.config.ts`, `docs/ollama-demo.md`, `pnpm smoke:ollama`
32
+ - **Index pipeline recipes** — pre-commit, Turborepo, CI (`docs/recipes/index-pipeline.md`)
33
+ - **`pnpm coverage:badge`** — CI-friendly badge updater script
34
+
35
+ ## 0.1.0-alpha.4
36
+
37
+ Activation and agent-adoption polish — from "works" to "wow in 60s".
38
+
39
+ ### Features
40
+ - **`ak-docs demo`** — bundled example/monorepo fixtures; before/after handoff, gate red→green, MCP snippet (no local config)
41
+ - **`ak-docs doctor`** — coverage score 0–100, missing agentDoc/humanDoc, gate status, next actions
42
+ - **`ak-docs mcp install --cursor | --claude`** — writes MCP server config
43
+ - **Handoff `bridge`** — `linked` / `missing` / `external` humanDoc status with bootstrap action
44
+ - **`ak-docs ask`** — handoff preview (start, edit, checks, bridge) when ownership matches
45
+ - **GitHub Action** — `action.yml` (`doc-bridge-gate`) for PR gates + doctor annotation
46
+ - **Agent skill** — `docs/skills/doc-bridge.md` for Cursor/Claude one-shot routing rules
47
+ - **Demo fixtures** — `examples/demo-example`, `examples/demo-monorepo` (auth + billing)
48
+
3
49
  ## 0.1.0-alpha.3
4
50
 
5
51
  Dogfood round-2 fixes (search ranking, full-text body, peers, federation soft-fail).
package/README.md CHANGED
@@ -1,12 +1,45 @@
1
1
  # doc-bridge
2
2
 
3
- **npm:** [`@agentskit/doc-bridge`](https://www.npmjs.com/package/@agentskit/doc-bridge) · **CLI:** `ak-docs`
3
+ **npm:** [`@agentskit/doc-bridge`](https://www.npmjs.com/package/@agentskit/doc-bridge) · **CLI:** `ak-docs` · **Landing:** [agentskit-io.github.io/doc-bridge](https://agentskit-io.github.io/doc-bridge/)
4
4
 
5
- **Human↔agent documentation bridge** for any project not a wiki, not a hosted RAG chat.
5
+ **AgentHandoff for your monorepo** deterministic routing so coding agents edit the right package, run the right checks, and stay linked to human docs.
6
6
 
7
- doc-bridge helps coding agents **find the right file, edit the right roots, run the right checks**, keeps **agent docs linked to human docs**, and turns **agent memory into project documentation** (with human approval). The core is deterministic and works **without any LLM or API key**.
7
+ Not a wiki. Not a hosted RAG chat. Layer 0 works **without any LLM or API key**.
8
8
 
9
- Optional intelligence (RAG + terminal chat) uses public AgentsKit packages — install only when you want them.
9
+ ## 60-second wow path
10
+
11
+ ```bash
12
+ npm i -D @agentskit/doc-bridge
13
+ npx ak-docs demo --text
14
+ ```
15
+
16
+ No config, no docs to read first. Output shows before/after, a real handoff, gate red→green, and the MCP snippet:
17
+
18
+ ```
19
+ After (handoff.resolve / query --agent)
20
+ ✓ target: auth (packages/auth)
21
+ ✓ start: docs/for-agents/packages/auth.md
22
+ ✓ edit: packages/auth
23
+ ✓ checks: pnpm --filter @demo/auth test · pnpm --filter @demo/auth lint
24
+ ✓ human guide: /docs/guides/auth
25
+
26
+ Gate: red → green
27
+ ```
28
+
29
+ Monorepo fixture with auth + billing:
30
+
31
+ ```bash
32
+ npx ak-docs demo --fixture monorepo --text
33
+ ```
34
+
35
+ Full setup in your repo:
36
+
37
+ ```bash
38
+ npx ak-docs init
39
+ npx ak-docs index
40
+ npx ak-docs query package example --agent
41
+ ak-docs mcp install --cursor # wires MCP into .cursor/mcp.json
42
+ ```
10
43
 
11
44
  ## Why this exists
12
45
 
@@ -21,41 +54,90 @@ doc-bridge ships **AgentHandoff** JSON:
21
54
  ```json
22
55
  {
23
56
  "type": "agent-handoff",
24
- "startHere": "docs/for-agents/packages/example.md",
25
- "editRoots": ["src"],
26
- "checks": ["npm test"],
27
- "humanDoc": "/docs/guides/example"
57
+ "startHere": "docs/for-agents/packages/auth.md",
58
+ "editRoots": ["packages/auth"],
59
+ "checks": ["pnpm --filter @demo/auth test"],
60
+ "humanDoc": "/docs/guides/auth",
61
+ "bridge": { "humanDoc": "linked" }
28
62
  }
29
63
  ```
30
64
 
31
- ## Four loops
65
+ When a human guide is missing, handoffs surface it as a feature:
32
66
 
33
- | Loop | What you get |
34
- |------|----------------|
35
- | **Act** | CLI + MCP handoffs (`query`, `handoff.resolve`) |
36
- | **Bridge** | Fumadocs / Docusaurus / plain-markdown ↔ agent corpus + gates |
37
- | **Learn** | `memory ingest → classify → promote` drafts (HITL) |
38
- | **Explain** | Optional `@agentskit/rag` + `@agentskit/ink` chat (`handoffFirst`) |
67
+ ```json
68
+ {
69
+ "bridge": {
70
+ "humanDoc": "missing",
71
+ "action": "ak-docs bootstrap agent-docs"
72
+ },
73
+ "notes": ["Human guide missing for billing. Run: ak-docs bootstrap agent-docs"]
74
+ }
75
+ ```
39
76
 
40
- ## Quick start (< 2 minutes, no key)
77
+ ## Four loops (with real commands)
78
+
79
+ | Loop | Command | What you see |
80
+ |------|---------|--------------|
81
+ | **Act** | `ak-docs query package auth --agent` | `editRoots`, `checks`, `startHere` |
82
+ | **Bridge** | `ak-docs bootstrap agent-docs` | Draft agent docs from human site; `bridge.humanDoc` in handoff |
83
+ | **Learn** | `ak-docs memory classify` → `promote` | HITL draft for agent corpus |
84
+ | **Explain** | `ak-docs ask "auth is broken in staging"` | Ownership match + handoff preview + next commands |
41
85
 
42
86
  ```bash
43
- npm i -D @agentskit/doc-bridge
44
- npx ak-docs init
45
- npx ak-docs index
46
- npx ak-docs query package example --agent
87
+ ak-docs ask "who owns schemas"
88
+ # Best match: ownership os-core
89
+ # Handoff preview
90
+ # start: docs/for-agents/packages/os-core.md
91
+ # edit: packages/os-core
92
+ # checks: pnpm --filter os-core lint · pnpm --filter os-core test
93
+ ```
94
+
95
+ ## Coverage your team checks daily
96
+
97
+ ```bash
98
+ ak-docs doctor --text
99
+ ak-docs doctor --badge # shields.io markdown for README
100
+ ak-docs index --watch # keep index fresh while editing docs
101
+ ```
102
+
47
103
  ```
104
+ Score: 82/100 (B)
105
+ Agent docs: 8/10 (80% handoff-ready)
106
+ Human guides: 6/10 (60% bridged)
107
+ Gates: 3/3 passing
108
+
109
+ Next actions
110
+ → ak-docs bootstrap agent-docs
111
+ → ak-docs query package billing --agent
112
+ ```
113
+
114
+ ## Agent uses it alone
115
+
116
+ 1. **MCP auto-wire:** `ak-docs mcp install --cursor`
117
+ 2. **Skill/rule:** paste [docs/skills/doc-bridge.md](docs/skills/doc-bridge.md) into Cursor rules — agents call `handoff.resolve` before editing `packages/*`
118
+ 3. **Handoff is the next step:** `startHere`, `checks`, and `bridge` are in the JSON/MCP response
119
+
120
+ ## CI as first-class citizen
48
121
 
49
- `init` scaffolds config, a demo ownership target, and an `AGENTS.md` snippet.
122
+ Reuse the bundled GitHub Action on every PR:
123
+
124
+ ```yaml
125
+ - uses: AgentsKit-io/doc-bridge@v1.0.0
126
+ with:
127
+ config-path: doc-bridge.config.json
128
+ ```
129
+
130
+ ![handoff coverage](https://img.shields.io/badge/handoff_coverage-100%25-2ea44f?style=flat-square) ![human bridge](https://img.shields.io/badge/human_bridge-0%25-cb2431?style=flat-square)
131
+
132
+ Run `ak-docs doctor --badge` locally to refresh — or `pnpm coverage:badge` in CI.
133
+
134
+ Or locally:
50
135
 
51
136
  ```bash
52
- npx ak-docs list packages --text
53
- npx ak-docs ask "where do I change example?"
54
- npx ak-docs gate run
55
- npx ak-docs mcp
137
+ ak-docs index && ak-docs gate run
56
138
  ```
57
139
 
58
- Full guide: **[docs/getting-started.md](docs/getting-started.md)**.
140
+ Gate fails with `Index is stale. Run: ak-docs index` — same check in CI annotations.
59
141
 
60
142
  ## Surfaces
61
143
 
@@ -63,50 +145,38 @@ Full guide: **[docs/getting-started.md](docs/getting-started.md)**.
63
145
 
64
146
  | Surface | Purpose |
65
147
  |---------|---------|
148
+ | **Demo** | `ak-docs demo` — bundled fixture, no setup |
149
+ | **Doctor** | Coverage score, missing humanDoc/agent doc, next actions |
66
150
  | **Index** | `DocBridgeIndex` + `contentHash` + `llms.txt` + capabilities |
67
151
  | **CLI** | `query` / `search` / `list` / `ask` / `gate` / `memory` / `bootstrap` |
68
- | **MCP** | `handoff.resolve`, `doc.search`, `doc.get`, … |
152
+ | **MCP** | `handoff.resolve`, `doc.search`, `doc.get`, `gate.status`, … |
69
153
  | **Gates** | Freshness, human-link validation, optional OKF style |
70
154
  | **Plugins** | `pnpm-monorepo`, `fumadocs`, `docusaurus`, `plain-markdown` |
71
155
 
72
- Ownership can come from **config**, **frontmatter** (`package` + `editRoot`), or **workspace discovery**.
73
-
74
156
  ### Layer 1 — optional AgentsKit peers
75
157
 
76
158
  ```bash
77
159
  npm i -D @agentskit/rag @agentskit/ink @agentskit/adapters @agentskit/memory react
78
- ```
79
-
80
- ```bash
81
- ak-docs rag ingest
82
- ak-docs chat
83
- ak-docs ask "how does auth work?" --chat
160
+ ak-docs rag ingest && ak-docs chat
84
161
  ```
85
162
 
86
163
  See **[docs/chat-and-rag.md](docs/chat-and-rag.md)**.
87
164
 
88
- ## Architecture
89
-
90
- ```
91
- Your repo
92
- ├── docs/for-agents/ agent corpus
93
- ├── docs/ or content/ human site (plugin)
94
- ├── AGENTS.md
95
- └── doc-bridge.config.*
96
-
97
- Layer 0 — Index · CLI · MCP · Gates · Memory pipeline
98
- Layer 1 — @agentskit/rag · adapters · ink chat (opt-in)
99
- ```
100
-
101
- **Trust model:** Layer 0 is merge-blocking truth. Layer 1 explains and drafts; humans and gates decide.
102
-
103
165
  ## Who uses it (public)
104
166
 
167
+ [![npm](https://img.shields.io/npm/v/@agentskit/doc-bridge?style=flat-square)](https://www.npmjs.com/package/@agentskit/doc-bridge)
168
+ [![CI](https://img.shields.io/github/actions/workflow/status/AgentsKit-io/doc-bridge/ci.yml?branch=master&style=flat-square)](https://github.com/AgentsKit-io/doc-bridge/actions)
169
+
105
170
  Designed for and dogfooded on open AgentsKit surfaces:
106
171
 
107
- - [for-agents docs](https://www.agentskit.io/docs/for-agents)
108
- - [Registry](https://registry.agentskit.io/)
109
- - [Playbook `llms.txt`](https://playbook.agentskit.io/llms.txt)
172
+ | Surface | Link |
173
+ |---------|------|
174
+ | **for-agents** | [agentskit.io/docs/for-agents](https://www.agentskit.io/docs/for-agents) |
175
+ | **Registry** | [registry.agentskit.io](https://registry.agentskit.io/) |
176
+ | **Playbook** | [playbook.agentskit.io](https://playbook.agentskit.io/llms.txt) |
177
+ | **This repo** | CI green · `ak-docs gate run` on every PR |
178
+
179
+ **Playbook pattern:** [`docs/playbook/doc-bridge-pattern.md`](docs/playbook/doc-bridge-pattern.md) — export with `ak-docs playbook pattern --text`
110
180
 
111
181
  ## Configuration examples
112
182
 
@@ -114,19 +184,31 @@ Designed for and dogfooded on open AgentsKit surfaces:
114
184
  |---------|---------|
115
185
  | Solo markdown | [`examples/minimal-plain-markdown.config.ts`](examples/minimal-plain-markdown.config.ts) |
116
186
  | pnpm monorepo | [`examples/pnpm-monorepo.config.ts`](examples/pnpm-monorepo.config.ts) |
187
+ | Demo monorepo | [`examples/demo-monorepo/`](examples/demo-monorepo/) |
117
188
  | Fumadocs + chat | [`examples/fumadocs-with-chat.config.ts`](examples/fumadocs-with-chat.config.ts) |
118
- | Docusaurus + memory | [`examples/docusaurus-with-memory.config.ts`](examples/docusaurus-with-memory.config.ts) |
119
189
 
120
- Contract: [`docs/spec/config-v1.md`](docs/spec/config-v1.md) · CLI: [`docs/spec/cli.md`](docs/spec/cli.md) · MCP: [`docs/mcp.md`](docs/mcp.md)
190
+ Contract: [`docs/spec/config-v1.md`](docs/spec/config-v1.md) · CLI: [`docs/spec/cli.md`](docs/spec/cli.md) · MCP: [`docs/mcp.md`](docs/mcp.md) · Skill: [`docs/skills/doc-bridge.md`](docs/skills/doc-bridge.md) · Pattern: [`docs/playbook/doc-bridge-pattern.md`](docs/playbook/doc-bridge-pattern.md) · Recipes: [`docs/recipes/index-pipeline.md`](docs/recipes/index-pipeline.md)
191
+
192
+ ## Learn loop — memory → draft PR
193
+
194
+ ```bash
195
+ ak-docs memory ingest
196
+ ak-docs memory classify
197
+ ak-docs memory promote --pr --dry-run # preview gh commands
198
+ ak-docs memory promote --pr # opens draft PR via gh
199
+ ```
121
200
 
122
201
  ## Status
123
202
 
124
- **v0.1.0-alpha.3** — Dogfood polish (pnpm-aware checks, corpus ownership inference, playbook gate preset, git prepare build). Layer 1 RAG/chat via optional peers.
203
+ **v1.0.0 stable** — doctor + CI + skill boring-reliable. Landing, Playbook pattern, full Tier A/B/C shipped.
125
204
 
126
205
  ```bash
127
206
  pnpm install && pnpm build && pnpm test
207
+ pnpm smoke:ollama # optional — skips if Ollama/peers unavailable
128
208
  ```
129
209
 
210
+ **Landing:** https://agentskit-io.github.io/doc-bridge/
211
+
130
212
  ## Contributing
131
213
 
132
214
  - [CONTRIBUTING.md](CONTRIBUTING.md) · [SECURITY.md](SECURITY.md) · [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) · [CHANGELOG.md](CHANGELOG.md)
@@ -134,4 +216,4 @@ pnpm install && pnpm build && pnpm test
134
216
 
135
217
  ## License
136
218
 
137
- MIT
219
+ MIT
package/action.yml ADDED
@@ -0,0 +1,78 @@
1
+ name: doc-bridge-gate
2
+ description: Run doc-bridge index freshness and configured gates on pull requests
3
+ branding:
4
+ icon: book
5
+ color: blue
6
+
7
+ inputs:
8
+ config-path:
9
+ description: Path to doc-bridge.config.json (default discovers from repo root)
10
+ required: false
11
+ default: ''
12
+ gate:
13
+ description: Optional single gate id (default runs all configured gates)
14
+ required: false
15
+ default: ''
16
+ node-version:
17
+ description: Node.js version for ak-docs
18
+ required: false
19
+ default: '22'
20
+ package-version:
21
+ description: npm package version pin (e.g. 0.1.0-alpha.3)
22
+ required: false
23
+ default: ''
24
+
25
+ runs:
26
+ using: composite
27
+ steps:
28
+ - name: Setup Node
29
+ uses: actions/setup-node@v4
30
+ with:
31
+ node-version: ${{ inputs.node-version }}
32
+
33
+ - name: Install ak-docs
34
+ shell: bash
35
+ run: |
36
+ VERSION="${{ inputs.package-version }}"
37
+ if [ -n "$VERSION" ]; then
38
+ npm install -g "@agentskit/doc-bridge@${VERSION}"
39
+ else
40
+ npm install -g @agentskit/doc-bridge
41
+ fi
42
+
43
+ - name: Build index
44
+ shell: bash
45
+ run: |
46
+ if [ -n "${{ inputs.config-path }}" ]; then
47
+ ak-docs index --config "${{ inputs.config-path }}"
48
+ else
49
+ ak-docs index
50
+ fi
51
+
52
+ - name: Run gates
53
+ shell: bash
54
+ run: |
55
+ if [ -n "${{ inputs.gate }}" ] && [ -n "${{ inputs.config-path }}" ]; then
56
+ ak-docs gate run "${{ inputs.gate }}" --config "${{ inputs.config-path }}"
57
+ elif [ -n "${{ inputs.gate }}" ]; then
58
+ ak-docs gate run "${{ inputs.gate }}"
59
+ elif [ -n "${{ inputs.config-path }}" ]; then
60
+ ak-docs gate run --config "${{ inputs.config-path }}"
61
+ else
62
+ ak-docs gate run
63
+ fi
64
+
65
+ - name: Doctor coverage (annotation)
66
+ shell: bash
67
+ continue-on-error: true
68
+ run: |
69
+ if [ -n "${{ inputs.config-path }}" ]; then
70
+ REPORT="$(ak-docs doctor --text --config "${{ inputs.config-path }}" 2>&1 || true)"
71
+ else
72
+ REPORT="$(ak-docs doctor --text 2>&1 || true)"
73
+ fi
74
+ echo "$REPORT"
75
+ SCORE="$(echo "$REPORT" | sed -n 's/^Score: \([0-9]*\)\/.*/\1/p' | head -1)"
76
+ if [ -n "$SCORE" ]; then
77
+ echo "::notice title=doc-bridge coverage::Score ${SCORE}/100 — run ak-docs doctor locally for next actions"
78
+ fi