tools.read_own_docs module

Read the bot’s own documentation, architecture graphs, and recent history.

async tools.read_own_docs.run(section='', **_kwargs)[source]

Return Stargazer’s own documentation for the requested section.

Entry point for the read_own_docs tool, letting the bot read its own architecture graphs, reference docs, and recent git history at runtime. With no section it returns the top-level self-doc overview (stargazer-docs.md); "list" enumerates the available sections; "commits" shows the latest git log; any other value is looked up in the module-level _SECTIONS map and the corresponding doc file is read.

Section docs are read via _read_file() (async, aiofiles-backed), and "commits" shells out to git log --oneline -5 through subprocess.run offloaded with asyncio.to_thread so the event loop is not blocked. All paths are resolved relative to the repository root (_PROJECT_ROOT). Read-only: no Redis, knowledge-graph, LLM, or network access. This module-level run is discovered and dispatched by the tool runtime via tool_loader.py (getattr(module, "run")); no other in-repo callers.

Parameters:

section (str) – Section selector — empty for the overview, "list" for the index, "commits" for git history, or a key from _SECTIONS. Case-insensitive and whitespace-trimmed.

Returns:

The requested document text, the section index, the recent commit list, or a human-readable error/”unknown section” message. Errors are returned as strings rather than raised.

Return type:

str