diff --git a/docs/mkdocs.wiki.yml b/docs/mkdocs.wiki.yml index fee5b50..e1eb24b 100644 --- a/docs/mkdocs.wiki.yml +++ b/docs/mkdocs.wiki.yml @@ -62,12 +62,12 @@ site_dir: ../site/wiki nav: - Home: index.md - Overview: 01_overview.md -- Architecture: 02_architecture.md +- Components: 02_components.md - Conventions: 03_conventions.md - Iterative Workflow: 04_iterative_workflow.md - Development: - Environment: 05_development/01_environment.md - Quality Gates: 05_development/02_quality_gates.md - - Gsdfc Guide: 05_development/03_gsdfc_guide.md - - Mcp Guide: 05_development/04_mcp_guide.md - - Mkdocs Configs: 05_development/05_mkdocs_configs.md + - GSDFC Guide: 05_development/03_gsdfc_guide.md + - MCP Guide: 05_development/04_mcp_guide.md + - MkDocs Configs: 05_development/05_mkdocs_configs.md diff --git a/docs/wiki/01_overview.md b/docs/wiki/01_overview.md index 25797be..d82d55d 100644 --- a/docs/wiki/01_overview.md +++ b/docs/wiki/01_overview.md @@ -1,10 +1,12 @@ -# Overview +# Library Overview `docforge` turns GSDFC-compliant Python docstrings into maintainable reference documentation. It never edits source docstrings; it reads them, renders them, and assembles documentation sites from all available material. -## What it generates +--- + +## 🧭 Which Build Should You Use? | Kind | Source | Output | |-----------|----------------------------|---------------------------------| @@ -13,7 +15,9 @@ and assembles documentation sites from all available material. | `wiki` | Hand-written markdown | `docs/wiki/**` (unchanged) | | `mcp` | GSDFC docstrings + renderers | `docs/mcp/**` structured JSON | -## Per-kind MkDocs builds +--- + +## πŸ—οΈ Architecture Each enabled site kind produces its own MkDocs configuration and build: @@ -25,8 +29,15 @@ 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 +--- + +## πŸ”„ Lifecycle Rules `docs/mcp/**` is a self-contained, machine-readable reference generated from docforge's own GSDFC docstrings. `doc-forge serve --mcp --module docforge` -serves it over MCP. See the [MCP Guide](05_development/04_mcp_guide.md). \ No newline at end of file +serves it over MCP. See the [MCP Guide](05_development/04_mcp_guide.md). + +--- + +## ➑️ Read Next +- [02 – Components](02_components.md) Β· [03 – Conventions](03_conventions.md) \ No newline at end of file diff --git a/docs/wiki/02_architecture.md b/docs/wiki/02_components.md similarity index 81% rename from docs/wiki/02_architecture.md rename to docs/wiki/02_components.md index 0a72c9e..d82fbdd 100644 --- a/docs/wiki/02_architecture.md +++ b/docs/wiki/02_components.md @@ -1,35 +1,45 @@ -# Architecture +# Components `docforge` is split into four horizontal layers. Everything flows top to bottom through the CLI. -## Loaders β†’ Models +--- + +## 1. Loaders & Models The `docforge/loaders` package wraps `griffe` to extract modules, functions, classes, and Google-style docstring sections. Loaded data is normalized into the object model under `docforge/models` (`Project`, `Module`, `DocObject`). -## Navigation +--- + +## 2. Navigation `docforge/nav` parses `docforge.nav.yml` specs (`NavSpec`, `Resolver`, and the MkDocs nav emitter) and, since the wiki kind, derives wiki navigation from the file structure via `build_wiki_nav`. -## Renderers +--- + +## 3. Renderers `docforge/renderers` turn model data into artifacts: - `MkDocsRenderer` β†’ `docs/lib/**` reference markdown - `MCPRenderer` β†’ `docs/mcp/**` structured documentation -## Servers +--- + +## 4. Servers `docforge/servers` serves generated artifacts over live protocols: - `MCPServer` β†’ serves a pre-generated `docs/mcp/**` bundle through MCP resources (`docs://index`, `docs://nav`, `docs://modules/{module}`) -## CLI +--- + +## 5. CLI `docforge/cli` wires it all together: @@ -37,4 +47,9 @@ file structure via `build_wiki_nav`. / `--mcp` modes - `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 \ No newline at end of file +- `api_utils.py` β€” OpenAPI loading and API docs generation + +--- + +## Related +- [01 – Overview](01_overview.md) Β· [03 – Conventions](03_conventions.md) \ No newline at end of file diff --git a/docs/wiki/03_conventions.md b/docs/wiki/03_conventions.md index 1ab2ec4..44c6efb 100644 --- a/docs/wiki/03_conventions.md +++ b/docs/wiki/03_conventions.md @@ -1,5 +1,7 @@ # Conventions +--- + ## GSDFC docstrings All documented source uses the Google-Styled Doc-Forge Convention (GSDFC): @@ -12,31 +14,42 @@ package docstring, which is exported verbatim into Key rules: -- Use parenthesized types in prose entries (`name (Type):`) that match the - signature types. -- Use `# Summary`, `# Examples`, and `# Notes` sections at module level. -- Use `Args:`, `Returns:`, `Raises:`, `Yields:`, `Notes:`, and `Example:` - sections at function and method level. -- Always update the matching `.pyi` stub alongside the `.py` implementation. +1. Use parenthesized types in prose entries (`name (Type):`) that match the + signature types. +2. Use `# Summary`, `# Examples`, and `# Notes` sections at module level. +3. Use `Args:`, `Returns:`, `Raises:`, `Yields:`, `Notes:`, and `Example:` + sections at function and method level. +4. Always update the matching `.pyi` stub alongside the `.py` implementation. + +--- ## `.pyi` stubs Every module ships a matching `.pyi` stub kept in sync with the `.py` implementation. When signatures change, update both files. +--- + ## Wiki pages -- Hand-written markdown lives in `docs/wiki/**` and is never generated. -- File names use a numeric prefix: `01_overview.md`, `02_architecture.md`. -- Nested directories become nested navigation groups: - `05_development/01_environment.md` β†’ group *Development*. -- `index.md` is the site `Home` at the root, and a section root inside a - directory. -- Navigation labels are derived by stripping the numeric prefix and applying - title case on the remaining words. +1. Hand-written markdown lives in `docs/wiki/**` and is never generated. +2. File names use a numeric prefix: `01_overview.md`, `02_components.md`. +3. Nested directories become nested navigation groups: + `05_development/01_environment.md` β†’ group *Development*. +4. `index.md` is the site `Home` at the root, and a section root inside a + directory. +5. Navigation labels are derived by stripping the numeric prefix and applying + title case on the remaining words. + +--- ## Templates MkDocs config fragments live in `docforge/templates`. The `mkdocs.wiki.yml` fragment carries only the `search` plugin, since wiki pages contain no -mkdocstrings directives. \ No newline at end of file +mkdocstrings directives. + +--- + +## Related +- [02 – Components](02_components.md) Β· [04 – Iterative Workflow](04_iterative_workflow.md) \ No newline at end of file diff --git a/docs/wiki/04_iterative_workflow.md b/docs/wiki/04_iterative_workflow.md index 94a355e..65fa1c4 100644 --- a/docs/wiki/04_iterative_workflow.md +++ b/docs/wiki/04_iterative_workflow.md @@ -2,7 +2,9 @@ A docs build runs through the CLI in a single pass. -## Build commands +--- + +## πŸš€ Build commands ```bash # Library reference only @@ -18,7 +20,9 @@ doc-forge build --wiki --site-name docforge doc-forge build --mcp --module docforge ``` -## What a build does +--- + +## πŸ”„ What a build does 1. Validates the requested modes (`--mkdocs`, `--api`, `--wiki`, `--mcp`). 2. Generates library sources under `docs/lib/**` with `MkDocsRenderer`. @@ -29,7 +33,9 @@ doc-forge build --mcp --module docforge 6. Runs `mkdocs build` once per config, emitting self-contained sites `site/lib/`, `site/api/`, and `site/wiki/`. -## Explore the sites +--- + +## 🧭 Explore the sites ```bash doc-forge build --wiki --mkdocs --module docforge @@ -40,9 +46,16 @@ doc-forge serve --api doc-forge serve --mkdocs --mkdocs-yml docs/mkdocs.wiki.yml ``` -## Serve the MCP bundle +--- + +## πŸ“¦ Serve the MCP bundle ```bash doc-forge build --mcp --module docforge doc-forge serve --mcp --module docforge -``` \ No newline at end of file +``` + +--- + +## Related +- [03 – Conventions](03_conventions.md) Β· [01 – Environment](05_development/01_environment.md) \ No newline at end of file diff --git a/docs/wiki/05_development/01_environment.md b/docs/wiki/05_development/01_environment.md index 7c55380..aedfcd9 100644 --- a/docs/wiki/05_development/01_environment.md +++ b/docs/wiki/05_development/01_environment.md @@ -1,6 +1,8 @@ # Environment Setup -## Create the environment +--- + +## πŸš€ Create the environment ```bash python -m venv .venv @@ -10,7 +12,9 @@ pip install -e . Requires Python 3.10+ (per `pyproject.toml`). -## Dependencies +--- + +## πŸ“¦ Dependencies Development extras include: @@ -18,4 +22,9 @@ Development extras include: - `ruff` β€” lint and format checking - `black` β€” auto-formatting - `mypy` β€” strict typing checks -- `pydoclint` β€” docstring ↔ signature consistency checks \ No newline at end of file +- `pydoclint` β€” docstring ↔ signature consistency checks + +--- + +## Related +- [04 – Iterative Workflow](../04_iterative_workflow.md) Β· [02 – Quality Gates](02_quality_gates.md) \ No newline at end of file diff --git a/docs/wiki/05_development/02_quality_gates.md b/docs/wiki/05_development/02_quality_gates.md index 8966aea..c157aaf 100644 --- a/docs/wiki/05_development/02_quality_gates.md +++ b/docs/wiki/05_development/02_quality_gates.md @@ -2,6 +2,10 @@ Run all checks before pushing: +--- + +## πŸš€ Commands + ```bash .venv\Scripts\python.exe -m pytest .venv\Scripts\python.exe -m ruff check docforge tests @@ -10,7 +14,9 @@ Run all checks before pushing: .venv\Scripts\pydoclint.exe docforge ``` -## Test layout +--- + +## πŸ“ Test layout | Path | Covers | |--------------------------|------------------------------------| @@ -20,4 +26,9 @@ Run all checks before pushing: CLI tests use the `cli_runner` fixture with `mock_mkdocs_build` and `mock_mkdocs_load_config` so they exercise the full flow without invoking a -real MkDocs build. \ No newline at end of file +real MkDocs build. + +--- + +## Related +- [01 – Environment](01_environment.md) Β· [03 – GSDFC Guide](03_gsdfc_guide.md) \ No newline at end of file diff --git a/docs/wiki/05_development/03_gsdfc_guide.md b/docs/wiki/05_development/03_gsdfc_guide.md index 90d01ab..faa6a84 100644 --- a/docs/wiki/05_development/03_gsdfc_guide.md +++ b/docs/wiki/05_development/03_gsdfc_guide.md @@ -5,7 +5,9 @@ in the `docforge/__init__.py` package docstring. It describes how to write docstrings that render correctly in MkDocs and stay machine-parseable by doc-forge, MkDocs, and MCP clients. -## Overview +--- + +## 🧭 Overview - Docstrings are the single source of truth. - `doc-forge` compiles docstrings but never rewrites them. @@ -13,7 +15,9 @@ doc-forge, MkDocs, and MCP clients. - Type hints live in signatures; prose entries repeat the type in parentheses and must match the signature. -## Module docstrings +--- + +## πŸ“¦ Module docstrings Modules use Markdown headings and `---` separators. @@ -23,7 +27,9 @@ Recommended sections: - `# Examples` β€” a representative usage snippet - `# Notes` β€” guarantees, lifecycle, and thread-safety notes -## Class docstrings +--- + +## πŸ“¦ Class docstrings Recommended sections, in order: @@ -32,7 +38,9 @@ Recommended sections, in order: - `Notes:` β€” grouped subsections such as **Guarantees**, **Lifecycle** - `Example:` β€” indented `python` code block -## Function and method docstrings +--- + +## πŸ“¦ Function and method docstrings Recommended section order: @@ -53,12 +61,16 @@ Formatting rules: - Fenced `python` blocks are allowed inside `Example:` sections, indented four spaces. -## Property docstrings +--- + +## πŸ“¦ Property docstrings Properties document their return values with a `Returns:` section and, when meaningful, an `Example:`. -## Example +--- + +## πŸš€ Example ```python def process(foo: Foo, multiplier: int) -> int: @@ -90,13 +102,17 @@ def process(foo: Foo, multiplier: int) -> int: """ ``` -## Keeping stubs in sync +--- + +## πŸ”„ Keeping stubs in sync Every `.py` module ships a matching `.pyi` stub. When a signature or a public symbol changes, update both files. Signature annotations in the stub must match the implementation. -## Enforcement +--- + +## πŸ›‘οΈ Enforcement `pydoclint` (Google style) runs in CI and verifies that `Args:`/`Returns:` sections match function signatures, including types. @@ -105,4 +121,9 @@ sections match function signatures, including types. - `skip-checking-raises = true` β€” `Raises:` sections are descriptive and are not required to map to literal `raise` statements. - `check-class-attributes = false` β€” `Attributes:` sections document instance - attributes without class-level annotations. \ No newline at end of file + attributes without class-level annotations. + +--- + +## Related +- [02 – Quality Gates](02_quality_gates.md) Β· [04 – MCP Guide](04_mcp_guide.md) \ No newline at end of file diff --git a/docs/wiki/05_development/04_mcp_guide.md b/docs/wiki/05_development/04_mcp_guide.md index 6a2dbdf..c5d474e 100644 --- a/docs/wiki/05_development/04_mcp_guide.md +++ b/docs/wiki/05_development/04_mcp_guide.md @@ -5,7 +5,9 @@ GSDFC docstrings and serve that bundle over the Model Context Protocol (MCP). The bundle is self-contained: readers can derive the full API reference β€” signatures, docstrings, and structure β€” for the documented project. -## Building the bundle +--- + +## πŸš€ Building the bundle ```bash doc-forge build --mcp --module docforge @@ -17,7 +19,9 @@ This writes structured JSON into `docs/mcp/`: - `nav.json` β€” module list with `docs://modules/{module}` resource URIs - `modules/{dotted.path}.json` β€” per-module serialized documentation -## Serving the bundle +--- + +## πŸš€ Serving the bundle ```bash doc-forge serve --mcp --module docforge @@ -36,7 +40,9 @@ Missing resources are returned as structured error dictionaries rather than exceptions. The default transport is `streamable-http`; `stdio` and `sse` are supported via `MCPServer.run`. -## Bundle contents +--- + +## πŸ“¦ Bundle contents Each module resource contains: @@ -48,4 +54,9 @@ Each module resource contains: Because the bundle is generated from docstrings, the quality of the bundle equals the quality of the project's GSDFC docstrings. For docforge itself, the GSDFC specification is carried in `modules/docforge.json` via the -`docforge/__init__.py` package docstring, making the bundle self-documenting. \ No newline at end of file +`docforge/__init__.py` package docstring, making the bundle self-documenting. + +--- + +## Related +- [03 – GSDFC Guide](03_gsdfc_guide.md) Β· [05 – MkDocs Configs](05_mkdocs_configs.md) \ No newline at end of file diff --git a/docs/wiki/05_development/05_mkdocs_configs.md b/docs/wiki/05_development/05_mkdocs_configs.md index 1f5fbec..658d776 100644 --- a/docs/wiki/05_development/05_mkdocs_configs.md +++ b/docs/wiki/05_development/05_mkdocs_configs.md @@ -5,7 +5,9 @@ repo that documents kind `{kind}` carries a config at `docs/mkdocs.{kind}.yml` that sets `docs_dir` to the kind's source directory and `site_dir` to `../site/{kind}`. -## File wins +--- + +## πŸ“„ File wins `docs/mkdocs.{kind}.yml` is a repo-owned file, not a build byproduct: @@ -19,7 +21,9 @@ that sets `docs_dir` to the kind's source directory and `site_dir` to Because a present file is never rewritten, rerunning a build is a no-op for versioned configs: the working tree stays clean. -## Templates +--- + +## 🧩 Templates The built-in defaults live in `docforge/templates/`: @@ -36,7 +40,9 @@ kind fragment, then filling in generation-time values (`site_name`, theme `icon` from `docforge.nav.yml`). Pass `--template ` to replace the built-in templates entirely. -## Supported layouts +--- + +## πŸ—οΈ Supported layouts - **Per-kind config** β€” the standard layout; each kind builds to `site/{kind}` and is served under `//{kind}/`. @@ -45,4 +51,9 @@ built-in templates entirely. doc-forge never reads or writes root `mkdocs.yml`; the docs service maps the kind to the root `site/` dir in this case. -Commit `docs/mkdocs.{kind}.yml` so served docs are reproducible from source. \ No newline at end of file +Commit `docs/mkdocs.{kind}.yml` so served docs are reproducible from source. + +--- + +## Related +- [04 – MCP Guide](04_mcp_guide.md) \ No newline at end of file diff --git a/docs/wiki/index.md b/docs/wiki/index.md index ceb3d33..cd5bd8d 100644 --- a/docs/wiki/index.md +++ b/docs/wiki/index.md @@ -1,9 +1,10 @@ -# πŸ”¨ docforge β€” Docstring-Driven Documentation Forge +# 🧩 docforge β€” Docstring-Driven Documentation Forge -`docforge` is an internal documentation tool that generates reference -documentation from Google-Styled Doc-Forge Convention (GSDFC) docstrings and -assembles it into per-kind MkDocs sites, alongside hand-written wiki pages and -OpenAPI-based API docs. +`docforge` is an internal documentation tool that generates reference documentation from Google-Styled Doc-Forge Convention (GSDFC) docstrings and assembles it into per-kind MkDocs sites, alongside hand-written wiki pages and OpenAPI-based API docs. + +> **Doc model:** this wiki is written for humans β€” how‑to guides, examples, +> and testing recipes. The authoritative API contracts live in the code +> (docstrings) and the machine‑readable bundle under `docs/mcp/`. --- @@ -17,17 +18,28 @@ OpenAPI-based API docs. --- +## πŸ“¦ Installation + +```bash +# Internal PyPI (TBD) +pip install docforge +``` + +--- + ## πŸ“ Documentation Structure | Section | Description | |----------------------------------------------| -------------------------------------------------- | | [Overview](01_overview.md) | What docforge is and how it fits the pipeline | -| [Architecture](02_architecture.md) | Loaders, models, nav, renderers, CLI, servers | +| [Components](02_components.md) | Loaders, models, nav, renderers, CLI, servers | | [Conventions](03_conventions.md) | GSDFC, `.pyi` stubs, and template conventions | | [Iterative Workflow](04_iterative_workflow.md) | How a docs build runs end to end | -| [Development](05_development/01_environment.md) | Environment setup and quality gates | -| [Docstring Guide](05_development/03_gsdfc_guide.md) | How to write GSDFC-conformant docstrings | +| [Environment](05_development/01_environment.md) | Environment setup | +| [Quality Gates](05_development/02_quality_gates.md) | Test layout and quality checks | +| [GSDFC Guide](05_development/03_gsdfc_guide.md) | How to write GSDFC-conformant docstrings | | [MCP Guide](05_development/04_mcp_guide.md) | Building, serving, and consuming the MCP bundle | +| [MkDocs Configs](05_development/05_mkdocs_configs.md) | MkDocs config generation and templates | --- @@ -301,4 +313,4 @@ Verification checklist: ```` --- -Β© Aetoskia Internal \ No newline at end of file +Β© Aetoskia Internal β€” `docforge` 1.0 \ No newline at end of file