|
| 1 | +# Documentation Gap Report |
| 2 | + |
| 3 | +**Generated:** 2026-04-29 |
| 4 | +**Agent:** documentation-generator |
| 5 | +**Scope:** Workspace-wide rustdoc analysis (`cargo rustdoc --lib -- -D missing-docs`) |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Executive Summary |
| 10 | + |
| 11 | +| Metric | Count | |
| 12 | +|--------|-------| |
| 13 | +| Crates scanned | 9 | |
| 14 | +| Total missing documentation items | **564** | |
| 15 | +| Crates with zero missing docs | 0 | |
| 16 | +| Worst offender | terraphim_server (138 items) | |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Per-Crate Breakdown |
| 21 | + |
| 22 | +| Crate | Missing Items | Top Category | |
| 23 | +|-------|---------------|--------------| |
| 24 | +| terraphim_server | 138 | struct field (83) | |
| 25 | +| terraphim_service | 114 | struct field (50) | |
| 26 | +| terraphim_agent | 99 | struct field (66) | |
| 27 | +| terraphim_types | 79 | struct field (33) | |
| 28 | +| terraphim_config | 38 | variant (14) | |
| 29 | +| terraphim_middleware | 40 | variant (16) | |
| 30 | +| terraphim_persistence | 30 | module (5) | |
| 31 | +| terraphim_rolegraph | 22 | constant (6) | |
| 32 | +| haystack_core | 4 | crate (1) | |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Critical Gaps (User-Facing Public API) |
| 37 | + |
| 38 | +### terraphim_agent |
| 39 | + |
| 40 | +**Missing crate-level documentation** (`src/lib.rs:1`) |
| 41 | +- The crate root has no `//!` doc comment describing the agent's purpose. |
| 42 | + |
| 43 | +**Missing module documentation** |
| 44 | +- `src/lib.rs:4` -- top-level module |
| 45 | +- `src/robot/mod.rs:7` -- robot module (core public API) |
| 46 | + |
| 47 | +**Missing struct documentation** |
| 48 | +- `src/service.rs:13` -- main service struct |
| 49 | +- `src/robot/budget.rs:7` -- `TokenBudget` (public API for robot mode) |
| 50 | +- `src/robot/budget.rs:19` -- `BudgetManager` |
| 51 | +- `src/repl/handler.rs:28` -- `ReplHandler` (REPL entry point) |
| 52 | + |
| 53 | +**Missing enum documentation** |
| 54 | +- `src/robot/budget.rs:14` -- `BudgetStrategy` |
| 55 | +- `src/repl/commands.rs:110` -- `SessionSubcommand` |
| 56 | +- `src/repl/commands.rs:135` -- `ConfigSubcommand` |
| 57 | +- `src/repl/commands.rs:141` -- `RoleSubcommand` |
| 58 | + |
| 59 | +**Missing method/function documentation** |
| 60 | +- `src/robot/budget.rs:37` -- `BudgetManager::new` |
| 61 | +- `src/robot/budget.rs:42` -- `BudgetManager::check_budget` |
| 62 | +- `src/repl/handler.rs:38` -- `ReplHandler::new_offline` |
| 63 | +- `src/repl/handler.rs:67` -- `ReplHandler::run` |
| 64 | + |
| 65 | +### terraphim_server |
| 66 | + |
| 67 | +**Missing crate-level documentation** (`src/lib.rs:1`) |
| 68 | + |
| 69 | +**Missing module documentation** |
| 70 | +- `src/lib.rs:139` -- workflows module |
| 71 | +- Multiple workflow submodules |
| 72 | + |
| 73 | +**Missing struct documentation** |
| 74 | +- `src/lib.rs:179` -- server state struct |
| 75 | +- `src/api.rs:66` -- API request/response types |
| 76 | +- `src/api.rs:231` -- additional API types |
| 77 | + |
| 78 | +**Missing function documentation** |
| 79 | +- `src/lib.rs:185` -- public server function |
| 80 | +- `src/lib.rs:650` -- public utility function |
| 81 | +- 19 other public functions in API modules |
| 82 | + |
| 83 | +### terraphim_service |
| 84 | + |
| 85 | +**Missing crate-level documentation** (`src/lib.rs:1`) |
| 86 | + |
| 87 | +**Missing module documentation** (9 modules) |
| 88 | +- All re-exported submodules lack `//!` docs |
| 89 | + |
| 90 | +### terraphim_types |
| 91 | + |
| 92 | +**Missing module documentation** |
| 93 | +- `src/lib.rs:100` -- types module |
| 94 | + |
| 95 | +**Missing enum documentation** |
| 96 | +- `src/lib.rs:470` -- core data type enum |
| 97 | + |
| 98 | +**Missing struct documentation** |
| 99 | +- `src/lib.rs:478` -- public data struct |
| 100 | +- `src/lib.rs:487` -- public data struct |
| 101 | + |
| 102 | +--- |
| 103 | + |
| 104 | +## API Reference Snippets (Partial) |
| 105 | + |
| 106 | +### terraphim_agent::robot::budget |
| 107 | + |
| 108 | +```rust |
| 109 | +/// Manages token budgets for robot mode output control. |
| 110 | +pub struct BudgetManager { ... } |
| 111 | + |
| 112 | +/// Strategy for enforcing token budgets. |
| 113 | +pub enum BudgetStrategy { ... } |
| 114 | +``` |
| 115 | + |
| 116 | +### terraphim_agent::repl |
| 117 | + |
| 118 | +```rust |
| 119 | +/// Handles REPL command execution and dispatch. |
| 120 | +pub struct ReplHandler { ... } |
| 121 | + |
| 122 | +/// Top-level CLI commands for the terraphim-agent REPL. |
| 123 | +pub enum Command { ... } |
| 124 | +``` |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## Recommendations |
| 129 | + |
| 130 | +1. **Priority 1:** Add crate-level `//!` documentation to all 9 crates. This is the first thing users see on docs.rs. |
| 131 | + |
| 132 | +2. **Priority 2:** Document all public structs and enums in `terraphim_agent::robot` and `terraphim_agent::repl`. These are user-facing CLI APIs. |
| 133 | + |
| 134 | +3. **Priority 3:** Document `terraphim_server` API types (`src/api.rs`). These define the HTTP contract. |
| 135 | + |
| 136 | +4. **Priority 4:** Add module-level documentation to all undocumented modules in `terraphim_service` and `terraphim_middleware`. |
| 137 | + |
| 138 | +5. **Ongoing:** Enable `#![warn(missing_docs)]` at crate root to prevent regression. |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +## Changelog Updates Required |
| 143 | + |
| 144 | +The following commits since the last CHANGELOG update (026c6b54f) need entries: |
| 145 | + |
| 146 | +- `feat(usage):` add LLM cost tracking foundation with genai fork integration (Refs #1075) |
| 147 | +- `fix(agent):` allow --server flag on listen subcommand so custom error handler runs |
| 148 | +- `docs(spec):` validation report 2026-04-29 -- FAIL, 3 fixed 5 remaining |
| 149 | + |
| 150 | +--- |
| 151 | + |
| 152 | +*Report generated by documentation-generator agent.* |
0 commit comments