34 Commits

Author SHA1 Message Date
3dc6ac9427 Improve documentation look & feel via MkDocs Material template enhancements
All checks were successful
continuous-integration/drone/tag Build is passing
2026-03-07 16:22:00 +05:30
b6306baafc Improve documentation look & feel via MkDocs Material template enhancements (#5)
# Improve documentation look & feel via MkDocs Material template enhancements

## Summary

This MR improves the overall **documentation experience and visual presentation** of the doc-forge docs by enhancing the MkDocs Material template configuration.

The changes focus on **navigation usability, code readability, and richer Markdown rendering**, resulting in a cleaner and more professional documentation site.

Docstring changes were made across the codebase for consistency, but this MR description focuses on the **template and presentation improvements**.

---

## Navigation Improvements

The navigation system has been enhanced to provide a clearer structure and better discoverability.

Key improvements include:

* Section-aware navigation in the sidebar
* Automatic expansion of module/package hierarchy
* Scroll tracking within the sidebar
* Clickable package index pages

Material navigation features added:

* `navigation.sections`
* `navigation.expand`
* `navigation.tracking`
* `navigation.indexes`

This results in a **single cohesive navigation tree** that exposes the entire documentation hierarchy from the sidebar.

---

## Code Block Improvements

Code blocks previously appeared relatively plain. The template now enables richer syntax highlighting and improved readability.

Enhancements include:

* Syntax highlighting using `pymdownx.highlight`
* Line numbers for code blocks
* Anchored line numbers for deep linking
* Improved fenced code block rendering

Additional Material features:

* `content.code.copy` — copy button for code blocks
* `content.code.annotate` — support for code annotations

These changes significantly improve the readability of examples and API snippets throughout the documentation.

---

## Markdown Rendering Enhancements

Additional Markdown extensions were enabled to support richer documentation features:

* `pymdownx.superfences` for advanced fenced blocks
* `pymdownx.inlinehilite` for inline code highlighting
* `pymdownx.snippets` for reusable snippets
* `admonition` and `pymdownx.details` for callouts and collapsible sections
* `pymdownx.tabbed` for tabbed content blocks
* `pymdownx.tasklist` for checklist-style items
* `tables`, `footnotes`, and advanced formatting extensions

These extensions make it easier to write expressive and structured documentation.

---

## Search Experience

The documentation search experience has been improved using Material search features:

* `search.highlight`
* `search.share`
* `search.suggest`

These enhancements provide:

* highlighted search matches
* sharable search URLs
* auto-suggestions while typing

---

## mkdocstrings Improvements

The mkdocstrings configuration has been expanded to produce clearer API documentation.

Notable improvements include:

* grouping objects by category
* explicit category headings
* improved symbol headings
* cleaner object path display

This results in more structured API documentation pages.

---

## Result

Overall, these changes provide:

* cleaner and more intuitive navigation
* significantly improved code presentation
* richer Markdown capabilities
* better search usability

The documentation now has a **more polished, modern appearance** and improved usability for both readers and contributors.

Reviewed-on: #5
Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
2026-03-07 10:50:18 +00:00
f8ca6075fb google styled doc string 2026-02-28 19:32:17 +05:30
3f68e51e58 google styled doc string 2026-02-28 19:19:20 +05:30
87a7f4eee1 google styled doc string 2026-02-28 18:53:02 +05:30
b5379cd82e added hierarchy rules 2026-02-27 21:27:47 +05:30
caeda0ad5c minor formatting changes 2026-02-27 21:16:05 +05:30
7643e27358 added tab feature 2026-02-27 21:12:50 +05:30
04db9f44d8 fixes for broken Examples and other formatting issues 2026-02-27 21:05:15 +05:30
6c8da4b43b fixes for bland looking doc strings 2026-02-27 20:47:23 +05:30
066e710dee doc string changes with sample to generate doc strings for packages/modules 2026-02-27 14:10:57 +05:30
ed0fac8b3d doc string changes with sample to generate doc strings for packages/modules 2026-02-27 14:10:15 +05:30
fbe9e1f109 Flatten MkDocs output structure, enforce root index.md, and add --module-is-source to produce deployable standalone static documentation sites without nested path issues.
All checks were successful
continuous-integration/drone/tag Build is passing
2026-02-21 21:47:34 +05:30
22fceef020 Flatten MkDocs Structure + --module-is-source Support (#4)
# Merge Request: Flatten MkDocs Structure + `--module-is-source` Support

## Summary

This MR introduces structural improvements to the MkDocs generation pipeline to:

1. Ensure a root `docs/index.md` always exists
2. Flatten documentation structure (remove `docs/<module>/` nesting by default)
3. Add support for `--module-is-source` to treat the module as the documentation root
4. Align navigation (`docforge.nav.yml`) with the new flat layout
5. Regenerate MCP artifacts to reflect updated signatures and docstrings

This resolves static hosting issues (e.g., Nginx 403 due to missing `site/index.html`) and makes each generated MkDocs site deployable as a standalone static website.

---

## Motivation

Previously, documentation was generated under:

```
docs/<module>/...
```

Which resulted in:

```
site/<module>/index.html
```

When deployed at `/libs/<project>/`, this caused:

* Missing `site/index.html`
* Nginx returning 403 for root access
* Inconsistent static hosting behavior

This MR corrects the architecture so each MkDocs build is a valid static site with a root entry point.

---

## Key Changes

### 1️⃣ Flattened Docs Structure

**Before**

```
docs/docforge/index.md
```

**After**

```
docs/index.md
```

All documentation paths were updated accordingly:

* `docs/docforge/cli/...` → `docs/cli/...`
* `docs/docforge/models/...` → `docs/models/...`
* `docs/docforge/renderers/...` → `docs/renderers/...`

Navigation updated to match the flat layout.

---

### 2️⃣ Root Index Enforcement

`MkDocsRenderer` now guarantees:

* `docs/index.md` is always created
* Parent `index.md` files are auto-generated if missing
* Parent indexes link to child modules (idempotent behavior)

This ensures:

```
site/index.html
```

Always exists after `mkdocs build`.

---

### 3️⃣ New CLI Flag: `--module-is-source`

Added option:

```
--module-is-source
```

Behavior:

* Treats the provided module as the documentation root
* Removes the top-level module folder from generated paths
* Prevents redundant nesting when the module corresponds to the source root

Updated components:

* `cli.commands.build`
* `mkdocs_utils.generate_sources`
* `MkDocsRenderer.generate_sources`
* Stub files (`.pyi`)
* MCP JSON artifacts

---

### 4️⃣ Navigation Spec Update

`docforge.nav.yml` updated:

**Before**

```yaml
home: docforge/index.md
```

**After**

```yaml
home: index.md
```

All group paths adjusted to remove `docforge/` prefix.

---

### 5️⃣ MkDocs Config Update

`mkdocs.yml` updated to:

* Move `site_name` below theme/plugins
* Use flat navigation paths
* Point Home to `index.md`

---

### 6️⃣ MCP Artifact Regeneration

Updated:

* Function signatures (new parameter)
* Docstrings (reflect `module_is_source`)
* Renderer metadata
* Line numbers

Ensures MCP output matches updated API.

---

## Architectural Outcome

Each project now produces a **valid standalone static site**:

```
site/
  index.html
  assets/
  search/
```

Safe for deployment under:

```
/libs/<project>/
```

No Nginx rewrites required.
No directory-index issues.
No nested-site ambiguity.

---

## Backward Compatibility

* Existing CLI usage remains valid
* `--module-is-source` is optional
* Navigation spec format unchanged (only paths adjusted)

---

## Deployment Impact

After merge:

* Each library can be deployed independently
* Sites can be merged under a shared root without internal conflicts
* Static hosting is predictable and production-safe

---

## Testing

* Verified MkDocs build produces `site/index.html`
* Verified navigation renders correctly
* Verified parent index generation is idempotent
* Regenerated MCP docs and validated schema consistency

---

## Result

The documentation compiler now:

* Produces structurally correct static sites
* Supports flat and source-root modes
* Eliminates 403 root issues
* Scales cleanly across multiple repositories

This aligns doc-forge with proper static-site architectural invariants.

Reviewed-on: #4
Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
2026-02-21 16:16:36 +00:00
56fb39de08 bumped up to version 0.0.4 with cli standardisation and rich doc strings
All checks were successful
continuous-integration/drone/tag Build is passing
2026-01-22 17:48:34 +05:30
8a509e590a tree using module instead of modules 2026-01-22 17:47:59 +05:30
cb68b0b93f passing module for mcp server name 2026-01-22 17:43:34 +05:30
2ed962d639 docs-and-mcps (#3)
Reviewed-on: #3
Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
2026-01-22 11:28:14 +00:00
678f522456 (0.0.3): Refactor - Modular CLI Structure, Type Synchronization, and Documentation Audit
All checks were successful
continuous-integration/drone/tag Build is passing
2026-01-21 18:59:09 +05:30
ff92906720 cli-cleanup (#2)
Some checks reported errors
continuous-integration/drone/tag Build was killed
Reviewed-on: #2
Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
2026-01-21 13:25:57 +00:00
94c1818103 cli-cleanup (#1)
Reviewed-on: #1
Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
2026-01-21 13:23:32 +00:00
15c59ab274 doc changes 2026-01-21 17:36:08 +05:30
e33133cb0e pyi fixes
Some checks failed
continuous-integration/drone/tag Build is failing
2026-01-21 17:30:43 +05:30
f76d8ccce4 added mcp_docs 2026-01-21 17:26:47 +05:30
f6a596ab62 modules instead of module 2026-01-21 17:13:30 +05:30
ef378e676b doc:// instead of mcp:// 2026-01-21 17:10:09 +05:30
751bbe8949 added mcp server code 2026-01-21 17:08:55 +05:30
5370a7faa2 feat(mcp): add MCP JSON renderer and CLI support, update tests accordingly
- Add MCPRenderer to generate MCP-native JSON bundles (index.json, nav.json, modules/*.json)
- Expose MCPRenderer via public API and CLI (`generate-mcp` command)
- Replace Markdown-based MCP output with structured JSON resources
- Update MCP renderer type stubs to match new JSON-based implementation
- Refactor MCP tests to validate JSON content, bundle structure, and navigation
- Fix MCP module coverage test to use explicit project_root for reliable discovery
2026-01-21 16:43:21 +05:30
ce2eafac85 fix tests 2026-01-21 16:41:48 +05:30
0d0959c95b fix tests 2026-01-21 16:32:20 +05:30
427e407d26 added mcp_renderer 2026-01-21 16:18:25 +05:30
9a5e356039 rename mkdocs.py to mkdocs_renderer.py 2026-01-21 16:04:02 +05:30
b1544c9610 chore: bump version to 0.0.2 after renaming loader/model packages to loaders/models
All checks were successful
continuous-integration/drone/tag Build is passing
2026-01-21 15:46:33 +05:30
4a876abc62 refactor: rename loader/model packages to loaders/models
- Rename docforge.loader → docforge.loaders and docforge.model → docforge.models
- Update all imports, type stubs, CLI, tests, and documentation references
- Align MkDocs navigation and docforge.nav.yml with new package structure
- Adjust module docstrings and comments for consistency with pluralized naming
2026-01-21 15:45:48 +05:30
132 changed files with 11336 additions and 2101 deletions

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="pytest" type="tests" factoryName="py.test"> <configuration default="false" name="pytests" type="tests" factoryName="py.test">
<module name="docforge" /> <module name="docforge" />
<option name="ENV_FILES" value="" /> <option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />

View File

@@ -1,327 +0,0 @@
# doc-forge — Architecture & Design Specification
**doc-forge** is a renderer-agnostic Python documentation compiler. It converts Python source code and docstrings into a structured, semantic documentation model and then emits multiple downstream representations, including:
* Human-facing documentation sites (MkDocs, Sphinx)
* Machine-facing documentation bundles (MCP JSON)
* Live documentation APIs (MCP servers)
This document is the **authoritative design and codebase specification** for the library. It is written to be both **LLM-friendly** and **developer-facing**, and should be treated as the canonical reference for implementation decisions.
---
## 1. Design Goals
1. **Single Source of Truth**
Python source code and docstrings are the only authoritative input.
2. **Renderer Agnosticism**
MkDocs, Sphinx, MCP, or future renderers must not influence the core model.
3. **Deterministic Output**
Given the same codebase, outputs must be reproducible.
4. **AI-Native Documentation**
Documentation must be structured, queryable, and machine-consumable.
5. **Library-First, CLI-Second**
All functionality must be accessible as a Python API. The CLI is a thin wrapper.
---
## 2. Core Mental Model
### Fundamental Abstraction
> **The atomic unit of documentation is a Python import path**
Examples:
* `mail_intake`
* `mail_intake.config`
* `mail_intake.adapters.base`
Files, Markdown, HTML, and JSON are *representations*, not documentation units.
---
## 3. High-Level Architecture
```
Python Source Code
Introspection Layer (Griffe)
Documentation Model (doc-forge core)
Renderer / Exporter Layer
├── MkDocs
├── Sphinx
├── MCP (static JSON)
└── MCP Server (live)
```
Only the **Documentation Model** is shared across all outputs.
---
## 4. Package Layout (Proposed)
```
docforge/
├── __init__.py
├── model/
│ ├── project.py
│ ├── module.py
│ ├── object.py
│ └── nav.py
├── loader/
│ └── griffe_loader.py
├── renderers/
│ ├── base.py
│ ├── mkdocs.py
│ └── sphinx.py
├── exporters/
│ └── mcp.py
├── server/
│ └── mcp_server.py
├── cli/
│ └── main.py
└── utils/
```
---
## 5. Documentation Model (Core)
The documentation model is renderer-neutral and must not contain any MkDocs-, Sphinx-, or MCP-specific logic.
### 5.1 Project
```python
class Project:
name: str
version: str | None
modules: dict[str, Module]
nav: Navigation
```
---
### 5.2 Module
```python
class Module:
path: str # import path
docstring: str | None
members: dict[str, DocObject]
```
---
### 5.3 DocObject
Represents classes, functions, variables, etc.
```python
class DocObject:
name: str
kind: str # class, function, attribute, module
path: str
signature: str | None
docstring: str | None
members: dict[str, DocObject]
```
Private members (`_name`) are excluded by default.
---
### 5.4 Navigation
```python
class Navigation:
entries: list[NavEntry]
class NavEntry:
title: str
module: str
```
Navigation is derived, not authored.
---
## 6. Introspection Layer
### 6.1 Griffe Loader
Griffe is the **only supported introspection backend**.
Responsibilities:
* Load modules by import path
* Resolve docstrings, signatures, and members
* Tolerate alias resolution failures
Output: fully populated `Project` and `Module` objects.
---
## 7. Renderer Interface
Renderers consume the documentation model and emit renderer-specific source trees.
```python
class DocRenderer(Protocol):
name: str
def generate_sources(self, project: Project, out_dir: Path) -> None:
"""Generate renderer-specific source files."""
def build(self, config: RendererConfig) -> None:
"""Build final artifacts (HTML, site, etc.)."""
def serve(self, config: RendererConfig) -> None:
"""Serve documentation locally (optional)."""
```
---
## 8. MkDocs Renderer
### Source Generation
* Emits `.md` files
* One file per module
* Uses `mkdocstrings` directives exclusively
```md
# Config
::: mail_intake.config
```
### Build
* Uses `mkdocs.commands.build`
### Serve
* Uses `mkdocs.commands.serve`
MkDocs-specific configuration lives outside the core model.
---
## 9. Sphinx Renderer
### Source Generation
* Emits `.rst` files
* Uses `autodoc` directives
```rst
mail_intake.config
==================
.. automodule:: mail_intake.config
:members:
:undoc-members:
```
### Build
* Uses `sphinx.application.Sphinx` directly
### Serve
* Optional (static build is sufficient)
---
## 10. MCP Exporter (Static)
The MCP exporter bypasses renderers entirely.
### Output Structure
```
mcp/
├── index.json
├── nav.json
└── modules/
└── package.module.json
```
### Design Principles
* Alias-safe
* Deterministic
* Fully self-contained
* No Markdown, HTML, or templates
---
## 11. MCP Server (Live)
The MCP server exposes documentation as queryable resources.
### Resources
* `docs://index`
* `docs://nav`
* `docs://module/{module}`
### Characteristics
* Read-only
* Stateless
* Backed by MCP JSON bundle
---
## 12. CLI Design
The CLI is a thin orchestration layer.
```bash
doc-forge generate --renderer mkdocs
doc-forge generate --renderer sphinx
doc-forge build --renderer mkdocs
doc-forge serve --renderer mkdocs
doc-forge export mcp
```
Renderer choice never affects the core model.
---
## 13. Explicit Non-Goals
* Markdown authoring
* Theme design
* Runtime code execution
* Code formatting or linting
---
## 14. Invariants (Must Never Break)
1. Import paths are canonical identifiers
2. Core model contains no renderer logic
3. MCP does not depend on MkDocs or Sphinx
4. Renderers do not introspect Python directly
5. All outputs trace back to the same model
---
## 15. One-Line Definition
> **doc-forge is a documentation compiler that turns Python code into structured knowledge and emits it through multiple human and machine interfaces.**
---
*End of specification.*

767
README.md
View File

@@ -1,243 +1,534 @@
# doc-forge # docforge
A renderer-agnostic Python documentation compiler that converts Python source code and docstrings into a structured, semantic documentation model and emits multiple downstream representations. Renderer-agnostic Python documentation compiler that converts Python docstrings
into structured documentation for both humans (MkDocs) and machines (MCP / AI agents).
## Features `doc-forge` statically analyzes source code, builds a semantic model of modules,
classes, functions, and attributes, and renders that model into documentation
- **Single Source of Truth**: Python source code and docstrings are the only authoritative input outputs without executing user code.
- **Renderer Agnosticism**: MkDocs, Sphinx, MCP, or future renderers don't influence the core model
- **Deterministic Output**: Given the same codebase, outputs are reproducible
- **AI-Native Documentation**: Structured, queryable, and machine-consumable
- **Library-First Design**: All functionality accessible as a Python API
## Installation
```bash
pip install doc-forge
```
### Optional Dependencies
```bash
# For MkDocs rendering
pip install doc-forge[mkdocs]
# For Sphinx rendering
pip install doc-forge[sphinx]
# For MCP support
pip install doc-forge[mcp]
# For development
pip install doc-forge[dev]
```
## Quick Start
### Command Line Interface
```bash
# Generate MkDocs documentation
doc-forge generate --renderer mkdocs mypackage
# Build final HTML documentation
doc-forge build --renderer mkdocs mypackage
# Serve documentation locally
doc-forge serve --renderer mkdocs mypackage
# Export to MCP format
doc-forge export mypackage
# Start live MCP server
doc-forge server mypackage
```
### Python API
```python
from docforge.loader import GriffeLoader
from docforge.renderers import MkDocsRenderer
from pathlib import Path
# Load your project
loader = GriffeLoader()
project = loader.load_project(["mypackage", "mypackage.utils"])
# Generate MkDocs sources
renderer = MkDocsRenderer()
renderer.generate_sources(project, Path("docs"))
# Build final documentation
from docforge.renderers.base import RendererConfig
config = RendererConfig(Path("docs"), project)
renderer.build(config)
```
## Architecture
doc-forge follows this high-level architecture:
```
Python Source Code
Introspection Layer (Griffe)
Documentation Model (doc-forge core)
Renderer / Exporter Layer
├── MkDocs
├── Sphinx
├── MCP (static JSON)
└── MCP Server (live)
```
## Core Components
### Documentation Model
- **Project**: Root container for all documentation
- **Module**: Represents Python modules
- **DocObject**: Base class for classes, functions, variables, etc.
- **Navigation**: Hierarchical structure for browsing
### Renderers
- **MkDocs Renderer**: Generates Markdown with mkdocstrings directives
- **Sphinx Renderer**: Generates reStructuredText with autodoc directives
### Exporters
- **MCP Exporter**: Creates static JSON bundles for machine consumption
- **MCP Server**: Live server for real-time documentation access
## CLI Commands
### `generate`
Generate renderer-specific source files without building final artifacts.
```bash
doc-forge generate --renderer mkdocs --out-dir docs mypackage
```
### `build`
Build final documentation artifacts (HTML, etc.).
```bash
doc-forge build --renderer sphinx mypackage
```
### `serve`
Start a local development server.
```bash
doc-forge serve --renderer mkdocs --port 9000 mypackage
```
### `export`
Export to MCP format for machine consumption.
```bash
doc-forge export --out-dir mcp mypackage
```
### `server`
Start live MCP server for real-time access.
```bash
doc-forge server --host 0.0.0.0 --port 8080 mypackage
```
## Configuration
doc-forge is designed to work with minimal configuration. Most settings are derived automatically from your Python code structure.
### MkDocs Configuration
The MkDocs renderer automatically generates `mkdocs.yml` with sensible defaults:
```yaml
site_name: Your Project
plugins:
- mkdocstrings
theme:
name: material
```
### Sphinx Configuration
The Sphinx renderer automatically generates `conf.py` with standard extensions:
```python
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
]
```
## MCP Integration
doc-forge provides two ways to integrate with MCP (Model Context Protocol):
### Static Export
```bash
doc-forge export mypackage
```
Creates a static JSON bundle in `mcp/` directory that can be loaded by MCP clients.
### Live Server
```bash
doc-forge server mypackage
```
Starts a live MCP server providing real-time access to documentation resources:
- `docs://index` - Project metadata
- `docs://nav` - Navigation structure
- `docs://module/{module}` - Individual module data
## Development
### Setup
```bash
git clone https://github.com/doc-forge/doc-forge
cd doc-forge
pip install -e ".[dev]"
```
### Running Tests
```bash
pytest
```
### Code Quality
```bash
black docforge/
ruff check docforge/
mypy docforge/
```
## License
MIT License - see LICENSE file for details.
## Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
## Philosophy
doc-forge is built on these core principles:
1. **Single Source of Truth**: Python source code and docstrings are the only authoritative input
2. **Renderer Agnosticism**: The core model contains no renderer-specific logic
3. **Deterministic Output**: Same input always produces same output
4. **AI-Native Documentation**: Documentation must be structured, queryable, and machine-consumable
5. **Library-First**: All functionality must be accessible as a Python API
--- ---
*doc-forge turns Python code into structured knowledge and emits it through multiple human and machine interfaces.* ## Installation
Install using pip:
pip install doc-forge
---
## Quick start
Generate a MkDocs site from a Python package:
doc-forge build --mkdocs --module my_package
Generate MCP JSON documentation:
doc-forge build --mcp --module my_package
Serve documentation locally:
doc-forge serve --mkdocs --module my_package
---
## Core concepts
**Loader**
Extracts symbols, signatures, and docstrings using static analysis.
**Semantic model**
Structured, renderer-agnostic representation of the API.
**Renderer**
Converts the semantic model into output formats such as MkDocs or MCP JSON.
**Symbol**
Any documentable object:
- module
- class
- function
- method
- property
- attribute
---
## Architecture
`doc-forge` follows a compiler architecture:
Front-end:
Static analysis of modules, classes, functions, type hints, and docstrings.
Middle-end:
Builds a semantic model describing symbols and relationships.
Back-end:
Renders documentation using interchangeable renderers.
This architecture ensures deterministic documentation generation.
---
## Rendering pipeline
Typical flow:
Python package
Loader (static analysis)
Semantic model
Renderer
MkDocs site or MCP JSON
---
## CLI usage
Build MkDocs documentation:
doc-forge build --mkdocs --module my_package
Build MCP documentation:
doc-forge build --mcp --module my_package
Serve MkDocs locally:
doc-forge serve --module my_package
---
## Public API
Loaders:
GriffeLoader
discover_module_paths
Renderers:
MkDocsRenderer
MCPRenderer
CLI:
main
Models:
models
---
# Google-Styled Doc-Forge Convention (GSDFC)
GSDFC defines how docstrings must be written so they render correctly in MkDocs and remain machine-parsable by doc-forge and AI tooling.
- Docstrings are the single source of truth.
- doc-forge compiles docstrings but does not generate documentation content.
- Documentation follows the Python import hierarchy.
- Every public symbol should have a complete and accurate docstring.
---
## General rules
- Use **Markdown headings** at package and module level.
- Use **Google-style structured sections** at class, function, and method level.
- Indent section contents using four spaces.
- Use type hints in signatures instead of duplicating types in prose.
- Write summaries in imperative form.
- Sections are separated by ```---```
---
## Package docstrings
- Package docstrings act as the documentation home page.
Recommended sections:
## Summary
## Installation
## Quick start
## Core concepts
## Architecture
## Rendering pipeline
## CLI usage
## Public API
## Examples
## Notes
Example:
Package Doc String:
'''
Foo-bar processing framework.
Provides tools for defining Foo objects and executing Bar pipelines.
---
# Installation
pip install foo-bar
---
# Quick start
from foobar import Foo, BarEngine
foo = Foo("example")
engine = BarEngine([foo])
result = engine.run()
---
# Public API
Foo
Bar
BarEngine
---
'''
---
## Module docstrings
- Module docstrings describe a subsystem.
Recommended sections:
## Summary
## Examples
## Notes
## Public API
Example:
Module Doc String:
'''
Foo execution subsystem.
Provides utilities for executing Foo objects through Bar stages.
---
Example:
from foobar.engine import BarEngine
from foobar.foo import Foo
foo = Foo("example")
engine = BarEngine([foo])
engine.run()
---
'''
---
## Class docstrings
- Class docstrings define object responsibility, lifecycle, and attributes.
Recommended sections:
Attributes:
Notes:
Example:
Raises:
Example:
Simple Foo:
class Foo:
'''
Represents a unit of work.
Attributes:
name (str):
Identifier of the foo instance.
value (int):
Numeric value associated with foo.
Notes:
Guarantees:
- instances are immutable after creation
Lifecycle:
- create instance
- pass to processing engine
Example:
Create and inspect a Foo:
foo = Foo("example", value=42)
print(foo.name)
'''
Complex Bar:
class BarEngine:
'''
Executes Foo objects through Bar stages.
Attributes:
foos (tuple[Foo, ...]):
Foo instances managed by the engine.
Notes:
Guarantees:
- deterministic execution order
Example:
Run engine:
foo1 = Foo("a")
foo2 = Foo("b")
engine = BarEngine([foo1, foo2])
engine.run()
'''
---
## Function and method docstrings
- Function docstrings define API contracts.
Recommended sections:
Args:
Returns:
Raises:
Yields:
Notes:
Example:
Example:
Simple process method:
def process(foo: Foo, multiplier: int) -> int:
'''
Process a Foo instance.
Args:
foo (Foo):
Foo instance to process.
multiplier (int):
Value used to scale foo.
Returns:
int:
Processed result.
Raises:
ValueError:
If multiplier is negative.
Notes:
Guarantees:
- foo is not modified
Example:
Process foo:
foo = Foo("example", value=10)
result = process(foo, multiplier=2)
print(result)
'''
Multiple Examples:
def combine(foo_a: Foo, foo_b: Foo) -> Foo:
'''
Combine two Foo instances.
Args:
foo_a (Foo):
First foo.
foo_b (Foo):
Second foo.
Returns:
Foo:
Combined foo.
Example:
Basic usage:
foo1 = Foo("a")
foo2 = Foo("b")
combined = combine(foo1, foo2)
Pipeline usage:
engine = BarEngine([foo1, foo2])
engine.run()
'''
---
## Property docstrings
- Properties must document return values.
Example:
Property Doc String:
@property
def foos(self) -> tuple[Foo, ...]:
'''
Return contained Foo instances.
Returns:
tuple[Foo, ...]:
Stored foo objects.
Example:
container = FooContainer()
foos = container.foos
'''
---
## Attribute documentation
- Document attributes in class docstrings using Attributes:.
Example:
Attribute Doc String:
'''
Represents a processing stage.
Attributes:
id (str):
Unique identifier.
enabled (bool):
Whether the stage is active.
'''
---
## Notes subsection grouping
- Group related information using labeled subsections.
Example:
Notes Example:
Notes:
**Guarantees:**
- deterministic behavior
**Lifecycle:**
- created during initialization
- reused across executions
**Thread safety:**
- safe for concurrent reads
---
## Example formatting
- Use indentation for examples.
Example:
Single example:
Example:
foo = Foo("example")
process(foo, multiplier=2)
Multiple examples:
Example:
Create foo:
foo = Foo("example")
Run engine:
engine = BarEngine([foo])
engine.run()
Avoid fenced code blocks inside structured sections.
---
## Separator rules
Use horizontal separators only at docstring root level to separate sections:
---
Allowed locations:
- package docstrings
- module docstrings
- major documentation sections
Do not use separators inside code sections.
---
## Parsing guarantees
GSDFC ensures doc-forge can deterministically extract:
- symbol kind (module, class, function, property, attribute)
- symbol name
- parameters
- return values
- attributes
- examples
- structured Notes subsections
This enables:
- reliable MkDocs rendering
- deterministic MCP export
- accurate AI semantic interpretation
---
Notes:
- doc-forge never executes analyzed modules.
- Documentation is generated entirely through static analysis.

View File

@@ -1,23 +1,26 @@
home: docforge/index.md home: index.md
groups: groups:
Loader: Loaders:
- docforge/loader/index.md - loaders/index.md
- docforge/loader/griffe_loader.md - loaders/griffe_loader.md
Model: Models:
- docforge/model/index.md - models/index.md
- docforge/model/module.md - models/module.md
- docforge/model/object.md - models/object.md
- docforge/model/project.md - models/project.md
Navigation: Navigation:
- docforge/nav/index.md - nav/index.md
- docforge/nav/spec.md - nav/spec.md
- docforge/nav/resolver.md - nav/resolver.md
- docforge/nav/mkdocs.md - nav/mkdocs.md
Renderers: Renderers:
- docforge/renderers/index.md - renderers/index.md
- docforge/renderers/base.md - renderers/base.md
- docforge/renderers/mkdocs.md - renderers/mkdocs_renderer.md
- renderers/mcp_renderer.md
CLI: CLI:
- docforge/cli/index.md - cli/index.md
- docforge/cli/main.md - cli/main.md
- docforge/cli/mkdocs.md - cli/commands.md
- cli/mcp_utils.md
- cli/mkdocs_utils.md

View File

@@ -1,65 +1,548 @@
""" """
# doc-forge Renderer-agnostic Python documentation compiler that converts Python docstrings
into structured documentation for both humans (MkDocs) and machines (MCP / AI agents).
`doc-forge` is a renderer-agnostic Python documentation compiler designed for `doc-forge` statically analyzes source code, builds a semantic model of modules,
speed, flexibility, and beautiful output. It decouples the introspection of classes, functions, and attributes, and renders that model into documentation
your code from the rendering process, allowing you to generate documentation outputs without executing user code.
for various platforms (starting with MkDocs) from a single internal model.
---
## Installation ## Installation
Install using `pip` with the optional `mkdocs` dependencies for a complete setup: Install using pip:
```bash pip install doc-forge
pip install doc-forge
```
## Quick Start ---
1. **Generate Markdown Sources**: ## Quick start
Introspect your package and create ready-to-use Markdown files:
```bash
doc-forge generate --module my_package --docs-dir docs
```
2. **Define Navigation**: Generate a MkDocs site from a Python package:
Create a `docforge.nav.yml` to organize your documentation:
```yaml
home: my_package/index.md
groups:
Core API:
- my_package/core/*.md
Utilities:
- my_package/utils.md
```
3. **Generate MkDocs Configuration**: doc-forge build --mkdocs --module my_package
```bash
doc-forge mkdocs --site-name "My Awesome Docs"
```
4. **Preview**: Generate MCP JSON documentation:
```bash
doc-forge serve
```
## Project Structure doc-forge build --mcp --module my_package
- `docforge.loader`: Introspects source code using static analysis (`griffe`). Serve documentation locally:
- `docforge.model`: The internal representation of your project, modules, and objects.
- `docforge.renderers`: Converters that turn the model into physical files. doc-forge serve --mkdocs --module my_package
- `docforge.nav`: Managers for logical-to-physical path mapping and navigation.
---
## Core concepts
**Loader**
Extracts symbols, signatures, and docstrings using static analysis.
**Semantic model**
Structured, renderer-agnostic representation of the API.
**Renderer**
Converts the semantic model into output formats such as MkDocs or MCP JSON.
**Symbol**
Any documentable object:
- module
- class
- function
- method
- property
- attribute
---
## Architecture
`doc-forge` follows a compiler architecture:
Front-end:
Static analysis of modules, classes, functions, type hints, and docstrings.
Middle-end:
Builds a semantic model describing symbols and relationships.
Back-end:
Renders documentation using interchangeable renderers.
This architecture ensures deterministic documentation generation.
---
## Rendering pipeline
Typical flow:
Python package
Loader (static analysis)
Semantic model
Renderer
MkDocs site or MCP JSON
---
## CLI usage
Build MkDocs documentation:
doc-forge build --mkdocs --module my_package
Build MCP documentation:
doc-forge build --mcp --module my_package
Serve MkDocs locally:
doc-forge serve --module my_package
---
## Public API
Loaders:
GriffeLoader
discover_module_paths
Renderers:
MkDocsRenderer
MCPRenderer
CLI:
main
Models:
models
---
# Google-Styled Doc-Forge Convention (GSDFC)
GSDFC defines how docstrings must be written so they render correctly in MkDocs and remain machine-parsable by doc-forge and AI tooling.
- Docstrings are the single source of truth.
- doc-forge compiles docstrings but does not generate documentation content.
- Documentation follows the Python import hierarchy.
- Every public symbol should have a complete and accurate docstring.
---
## General rules
- Use **Markdown headings** at package and module level.
- Use **Google-style structured sections** at class, function, and method level.
- Indent section contents using four spaces.
- Use type hints in signatures instead of duplicating types in prose.
- Write summaries in imperative form.
- Sections are separated by ```---```
---
## Package docstrings
- Package docstrings act as the documentation home page.
Recommended sections:
## Summary
## Installation
## Quick start
## Core concepts
## Architecture
## Rendering pipeline
## CLI usage
## Public API
## Examples
## Notes
Example:
Package Doc String:
'''
Foo-bar processing framework.
Provides tools for defining Foo objects and executing Bar pipelines.
---
# Installation
pip install foo-bar
---
# Quick start
from foobar import Foo, BarEngine
foo = Foo("example")
engine = BarEngine([foo])
result = engine.run()
---
# Public API
Foo
Bar
BarEngine
---
'''
---
## Module docstrings
- Module docstrings describe a subsystem.
Recommended sections:
## Summary
## Examples
## Notes
## Public API
Example:
Module Doc String:
'''
Foo execution subsystem.
Provides utilities for executing Foo objects through Bar stages.
---
Example:
from foobar.engine import BarEngine
from foobar.foo import Foo
foo = Foo("example")
engine = BarEngine([foo])
engine.run()
---
'''
---
## Class docstrings
- Class docstrings define object responsibility, lifecycle, and attributes.
Recommended sections:
Attributes:
Notes:
Example:
Raises:
Example:
Simple Foo:
class Foo:
'''
Represents a unit of work.
Attributes:
name (str):
Identifier of the foo instance.
value (int):
Numeric value associated with foo.
Notes:
Guarantees:
- instances are immutable after creation
Lifecycle:
- create instance
- pass to processing engine
Example:
Create and inspect a Foo:
foo = Foo("example", value=42)
print(foo.name)
'''
Complex Bar:
class BarEngine:
'''
Executes Foo objects through Bar stages.
Attributes:
foos (tuple[Foo, ...]):
Foo instances managed by the engine.
Notes:
Guarantees:
- deterministic execution order
Example:
Run engine:
foo1 = Foo("a")
foo2 = Foo("b")
engine = BarEngine([foo1, foo2])
engine.run()
'''
---
## Function and method docstrings
- Function docstrings define API contracts.
Recommended sections:
Args:
Returns:
Raises:
Yields:
Notes:
Example:
Example:
Simple process method:
def process(foo: Foo, multiplier: int) -> int:
'''
Process a Foo instance.
Args:
foo (Foo):
Foo instance to process.
multiplier (int):
Value used to scale foo.
Returns:
int:
Processed result.
Raises:
ValueError:
If multiplier is negative.
Notes:
Guarantees:
- foo is not modified
Example:
Process foo:
foo = Foo("example", value=10)
result = process(foo, multiplier=2)
print(result)
'''
Multiple Examples:
def combine(foo_a: Foo, foo_b: Foo) -> Foo:
'''
Combine two Foo instances.
Args:
foo_a (Foo):
First foo.
foo_b (Foo):
Second foo.
Returns:
Foo:
Combined foo.
Example:
Basic usage:
foo1 = Foo("a")
foo2 = Foo("b")
combined = combine(foo1, foo2)
Pipeline usage:
engine = BarEngine([foo1, foo2])
engine.run()
'''
---
## Property docstrings
- Properties must document return values.
Example:
Property Doc String:
@property
def foos(self) -> tuple[Foo, ...]:
'''
Return contained Foo instances.
Returns:
tuple[Foo, ...]:
Stored foo objects.
Example:
container = FooContainer()
foos = container.foos
'''
---
## Attribute documentation
- Document attributes in class docstrings using Attributes:.
Example:
Attribute Doc String:
'''
Represents a processing stage.
Attributes:
id (str):
Unique identifier.
enabled (bool):
Whether the stage is active.
'''
---
## Notes subsection grouping
- Group related information using labeled subsections.
Example:
Notes Example:
Notes:
**Guarantees:**
- deterministic behavior
**Lifecycle:**
- created during initialization
- reused across executions
**Thread safety:**
- safe for concurrent reads
---
## Example formatting
- Use indentation for examples.
Example:
Single example:
Example:
foo = Foo("example")
process(foo, multiplier=2)
Multiple examples:
Example:
Create foo:
foo = Foo("example")
Run engine:
engine = BarEngine([foo])
engine.run()
Avoid fenced code blocks inside structured sections.
---
## Separator rules
Use horizontal separators only at docstring root level to separate sections:
---
Allowed locations:
- package docstrings
- module docstrings
- major documentation sections
Do not use separators inside code sections.
---
## Parsing guarantees
GSDFC ensures doc-forge can deterministically extract:
- symbol kind (module, class, function, property, attribute)
- symbol name
- parameters
- return values
- attributes
- examples
- structured Notes subsections
This enables:
- reliable MkDocs rendering
- deterministic MCP export
- accurate AI semantic interpretation
---
Notes:
- doc-forge never executes analyzed modules.
- Documentation is generated entirely through static analysis.
""" """
from .loader import GriffeLoader, discover_module_paths from .loaders import GriffeLoader, discover_module_paths
from .renderers import MkDocsRenderer from .renderers import MkDocsRenderer, MCPRenderer
from .cli import main from .cli import main
from . import model from . import models
__all__ = [ __all__ = [
"GriffeLoader", "GriffeLoader",
"discover_module_paths", "discover_module_paths",
"MkDocsRenderer", "MkDocsRenderer",
"model", "MCPRenderer",
"models",
"main", "main",
] ]

View File

@@ -1,12 +1,13 @@
from .loader import GriffeLoader, discover_module_paths from .loaders import GriffeLoader, discover_module_paths
from .renderers import MkDocsRenderer from .renderers import MkDocsRenderer, MCPRenderer
from .cli import main from .cli import main
from . import model from . import models
__all__ = [ __all__ = [
"GriffeLoader", "GriffeLoader",
"discover_module_paths", "discover_module_paths",
"MkDocsRenderer", "MkDocsRenderer",
"model", "MCPRenderer",
"models",
"main", "main",
] ]

View File

@@ -1,16 +1,31 @@
""" """
# CLI Layer Command line interface entry point for doc-forge.
The `docforge.cli` package provides the command-line interface for interacting This module exposes the primary CLI entry function used by the
with doc-forge. ``doc-forge`` command. The actual command implementation resides in
``docforge.cli.main``, while this module provides a stable import path
for external tools and the package entry point configuration.
## Available Commands The CLI is responsible for orchestrating documentation workflows such as
generating renderer sources, building documentation sites, exporting
machine-readable documentation bundles, and starting development or MCP
servers.
- **tree**: Visualize the introspected project structure. ---
- **generate**: Create Markdown source files from Python code.
- **mkdocs**: Generate the primary `mkdocs.yml` configuration. Typical usage
- **build**: Build the final documentation site. -------------
- **serve**: Launch a local development server with live-reloading.
The CLI is normally invoked through the installed command:
doc-forge <command> [options]
Programmatic invocation is also possible:
from docforge.cli import main
main()
---
""" """
from .main import main from .main import main

204
docforge/cli/commands.py Normal file
View File

@@ -0,0 +1,204 @@
import click
from pathlib import Path
from typing import Sequence, Optional
from docforge.loaders import GriffeLoader
from docforge.cli import mkdocs_utils
from docforge.cli import mcp_utils
@click.group()
def cli() -> None:
"""
Root command group for the doc-forge CLI.
Provides commands for building, serving, and inspecting
documentation generated from Python source code.
"""
pass
@cli.command()
@click.option("--mcp", is_flag=True, help="Build MCP resources")
@click.option("--mkdocs", is_flag=True, help="Build MkDocs site")
@click.option("--module-is-source", is_flag=True, help="Module is source folder and to be treated as root folder")
@click.option("--module", help="Python module to document")
@click.option("--project-name", help="Project name override")
@click.option("--site-name", help="MkDocs site name")
@click.option("--docs-dir", type=click.Path(path_type=Path), default=Path("docs"), help="Directory for MD sources")
@click.option("--nav", "nav_file", type=click.Path(path_type=Path), default=Path("docforge.nav.yml"),
help="Nav spec path")
@click.option("--template", type=click.Path(path_type=Path), help="MkDocs template path")
@click.option("--mkdocs-yml", type=click.Path(path_type=Path), default=Path("mkdocs.yml"), help="Output config path")
@click.option("--out-dir", type=click.Path(path_type=Path), default=Path("mcp_docs"), help="MCP output directory")
def build(
mcp: bool,
mkdocs: bool,
module_is_source: bool,
module: Optional[str],
project_name: Optional[str],
site_name: Optional[str],
docs_dir: Path,
nav_file: Path,
template: Optional[Path],
mkdocs_yml: Path,
out_dir: Path,
) -> None:
"""
Build documentation artifacts.
This command performs the full documentation build pipeline:
1. Introspects the Python project using Griffe
2. Generates renderer-specific documentation sources
3. Optionally builds the final documentation output
Depending on the selected options, the build can target:
- MkDocs static documentation sites
- MCP structured documentation resources
Args:
mcp: Enable MCP documentation generation.
mkdocs: Enable MkDocs documentation generation.
module_is_source: Treat the specified module directory as the
project root.
module: Python module import path to document.
project_name: Optional override for the project name.
site_name: Display name for the MkDocs site.
docs_dir: Directory where Markdown documentation sources
will be generated.
nav_file: Path to the navigation specification file.
template: Optional custom MkDocs configuration template.
mkdocs_yml: Output path for the generated MkDocs configuration.
out_dir: Output directory for generated MCP resources.
Raises:
click.UsageError: If required options are missing or conflicting.
"""
if not mcp and not mkdocs:
raise click.UsageError("Must specify either --mcp or --mkdocs")
if mkdocs:
if not module:
raise click.UsageError("--module is required for MkDocs build")
if not site_name:
site_name = module
click.echo(f"Generating MkDocs sources in {docs_dir}...")
mkdocs_utils.generate_sources(
module,
docs_dir,
project_name,
module_is_source,
)
click.echo(f"Generating MkDocs config {mkdocs_yml}...")
mkdocs_utils.generate_config(docs_dir, nav_file, template, mkdocs_yml, site_name)
click.echo("Running MkDocs build...")
mkdocs_utils.build(mkdocs_yml)
click.echo("MkDocs build completed.")
if mcp:
if not module:
raise click.UsageError("--module is required for MCP build")
click.echo(f"Generating MCP resources in {out_dir}...")
mcp_utils.generate_resources(module, project_name, out_dir)
click.echo("MCP build completed.")
@cli.command()
@click.option("--mcp", is_flag=True, help="Serve MCP documentation")
@click.option("--mkdocs", is_flag=True, help="Serve MkDocs site")
@click.option("--module", help="Python module to serve")
@click.option("--mkdocs-yml", type=click.Path(path_type=Path), default=Path("mkdocs.yml"), help="MkDocs config path")
@click.option("--out-dir", type=click.Path(path_type=Path), default=Path("mcp_docs"), help="MCP root directory")
def serve(
mcp: bool,
mkdocs: bool,
module: Optional[str],
mkdocs_yml: Path,
out_dir: Path,
) -> None:
"""
Serve generated documentation locally.
Depending on the selected mode, this command starts either:
- A MkDocs development server for browsing documentation
- An MCP server exposing structured documentation resources
Args:
mcp: Serve documentation using the MCP server.
mkdocs: Serve the MkDocs development site.
module: Python module import path to serve via MCP.
mkdocs_yml: Path to the MkDocs configuration file.
out_dir: Root directory containing MCP documentation resources.
Raises:
click.UsageError: If invalid or conflicting options are provided.
"""
if mcp and mkdocs:
raise click.UsageError("Cannot specify both --mcp and --mkdocs")
if not mcp and not mkdocs:
raise click.UsageError("Must specify either --mcp or --mkdocs")
if mcp and not module:
raise click.UsageError("--module is required for MCP serve")
if mkdocs:
mkdocs_utils.serve(mkdocs_yml)
elif mcp:
mcp_utils.serve(module, out_dir)
@cli.command()
@click.option(
"--module",
required=True,
help="Python module import path to introspect",
)
@click.option(
"--project-name",
help="Project name (defaults to specified module)",
)
def tree(
module: str,
project_name: Optional[str],
) -> None:
"""
Display the documentation object tree for a module.
This command introspects the specified module and prints a
hierarchical representation of the discovered documentation
objects, including modules, classes, functions, and members.
Args:
module: Python module import path to introspect.
project_name: Optional name to display as the project root.
"""
loader = GriffeLoader()
project = loader.load_project([module], project_name)
click.echo(project.name)
for module in project.get_all_modules():
click.echo(f"├── {module.path}")
for obj in module.get_all_objects():
_print_object(obj, indent="")
def _print_object(obj, indent: str) -> None:
"""
Recursively print a documentation object and its members.
This helper function traverses the documentation object graph
and prints each object with indentation to represent hierarchy.
Args:
obj: Documentation object to print.
indent: Current indentation prefix used for nested members.
"""
click.echo(f"{indent}├── {obj.name}")
for member in obj.get_all_members():
_print_object(member, indent + "")

34
docforge/cli/commands.pyi Normal file
View File

@@ -0,0 +1,34 @@
from click.core import Group
from pathlib import Path
from typing import Sequence, Optional, Any
cli: Group
def build(
mcp: bool,
mkdocs: bool,
module_is_source: bool,
module: Optional[str],
project_name: Optional[str],
site_name: Optional[str],
docs_dir: Path,
nav_file: Path,
template: Optional[Path],
mkdocs_yml: Path,
out_dir: Path,
) -> None: ...
def serve(
mcp: bool,
mkdocs: bool,
module: Optional[str],
mkdocs_yml: Path,
out_dir: Path,
) -> None: ...
def tree(
module: str,
project_name: Optional[str],
) -> None: ...
def _print_object(obj: Any, indent: str) -> None: ...

View File

@@ -1,191 +1,23 @@
""" """
Main entry point for the doc-forge CLI. This module defines the core command Command-line entry point for the doc-forge CLI.
group and the 'tree', 'generate', 'build', and 'serve' commands.
This module exposes the executable entry point that initializes the
Click command group defined in ``docforge.cli.commands``.
""" """
from pathlib import Path from docforge.cli.commands import cli
from typing import Sequence, Optional
import click
from docforge.loader import GriffeLoader, discover_module_paths
from docforge.renderers.mkdocs import MkDocsRenderer
from docforge.cli.mkdocs import mkdocs_cmd
@click.group()
def cli() -> None:
"""
doc-forge CLI: A tool for introspecting Python projects and generating
documentation.
"""
pass
cli.add_command(mkdocs_cmd)
# ---------------------------------------------------------------------
# tree
# ---------------------------------------------------------------------
@cli.command()
@click.option(
"--modules",
multiple=True,
required=True,
help="Python module import paths to introspect",
)
@click.option(
"--project-name",
help="Project name (defaults to first module)",
)
def tree(
modules: Sequence[str],
project_name: Optional[str],
) -> None:
"""
Visualize the project structure including modules and their members.
Args:
modules: List of module paths to introspect.
project_name: Optional project name override.
"""
loader = GriffeLoader()
project = loader.load_project(list(modules), project_name)
click.echo(project.name)
for module in project.get_all_modules():
click.echo(f"├── {module.path}")
for obj in module.get_all_objects():
_print_object(obj, indent="")
def _print_object(obj, indent: str) -> None:
"""
Recursive helper to print doc objects.
"""
click.echo(f"{indent}├── {obj.name}")
for member in obj.get_all_members():
_print_object(member, indent + "")
# ---------------------------------------------------------------------
# generate
# ---------------------------------------------------------------------
@cli.command()
@click.option(
"--module",
required=True,
help="Python module import paths to document",
)
@click.option(
"--project-name",
help="Project name (defaults to first module)",
)
@click.option(
"--docs-dir",
type=click.Path(path_type=Path),
default=Path("docs"),
)
def generate(
module: str,
project_name: Optional[str],
docs_dir: Path,
) -> None:
"""
Generate Markdown source files for the specified module.
Args:
module: The primary module path to document.
project_name: Optional project name override.
docs_dir: Directory where documentation sources will be written.
"""
loader = GriffeLoader()
discovered_paths = discover_module_paths(
module,
)
project = loader.load_project(
discovered_paths,
project_name
)
renderer = MkDocsRenderer()
renderer.generate_sources(project, docs_dir)
click.echo(f"Documentation sources generated in {docs_dir}")
# ---------------------------------------------------------------------
# build
# ---------------------------------------------------------------------
@cli.command()
@click.option(
"--mkdocs-yml",
type=click.Path(path_type=Path),
default=Path("mkdocs.yml"),
)
def build(mkdocs_yml: Path) -> None:
"""
Build the documentation site using MkDocs.
Args:
mkdocs_yml: Path to the mkdocs.yml configuration file.
"""
if not mkdocs_yml.exists():
raise click.ClickException(f"mkdocs.yml not found: {mkdocs_yml}")
from mkdocs.config import load_config
from mkdocs.commands.build import build as mkdocs_build
mkdocs_build(load_config(str(mkdocs_yml)))
click.echo("MkDocs build completed")
# ---------------------------------------------------------------------
# serve
# ---------------------------------------------------------------------
@cli.command()
@click.option(
"--mkdocs-yml",
type=click.Path(path_type=Path),
default=Path("mkdocs.yml"),
)
def serve(mkdocs_yml: Path) -> None:
"""
Serve the documentation site with live-reload using MkDocs.
Args:
mkdocs_yml: Path to the mkdocs.yml configuration file.
"""
if not mkdocs_yml.exists():
raise click.ClickException(f"mkdocs.yml not found: {mkdocs_yml}")
from mkdocs.commands.serve import serve as mkdocs_serve
host = "127.0.0.1"
port = 8000
url = f"http://{host}:{port}/"
click.echo(f"Serving documentation at {url}")
mkdocs_serve(config_file=str(mkdocs_yml))
# ---------------------------------------------------------------------
# entry point
# ---------------------------------------------------------------------
def main() -> None: def main() -> None:
""" """
CLI Entry point. Run the doc-forge command-line interface.
This function initializes and executes the Click CLI application.
It is used as the console entry point when invoking ``doc-forge``
from the command line.
""" """
cli() cli()
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@@ -1,76 +1 @@
from typing import Sequence def main() -> None: ...
from pathlib import Path
import click
@click.group()
def cli() -> None:
"""doc-forge command-line interface."""
@cli.command()
@click.option(
"--modules",
multiple=True,
help="Python module import paths to introspect",
)
@click.option(
"--project-name",
help="Project name (defaults to first module)",
)
def tree(
modules: Sequence[str],
project_name: str | None,
) -> None:
"""Show introspection tree."""
@cli.command()
@click.option(
"--module",
help="Python module import paths to document",
)
@click.option(
"--project-name",
help="Project name (defaults to first module)",
)
@click.option(
"--docs-dir",
type=click.Path(path_type=Path),
default=Path("docs"),
)
def generate(
module: str,
project_name: str | None,
docs_dir: Path,
) -> None:
"""Generate documentation source files using MkDocs renderer."""
@cli.command()
@click.option(
"--mkdocs-yml",
type=click.Path(path_type=Path),
default=Path("mkdocs.yml"),
)
def build(
mkdocs_yml: Path,
) -> None:
"""Build documentation using MkDocs."""
@cli.command()
@click.option(
"--mkdocs-yml",
type=click.Path(path_type=Path),
default=Path("mkdocs.yml"),
)
def serve(
mkdocs_yml: Path,
) -> None:
"""Serve documentation using MkDocs."""
def main() -> None:
"""CLI entry point."""

66
docforge/cli/mcp_utils.py Normal file
View File

@@ -0,0 +1,66 @@
from pathlib import Path
import click
from docforge.loaders import GriffeLoader, discover_module_paths
from docforge.renderers import MCPRenderer
from docforge.servers import MCPServer
def generate_resources(module: str, project_name: str | None, out_dir: Path) -> None:
"""
Generate MCP documentation resources from a Python module.
The function performs project introspection, builds the internal
documentation model, and renders MCP-compatible JSON resources
to the specified output directory.
Args:
module: Python module import path used as the entry point for
documentation generation.
project_name: Optional override for the project name used in
generated documentation metadata.
out_dir: Directory where MCP resources (index.json, nav.json,
and module data) will be written.
"""
loader = GriffeLoader()
discovered_paths = discover_module_paths(module)
project = loader.load_project(discovered_paths, project_name)
renderer = MCPRenderer()
renderer.generate_sources(project, out_dir)
def serve(module: str, mcp_root: Path) -> None:
"""
Start an MCP server for a pre-generated documentation bundle.
The server exposes documentation resources such as project metadata,
navigation structure, and module documentation through MCP endpoints.
Args:
module: Python module import path used to identify the served
documentation instance.
mcp_root: Path to the directory containing the MCP documentation
bundle (index.json, nav.json, and modules/).
Raises:
click.ClickException: If the MCP documentation bundle is missing
required files or directories.
"""
if not mcp_root.exists():
raise click.ClickException(f"mcp_docs directory not found: {mcp_root}")
required = [
mcp_root / "index.json",
mcp_root / "nav.json",
mcp_root / "modules",
]
for path in required:
if not path.exists():
raise click.ClickException(f"Invalid MCP bundle, missing: {path.name}")
server = MCPServer(
mcp_root=mcp_root,
name=f"{module}-mcp",
)
server.run()

View File

@@ -0,0 +1,4 @@
from pathlib import Path
def generate_resources(module: str, project_name: str | None, out_dir: Path) -> None: ...
def serve(module: str, mcp_root: Path) -> None: ...

View File

@@ -1,116 +0,0 @@
"""
This module contains the 'mkdocs' CLI command, which orchestrates the generation
of the main mkdocs.yml configuration file.
"""
from pathlib import Path
from importlib import resources
import click
import yaml
from docforge.nav import load_nav_spec
from docforge.nav import resolve_nav
from docforge.nav import MkDocsNavEmitter
def _load_template(template: Path | None) -> dict:
"""
Load a YAML template for mkdocs.yml. If no template is provided,
loads the built-in sample template.
Args:
template: Path to the template file, or None.
Returns:
The loaded template data as a dictionary.
"""
if template is not None:
if not template.exists():
raise click.FileError(str(template), hint="Template not found")
return yaml.safe_load(template.read_text(encoding="utf-8"))
# Load built-in default
text = (
resources.files("docforge.templates")
.joinpath("mkdocs.sample.yml")
.read_text(encoding="utf-8")
)
return yaml.safe_load(text)
@click.command("mkdocs")
@click.option(
"--site-name",
required=True,
help="MkDocs site_name (required)",
)
@click.option(
"--docs-dir",
type=click.Path(path_type=Path),
default=Path("docs"),
)
@click.option(
"--nav",
"nav_file",
type=click.Path(path_type=Path),
default=Path("docforge.nav.yml"),
)
@click.option(
"--template",
type=click.Path(path_type=Path),
default=None,
help="Override the built-in mkdocs template",
)
@click.option(
"--out",
type=click.Path(path_type=Path),
default=Path("mkdocs.yml"),
)
def mkdocs_cmd(
docs_dir: Path,
nav_file: Path,
template: Path | None,
out: Path,
site_name: str,
) -> None:
"""
Generate an mkdocs.yml configuration file by combining a template with
the navigation structure resolved from a docforge.nav.yml file.
Args:
docs_dir: Path to the directory containing documentation Markdown files.
nav_file: Path to the docforge.nav.yml specification.
template: Optional path to an mkdocs.yml template.
out: Path where the final mkdocs.yml will be written.
site_name: The name of the documentation site.
"""
if not nav_file.exists():
raise click.FileError(str(nav_file), hint="Nav spec not found")
# Load nav spec
spec = load_nav_spec(nav_file)
# Resolve nav
resolved = resolve_nav(spec, docs_dir)
# Emit mkdocs nav
nav_block = MkDocsNavEmitter().emit(resolved)
# Load template (user or built-in)
data = _load_template(template)
# Inject site_name
data["site_name"] = site_name
# Inject nav
data["nav"] = nav_block
# Write output
out.write_text(
yaml.safe_dump(data, sort_keys=False),
encoding="utf-8",
)
click.echo(f"mkdocs.yml written to {out}")

View File

@@ -1,45 +0,0 @@
from pathlib import Path
from typing import Any, Dict, Optional
import click
def _load_template(template: Optional[Path]) -> Dict[str, Any]:
...
@click.command("mkdocs")
@click.option(
"--site-name",
required=True,
help="MkDocs site_name (required)",
)
@click.option(
"--docs-dir",
type=click.Path(path_type=Path),
default=Path("docs"),
)
@click.option(
"--nav",
"nav_file",
type=click.Path(path_type=Path),
default=Path("docforge.nav.yml"),
)
@click.option(
"--template",
type=click.Path(path_type=Path),
default=None,
)
@click.option(
"--out",
type=click.Path(path_type=Path),
default=Path("mkdocs.yml"),
)
def mkdocs_cmd(
docs_dir: Path,
nav_file: Path,
template: Optional[Path],
out: Path,
site_name: str,
) -> None:
...

View File

@@ -0,0 +1,142 @@
from pathlib import Path
from importlib import resources
import click
import yaml
from docforge.loaders import GriffeLoader, discover_module_paths
from docforge.renderers import MkDocsRenderer
from docforge.nav import load_nav_spec, resolve_nav, MkDocsNavEmitter
def generate_sources(
module: str,
docs_dir: Path,
project_name: str | None = None,
module_is_source: bool | None = None,
) -> None:
"""
Generate MkDocs Markdown sources for a Python module.
This function introspects the specified module, builds the internal
documentation model, and renders Markdown documentation files for
use with MkDocs.
Args:
module: Python module import path used as the entry point for
documentation generation.
docs_dir: Directory where the generated Markdown files will be written.
project_name: Optional override for the project name used in
documentation metadata.
module_is_source: If True, treat the specified module directory as
the project root rather than a nested module.
"""
loader = GriffeLoader()
discovered_paths = discover_module_paths(module)
project = loader.load_project(discovered_paths, project_name)
renderer = MkDocsRenderer()
renderer.generate_sources(
project,
docs_dir,
module_is_source,
)
renderer.generate_readme(
project,
docs_dir,
module_is_source,
)
def generate_config(
docs_dir: Path,
nav_file: Path,
template: Path | None,
out: Path,
site_name: str,
) -> None:
"""
Generate an ``mkdocs.yml`` configuration file.
The configuration is created by combining a template configuration
with a navigation structure derived from the docforge navigation
specification.
Args:
docs_dir: Directory containing generated documentation Markdown files.
nav_file: Path to the ``docforge.nav.yml`` navigation specification.
template: Optional path to a custom MkDocs configuration template.
If not provided, a built-in template will be used.
out: Destination path where the generated ``mkdocs.yml`` file
will be written.
site_name: Display name for the generated documentation site.
Raises:
click.FileError: If the navigation specification or template
file cannot be found.
"""
if not nav_file.exists():
raise click.FileError(str(nav_file), hint="Nav spec not found")
spec = load_nav_spec(nav_file)
resolved = resolve_nav(spec, docs_dir)
nav_block = MkDocsNavEmitter().emit(resolved)
# Load template
if template is not None:
if not template.exists():
raise click.FileError(str(template), hint="Template not found")
data = yaml.safe_load(template.read_text(encoding="utf-8"))
else:
text = (
resources.files("docforge.templates")
.joinpath("mkdocs.sample.yml")
.read_text(encoding="utf-8")
)
data = yaml.safe_load(text)
data["site_name"] = site_name
data["nav"] = nav_block
out.write_text(yaml.safe_dump(data, sort_keys=False), encoding="utf-8")
def build(mkdocs_yml: Path) -> None:
"""
Build the MkDocs documentation site.
This function loads the MkDocs configuration and runs the MkDocs
build command to generate the final static documentation site.
Args:
mkdocs_yml: Path to the ``mkdocs.yml`` configuration file.
Raises:
click.ClickException: If the configuration file does not exist.
"""
if not mkdocs_yml.exists():
raise click.ClickException(f"mkdocs.yml not found: {mkdocs_yml}")
from mkdocs.config import load_config
from mkdocs.commands.build import build as mkdocs_build
mkdocs_build(load_config(str(mkdocs_yml)))
def serve(mkdocs_yml: Path) -> None:
"""
Start an MkDocs development server with live reload.
The server watches documentation files and automatically reloads
the site when changes are detected.
Args:
mkdocs_yml: Path to the ``mkdocs.yml`` configuration file.
Raises:
click.ClickException: If the configuration file does not exist.
"""
if not mkdocs_yml.exists():
raise click.ClickException(f"mkdocs.yml not found: {mkdocs_yml}")
from mkdocs.commands.serve import serve as mkdocs_serve
mkdocs_serve(config_file=str(mkdocs_yml))

View File

@@ -0,0 +1,11 @@
from pathlib import Path
def generate_sources(
module: str,
docs_dir: Path,
project_name: str | None = None,
module_is_source: bool | None = None,
) -> None: ...
def generate_config(docs_dir: Path, nav_file: Path, template: Path | None, out: Path, site_name: str) -> None: ...
def build(mkdocs_yml: Path) -> None: ...
def serve(mkdocs_yml: Path) -> None: ...

View File

@@ -1,22 +0,0 @@
"""
# Loader Layer
The `docforge.loader` package is responsible for discovering Python source files
and extracting their documentation using static analysis.
## Core Features
- **Discovery**: Automatically find all modules and packages in a project
directory.
- **Introspection**: Uses `griffe` to parse docstrings, signatures, and
hierarchical relationships without executing the code.
- **Filtering**: Automatically excludes private members (prefixed with `_`) to
ensure clean public documentation.
"""
from .griffe_loader import GriffeLoader, discover_module_paths
__all__ = [
"GriffeLoader",
"discover_module_paths",
]

View File

@@ -1,188 +0,0 @@
"""
This module provides the GriffeLoader, which uses the 'griffe' library to
introspect Python source code and populate the doc-forge Project model.
"""
import logging
from pathlib import Path
from typing import List, Optional
from griffe import (
GriffeLoader as _GriffeLoader,
ModulesCollection,
LinesCollection,
Object,
AliasResolutionError,
)
from docforge.model import Module, Project, DocObject
logger = logging.getLogger(__name__)
def discover_module_paths(
module_name: str,
project_root: Path | None = None,
) -> List[str]:
"""
Discover all Python modules under a package via filesystem traversal.
Rules:
- Directory with __init__.py is treated as a package.
- Any .py file is treated as a module.
- All paths are converted to dotted module paths.
Args:
module_name: The name of the package to discover.
project_root: The root directory of the project. Defaults to current working directory.
Returns:
A sorted list of dotted module paths.
"""
if project_root is None:
project_root = Path.cwd()
pkg_dir = project_root / module_name
if not pkg_dir.exists():
raise FileNotFoundError(f"Package not found: {pkg_dir}")
module_paths: List[str] = []
for path in pkg_dir.rglob("*.py"):
if path.name == "__init__.py":
module_path = path.parent
else:
module_path = path
rel = module_path.relative_to(project_root)
dotted = ".".join(rel.with_suffix("").parts)
module_paths.append(dotted)
return sorted(set(module_paths))
class GriffeLoader:
"""
Loads Python modules and extracts documentation using the Griffe introspection engine.
"""
def __init__(self) -> None:
"""
Initialize the GriffeLoader.
"""
self._loader = _GriffeLoader(
modules_collection=ModulesCollection(),
lines_collection=LinesCollection(),
)
def load_project(
self,
module_paths: List[str],
project_name: Optional[str] = None,
skip_import_errors: bool = None,
) -> Project:
"""
Load multiple modules and combine them into a single Project model.
Args:
module_paths: A list of dotted paths to the modules to load.
project_name: Optional name for the project. Defaults to the first module name.
skip_import_errors: If True, modules that fail to import will be skipped.
Returns:
A Project instance containing the loaded modules.
"""
if not module_paths:
raise ValueError("At least one module path must be provided")
if project_name is None:
project_name = module_paths[0].split(".")[0]
project = Project(name=project_name)
for module_path in module_paths:
try:
module = self.load_module(module_path)
except ImportError as import_error:
if skip_import_errors:
logger.debug("Could not load %s: %s", module_path, import_error)
continue
else:
raise import_error
project.add_module(module)
return project
def load_module(self, path: str) -> Module:
"""
Load a single module and convert its introspection data into the docforge model.
Args:
path: The dotted path of the module to load.
Returns:
A Module instance.
"""
self._loader.load(path)
griffe_module = self._loader.modules_collection[path]
return self._convert_module(griffe_module)
# -------------------------
# Conversion helpers
# -------------------------
def _convert_module(self, obj: Object) -> Module:
module = Module(
path=obj.path,
docstring=self._safe_docstring(obj),
)
for name, member in obj.members.items():
if name.startswith("_"):
continue
module.add_object(self._convert_object(member))
return module
def _convert_object(self, obj: Object) -> DocObject:
kind = obj.kind.value
signature = self._safe_signature(obj)
doc_obj = DocObject(
name=obj.name,
kind=kind,
path=obj.path,
signature=signature,
docstring=self._safe_docstring(obj),
)
try:
for name, member in obj.members.items():
if name.startswith("_"):
continue
doc_obj.add_member(self._convert_object(member))
except AliasResolutionError:
pass
return doc_obj
# -------------------------
# Safe extractors
# -------------------------
def _safe_docstring(self, obj: Object) -> Optional[str]:
try:
return obj.docstring.value if obj.docstring else None
except AliasResolutionError:
return None
def _safe_signature(self, obj: Object) -> Optional[str]:
try:
if hasattr(obj, "signature") and obj.signature:
return str(obj.signature)
except AliasResolutionError:
return None
return None

View File

@@ -0,0 +1,32 @@
"""
Loader layer for doc-forge.
The ``docforge.loaders`` package is responsible for discovering Python modules
and extracting documentation data using static analysis.
---
Overview
--------
This layer converts Python source code into an intermediate documentation
model used by doc-forge. It performs module discovery, introspection, and
initial filtering before the data is passed to the core documentation models.
Core capabilities include:
- **Module discovery** Locate Python modules and packages within a project.
- **Static introspection** Parse docstrings, signatures, and object
hierarchies using the ``griffe`` library without executing the code.
- **Public API filtering** Exclude private members (names prefixed with
``_``) to produce clean public documentation structures.
---
"""
from .griffe_loader import GriffeLoader, discover_module_paths
__all__ = [
"GriffeLoader",
"discover_module_paths",
]

View File

@@ -0,0 +1,264 @@
"""
Utilities for loading and introspecting Python modules using Griffe.
This module provides the ``GriffeLoader`` class and helper utilities used to
discover Python modules, introspect their structure, and convert the results
into doc-forge documentation models.
"""
import logging
from pathlib import Path
from typing import List, Optional
from griffe import (
GriffeLoader as _GriffeLoader,
ModulesCollection,
LinesCollection,
Object,
AliasResolutionError,
)
from docforge.models import Module, Project, DocObject
logger = logging.getLogger(__name__)
def discover_module_paths(
module_name: str,
project_root: Path | None = None,
) -> List[str]:
"""
Discover Python modules within a package directory.
The function scans the filesystem for ``.py`` files inside the specified
package and converts them into dotted module import paths.
Discovery rules:
- Directories containing ``__init__.py`` are treated as packages.
- Each ``.py`` file is treated as a module.
- Results are returned as dotted import paths.
Args:
module_name: Top-level package name to discover modules from.
project_root: Root directory used to resolve module paths. If not
provided, the current working directory is used.
Returns:
A sorted list of unique dotted module import paths.
Raises:
FileNotFoundError: If the specified package directory does not exist.
"""
if project_root is None:
project_root = Path.cwd()
pkg_dir = project_root / module_name
if not pkg_dir.exists():
raise FileNotFoundError(f"Package not found: {pkg_dir}")
module_paths: List[str] = []
for path in pkg_dir.rglob("*.py"):
if path.name == "__init__.py":
module_path = path.parent
else:
module_path = path
rel = module_path.relative_to(project_root)
dotted = ".".join(rel.with_suffix("").parts)
module_paths.append(dotted)
return sorted(set(module_paths))
class GriffeLoader:
"""
Load Python modules using Griffe and convert them into doc-forge models.
This loader uses the Griffe introspection engine to analyze Python source
code and transform the extracted information into ``Project``, ``Module``,
and ``DocObject`` instances used by doc-forge.
"""
def __init__(self) -> None:
"""
Initialize the Griffe-backed loader.
Creates an internal Griffe loader instance with dedicated collections
for modules and source lines.
"""
self._loader = _GriffeLoader(
modules_collection=ModulesCollection(),
lines_collection=LinesCollection(),
)
def load_project(
self,
module_paths: List[str],
project_name: Optional[str] = None,
skip_import_errors: bool = None,
) -> Project:
"""
Load multiple modules and assemble them into a Project model.
Each module path is introspected and converted into a ``Module``
instance. All modules are then aggregated into a single ``Project``
object.
Args:
module_paths: List of dotted module import paths to load.
project_name: Optional override for the project name. Defaults
to the top-level name of the first module.
skip_import_errors: If True, modules that fail to load will be
skipped instead of raising an error.
Returns:
A populated ``Project`` instance containing the loaded modules.
Raises:
ValueError: If no module paths are provided.
ImportError: If a module fails to load and
``skip_import_errors`` is False.
"""
if not module_paths:
raise ValueError("At least one module path must be provided")
if project_name is None:
project_name = module_paths[0].split(".")[0]
project = Project(name=project_name)
for module_path in module_paths:
try:
module = self.load_module(module_path)
except ImportError as import_error:
if skip_import_errors:
logger.debug("Could not load %s: %s", module_path, import_error)
continue
else:
raise import_error
project.add_module(module)
return project
def load_module(self, path: str) -> Module:
"""
Load and convert a single Python module.
The module is introspected using Griffe and then transformed into
a doc-forge ``Module`` model.
Args:
path: Dotted import path of the module.
Returns:
A populated ``Module`` instance.
"""
self._loader.load(path)
griffe_module = self._loader.modules_collection[path]
return self._convert_module(griffe_module)
# -------------------------
# Conversion helpers
# -------------------------
def _convert_module(self, obj: Object) -> Module:
"""
Convert a Griffe module object into a doc-forge Module.
All public members of the module are recursively converted into
``DocObject`` instances.
Args:
obj: Griffe object representing the module.
Returns:
A populated ``Module`` model.
"""
module = Module(
path=obj.path,
docstring=self._safe_docstring(obj),
)
for name, member in obj.members.items():
if name.startswith("_"):
continue
module.add_object(self._convert_object(member))
return module
def _convert_object(self, obj: Object) -> DocObject:
"""
Convert a Griffe object into a doc-forge DocObject.
The conversion preserves the object's metadata such as name,
kind, path, signature, and docstring. Child members are processed
recursively.
Args:
obj: Griffe object representing a documented Python object.
Returns:
A ``DocObject`` instance representing the converted object.
"""
kind = obj.kind.value
signature = self._safe_signature(obj)
doc_obj = DocObject(
name=obj.name,
kind=kind,
path=obj.path,
signature=signature,
docstring=self._safe_docstring(obj),
)
try:
for name, member in obj.members.items():
if name.startswith("_"):
continue
doc_obj.add_member(self._convert_object(member))
except AliasResolutionError:
pass
return doc_obj
# -------------------------
# Safe extractors
# -------------------------
def _safe_docstring(self, obj: Object) -> Optional[str]:
"""
Safely extract a docstring from a Griffe object.
Args:
obj: Griffe object to inspect.
Returns:
The raw docstring text if available, otherwise ``None``.
"""
try:
return obj.docstring.value if obj.docstring else None
except AliasResolutionError:
return None
def _safe_signature(self, obj: Object) -> Optional[str]:
"""
Safely extract the signature of a Griffe object.
Args:
obj: Griffe object to inspect.
Returns:
String representation of the object's signature if available,
otherwise ``None``.
"""
try:
if hasattr(obj, "signature") and obj.signature:
return str(obj.signature)
except AliasResolutionError:
return None
return None

View File

@@ -1,7 +1,7 @@
from typing import List, Optional from typing import List, Optional
from pathlib import Path from pathlib import Path
from docforge.model import Module, Project from docforge.models import Module, Project
def discover_module_paths( def discover_module_paths(
@@ -12,7 +12,7 @@ def discover_module_paths(
class GriffeLoader: class GriffeLoader:
"""Griffe-based introspection loader. """Griffe-based introspection loaders.
This is the only supported introspection backend in doc-forge. This is the only supported introspection backend in doc-forge.
""" """

View File

@@ -1,25 +0,0 @@
"""
# Model Layer
The `docforge.model` package provides the core data structures used to represent
Python source code in a documentation-focused hierarchy.
## Key Components
- **Project**: The root container for all documented modules.
- **Module**: Represents a Python module or package, containing members.
- **DocObject**: A recursive structure for classes, functions, and attributes.
These classes are designed to be renderer-agnostic, allowing the same internal
representation to be transformed into various output formats (currently MkDocs).
"""
from .project import Project
from .module import Module
from .object import DocObject
__all__ = [
"Project",
"Module",
"DocObject",
]

View File

@@ -1,66 +0,0 @@
"""
This module defines the Module class, which represents a Python module or package
in the doc-forge documentation model. It acts as a container for top-level
documented objects.
"""
from typing import Dict, Iterable, Optional
from docforge.model.object import DocObject
class Module:
"""
Represents a documented Python module or package.
Attributes:
path: Dotted import path of the module.
docstring: Module-level docstring content.
members: Dictionary mapping object names to their DocObject representations.
"""
def __init__(
self,
path: str,
docstring: Optional[str] = None,
) -> None:
"""
Initialize a new Module.
Args:
path: The dotted path of the module.
docstring: The module's docstring, if any.
"""
self.path = path
self.docstring = docstring
self.members: Dict[str, DocObject] = {}
def add_object(self, obj: DocObject) -> None:
"""
Add a documented object to the module.
Args:
obj: The object to add.
"""
self.members[obj.name] = obj
def get_object(self, name: str) -> DocObject:
"""
Retrieve a member object by name.
Args:
name: The name of the object.
Returns:
The requested DocObject.
"""
return self.members[name]
def get_all_objects(self) -> Iterable[DocObject]:
"""
Get all top-level objects in the module.
Returns:
An iterable of DocObject instances.
"""
return self.members.values()

View File

@@ -1,76 +0,0 @@
"""
This module defines the DocObject class, the fundamental recursive unit of the
doc-forge documentation model. A DocObject represents a single Python entity
(class, function, method, or attribute) and its nested members.
"""
from typing import Dict, Iterable, Optional
class DocObject:
"""
Represents a documented Python object (class, function, method, etc.).
Attributes:
name: Local name of the object.
kind: Type of object (e.g., 'class', 'function', 'attribute').
path: Full dotted import path to the object.
signature: Callable signature, if applicable.
docstring: Raw docstring content extracted from the source.
members: Dictionary mapping member names to their DocObject representations.
"""
def __init__(
self,
name: str,
kind: str,
path: str,
signature: Optional[str] = None,
docstring: Optional[str] = None,
) -> None:
"""
Initialize a new DocObject.
Args:
name: The local name of the object.
kind: The kind of object (e.g., 'class', 'function').
path: The full dotted path to the object.
signature: The object's signature (for callable objects).
docstring: The object's docstring, if any.
"""
self.name = name
self.kind = kind
self.path = path
self.signature = signature
self.docstring = docstring
self.members: Dict[str, 'DocObject'] = {}
def add_member(self, obj: 'DocObject') -> None:
"""
Add a child member to this object (e.g., a method to a class).
Args:
obj: The child DocObject to add.
"""
self.members[obj.name] = obj
def get_member(self, name: str) -> 'DocObject':
"""
Retrieve a child member by name.
Args:
name: The name of the member.
Returns:
The requested DocObject.
"""
return self.members[name]
def get_all_members(self) -> Iterable['DocObject']:
"""
Get all members of this object.
Returns:
An iterable of child DocObject instances.
"""
return self.members.values()

View File

@@ -1,67 +0,0 @@
"""
This module defines the Project class, the top-level container for a documented
project. It aggregates multiple Module instances into a single named entity.
"""
from typing import Dict, Iterable
from docforge.model.module import Module
class Project:
"""
Represents a documentation project, serving as a container for modules.
Attributes:
name: Name of the project.
modules: Dictionary mapping module paths to Module instances.
"""
def __init__(self, name: str) -> None:
"""
Initialize a new Project.
Args:
name: The name of the project.
"""
self.name = name
self.modules: Dict[str, Module] = {}
def add_module(self, module: Module) -> None:
"""
Add a module to the project.
Args:
module: The module to add.
"""
self.modules[module.path] = module
def get_module(self, path: str) -> Module:
"""
Retrieve a module by its dotted path.
Args:
path: The dotted path of the module (e.g., 'pkg.mod').
Returns:
The requested Module.
"""
return self.modules[path]
def get_all_modules(self) -> Iterable[Module]:
"""
Get all modules in the project.
Returns:
An iterable of Module objects.
"""
return self.modules.values()
def get_module_list(self) -> list[str]:
"""
Get the list of all module dotted paths.
Returns:
A list of module paths.
"""
return list(self.modules.keys())

View File

@@ -0,0 +1,40 @@
"""
Model layer for doc-forge.
The ``docforge.models`` package defines the core data structures used to
represent Python source code as a structured documentation model.
---
Overview
--------
The model layer forms the central intermediate representation used throughout
doc-forge. Python modules and objects discovered during introspection are
converted into a hierarchy of documentation models that can later be rendered
into different documentation formats.
Key components:
- **Project** Root container representing an entire documented codebase.
- **Module** Representation of a Python module or package containing
documented members.
- **DocObject** Recursive structure representing Python objects such as
classes, functions, methods, and attributes.
These models are intentionally **renderer-agnostic**, allowing the same
documentation structure to be transformed into multiple output formats
(e.g., MkDocs, MCP, or other renderers).
---
"""
from .project import Project
from .module import Module
from .object import DocObject
__all__ = [
"Project",
"Module",
"DocObject",
]

79
docforge/models/module.py Normal file
View File

@@ -0,0 +1,79 @@
"""
Documentation model representing a Python module or package.
This module defines the ``Module`` class used in the doc-forge documentation
model. A ``Module`` acts as a container for top-level documented objects
(classes, functions, variables, and other members) discovered during
introspection.
"""
from typing import Dict, Iterable, Optional
from docforge.models.object import DocObject
class Module:
"""
Representation of a documented Python module or package.
A ``Module`` stores metadata about the module itself and maintains a
collection of top-level documentation objects discovered during
introspection.
Attributes:
path: Dotted import path of the module.
docstring: Module-level documentation string, if present.
members: Mapping of object names to their corresponding
``DocObject`` representations.
"""
def __init__(
self,
path: str,
docstring: Optional[str] = None,
) -> None:
"""
Initialize a Module instance.
Args:
path: Dotted import path identifying the module.
docstring: Module-level documentation text, if available.
"""
self.path = path
self.docstring = docstring
self.members: Dict[str, DocObject] = {}
def add_object(self, obj: DocObject) -> None:
"""
Add a documented object to the module.
Args:
obj: Documentation object to register as a top-level
member of the module.
"""
self.members[obj.name] = obj
def get_object(self, name: str) -> DocObject:
"""
Retrieve a documented object by name.
Args:
name: Name of the object to retrieve.
Returns:
The corresponding ``DocObject`` instance.
Raises:
KeyError: If no object with the given name exists.
"""
return self.members[name]
def get_all_objects(self) -> Iterable[DocObject]:
"""
Return all top-level documentation objects in the module.
Returns:
An iterable of ``DocObject`` instances representing the
module's public members.
"""
return self.members.values()

View File

@@ -1,6 +1,6 @@
from typing import Dict, Iterable, Optional from typing import Dict, Iterable, Optional
from docforge.model.object import DocObject from docforge.models.object import DocObject
class Module: class Module:

90
docforge/models/object.py Normal file
View File

@@ -0,0 +1,90 @@
"""
Documentation model representing individual Python objects.
This module defines the ``DocObject`` class, the fundamental recursive unit of
the doc-forge documentation model. Each ``DocObject`` represents a Python
entity such as a class, function, method, or attribute, and may contain nested
members that form a hierarchical documentation structure.
"""
from typing import Dict, Iterable, Optional
class DocObject:
"""
Representation of a documented Python object.
A ``DocObject`` models a single Python entity discovered during
introspection. Objects may contain nested members, allowing the structure
of modules, classes, and other containers to be represented recursively.
Attributes:
name: Local name of the object.
kind: Type of object (for example ``class``, ``function``,
``method``, or ``attribute``).
path: Fully qualified dotted path to the object.
signature: Callable signature if the object represents a callable.
docstring: Raw docstring text extracted from the source code.
members: Mapping of member names to child ``DocObject`` instances.
"""
def __init__(
self,
name: str,
kind: str,
path: str,
signature: Optional[str] = None,
docstring: Optional[str] = None,
) -> None:
"""
Initialize a DocObject instance.
Args:
name: Local name of the object.
kind: Object type identifier (for example ``class`` or ``function``).
path: Fully qualified dotted path of the object.
signature: Callable signature if applicable.
docstring: Documentation string associated with the object.
"""
self.name = name
self.kind = kind
self.path = path
self.signature = signature
self.docstring = docstring
self.members: Dict[str, "DocObject"] = {}
def add_member(self, obj: "DocObject") -> None:
"""
Add a child documentation object.
This is typically used when attaching methods to classes or
nested objects to their parent containers.
Args:
obj: Documentation object to add as a member.
"""
self.members[obj.name] = obj
def get_member(self, name: str) -> "DocObject":
"""
Retrieve a member object by name.
Args:
name: Name of the member to retrieve.
Returns:
The corresponding ``DocObject`` instance.
Raises:
KeyError: If the member does not exist.
"""
return self.members[name]
def get_all_members(self) -> Iterable["DocObject"]:
"""
Return all child members of the object.
Returns:
An iterable of ``DocObject`` instances representing nested members.
"""
return self.members.values()

View File

@@ -0,0 +1,76 @@
"""
Documentation model representing a project.
This module defines the ``Project`` class, the top-level container used by
doc-forge to represent a documented codebase. A ``Project`` aggregates multiple
modules and provides access to them through a unified interface.
"""
from typing import Dict, Iterable
from docforge.models.module import Module
class Project:
"""
Representation of a documentation project.
A ``Project`` serves as the root container for all modules discovered during
introspection. Each module is stored by its dotted import path.
Attributes:
name: Name of the project.
modules: Mapping of module paths to ``Module`` instances.
"""
def __init__(self, name: str) -> None:
"""
Initialize a Project instance.
Args:
name: Name used to identify the documentation project.
"""
self.name = name
self.modules: Dict[str, Module] = {}
def add_module(self, module: Module) -> None:
"""
Register a module in the project.
Args:
module: Module instance to add to the project.
"""
self.modules[module.path] = module
def get_module(self, path: str) -> Module:
"""
Retrieve a module by its dotted path.
Args:
path: Fully qualified dotted module path (for example ``pkg.module``).
Returns:
The corresponding ``Module`` instance.
Raises:
KeyError: If the module does not exist in the project.
"""
return self.modules[path]
def get_all_modules(self) -> Iterable[Module]:
"""
Return all modules contained in the project.
Returns:
An iterable of ``Module`` instances.
"""
return self.modules.values()
def get_module_list(self) -> list[str]:
"""
Return the list of module import paths.
Returns:
A list containing the dotted paths of all modules in the project.
"""
return list(self.modules.keys())

View File

@@ -1,6 +1,6 @@
from typing import Dict, Iterable from typing import Dict, Iterable
from docforge.model.module import Module from docforge.models.module import Module
class Project: class Project:

View File

@@ -1,17 +1,26 @@
""" """
# Navigation Layer Navigation layer for doc-forge.
The `docforge.nav` package manages the mapping between the logical documentation The ``docforge.nav`` package manages the relationship between the logical
structure and the physical files on disk. documentation structure defined by the user and the physical documentation
files generated on disk.
## Workflow ---
1. **Spec Definition**: Users define navigation intent in `docforge.nav.yml`. Workflow
2. **Resolution**: `resolve_nav` matches patterns in the spec to generated `.md` files. --------
3. **Emission**: `MkDocsNavEmitter` produces the final YAML structure for `mkdocs.yml`.
This abstraction allows doc-forge to support complex grouping and ordering 1. **Specification** Users define navigation intent in ``docforge.nav.yml``.
independently of the source code's physical layout. 2. **Resolution** ``resolve_nav`` expands patterns and matches them against
generated Markdown files.
3. **Emission** ``MkDocsNavEmitter`` converts the resolved structure into
the YAML navigation format required by ``mkdocs.yml``.
This layer separates documentation organization from the underlying source
code layout, enabling flexible grouping, ordering, and navigation structures
independent of module hierarchy.
---
""" """
from .spec import NavSpec, load_nav_spec from .spec import NavSpec, load_nav_spec

View File

@@ -1,7 +1,9 @@
""" """
This module provides the MkDocsNavEmitter, which converts a ResolvedNav instance MkDocs navigation emitter.
into the specific YAML-ready list structure expected by the MkDocs 'nav'
configuration. This module provides the ``MkDocsNavEmitter`` class, which converts a
``ResolvedNav`` instance into the navigation structure required by the
MkDocs ``nav`` configuration.
""" """
from pathlib import Path from pathlib import Path
@@ -12,19 +14,24 @@ from docforge.nav.resolver import ResolvedNav
class MkDocsNavEmitter: class MkDocsNavEmitter:
""" """
Emitter responsible for transforming a ResolvedNav into an MkDocs-compatible Emit MkDocs navigation structures from resolved navigation data.
navigation structure.
The emitter transforms a ``ResolvedNav`` object into the YAML-compatible
list structure expected by the MkDocs ``nav`` configuration field.
""" """
def emit(self, nav: ResolvedNav) -> List[Dict[str, Any]]: def emit(self, nav: ResolvedNav) -> List[Dict[str, Any]]:
""" """
Generate a list of navigation entries for mkdocs.yml. Generate a navigation structure for ``mkdocs.yml``.
Args: Args:
nav: The resolved navigation data. nav: Resolved navigation data describing documentation groups
and their associated Markdown files.
Returns: Returns:
A list of dictionary mappings representing the MkDocs navigation. A list of dictionaries representing the MkDocs navigation layout.
Each dictionary maps a navigation label to a page or a list of
pages.
""" """
result: List[Dict[str, Any]] = [] result: List[Dict[str, Any]] = []
@@ -45,16 +52,18 @@ class MkDocsNavEmitter:
def _to_relative(self, path: Path, docs_root: Path | None) -> str: def _to_relative(self, path: Path, docs_root: Path | None) -> str:
""" """
Convert a filesystem path to a path relative to the documentation root. Convert a filesystem path into a documentation-relative path.
This handles both absolute and relative filesystem paths, ensuring the
output is compatible with MkDocs navigation requirements. This method normalizes paths so they can be used in MkDocs navigation.
It handles both absolute and relative filesystem paths and ensures the
resulting path is relative to the documentation root.
Args: Args:
path: The path to convert. path: Filesystem path to convert.
docs_root: The root directory for documentation. docs_root: Root directory of the documentation sources.
Returns: Returns:
A string representing the relative POSIX-style path. POSIX-style path relative to the documentation root.
""" """
if docs_root and path.is_absolute(): if docs_root and path.is_absolute():
try: try:
@@ -67,6 +76,6 @@ class MkDocsNavEmitter:
docs_root_str = docs_root.as_posix() docs_root_str = docs_root.as_posix()
if path_str.startswith(docs_root_str + "/"): if path_str.startswith(docs_root_str + "/"):
return path_str[len(docs_root_str) + 1:] return path_str[len(docs_root_str) + 1:]
# Fallback for other cases # Fallback for other cases
return path.as_posix().split("/docs/", 1)[-1] return path.as_posix().split("/docs/", 1)[-1]

View File

@@ -1,7 +1,8 @@
""" """
This module contains the logic for resolving a NavSpec against the physical Navigation resolution utilities.
filesystem. It expands globs and validates that all referenced documents
actually exist on disk. This module resolves a ``NavSpec`` against the filesystem by expanding glob
patterns and validating that referenced documentation files exist.
""" """
from pathlib import Path from pathlib import Path
@@ -14,12 +15,15 @@ from docforge.nav.spec import NavSpec
class ResolvedNav: class ResolvedNav:
""" """
Represents a navigation structure where all patterns and paths have been Resolved navigation structure.
resolved against the actual filesystem contents.
A ``ResolvedNav`` represents navigation data after glob patterns have been
expanded and paths validated against the filesystem.
Attributes: Attributes:
home: Resolved relative path to the home page. home: Relative path to the documentation home page.
groups: Mapping of group titles to lists of absolute or relative Path objects. groups: Mapping of navigation group titles to lists of resolved
documentation file paths.
""" """
def __init__( def __init__(
@@ -32,9 +36,9 @@ class ResolvedNav:
Initialize a ResolvedNav instance. Initialize a ResolvedNav instance.
Args: Args:
home: The relative path to the project home page. home: Relative path to the home page within the documentation root.
groups: A mapping of group names to their resolved filesystem paths. groups: Mapping of group titles to resolved documentation file paths.
docs_root: The root documentation directory. docs_root: Root directory of the documentation source files.
""" """
self.home = home self.home = home
self.groups = groups self.groups = groups
@@ -42,15 +46,20 @@ class ResolvedNav:
def all_files(self) -> Iterable[Path]: def all_files(self) -> Iterable[Path]:
""" """
Get an iterable of all resolved files in the navigation structure. Iterate over all files referenced by the navigation structure.
Returns: Returns:
An iterable of Path objects. An iterable of ``Path`` objects representing documentation files.
Raises:
RuntimeError: If the home page is defined but the documentation
root is not available for resolution.
""" """
if self.home: if self.home:
if self._docs_root is None: if self._docs_root is None:
raise RuntimeError("docs_root is required to resolve home path") raise RuntimeError("docs_root is required to resolve home path")
yield self._docs_root / self.home yield self._docs_root / self.home
for paths in self.groups.values(): for paths in self.groups.values():
for p in paths: for p in paths:
yield p yield p
@@ -61,23 +70,38 @@ def resolve_nav(
docs_root: Path, docs_root: Path,
) -> ResolvedNav: ) -> ResolvedNav:
""" """
Create a ResolvedNav by processing a NavSpec against the filesystem. Resolve a navigation specification against the filesystem.
This expands globs and validates the existence of referenced files.
The function expands glob patterns defined in a ``NavSpec`` and verifies
that referenced documentation files exist within the documentation root.
Args: Args:
spec: The navigation specification to resolve. spec: Navigation specification describing documentation layout.
docs_root: The root directory for documentation files. docs_root: Root directory containing documentation Markdown files.
Returns: Returns:
A ResolvedNav instance. A ``ResolvedNav`` instance containing validated navigation paths.
Raises: Raises:
FileNotFoundError: If a pattern doesn't match any files or the docs_root doesn't exist. FileNotFoundError: If the documentation root does not exist or a
navigation pattern does not match any files.
""" """
if not docs_root.exists(): if not docs_root.exists():
raise FileNotFoundError(docs_root) raise FileNotFoundError(docs_root)
def resolve_pattern(pattern: str) -> List[Path]: def resolve_pattern(pattern: str) -> List[Path]:
"""
Resolve a glob pattern relative to the documentation root.
Args:
pattern: Glob pattern used to match documentation files.
Returns:
A sorted list of matching ``Path`` objects.
Raises:
FileNotFoundError: If the pattern does not match any files.
"""
full = docs_root / pattern full = docs_root / pattern
matches = sorted( matches = sorted(
Path(p) for p in glob.glob(str(full), recursive=True) Path(p) for p in glob.glob(str(full), recursive=True)
@@ -88,7 +112,7 @@ def resolve_nav(
return matches return matches
# Resolve home # Resolve home page
home: str | None = None home: str | None = None
if spec.home: if spec.home:
home_path = docs_root / spec.home home_path = docs_root / spec.home
@@ -96,7 +120,7 @@ def resolve_nav(
raise FileNotFoundError(spec.home) raise FileNotFoundError(spec.home)
home = spec.home home = spec.home
# Resolve groups # Resolve navigation groups
resolved_groups: Dict[str, List[Path]] = {} resolved_groups: Dict[str, List[Path]] = {}
for group, patterns in spec.groups.items(): for group, patterns in spec.groups.items():

View File

@@ -1,7 +1,9 @@
""" """
This module defines the NavSpec class, which represents the user's intent for Navigation specification model.
documentation navigation as defined in a YAML specification (usually
docforge.nav.yml). This module defines the ``NavSpec`` class, which represents the navigation
structure defined by the user in the doc-forge navigation specification
(typically ``docforge.nav.yml``).
""" """
from pathlib import Path from pathlib import Path
@@ -12,11 +14,16 @@ import yaml
class NavSpec: class NavSpec:
""" """
Parsed representation of the docforge navigation specification file. Parsed representation of a navigation specification.
A ``NavSpec`` describes the intended documentation navigation layout before
it is resolved against the filesystem.
Attributes: Attributes:
home: Path to the home document (e.g., 'index.md'). home: Relative path to the documentation home page (for example
groups: Mapping of group titles to lists of path patterns/globs. ``index.md``).
groups: Mapping of navigation group titles to lists of file patterns
or glob expressions.
""" """
def __init__( def __init__(
@@ -25,11 +32,12 @@ class NavSpec:
groups: Dict[str, List[str]], groups: Dict[str, List[str]],
) -> None: ) -> None:
""" """
Initialize a NavSpec. Initialize a NavSpec instance.
Args: Args:
home: The path to the home document. home: Relative path to the home document.
groups: A mapping of group names to lists of path patterns (globs). groups: Mapping of group names to lists of path patterns
(glob expressions).
""" """
self.home = home self.home = home
self.groups = groups self.groups = groups
@@ -37,17 +45,18 @@ class NavSpec:
@classmethod @classmethod
def load(cls, path: Path) -> "NavSpec": def load(cls, path: Path) -> "NavSpec":
""" """
Load a NavSpec from a YAML file. Load a navigation specification from a YAML file.
Args: Args:
path: The filesystem path to the YAML file. path: Filesystem path to the navigation specification file.
Returns: Returns:
A NavSpec instance. A ``NavSpec`` instance representing the parsed configuration.
Raises: Raises:
FileNotFoundError: If the path does not exist. FileNotFoundError: If the specified file does not exist.
ValueError: If the file content is not a valid NavSpec mapping. ValueError: If the file contents are not a valid navigation
specification.
""" """
if not path.exists(): if not path.exists():
raise FileNotFoundError(path) raise FileNotFoundError(path)
@@ -78,33 +87,45 @@ class NavSpec:
def all_patterns(self) -> List[str]: def all_patterns(self) -> List[str]:
""" """
Get all path patterns referenced in the specification. Return all path patterns referenced by the specification.
Returns: Returns:
A list of all patterns (home plus all groups). A list containing the home document (if defined) and all
group pattern entries.
""" """
patterns: List[str] = [] patterns: List[str] = []
if self.home: if self.home:
patterns.append(self.home) patterns.append(self.home)
for items in self.groups.values(): for items in self.groups.values():
patterns.extend(items) patterns.extend(items)
return patterns return patterns
def load_nav_spec(path: Path) -> NavSpec: def load_nav_spec(path: Path) -> NavSpec:
""" """
Utility function to load a NavSpec from a file. Load a navigation specification file.
This helper function reads a YAML navigation file and constructs a
corresponding ``NavSpec`` instance.
Args: Args:
path: Path to the navigation specification file. path: Path to the navigation specification file.
Returns: Returns:
A loaded NavSpec instance. A ``NavSpec`` instance representing the parsed specification.
Raises:
FileNotFoundError: If the specification file does not exist.
ValueError: If the YAML structure is invalid.
""" """
if not path.exists(): if not path.exists():
raise FileNotFoundError(path) raise FileNotFoundError(path)
data = yaml.safe_load(path.read_text(encoding="utf-8")) data = yaml.safe_load(path.read_text(encoding="utf-8"))
if not isinstance(data, dict): if not isinstance(data, dict):
raise ValueError("Nav spec must be a YAML mapping") raise ValueError("Nav spec must be a YAML mapping")

View File

@@ -1,24 +1,40 @@
""" """
# Renderers Layer Renderers layer for doc-forge.
The `docforge.renderers` package handles the transformation of the internal The ``docforge.renderers`` package transforms the internal documentation
documentation model into physical files formatted for specific documentation models into files formatted for specific documentation systems.
engines.
## Current Implementations ---
- **MkDocsRenderer**: Generates Markdown files utilizing the `mkdocstrings` Overview
syntax. It automatically handles package/module hierarchy and generates --------
`index.md` files for packages.
## Extending Renderers consume the doc-forge project model and generate output suitable
for documentation tools or machine interfaces.
To add a new renderer, implement the `DocRenderer` protocol defined in Current implementations:
`docforge.renderers.base`.
- **MkDocsRenderer** Produces Markdown files compatible with MkDocs and
the ``mkdocstrings`` plugin. It automatically handles package hierarchy
and generates ``index.md`` files for packages.
- **MCPRenderer** Emits structured JSON resources designed for consumption
by Model Context Protocol (MCP) clients.
---
Extending
---------
New renderers can be added by implementing the ``DocRenderer`` protocol
defined in ``docforge.renderers.base``.
---
""" """
from .mkdocs import MkDocsRenderer from .mkdocs_renderer import MkDocsRenderer
from .mcp_renderer import MCPRenderer
__all__ = [ __all__ = [
"MkDocsRenderer", "MkDocsRenderer",
"MCPRenderer",
] ]

View File

@@ -1,5 +1,7 @@
from .mkdocs import MkDocsRenderer from .mkdocs_renderer import MkDocsRenderer
from .mcp_renderer import MCPRenderer
__all__ = [ __all__ = [
"MkDocsRenderer", "MkDocsRenderer",
"MCPRenderer",
] ]

View File

@@ -1,25 +1,37 @@
""" """
This module defines the base interfaces and configuration containers for Renderer base interfaces and configuration models.
doc-forge renderers. All renderer implementations should adhere to the
DocRenderer protocol. This module defines the base protocol and configuration container used by
doc-forge renderers. Concrete renderer implementations should implement the
``DocRenderer`` protocol.
""" """
from pathlib import Path from pathlib import Path
from typing import Protocol from typing import Protocol
from docforge.model import Project from docforge.models import Project
class RendererConfig: class RendererConfig:
""" """
Configuration container for documentation renderers. Configuration container for documentation renderers.
Args: A ``RendererConfig`` instance groups together the project model and the
out_dir: The directory where documentation files should be written. output directory used during rendering.
project: The introspected project model to be rendered.
Attributes:
out_dir: Directory where generated documentation files will be written.
project: Documentation project model to be rendered.
""" """
def __init__(self, out_dir: Path, project: Project) -> None: def __init__(self, out_dir: Path, project: Project) -> None:
"""
Initialize a RendererConfig instance.
Args:
out_dir: Target directory where documentation files should be written.
project: Introspected project model to render.
"""
self.out_dir = out_dir self.out_dir = out_dir
self.project = project self.project = project
@@ -27,6 +39,9 @@ class RendererConfig:
class DocRenderer(Protocol): class DocRenderer(Protocol):
""" """
Protocol defining the interface for documentation renderers. Protocol defining the interface for documentation renderers.
Implementations of this protocol are responsible for transforming a
``Project`` model into renderer-specific documentation sources.
""" """
name: str name: str
@@ -37,10 +52,11 @@ class DocRenderer(Protocol):
out_dir: Path, out_dir: Path,
) -> None: ) -> None:
""" """
Generate renderer-specific source files for the given project. Generate renderer-specific documentation sources.
Args: Args:
project: The project model containing modules and objects. project: Project model containing modules and documentation objects.
out_dir: Target directory for the generated files. out_dir: Directory where generated documentation sources
should be written.
""" """
... ...

View File

@@ -1,7 +1,7 @@
from pathlib import Path from pathlib import Path
from typing import Protocol from typing import Protocol
from docforge.model import Project from docforge.models import Project
class RendererConfig: class RendererConfig:

View File

@@ -0,0 +1,138 @@
import json
from pathlib import Path
from typing import Dict, List
from docforge.models import Project, Module, DocObject
class MCPRenderer:
"""
Renderer that generates MCP-compatible documentation resources.
This renderer converts doc-forge project models into structured JSON
resources suitable for consumption by systems implementing the Model
Context Protocol (MCP).
"""
name = "mcp"
def generate_sources(self, project: Project, out_dir: Path) -> None:
"""
Generate MCP documentation resources for a project.
The renderer serializes each module into a JSON resource and produces
supporting metadata files such as ``nav.json`` and ``index.json``.
Args:
project: Documentation project model to render.
out_dir: Directory where MCP resources will be written.
"""
modules_dir = out_dir / "modules"
modules_dir.mkdir(parents=True, exist_ok=True)
nav: List[Dict[str, str]] = []
for module in project.get_all_modules():
self._write_module(module, modules_dir)
nav.append({
"module": module.path,
"resource": f"doc://modules/{module.path}",
})
# Write nav.json
(out_dir / "nav.json").write_text(
self._json(nav),
encoding="utf-8",
)
# Write index.json
index = {
"project": project.name,
"type": "docforge-model",
"modules_count": len(nav),
"source": "docforge",
}
(out_dir / "index.json").write_text(
self._json(index),
encoding="utf-8",
)
def _write_module(self, module: Module, modules_dir: Path) -> None:
"""
Serialize a module into an MCP resource file.
Args:
module: Module instance to serialize.
modules_dir: Directory where module JSON files are stored.
"""
payload = {
"module": module.path,
"content": self._render_module(module),
}
out = modules_dir / f"{module.path}.json"
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(self._json(payload), encoding="utf-8")
def _render_module(self, module: Module) -> Dict:
"""
Convert a Module model into MCP-compatible structured data.
Args:
module: Module instance to convert.
Returns:
Dictionary representing the module and its documented objects.
"""
data: Dict = {
"path": module.path,
"docstring": module.docstring,
"objects": {},
}
for obj in module.get_all_objects():
data["objects"][obj.name] = self._render_object(obj)
return data
def _render_object(self, obj: DocObject) -> Dict:
"""
Recursively convert a DocObject into structured MCP data.
Args:
obj: Documentation object to convert.
Returns:
Dictionary describing the object and any nested members.
"""
data: Dict = {
"name": obj.name,
"kind": obj.kind,
"path": obj.path,
"signature": obj.signature,
"docstring": obj.docstring,
}
members = list(obj.get_all_members())
if members:
data["members"] = {
member.name: self._render_object(member)
for member in members
}
return data
@staticmethod
def _json(data: Dict) -> str:
"""
Serialize data to formatted JSON.
Args:
data: Dictionary to serialize.
Returns:
JSON string formatted with indentation and UTF-8 compatibility.
"""
return json.dumps(data, indent=2, ensure_ascii=False)

View File

@@ -0,0 +1,26 @@
from pathlib import Path
from typing import Dict, List
from docforge.models import Project, Module, DocObject
class MCPRenderer:
"""Renderer that emits MCP-native JSON resources from docforge models."""
name: str
def generate_sources(self, project: Project, out_dir: Path) -> None:
"""Generate MCP-compatible JSON resources and navigation for the project."""
def _write_module(self, module: Module, modules_dir: Path) -> None:
"""Serialize a module into an MCP JSON resource."""
def _render_module(self, module: Module) -> Dict:
"""Render a Module into MCP-friendly structured data."""
def _render_object(self, obj: DocObject) -> Dict:
"""Recursively render a DocObject into structured MCP data."""
@staticmethod
def _json(data: Dict) -> str:
"""Serialize structured data to formatted JSON."""

View File

@@ -1,91 +0,0 @@
"""
This module implements the MkDocsRenderer, which generates Markdown source files
compatible with the MkDocs 'material' theme and 'mkdocstrings' extension.
"""
from pathlib import Path
from docforge.model import Project
class MkDocsRenderer:
"""
Renderer that generates Markdown source files formatted for the MkDocs
'mkdocstrings' plugin.
"""
name = "mkdocs"
def generate_sources(self, project: Project, out_dir: Path) -> None:
"""
Produce a set of Markdown files in the output directory based on the
provided Project model.
Args:
project: The project model to render.
out_dir: Target directory for documentation files.
"""
modules = list(project.get_all_modules())
paths = {m.path for m in modules}
# Package detection (level-agnostic)
packages = {
p for p in paths
if any(other.startswith(p + ".") for other in paths)
}
for module in modules:
self._write_module(module, packages, out_dir)
# -------------------------
# Internal helpers
# -------------------------
def _write_module(self, module, packages: set[str], out_dir: Path) -> None:
"""
Write a single module's documentation file. Packages are written as
'index.md' inside their respective directories.
Args:
module: The module to write.
packages: A set of module paths that are identified as packages.
out_dir: The base output directory.
"""
parts = module.path.split(".")
if module.path in packages:
# package → index.md
dir_path = out_dir.joinpath(*parts)
dir_path.mkdir(parents=True, exist_ok=True)
md_path = dir_path / "index.md"
title = parts[-1].replace("_", " ").title()
else:
# leaf module → <name>.md
dir_path = out_dir.joinpath(*parts[:-1])
dir_path.mkdir(parents=True, exist_ok=True)
md_path = dir_path / f"{parts[-1]}.md"
title = parts[-1].replace("_", " ").title()
content = self._render_markdown(title, module.path)
if md_path.exists() and md_path.read_text(encoding="utf-8") == content:
return
md_path.write_text(content, encoding="utf-8")
def _render_markdown(self, title: str, module_path: str) -> str:
"""
Generate the Markdown content for a module file.
Args:
title: The display title for the page.
module_path: The dotted path of the module to document.
Returns:
A string containing the Markdown source.
"""
return (
f"# {title}\n\n"
f"::: {module_path}\n"
)

View File

@@ -1,17 +0,0 @@
from pathlib import Path
from typing import Set
from docforge.model import Project, Module
class MkDocsRenderer:
name: str
def generate_sources(self, project: Project, out_dir: Path) -> None: ...
def _write_module(
self,
module: Module,
packages: Set[str],
out_dir: Path,
) -> None: ...
def _render_markdown(self, title: str, module_path: str) -> str: ...

View File

@@ -0,0 +1,272 @@
"""
MkDocs renderer implementation.
This module defines the ``MkDocsRenderer`` class, which generates Markdown
documentation sources compatible with MkDocs Material and the mkdocstrings
plugin.
The renderer ensures a consistent documentation structure by:
- Creating a root ``index.md`` if one does not exist
- Generating package index pages automatically
- Linking child modules within parent package pages
- Optionally generating ``README.md`` from the root package docstring
"""
from pathlib import Path
from docforge.models import Project, Module
class MkDocsRenderer:
"""
Renderer that produces Markdown documentation for MkDocs.
Generated pages use mkdocstrings directives to reference Python modules,
allowing MkDocs to render API documentation dynamically.
"""
name = "mkdocs"
# -------------------------
# Public API
# -------------------------
def generate_sources(
self,
project: Project,
out_dir: Path,
module_is_source: bool | None = None,
) -> None:
"""
Generate Markdown documentation files for a project.
This method renders a documentation structure from the provided
project model and writes the resulting Markdown files to the
specified output directory.
Args:
project: Project model containing modules to document.
out_dir: Directory where generated Markdown files will be written.
module_is_source: If True, treat the specified module as the
documentation root rather than nesting it inside a folder.
"""
out_dir.mkdir(parents=True, exist_ok=True)
self._ensure_root_index(project, out_dir)
modules = list(project.get_all_modules())
paths = {m.path for m in modules}
# Detect packages (modules with children)
packages = {
p for p in paths
if any(other.startswith(p + ".") for other in paths)
}
for module in modules:
self._write_module(
module,
packages,
out_dir,
module_is_source,
)
def generate_readme(
self,
project: Project,
docs_dir: Path,
module_is_source: bool | None = None,
) -> None:
"""
Generate a ``README.md`` file from the root module docstring.
Behavior:
- If ``module_is_source`` is True, ``README.md`` is written to the
project root directory.
- If False, README generation is currently not implemented.
Args:
project: Project model containing documentation metadata.
docs_dir: Directory containing generated documentation sources.
module_is_source: Whether the module is treated as the project
source root.
"""
if not module_is_source:
# Future: support README generation per module
return
readme_path = docs_dir.parent / "README.md"
root_module = None
for module in project.get_all_modules():
if module.path == project.name:
root_module = module
break
if root_module is None:
return
doc = ""
if root_module.docstring:
doc = getattr(
root_module.docstring,
"value",
str(root_module.docstring),
)
content = (
f"# {project.name}\n\n"
f"{doc.strip()}\n"
)
if not readme_path.exists() or readme_path.read_text(encoding="utf-8") != content:
readme_path.write_text(
content,
encoding="utf-8",
)
# -------------------------
# Internal helpers
# -------------------------
def _find_root_module(self, project: Project) -> Module | None:
"""
Locate the root module corresponding to the project name.
Args:
project: Project model to inspect.
Returns:
The root ``Module`` if found, otherwise ``None``.
"""
for module in project.get_all_modules():
if module.path == project.name:
return module
return None
def _write_module(
self,
module: Module,
packages: set[str],
out_dir: Path,
module_is_source: bool | None = None,
) -> None:
"""
Write documentation for a single module.
Package modules are rendered as ``index.md`` files inside their
corresponding directories, while leaf modules are written as
standalone Markdown pages.
Args:
module: Module to render.
packages: Set of module paths identified as packages.
out_dir: Base directory for generated documentation files.
module_is_source: Whether the module acts as the documentation
root directory.
"""
parts = module.path.split(".")
if module_is_source:
module_name, parts = parts[0], parts[1:]
else:
module_name, parts = parts[0], parts
if module.path in packages:
dir_path = out_dir.joinpath(*parts)
dir_path.mkdir(parents=True, exist_ok=True)
md_path = dir_path / "index.md"
link_target = f"{parts[-1]}/" if parts else None
else:
dir_path = out_dir.joinpath(*parts[:-1])
dir_path.mkdir(parents=True, exist_ok=True)
md_path = dir_path / f"{parts[-1]}.md"
link_target = f"{parts[-1]}.md" if parts else None
title = parts[-1].replace("_", " ").title() if parts else module_name
content = self._render_markdown(title, module.path)
if not md_path.exists() or md_path.read_text(encoding="utf-8") != content:
md_path.write_text(content, encoding="utf-8")
if not module_is_source:
self._ensure_parent_index(parts, out_dir, link_target, title)
def _render_markdown(self, title: str, module_path: str) -> str:
"""
Generate Markdown content for a module documentation page.
Args:
title: Page title displayed in the documentation.
module_path: Dotted import path of the module.
Returns:
Markdown source containing a mkdocstrings directive.
"""
return (
f"# {title}\n\n"
f"::: {module_path}\n"
)
def _ensure_root_index(
self,
project: Project,
out_dir: Path,
) -> None:
"""
Ensure that the root ``index.md`` page exists.
Args:
project: Project model used for the page title.
out_dir: Documentation output directory.
"""
root_index = out_dir / "index.md"
if not root_index.exists():
root_index.write_text(
f"# {project.name}\n\n"
"## Modules\n\n",
encoding="utf-8",
)
def _ensure_parent_index(
self,
parts: list[str],
out_dir: Path,
link_target: str,
title: str,
) -> None:
"""
Ensure that parent package index files exist and contain links to
child modules.
Args:
parts: Module path components.
out_dir: Documentation output directory.
link_target: Link target used in the parent index.
title: Display title for the link.
"""
if len(parts) == 1:
parent_index = out_dir / "index.md"
else:
parent_dir = out_dir.joinpath(*parts[:-1])
parent_dir.mkdir(parents=True, exist_ok=True)
parent_index = parent_dir / "index.md"
if not parent_index.exists():
parent_title = parts[-2].replace("_", " ").title()
parent_index.write_text(
f"# {parent_title}\n\n",
encoding="utf-8",
)
content = parent_index.read_text(encoding="utf-8")
link = f"- [{title}]({link_target})\n"
if link not in content:
parent_index.write_text(content + link, encoding="utf-8")

View File

@@ -0,0 +1,34 @@
from pathlib import Path
from docforge.models import Project, Module
class MkDocsRenderer:
name: str
def generate_sources(
self,
project: Project,
out_dir: Path,
module_is_source: bool | None = None,
) -> None: ...
def generate_readme(
self,
project: Project,
docs_dir: Path,
module_is_source: bool | None = None,
) -> None:
def _write_module(
self,
module: Module,
packages: set[str],
out_dir: Path,
module_is_source: bool | None = None,
) -> None: ...
def _render_markdown(self, title: str, module_path: str) -> str: ...
def _ensure_root_index(self, project, out_dir) -> None: ...
def _ensure_parent_index(self, parts, out_dir, link_target, title) -> None: ...

View File

@@ -0,0 +1,15 @@
"""
Server layer for doc-forge.
This module exposes server implementations used to provide live access
to generated documentation resources. Currently, it includes the MCP
documentation server.
---
"""
from .mcp_server import MCPServer
__all__ = [
"MCPServer",
]

View File

@@ -0,0 +1,5 @@
from .mcp_server import MCPServer
__all__ = [
"MCPServer",
]

View File

@@ -0,0 +1,122 @@
from __future__ import annotations
import json
from pathlib import Path
from typing import Any, Literal
from mcp.server.fastmcp import FastMCP
class MCPServer:
"""
MCP server for serving a pre-generated documentation bundle.
The server exposes documentation resources and diagnostic tools through
MCP endpoints backed by JSON files generated by the MCP renderer.
"""
def __init__(self, mcp_root: Path, name: str) -> None:
"""
Initialize the MCP server.
Args:
mcp_root: Directory containing the generated MCP documentation
bundle (for example ``index.json``, ``nav.json``, and
``modules/``).
name: Identifier used for the MCP server instance.
"""
self.mcp_root = mcp_root
self.app = FastMCP(name)
self._register_resources()
self._register_tools()
# ------------------------------------------------------------------
# Internal helpers
# ------------------------------------------------------------------
def _read_json(self, path: Path) -> Any:
"""
Load and parse a JSON file.
If the file does not exist, a structured error response is returned
instead of raising an exception.
Args:
path: Path to the JSON file to read.
Returns:
Parsed JSON data if the file exists, otherwise an error dictionary
describing the missing resource.
"""
if not path.exists():
return {
"error": "not_found",
"path": str(path),
}
return json.loads(path.read_text(encoding="utf-8"))
# ------------------------------------------------------------------
# MCP resources
# ------------------------------------------------------------------
def _register_resources(self) -> None:
"""
Register MCP resource endpoints.
The server exposes documentation resources through the following
endpoints:
- ``docs://index`` Project metadata
- ``docs://nav`` Navigation structure
- ``docs://modules/{module}`` Individual module documentation
"""
@self.app.resource("docs://index")
def index():
return self._read_json(self.mcp_root / "index.json")
@self.app.resource("docs://nav")
def nav():
return self._read_json(self.mcp_root / "nav.json")
@self.app.resource("docs://modules/{module}")
def module(module: str):
return self._read_json(
self.mcp_root / "modules" / f"{module}.json"
)
# ------------------------------------------------------------------
# MCP tools
# ------------------------------------------------------------------
def _register_tools(self) -> None:
"""
Register optional MCP diagnostic tools.
These tools provide lightweight endpoints useful for verifying that
the MCP server is operational.
"""
@self.app.tool()
def ping() -> str:
"""Return a simple health check response."""
return "pong"
# ------------------------------------------------------------------
# Server lifecycle
# ------------------------------------------------------------------
def run(
self,
transport: Literal["stdio", "sse", "streamable-http"] = "streamable-http",
) -> None:
"""
Start the MCP server.
Args:
transport: Transport mechanism used by the MCP server. Supported
options include ``stdio``, ``sse``, and ``streamable-http``.
"""
self.app.run(transport=transport)

View File

@@ -0,0 +1,22 @@
from pathlib import Path
from typing import Literal, Any
from mcp.server.fastmcp import FastMCP
class MCPServer:
"""MCP server for serving documentation."""
mcp_root: Path
app: FastMCP
def __init__(self, mcp_root: Path, name: str) -> None: ...
def _read_json(self, path: Path) -> Any: ...
def _register_resources(self) -> None: ...
def _register_tools(self) -> None: ...
def run(self, transport: Literal["stdio", "sse", "streamable-http"] = ...) -> None:
"""Start the MCP server."""

View File

@@ -4,16 +4,30 @@ theme:
- scheme: slate - scheme: slate
primary: deep purple primary: deep purple
accent: cyan accent: cyan
font: font:
text: Inter text: Inter
code: JetBrains Mono code: JetBrains Mono
features: features:
- navigation.tabs # Navigation
- navigation.sections
- navigation.expand - navigation.expand
- navigation.top - navigation.top
- navigation.instant - navigation.instant
- navigation.tracking
- navigation.indexes
# Content
- content.code.copy - content.code.copy
- content.code.annotate - content.code.annotate
- content.tabs.link
- content.action.edit
# Search UX
- search.highlight
- search.share
- search.suggest
plugins: plugins:
- search - search
@@ -31,3 +45,34 @@ plugins:
annotations_path: brief annotations_path: brief
show_root_heading: true show_root_heading: true
group_by_category: true group_by_category: true
show_category_heading: true
show_object_full_path: false
show_symbol_type_heading: true
markdown_extensions:
- pymdownx.superfences
- pymdownx.inlinehilite
- pymdownx.snippets
- admonition
- pymdownx.details
- pymdownx.superfences
- pymdownx.highlight:
linenums: true
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.tabbed:
alternate_style: true
- pymdownx.tasklist:
custom_checkbox: true
- tables
- footnotes
- pymdownx.caret
- pymdownx.tilde
- pymdownx.mark

3
docs/cli/commands.md Normal file
View File

@@ -0,0 +1,3 @@
# Commands
::: docforge.cli.commands

3
docs/cli/mcp_utils.md Normal file
View File

@@ -0,0 +1,3 @@
# Mcp Utils
::: docforge.cli.mcp_utils

3
docs/cli/mkdocs_utils.md Normal file
View File

@@ -0,0 +1,3 @@
# Mkdocs Utils
::: docforge.cli.mkdocs_utils

View File

@@ -1,3 +0,0 @@
# Mkdocs
::: docforge.cli.mkdocs

View File

@@ -1,3 +0,0 @@
# Griffe Loader
::: docforge.loader.griffe_loader

View File

@@ -1,3 +0,0 @@
# Loader
::: docforge.loader

View File

@@ -1,3 +0,0 @@
# Model
::: docforge.model

View File

@@ -1,3 +0,0 @@
# Module
::: docforge.model.module

View File

@@ -1,3 +0,0 @@
# Object
::: docforge.model.object

View File

@@ -1,3 +0,0 @@
# Project
::: docforge.model.project

View File

@@ -1,3 +0,0 @@
# Mkdocs
::: docforge.renderers.mkdocs

View File

@@ -1,3 +1,3 @@
# Docforge # docforge
::: docforge ::: docforge

View File

@@ -0,0 +1,3 @@
# Griffe Loader
::: docforge.loaders.griffe_loader

3
docs/loaders/index.md Normal file
View File

@@ -0,0 +1,3 @@
# Loaders
::: docforge.loaders

3
docs/models/index.md Normal file
View File

@@ -0,0 +1,3 @@
# Models
::: docforge.models

3
docs/models/module.md Normal file
View File

@@ -0,0 +1,3 @@
# Module
::: docforge.models.module

3
docs/models/object.md Normal file
View File

@@ -0,0 +1,3 @@
# Object
::: docforge.models.object

3
docs/models/project.md Normal file
View File

@@ -0,0 +1,3 @@
# Project
::: docforge.models.project

View File

@@ -0,0 +1,3 @@
# Mcp Renderer
::: docforge.renderers.mcp_renderer

View File

@@ -0,0 +1,3 @@
# Mkdocs Renderer
::: docforge.renderers.mkdocs_renderer

3
docs/servers/index.md Normal file
View File

@@ -0,0 +1,3 @@
# Servers
::: docforge.servers

View File

@@ -0,0 +1,3 @@
# Mcp Server
::: docforge.servers.mcp_server

6
mcp_docs/index.json Normal file
View File

@@ -0,0 +1,6 @@
{
"project": "docforge",
"type": "docforge-model",
"modules_count": 22,
"source": "docforge"
}

View File

@@ -0,0 +1,377 @@
{
"module": "docforge.cli.commands",
"content": {
"path": "docforge.cli.commands",
"docstring": null,
"objects": {
"click": {
"name": "click",
"kind": "alias",
"path": "docforge.cli.commands.click",
"signature": "<bound method Alias.signature of Alias('click', 'click')>",
"docstring": null
},
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.cli.commands.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"Sequence": {
"name": "Sequence",
"kind": "alias",
"path": "docforge.cli.commands.Sequence",
"signature": "<bound method Alias.signature of Alias('Sequence', 'typing.Sequence')>",
"docstring": null
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "docforge.cli.commands.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.cli.commands.GriffeLoader",
"signature": "<bound method Alias.signature of Alias('GriffeLoader', 'docforge.loaders.GriffeLoader')>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.cli.commands.GriffeLoader.load_project",
"signature": "<bound method Alias.signature of Alias('load_project', 'docforge.loaders.griffe_loader.GriffeLoader.load_project')>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.cli.commands.GriffeLoader.load_module",
"signature": "<bound method Alias.signature of Alias('load_module', 'docforge.loaders.griffe_loader.GriffeLoader.load_module')>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
},
"mkdocs_utils": {
"name": "mkdocs_utils",
"kind": "module",
"path": "docforge.cli.commands.mkdocs_utils",
"signature": "<bound method Alias.signature of Alias('mkdocs_utils', 'docforge.cli.mkdocs_utils')>",
"docstring": null,
"members": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.cli.commands.mkdocs_utils.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'docforge.cli.mkdocs_utils.Path')>",
"docstring": null
},
"resources": {
"name": "resources",
"kind": "alias",
"path": "docforge.cli.commands.mkdocs_utils.resources",
"signature": "<bound method Alias.signature of Alias('resources', 'docforge.cli.mkdocs_utils.resources')>",
"docstring": null
},
"click": {
"name": "click",
"kind": "alias",
"path": "docforge.cli.commands.mkdocs_utils.click",
"signature": "<bound method Alias.signature of Alias('click', 'docforge.cli.mkdocs_utils.click')>",
"docstring": null
},
"yaml": {
"name": "yaml",
"kind": "alias",
"path": "docforge.cli.commands.mkdocs_utils.yaml",
"signature": "<bound method Alias.signature of Alias('yaml', 'docforge.cli.mkdocs_utils.yaml')>",
"docstring": null
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.cli.commands.mkdocs_utils.GriffeLoader",
"signature": "<bound method Alias.signature of Alias('GriffeLoader', 'docforge.cli.mkdocs_utils.GriffeLoader')>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.GriffeLoader.load_project",
"signature": "<bound method Alias.signature of Alias('load_project', 'docforge.loaders.griffe_loader.GriffeLoader.load_project')>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.GriffeLoader.load_module",
"signature": "<bound method Alias.signature of Alias('load_module', 'docforge.loaders.griffe_loader.GriffeLoader.load_module')>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
},
"discover_module_paths": {
"name": "discover_module_paths",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.discover_module_paths",
"signature": "<bound method Alias.signature of Alias('discover_module_paths', 'docforge.cli.mkdocs_utils.discover_module_paths')>",
"docstring": "Discover Python modules within a package directory.\n\nThe function scans the filesystem for ``.py`` files inside the specified\npackage and converts them into dotted module import paths.\n\nDiscovery rules:\n\n- Directories containing ``__init__.py`` are treated as packages.\n- Each ``.py`` file is treated as a module.\n- Results are returned as dotted import paths.\n\nArgs:\n module_name: Top-level package name to discover modules from.\n project_root: Root directory used to resolve module paths. If not\n provided, the current working directory is used.\n\nReturns:\n A sorted list of unique dotted module import paths.\n\nRaises:\n FileNotFoundError: If the specified package directory does not exist."
},
"MkDocsRenderer": {
"name": "MkDocsRenderer",
"kind": "class",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsRenderer",
"signature": "<bound method Alias.signature of Alias('MkDocsRenderer', 'docforge.cli.mkdocs_utils.MkDocsRenderer')>",
"docstring": "Renderer that produces Markdown documentation for MkDocs.\n\nGenerated pages use mkdocstrings directives to reference Python modules,\nallowing MkDocs to render API documentation dynamically.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsRenderer.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.name')>",
"docstring": null
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsRenderer.generate_sources",
"signature": "<bound method Alias.signature of Alias('generate_sources', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.generate_sources')>",
"docstring": "Generate Markdown documentation files for a project.\n\nThis method renders a documentation structure from the provided\nproject model and writes the resulting Markdown files to the\nspecified output directory.\n\nArgs:\n project: Project model containing modules to document.\n out_dir: Directory where generated Markdown files will be written.\n module_is_source: If True, treat the specified module as the\n documentation root rather than nesting it inside a folder."
},
"generate_readme": {
"name": "generate_readme",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsRenderer.generate_readme",
"signature": "<bound method Alias.signature of Alias('generate_readme', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.generate_readme')>",
"docstring": "Generate a ``README.md`` file from the root module docstring.\n\nBehavior:\n\n- If ``module_is_source`` is True, ``README.md`` is written to the\n project root directory.\n- If False, README generation is currently not implemented.\n\nArgs:\n project: Project model containing documentation metadata.\n docs_dir: Directory containing generated documentation sources.\n module_is_source: Whether the module is treated as the project\n source root."
}
}
},
"load_nav_spec": {
"name": "load_nav_spec",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.load_nav_spec",
"signature": "<bound method Alias.signature of Alias('load_nav_spec', 'docforge.cli.mkdocs_utils.load_nav_spec')>",
"docstring": "Load a navigation specification file.\n\nThis helper function reads a YAML navigation file and constructs a\ncorresponding ``NavSpec`` instance.\n\nArgs:\n path: Path to the navigation specification file.\n\nReturns:\n A ``NavSpec`` instance representing the parsed specification.\n\nRaises:\n FileNotFoundError: If the specification file does not exist.\n ValueError: If the YAML structure is invalid."
},
"resolve_nav": {
"name": "resolve_nav",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.resolve_nav",
"signature": "<bound method Alias.signature of Alias('resolve_nav', 'docforge.cli.mkdocs_utils.resolve_nav')>",
"docstring": "Resolve a navigation specification against the filesystem.\n\nThe function expands glob patterns defined in a ``NavSpec`` and verifies\nthat referenced documentation files exist within the documentation root.\n\nArgs:\n spec: Navigation specification describing documentation layout.\n docs_root: Root directory containing documentation Markdown files.\n\nReturns:\n A ``ResolvedNav`` instance containing validated navigation paths.\n\nRaises:\n FileNotFoundError: If the documentation root does not exist or a\n navigation pattern does not match any files."
},
"MkDocsNavEmitter": {
"name": "MkDocsNavEmitter",
"kind": "class",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsNavEmitter",
"signature": "<bound method Alias.signature of Alias('MkDocsNavEmitter', 'docforge.cli.mkdocs_utils.MkDocsNavEmitter')>",
"docstring": "Emit MkDocs navigation structures from resolved navigation data.\n\nThe emitter transforms a ``ResolvedNav`` object into the YAML-compatible\nlist structure expected by the MkDocs ``nav`` configuration field.",
"members": {
"emit": {
"name": "emit",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsNavEmitter.emit",
"signature": "<bound method Alias.signature of Alias('emit', 'docforge.nav.mkdocs.MkDocsNavEmitter.emit')>",
"docstring": "Generate a navigation structure for ``mkdocs.yml``.\n\nArgs:\n nav: Resolved navigation data describing documentation groups\n and their associated Markdown files.\n\nReturns:\n A list of dictionaries representing the MkDocs navigation layout.\n Each dictionary maps a navigation label to a page or a list of\n pages."
}
}
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.generate_sources",
"signature": "<bound method Alias.signature of Alias('generate_sources', 'docforge.cli.mkdocs_utils.generate_sources')>",
"docstring": "Generate MkDocs Markdown sources for a Python module.\n\nThis function introspects the specified module, builds the internal\ndocumentation model, and renders Markdown documentation files for\nuse with MkDocs.\n\nArgs:\n module: Python module import path used as the entry point for\n documentation generation.\n docs_dir: Directory where the generated Markdown files will be written.\n project_name: Optional override for the project name used in\n documentation metadata.\n module_is_source: If True, treat the specified module directory as\n the project root rather than a nested module."
},
"generate_config": {
"name": "generate_config",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.generate_config",
"signature": "<bound method Alias.signature of Alias('generate_config', 'docforge.cli.mkdocs_utils.generate_config')>",
"docstring": "Generate an ``mkdocs.yml`` configuration file.\n\nThe configuration is created by combining a template configuration\nwith a navigation structure derived from the docforge navigation\nspecification.\n\nArgs:\n docs_dir: Directory containing generated documentation Markdown files.\n nav_file: Path to the ``docforge.nav.yml`` navigation specification.\n template: Optional path to a custom MkDocs configuration template.\n If not provided, a built-in template will be used.\n out: Destination path where the generated ``mkdocs.yml`` file\n will be written.\n site_name: Display name for the generated documentation site.\n\nRaises:\n click.FileError: If the navigation specification or template\n file cannot be found."
},
"build": {
"name": "build",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.build",
"signature": "<bound method Alias.signature of Alias('build', 'docforge.cli.mkdocs_utils.build')>",
"docstring": "Build the MkDocs documentation site.\n\nThis function loads the MkDocs configuration and runs the MkDocs\nbuild command to generate the final static documentation site.\n\nArgs:\n mkdocs_yml: Path to the ``mkdocs.yml`` configuration file.\n\nRaises:\n click.ClickException: If the configuration file does not exist."
},
"serve": {
"name": "serve",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.serve",
"signature": "<bound method Alias.signature of Alias('serve', 'docforge.cli.mkdocs_utils.serve')>",
"docstring": "Start an MkDocs development server with live reload.\n\nThe server watches documentation files and automatically reloads\nthe site when changes are detected.\n\nArgs:\n mkdocs_yml: Path to the ``mkdocs.yml`` configuration file.\n\nRaises:\n click.ClickException: If the configuration file does not exist."
}
}
},
"mcp_utils": {
"name": "mcp_utils",
"kind": "module",
"path": "docforge.cli.commands.mcp_utils",
"signature": "<bound method Alias.signature of Alias('mcp_utils', 'docforge.cli.mcp_utils')>",
"docstring": null,
"members": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.cli.commands.mcp_utils.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'docforge.cli.mcp_utils.Path')>",
"docstring": null
},
"click": {
"name": "click",
"kind": "alias",
"path": "docforge.cli.commands.mcp_utils.click",
"signature": "<bound method Alias.signature of Alias('click', 'docforge.cli.mcp_utils.click')>",
"docstring": null
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.cli.commands.mcp_utils.GriffeLoader",
"signature": "<bound method Alias.signature of Alias('GriffeLoader', 'docforge.cli.mcp_utils.GriffeLoader')>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.GriffeLoader.load_project",
"signature": "<bound method Alias.signature of Alias('load_project', 'docforge.loaders.griffe_loader.GriffeLoader.load_project')>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.GriffeLoader.load_module",
"signature": "<bound method Alias.signature of Alias('load_module', 'docforge.loaders.griffe_loader.GriffeLoader.load_module')>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
},
"discover_module_paths": {
"name": "discover_module_paths",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.discover_module_paths",
"signature": "<bound method Alias.signature of Alias('discover_module_paths', 'docforge.cli.mcp_utils.discover_module_paths')>",
"docstring": "Discover Python modules within a package directory.\n\nThe function scans the filesystem for ``.py`` files inside the specified\npackage and converts them into dotted module import paths.\n\nDiscovery rules:\n\n- Directories containing ``__init__.py`` are treated as packages.\n- Each ``.py`` file is treated as a module.\n- Results are returned as dotted import paths.\n\nArgs:\n module_name: Top-level package name to discover modules from.\n project_root: Root directory used to resolve module paths. If not\n provided, the current working directory is used.\n\nReturns:\n A sorted list of unique dotted module import paths.\n\nRaises:\n FileNotFoundError: If the specified package directory does not exist."
},
"MCPRenderer": {
"name": "MCPRenderer",
"kind": "class",
"path": "docforge.cli.commands.mcp_utils.MCPRenderer",
"signature": "<bound method Alias.signature of Alias('MCPRenderer', 'docforge.cli.mcp_utils.MCPRenderer')>",
"docstring": "Renderer that generates MCP-compatible documentation resources.\n\nThis renderer converts doc-forge project models into structured JSON\nresources suitable for consumption by systems implementing the Model\nContext Protocol (MCP).",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.cli.commands.mcp_utils.MCPRenderer.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.renderers.mcp_renderer.MCPRenderer.name')>",
"docstring": null
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.MCPRenderer.generate_sources",
"signature": "<bound method Alias.signature of Alias('generate_sources', 'docforge.renderers.mcp_renderer.MCPRenderer.generate_sources')>",
"docstring": "Generate MCP documentation resources for a project.\n\nThe renderer serializes each module into a JSON resource and produces\nsupporting metadata files such as ``nav.json`` and ``index.json``.\n\nArgs:\n project: Documentation project model to render.\n out_dir: Directory where MCP resources will be written."
}
}
},
"MCPServer": {
"name": "MCPServer",
"kind": "class",
"path": "docforge.cli.commands.mcp_utils.MCPServer",
"signature": "<bound method Alias.signature of Alias('MCPServer', 'docforge.cli.mcp_utils.MCPServer')>",
"docstring": "MCP server for serving a pre-generated documentation bundle.\n\nThe server exposes documentation resources and diagnostic tools through\nMCP endpoints backed by JSON files generated by the MCP renderer.",
"members": {
"mcp_root": {
"name": "mcp_root",
"kind": "attribute",
"path": "docforge.cli.commands.mcp_utils.MCPServer.mcp_root",
"signature": "<bound method Alias.signature of Alias('mcp_root', 'docforge.servers.mcp_server.MCPServer.mcp_root')>",
"docstring": null
},
"app": {
"name": "app",
"kind": "attribute",
"path": "docforge.cli.commands.mcp_utils.MCPServer.app",
"signature": "<bound method Alias.signature of Alias('app', 'docforge.servers.mcp_server.MCPServer.app')>",
"docstring": null
},
"run": {
"name": "run",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.MCPServer.run",
"signature": "<bound method Alias.signature of Alias('run', 'docforge.servers.mcp_server.MCPServer.run')>",
"docstring": "Start the MCP server.\n\nArgs:\n transport: Transport mechanism used by the MCP server. Supported\n options include ``stdio``, ``sse``, and ``streamable-http``."
}
}
},
"generate_resources": {
"name": "generate_resources",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.generate_resources",
"signature": "<bound method Alias.signature of Alias('generate_resources', 'docforge.cli.mcp_utils.generate_resources')>",
"docstring": "Generate MCP documentation resources from a Python module.\n\nThe function performs project introspection, builds the internal\ndocumentation model, and renders MCP-compatible JSON resources\nto the specified output directory.\n\nArgs:\n module: Python module import path used as the entry point for\n documentation generation.\n project_name: Optional override for the project name used in\n generated documentation metadata.\n out_dir: Directory where MCP resources (index.json, nav.json,\n and module data) will be written."
},
"serve": {
"name": "serve",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.serve",
"signature": "<bound method Alias.signature of Alias('serve', 'docforge.cli.mcp_utils.serve')>",
"docstring": "Start an MCP server for a pre-generated documentation bundle.\n\nThe server exposes documentation resources such as project metadata,\nnavigation structure, and module documentation through MCP endpoints.\n\nArgs:\n module: Python module import path used to identify the served\n documentation instance.\n mcp_root: Path to the directory containing the MCP documentation\n bundle (index.json, nav.json, and modules/).\n\nRaises:\n click.ClickException: If the MCP documentation bundle is missing\n required files or directories."
}
}
},
"cli": {
"name": "cli",
"kind": "attribute",
"path": "docforge.cli.commands.cli",
"signature": null,
"docstring": null
},
"build": {
"name": "build",
"kind": "function",
"path": "docforge.cli.commands.build",
"signature": "<bound method Function.signature of Function('build', 20, 108)>",
"docstring": "Build documentation artifacts.\n\nThis command performs the full documentation build pipeline:\n\n1. Introspects the Python project using Griffe\n2. Generates renderer-specific documentation sources\n3. Optionally builds the final documentation output\n\nDepending on the selected options, the build can target:\n\n- MkDocs static documentation sites\n- MCP structured documentation resources\n\nArgs:\n mcp: Enable MCP documentation generation.\n mkdocs: Enable MkDocs documentation generation.\n module_is_source: Treat the specified module directory as the\n project root.\n module: Python module import path to document.\n project_name: Optional override for the project name.\n site_name: Display name for the MkDocs site.\n docs_dir: Directory where Markdown documentation sources\n will be generated.\n nav_file: Path to the navigation specification file.\n template: Optional custom MkDocs configuration template.\n mkdocs_yml: Output path for the generated MkDocs configuration.\n out_dir: Output directory for generated MCP resources.\n\nRaises:\n click.UsageError: If required options are missing or conflicting."
},
"serve": {
"name": "serve",
"kind": "function",
"path": "docforge.cli.commands.serve",
"signature": "<bound method Function.signature of Function('serve', 111, 152)>",
"docstring": "Serve generated documentation locally.\n\nDepending on the selected mode, this command starts either:\n\n- A MkDocs development server for browsing documentation\n- An MCP server exposing structured documentation resources\n\nArgs:\n mcp: Serve documentation using the MCP server.\n mkdocs: Serve the MkDocs development site.\n module: Python module import path to serve via MCP.\n mkdocs_yml: Path to the MkDocs configuration file.\n out_dir: Root directory containing MCP documentation resources.\n\nRaises:\n click.UsageError: If invalid or conflicting options are provided."
},
"tree": {
"name": "tree",
"kind": "function",
"path": "docforge.cli.commands.tree",
"signature": "<bound method Function.signature of Function('tree', 155, 188)>",
"docstring": "Display the documentation object tree for a module.\n\nThis command introspects the specified module and prints a\nhierarchical representation of the discovered documentation\nobjects, including modules, classes, functions, and members.\n\nArgs:\n module: Python module import path to introspect.\n project_name: Optional name to display as the project root."
},
"Group": {
"name": "Group",
"kind": "alias",
"path": "docforge.cli.commands.Group",
"signature": "<bound method Alias.signature of Alias('Group', 'click.core.Group')>",
"docstring": null
},
"Any": {
"name": "Any",
"kind": "alias",
"path": "docforge.cli.commands.Any",
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
"docstring": null
}
}
}
}

View File

@@ -0,0 +1,684 @@
{
"module": "docforge.cli",
"content": {
"path": "docforge.cli",
"docstring": "Command line interface entry point for doc-forge.\n\nThis module exposes the primary CLI entry function used by the\n``doc-forge`` command. The actual command implementation resides in\n``docforge.cli.main``, while this module provides a stable import path\nfor external tools and the package entry point configuration.\n\nThe CLI is responsible for orchestrating documentation workflows such as\ngenerating renderer sources, building documentation sites, exporting\nmachine-readable documentation bundles, and starting development or MCP\nservers.\n\n---\n\nTypical usage\n-------------\n\nThe CLI is normally invoked through the installed command:\n\n doc-forge <command> [options]\n\nProgrammatic invocation is also possible:\n\n from docforge.cli import main\n main()\n\n---",
"objects": {
"main": {
"name": "main",
"kind": "module",
"path": "docforge.cli.main",
"signature": null,
"docstring": "Command-line entry point for the doc-forge CLI.\n\nThis module exposes the executable entry point that initializes the\nClick command group defined in ``docforge.cli.commands``.",
"members": {
"cli": {
"name": "cli",
"kind": "attribute",
"path": "docforge.cli.main.cli",
"signature": "<bound method Alias.signature of Alias('cli', 'docforge.cli.commands.cli')>",
"docstring": null
},
"main": {
"name": "main",
"kind": "function",
"path": "docforge.cli.main.main",
"signature": "<bound method Function.signature of Function('main', 11, 19)>",
"docstring": "Run the doc-forge command-line interface.\n\nThis function initializes and executes the Click CLI application.\nIt is used as the console entry point when invoking ``doc-forge``\nfrom the command line."
}
}
},
"commands": {
"name": "commands",
"kind": "module",
"path": "docforge.cli.commands",
"signature": null,
"docstring": null,
"members": {
"click": {
"name": "click",
"kind": "alias",
"path": "docforge.cli.commands.click",
"signature": "<bound method Alias.signature of Alias('click', 'click')>",
"docstring": null
},
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.cli.commands.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"Sequence": {
"name": "Sequence",
"kind": "alias",
"path": "docforge.cli.commands.Sequence",
"signature": "<bound method Alias.signature of Alias('Sequence', 'typing.Sequence')>",
"docstring": null
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "docforge.cli.commands.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.cli.commands.GriffeLoader",
"signature": "<bound method Alias.signature of Alias('GriffeLoader', 'docforge.loaders.GriffeLoader')>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.cli.commands.GriffeLoader.load_project",
"signature": "<bound method Alias.signature of Alias('load_project', 'docforge.loaders.griffe_loader.GriffeLoader.load_project')>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.cli.commands.GriffeLoader.load_module",
"signature": "<bound method Alias.signature of Alias('load_module', 'docforge.loaders.griffe_loader.GriffeLoader.load_module')>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
},
"mkdocs_utils": {
"name": "mkdocs_utils",
"kind": "module",
"path": "docforge.cli.commands.mkdocs_utils",
"signature": "<bound method Alias.signature of Alias('mkdocs_utils', 'docforge.cli.mkdocs_utils')>",
"docstring": null,
"members": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.cli.commands.mkdocs_utils.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'docforge.cli.mkdocs_utils.Path')>",
"docstring": null
},
"resources": {
"name": "resources",
"kind": "alias",
"path": "docforge.cli.commands.mkdocs_utils.resources",
"signature": "<bound method Alias.signature of Alias('resources', 'docforge.cli.mkdocs_utils.resources')>",
"docstring": null
},
"click": {
"name": "click",
"kind": "alias",
"path": "docforge.cli.commands.mkdocs_utils.click",
"signature": "<bound method Alias.signature of Alias('click', 'docforge.cli.mkdocs_utils.click')>",
"docstring": null
},
"yaml": {
"name": "yaml",
"kind": "alias",
"path": "docforge.cli.commands.mkdocs_utils.yaml",
"signature": "<bound method Alias.signature of Alias('yaml', 'docforge.cli.mkdocs_utils.yaml')>",
"docstring": null
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.cli.commands.mkdocs_utils.GriffeLoader",
"signature": "<bound method Alias.signature of Alias('GriffeLoader', 'docforge.cli.mkdocs_utils.GriffeLoader')>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.GriffeLoader.load_project",
"signature": "<bound method Alias.signature of Alias('load_project', 'docforge.loaders.griffe_loader.GriffeLoader.load_project')>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.GriffeLoader.load_module",
"signature": "<bound method Alias.signature of Alias('load_module', 'docforge.loaders.griffe_loader.GriffeLoader.load_module')>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
},
"discover_module_paths": {
"name": "discover_module_paths",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.discover_module_paths",
"signature": "<bound method Alias.signature of Alias('discover_module_paths', 'docforge.cli.mkdocs_utils.discover_module_paths')>",
"docstring": "Discover Python modules within a package directory.\n\nThe function scans the filesystem for ``.py`` files inside the specified\npackage and converts them into dotted module import paths.\n\nDiscovery rules:\n\n- Directories containing ``__init__.py`` are treated as packages.\n- Each ``.py`` file is treated as a module.\n- Results are returned as dotted import paths.\n\nArgs:\n module_name: Top-level package name to discover modules from.\n project_root: Root directory used to resolve module paths. If not\n provided, the current working directory is used.\n\nReturns:\n A sorted list of unique dotted module import paths.\n\nRaises:\n FileNotFoundError: If the specified package directory does not exist."
},
"MkDocsRenderer": {
"name": "MkDocsRenderer",
"kind": "class",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsRenderer",
"signature": "<bound method Alias.signature of Alias('MkDocsRenderer', 'docforge.cli.mkdocs_utils.MkDocsRenderer')>",
"docstring": "Renderer that produces Markdown documentation for MkDocs.\n\nGenerated pages use mkdocstrings directives to reference Python modules,\nallowing MkDocs to render API documentation dynamically.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsRenderer.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.name')>",
"docstring": null
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsRenderer.generate_sources",
"signature": "<bound method Alias.signature of Alias('generate_sources', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.generate_sources')>",
"docstring": "Generate Markdown documentation files for a project.\n\nThis method renders a documentation structure from the provided\nproject model and writes the resulting Markdown files to the\nspecified output directory.\n\nArgs:\n project: Project model containing modules to document.\n out_dir: Directory where generated Markdown files will be written.\n module_is_source: If True, treat the specified module as the\n documentation root rather than nesting it inside a folder."
},
"generate_readme": {
"name": "generate_readme",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsRenderer.generate_readme",
"signature": "<bound method Alias.signature of Alias('generate_readme', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.generate_readme')>",
"docstring": "Generate a ``README.md`` file from the root module docstring.\n\nBehavior:\n\n- If ``module_is_source`` is True, ``README.md`` is written to the\n project root directory.\n- If False, README generation is currently not implemented.\n\nArgs:\n project: Project model containing documentation metadata.\n docs_dir: Directory containing generated documentation sources.\n module_is_source: Whether the module is treated as the project\n source root."
}
}
},
"load_nav_spec": {
"name": "load_nav_spec",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.load_nav_spec",
"signature": "<bound method Alias.signature of Alias('load_nav_spec', 'docforge.cli.mkdocs_utils.load_nav_spec')>",
"docstring": "Load a navigation specification file.\n\nThis helper function reads a YAML navigation file and constructs a\ncorresponding ``NavSpec`` instance.\n\nArgs:\n path: Path to the navigation specification file.\n\nReturns:\n A ``NavSpec`` instance representing the parsed specification.\n\nRaises:\n FileNotFoundError: If the specification file does not exist.\n ValueError: If the YAML structure is invalid."
},
"resolve_nav": {
"name": "resolve_nav",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.resolve_nav",
"signature": "<bound method Alias.signature of Alias('resolve_nav', 'docforge.cli.mkdocs_utils.resolve_nav')>",
"docstring": "Resolve a navigation specification against the filesystem.\n\nThe function expands glob patterns defined in a ``NavSpec`` and verifies\nthat referenced documentation files exist within the documentation root.\n\nArgs:\n spec: Navigation specification describing documentation layout.\n docs_root: Root directory containing documentation Markdown files.\n\nReturns:\n A ``ResolvedNav`` instance containing validated navigation paths.\n\nRaises:\n FileNotFoundError: If the documentation root does not exist or a\n navigation pattern does not match any files."
},
"MkDocsNavEmitter": {
"name": "MkDocsNavEmitter",
"kind": "class",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsNavEmitter",
"signature": "<bound method Alias.signature of Alias('MkDocsNavEmitter', 'docforge.cli.mkdocs_utils.MkDocsNavEmitter')>",
"docstring": "Emit MkDocs navigation structures from resolved navigation data.\n\nThe emitter transforms a ``ResolvedNav`` object into the YAML-compatible\nlist structure expected by the MkDocs ``nav`` configuration field.",
"members": {
"emit": {
"name": "emit",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.MkDocsNavEmitter.emit",
"signature": "<bound method Alias.signature of Alias('emit', 'docforge.nav.mkdocs.MkDocsNavEmitter.emit')>",
"docstring": "Generate a navigation structure for ``mkdocs.yml``.\n\nArgs:\n nav: Resolved navigation data describing documentation groups\n and their associated Markdown files.\n\nReturns:\n A list of dictionaries representing the MkDocs navigation layout.\n Each dictionary maps a navigation label to a page or a list of\n pages."
}
}
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.generate_sources",
"signature": "<bound method Alias.signature of Alias('generate_sources', 'docforge.cli.mkdocs_utils.generate_sources')>",
"docstring": "Generate MkDocs Markdown sources for a Python module.\n\nThis function introspects the specified module, builds the internal\ndocumentation model, and renders Markdown documentation files for\nuse with MkDocs.\n\nArgs:\n module: Python module import path used as the entry point for\n documentation generation.\n docs_dir: Directory where the generated Markdown files will be written.\n project_name: Optional override for the project name used in\n documentation metadata.\n module_is_source: If True, treat the specified module directory as\n the project root rather than a nested module."
},
"generate_config": {
"name": "generate_config",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.generate_config",
"signature": "<bound method Alias.signature of Alias('generate_config', 'docforge.cli.mkdocs_utils.generate_config')>",
"docstring": "Generate an ``mkdocs.yml`` configuration file.\n\nThe configuration is created by combining a template configuration\nwith a navigation structure derived from the docforge navigation\nspecification.\n\nArgs:\n docs_dir: Directory containing generated documentation Markdown files.\n nav_file: Path to the ``docforge.nav.yml`` navigation specification.\n template: Optional path to a custom MkDocs configuration template.\n If not provided, a built-in template will be used.\n out: Destination path where the generated ``mkdocs.yml`` file\n will be written.\n site_name: Display name for the generated documentation site.\n\nRaises:\n click.FileError: If the navigation specification or template\n file cannot be found."
},
"build": {
"name": "build",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.build",
"signature": "<bound method Alias.signature of Alias('build', 'docforge.cli.mkdocs_utils.build')>",
"docstring": "Build the MkDocs documentation site.\n\nThis function loads the MkDocs configuration and runs the MkDocs\nbuild command to generate the final static documentation site.\n\nArgs:\n mkdocs_yml: Path to the ``mkdocs.yml`` configuration file.\n\nRaises:\n click.ClickException: If the configuration file does not exist."
},
"serve": {
"name": "serve",
"kind": "function",
"path": "docforge.cli.commands.mkdocs_utils.serve",
"signature": "<bound method Alias.signature of Alias('serve', 'docforge.cli.mkdocs_utils.serve')>",
"docstring": "Start an MkDocs development server with live reload.\n\nThe server watches documentation files and automatically reloads\nthe site when changes are detected.\n\nArgs:\n mkdocs_yml: Path to the ``mkdocs.yml`` configuration file.\n\nRaises:\n click.ClickException: If the configuration file does not exist."
}
}
},
"mcp_utils": {
"name": "mcp_utils",
"kind": "module",
"path": "docforge.cli.commands.mcp_utils",
"signature": "<bound method Alias.signature of Alias('mcp_utils', 'docforge.cli.mcp_utils')>",
"docstring": null,
"members": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.cli.commands.mcp_utils.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'docforge.cli.mcp_utils.Path')>",
"docstring": null
},
"click": {
"name": "click",
"kind": "alias",
"path": "docforge.cli.commands.mcp_utils.click",
"signature": "<bound method Alias.signature of Alias('click', 'docforge.cli.mcp_utils.click')>",
"docstring": null
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.cli.commands.mcp_utils.GriffeLoader",
"signature": "<bound method Alias.signature of Alias('GriffeLoader', 'docforge.cli.mcp_utils.GriffeLoader')>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.GriffeLoader.load_project",
"signature": "<bound method Alias.signature of Alias('load_project', 'docforge.loaders.griffe_loader.GriffeLoader.load_project')>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.GriffeLoader.load_module",
"signature": "<bound method Alias.signature of Alias('load_module', 'docforge.loaders.griffe_loader.GriffeLoader.load_module')>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
},
"discover_module_paths": {
"name": "discover_module_paths",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.discover_module_paths",
"signature": "<bound method Alias.signature of Alias('discover_module_paths', 'docforge.cli.mcp_utils.discover_module_paths')>",
"docstring": "Discover Python modules within a package directory.\n\nThe function scans the filesystem for ``.py`` files inside the specified\npackage and converts them into dotted module import paths.\n\nDiscovery rules:\n\n- Directories containing ``__init__.py`` are treated as packages.\n- Each ``.py`` file is treated as a module.\n- Results are returned as dotted import paths.\n\nArgs:\n module_name: Top-level package name to discover modules from.\n project_root: Root directory used to resolve module paths. If not\n provided, the current working directory is used.\n\nReturns:\n A sorted list of unique dotted module import paths.\n\nRaises:\n FileNotFoundError: If the specified package directory does not exist."
},
"MCPRenderer": {
"name": "MCPRenderer",
"kind": "class",
"path": "docforge.cli.commands.mcp_utils.MCPRenderer",
"signature": "<bound method Alias.signature of Alias('MCPRenderer', 'docforge.cli.mcp_utils.MCPRenderer')>",
"docstring": "Renderer that generates MCP-compatible documentation resources.\n\nThis renderer converts doc-forge project models into structured JSON\nresources suitable for consumption by systems implementing the Model\nContext Protocol (MCP).",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.cli.commands.mcp_utils.MCPRenderer.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.renderers.mcp_renderer.MCPRenderer.name')>",
"docstring": null
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.MCPRenderer.generate_sources",
"signature": "<bound method Alias.signature of Alias('generate_sources', 'docforge.renderers.mcp_renderer.MCPRenderer.generate_sources')>",
"docstring": "Generate MCP documentation resources for a project.\n\nThe renderer serializes each module into a JSON resource and produces\nsupporting metadata files such as ``nav.json`` and ``index.json``.\n\nArgs:\n project: Documentation project model to render.\n out_dir: Directory where MCP resources will be written."
}
}
},
"MCPServer": {
"name": "MCPServer",
"kind": "class",
"path": "docforge.cli.commands.mcp_utils.MCPServer",
"signature": "<bound method Alias.signature of Alias('MCPServer', 'docforge.cli.mcp_utils.MCPServer')>",
"docstring": "MCP server for serving a pre-generated documentation bundle.\n\nThe server exposes documentation resources and diagnostic tools through\nMCP endpoints backed by JSON files generated by the MCP renderer.",
"members": {
"mcp_root": {
"name": "mcp_root",
"kind": "attribute",
"path": "docforge.cli.commands.mcp_utils.MCPServer.mcp_root",
"signature": "<bound method Alias.signature of Alias('mcp_root', 'docforge.servers.mcp_server.MCPServer.mcp_root')>",
"docstring": null
},
"app": {
"name": "app",
"kind": "attribute",
"path": "docforge.cli.commands.mcp_utils.MCPServer.app",
"signature": "<bound method Alias.signature of Alias('app', 'docforge.servers.mcp_server.MCPServer.app')>",
"docstring": null
},
"run": {
"name": "run",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.MCPServer.run",
"signature": "<bound method Alias.signature of Alias('run', 'docforge.servers.mcp_server.MCPServer.run')>",
"docstring": "Start the MCP server.\n\nArgs:\n transport: Transport mechanism used by the MCP server. Supported\n options include ``stdio``, ``sse``, and ``streamable-http``."
}
}
},
"generate_resources": {
"name": "generate_resources",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.generate_resources",
"signature": "<bound method Alias.signature of Alias('generate_resources', 'docforge.cli.mcp_utils.generate_resources')>",
"docstring": "Generate MCP documentation resources from a Python module.\n\nThe function performs project introspection, builds the internal\ndocumentation model, and renders MCP-compatible JSON resources\nto the specified output directory.\n\nArgs:\n module: Python module import path used as the entry point for\n documentation generation.\n project_name: Optional override for the project name used in\n generated documentation metadata.\n out_dir: Directory where MCP resources (index.json, nav.json,\n and module data) will be written."
},
"serve": {
"name": "serve",
"kind": "function",
"path": "docforge.cli.commands.mcp_utils.serve",
"signature": "<bound method Alias.signature of Alias('serve', 'docforge.cli.mcp_utils.serve')>",
"docstring": "Start an MCP server for a pre-generated documentation bundle.\n\nThe server exposes documentation resources such as project metadata,\nnavigation structure, and module documentation through MCP endpoints.\n\nArgs:\n module: Python module import path used to identify the served\n documentation instance.\n mcp_root: Path to the directory containing the MCP documentation\n bundle (index.json, nav.json, and modules/).\n\nRaises:\n click.ClickException: If the MCP documentation bundle is missing\n required files or directories."
}
}
},
"cli": {
"name": "cli",
"kind": "attribute",
"path": "docforge.cli.commands.cli",
"signature": null,
"docstring": null
},
"build": {
"name": "build",
"kind": "function",
"path": "docforge.cli.commands.build",
"signature": "<bound method Function.signature of Function('build', 20, 108)>",
"docstring": "Build documentation artifacts.\n\nThis command performs the full documentation build pipeline:\n\n1. Introspects the Python project using Griffe\n2. Generates renderer-specific documentation sources\n3. Optionally builds the final documentation output\n\nDepending on the selected options, the build can target:\n\n- MkDocs static documentation sites\n- MCP structured documentation resources\n\nArgs:\n mcp: Enable MCP documentation generation.\n mkdocs: Enable MkDocs documentation generation.\n module_is_source: Treat the specified module directory as the\n project root.\n module: Python module import path to document.\n project_name: Optional override for the project name.\n site_name: Display name for the MkDocs site.\n docs_dir: Directory where Markdown documentation sources\n will be generated.\n nav_file: Path to the navigation specification file.\n template: Optional custom MkDocs configuration template.\n mkdocs_yml: Output path for the generated MkDocs configuration.\n out_dir: Output directory for generated MCP resources.\n\nRaises:\n click.UsageError: If required options are missing or conflicting."
},
"serve": {
"name": "serve",
"kind": "function",
"path": "docforge.cli.commands.serve",
"signature": "<bound method Function.signature of Function('serve', 111, 152)>",
"docstring": "Serve generated documentation locally.\n\nDepending on the selected mode, this command starts either:\n\n- A MkDocs development server for browsing documentation\n- An MCP server exposing structured documentation resources\n\nArgs:\n mcp: Serve documentation using the MCP server.\n mkdocs: Serve the MkDocs development site.\n module: Python module import path to serve via MCP.\n mkdocs_yml: Path to the MkDocs configuration file.\n out_dir: Root directory containing MCP documentation resources.\n\nRaises:\n click.UsageError: If invalid or conflicting options are provided."
},
"tree": {
"name": "tree",
"kind": "function",
"path": "docforge.cli.commands.tree",
"signature": "<bound method Function.signature of Function('tree', 155, 188)>",
"docstring": "Display the documentation object tree for a module.\n\nThis command introspects the specified module and prints a\nhierarchical representation of the discovered documentation\nobjects, including modules, classes, functions, and members.\n\nArgs:\n module: Python module import path to introspect.\n project_name: Optional name to display as the project root."
},
"Group": {
"name": "Group",
"kind": "alias",
"path": "docforge.cli.commands.Group",
"signature": "<bound method Alias.signature of Alias('Group', 'click.core.Group')>",
"docstring": null
},
"Any": {
"name": "Any",
"kind": "alias",
"path": "docforge.cli.commands.Any",
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
"docstring": null
}
}
},
"mcp_utils": {
"name": "mcp_utils",
"kind": "module",
"path": "docforge.cli.mcp_utils",
"signature": null,
"docstring": null,
"members": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.cli.mcp_utils.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"click": {
"name": "click",
"kind": "alias",
"path": "docforge.cli.mcp_utils.click",
"signature": "<bound method Alias.signature of Alias('click', 'click')>",
"docstring": null
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.cli.mcp_utils.GriffeLoader",
"signature": "<bound method Alias.signature of Alias('GriffeLoader', 'docforge.loaders.GriffeLoader')>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.cli.mcp_utils.GriffeLoader.load_project",
"signature": "<bound method Alias.signature of Alias('load_project', 'docforge.loaders.griffe_loader.GriffeLoader.load_project')>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.cli.mcp_utils.GriffeLoader.load_module",
"signature": "<bound method Alias.signature of Alias('load_module', 'docforge.loaders.griffe_loader.GriffeLoader.load_module')>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
},
"discover_module_paths": {
"name": "discover_module_paths",
"kind": "function",
"path": "docforge.cli.mcp_utils.discover_module_paths",
"signature": "<bound method Alias.signature of Alias('discover_module_paths', 'docforge.loaders.discover_module_paths')>",
"docstring": "Discover Python modules within a package directory.\n\nThe function scans the filesystem for ``.py`` files inside the specified\npackage and converts them into dotted module import paths.\n\nDiscovery rules:\n\n- Directories containing ``__init__.py`` are treated as packages.\n- Each ``.py`` file is treated as a module.\n- Results are returned as dotted import paths.\n\nArgs:\n module_name: Top-level package name to discover modules from.\n project_root: Root directory used to resolve module paths. If not\n provided, the current working directory is used.\n\nReturns:\n A sorted list of unique dotted module import paths.\n\nRaises:\n FileNotFoundError: If the specified package directory does not exist."
},
"MCPRenderer": {
"name": "MCPRenderer",
"kind": "class",
"path": "docforge.cli.mcp_utils.MCPRenderer",
"signature": "<bound method Alias.signature of Alias('MCPRenderer', 'docforge.renderers.MCPRenderer')>",
"docstring": "Renderer that generates MCP-compatible documentation resources.\n\nThis renderer converts doc-forge project models into structured JSON\nresources suitable for consumption by systems implementing the Model\nContext Protocol (MCP).",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.cli.mcp_utils.MCPRenderer.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.renderers.mcp_renderer.MCPRenderer.name')>",
"docstring": null
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.mcp_utils.MCPRenderer.generate_sources",
"signature": "<bound method Alias.signature of Alias('generate_sources', 'docforge.renderers.mcp_renderer.MCPRenderer.generate_sources')>",
"docstring": "Generate MCP documentation resources for a project.\n\nThe renderer serializes each module into a JSON resource and produces\nsupporting metadata files such as ``nav.json`` and ``index.json``.\n\nArgs:\n project: Documentation project model to render.\n out_dir: Directory where MCP resources will be written."
}
}
},
"MCPServer": {
"name": "MCPServer",
"kind": "class",
"path": "docforge.cli.mcp_utils.MCPServer",
"signature": "<bound method Alias.signature of Alias('MCPServer', 'docforge.servers.MCPServer')>",
"docstring": "MCP server for serving a pre-generated documentation bundle.\n\nThe server exposes documentation resources and diagnostic tools through\nMCP endpoints backed by JSON files generated by the MCP renderer.",
"members": {
"mcp_root": {
"name": "mcp_root",
"kind": "attribute",
"path": "docforge.cli.mcp_utils.MCPServer.mcp_root",
"signature": "<bound method Alias.signature of Alias('mcp_root', 'docforge.servers.mcp_server.MCPServer.mcp_root')>",
"docstring": null
},
"app": {
"name": "app",
"kind": "attribute",
"path": "docforge.cli.mcp_utils.MCPServer.app",
"signature": "<bound method Alias.signature of Alias('app', 'docforge.servers.mcp_server.MCPServer.app')>",
"docstring": null
},
"run": {
"name": "run",
"kind": "function",
"path": "docforge.cli.mcp_utils.MCPServer.run",
"signature": "<bound method Alias.signature of Alias('run', 'docforge.servers.mcp_server.MCPServer.run')>",
"docstring": "Start the MCP server.\n\nArgs:\n transport: Transport mechanism used by the MCP server. Supported\n options include ``stdio``, ``sse``, and ``streamable-http``."
}
}
},
"generate_resources": {
"name": "generate_resources",
"kind": "function",
"path": "docforge.cli.mcp_utils.generate_resources",
"signature": "<bound method Function.signature of Function('generate_resources', 8, 29)>",
"docstring": "Generate MCP documentation resources from a Python module.\n\nThe function performs project introspection, builds the internal\ndocumentation model, and renders MCP-compatible JSON resources\nto the specified output directory.\n\nArgs:\n module: Python module import path used as the entry point for\n documentation generation.\n project_name: Optional override for the project name used in\n generated documentation metadata.\n out_dir: Directory where MCP resources (index.json, nav.json,\n and module data) will be written."
},
"serve": {
"name": "serve",
"kind": "function",
"path": "docforge.cli.mcp_utils.serve",
"signature": "<bound method Function.signature of Function('serve', 32, 66)>",
"docstring": "Start an MCP server for a pre-generated documentation bundle.\n\nThe server exposes documentation resources such as project metadata,\nnavigation structure, and module documentation through MCP endpoints.\n\nArgs:\n module: Python module import path used to identify the served\n documentation instance.\n mcp_root: Path to the directory containing the MCP documentation\n bundle (index.json, nav.json, and modules/).\n\nRaises:\n click.ClickException: If the MCP documentation bundle is missing\n required files or directories."
}
}
},
"mkdocs_utils": {
"name": "mkdocs_utils",
"kind": "module",
"path": "docforge.cli.mkdocs_utils",
"signature": null,
"docstring": null,
"members": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.cli.mkdocs_utils.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"resources": {
"name": "resources",
"kind": "alias",
"path": "docforge.cli.mkdocs_utils.resources",
"signature": "<bound method Alias.signature of Alias('resources', 'importlib.resources')>",
"docstring": null
},
"click": {
"name": "click",
"kind": "alias",
"path": "docforge.cli.mkdocs_utils.click",
"signature": "<bound method Alias.signature of Alias('click', 'click')>",
"docstring": null
},
"yaml": {
"name": "yaml",
"kind": "alias",
"path": "docforge.cli.mkdocs_utils.yaml",
"signature": "<bound method Alias.signature of Alias('yaml', 'yaml')>",
"docstring": null
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.cli.mkdocs_utils.GriffeLoader",
"signature": "<bound method Alias.signature of Alias('GriffeLoader', 'docforge.loaders.GriffeLoader')>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.GriffeLoader.load_project",
"signature": "<bound method Alias.signature of Alias('load_project', 'docforge.loaders.griffe_loader.GriffeLoader.load_project')>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.GriffeLoader.load_module",
"signature": "<bound method Alias.signature of Alias('load_module', 'docforge.loaders.griffe_loader.GriffeLoader.load_module')>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
},
"discover_module_paths": {
"name": "discover_module_paths",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.discover_module_paths",
"signature": "<bound method Alias.signature of Alias('discover_module_paths', 'docforge.loaders.discover_module_paths')>",
"docstring": "Discover Python modules within a package directory.\n\nThe function scans the filesystem for ``.py`` files inside the specified\npackage and converts them into dotted module import paths.\n\nDiscovery rules:\n\n- Directories containing ``__init__.py`` are treated as packages.\n- Each ``.py`` file is treated as a module.\n- Results are returned as dotted import paths.\n\nArgs:\n module_name: Top-level package name to discover modules from.\n project_root: Root directory used to resolve module paths. If not\n provided, the current working directory is used.\n\nReturns:\n A sorted list of unique dotted module import paths.\n\nRaises:\n FileNotFoundError: If the specified package directory does not exist."
},
"MkDocsRenderer": {
"name": "MkDocsRenderer",
"kind": "class",
"path": "docforge.cli.mkdocs_utils.MkDocsRenderer",
"signature": "<bound method Alias.signature of Alias('MkDocsRenderer', 'docforge.renderers.MkDocsRenderer')>",
"docstring": "Renderer that produces Markdown documentation for MkDocs.\n\nGenerated pages use mkdocstrings directives to reference Python modules,\nallowing MkDocs to render API documentation dynamically.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.cli.mkdocs_utils.MkDocsRenderer.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.name')>",
"docstring": null
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.MkDocsRenderer.generate_sources",
"signature": "<bound method Alias.signature of Alias('generate_sources', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.generate_sources')>",
"docstring": "Generate Markdown documentation files for a project.\n\nThis method renders a documentation structure from the provided\nproject model and writes the resulting Markdown files to the\nspecified output directory.\n\nArgs:\n project: Project model containing modules to document.\n out_dir: Directory where generated Markdown files will be written.\n module_is_source: If True, treat the specified module as the\n documentation root rather than nesting it inside a folder."
},
"generate_readme": {
"name": "generate_readme",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.MkDocsRenderer.generate_readme",
"signature": "<bound method Alias.signature of Alias('generate_readme', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.generate_readme')>",
"docstring": "Generate a ``README.md`` file from the root module docstring.\n\nBehavior:\n\n- If ``module_is_source`` is True, ``README.md`` is written to the\n project root directory.\n- If False, README generation is currently not implemented.\n\nArgs:\n project: Project model containing documentation metadata.\n docs_dir: Directory containing generated documentation sources.\n module_is_source: Whether the module is treated as the project\n source root."
}
}
},
"load_nav_spec": {
"name": "load_nav_spec",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.load_nav_spec",
"signature": "<bound method Alias.signature of Alias('load_nav_spec', 'docforge.nav.load_nav_spec')>",
"docstring": "Load a navigation specification file.\n\nThis helper function reads a YAML navigation file and constructs a\ncorresponding ``NavSpec`` instance.\n\nArgs:\n path: Path to the navigation specification file.\n\nReturns:\n A ``NavSpec`` instance representing the parsed specification.\n\nRaises:\n FileNotFoundError: If the specification file does not exist.\n ValueError: If the YAML structure is invalid."
},
"resolve_nav": {
"name": "resolve_nav",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.resolve_nav",
"signature": "<bound method Alias.signature of Alias('resolve_nav', 'docforge.nav.resolve_nav')>",
"docstring": "Resolve a navigation specification against the filesystem.\n\nThe function expands glob patterns defined in a ``NavSpec`` and verifies\nthat referenced documentation files exist within the documentation root.\n\nArgs:\n spec: Navigation specification describing documentation layout.\n docs_root: Root directory containing documentation Markdown files.\n\nReturns:\n A ``ResolvedNav`` instance containing validated navigation paths.\n\nRaises:\n FileNotFoundError: If the documentation root does not exist or a\n navigation pattern does not match any files."
},
"MkDocsNavEmitter": {
"name": "MkDocsNavEmitter",
"kind": "class",
"path": "docforge.cli.mkdocs_utils.MkDocsNavEmitter",
"signature": "<bound method Alias.signature of Alias('MkDocsNavEmitter', 'docforge.nav.MkDocsNavEmitter')>",
"docstring": "Emit MkDocs navigation structures from resolved navigation data.\n\nThe emitter transforms a ``ResolvedNav`` object into the YAML-compatible\nlist structure expected by the MkDocs ``nav`` configuration field.",
"members": {
"emit": {
"name": "emit",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.MkDocsNavEmitter.emit",
"signature": "<bound method Alias.signature of Alias('emit', 'docforge.nav.mkdocs.MkDocsNavEmitter.emit')>",
"docstring": "Generate a navigation structure for ``mkdocs.yml``.\n\nArgs:\n nav: Resolved navigation data describing documentation groups\n and their associated Markdown files.\n\nReturns:\n A list of dictionaries representing the MkDocs navigation layout.\n Each dictionary maps a navigation label to a page or a list of\n pages."
}
}
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.generate_sources",
"signature": "<bound method Function.signature of Function('generate_sources', 10, 47)>",
"docstring": "Generate MkDocs Markdown sources for a Python module.\n\nThis function introspects the specified module, builds the internal\ndocumentation model, and renders Markdown documentation files for\nuse with MkDocs.\n\nArgs:\n module: Python module import path used as the entry point for\n documentation generation.\n docs_dir: Directory where the generated Markdown files will be written.\n project_name: Optional override for the project name used in\n documentation metadata.\n module_is_source: If True, treat the specified module directory as\n the project root rather than a nested module."
},
"generate_config": {
"name": "generate_config",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.generate_config",
"signature": "<bound method Function.signature of Function('generate_config', 50, 100)>",
"docstring": "Generate an ``mkdocs.yml`` configuration file.\n\nThe configuration is created by combining a template configuration\nwith a navigation structure derived from the docforge navigation\nspecification.\n\nArgs:\n docs_dir: Directory containing generated documentation Markdown files.\n nav_file: Path to the ``docforge.nav.yml`` navigation specification.\n template: Optional path to a custom MkDocs configuration template.\n If not provided, a built-in template will be used.\n out: Destination path where the generated ``mkdocs.yml`` file\n will be written.\n site_name: Display name for the generated documentation site.\n\nRaises:\n click.FileError: If the navigation specification or template\n file cannot be found."
},
"build": {
"name": "build",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.build",
"signature": "<bound method Function.signature of Function('build', 103, 122)>",
"docstring": "Build the MkDocs documentation site.\n\nThis function loads the MkDocs configuration and runs the MkDocs\nbuild command to generate the final static documentation site.\n\nArgs:\n mkdocs_yml: Path to the ``mkdocs.yml`` configuration file.\n\nRaises:\n click.ClickException: If the configuration file does not exist."
},
"serve": {
"name": "serve",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.serve",
"signature": "<bound method Function.signature of Function('serve', 125, 142)>",
"docstring": "Start an MkDocs development server with live reload.\n\nThe server watches documentation files and automatically reloads\nthe site when changes are detected.\n\nArgs:\n mkdocs_yml: Path to the ``mkdocs.yml`` configuration file.\n\nRaises:\n click.ClickException: If the configuration file does not exist."
}
}
}
}
}
}

View File

@@ -0,0 +1,23 @@
{
"module": "docforge.cli.main",
"content": {
"path": "docforge.cli.main",
"docstring": "Command-line entry point for the doc-forge CLI.\n\nThis module exposes the executable entry point that initializes the\nClick command group defined in ``docforge.cli.commands``.",
"objects": {
"cli": {
"name": "cli",
"kind": "attribute",
"path": "docforge.cli.main.cli",
"signature": "<bound method Alias.signature of Alias('cli', 'docforge.cli.commands.cli')>",
"docstring": null
},
"main": {
"name": "main",
"kind": "function",
"path": "docforge.cli.main.main",
"signature": "<bound method Function.signature of Function('main', 11, 19)>",
"docstring": "Run the doc-forge command-line interface.\n\nThis function initializes and executes the Click CLI application.\nIt is used as the console entry point when invoking ``doc-forge``\nfrom the command line."
}
}
}
}

View File

@@ -0,0 +1,120 @@
{
"module": "docforge.cli.mcp_utils",
"content": {
"path": "docforge.cli.mcp_utils",
"docstring": null,
"objects": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.cli.mcp_utils.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"click": {
"name": "click",
"kind": "alias",
"path": "docforge.cli.mcp_utils.click",
"signature": "<bound method Alias.signature of Alias('click', 'click')>",
"docstring": null
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.cli.mcp_utils.GriffeLoader",
"signature": "<bound method Alias.signature of Alias('GriffeLoader', 'docforge.loaders.GriffeLoader')>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.cli.mcp_utils.GriffeLoader.load_project",
"signature": "<bound method Alias.signature of Alias('load_project', 'docforge.loaders.griffe_loader.GriffeLoader.load_project')>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.cli.mcp_utils.GriffeLoader.load_module",
"signature": "<bound method Alias.signature of Alias('load_module', 'docforge.loaders.griffe_loader.GriffeLoader.load_module')>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
},
"discover_module_paths": {
"name": "discover_module_paths",
"kind": "function",
"path": "docforge.cli.mcp_utils.discover_module_paths",
"signature": "<bound method Alias.signature of Alias('discover_module_paths', 'docforge.loaders.discover_module_paths')>",
"docstring": "Discover Python modules within a package directory.\n\nThe function scans the filesystem for ``.py`` files inside the specified\npackage and converts them into dotted module import paths.\n\nDiscovery rules:\n\n- Directories containing ``__init__.py`` are treated as packages.\n- Each ``.py`` file is treated as a module.\n- Results are returned as dotted import paths.\n\nArgs:\n module_name: Top-level package name to discover modules from.\n project_root: Root directory used to resolve module paths. If not\n provided, the current working directory is used.\n\nReturns:\n A sorted list of unique dotted module import paths.\n\nRaises:\n FileNotFoundError: If the specified package directory does not exist."
},
"MCPRenderer": {
"name": "MCPRenderer",
"kind": "class",
"path": "docforge.cli.mcp_utils.MCPRenderer",
"signature": "<bound method Alias.signature of Alias('MCPRenderer', 'docforge.renderers.MCPRenderer')>",
"docstring": "Renderer that generates MCP-compatible documentation resources.\n\nThis renderer converts doc-forge project models into structured JSON\nresources suitable for consumption by systems implementing the Model\nContext Protocol (MCP).",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.cli.mcp_utils.MCPRenderer.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.renderers.mcp_renderer.MCPRenderer.name')>",
"docstring": null
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.mcp_utils.MCPRenderer.generate_sources",
"signature": "<bound method Alias.signature of Alias('generate_sources', 'docforge.renderers.mcp_renderer.MCPRenderer.generate_sources')>",
"docstring": "Generate MCP documentation resources for a project.\n\nThe renderer serializes each module into a JSON resource and produces\nsupporting metadata files such as ``nav.json`` and ``index.json``.\n\nArgs:\n project: Documentation project model to render.\n out_dir: Directory where MCP resources will be written."
}
}
},
"MCPServer": {
"name": "MCPServer",
"kind": "class",
"path": "docforge.cli.mcp_utils.MCPServer",
"signature": "<bound method Alias.signature of Alias('MCPServer', 'docforge.servers.MCPServer')>",
"docstring": "MCP server for serving a pre-generated documentation bundle.\n\nThe server exposes documentation resources and diagnostic tools through\nMCP endpoints backed by JSON files generated by the MCP renderer.",
"members": {
"mcp_root": {
"name": "mcp_root",
"kind": "attribute",
"path": "docforge.cli.mcp_utils.MCPServer.mcp_root",
"signature": "<bound method Alias.signature of Alias('mcp_root', 'docforge.servers.mcp_server.MCPServer.mcp_root')>",
"docstring": null
},
"app": {
"name": "app",
"kind": "attribute",
"path": "docforge.cli.mcp_utils.MCPServer.app",
"signature": "<bound method Alias.signature of Alias('app', 'docforge.servers.mcp_server.MCPServer.app')>",
"docstring": null
},
"run": {
"name": "run",
"kind": "function",
"path": "docforge.cli.mcp_utils.MCPServer.run",
"signature": "<bound method Alias.signature of Alias('run', 'docforge.servers.mcp_server.MCPServer.run')>",
"docstring": "Start the MCP server.\n\nArgs:\n transport: Transport mechanism used by the MCP server. Supported\n options include ``stdio``, ``sse``, and ``streamable-http``."
}
}
},
"generate_resources": {
"name": "generate_resources",
"kind": "function",
"path": "docforge.cli.mcp_utils.generate_resources",
"signature": "<bound method Function.signature of Function('generate_resources', 8, 29)>",
"docstring": "Generate MCP documentation resources from a Python module.\n\nThe function performs project introspection, builds the internal\ndocumentation model, and renders MCP-compatible JSON resources\nto the specified output directory.\n\nArgs:\n module: Python module import path used as the entry point for\n documentation generation.\n project_name: Optional override for the project name used in\n generated documentation metadata.\n out_dir: Directory where MCP resources (index.json, nav.json,\n and module data) will be written."
},
"serve": {
"name": "serve",
"kind": "function",
"path": "docforge.cli.mcp_utils.serve",
"signature": "<bound method Function.signature of Function('serve', 32, 66)>",
"docstring": "Start an MCP server for a pre-generated documentation bundle.\n\nThe server exposes documentation resources such as project metadata,\nnavigation structure, and module documentation through MCP endpoints.\n\nArgs:\n module: Python module import path used to identify the served\n documentation instance.\n mcp_root: Path to the directory containing the MCP documentation\n bundle (index.json, nav.json, and modules/).\n\nRaises:\n click.ClickException: If the MCP documentation bundle is missing\n required files or directories."
}
}
}
}

View File

@@ -0,0 +1,155 @@
{
"module": "docforge.cli.mkdocs_utils",
"content": {
"path": "docforge.cli.mkdocs_utils",
"docstring": null,
"objects": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.cli.mkdocs_utils.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"resources": {
"name": "resources",
"kind": "alias",
"path": "docforge.cli.mkdocs_utils.resources",
"signature": "<bound method Alias.signature of Alias('resources', 'importlib.resources')>",
"docstring": null
},
"click": {
"name": "click",
"kind": "alias",
"path": "docforge.cli.mkdocs_utils.click",
"signature": "<bound method Alias.signature of Alias('click', 'click')>",
"docstring": null
},
"yaml": {
"name": "yaml",
"kind": "alias",
"path": "docforge.cli.mkdocs_utils.yaml",
"signature": "<bound method Alias.signature of Alias('yaml', 'yaml')>",
"docstring": null
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.cli.mkdocs_utils.GriffeLoader",
"signature": "<bound method Alias.signature of Alias('GriffeLoader', 'docforge.loaders.GriffeLoader')>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.GriffeLoader.load_project",
"signature": "<bound method Alias.signature of Alias('load_project', 'docforge.loaders.griffe_loader.GriffeLoader.load_project')>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.GriffeLoader.load_module",
"signature": "<bound method Alias.signature of Alias('load_module', 'docforge.loaders.griffe_loader.GriffeLoader.load_module')>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
},
"discover_module_paths": {
"name": "discover_module_paths",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.discover_module_paths",
"signature": "<bound method Alias.signature of Alias('discover_module_paths', 'docforge.loaders.discover_module_paths')>",
"docstring": "Discover Python modules within a package directory.\n\nThe function scans the filesystem for ``.py`` files inside the specified\npackage and converts them into dotted module import paths.\n\nDiscovery rules:\n\n- Directories containing ``__init__.py`` are treated as packages.\n- Each ``.py`` file is treated as a module.\n- Results are returned as dotted import paths.\n\nArgs:\n module_name: Top-level package name to discover modules from.\n project_root: Root directory used to resolve module paths. If not\n provided, the current working directory is used.\n\nReturns:\n A sorted list of unique dotted module import paths.\n\nRaises:\n FileNotFoundError: If the specified package directory does not exist."
},
"MkDocsRenderer": {
"name": "MkDocsRenderer",
"kind": "class",
"path": "docforge.cli.mkdocs_utils.MkDocsRenderer",
"signature": "<bound method Alias.signature of Alias('MkDocsRenderer', 'docforge.renderers.MkDocsRenderer')>",
"docstring": "Renderer that produces Markdown documentation for MkDocs.\n\nGenerated pages use mkdocstrings directives to reference Python modules,\nallowing MkDocs to render API documentation dynamically.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.cli.mkdocs_utils.MkDocsRenderer.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.name')>",
"docstring": null
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.MkDocsRenderer.generate_sources",
"signature": "<bound method Alias.signature of Alias('generate_sources', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.generate_sources')>",
"docstring": "Generate Markdown documentation files for a project.\n\nThis method renders a documentation structure from the provided\nproject model and writes the resulting Markdown files to the\nspecified output directory.\n\nArgs:\n project: Project model containing modules to document.\n out_dir: Directory where generated Markdown files will be written.\n module_is_source: If True, treat the specified module as the\n documentation root rather than nesting it inside a folder."
},
"generate_readme": {
"name": "generate_readme",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.MkDocsRenderer.generate_readme",
"signature": "<bound method Alias.signature of Alias('generate_readme', 'docforge.renderers.mkdocs_renderer.MkDocsRenderer.generate_readme')>",
"docstring": "Generate a ``README.md`` file from the root module docstring.\n\nBehavior:\n\n- If ``module_is_source`` is True, ``README.md`` is written to the\n project root directory.\n- If False, README generation is currently not implemented.\n\nArgs:\n project: Project model containing documentation metadata.\n docs_dir: Directory containing generated documentation sources.\n module_is_source: Whether the module is treated as the project\n source root."
}
}
},
"load_nav_spec": {
"name": "load_nav_spec",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.load_nav_spec",
"signature": "<bound method Alias.signature of Alias('load_nav_spec', 'docforge.nav.load_nav_spec')>",
"docstring": "Load a navigation specification file.\n\nThis helper function reads a YAML navigation file and constructs a\ncorresponding ``NavSpec`` instance.\n\nArgs:\n path: Path to the navigation specification file.\n\nReturns:\n A ``NavSpec`` instance representing the parsed specification.\n\nRaises:\n FileNotFoundError: If the specification file does not exist.\n ValueError: If the YAML structure is invalid."
},
"resolve_nav": {
"name": "resolve_nav",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.resolve_nav",
"signature": "<bound method Alias.signature of Alias('resolve_nav', 'docforge.nav.resolve_nav')>",
"docstring": "Resolve a navigation specification against the filesystem.\n\nThe function expands glob patterns defined in a ``NavSpec`` and verifies\nthat referenced documentation files exist within the documentation root.\n\nArgs:\n spec: Navigation specification describing documentation layout.\n docs_root: Root directory containing documentation Markdown files.\n\nReturns:\n A ``ResolvedNav`` instance containing validated navigation paths.\n\nRaises:\n FileNotFoundError: If the documentation root does not exist or a\n navigation pattern does not match any files."
},
"MkDocsNavEmitter": {
"name": "MkDocsNavEmitter",
"kind": "class",
"path": "docforge.cli.mkdocs_utils.MkDocsNavEmitter",
"signature": "<bound method Alias.signature of Alias('MkDocsNavEmitter', 'docforge.nav.MkDocsNavEmitter')>",
"docstring": "Emit MkDocs navigation structures from resolved navigation data.\n\nThe emitter transforms a ``ResolvedNav`` object into the YAML-compatible\nlist structure expected by the MkDocs ``nav`` configuration field.",
"members": {
"emit": {
"name": "emit",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.MkDocsNavEmitter.emit",
"signature": "<bound method Alias.signature of Alias('emit', 'docforge.nav.mkdocs.MkDocsNavEmitter.emit')>",
"docstring": "Generate a navigation structure for ``mkdocs.yml``.\n\nArgs:\n nav: Resolved navigation data describing documentation groups\n and their associated Markdown files.\n\nReturns:\n A list of dictionaries representing the MkDocs navigation layout.\n Each dictionary maps a navigation label to a page or a list of\n pages."
}
}
},
"generate_sources": {
"name": "generate_sources",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.generate_sources",
"signature": "<bound method Function.signature of Function('generate_sources', 10, 47)>",
"docstring": "Generate MkDocs Markdown sources for a Python module.\n\nThis function introspects the specified module, builds the internal\ndocumentation model, and renders Markdown documentation files for\nuse with MkDocs.\n\nArgs:\n module: Python module import path used as the entry point for\n documentation generation.\n docs_dir: Directory where the generated Markdown files will be written.\n project_name: Optional override for the project name used in\n documentation metadata.\n module_is_source: If True, treat the specified module directory as\n the project root rather than a nested module."
},
"generate_config": {
"name": "generate_config",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.generate_config",
"signature": "<bound method Function.signature of Function('generate_config', 50, 100)>",
"docstring": "Generate an ``mkdocs.yml`` configuration file.\n\nThe configuration is created by combining a template configuration\nwith a navigation structure derived from the docforge navigation\nspecification.\n\nArgs:\n docs_dir: Directory containing generated documentation Markdown files.\n nav_file: Path to the ``docforge.nav.yml`` navigation specification.\n template: Optional path to a custom MkDocs configuration template.\n If not provided, a built-in template will be used.\n out: Destination path where the generated ``mkdocs.yml`` file\n will be written.\n site_name: Display name for the generated documentation site.\n\nRaises:\n click.FileError: If the navigation specification or template\n file cannot be found."
},
"build": {
"name": "build",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.build",
"signature": "<bound method Function.signature of Function('build', 103, 122)>",
"docstring": "Build the MkDocs documentation site.\n\nThis function loads the MkDocs configuration and runs the MkDocs\nbuild command to generate the final static documentation site.\n\nArgs:\n mkdocs_yml: Path to the ``mkdocs.yml`` configuration file.\n\nRaises:\n click.ClickException: If the configuration file does not exist."
},
"serve": {
"name": "serve",
"kind": "function",
"path": "docforge.cli.mkdocs_utils.serve",
"signature": "<bound method Function.signature of Function('serve', 125, 142)>",
"docstring": "Start an MkDocs development server with live reload.\n\nThe server watches documentation files and automatically reloads\nthe site when changes are detected.\n\nArgs:\n mkdocs_yml: Path to the ``mkdocs.yml`` configuration file.\n\nRaises:\n click.ClickException: If the configuration file does not exist."
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,276 @@
{
"module": "docforge.loaders.griffe_loader",
"content": {
"path": "docforge.loaders.griffe_loader",
"docstring": "Utilities for loading and introspecting Python modules using Griffe.\n\nThis module provides the ``GriffeLoader`` class and helper utilities used to\ndiscover Python modules, introspect their structure, and convert the results\ninto doc-forge documentation models.",
"objects": {
"logging": {
"name": "logging",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.logging",
"signature": "<bound method Alias.signature of Alias('logging', 'logging')>",
"docstring": null
},
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"List": {
"name": "List",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.List",
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
"docstring": null
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
},
"ModulesCollection": {
"name": "ModulesCollection",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.ModulesCollection",
"signature": "<bound method Alias.signature of Alias('ModulesCollection', 'griffe.ModulesCollection')>",
"docstring": null
},
"LinesCollection": {
"name": "LinesCollection",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.LinesCollection",
"signature": "<bound method Alias.signature of Alias('LinesCollection', 'griffe.LinesCollection')>",
"docstring": null
},
"Object": {
"name": "Object",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.Object",
"signature": "<bound method Alias.signature of Alias('Object', 'griffe.Object')>",
"docstring": null
},
"AliasResolutionError": {
"name": "AliasResolutionError",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.AliasResolutionError",
"signature": "<bound method Alias.signature of Alias('AliasResolutionError', 'griffe.AliasResolutionError')>",
"docstring": null
},
"Module": {
"name": "Module",
"kind": "class",
"path": "docforge.loaders.griffe_loader.Module",
"signature": "<bound method Alias.signature of Alias('Module', 'docforge.models.Module')>",
"docstring": "Representation of a documented Python module or package.\n\nA ``Module`` stores metadata about the module itself and maintains a\ncollection of top-level documentation objects discovered during\nintrospection.\n\nAttributes:\n path: Dotted import path of the module.\n docstring: Module-level documentation string, if present.\n members: Mapping of object names to their corresponding\n ``DocObject`` representations.",
"members": {
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.Module.path",
"signature": "<bound method Alias.signature of Alias('path', 'docforge.models.module.Module.path')>",
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.Module.docstring",
"signature": "<bound method Alias.signature of Alias('docstring', 'docforge.models.module.Module.docstring')>",
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.Module.members",
"signature": "<bound method Alias.signature of Alias('members', 'docforge.models.module.Module.members')>",
"docstring": null
},
"add_object": {
"name": "add_object",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Module.add_object",
"signature": "<bound method Alias.signature of Alias('add_object', 'docforge.models.module.Module.add_object')>",
"docstring": "Add a documented object to the module.\n\nArgs:\n obj: Documentation object to register as a top-level\n member of the module."
},
"get_object": {
"name": "get_object",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Module.get_object",
"signature": "<bound method Alias.signature of Alias('get_object', 'docforge.models.module.Module.get_object')>",
"docstring": "Retrieve a documented object by name.\n\nArgs:\n name: Name of the object to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If no object with the given name exists."
},
"get_all_objects": {
"name": "get_all_objects",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Module.get_all_objects",
"signature": "<bound method Alias.signature of Alias('get_all_objects', 'docforge.models.module.Module.get_all_objects')>",
"docstring": "Return all top-level documentation objects in the module.\n\nReturns:\n An iterable of ``DocObject`` instances representing the\n module's public members."
}
}
},
"Project": {
"name": "Project",
"kind": "class",
"path": "docforge.loaders.griffe_loader.Project",
"signature": "<bound method Alias.signature of Alias('Project', 'docforge.models.Project')>",
"docstring": "Representation of a documentation project.\n\nA ``Project`` serves as the root container for all modules discovered during\nintrospection. Each module is stored by its dotted import path.\n\nAttributes:\n name: Name of the project.\n modules: Mapping of module paths to ``Module`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.Project.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.models.project.Project.name')>",
"docstring": null
},
"modules": {
"name": "modules",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.Project.modules",
"signature": "<bound method Alias.signature of Alias('modules', 'docforge.models.project.Project.modules')>",
"docstring": null
},
"add_module": {
"name": "add_module",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Project.add_module",
"signature": "<bound method Alias.signature of Alias('add_module', 'docforge.models.project.Project.add_module')>",
"docstring": "Register a module in the project.\n\nArgs:\n module: Module instance to add to the project."
},
"get_module": {
"name": "get_module",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Project.get_module",
"signature": "<bound method Alias.signature of Alias('get_module', 'docforge.models.project.Project.get_module')>",
"docstring": "Retrieve a module by its dotted path.\n\nArgs:\n path: Fully qualified dotted module path (for example ``pkg.module``).\n\nReturns:\n The corresponding ``Module`` instance.\n\nRaises:\n KeyError: If the module does not exist in the project."
},
"get_all_modules": {
"name": "get_all_modules",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Project.get_all_modules",
"signature": "<bound method Alias.signature of Alias('get_all_modules', 'docforge.models.project.Project.get_all_modules')>",
"docstring": "Return all modules contained in the project.\n\nReturns:\n An iterable of ``Module`` instances."
},
"get_module_list": {
"name": "get_module_list",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Project.get_module_list",
"signature": "<bound method Alias.signature of Alias('get_module_list', 'docforge.models.project.Project.get_module_list')>",
"docstring": "Return the list of module import paths.\n\nReturns:\n A list containing the dotted paths of all modules in the project."
}
}
},
"DocObject": {
"name": "DocObject",
"kind": "class",
"path": "docforge.loaders.griffe_loader.DocObject",
"signature": "<bound method Alias.signature of Alias('DocObject', 'docforge.models.DocObject')>",
"docstring": "Representation of a documented Python object.\n\nA ``DocObject`` models a single Python entity discovered during\nintrospection. Objects may contain nested members, allowing the structure\nof modules, classes, and other containers to be represented recursively.\n\nAttributes:\n name: Local name of the object.\n kind: Type of object (for example ``class``, ``function``,\n ``method``, or ``attribute``).\n path: Fully qualified dotted path to the object.\n signature: Callable signature if the object represents a callable.\n docstring: Raw docstring text extracted from the source code.\n members: Mapping of member names to child ``DocObject`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.models.object.DocObject.name')>",
"docstring": null
},
"kind": {
"name": "kind",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.kind",
"signature": "<bound method Alias.signature of Alias('kind', 'docforge.models.object.DocObject.kind')>",
"docstring": null
},
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.path",
"signature": "<bound method Alias.signature of Alias('path', 'docforge.models.object.DocObject.path')>",
"docstring": null
},
"signature": {
"name": "signature",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.signature",
"signature": "<bound method Alias.signature of Alias('signature', 'docforge.models.object.DocObject.signature')>",
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.docstring",
"signature": "<bound method Alias.signature of Alias('docstring', 'docforge.models.object.DocObject.docstring')>",
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.members",
"signature": "<bound method Alias.signature of Alias('members', 'docforge.models.object.DocObject.members')>",
"docstring": null
},
"add_member": {
"name": "add_member",
"kind": "function",
"path": "docforge.loaders.griffe_loader.DocObject.add_member",
"signature": "<bound method Alias.signature of Alias('add_member', 'docforge.models.object.DocObject.add_member')>",
"docstring": "Add a child documentation object.\n\nThis is typically used when attaching methods to classes or\nnested objects to their parent containers.\n\nArgs:\n obj: Documentation object to add as a member."
},
"get_member": {
"name": "get_member",
"kind": "function",
"path": "docforge.loaders.griffe_loader.DocObject.get_member",
"signature": "<bound method Alias.signature of Alias('get_member', 'docforge.models.object.DocObject.get_member')>",
"docstring": "Retrieve a member object by name.\n\nArgs:\n name: Name of the member to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If the member does not exist."
},
"get_all_members": {
"name": "get_all_members",
"kind": "function",
"path": "docforge.loaders.griffe_loader.DocObject.get_all_members",
"signature": "<bound method Alias.signature of Alias('get_all_members', 'docforge.models.object.DocObject.get_all_members')>",
"docstring": "Return all child members of the object.\n\nReturns:\n An iterable of ``DocObject`` instances representing nested members."
}
}
},
"logger": {
"name": "logger",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.logger",
"signature": null,
"docstring": null
},
"discover_module_paths": {
"name": "discover_module_paths",
"kind": "function",
"path": "docforge.loaders.griffe_loader.discover_module_paths",
"signature": "<bound method Function.signature of Function('discover_module_paths', 26, 73)>",
"docstring": "Discover Python modules within a package directory.\n\nThe function scans the filesystem for ``.py`` files inside the specified\npackage and converts them into dotted module import paths.\n\nDiscovery rules:\n\n- Directories containing ``__init__.py`` are treated as packages.\n- Each ``.py`` file is treated as a module.\n- Results are returned as dotted import paths.\n\nArgs:\n module_name: Top-level package name to discover modules from.\n project_root: Root directory used to resolve module paths. If not\n provided, the current working directory is used.\n\nReturns:\n A sorted list of unique dotted module import paths.\n\nRaises:\n FileNotFoundError: If the specified package directory does not exist."
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.loaders.griffe_loader.GriffeLoader",
"signature": "<bound method Class.signature of Class('GriffeLoader', 76, 264)>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.loaders.griffe_loader.GriffeLoader.load_project",
"signature": "<bound method Function.signature of Function('load_project', 97, 144)>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.loaders.griffe_loader.GriffeLoader.load_module",
"signature": "<bound method Function.signature of Function('load_module', 146, 162)>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
}
}
}
}

View File

@@ -0,0 +1,315 @@
{
"module": "docforge.loaders",
"content": {
"path": "docforge.loaders",
"docstring": "Loader layer for doc-forge.\n\nThe ``docforge.loaders`` package is responsible for discovering Python modules\nand extracting documentation data using static analysis.\n\n---\n\nOverview\n--------\n\nThis layer converts Python source code into an intermediate documentation\nmodel used by doc-forge. It performs module discovery, introspection, and\ninitial filtering before the data is passed to the core documentation models.\n\nCore capabilities include:\n\n- **Module discovery** Locate Python modules and packages within a project.\n- **Static introspection** Parse docstrings, signatures, and object\n hierarchies using the ``griffe`` library without executing the code.\n- **Public API filtering** Exclude private members (names prefixed with\n ``_``) to produce clean public documentation structures.\n\n---",
"objects": {
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.loaders.GriffeLoader",
"signature": "<bound method Alias.signature of Alias('GriffeLoader', 'docforge.loaders.griffe_loader.GriffeLoader')>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.loaders.GriffeLoader.load_project",
"signature": "<bound method Alias.signature of Alias('load_project', 'docforge.loaders.griffe_loader.GriffeLoader.load_project')>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.loaders.GriffeLoader.load_module",
"signature": "<bound method Alias.signature of Alias('load_module', 'docforge.loaders.griffe_loader.GriffeLoader.load_module')>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
},
"discover_module_paths": {
"name": "discover_module_paths",
"kind": "function",
"path": "docforge.loaders.discover_module_paths",
"signature": "<bound method Alias.signature of Alias('discover_module_paths', 'docforge.loaders.griffe_loader.discover_module_paths')>",
"docstring": "Discover Python modules within a package directory.\n\nThe function scans the filesystem for ``.py`` files inside the specified\npackage and converts them into dotted module import paths.\n\nDiscovery rules:\n\n- Directories containing ``__init__.py`` are treated as packages.\n- Each ``.py`` file is treated as a module.\n- Results are returned as dotted import paths.\n\nArgs:\n module_name: Top-level package name to discover modules from.\n project_root: Root directory used to resolve module paths. If not\n provided, the current working directory is used.\n\nReturns:\n A sorted list of unique dotted module import paths.\n\nRaises:\n FileNotFoundError: If the specified package directory does not exist."
},
"griffe_loader": {
"name": "griffe_loader",
"kind": "module",
"path": "docforge.loaders.griffe_loader",
"signature": null,
"docstring": "Utilities for loading and introspecting Python modules using Griffe.\n\nThis module provides the ``GriffeLoader`` class and helper utilities used to\ndiscover Python modules, introspect their structure, and convert the results\ninto doc-forge documentation models.",
"members": {
"logging": {
"name": "logging",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.logging",
"signature": "<bound method Alias.signature of Alias('logging', 'logging')>",
"docstring": null
},
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"List": {
"name": "List",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.List",
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
"docstring": null
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
},
"ModulesCollection": {
"name": "ModulesCollection",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.ModulesCollection",
"signature": "<bound method Alias.signature of Alias('ModulesCollection', 'griffe.ModulesCollection')>",
"docstring": null
},
"LinesCollection": {
"name": "LinesCollection",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.LinesCollection",
"signature": "<bound method Alias.signature of Alias('LinesCollection', 'griffe.LinesCollection')>",
"docstring": null
},
"Object": {
"name": "Object",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.Object",
"signature": "<bound method Alias.signature of Alias('Object', 'griffe.Object')>",
"docstring": null
},
"AliasResolutionError": {
"name": "AliasResolutionError",
"kind": "alias",
"path": "docforge.loaders.griffe_loader.AliasResolutionError",
"signature": "<bound method Alias.signature of Alias('AliasResolutionError', 'griffe.AliasResolutionError')>",
"docstring": null
},
"Module": {
"name": "Module",
"kind": "class",
"path": "docforge.loaders.griffe_loader.Module",
"signature": "<bound method Alias.signature of Alias('Module', 'docforge.models.Module')>",
"docstring": "Representation of a documented Python module or package.\n\nA ``Module`` stores metadata about the module itself and maintains a\ncollection of top-level documentation objects discovered during\nintrospection.\n\nAttributes:\n path: Dotted import path of the module.\n docstring: Module-level documentation string, if present.\n members: Mapping of object names to their corresponding\n ``DocObject`` representations.",
"members": {
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.Module.path",
"signature": "<bound method Alias.signature of Alias('path', 'docforge.models.module.Module.path')>",
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.Module.docstring",
"signature": "<bound method Alias.signature of Alias('docstring', 'docforge.models.module.Module.docstring')>",
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.Module.members",
"signature": "<bound method Alias.signature of Alias('members', 'docforge.models.module.Module.members')>",
"docstring": null
},
"add_object": {
"name": "add_object",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Module.add_object",
"signature": "<bound method Alias.signature of Alias('add_object', 'docforge.models.module.Module.add_object')>",
"docstring": "Add a documented object to the module.\n\nArgs:\n obj: Documentation object to register as a top-level\n member of the module."
},
"get_object": {
"name": "get_object",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Module.get_object",
"signature": "<bound method Alias.signature of Alias('get_object', 'docforge.models.module.Module.get_object')>",
"docstring": "Retrieve a documented object by name.\n\nArgs:\n name: Name of the object to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If no object with the given name exists."
},
"get_all_objects": {
"name": "get_all_objects",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Module.get_all_objects",
"signature": "<bound method Alias.signature of Alias('get_all_objects', 'docforge.models.module.Module.get_all_objects')>",
"docstring": "Return all top-level documentation objects in the module.\n\nReturns:\n An iterable of ``DocObject`` instances representing the\n module's public members."
}
}
},
"Project": {
"name": "Project",
"kind": "class",
"path": "docforge.loaders.griffe_loader.Project",
"signature": "<bound method Alias.signature of Alias('Project', 'docforge.models.Project')>",
"docstring": "Representation of a documentation project.\n\nA ``Project`` serves as the root container for all modules discovered during\nintrospection. Each module is stored by its dotted import path.\n\nAttributes:\n name: Name of the project.\n modules: Mapping of module paths to ``Module`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.Project.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.models.project.Project.name')>",
"docstring": null
},
"modules": {
"name": "modules",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.Project.modules",
"signature": "<bound method Alias.signature of Alias('modules', 'docforge.models.project.Project.modules')>",
"docstring": null
},
"add_module": {
"name": "add_module",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Project.add_module",
"signature": "<bound method Alias.signature of Alias('add_module', 'docforge.models.project.Project.add_module')>",
"docstring": "Register a module in the project.\n\nArgs:\n module: Module instance to add to the project."
},
"get_module": {
"name": "get_module",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Project.get_module",
"signature": "<bound method Alias.signature of Alias('get_module', 'docforge.models.project.Project.get_module')>",
"docstring": "Retrieve a module by its dotted path.\n\nArgs:\n path: Fully qualified dotted module path (for example ``pkg.module``).\n\nReturns:\n The corresponding ``Module`` instance.\n\nRaises:\n KeyError: If the module does not exist in the project."
},
"get_all_modules": {
"name": "get_all_modules",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Project.get_all_modules",
"signature": "<bound method Alias.signature of Alias('get_all_modules', 'docforge.models.project.Project.get_all_modules')>",
"docstring": "Return all modules contained in the project.\n\nReturns:\n An iterable of ``Module`` instances."
},
"get_module_list": {
"name": "get_module_list",
"kind": "function",
"path": "docforge.loaders.griffe_loader.Project.get_module_list",
"signature": "<bound method Alias.signature of Alias('get_module_list', 'docforge.models.project.Project.get_module_list')>",
"docstring": "Return the list of module import paths.\n\nReturns:\n A list containing the dotted paths of all modules in the project."
}
}
},
"DocObject": {
"name": "DocObject",
"kind": "class",
"path": "docforge.loaders.griffe_loader.DocObject",
"signature": "<bound method Alias.signature of Alias('DocObject', 'docforge.models.DocObject')>",
"docstring": "Representation of a documented Python object.\n\nA ``DocObject`` models a single Python entity discovered during\nintrospection. Objects may contain nested members, allowing the structure\nof modules, classes, and other containers to be represented recursively.\n\nAttributes:\n name: Local name of the object.\n kind: Type of object (for example ``class``, ``function``,\n ``method``, or ``attribute``).\n path: Fully qualified dotted path to the object.\n signature: Callable signature if the object represents a callable.\n docstring: Raw docstring text extracted from the source code.\n members: Mapping of member names to child ``DocObject`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.models.object.DocObject.name')>",
"docstring": null
},
"kind": {
"name": "kind",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.kind",
"signature": "<bound method Alias.signature of Alias('kind', 'docforge.models.object.DocObject.kind')>",
"docstring": null
},
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.path",
"signature": "<bound method Alias.signature of Alias('path', 'docforge.models.object.DocObject.path')>",
"docstring": null
},
"signature": {
"name": "signature",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.signature",
"signature": "<bound method Alias.signature of Alias('signature', 'docforge.models.object.DocObject.signature')>",
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.docstring",
"signature": "<bound method Alias.signature of Alias('docstring', 'docforge.models.object.DocObject.docstring')>",
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.DocObject.members",
"signature": "<bound method Alias.signature of Alias('members', 'docforge.models.object.DocObject.members')>",
"docstring": null
},
"add_member": {
"name": "add_member",
"kind": "function",
"path": "docforge.loaders.griffe_loader.DocObject.add_member",
"signature": "<bound method Alias.signature of Alias('add_member', 'docforge.models.object.DocObject.add_member')>",
"docstring": "Add a child documentation object.\n\nThis is typically used when attaching methods to classes or\nnested objects to their parent containers.\n\nArgs:\n obj: Documentation object to add as a member."
},
"get_member": {
"name": "get_member",
"kind": "function",
"path": "docforge.loaders.griffe_loader.DocObject.get_member",
"signature": "<bound method Alias.signature of Alias('get_member', 'docforge.models.object.DocObject.get_member')>",
"docstring": "Retrieve a member object by name.\n\nArgs:\n name: Name of the member to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If the member does not exist."
},
"get_all_members": {
"name": "get_all_members",
"kind": "function",
"path": "docforge.loaders.griffe_loader.DocObject.get_all_members",
"signature": "<bound method Alias.signature of Alias('get_all_members', 'docforge.models.object.DocObject.get_all_members')>",
"docstring": "Return all child members of the object.\n\nReturns:\n An iterable of ``DocObject`` instances representing nested members."
}
}
},
"logger": {
"name": "logger",
"kind": "attribute",
"path": "docforge.loaders.griffe_loader.logger",
"signature": null,
"docstring": null
},
"discover_module_paths": {
"name": "discover_module_paths",
"kind": "function",
"path": "docforge.loaders.griffe_loader.discover_module_paths",
"signature": "<bound method Function.signature of Function('discover_module_paths', 26, 73)>",
"docstring": "Discover Python modules within a package directory.\n\nThe function scans the filesystem for ``.py`` files inside the specified\npackage and converts them into dotted module import paths.\n\nDiscovery rules:\n\n- Directories containing ``__init__.py`` are treated as packages.\n- Each ``.py`` file is treated as a module.\n- Results are returned as dotted import paths.\n\nArgs:\n module_name: Top-level package name to discover modules from.\n project_root: Root directory used to resolve module paths. If not\n provided, the current working directory is used.\n\nReturns:\n A sorted list of unique dotted module import paths.\n\nRaises:\n FileNotFoundError: If the specified package directory does not exist."
},
"GriffeLoader": {
"name": "GriffeLoader",
"kind": "class",
"path": "docforge.loaders.griffe_loader.GriffeLoader",
"signature": "<bound method Class.signature of Class('GriffeLoader', 76, 264)>",
"docstring": "Load Python modules using Griffe and convert them into doc-forge models.\n\nThis loader uses the Griffe introspection engine to analyze Python source\ncode and transform the extracted information into ``Project``, ``Module``,\nand ``DocObject`` instances used by doc-forge.",
"members": {
"load_project": {
"name": "load_project",
"kind": "function",
"path": "docforge.loaders.griffe_loader.GriffeLoader.load_project",
"signature": "<bound method Function.signature of Function('load_project', 97, 144)>",
"docstring": "Load multiple modules and assemble them into a Project model.\n\nEach module path is introspected and converted into a ``Module``\ninstance. All modules are then aggregated into a single ``Project``\nobject.\n\nArgs:\n module_paths: List of dotted module import paths to load.\n project_name: Optional override for the project name. Defaults\n to the top-level name of the first module.\n skip_import_errors: If True, modules that fail to load will be\n skipped instead of raising an error.\n\nReturns:\n A populated ``Project`` instance containing the loaded modules.\n\nRaises:\n ValueError: If no module paths are provided.\n ImportError: If a module fails to load and\n ``skip_import_errors`` is False."
},
"load_module": {
"name": "load_module",
"kind": "function",
"path": "docforge.loaders.griffe_loader.GriffeLoader.load_module",
"signature": "<bound method Function.signature of Function('load_module', 146, 162)>",
"docstring": "Load and convert a single Python module.\n\nThe module is introspected using Griffe and then transformed into\na doc-forge ``Module`` model.\n\nArgs:\n path: Dotted import path of the module.\n\nReturns:\n A populated ``Module`` instance."
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,563 @@
{
"module": "docforge.models",
"content": {
"path": "docforge.models",
"docstring": "Model layer for doc-forge.\n\nThe ``docforge.models`` package defines the core data structures used to\nrepresent Python source code as a structured documentation model.\n\n---\n\nOverview\n--------\n\nThe model layer forms the central intermediate representation used throughout\ndoc-forge. Python modules and objects discovered during introspection are\nconverted into a hierarchy of documentation models that can later be rendered\ninto different documentation formats.\n\nKey components:\n\n- **Project** Root container representing an entire documented codebase.\n- **Module** Representation of a Python module or package containing\n documented members.\n- **DocObject** Recursive structure representing Python objects such as\n classes, functions, methods, and attributes.\n\nThese models are intentionally **renderer-agnostic**, allowing the same\ndocumentation structure to be transformed into multiple output formats\n(e.g., MkDocs, MCP, or other renderers).\n\n---",
"objects": {
"Project": {
"name": "Project",
"kind": "class",
"path": "docforge.models.Project",
"signature": "<bound method Alias.signature of Alias('Project', 'docforge.models.project.Project')>",
"docstring": "Representation of a documentation project.\n\nA ``Project`` serves as the root container for all modules discovered during\nintrospection. Each module is stored by its dotted import path.\n\nAttributes:\n name: Name of the project.\n modules: Mapping of module paths to ``Module`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.models.Project.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.models.project.Project.name')>",
"docstring": null
},
"modules": {
"name": "modules",
"kind": "attribute",
"path": "docforge.models.Project.modules",
"signature": "<bound method Alias.signature of Alias('modules', 'docforge.models.project.Project.modules')>",
"docstring": null
},
"add_module": {
"name": "add_module",
"kind": "function",
"path": "docforge.models.Project.add_module",
"signature": "<bound method Alias.signature of Alias('add_module', 'docforge.models.project.Project.add_module')>",
"docstring": "Register a module in the project.\n\nArgs:\n module: Module instance to add to the project."
},
"get_module": {
"name": "get_module",
"kind": "function",
"path": "docforge.models.Project.get_module",
"signature": "<bound method Alias.signature of Alias('get_module', 'docforge.models.project.Project.get_module')>",
"docstring": "Retrieve a module by its dotted path.\n\nArgs:\n path: Fully qualified dotted module path (for example ``pkg.module``).\n\nReturns:\n The corresponding ``Module`` instance.\n\nRaises:\n KeyError: If the module does not exist in the project."
},
"get_all_modules": {
"name": "get_all_modules",
"kind": "function",
"path": "docforge.models.Project.get_all_modules",
"signature": "<bound method Alias.signature of Alias('get_all_modules', 'docforge.models.project.Project.get_all_modules')>",
"docstring": "Return all modules contained in the project.\n\nReturns:\n An iterable of ``Module`` instances."
},
"get_module_list": {
"name": "get_module_list",
"kind": "function",
"path": "docforge.models.Project.get_module_list",
"signature": "<bound method Alias.signature of Alias('get_module_list', 'docforge.models.project.Project.get_module_list')>",
"docstring": "Return the list of module import paths.\n\nReturns:\n A list containing the dotted paths of all modules in the project."
}
}
},
"Module": {
"name": "Module",
"kind": "class",
"path": "docforge.models.Module",
"signature": "<bound method Alias.signature of Alias('Module', 'docforge.models.module.Module')>",
"docstring": "Representation of a documented Python module or package.\n\nA ``Module`` stores metadata about the module itself and maintains a\ncollection of top-level documentation objects discovered during\nintrospection.\n\nAttributes:\n path: Dotted import path of the module.\n docstring: Module-level documentation string, if present.\n members: Mapping of object names to their corresponding\n ``DocObject`` representations.",
"members": {
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.models.Module.path",
"signature": "<bound method Alias.signature of Alias('path', 'docforge.models.module.Module.path')>",
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.models.Module.docstring",
"signature": "<bound method Alias.signature of Alias('docstring', 'docforge.models.module.Module.docstring')>",
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.models.Module.members",
"signature": "<bound method Alias.signature of Alias('members', 'docforge.models.module.Module.members')>",
"docstring": null
},
"add_object": {
"name": "add_object",
"kind": "function",
"path": "docforge.models.Module.add_object",
"signature": "<bound method Alias.signature of Alias('add_object', 'docforge.models.module.Module.add_object')>",
"docstring": "Add a documented object to the module.\n\nArgs:\n obj: Documentation object to register as a top-level\n member of the module."
},
"get_object": {
"name": "get_object",
"kind": "function",
"path": "docforge.models.Module.get_object",
"signature": "<bound method Alias.signature of Alias('get_object', 'docforge.models.module.Module.get_object')>",
"docstring": "Retrieve a documented object by name.\n\nArgs:\n name: Name of the object to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If no object with the given name exists."
},
"get_all_objects": {
"name": "get_all_objects",
"kind": "function",
"path": "docforge.models.Module.get_all_objects",
"signature": "<bound method Alias.signature of Alias('get_all_objects', 'docforge.models.module.Module.get_all_objects')>",
"docstring": "Return all top-level documentation objects in the module.\n\nReturns:\n An iterable of ``DocObject`` instances representing the\n module's public members."
}
}
},
"DocObject": {
"name": "DocObject",
"kind": "class",
"path": "docforge.models.DocObject",
"signature": "<bound method Alias.signature of Alias('DocObject', 'docforge.models.object.DocObject')>",
"docstring": "Representation of a documented Python object.\n\nA ``DocObject`` models a single Python entity discovered during\nintrospection. Objects may contain nested members, allowing the structure\nof modules, classes, and other containers to be represented recursively.\n\nAttributes:\n name: Local name of the object.\n kind: Type of object (for example ``class``, ``function``,\n ``method``, or ``attribute``).\n path: Fully qualified dotted path to the object.\n signature: Callable signature if the object represents a callable.\n docstring: Raw docstring text extracted from the source code.\n members: Mapping of member names to child ``DocObject`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.models.DocObject.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.models.object.DocObject.name')>",
"docstring": null
},
"kind": {
"name": "kind",
"kind": "attribute",
"path": "docforge.models.DocObject.kind",
"signature": "<bound method Alias.signature of Alias('kind', 'docforge.models.object.DocObject.kind')>",
"docstring": null
},
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.models.DocObject.path",
"signature": "<bound method Alias.signature of Alias('path', 'docforge.models.object.DocObject.path')>",
"docstring": null
},
"signature": {
"name": "signature",
"kind": "attribute",
"path": "docforge.models.DocObject.signature",
"signature": "<bound method Alias.signature of Alias('signature', 'docforge.models.object.DocObject.signature')>",
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.models.DocObject.docstring",
"signature": "<bound method Alias.signature of Alias('docstring', 'docforge.models.object.DocObject.docstring')>",
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.models.DocObject.members",
"signature": "<bound method Alias.signature of Alias('members', 'docforge.models.object.DocObject.members')>",
"docstring": null
},
"add_member": {
"name": "add_member",
"kind": "function",
"path": "docforge.models.DocObject.add_member",
"signature": "<bound method Alias.signature of Alias('add_member', 'docforge.models.object.DocObject.add_member')>",
"docstring": "Add a child documentation object.\n\nThis is typically used when attaching methods to classes or\nnested objects to their parent containers.\n\nArgs:\n obj: Documentation object to add as a member."
},
"get_member": {
"name": "get_member",
"kind": "function",
"path": "docforge.models.DocObject.get_member",
"signature": "<bound method Alias.signature of Alias('get_member', 'docforge.models.object.DocObject.get_member')>",
"docstring": "Retrieve a member object by name.\n\nArgs:\n name: Name of the member to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If the member does not exist."
},
"get_all_members": {
"name": "get_all_members",
"kind": "function",
"path": "docforge.models.DocObject.get_all_members",
"signature": "<bound method Alias.signature of Alias('get_all_members', 'docforge.models.object.DocObject.get_all_members')>",
"docstring": "Return all child members of the object.\n\nReturns:\n An iterable of ``DocObject`` instances representing nested members."
}
}
},
"module": {
"name": "module",
"kind": "module",
"path": "docforge.models.module",
"signature": null,
"docstring": "Documentation model representing a Python module or package.\n\nThis module defines the ``Module`` class used in the doc-forge documentation\nmodel. A ``Module`` acts as a container for top-level documented objects\n(classes, functions, variables, and other members) discovered during\nintrospection.",
"members": {
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "docforge.models.module.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"Iterable": {
"name": "Iterable",
"kind": "alias",
"path": "docforge.models.module.Iterable",
"signature": "<bound method Alias.signature of Alias('Iterable', 'typing.Iterable')>",
"docstring": null
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "docforge.models.module.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
},
"DocObject": {
"name": "DocObject",
"kind": "class",
"path": "docforge.models.module.DocObject",
"signature": "<bound method Alias.signature of Alias('DocObject', 'docforge.models.object.DocObject')>",
"docstring": "Representation of a documented Python object.\n\nA ``DocObject`` models a single Python entity discovered during\nintrospection. Objects may contain nested members, allowing the structure\nof modules, classes, and other containers to be represented recursively.\n\nAttributes:\n name: Local name of the object.\n kind: Type of object (for example ``class``, ``function``,\n ``method``, or ``attribute``).\n path: Fully qualified dotted path to the object.\n signature: Callable signature if the object represents a callable.\n docstring: Raw docstring text extracted from the source code.\n members: Mapping of member names to child ``DocObject`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.models.module.DocObject.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.models.object.DocObject.name')>",
"docstring": null
},
"kind": {
"name": "kind",
"kind": "attribute",
"path": "docforge.models.module.DocObject.kind",
"signature": "<bound method Alias.signature of Alias('kind', 'docforge.models.object.DocObject.kind')>",
"docstring": null
},
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.models.module.DocObject.path",
"signature": "<bound method Alias.signature of Alias('path', 'docforge.models.object.DocObject.path')>",
"docstring": null
},
"signature": {
"name": "signature",
"kind": "attribute",
"path": "docforge.models.module.DocObject.signature",
"signature": "<bound method Alias.signature of Alias('signature', 'docforge.models.object.DocObject.signature')>",
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.models.module.DocObject.docstring",
"signature": "<bound method Alias.signature of Alias('docstring', 'docforge.models.object.DocObject.docstring')>",
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.models.module.DocObject.members",
"signature": "<bound method Alias.signature of Alias('members', 'docforge.models.object.DocObject.members')>",
"docstring": null
},
"add_member": {
"name": "add_member",
"kind": "function",
"path": "docforge.models.module.DocObject.add_member",
"signature": "<bound method Alias.signature of Alias('add_member', 'docforge.models.object.DocObject.add_member')>",
"docstring": "Add a child documentation object.\n\nThis is typically used when attaching methods to classes or\nnested objects to their parent containers.\n\nArgs:\n obj: Documentation object to add as a member."
},
"get_member": {
"name": "get_member",
"kind": "function",
"path": "docforge.models.module.DocObject.get_member",
"signature": "<bound method Alias.signature of Alias('get_member', 'docforge.models.object.DocObject.get_member')>",
"docstring": "Retrieve a member object by name.\n\nArgs:\n name: Name of the member to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If the member does not exist."
},
"get_all_members": {
"name": "get_all_members",
"kind": "function",
"path": "docforge.models.module.DocObject.get_all_members",
"signature": "<bound method Alias.signature of Alias('get_all_members', 'docforge.models.object.DocObject.get_all_members')>",
"docstring": "Return all child members of the object.\n\nReturns:\n An iterable of ``DocObject`` instances representing nested members."
}
}
},
"Module": {
"name": "Module",
"kind": "class",
"path": "docforge.models.module.Module",
"signature": "<bound method Class.signature of Class('Module', 15, 79)>",
"docstring": "Representation of a documented Python module or package.\n\nA ``Module`` stores metadata about the module itself and maintains a\ncollection of top-level documentation objects discovered during\nintrospection.\n\nAttributes:\n path: Dotted import path of the module.\n docstring: Module-level documentation string, if present.\n members: Mapping of object names to their corresponding\n ``DocObject`` representations.",
"members": {
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.models.module.Module.path",
"signature": null,
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.models.module.Module.docstring",
"signature": null,
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.models.module.Module.members",
"signature": null,
"docstring": null
},
"add_object": {
"name": "add_object",
"kind": "function",
"path": "docforge.models.module.Module.add_object",
"signature": "<bound method Function.signature of Function('add_object', 46, 54)>",
"docstring": "Add a documented object to the module.\n\nArgs:\n obj: Documentation object to register as a top-level\n member of the module."
},
"get_object": {
"name": "get_object",
"kind": "function",
"path": "docforge.models.module.Module.get_object",
"signature": "<bound method Function.signature of Function('get_object', 56, 69)>",
"docstring": "Retrieve a documented object by name.\n\nArgs:\n name: Name of the object to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If no object with the given name exists."
},
"get_all_objects": {
"name": "get_all_objects",
"kind": "function",
"path": "docforge.models.module.Module.get_all_objects",
"signature": "<bound method Function.signature of Function('get_all_objects', 71, 79)>",
"docstring": "Return all top-level documentation objects in the module.\n\nReturns:\n An iterable of ``DocObject`` instances representing the\n module's public members."
}
}
}
}
},
"object": {
"name": "object",
"kind": "module",
"path": "docforge.models.object",
"signature": null,
"docstring": "Documentation model representing individual Python objects.\n\nThis module defines the ``DocObject`` class, the fundamental recursive unit of\nthe doc-forge documentation model. Each ``DocObject`` represents a Python\nentity such as a class, function, method, or attribute, and may contain nested\nmembers that form a hierarchical documentation structure.",
"members": {
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "docforge.models.object.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"Iterable": {
"name": "Iterable",
"kind": "alias",
"path": "docforge.models.object.Iterable",
"signature": "<bound method Alias.signature of Alias('Iterable', 'typing.Iterable')>",
"docstring": null
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "docforge.models.object.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
},
"DocObject": {
"name": "DocObject",
"kind": "class",
"path": "docforge.models.object.DocObject",
"signature": "<bound method Class.signature of Class('DocObject', 13, 90)>",
"docstring": "Representation of a documented Python object.\n\nA ``DocObject`` models a single Python entity discovered during\nintrospection. Objects may contain nested members, allowing the structure\nof modules, classes, and other containers to be represented recursively.\n\nAttributes:\n name: Local name of the object.\n kind: Type of object (for example ``class``, ``function``,\n ``method``, or ``attribute``).\n path: Fully qualified dotted path to the object.\n signature: Callable signature if the object represents a callable.\n docstring: Raw docstring text extracted from the source code.\n members: Mapping of member names to child ``DocObject`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.models.object.DocObject.name",
"signature": null,
"docstring": null
},
"kind": {
"name": "kind",
"kind": "attribute",
"path": "docforge.models.object.DocObject.kind",
"signature": null,
"docstring": null
},
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.models.object.DocObject.path",
"signature": null,
"docstring": null
},
"signature": {
"name": "signature",
"kind": "attribute",
"path": "docforge.models.object.DocObject.signature",
"signature": null,
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.models.object.DocObject.docstring",
"signature": null,
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.models.object.DocObject.members",
"signature": null,
"docstring": null
},
"add_member": {
"name": "add_member",
"kind": "function",
"path": "docforge.models.object.DocObject.add_member",
"signature": "<bound method Function.signature of Function('add_member', 56, 66)>",
"docstring": "Add a child documentation object.\n\nThis is typically used when attaching methods to classes or\nnested objects to their parent containers.\n\nArgs:\n obj: Documentation object to add as a member."
},
"get_member": {
"name": "get_member",
"kind": "function",
"path": "docforge.models.object.DocObject.get_member",
"signature": "<bound method Function.signature of Function('get_member', 68, 81)>",
"docstring": "Retrieve a member object by name.\n\nArgs:\n name: Name of the member to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If the member does not exist."
},
"get_all_members": {
"name": "get_all_members",
"kind": "function",
"path": "docforge.models.object.DocObject.get_all_members",
"signature": "<bound method Function.signature of Function('get_all_members', 83, 90)>",
"docstring": "Return all child members of the object.\n\nReturns:\n An iterable of ``DocObject`` instances representing nested members."
}
}
}
}
},
"project": {
"name": "project",
"kind": "module",
"path": "docforge.models.project",
"signature": null,
"docstring": "Documentation model representing a project.\n\nThis module defines the ``Project`` class, the top-level container used by\ndoc-forge to represent a documented codebase. A ``Project`` aggregates multiple\nmodules and provides access to them through a unified interface.",
"members": {
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "docforge.models.project.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"Iterable": {
"name": "Iterable",
"kind": "alias",
"path": "docforge.models.project.Iterable",
"signature": "<bound method Alias.signature of Alias('Iterable', 'typing.Iterable')>",
"docstring": null
},
"Module": {
"name": "Module",
"kind": "class",
"path": "docforge.models.project.Module",
"signature": "<bound method Alias.signature of Alias('Module', 'docforge.models.module.Module')>",
"docstring": "Representation of a documented Python module or package.\n\nA ``Module`` stores metadata about the module itself and maintains a\ncollection of top-level documentation objects discovered during\nintrospection.\n\nAttributes:\n path: Dotted import path of the module.\n docstring: Module-level documentation string, if present.\n members: Mapping of object names to their corresponding\n ``DocObject`` representations.",
"members": {
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.models.project.Module.path",
"signature": "<bound method Alias.signature of Alias('path', 'docforge.models.module.Module.path')>",
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.models.project.Module.docstring",
"signature": "<bound method Alias.signature of Alias('docstring', 'docforge.models.module.Module.docstring')>",
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.models.project.Module.members",
"signature": "<bound method Alias.signature of Alias('members', 'docforge.models.module.Module.members')>",
"docstring": null
},
"add_object": {
"name": "add_object",
"kind": "function",
"path": "docforge.models.project.Module.add_object",
"signature": "<bound method Alias.signature of Alias('add_object', 'docforge.models.module.Module.add_object')>",
"docstring": "Add a documented object to the module.\n\nArgs:\n obj: Documentation object to register as a top-level\n member of the module."
},
"get_object": {
"name": "get_object",
"kind": "function",
"path": "docforge.models.project.Module.get_object",
"signature": "<bound method Alias.signature of Alias('get_object', 'docforge.models.module.Module.get_object')>",
"docstring": "Retrieve a documented object by name.\n\nArgs:\n name: Name of the object to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If no object with the given name exists."
},
"get_all_objects": {
"name": "get_all_objects",
"kind": "function",
"path": "docforge.models.project.Module.get_all_objects",
"signature": "<bound method Alias.signature of Alias('get_all_objects', 'docforge.models.module.Module.get_all_objects')>",
"docstring": "Return all top-level documentation objects in the module.\n\nReturns:\n An iterable of ``DocObject`` instances representing the\n module's public members."
}
}
},
"Project": {
"name": "Project",
"kind": "class",
"path": "docforge.models.project.Project",
"signature": "<bound method Class.signature of Class('Project', 14, 76)>",
"docstring": "Representation of a documentation project.\n\nA ``Project`` serves as the root container for all modules discovered during\nintrospection. Each module is stored by its dotted import path.\n\nAttributes:\n name: Name of the project.\n modules: Mapping of module paths to ``Module`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.models.project.Project.name",
"signature": null,
"docstring": null
},
"modules": {
"name": "modules",
"kind": "attribute",
"path": "docforge.models.project.Project.modules",
"signature": null,
"docstring": null
},
"add_module": {
"name": "add_module",
"kind": "function",
"path": "docforge.models.project.Project.add_module",
"signature": "<bound method Function.signature of Function('add_module', 36, 43)>",
"docstring": "Register a module in the project.\n\nArgs:\n module: Module instance to add to the project."
},
"get_module": {
"name": "get_module",
"kind": "function",
"path": "docforge.models.project.Project.get_module",
"signature": "<bound method Function.signature of Function('get_module', 45, 58)>",
"docstring": "Retrieve a module by its dotted path.\n\nArgs:\n path: Fully qualified dotted module path (for example ``pkg.module``).\n\nReturns:\n The corresponding ``Module`` instance.\n\nRaises:\n KeyError: If the module does not exist in the project."
},
"get_all_modules": {
"name": "get_all_modules",
"kind": "function",
"path": "docforge.models.project.Project.get_all_modules",
"signature": "<bound method Function.signature of Function('get_all_modules', 60, 67)>",
"docstring": "Return all modules contained in the project.\n\nReturns:\n An iterable of ``Module`` instances."
},
"get_module_list": {
"name": "get_module_list",
"kind": "function",
"path": "docforge.models.project.Project.get_module_list",
"signature": "<bound method Function.signature of Function('get_module_list', 69, 76)>",
"docstring": "Return the list of module import paths.\n\nReturns:\n A list containing the dotted paths of all modules in the project."
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,153 @@
{
"module": "docforge.models.module",
"content": {
"path": "docforge.models.module",
"docstring": "Documentation model representing a Python module or package.\n\nThis module defines the ``Module`` class used in the doc-forge documentation\nmodel. A ``Module`` acts as a container for top-level documented objects\n(classes, functions, variables, and other members) discovered during\nintrospection.",
"objects": {
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "docforge.models.module.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"Iterable": {
"name": "Iterable",
"kind": "alias",
"path": "docforge.models.module.Iterable",
"signature": "<bound method Alias.signature of Alias('Iterable', 'typing.Iterable')>",
"docstring": null
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "docforge.models.module.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
},
"DocObject": {
"name": "DocObject",
"kind": "class",
"path": "docforge.models.module.DocObject",
"signature": "<bound method Alias.signature of Alias('DocObject', 'docforge.models.object.DocObject')>",
"docstring": "Representation of a documented Python object.\n\nA ``DocObject`` models a single Python entity discovered during\nintrospection. Objects may contain nested members, allowing the structure\nof modules, classes, and other containers to be represented recursively.\n\nAttributes:\n name: Local name of the object.\n kind: Type of object (for example ``class``, ``function``,\n ``method``, or ``attribute``).\n path: Fully qualified dotted path to the object.\n signature: Callable signature if the object represents a callable.\n docstring: Raw docstring text extracted from the source code.\n members: Mapping of member names to child ``DocObject`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.models.module.DocObject.name",
"signature": "<bound method Alias.signature of Alias('name', 'docforge.models.object.DocObject.name')>",
"docstring": null
},
"kind": {
"name": "kind",
"kind": "attribute",
"path": "docforge.models.module.DocObject.kind",
"signature": "<bound method Alias.signature of Alias('kind', 'docforge.models.object.DocObject.kind')>",
"docstring": null
},
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.models.module.DocObject.path",
"signature": "<bound method Alias.signature of Alias('path', 'docforge.models.object.DocObject.path')>",
"docstring": null
},
"signature": {
"name": "signature",
"kind": "attribute",
"path": "docforge.models.module.DocObject.signature",
"signature": "<bound method Alias.signature of Alias('signature', 'docforge.models.object.DocObject.signature')>",
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.models.module.DocObject.docstring",
"signature": "<bound method Alias.signature of Alias('docstring', 'docforge.models.object.DocObject.docstring')>",
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.models.module.DocObject.members",
"signature": "<bound method Alias.signature of Alias('members', 'docforge.models.object.DocObject.members')>",
"docstring": null
},
"add_member": {
"name": "add_member",
"kind": "function",
"path": "docforge.models.module.DocObject.add_member",
"signature": "<bound method Alias.signature of Alias('add_member', 'docforge.models.object.DocObject.add_member')>",
"docstring": "Add a child documentation object.\n\nThis is typically used when attaching methods to classes or\nnested objects to their parent containers.\n\nArgs:\n obj: Documentation object to add as a member."
},
"get_member": {
"name": "get_member",
"kind": "function",
"path": "docforge.models.module.DocObject.get_member",
"signature": "<bound method Alias.signature of Alias('get_member', 'docforge.models.object.DocObject.get_member')>",
"docstring": "Retrieve a member object by name.\n\nArgs:\n name: Name of the member to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If the member does not exist."
},
"get_all_members": {
"name": "get_all_members",
"kind": "function",
"path": "docforge.models.module.DocObject.get_all_members",
"signature": "<bound method Alias.signature of Alias('get_all_members', 'docforge.models.object.DocObject.get_all_members')>",
"docstring": "Return all child members of the object.\n\nReturns:\n An iterable of ``DocObject`` instances representing nested members."
}
}
},
"Module": {
"name": "Module",
"kind": "class",
"path": "docforge.models.module.Module",
"signature": "<bound method Class.signature of Class('Module', 15, 79)>",
"docstring": "Representation of a documented Python module or package.\n\nA ``Module`` stores metadata about the module itself and maintains a\ncollection of top-level documentation objects discovered during\nintrospection.\n\nAttributes:\n path: Dotted import path of the module.\n docstring: Module-level documentation string, if present.\n members: Mapping of object names to their corresponding\n ``DocObject`` representations.",
"members": {
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.models.module.Module.path",
"signature": null,
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.models.module.Module.docstring",
"signature": null,
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.models.module.Module.members",
"signature": null,
"docstring": null
},
"add_object": {
"name": "add_object",
"kind": "function",
"path": "docforge.models.module.Module.add_object",
"signature": "<bound method Function.signature of Function('add_object', 46, 54)>",
"docstring": "Add a documented object to the module.\n\nArgs:\n obj: Documentation object to register as a top-level\n member of the module."
},
"get_object": {
"name": "get_object",
"kind": "function",
"path": "docforge.models.module.Module.get_object",
"signature": "<bound method Function.signature of Function('get_object', 56, 69)>",
"docstring": "Retrieve a documented object by name.\n\nArgs:\n name: Name of the object to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If no object with the given name exists."
},
"get_all_objects": {
"name": "get_all_objects",
"kind": "function",
"path": "docforge.models.module.Module.get_all_objects",
"signature": "<bound method Function.signature of Function('get_all_objects', 71, 79)>",
"docstring": "Return all top-level documentation objects in the module.\n\nReturns:\n An iterable of ``DocObject`` instances representing the\n module's public members."
}
}
}
}
}
}

View File

@@ -0,0 +1,102 @@
{
"module": "docforge.models.object",
"content": {
"path": "docforge.models.object",
"docstring": "Documentation model representing individual Python objects.\n\nThis module defines the ``DocObject`` class, the fundamental recursive unit of\nthe doc-forge documentation model. Each ``DocObject`` represents a Python\nentity such as a class, function, method, or attribute, and may contain nested\nmembers that form a hierarchical documentation structure.",
"objects": {
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "docforge.models.object.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"Iterable": {
"name": "Iterable",
"kind": "alias",
"path": "docforge.models.object.Iterable",
"signature": "<bound method Alias.signature of Alias('Iterable', 'typing.Iterable')>",
"docstring": null
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "docforge.models.object.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
},
"DocObject": {
"name": "DocObject",
"kind": "class",
"path": "docforge.models.object.DocObject",
"signature": "<bound method Class.signature of Class('DocObject', 13, 90)>",
"docstring": "Representation of a documented Python object.\n\nA ``DocObject`` models a single Python entity discovered during\nintrospection. Objects may contain nested members, allowing the structure\nof modules, classes, and other containers to be represented recursively.\n\nAttributes:\n name: Local name of the object.\n kind: Type of object (for example ``class``, ``function``,\n ``method``, or ``attribute``).\n path: Fully qualified dotted path to the object.\n signature: Callable signature if the object represents a callable.\n docstring: Raw docstring text extracted from the source code.\n members: Mapping of member names to child ``DocObject`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.models.object.DocObject.name",
"signature": null,
"docstring": null
},
"kind": {
"name": "kind",
"kind": "attribute",
"path": "docforge.models.object.DocObject.kind",
"signature": null,
"docstring": null
},
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.models.object.DocObject.path",
"signature": null,
"docstring": null
},
"signature": {
"name": "signature",
"kind": "attribute",
"path": "docforge.models.object.DocObject.signature",
"signature": null,
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.models.object.DocObject.docstring",
"signature": null,
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.models.object.DocObject.members",
"signature": null,
"docstring": null
},
"add_member": {
"name": "add_member",
"kind": "function",
"path": "docforge.models.object.DocObject.add_member",
"signature": "<bound method Function.signature of Function('add_member', 56, 66)>",
"docstring": "Add a child documentation object.\n\nThis is typically used when attaching methods to classes or\nnested objects to their parent containers.\n\nArgs:\n obj: Documentation object to add as a member."
},
"get_member": {
"name": "get_member",
"kind": "function",
"path": "docforge.models.object.DocObject.get_member",
"signature": "<bound method Function.signature of Function('get_member', 68, 81)>",
"docstring": "Retrieve a member object by name.\n\nArgs:\n name: Name of the member to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If the member does not exist."
},
"get_all_members": {
"name": "get_all_members",
"kind": "function",
"path": "docforge.models.object.DocObject.get_all_members",
"signature": "<bound method Function.signature of Function('get_all_members', 83, 90)>",
"docstring": "Return all child members of the object.\n\nReturns:\n An iterable of ``DocObject`` instances representing nested members."
}
}
}
}
}
}

View File

@@ -0,0 +1,125 @@
{
"module": "docforge.models.project",
"content": {
"path": "docforge.models.project",
"docstring": "Documentation model representing a project.\n\nThis module defines the ``Project`` class, the top-level container used by\ndoc-forge to represent a documented codebase. A ``Project`` aggregates multiple\nmodules and provides access to them through a unified interface.",
"objects": {
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "docforge.models.project.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"Iterable": {
"name": "Iterable",
"kind": "alias",
"path": "docforge.models.project.Iterable",
"signature": "<bound method Alias.signature of Alias('Iterable', 'typing.Iterable')>",
"docstring": null
},
"Module": {
"name": "Module",
"kind": "class",
"path": "docforge.models.project.Module",
"signature": "<bound method Alias.signature of Alias('Module', 'docforge.models.module.Module')>",
"docstring": "Representation of a documented Python module or package.\n\nA ``Module`` stores metadata about the module itself and maintains a\ncollection of top-level documentation objects discovered during\nintrospection.\n\nAttributes:\n path: Dotted import path of the module.\n docstring: Module-level documentation string, if present.\n members: Mapping of object names to their corresponding\n ``DocObject`` representations.",
"members": {
"path": {
"name": "path",
"kind": "attribute",
"path": "docforge.models.project.Module.path",
"signature": "<bound method Alias.signature of Alias('path', 'docforge.models.module.Module.path')>",
"docstring": null
},
"docstring": {
"name": "docstring",
"kind": "attribute",
"path": "docforge.models.project.Module.docstring",
"signature": "<bound method Alias.signature of Alias('docstring', 'docforge.models.module.Module.docstring')>",
"docstring": null
},
"members": {
"name": "members",
"kind": "attribute",
"path": "docforge.models.project.Module.members",
"signature": "<bound method Alias.signature of Alias('members', 'docforge.models.module.Module.members')>",
"docstring": null
},
"add_object": {
"name": "add_object",
"kind": "function",
"path": "docforge.models.project.Module.add_object",
"signature": "<bound method Alias.signature of Alias('add_object', 'docforge.models.module.Module.add_object')>",
"docstring": "Add a documented object to the module.\n\nArgs:\n obj: Documentation object to register as a top-level\n member of the module."
},
"get_object": {
"name": "get_object",
"kind": "function",
"path": "docforge.models.project.Module.get_object",
"signature": "<bound method Alias.signature of Alias('get_object', 'docforge.models.module.Module.get_object')>",
"docstring": "Retrieve a documented object by name.\n\nArgs:\n name: Name of the object to retrieve.\n\nReturns:\n The corresponding ``DocObject`` instance.\n\nRaises:\n KeyError: If no object with the given name exists."
},
"get_all_objects": {
"name": "get_all_objects",
"kind": "function",
"path": "docforge.models.project.Module.get_all_objects",
"signature": "<bound method Alias.signature of Alias('get_all_objects', 'docforge.models.module.Module.get_all_objects')>",
"docstring": "Return all top-level documentation objects in the module.\n\nReturns:\n An iterable of ``DocObject`` instances representing the\n module's public members."
}
}
},
"Project": {
"name": "Project",
"kind": "class",
"path": "docforge.models.project.Project",
"signature": "<bound method Class.signature of Class('Project', 14, 76)>",
"docstring": "Representation of a documentation project.\n\nA ``Project`` serves as the root container for all modules discovered during\nintrospection. Each module is stored by its dotted import path.\n\nAttributes:\n name: Name of the project.\n modules: Mapping of module paths to ``Module`` instances.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "docforge.models.project.Project.name",
"signature": null,
"docstring": null
},
"modules": {
"name": "modules",
"kind": "attribute",
"path": "docforge.models.project.Project.modules",
"signature": null,
"docstring": null
},
"add_module": {
"name": "add_module",
"kind": "function",
"path": "docforge.models.project.Project.add_module",
"signature": "<bound method Function.signature of Function('add_module', 36, 43)>",
"docstring": "Register a module in the project.\n\nArgs:\n module: Module instance to add to the project."
},
"get_module": {
"name": "get_module",
"kind": "function",
"path": "docforge.models.project.Project.get_module",
"signature": "<bound method Function.signature of Function('get_module', 45, 58)>",
"docstring": "Retrieve a module by its dotted path.\n\nArgs:\n path: Fully qualified dotted module path (for example ``pkg.module``).\n\nReturns:\n The corresponding ``Module`` instance.\n\nRaises:\n KeyError: If the module does not exist in the project."
},
"get_all_modules": {
"name": "get_all_modules",
"kind": "function",
"path": "docforge.models.project.Project.get_all_modules",
"signature": "<bound method Function.signature of Function('get_all_modules', 60, 67)>",
"docstring": "Return all modules contained in the project.\n\nReturns:\n An iterable of ``Module`` instances."
},
"get_module_list": {
"name": "get_module_list",
"kind": "function",
"path": "docforge.models.project.Project.get_module_list",
"signature": "<bound method Function.signature of Function('get_module_list', 69, 76)>",
"docstring": "Return the list of module import paths.\n\nReturns:\n A list containing the dotted paths of all modules in the project."
}
}
}
}
}
}

View File

@@ -0,0 +1,402 @@
{
"module": "docforge.nav",
"content": {
"path": "docforge.nav",
"docstring": "Navigation layer for doc-forge.\n\nThe ``docforge.nav`` package manages the relationship between the logical\ndocumentation structure defined by the user and the physical documentation\nfiles generated on disk.\n\n---\n\nWorkflow\n--------\n\n1. **Specification** Users define navigation intent in ``docforge.nav.yml``.\n2. **Resolution** ``resolve_nav`` expands patterns and matches them against\n generated Markdown files.\n3. **Emission** ``MkDocsNavEmitter`` converts the resolved structure into\n the YAML navigation format required by ``mkdocs.yml``.\n\nThis layer separates documentation organization from the underlying source\ncode layout, enabling flexible grouping, ordering, and navigation structures\nindependent of module hierarchy.\n\n---",
"objects": {
"NavSpec": {
"name": "NavSpec",
"kind": "class",
"path": "docforge.nav.NavSpec",
"signature": "<bound method Alias.signature of Alias('NavSpec', 'docforge.nav.spec.NavSpec')>",
"docstring": "Parsed representation of a navigation specification.\n\nA ``NavSpec`` describes the intended documentation navigation layout before\nit is resolved against the filesystem.\n\nAttributes:\n home: Relative path to the documentation home page (for example\n ``index.md``).\n groups: Mapping of navigation group titles to lists of file patterns\n or glob expressions.",
"members": {
"home": {
"name": "home",
"kind": "attribute",
"path": "docforge.nav.NavSpec.home",
"signature": "<bound method Alias.signature of Alias('home', 'docforge.nav.spec.NavSpec.home')>",
"docstring": null
},
"groups": {
"name": "groups",
"kind": "attribute",
"path": "docforge.nav.NavSpec.groups",
"signature": "<bound method Alias.signature of Alias('groups', 'docforge.nav.spec.NavSpec.groups')>",
"docstring": null
},
"load": {
"name": "load",
"kind": "function",
"path": "docforge.nav.NavSpec.load",
"signature": "<bound method Alias.signature of Alias('load', 'docforge.nav.spec.NavSpec.load')>",
"docstring": "Load a navigation specification from a YAML file.\n\nArgs:\n path: Filesystem path to the navigation specification file.\n\nReturns:\n A ``NavSpec`` instance representing the parsed configuration.\n\nRaises:\n FileNotFoundError: If the specified file does not exist.\n ValueError: If the file contents are not a valid navigation\n specification."
},
"all_patterns": {
"name": "all_patterns",
"kind": "function",
"path": "docforge.nav.NavSpec.all_patterns",
"signature": "<bound method Alias.signature of Alias('all_patterns', 'docforge.nav.spec.NavSpec.all_patterns')>",
"docstring": "Return all path patterns referenced by the specification.\n\nReturns:\n A list containing the home document (if defined) and all\n group pattern entries."
}
}
},
"load_nav_spec": {
"name": "load_nav_spec",
"kind": "function",
"path": "docforge.nav.load_nav_spec",
"signature": "<bound method Alias.signature of Alias('load_nav_spec', 'docforge.nav.spec.load_nav_spec')>",
"docstring": "Load a navigation specification file.\n\nThis helper function reads a YAML navigation file and constructs a\ncorresponding ``NavSpec`` instance.\n\nArgs:\n path: Path to the navigation specification file.\n\nReturns:\n A ``NavSpec`` instance representing the parsed specification.\n\nRaises:\n FileNotFoundError: If the specification file does not exist.\n ValueError: If the YAML structure is invalid."
},
"ResolvedNav": {
"name": "ResolvedNav",
"kind": "class",
"path": "docforge.nav.ResolvedNav",
"signature": "<bound method Alias.signature of Alias('ResolvedNav', 'docforge.nav.resolver.ResolvedNav')>",
"docstring": "Resolved navigation structure.\n\nA ``ResolvedNav`` represents navigation data after glob patterns have been\nexpanded and paths validated against the filesystem.\n\nAttributes:\n home: Relative path to the documentation home page.\n groups: Mapping of navigation group titles to lists of resolved\n documentation file paths.",
"members": {
"home": {
"name": "home",
"kind": "attribute",
"path": "docforge.nav.ResolvedNav.home",
"signature": "<bound method Alias.signature of Alias('home', 'docforge.nav.resolver.ResolvedNav.home')>",
"docstring": null
},
"groups": {
"name": "groups",
"kind": "attribute",
"path": "docforge.nav.ResolvedNav.groups",
"signature": "<bound method Alias.signature of Alias('groups', 'docforge.nav.resolver.ResolvedNav.groups')>",
"docstring": null
},
"all_files": {
"name": "all_files",
"kind": "function",
"path": "docforge.nav.ResolvedNav.all_files",
"signature": "<bound method Alias.signature of Alias('all_files', 'docforge.nav.resolver.ResolvedNav.all_files')>",
"docstring": "Iterate over all files referenced by the navigation structure.\n\nReturns:\n An iterable of ``Path`` objects representing documentation files.\n\nRaises:\n RuntimeError: If the home page is defined but the documentation\n root is not available for resolution."
}
}
},
"resolve_nav": {
"name": "resolve_nav",
"kind": "function",
"path": "docforge.nav.resolve_nav",
"signature": "<bound method Alias.signature of Alias('resolve_nav', 'docforge.nav.resolver.resolve_nav')>",
"docstring": "Resolve a navigation specification against the filesystem.\n\nThe function expands glob patterns defined in a ``NavSpec`` and verifies\nthat referenced documentation files exist within the documentation root.\n\nArgs:\n spec: Navigation specification describing documentation layout.\n docs_root: Root directory containing documentation Markdown files.\n\nReturns:\n A ``ResolvedNav`` instance containing validated navigation paths.\n\nRaises:\n FileNotFoundError: If the documentation root does not exist or a\n navigation pattern does not match any files."
},
"MkDocsNavEmitter": {
"name": "MkDocsNavEmitter",
"kind": "class",
"path": "docforge.nav.MkDocsNavEmitter",
"signature": "<bound method Alias.signature of Alias('MkDocsNavEmitter', 'docforge.nav.mkdocs.MkDocsNavEmitter')>",
"docstring": "Emit MkDocs navigation structures from resolved navigation data.\n\nThe emitter transforms a ``ResolvedNav`` object into the YAML-compatible\nlist structure expected by the MkDocs ``nav`` configuration field.",
"members": {
"emit": {
"name": "emit",
"kind": "function",
"path": "docforge.nav.MkDocsNavEmitter.emit",
"signature": "<bound method Alias.signature of Alias('emit', 'docforge.nav.mkdocs.MkDocsNavEmitter.emit')>",
"docstring": "Generate a navigation structure for ``mkdocs.yml``.\n\nArgs:\n nav: Resolved navigation data describing documentation groups\n and their associated Markdown files.\n\nReturns:\n A list of dictionaries representing the MkDocs navigation layout.\n Each dictionary maps a navigation label to a page or a list of\n pages."
}
}
},
"mkdocs": {
"name": "mkdocs",
"kind": "module",
"path": "docforge.nav.mkdocs",
"signature": null,
"docstring": "MkDocs navigation emitter.\n\nThis module provides the ``MkDocsNavEmitter`` class, which converts a\n``ResolvedNav`` instance into the navigation structure required by the\nMkDocs ``nav`` configuration.",
"members": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.nav.mkdocs.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"List": {
"name": "List",
"kind": "alias",
"path": "docforge.nav.mkdocs.List",
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
"docstring": null
},
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "docforge.nav.mkdocs.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"Any": {
"name": "Any",
"kind": "alias",
"path": "docforge.nav.mkdocs.Any",
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
"docstring": null
},
"ResolvedNav": {
"name": "ResolvedNav",
"kind": "class",
"path": "docforge.nav.mkdocs.ResolvedNav",
"signature": "<bound method Alias.signature of Alias('ResolvedNav', 'docforge.nav.resolver.ResolvedNav')>",
"docstring": "Resolved navigation structure.\n\nA ``ResolvedNav`` represents navigation data after glob patterns have been\nexpanded and paths validated against the filesystem.\n\nAttributes:\n home: Relative path to the documentation home page.\n groups: Mapping of navigation group titles to lists of resolved\n documentation file paths.",
"members": {
"home": {
"name": "home",
"kind": "attribute",
"path": "docforge.nav.mkdocs.ResolvedNav.home",
"signature": "<bound method Alias.signature of Alias('home', 'docforge.nav.resolver.ResolvedNav.home')>",
"docstring": null
},
"groups": {
"name": "groups",
"kind": "attribute",
"path": "docforge.nav.mkdocs.ResolvedNav.groups",
"signature": "<bound method Alias.signature of Alias('groups', 'docforge.nav.resolver.ResolvedNav.groups')>",
"docstring": null
},
"all_files": {
"name": "all_files",
"kind": "function",
"path": "docforge.nav.mkdocs.ResolvedNav.all_files",
"signature": "<bound method Alias.signature of Alias('all_files', 'docforge.nav.resolver.ResolvedNav.all_files')>",
"docstring": "Iterate over all files referenced by the navigation structure.\n\nReturns:\n An iterable of ``Path`` objects representing documentation files.\n\nRaises:\n RuntimeError: If the home page is defined but the documentation\n root is not available for resolution."
}
}
},
"MkDocsNavEmitter": {
"name": "MkDocsNavEmitter",
"kind": "class",
"path": "docforge.nav.mkdocs.MkDocsNavEmitter",
"signature": "<bound method Class.signature of Class('MkDocsNavEmitter', 15, 81)>",
"docstring": "Emit MkDocs navigation structures from resolved navigation data.\n\nThe emitter transforms a ``ResolvedNav`` object into the YAML-compatible\nlist structure expected by the MkDocs ``nav`` configuration field.",
"members": {
"emit": {
"name": "emit",
"kind": "function",
"path": "docforge.nav.mkdocs.MkDocsNavEmitter.emit",
"signature": "<bound method Function.signature of Function('emit', 23, 51)>",
"docstring": "Generate a navigation structure for ``mkdocs.yml``.\n\nArgs:\n nav: Resolved navigation data describing documentation groups\n and their associated Markdown files.\n\nReturns:\n A list of dictionaries representing the MkDocs navigation layout.\n Each dictionary maps a navigation label to a page or a list of\n pages."
}
}
}
}
},
"resolver": {
"name": "resolver",
"kind": "module",
"path": "docforge.nav.resolver",
"signature": null,
"docstring": "Navigation resolution utilities.\n\nThis module resolves a ``NavSpec`` against the filesystem by expanding glob\npatterns and validating that referenced documentation files exist.",
"members": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.nav.resolver.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "docforge.nav.resolver.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"Iterable": {
"name": "Iterable",
"kind": "alias",
"path": "docforge.nav.resolver.Iterable",
"signature": "<bound method Alias.signature of Alias('Iterable', 'typing.Iterable')>",
"docstring": null
},
"List": {
"name": "List",
"kind": "alias",
"path": "docforge.nav.resolver.List",
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
"docstring": null
},
"glob": {
"name": "glob",
"kind": "alias",
"path": "docforge.nav.resolver.glob",
"signature": "<bound method Alias.signature of Alias('glob', 'glob')>",
"docstring": null
},
"NavSpec": {
"name": "NavSpec",
"kind": "class",
"path": "docforge.nav.resolver.NavSpec",
"signature": "<bound method Alias.signature of Alias('NavSpec', 'docforge.nav.spec.NavSpec')>",
"docstring": "Parsed representation of a navigation specification.\n\nA ``NavSpec`` describes the intended documentation navigation layout before\nit is resolved against the filesystem.\n\nAttributes:\n home: Relative path to the documentation home page (for example\n ``index.md``).\n groups: Mapping of navigation group titles to lists of file patterns\n or glob expressions.",
"members": {
"home": {
"name": "home",
"kind": "attribute",
"path": "docforge.nav.resolver.NavSpec.home",
"signature": "<bound method Alias.signature of Alias('home', 'docforge.nav.spec.NavSpec.home')>",
"docstring": null
},
"groups": {
"name": "groups",
"kind": "attribute",
"path": "docforge.nav.resolver.NavSpec.groups",
"signature": "<bound method Alias.signature of Alias('groups', 'docforge.nav.spec.NavSpec.groups')>",
"docstring": null
},
"load": {
"name": "load",
"kind": "function",
"path": "docforge.nav.resolver.NavSpec.load",
"signature": "<bound method Alias.signature of Alias('load', 'docforge.nav.spec.NavSpec.load')>",
"docstring": "Load a navigation specification from a YAML file.\n\nArgs:\n path: Filesystem path to the navigation specification file.\n\nReturns:\n A ``NavSpec`` instance representing the parsed configuration.\n\nRaises:\n FileNotFoundError: If the specified file does not exist.\n ValueError: If the file contents are not a valid navigation\n specification."
},
"all_patterns": {
"name": "all_patterns",
"kind": "function",
"path": "docforge.nav.resolver.NavSpec.all_patterns",
"signature": "<bound method Alias.signature of Alias('all_patterns', 'docforge.nav.spec.NavSpec.all_patterns')>",
"docstring": "Return all path patterns referenced by the specification.\n\nReturns:\n A list containing the home document (if defined) and all\n group pattern entries."
}
}
},
"ResolvedNav": {
"name": "ResolvedNav",
"kind": "class",
"path": "docforge.nav.resolver.ResolvedNav",
"signature": "<bound method Class.signature of Class('ResolvedNav', 16, 65)>",
"docstring": "Resolved navigation structure.\n\nA ``ResolvedNav`` represents navigation data after glob patterns have been\nexpanded and paths validated against the filesystem.\n\nAttributes:\n home: Relative path to the documentation home page.\n groups: Mapping of navigation group titles to lists of resolved\n documentation file paths.",
"members": {
"home": {
"name": "home",
"kind": "attribute",
"path": "docforge.nav.resolver.ResolvedNav.home",
"signature": null,
"docstring": null
},
"groups": {
"name": "groups",
"kind": "attribute",
"path": "docforge.nav.resolver.ResolvedNav.groups",
"signature": null,
"docstring": null
},
"all_files": {
"name": "all_files",
"kind": "function",
"path": "docforge.nav.resolver.ResolvedNav.all_files",
"signature": "<bound method Function.signature of Function('all_files', 47, 65)>",
"docstring": "Iterate over all files referenced by the navigation structure.\n\nReturns:\n An iterable of ``Path`` objects representing documentation files.\n\nRaises:\n RuntimeError: If the home page is defined but the documentation\n root is not available for resolution."
}
}
},
"resolve_nav": {
"name": "resolve_nav",
"kind": "function",
"path": "docforge.nav.resolver.resolve_nav",
"signature": "<bound method Function.signature of Function('resolve_nav', 68, 136)>",
"docstring": "Resolve a navigation specification against the filesystem.\n\nThe function expands glob patterns defined in a ``NavSpec`` and verifies\nthat referenced documentation files exist within the documentation root.\n\nArgs:\n spec: Navigation specification describing documentation layout.\n docs_root: Root directory containing documentation Markdown files.\n\nReturns:\n A ``ResolvedNav`` instance containing validated navigation paths.\n\nRaises:\n FileNotFoundError: If the documentation root does not exist or a\n navigation pattern does not match any files."
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "docforge.nav.resolver.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
}
}
},
"spec": {
"name": "spec",
"kind": "module",
"path": "docforge.nav.spec",
"signature": null,
"docstring": "Navigation specification model.\n\nThis module defines the ``NavSpec`` class, which represents the navigation\nstructure defined by the user in the doc-forge navigation specification\n(typically ``docforge.nav.yml``).",
"members": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.nav.spec.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "docforge.nav.spec.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"List": {
"name": "List",
"kind": "alias",
"path": "docforge.nav.spec.List",
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
"docstring": null
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "docforge.nav.spec.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
},
"yaml": {
"name": "yaml",
"kind": "alias",
"path": "docforge.nav.spec.yaml",
"signature": "<bound method Alias.signature of Alias('yaml', 'yaml')>",
"docstring": null
},
"NavSpec": {
"name": "NavSpec",
"kind": "class",
"path": "docforge.nav.spec.NavSpec",
"signature": "<bound method Class.signature of Class('NavSpec', 15, 104)>",
"docstring": "Parsed representation of a navigation specification.\n\nA ``NavSpec`` describes the intended documentation navigation layout before\nit is resolved against the filesystem.\n\nAttributes:\n home: Relative path to the documentation home page (for example\n ``index.md``).\n groups: Mapping of navigation group titles to lists of file patterns\n or glob expressions.",
"members": {
"home": {
"name": "home",
"kind": "attribute",
"path": "docforge.nav.spec.NavSpec.home",
"signature": null,
"docstring": null
},
"groups": {
"name": "groups",
"kind": "attribute",
"path": "docforge.nav.spec.NavSpec.groups",
"signature": null,
"docstring": null
},
"load": {
"name": "load",
"kind": "function",
"path": "docforge.nav.spec.NavSpec.load",
"signature": "<bound method Function.signature of Function('load', 45, 86)>",
"docstring": "Load a navigation specification from a YAML file.\n\nArgs:\n path: Filesystem path to the navigation specification file.\n\nReturns:\n A ``NavSpec`` instance representing the parsed configuration.\n\nRaises:\n FileNotFoundError: If the specified file does not exist.\n ValueError: If the file contents are not a valid navigation\n specification."
},
"all_patterns": {
"name": "all_patterns",
"kind": "function",
"path": "docforge.nav.spec.NavSpec.all_patterns",
"signature": "<bound method Function.signature of Function('all_patterns', 88, 104)>",
"docstring": "Return all path patterns referenced by the specification.\n\nReturns:\n A list containing the home document (if defined) and all\n group pattern entries."
}
}
},
"load_nav_spec": {
"name": "load_nav_spec",
"kind": "function",
"path": "docforge.nav.spec.load_nav_spec",
"signature": "<bound method Function.signature of Function('load_nav_spec', 107, 135)>",
"docstring": "Load a navigation specification file.\n\nThis helper function reads a YAML navigation file and constructs a\ncorresponding ``NavSpec`` instance.\n\nArgs:\n path: Path to the navigation specification file.\n\nReturns:\n A ``NavSpec`` instance representing the parsed specification.\n\nRaises:\n FileNotFoundError: If the specification file does not exist.\n ValueError: If the YAML structure is invalid."
}
}
}
}
}
}

View File

@@ -0,0 +1,83 @@
{
"module": "docforge.nav.mkdocs",
"content": {
"path": "docforge.nav.mkdocs",
"docstring": "MkDocs navigation emitter.\n\nThis module provides the ``MkDocsNavEmitter`` class, which converts a\n``ResolvedNav`` instance into the navigation structure required by the\nMkDocs ``nav`` configuration.",
"objects": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.nav.mkdocs.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"List": {
"name": "List",
"kind": "alias",
"path": "docforge.nav.mkdocs.List",
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
"docstring": null
},
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "docforge.nav.mkdocs.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"Any": {
"name": "Any",
"kind": "alias",
"path": "docforge.nav.mkdocs.Any",
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
"docstring": null
},
"ResolvedNav": {
"name": "ResolvedNav",
"kind": "class",
"path": "docforge.nav.mkdocs.ResolvedNav",
"signature": "<bound method Alias.signature of Alias('ResolvedNav', 'docforge.nav.resolver.ResolvedNav')>",
"docstring": "Resolved navigation structure.\n\nA ``ResolvedNav`` represents navigation data after glob patterns have been\nexpanded and paths validated against the filesystem.\n\nAttributes:\n home: Relative path to the documentation home page.\n groups: Mapping of navigation group titles to lists of resolved\n documentation file paths.",
"members": {
"home": {
"name": "home",
"kind": "attribute",
"path": "docforge.nav.mkdocs.ResolvedNav.home",
"signature": "<bound method Alias.signature of Alias('home', 'docforge.nav.resolver.ResolvedNav.home')>",
"docstring": null
},
"groups": {
"name": "groups",
"kind": "attribute",
"path": "docforge.nav.mkdocs.ResolvedNav.groups",
"signature": "<bound method Alias.signature of Alias('groups', 'docforge.nav.resolver.ResolvedNav.groups')>",
"docstring": null
},
"all_files": {
"name": "all_files",
"kind": "function",
"path": "docforge.nav.mkdocs.ResolvedNav.all_files",
"signature": "<bound method Alias.signature of Alias('all_files', 'docforge.nav.resolver.ResolvedNav.all_files')>",
"docstring": "Iterate over all files referenced by the navigation structure.\n\nReturns:\n An iterable of ``Path`` objects representing documentation files.\n\nRaises:\n RuntimeError: If the home page is defined but the documentation\n root is not available for resolution."
}
}
},
"MkDocsNavEmitter": {
"name": "MkDocsNavEmitter",
"kind": "class",
"path": "docforge.nav.mkdocs.MkDocsNavEmitter",
"signature": "<bound method Class.signature of Class('MkDocsNavEmitter', 15, 81)>",
"docstring": "Emit MkDocs navigation structures from resolved navigation data.\n\nThe emitter transforms a ``ResolvedNav`` object into the YAML-compatible\nlist structure expected by the MkDocs ``nav`` configuration field.",
"members": {
"emit": {
"name": "emit",
"kind": "function",
"path": "docforge.nav.mkdocs.MkDocsNavEmitter.emit",
"signature": "<bound method Function.signature of Function('emit', 23, 51)>",
"docstring": "Generate a navigation structure for ``mkdocs.yml``.\n\nArgs:\n nav: Resolved navigation data describing documentation groups\n and their associated Markdown files.\n\nReturns:\n A list of dictionaries representing the MkDocs navigation layout.\n Each dictionary maps a navigation label to a page or a list of\n pages."
}
}
}
}
}
}

View File

@@ -0,0 +1,125 @@
{
"module": "docforge.nav.resolver",
"content": {
"path": "docforge.nav.resolver",
"docstring": "Navigation resolution utilities.\n\nThis module resolves a ``NavSpec`` against the filesystem by expanding glob\npatterns and validating that referenced documentation files exist.",
"objects": {
"Path": {
"name": "Path",
"kind": "alias",
"path": "docforge.nav.resolver.Path",
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
"docstring": null
},
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "docforge.nav.resolver.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"Iterable": {
"name": "Iterable",
"kind": "alias",
"path": "docforge.nav.resolver.Iterable",
"signature": "<bound method Alias.signature of Alias('Iterable', 'typing.Iterable')>",
"docstring": null
},
"List": {
"name": "List",
"kind": "alias",
"path": "docforge.nav.resolver.List",
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
"docstring": null
},
"glob": {
"name": "glob",
"kind": "alias",
"path": "docforge.nav.resolver.glob",
"signature": "<bound method Alias.signature of Alias('glob', 'glob')>",
"docstring": null
},
"NavSpec": {
"name": "NavSpec",
"kind": "class",
"path": "docforge.nav.resolver.NavSpec",
"signature": "<bound method Alias.signature of Alias('NavSpec', 'docforge.nav.spec.NavSpec')>",
"docstring": "Parsed representation of a navigation specification.\n\nA ``NavSpec`` describes the intended documentation navigation layout before\nit is resolved against the filesystem.\n\nAttributes:\n home: Relative path to the documentation home page (for example\n ``index.md``).\n groups: Mapping of navigation group titles to lists of file patterns\n or glob expressions.",
"members": {
"home": {
"name": "home",
"kind": "attribute",
"path": "docforge.nav.resolver.NavSpec.home",
"signature": "<bound method Alias.signature of Alias('home', 'docforge.nav.spec.NavSpec.home')>",
"docstring": null
},
"groups": {
"name": "groups",
"kind": "attribute",
"path": "docforge.nav.resolver.NavSpec.groups",
"signature": "<bound method Alias.signature of Alias('groups', 'docforge.nav.spec.NavSpec.groups')>",
"docstring": null
},
"load": {
"name": "load",
"kind": "function",
"path": "docforge.nav.resolver.NavSpec.load",
"signature": "<bound method Alias.signature of Alias('load', 'docforge.nav.spec.NavSpec.load')>",
"docstring": "Load a navigation specification from a YAML file.\n\nArgs:\n path: Filesystem path to the navigation specification file.\n\nReturns:\n A ``NavSpec`` instance representing the parsed configuration.\n\nRaises:\n FileNotFoundError: If the specified file does not exist.\n ValueError: If the file contents are not a valid navigation\n specification."
},
"all_patterns": {
"name": "all_patterns",
"kind": "function",
"path": "docforge.nav.resolver.NavSpec.all_patterns",
"signature": "<bound method Alias.signature of Alias('all_patterns', 'docforge.nav.spec.NavSpec.all_patterns')>",
"docstring": "Return all path patterns referenced by the specification.\n\nReturns:\n A list containing the home document (if defined) and all\n group pattern entries."
}
}
},
"ResolvedNav": {
"name": "ResolvedNav",
"kind": "class",
"path": "docforge.nav.resolver.ResolvedNav",
"signature": "<bound method Class.signature of Class('ResolvedNav', 16, 65)>",
"docstring": "Resolved navigation structure.\n\nA ``ResolvedNav`` represents navigation data after glob patterns have been\nexpanded and paths validated against the filesystem.\n\nAttributes:\n home: Relative path to the documentation home page.\n groups: Mapping of navigation group titles to lists of resolved\n documentation file paths.",
"members": {
"home": {
"name": "home",
"kind": "attribute",
"path": "docforge.nav.resolver.ResolvedNav.home",
"signature": null,
"docstring": null
},
"groups": {
"name": "groups",
"kind": "attribute",
"path": "docforge.nav.resolver.ResolvedNav.groups",
"signature": null,
"docstring": null
},
"all_files": {
"name": "all_files",
"kind": "function",
"path": "docforge.nav.resolver.ResolvedNav.all_files",
"signature": "<bound method Function.signature of Function('all_files', 47, 65)>",
"docstring": "Iterate over all files referenced by the navigation structure.\n\nReturns:\n An iterable of ``Path`` objects representing documentation files.\n\nRaises:\n RuntimeError: If the home page is defined but the documentation\n root is not available for resolution."
}
}
},
"resolve_nav": {
"name": "resolve_nav",
"kind": "function",
"path": "docforge.nav.resolver.resolve_nav",
"signature": "<bound method Function.signature of Function('resolve_nav', 68, 136)>",
"docstring": "Resolve a navigation specification against the filesystem.\n\nThe function expands glob patterns defined in a ``NavSpec`` and verifies\nthat referenced documentation files exist within the documentation root.\n\nArgs:\n spec: Navigation specification describing documentation layout.\n docs_root: Root directory containing documentation Markdown files.\n\nReturns:\n A ``ResolvedNav`` instance containing validated navigation paths.\n\nRaises:\n FileNotFoundError: If the documentation root does not exist or a\n navigation pattern does not match any files."
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "docforge.nav.resolver.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More