Documentation
This guide provides practical information about writing and maintaining documentation for the Cloacina project.
Documentation Structure
Section titled “Documentation Structure”The docs are an Astro Starlight site (docs/, theme starlight-aurora) organized by the Diátaxis Framework. The pages are in docs/src/content/docs/:
tutorials/,how-to/,explanation/— one folder for each reader path inside each:embed/(the embedded library) andservice/(cloacina-server). How-to guides for the engine primitives are inhow-to/workflows/,how-to/computation-graphs/andhow-to/constructors/; the primitives themselves are described inexplanation/primitives/, and the engine internals inexplanation/engine/.start/,embed/,service/,engine/— the orientation pages of each path (“Start Here” in the sidebar).reference/— Hand-written lookup reference: CLI, HTTP API, WebSocket protocol, configuration, environment variables, macros, errors, metrics catalog, glossary, troubleshooting, pluspython-api/andsdks/subtrees.reference/api/— Generated API reference (Rust crates + thecloacaPython bindings). Never hand-edit these pages; see Generated documentation pipelines below.contributing/— This section.
When adding a new doc, decide first which quadrant it belongs to, then which reader path. Tutorials teach one path, how-tos solve one task, reference looks things up, explanation explains. If a doc spans paths, it lives in the most relevant one and the others cross-link to it.
The sidebar (docs/src/sidebar.mjs) lists each folder as a group, labelled with the title of its index.md, in the order of sidebar.order. Link between pages with relative links to the route (../workflows/task/), so that the links work under the base path of the published site. The old Hugo addresses redirect to the new pages (docs/src/redirects.json).
Nomenclature compliance
Section titled “Nomenclature compliance”All docs must comply with CLOACI-S-0011. In particular: never use reactive scheduler / reactive computation graph / reactive subsystem. Use reactor, computation graph, and traversal per spec.
Generated documentation pipelines
Section titled “Generated documentation pipelines”Two documentation surfaces are generated from source rather than hand-written. Know which one you are touching before you edit anything.
1. plissken → docs/src/content/docs/reference/api/
Section titled “1. plissken → docs/src/content/docs/reference/api/”The plissken tool generates the entire reference/api/ folder from source, its overview page (reference/api/index.md) included:
- Config:
plissken.tomlat the repository root, withtemplate = "starlight". It lists the Rust crates to document (crates/cloacina,crates/cloacina-computation-graph,crates/cloacina-workflow,crates/cloacina-python) and the Python package (cloaca, generated from the PyO3 binding source incrates/cloacina-python/src). - Command:
angreal docs api, which runsplissken render(0.2.1) from the project root. Output lands indocs/src/content/docs/reference/api/(index.md, one page for each module, and_sidebar.mjs, the sidebar group). The folder is git-ignored: do not commit it. Private items are left out. The Python API follows the#[pymodule]of the bindings and is one page,cloaca. - Install: plissken 0.2.1 from its release, or
cargo install plissken --version 0.2.1 --locked. The docs tasks fail when plissken is missing or is another version. - Removed pages: plissken deletes the page of a module that went away. Add its old address to
docs/src/redirects.json, pointing at the nearest page, so the address keeps working. - Wiring: the docs workflow (
.github/workflows/docs.yml) renders the pages before each build, on pull requests and on the Pages deploy, so they always match the source. Locally,angreal docs buildandangreal docs serverender them first. - Doc links: write rustdoc links to other crates in the intra-doc form,
[`cloacina_workflow::Context::secret`]. plissken copies a link written as[text](cloacina_workflow::Context::secret)into the page as is, and it is a broken link there.
2. utoipa → docs/public/openapi.json (CI drift-gated)
Section titled “2. utoipa → docs/public/openapi.json (CI drift-gated)”The REST API spec is emitted from the server’s utoipa annotations:
cargo run -p cloacina-server --bin cloacina-server -- emit-openapi > docs/public/openapi.jsonThe committed spec is the public API contract. CI runs angreal docs spec-check, which re-emits the spec and diffs it against the committed docs/public/openapi.json; any change to server routes or cloacina-api-types DTOs must ship with a regenerated spec or the check fails. Note the gate only covers what is utoipa-annotated — annotate new routes so they appear in the spec.
Writing Guidelines
Section titled “Writing Guidelines”General Principles
Section titled “General Principles”- Write clear, concise, and accurate documentation
- Use active voice and present tense
- Include practical examples where appropriate
- Keep documentation up-to-date with code changes
- Consider the reader’s perspective and experience level
API Documentation and Cross-Linking
Section titled “API Documentation and Cross-Linking”When documenting API features or referring to API components in the documentation, link to the page of the module in reference/api/, with a relative link. Each item has a fixed anchor:
| Item | Anchor |
|---|---|
| Rust struct | #struct.Name |
| Rust enum | #enum.Name |
| Function | #fn.name |
| Method | #Type.method |
| Python class | #class.Name |
For example, from a page in explanation/engine/:
[`cloacina::models`](../../../reference/api/rust/cloacina/models/)[`Context`](../../../reference/api/rust/cloacina-workflow/context/#struct.Context)Pages: Markdown and MDX
Section titled “Pages: Markdown and MDX”A page is Markdown (.md). A page that uses a Starlight component, such as <Tabs>, is MDX (.mdx): in MDX, write {, } and < in text as \{, \} and <. Use Starlight’s asides (:::note, :::tip, :::caution, :::danger) for hints, and a mermaid code block for a diagram.
Documentation Review Process
Section titled “Documentation Review Process”-
Self-Review
- Check for technical accuracy
- Verify all links work
- Ensure examples are up-to-date
- Review for clarity and completeness
-
Peer Review
- Documentation changes should be reviewed by at least one other contributor
- Focus on both technical accuracy and clarity
- Consider the perspective of new users
Tools and Resources
Section titled “Tools and Resources”- Use the angreal task to preview documentation changes:
(which runs the Starlight dev server at http://localhost:4321, with live reload; it installs the npm packages of
Terminal window angreal docs servedocs/on the first run). - Use
angreal docs buildto validate the site builds before opening a PR. The site is indocs/dist. - Use
angreal docs spec-checkbefore opening a PR that touches server routes or API DTOs — CI runs the same gate. - Check the Starlight documentation for Markdown, MDX and components
- Review existing documentation for style and format consistency
Need Help?
Section titled “Need Help?”If you need assistance with documentation:
- Check existing documentation for examples
- Ask in the project’s communication channels
- Review the Diátaxis Framework for guidance on documentation types