Skip to main content

Module docs

Module docs 

Source
Expand description

Layered, Obsidian-ready documentation vault generator.

The docs generator turns the cgx graph into a markdown vault organised by the Diátaxis-ish layout described in cgx-docs:

  • 00-Overview/ — Architecture.md, Glossary.md
  • 10-PublicAPI/ — one note per community’s exported surface
  • 20-Architecture/ — Communities, CrossClusterDeps, EntryPoints
  • 30-Modules/<community>/<file>.md — per-file notes with prompt packets
  • 40-Risk/ — Hotspots, ComplexityHigh, DeadCode, Duplicates
  • 50-Ownership/ — Owners, BlameGraph

cgx never calls an LLM. Each module note ends with a <!-- cgx-prompt --> block that contains all context the user’s AI agent needs to produce prose without re-exploring the repo. The agent runs outside cgx.

Modules§

incremental
Per-file slice-hash tracking, persisted to ~/.cgx/<repo_id>/docs_state.json.
label
Replace cgx’s dominant-node-name community labels with labels derived from the common path prefix of nodes in each community. Much more readable.
layered
Diátaxis-ish layered vault writer.
obsidian_detect
Best-effort detection of an Obsidian vault on the user’s machine.
project
Detect “what is this project?” by walking every manifest in the repo and cross-referencing declared dependencies with actual imports in source code.
prompt_packet
Builds the <!-- cgx-prompt --> block embedded in every module note.
prompts_index
Helper for cgx docs prompts — scan the vault for module notes whose <!-- cgx-prompt --> block hasn’t been filled in yet.
role
Heuristic role classifier for a source file. Drives the TL;DR badge and a frontmatter tag in each module note.
wiki_link
Wiki-link / markdown-link formatting + safe filename conversion.

Structs§

DocsOptions
Options that flow from CLI flags / DocsConfig into the generator.
DocsReport
Stats returned by generate_vault.

Enums§

DocsMode
Mode of generation.
DocsTarget
User-selected output target for cgx docs.
WikiLinkStyle

Functions§

generate_vault
Main entry point — generate (or refresh) a docs vault for the repo indexed in db.