SyncDocs.md
SyncDocs
type: module path: "@root/tools/SyncDocs.pudu" fidelity: Active grammar: "[[grammar/pudu]]" depth_score: 0.45 depth_status: MODERATE coupling: 1 interface_stability: 0.8 tags: [module, tool] aliases: [SyncDocs]
Purpose
Regenerate [[src/PuduLangMcp/Generated/Docs]] from a pudu-lang checkout: the language guide, the site pages, the release notes, and the playground examples ([[decisions/ADR-0002-compiled-documentation]]).
Interface
pudu run tools/SyncDocs.pudu <pudu-lang-checkout> [revision]Writes src/PuduLangMcp/Generated/Docs.pudu. Exit status 0 on success, 1 with a message on stderr otherwise.
Algorithm
- Collect, in this order:
website/docs/*.md(groupdocs); the six site pages the website publishes (grouppages: conduct, contributing, security, community, privacy, brand); everypackages/pudu/<series>/release-notes/*.md(groupreleases, slug = version); andwebsite/playground/examples/*.pudu(groupexamples, wrapped in apudufence and titled by the program's first//line). Each directory is sorted by name. - A slug is the file name without its extension and without a leading
NN-prefix; a title is the first line starting#, else the slug. - Escape each chapter's text for a Pudu string literal:
\"{}are backslash-escaped, a line break is\n, a tab\t, and carriage returns are dropped. - Write the module: the revision constant, then one
Chapter{...}per document inCHAPTERS.
Negative Logic (Prohibited Paths)
- Never writes a partial file: the text is built fully, then written once.
Edge Cases
- No documentation chapters is an error: an empty corpus would silently disable the docs tools.
- The standard-library catalogue is deliberately not generated ([[decisions/ADR-0006-reference-from-toolchain]]).
Grill Log
- Q: Why a Pudu program and not a shell script? A: The escaping rules are Pudu's own and are tested with Pudu; one language keeps the repository whole.
Referenced by
[[src/PuduLangMcp/Generated/Docs]]
