LibTmux — documentation
Write and export API documentation
Document public declarations with RakuDoc declarator comments directly above their definitions. Describe the result, whether the operation performs I/O, ownership and cleanup, and errors the caller can handle. Keep longer examples in the executable examples directory and link to them rather than maintaining an unchecked second copy.
Use native code markup and links inside declarator comments:
#| Inspect a C<Snapshot>. See L<LibTmux::Model::Snapshot>.
Native links must resolve to one exported declaration or an explicit signature value type. Spell an ambiguous target fully. Unknown or ambiguous targets fail native extraction as well as the shared adapter. Resolution checks exact identities, exported aliases, the owner's scope, then a unique declaration name. The exporter validates targets without choosing website routes. Use link labels without square brackets; the current shared Markdown bridge cannot represent them, so native extraction rejects them explicitly.
Use the RakuDoc V1 syntax supported by the pinned compiler. Native declarator
comments, C markup and L links remain the authoring source; the shared site
is a renderer of that source.
Native extraction
Run this command from the repository root after installing the declared
dependencies and selecting the compiler pinned in .tool-versions:
$ mise exec -- raku -I. tools/export-docs.raku
The author tool writes docs/_build/api.json. It parses trusted source with
Rakudo's RakuAST and reads native RakuDoc nodes; parsing can execute compile-time
code. The exporter reads the public import, independently public modules,
signature value types, and typed exceptions. It copies inherited native
declarations onto their public owners.
Internal transport owners do not become public API merely because they occur
in META6.json.
The artifact records exact native signatures, resolved type references, source lines, RakuDoc links, and the generated field catalogue. Library and exporter identities are separate, with content digests and dirty-tree flags. It embeds the captured module sources and refuses an input or HEAD change during extraction.
Check the native extraction fixture separately:
$ mise exec -- prove6 -I. xt/docs/export.rakutest
Check documentation coverage after a full export:
$ jq --exit-status '(.missingDocumentation | type == "object" and length == 0)' docs/_build/api.json
Missing prose is reported by declaration with its source file and line. An empty report establishes coverage; it does not establish that the prose correctly describes behavior. Behavioral review remains required.
Executable examples
Complete programs in examples/ are the canonical source. The README marks a
complete fenced block with <!-- runs: examples/query-panes.raku --> .
The native guide uses an abbreviated RakuDoc comment,
=comment runs: examples/query-panes.raku, immediately before its code block.
The runner checks every marked program byte-for-byte and rejects unmarked Raku
blocks in those guides. Check source alignment without starting tmux:
$ mise exec -- raku tools/check-examples.raku --check-source
The native exporter captures all shipped example files with their input digests
and source bytes. A rendered example therefore links to the captured version.
The example runner executes every program, checks its result, and rejects
leftover owned socket directories. Set LIBTMUX_TEST_TMUX to the absolute
endpoint executable and run:
$ mise exec -- raku tools/check-examples.raku
Run the programs to validate their output; compilation alone checks syntax and compile-time behavior. RakuDoc code blocks have no automatic doctest gate. Link displayed programs to the tested files or check that their source matches.
Shared rendering
The shared documentation repository consumes the versioned
libtmux.raku-api/v1 artifact. Its adapter validates input digests, parent
relationships, native signature spans, and cross-links before rendering.
The library exporter revision and shared adapter revision remain separate.
A dirty source tree requires explicit local-preview mode. Source links in
that preview open the exact captured files, and pages identify the preview
as uncommitted. Follow the repository boundaries in AGENTS.md for publication.