Commit Graph

1 Commits

Author SHA1 Message Date
AleFlyX
d518a3c587 feat: export the CLI and API surface the docs are checked against
The doc contract checks need the truth about what the CLI and the backend
actually expose. Reconstructing that from source with `ast` cannot see
registration that only exists at runtime (the imperative
`for action in (...): app.command(action)(...)` loop in deeptutor_cli/module.py,
`add_typer` aliases), so it has to guess and the guesses rot.

Export the surface from the live objects instead:

- CLI: `typer.main.get_command(app)` walks the Click tree, so loop-registered
  commands, aliases and Typer's default naming all come out correctly.
- HTTP: `app.openapi()["paths"]`, which resolves include prefixes and expands
  the lazy router loader.
- WebSocket: FastAPI omits socket routes from OpenAPI, so they come from the
  repo's own `RouterLoader.records` joined with the manifest prefixes.

The artifact is committed at docs/tests/docs_surface.json and rendered
deterministically (sorted, indent=2, trailing newline), so `--check` is a
byte comparison. Nothing reads it yet; the next commits switch the tests over
and add the freshness gate.

20 CLI groups, 610 HTTP paths, 9 WebSocket paths as of this commit.
2026-11-26 21:35:16 +08:00