Skip to content

# Commands

## `` docforge.cli.commands

### Summary

Command definitions for the doc-forge CLI.

Provides the CLI structure using Click, including build, serve, and tree commands.

### Classes

### Functions

#### `` build

    1

    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

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`mcp` | `bool` | Enable MCP documentation generation. | required
`mkdocs` | `bool` | Enable MkDocs documentation generation. | required
`module_is_source` | `bool` | Treat the specified module directory as the project root. | required
`module` | `Optional[str]` | Python module import path to document. | required
`project_name` | `Optional[str]` | Optional override for the project name. | required
`site_name` | `Optional[str]` | Display name for the MkDocs site. | required
`docs_dir` | `Path` | Directory where Markdown documentation sources will be generated. | required
`nav_file` | `Path` | Path to the navigation specification file. | required
`template` | `Optional[Path]` | Optional custom MkDocs configuration template. | required
`mkdocs_yml` | `Path` | Output path for the generated MkDocs configuration. | required
`out_dir` | `Path` | Output directory for generated MCP resources. | required

Raises:

Type | Description
--- | ---
`UsageError` | If required options are missing or conflicting.

#### `` serve

    1

    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

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`mcp` | `bool` | Serve documentation using the MCP server. | required
`mkdocs` | `bool` | Serve the MkDocs development site. | required
`module` | `Optional[str]` | Python module import path to serve via MCP. | required
`mkdocs_yml` | `Path` | Path to the MkDocs configuration file. | required
`out_dir` | `Path` | Root directory containing MCP documentation resources. | required

Raises:

Type | Description
--- | ---
`UsageError` | If invalid or conflicting options are provided.

#### `` tree

    1

    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.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`module` | `str` | Python module import path to introspect. | required
`project_name` | `Optional[str]` | Optional name to display as the project root. | required