docs: document exports 47%→95%, trim app-specific root exports, adopt agent-docs#245
Conversation
…cs suggest Fills the public-API JSDoc gap so the generated agent-readable docs (llms.txt, API pages) carry real summaries. Drafted by @tangle-network/agent-docs suggest — a cheap model (gpt-4.1-mini via the Tangle router) writes a one-line summary from each undocumented export's signature + source, inserted above the declaration. Then the deterministic doc pass (scripts/gen-codemap.mjs) picks them up, so the committed docs stay type-derived. - 978 JSDoc comments across 168 source files; documented coverage 47%→95% (3146/3318 exports). - Additive comments only — `pnpm typecheck` stays green; behavior unchanged. - docs/ regenerated so the codemap staleness gate passes. These are model-drafted summaries for human review — accurate on spot-check (e.g. AuthorizeResult → "Resolve authorization status and context for a chat turn…"), and improvable in place; NO raw model text enters the gated output.
The generator's --check spawns a full source walk; with the JSDoc pass it now exceeds the 5000ms default in CI. Bump to 60s (it's a subprocess, not hot code).
…d agent-docs 1. Trim — `/sequences` and `/design-canvas` are app-specific FEATURE surfaces (timeline editing, a design canvas), not shell mechanism every product wants. Removed from the root barrel; they stay importable as subpaths (`@tangle-network/agent-app/sequences`, `/design-canvas`). Keeps the root entry to shared mechanism instead of every product's features. `/studio` was already subpath-only. (Breaking only for a ROOT import of those symbols — switch to the subpath, which is the documented convention.) 2. Dogfood — agent-app now generates its docs with `@tangle-network/agent-docs` instead of the bespoke `scripts/gen-codemap.mjs` (deleted). `docs:gen` → `agent-docs`; the freshness gate runs `agent-docs --check`; docs/ now also carries `llms.txt` + `llms-full.txt` + `codemap.json` (the agent-readable surface). Deletes the first fleet copy of the generator.
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 10bdc01c
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
tangletools · auto-approval · reason: drewstone_author · 2026-07-24T20:04:43Z
tangletools
left a comment
There was a problem hiding this comment.
🟡 Value Audit — sound-with-nits
| Verdict | sound-with-nits |
| Concerns | 2 (2 weak-concern) |
| Heuristic | 0.1s |
| Duplication | 0.0s |
| Interrogation | 157.3s (2 bridge agents) |
| Total | 157.4s |
💰 Value — sound-with-nits
Documentation overhaul — 978 additive JSDoc summaries, root barrel trimmed of two app-specific feature surfaces, and the bespoke gen-codemap.mjs replaced by the shared @tangle-network/agent-docs tool; coherent and in-grain.
- What it does: Three changes: (1) adds 978 one-line JSDoc summaries above previously-undocumented exports across 168 source files, raising documented-export coverage from 47% to 95%; (2) removes
/sequencesand/design-canvasfrom the root barrel in src/index.ts (they remain valid subpaths via tsup.config.ts + package.json exports); (3) deletes scripts/gen-codemap.mjs (282 LOC) and replaces it with the @Tangl - Goals it achieves: (1) Make the public surface legible — IDE hovers and generated reference docs now cover 95% of exports instead of 47%. (2) Keep the root barrel to shared shell mechanism, not product-specific feature surfaces — a consumer importing
@tangle-network/agent-appno longer pays for timeline/canvas symbols it may not want. (3) Kill the first bespoke fleet copy of a codemap generator by dogfooding the c - Assessment: All three parts are coherent and in the grain of the codebase. The JSDoc additions are purely additive comments (verified in src/chat-routes/wire.ts and src/tools/types.ts) — zero behavior risk, typecheck stays green. The barrel trim is well-justified: ARCHITECTURE.md:19-22,100-101 classifies sequences and design-canvas as L2/L3 app-specific feature surfaces (timeline editor, canvas editor), expli
- Better / existing approach: Searched for any pre-existing JSDoc/codemap tool in the repo (find for *.mjs, grep for 'agent-docs', 'codemap', 'gen-codemap'). The only existing generator is the one being deleted — there is nothing else to extend. The @tangle-network/agent-docs devDep is the canonical fleet tool, so adopting it is the right move rather than reinventing. None — this is the right approach.
- Model: opencode/zai-coding-plan/glm-5.2
- Bridge attempts: 2
- Bridge warning: opencode/kimi-for-coding/k2p7: bridge stream ended without value-audit content
🎯 Usefulness — sound-with-nits
A coherent docs+barrel-hygiene change that trims genuinely app-specific surfaces from the root barrel (verified safe), dogfoods the shared agent-docs tool (removing a bespoke fleet copy), and adds ~978 additive JSDoc summaries — all wired into package.json scripts and a real freshness gate.
- Integration: All three parts are reachable and used: docs:gen→agent-docs (package.json:410), devDep pinned (package.json:416), freshness gate spawns agent-docs --check (tests/codemap-fresh.test.ts:24), trimmed subpaths remain importable + documented (docs/codemap.json ./sequences, ./design-canvas entries). No internal caller imported the trimmed symbols from root (greps of src/ + tests/ for root-barrel imports
- Fit with existing patterns: Matches the repo's stated grain precisely: AGENTS.md's module map and the engine/shell rule treat /sequences and /design-canvas as app-specific feature surfaces (timeline editing, design canvas), not shell mechanism — demoting them keeps the root entry to shared mechanism. Dogfooding agent-docs is the literal 'extend, never duplicate' rule (deletes the first bespoke fleet generator).
- Real-world viability: Holds up: additive comments can't break behavior; the barrel trim is a narrow, documented breaking change only for external ROOT importers (0.x package, migration is one subpath swap); the freshness gate is a real subprocess diff check, not a stub. Sole fragility is the hardcoded node_modules/dist/cli.js path in the gate test.
- Model: opencode/zai-coding-plan/glm-5.2
- Bridge attempts: 1
🎯 Usefulness Audit
🟡 Freshness gate hardcodes the tool's dist path [robustness] ``
tests/codemap-fresh.test.ts:18 resolves the CLI via join(repoRoot,'node_modules','@tangle-network','agent-docs','dist','cli.js'). This breaks if agent-docs changes its dist layout. The exact 0.2.0 pin prevents silent drift today, but resolving via the package's declared bin entry (or importing its programmatic API) would be more robust. Note only — not blocking.
💰 Value Audit
🟡 Generated codemap.json still lists trimmed subpaths as root dependsOn [maintenance] ``
After this PR, src/index.ts no longer re-exports sequences or design-canvas, and docs/CODEMAP.md correctly drops the root export count from 982 to 766. However docs/codemap.json still lists
sequences,sequences-react,design-canvas,design-canvas-reactin the root entry'sdependsOnarray (verified: grep -A 60 '"id": "."' docs/codemap.json). This appears to be how @tangle-network/agent-docs computes dependsOn (from tsup.config.ts entry siblings, not from actual src/index.ts reachability
What this audit checks
It judges the change on its merits — not whether it was tasked out in an issue. Unticketed, fast-moving work is fine; the question is whether the change is good and whether a better or existing approach should be used instead.
| Pass | What it asks |
|---|---|
| Heuristic | Vague title? Whitespace-only or cruft-bearing diff? (content signals only) |
| Duplication | Do added function/class names already exist elsewhere in the repo? |
| Value Audit | What does it do? What goal does it achieve? Is it good? Better architecture or already-exists? |
| Usefulness Audit | Does it integrate and fit? Will it hold up in real use and actually get used? |
Findings are concerns, not blocks — the human reviewer decides what to do with them.
✅ No Blockers —
|
tangletools
left a comment
There was a problem hiding this comment.
✅ Approved — 17 non-blocking findings — 10bdc01c
Full multi-shot audit completed 8/8 planned shots over 249 changed files. Global verifier still owns final merge decision.
Full immutable report for this review: trace
Summary comment for this run: full summary
tangletools · 2026-07-24T20:21:48Z · immutable trace
The full documentation-surface overhaul (supersedes #244). Three coherent parts:
1. Document the exports (47% → 95%)
978 one-line JSDoc summaries across 168 source files, drafted by
@tangle-network/agent-docs suggest(a cheap model —gpt-4.1-minivia the Tangle router — writes a summary from each undocumented export's signature + source; inserted above the declaration). Additive comments only;pnpm typecheckgreen; no raw model text in generated output.2. Trim the root barrel (are they all needed? — no)
/sequencesand/design-canvasare app-specific feature surfaces (timeline editing, a design canvas), not shell mechanism every product wants — removed from the root barrel. They stay importable as subpaths (@tangle-network/agent-app/sequences,/design-canvas)./studiowas already subpath-only. This keeps the root entry to shared mechanism; before this, the root barrel re-exported 982 symbols (~42% of the real subpath surface).Breaking only for a root import of those symbols — switch to the subpath (the documented convention). No internal code or test imports them from root.
3. Dogfood agent-docs
agent-app now generates its docs with
@tangle-network/agent-docs(devDep) instead of the bespokescripts/gen-codemap.mjs(deleted — the first fleet copy gone).docs:gen→agent-docs; the freshness gate runsagent-docs --check;docs/now also carriesllms.txt+llms-full.txt+codemap.json— the agent-readable surface, type-derived and drift-gated.Verified
pnpm typecheck✅ ·pnpm test✅ 3143 pass (193 files) ·agent-docs --checkfresh ✅🤖 Generated with Claude Code