feat: build each doc kind with its own MkDocs config and site

This commit is contained in:
2026-09-12 14:23:22 +05:30
parent 582b6809a0
commit 2ae96f58de
21 changed files with 942 additions and 443 deletions

View File

@@ -2,7 +2,7 @@
`docforge` turns GSDFC-compliant Python docstrings into maintainable reference
documentation. It never edits source docstrings; it reads them, renders them,
and assembles a single MkDocs site from all available material.
and assembles documentation sites from all available material.
## What it generates
@@ -13,16 +13,17 @@ and assembles a single MkDocs site from all available material.
| `wiki` | Hand-written markdown | `docs/wiki/**` (unchanged) |
| `mcp` | GSDFC docstrings + renderers | `docs/mcp/**` structured JSON |
## Combined build
## Per-kind MkDocs builds
One `mkdocs.yml` and one MkDocs build serve all kinds:
Each enabled site kind produces its own MkDocs configuration and build:
1. Wiki navigation is derived from the `docs/wiki/` file structure.
2. Generated library/API navigation is appended after it.
3. The wiki `index.md` becomes the site `Home`.
1. `--mkdocs` (lib) writes `docs/mkdocs.lib.yml` and builds `site/lib/`.
2. `--api` writes `docs/mkdocs.api.yml` and builds `site/api/`.
3. `--wiki` writes `docs/mkdocs.wiki.yml` and builds `site/wiki/`.
Hand-written wiki content is never overwritten or regenerated — only its
navigation is derived automatically.
Every site is self-contained (own theme assets and search index) with
navigation derived or scoped to that kind. Hand-written wiki content is never
overwritten or regenerated — only its navigation is derived automatically.
## MCP bundle

View File

@@ -35,6 +35,6 @@ file structure via `build_wiki_nav`.
- `commands.py` — the `build` command and its `--mkdocs` / `--api` / `--wiki`
/ `--mcp` modes
- `mkdocs_utils.py` — config generation (`mkdocs.yml`) including merged
wiki + lib + api navigation
- `mkdocs_utils.py` per-kind config generation (`docs/mkdocs.{lib,api,wiki}.yml`)
with navigation re-rooted to each kind's `docs_dir`
- `api_utils.py` — OpenAPI loading and API docs generation

View File

@@ -8,7 +8,7 @@ A docs build runs through the CLI in a single pass.
# Library reference only
doc-forge build --mkdocs --module docforge
# Wiki + library combined (single MkDocs build)
# Wiki + library (each an independent MkDocs build)
doc-forge build --wiki --mkdocs --module docforge
# Wiki only — no module required
@@ -18,21 +18,26 @@ doc-forge build --wiki --site-name docforge
doc-forge build --mcp --module docforge
```
## What a combined build does
## What a build does
1. Validates the requested modes (`--mkdocs`, `--api`, `--wiki`, `--mcp`).
2. Generates library sources under `docs/lib/**` with `MkDocsRenderer`.
3. Generates API sources under `docs/api/**` when `--api` is given.
4. Derives wiki navigation from `docs/wiki/**`.
5. Writes `mkdocs.yml` with merged navigation — wiki first, generated groups
appended, and the wiki `Home` replacing any spec `Home` entry.
6. Runs `mkdocs build` once and emits the site.
4. Derives the wiki navigation from `docs/wiki/**`.
5. Writes one MkDocs config per site kind (`docs/mkdocs.{lib,api,wiki}.yml`),
re-rooting navigation paths to each kind's `docs_dir`.
6. Runs `mkdocs build` once per config, emitting self-contained sites
`site/lib/`, `site/api/`, and `site/wiki/`.
## Explore the site
## Explore the sites
```bash
doc-forge build --wiki --mkdocs --module docforge
doc-forge serve --mkdocs --mkdocs-yml mkdocs.yml
doc-forge serve --wiki # serves site preview from docs/mkdocs.wiki.yml
doc-forge serve --lib
doc-forge serve --api
# or target any config directly:
doc-forge serve --mkdocs --mkdocs-yml docs/mkdocs.wiki.yml
```
## Serve the MCP bundle

View File

@@ -2,7 +2,7 @@
`docforge` is an internal documentation tool that generates reference
documentation from Google-Styled Doc-Forge Convention (GSDFC) docstrings and
assembles it into a single MkDocs site, alongside hand-written wiki pages and
assembles it into per-kind MkDocs sites, alongside hand-written wiki pages and
OpenAPI-based API docs.
---
@@ -11,7 +11,7 @@ OpenAPI-based API docs.
- 🧪 GSDFC docstring extraction via Griffe
- 🧭 Auto-derived navigation for hand-written wiki pages
- 🗂 Combined MkDocs build: wiki first, then generated library/API reference
- 🗂 Independent MkDocs builds per kind (lib, api, wiki) into `site/{kind}`
- 🔌 Material MkDocs theming out of the box
- 📦 MCP structured documentation resources