@agentskit/doc-bridge 0.1.0-alpha.1 → 0.1.0-alpha.2

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 (61) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -1
  3. package/dist/cli/program.js +283 -105
  4. package/dist/cli/program.js.map +1 -1
  5. package/dist/config/index.d.ts +1 -1
  6. package/dist/config/index.js +6 -3
  7. package/dist/config/index.js.map +1 -1
  8. package/dist/{index-CD_zmKXf.d.ts → index-CPUJbTbg.d.ts} +19 -10
  9. package/dist/index.d.ts +5 -4
  10. package/dist/index.js +278 -100
  11. package/dist/index.js.map +1 -1
  12. package/docs/DOGFOOD.md +92 -0
  13. package/package.json +27 -9
  14. package/scripts/prepare.mjs +44 -0
  15. package/src/cli/program.ts +933 -0
  16. package/src/config/defaults.ts +63 -0
  17. package/src/config/define-config.ts +6 -0
  18. package/src/config/index.ts +15 -0
  19. package/src/config/load-config.ts +138 -0
  20. package/src/config/schema.ts +294 -0
  21. package/src/federation/llms.ts +145 -0
  22. package/src/gates/run-gates.ts +274 -0
  23. package/src/index-builder/build-handoffs.ts +217 -0
  24. package/src/index-builder/build-index.ts +137 -0
  25. package/src/index-builder/capabilities.ts +37 -0
  26. package/src/index-builder/content-hash.ts +19 -0
  27. package/src/index-builder/human-adapters/core.ts +100 -0
  28. package/src/index-builder/human-adapters/docusaurus.ts +113 -0
  29. package/src/index-builder/human-adapters/fumadocs.ts +70 -0
  30. package/src/index-builder/human-adapters/index.ts +52 -0
  31. package/src/index-builder/human-adapters/plain-markdown.ts +10 -0
  32. package/src/index-builder/llms-txt.ts +19 -0
  33. package/src/index-builder/plugins/human-markdown.ts +7 -0
  34. package/src/index-builder/plugins/pnpm-monorepo.ts +72 -0
  35. package/src/index-builder/scan-corpus.ts +181 -0
  36. package/src/index.ts +120 -0
  37. package/src/intelligence/adapter.ts +90 -0
  38. package/src/intelligence/chat.ts +148 -0
  39. package/src/intelligence/peers.ts +59 -0
  40. package/src/intelligence/rag.ts +98 -0
  41. package/src/lib/glob-expand.ts +33 -0
  42. package/src/lib/markdown.ts +90 -0
  43. package/src/lib/package-manager.ts +104 -0
  44. package/src/lib/paths.ts +6 -0
  45. package/src/lib/walk.ts +45 -0
  46. package/src/mcp/server.ts +276 -0
  47. package/src/memory/ingest.ts +51 -0
  48. package/src/memory/pipeline.ts +119 -0
  49. package/src/query/load-index.ts +25 -0
  50. package/src/query/query.ts +142 -0
  51. package/src/query/search.ts +58 -0
  52. package/src/retriever/doc-bridge-retriever.ts +62 -0
  53. package/src/schemas/agent-handoff.ts +82 -0
  54. package/src/schemas/doc-bridge-index.ts +106 -0
  55. package/src/schemas/json-schemas.ts +156 -0
  56. package/src/schemas/memory-candidate.ts +37 -0
  57. package/src/shims/agentskit-peers.d.ts +80 -0
  58. package/src/validate.ts +67 -0
  59. package/src/version.ts +1 -0
  60. package/tsconfig.json +21 -0
  61. package/tsup.config.ts +15 -0
