Skip to content

feat(docs): forge docs render — self-writing doc surfaces + one brand diagram theme - #119

Merged
CodeWithJuber merged 1 commit into
masterfrom
claude/repo-review-agentic-generics-tteyld
Aug 7, 2026
Merged

feat(docs): forge docs render — self-writing doc surfaces + one brand diagram theme#119
CodeWithJuber merged 1 commit into
masterfrom
claude/repo-review-agentic-generics-tteyld

Conversation

@CodeWithJuber

Copy link
Copy Markdown
Owner

What & why

Keeping the docs in full sync with the code was manual: forge docs check detects drift and fails CI, but every fix was still a human hand-editing tables across five files (the last feature PR needed the "N MCP tools" count bumped in six places by hand). And the mermaid diagrams each carried their own hand-pasted theme string.

forge docs render closes the loop — the derivable doc surfaces are now generated from the same registries the check reads, into marker-managed blocks (the exact pattern npm run bench already uses for reports/benchmarks.md). Prose stays human; tables and diagrams become machine-owned:

  • README command table + GUIDE group map — rendered from COMMANDS/GROUPS, so the docs always show exactly the --help grouping, one source of truth.
  • GUIDE MCP tool table — rendered from the TOOLS registry.
  • "N MCP tools" count phrases — auto-corrected across all six files they live in.
  • One shared mermaid theme derived from brand.json (no hardcoded hexes) with readability settings the hand-written init strings lacked (edge label background, cluster colors, font size, curve, spacing) — normalized across every tracked markdown file; deliberate bad-example blocks opted out with docs-check-ignore stay untouched. Change the brand → run render → every diagram re-themes.
  • A repo map in ARCHITECTURE.md drawn from the live import graph (directories sized by file count, edges = import counts) — the architecture picture cannot drift from the tree it describes.

docs check gains a render reconciler with calibrated severity: a stale registry-derived block is an error whose message is the fix (run forge docs render); tree-derived output (repo map, diagram theme) is a warning, so moving a file never fails an unrelated PR — but shipping a new command with a stale table always does. Roots without markers manage nothing and stay ok (fixture safety; forks can opt out by deleting markers).

forge docs render --check reports drift without writing (exit 1), for local pre-push use.

Checklist

  • npm test passes (1,097 pass / 0 fail locally, Node 20)
  • npm run check passes (Biome lint + format)
  • New public functions have a test (test/docs_render.test.js ×9: renderer/registry coverage, splice idempotence, count rewrite, theme normalization + opt-outs, repo map from a real tree, end-to-end render → tamper → strict-drift, fixture safety)
  • Conventional commit message (feat:/fix:/docs: …)
  • CHANGELOG.md updated under ## [Unreleased]
  • No new runtime dependency (dev deps ok)
  • Substrate/docs updated if this changes forge substrate, forge impact, router/gate, or MCP substrate tools (GUIDE section for docs render, mintlify core.mdx, COMMANDS usage/flags)

Risk & rollback

  • Risk level: low — additive subcommand + one new reconciler; generated block content is identical in spirit to the hand tables it replaces (now sourced from COMMANDS summaries); the only repo-wide rewrite is the mermaid %%{init line, which keeps the two brand hexes docs check already enforces.
  • Rollback plan: revert the commit; the docs keep their last rendered content (fully valid markdown), and deleting the markers returns any table to hand maintenance.

Extra checks (tick if applicable)

  • npm run typecheck passes
  • Input validated at boundaries; errors handled (no swallowing) — renderer failure never takes docs check down (try/catch → skip); missing files/markers degrade to informational
  • Authorization/ownership checked (if it touches access) — n/a
  • Logs contain no secrets/PII
  • If AI-assisted: I understand it, verified the package APIs, and it has tests

🤖 Generated with Claude Code

https://claude.ai/code/session_01LXmzxfRVDRVPU6LG8W39Rz


Generated by Claude Code

…from the registries

docs check could only DETECT drift between the registries and the prose;
every fix was still a human hand-editing tables across five files. This
closes the loop with the marker-managed-block pattern bench already uses
for reports/benchmarks.md:

- README command table + GUIDE group map rendered from COMMANDS/GROUPS —
  the docs now show exactly the --help grouping, one source of truth.
- The GUIDE MCP tool table rendered from the TOOLS registry.
- Every literal "N MCP tools" count phrase auto-corrected across the six
  files it lives in.
- One shared mermaid theme derived from brand.json (never hardcoded
  hexes) with the readability settings the hand-written init strings
  lacked — normalized across every tracked markdown file; deliberate
  bad-example blocks opted out via docs-check-ignore stay untouched.
- A repo map in ARCHITECTURE.md drawn from the live import graph
  (directories sized by file count, edges = import counts), so the
  architecture picture cannot drift from the tree it describes.

docs check gains a render reconciler: a stale registry-derived block is
an ERROR whose message is the fix (run forge docs render); tree-derived
output (repo map, diagram theme) is a WARNING so moving a file never
fails an unrelated PR, but a new command with a stale table always does.
Roots without markers manage nothing and stay ok (fixture safety).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXmzxfRVDRVPU6LG8W39Rz
@CodeWithJuber
CodeWithJuber marked this pull request as ready for review August 7, 2026 07:52
@CodeWithJuber
CodeWithJuber merged commit db06ff2 into master Aug 7, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants