doc: generate the ## Declarations sections of the standard library pages #32
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
The
## Declarationssection of everydocs/standard-library/<package>.mdpage is written by hand next to the hand-written prose, so a signature on a page can drift fromstd/(theUripage, for one, showsUriwhere the source saysSelfand omitscompare). Generate the signature blocks from the model oftorb docand keep them in sync with a check. The prose between the blocks stays hand-written.Design point
docs/contributing/research.md, principle 4 "Nothing is written twice by hand": the standard-library declarations "will be generated by milestone 8'storb doc".docs/ROADMAP.md, thetorb docparagraph (the point linked in "Source" below; it is a milestone 8 item).docs/tooling/torb-doc.md: the model (compiler/src/reference/model.trb,DocumentedItem) already carries, per public construct, the kind, the name, the signature as the source's own text, and its members. No new model field is needed.Design (decided by the loop, see the comment below)
torb docs declarations [root] [--standard-library <path>] [--check], next todocs indexanddocs skill. It reads the documentation tree, builds the model of the package a page names (title: std/<name>,kind: package) with the existingreferenceOfwalk, and rewrites the generated blocks. Without--checkit writes; with--checkit writes nothing and reports every page whose blocks differ (the gate form, likedocs index --check).<!-- torb:declaration: <Name> -->directly above atrb fragmentfence marks that fence as generated. The generator replaces the fence with: the construct's signature (the model's text, withoutpublic), its non-private members one per line, indented, and the headers of theextendblocks of the package that target it. Everything outside the marked fences is untouched byte for byte, and a marker whose name is not a public construct of the page's package is a problem naming the page and the line.AuthorityandHostunder one###heading get two markers). The###heading and the prose below stay as they are.## Declarationssection are migrated:<!-- torb:declaration: -->markers added by the migration, blocks regenerated,skills/regenerated.Acceptance criteria
torb docs declarations docsrewrites the marked blocks from the model;torb docs declarations docs --checkexits non-zero and names the page and the construct when a block differs, a marker names nothing, or the package does not check; it writes nothing.compiler/tests/documentation.test.trb(or a newdocumentation-declarations.test.trb): a block is regenerated byte for byte, text outside the markers is untouched, an unknown name is a problem, a stale block is reported by--check, two markers under one heading both work.docs/standard-library/<package>.mdpage with a## Declarationssection has a marker above each of its signature fences, andtorb docs declarations docs --checkis clean onmainafter the PR.sh tools/gates.sh arunsdocs declarations --checkas a gate (tools/gates.sh, besidedocs index --check), and its time is reported; if it adds more than 40 s to tier A, it shares the std check with the existingdoc --check --no-run stdgate instead of running a second one.docs/standard-library/index.md("What belongs here"),docs/contributing/checks.md("The declarations of a package page"),docs/contributing/adding-a-page.md(std package template),docs/tooling/torb-doc.md("Related"), and the usage listing indocs/contributing/checks.mdSynopsis andcompiler/src/documentation/command.trb.torb docs skill docs skillsoutput regenerated and committed (--checkclean).torb docs check docsstays clean (the generated fences aretrb fragment, which only lex).Seed
No seed impact: a new
torb docssubcommand, no syntax, no new native, no flag the bootstrap uses, no std name the compiler looks up by string. The gate runs with the freshly bootstrappedtorb, never the seed. Compiler change incompiler/src/documentation/, so the implementer is opus/high per the loop contract.Size and dependencies
One PR, two Conventional Commits:
feat(docs): torb docs declarations generates the signature blocks of std pages(command, tests, gate, the sentences about the command in docs, skills regenerated). With no markers in the pages yet, the new check is trivially clean.docs(std): generate the declarations of the standard library pages(markers on every page, blocks regenerated,skills/regenerated).Depends on nothing open:
torb docand its model are built, and the work is independent of the VM/IR and oftools/registry. If the implementer finds that the model needs a new field or that commit 2 does not fit one reviewable diff, split it into linked issues instead of growing the PR.Source
torb docMoved from the planning lists of the docs; the design record stays the specification.
[loop:torbscript] intake: in scope (author orion, label loop). Generates the
## Declarationssections ofdocs/standard-library/from thetorb docmodel with a sync check; tooling and docs, regeneratesskills/, no seed impact expected. Related to the docs issue on public constructs (#31). Release freeze for 0.1.0 (2026-10-06) holds new PRs, next: refine (queued)[loop:torbscript] decided by the loop: command shape, markers, scope of the generated block
torb docflag. The pages live in the documentation tree and the other generated parts (docs index,docs skill) aretorb docssubcommands with a--checkgate form, anddocs checkalready takes--standard-library. A newtorb docs declarationsfollows that convention instead of teachingtorb docaboutdocs/.###headings hold two constructs (Authority,Host). Replacing only the marked fence keeps every explanation and needs no page restructuring; a whole-section generator would have deleted the prose.Self, nopublic). The hand-written blocks were curated and had drifted (omittedcompare, wroteUriforSelf); one rule that the source decides is what removes the drift. Longer blocks for the largest types (e.g.Option) are the accepted cost; the prose stays the place that explains.title: std/<name>ofkind: packagepages. No new front-matter field;function-types.mdandprelude.mdget markers only where a name resolves to a public construct of their package, otherwise they keep a plain fence.std/(about half a minute, same asdoc --check --no-run std). The criterion fixes the threshold (40 s on tier A) and the fallback (share the check) so the implementer decides with numbers.torb doc's JSONformatis untouched).tools/registrywork (checked against the open issue list: thetorb docissues #234, #235, #236 touch the renderer and the registry worker, not the model ordocs).[loop:torbscript] refine: requirements written (new
torb docs declarationscommand with per-construct markers and a--checkgate; two commits; no seed impact; no dependency on open VM/IR or registry work), next: implement[loop:torbscript] claim implement by session:loop-torbscript-20261009 until 2026-10-09T07:28Z
[loop:torbscript] implement: PR #243 open, CI success, worker usage ~450k tokens, next: waiting (review by the merge gate argus)
--sandbox#49--sandbox#49