@@ -0,0 +1,92 @@
1
+ # Ecosystem dogfood — `@agentskit/doc-bridge`
2
+
3
+ Validated **2026-07-09** against four consumers.
4
+
5
+ - First pass: `0.1.0-alpha.1` (local `file:`)
6
+ - Second pass after polish: **`0.1.0-alpha.2`** (`v0.1.0-alpha.2`)
7
+
8
+ ## Standard integration (all repos)
9
+
10
+ | Artifact | Purpose |
11
+ |----------|---------|
12
+ | `doc-bridge.config.json` | Layer 0 config (schemaVersion 1) |
13
+ | `docs:bridge:index` | `ak-docs index` |
14
+ | `docs:bridge:gate` | `ak-docs gate run` |
15
+ | `docs:bridge:query` | `ak-docs query` |
16
+ | `.doc-bridge/` | Generated index (gitignored) |
17
+ | `devDependency` | `@agentskit/doc-bridge` (`file:` or `0.1.0-alpha.1` / `@alpha` when npm resolves) |
18
+
19
+ ### MCP (optional, same in each repo)
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "ak-docs": {
25
+ "command": "ak-docs",
26
+ "args": ["mcp"]
27
+ }
28
+ }
29
+ }
30
+ ```
31
+
32
+ ## Results
33
+
34
+ | Repo | Knowledge | Handoffs | Gate | Sample handoff |
35
+ |------|-----------|----------|------|----------------|
36
+ | **agentskit** | 25 | 24 | ✅ freshness + 24 humanDoc | `core` → `packages/core` + for-agents MDX |
37
+ | **agentskit-os** | 170 | 82 | ✅ freshness + 2 humanDoc | `os-core` → for-agents package doc |
38
+ | **agents-playbook** | 127 | 81 patterns | ✅ freshness + okf-type | `open-knowledge-format-pattern` |
39
+ | **agentskit-registry** | 36 | 36 | ✅ freshness | `docs-chat` → `registry/docs-chat` |
40
+
41
+ ## Findings / improvements for doc-bridge
42
+
43
+ ### P0 product feedback
44
+ 1. **Default checks are npm-centric** (`npm test` / `npm run lint`) even in pnpm monorepos. Prefer detecting `packageManager` or `pnpm --filter <id> test`.
45
+ 2. **Git install lacks `dist/`** — `github:…#tag` installs source only; need `prepare`/`prepack` that builds, or document npm-only install.
46
+ 3. **`docs-style` gate is too strict** for playbook OKF (expects purpose/owner-source on every page). Make playbook profile softer or map to existing `check:okf-type`.
47
+ 4. **HumanDoc join rate low on AKOS** (2/82) — product Fumadocs tree is thin vs package atlas; support multi-human corpora (product + `docs/adr`) and/or ownership `humanDoc` from for-agents frontmatter.
48
+
49
+ ### P1 DX
50
+ 5. **Nested agent corpus inside human tree** (agentskit for-agents under `content/docs`) double-counts unless human meta exclude — works but humanDoc points at `/docs/for-agents/core` which is correct for that site.
51
+ 6. **Playbook is pattern-owned, not package-owned** — ownership generation from filenames works; first-class `routing.plugin: pattern-files` would help.
52
+ 7. **Registry human plain-markdown** + URL prefix `/agents/:id` works; committed `public/llms.txt` must stay owner of site discovery (`llmsTxt.enabled: false`).
53
+ 8. **AKOS pnpm store mismatch** can block `pnpm add` — dogfood via absolute `ak-docs` still validates; install needs store alignment.
54
+
55
+ ### P2 ecosystem
56
+ 9. Ship **npm package** publicly (`@agentskit/doc-bridge@alpha`) so consumers drop `file:`.
57
+ 10. Wire `docs:bridge:gate` into each CI (`check:quality-gates` / registry verify / new playbook workflow).
58
+ 11. Federation: registry `llms.txt` still 404 online — dogfood configs already list it; fix registry publish of Self-Describe artifact.
59
+
60
+ ## Per-repo config notes
61
+
62
+ ### agentskit
63
+ - Agent: `apps/docs-next/content/docs/for-agents`
64
+ - Human: Fumadocs same docs tree
65
+ - Routing: `pnpm-monorepo` `packages/*`
66
+ - Best fit: clean monorepo + for-agents coverage already exists
67
+
68
+ ### agentskit-os
69
+ - Agent: `docs/for-agents` (canonical)
70
+ - Human: product Fumadocs only (`apps/web/content/docs`) — dual human later
71
+ - `llmsTxt.enabled: false` (keep `gen-self-describe`)
72
+ - Dual-run with `docs:internal` — do not delete internal generators yet
73
+
74
+ ### agents-playbook
75
+ - Agent = human = `content/docs` (OKF)
76
+ - Ownership: generated per pattern file under pillars
77
+ - Gates: `index-freshness` + `okf-type` only (not docs-style)
78
+
79
+ ### agentskit-registry
80
+ - Agent root: `registry/**/README.md`
81
+ - Ownership: one entry per agent id
82
+ - npm package (not pnpm workspace)
83
+ - `llmsTxt.enabled: false`
84
+
85
+ ## Commands used to validate
86
+
87
+ ```bash
88
+ ak-docs index
89
+ ak-docs gate run
90
+ ak-docs query package <id> --agent
91
+ ak-docs list packages --text
92
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentskit/doc-bridge",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "Human↔agent documentation bridge — deterministic handoffs, doc-site links, memory→docs, optional AgentsKit RAG/chat.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,6 +21,7 @@
21
21
  "files": [
22
22
  "dist",
23
23
  "bin",
24
+ "scripts/prepare.mjs",
24
25
  "docs",
25
26
  "examples",
26
27
  "README.md",
@@ -28,7 +29,10 @@
28
29
  "SECURITY.md",
29
30
  "CODE_OF_CONDUCT.md",
30
31
  "CHANGELOG.md",
31
- "LICENSE"
32
+ "LICENSE",
33
+ "tsup.config.ts",
34
+ "tsconfig.json",
35
+ "src"
32
36
  ],
33
37
  "scripts": {
34
38
  "build": "tsup",
@@ -42,7 +46,9 @@
42
46
  "changeset": "changeset",
43
47
  "version-packages": "changeset version",
44
48
  "release": "pnpm build && pnpm test && changeset publish",
45
- "prepublishOnly": "pnpm build && pnpm test"
49
+ "prepublishOnly": "npm run build && npm test",
50
+ "prepare": "node scripts/prepare.mjs",
51
+ "prepack": "npm run build"
46
52
  },
47
53
  "keywords": [
48
54
  "agentskit",
@@ -77,12 +83,24 @@
77
83
  "react": ">=18.0.0"
78
84
  },
79
85
  "peerDependenciesMeta": {
80
- "@agentskit/adapters": { "optional": true },
81
- "@agentskit/core": { "optional": true },
82
- "@agentskit/ink": { "optional": true },
83
- "@agentskit/memory": { "optional": true },
84
- "@agentskit/rag": { "optional": true },
85
- "react": { "optional": true }
86
+ "@agentskit/adapters": {
87
+ "optional": true
88
+ },
89
+ "@agentskit/core": {
90
+ "optional": true
91
+ },
92
+ "@agentskit/ink": {
93
+ "optional": true
94
+ },
95
+ "@agentskit/memory": {
96
+ "optional": true
97
+ },
98
+ "@agentskit/rag": {
99
+ "optional": true
100
+ },
101
+ "react": {
102
+ "optional": true
103
+ }
86
104
  },
87
105
  "devDependencies": {
88
106
  "@changesets/cli": "^2.31.0",
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Ensure dist/ exists for git installs and local clones.
4
+ * Published npm tarballs already include dist/ — this is a no-op then.
5
+ */
6
+ import { existsSync } from 'node:fs'
7
+ import { spawnSync } from 'node:child_process'
8
+ import { dirname, join } from 'node:path'
9
+ import { fileURLToPath } from 'node:url'
10
+
11
+ const root = join(dirname(fileURLToPath(import.meta.url)), '..')
12
+ const marker = join(root, 'dist', 'cli', 'program.js')
13
+
14
+ if (existsSync(marker)) {
15
+ process.exit(0)
16
+ }
17
+
18
+ const attempts = [
19
+ ['pnpm', ['exec', 'tsup']],
20
+ ['npx', ['--yes', 'tsup@8.5.1']],
21
+ ['npm', ['exec', '--', 'tsup']],
22
+ ]
23
+
24
+ let ok = false
25
+ for (const [cmd, args] of attempts) {
26
+ const result = spawnSync(cmd, args, {
27
+ cwd: root,
28
+ stdio: 'inherit',
29
+ env: process.env,
30
+ shell: process.platform === 'win32',
31
+ })
32
+ if (result.status === 0 && existsSync(marker)) {
33
+ ok = true
34
+ break
35
+ }
36
+ }
37
+
38
+ if (!ok) {
39
+ process.stderr.write(
40
+ '[@agentskit/doc-bridge] prepare: could not build dist/. Run: pnpm build (or npm run build)\n',
41
+ )
42
+ // Don't fail install of dependents hard when used as file: link with prebuilt dist elsewhere
43
+ process.exit(0)
44
+ }