Files

40 KiB

Writing docs

Writing docs

The site is Hugo with the Hextra theme, built from docs/. Hextra is a Hugo module pinned in docs/go.mod; update it with hugo mod get github.com/imfing/hextra@<version> in docs/.

  • Pages are Markdown files in docs/content/docs/, one per topic, in a folder per section of the sidebar. The sections run in the order a new user needs them: getting-started/, using/, releases/, safety/, backends/, compared/, cli/, internals/, then contributing/. Each folder's _index.md is the section's own page, which lists its pages. Update the page for any behavior you change, in the same change. The README stays high level: it says what devvm is and links to the pages for the rest.
  • What goes where: the user pages, in getting-started/, using/, safety/, backends/ and compared/, say what devvm does, what you type and what you see, and they name no repo paths, Go identifiers or message names. How it works, in internals/, explains how devvm does it, for readers who want to check a claim, and it holds the mechanisms and the message names that come from them. Contributing, in contributing/, covers changing devvm, so repo paths, Go identifiers, version bumps, releases and tests go there, and so do the design notes, which say why devvm is built as it is and hold each emulation's design note and threat check. A user page links once to its How it works page where there is one.
  • Current behavior, but for releases: every page describes how devvm works now, and none mentions older behavior, what changed or what moved, because that goes in the changelog and on the release pages. Releases, in releases/, is the one place the docs describe history. It has a page for each minor release, such as releases/0.2.0.md, which covers the release and its release candidates and is written as the release is made. Each change there has a section of its own, under Breaking changes, Changes, Fixes or Hardening, that tells its full story: what was wrong or missing, how it showed, how devvm works now, at the level of the user pages, and what you do, with links to the user or How it works pages for anything deeper. The changelog's entry links each section, as Releasing says. These pages follow the docs voice, but they aren't user pages, so the rules for leading with a command don't apply.
  • User pages lead with doing: a task on a user page, in getting-started/, using/, safety/, backends/ or compared/, shows its command, in a copyable block or numbered steps, and a short explanation follows. One paragraph of why next to its command is fine, but two or more paragraphs back to back mean the mechanism belongs on the How it works page, under a heading that the user page links to, with every fact moved rather than dropped. The docs-voice skill's SKILL.md has the rule, under Commands first on user pages, with an example, and its scan.sh -p paras and scan.sh -p long list the runs and the long paragraphs.
  • Front matter sets title, shown as the page's heading, weight, the page's place in its section, or a section's place in the sidebar for an _index.md, and explainer, the line under the title on the page's social card, which Social cards below describes. Start the body at ##.
  • Links to other pages point at their files ([Contributing](_index.md)), so the linters can check them.
  • Diagrams are Mermaid code blocks, fenced with mermaid, which a script draws as SVGs before Hugo builds the site, so no page loads Mermaid or any other diagram JavaScript. A diagram goes where it helps the reader follow the text, with at most one sentence to introduce it, and the text keeps every fact the diagram shows.
    • Drawing them: mise run docs:diagrams installs pele with npm ci --ignore-scripts, at the version and integrity that docs/package.json and docs/package-lock.json pin, and then runs docs/render-diagrams.mjs. The script draws each block in docs/content as an SVG in docs/.build/diagrams/, which git ignores, with a JSON file of the diagram's size beside it. It names both files for the block's key, which is a hash of the salt and the block's text. The salt is a hash of pele's version and the script itself, and the script writes it to that folder too. mise run docs and mise run lint:docs run it first, and so do the Docs workflow's builds.
    • Caching: a run with nothing changed takes a few hundredths of a second. mise skips the task when the drawings' folder is newer than every page in docs/content, the script, docs/package.json and the lock, so the script updates the folder's time on every run. The task runs npm ci only when the lock's SHA-256 differs from the one it wrote to docs/node_modules/.devvm-lock-sha256 after its last install. The script keeps every drawing that's already there, draws only the blocks it has no drawing of, and deletes the files no block's key names, so a changed diagram is drawn again on its own, and a new pele or a change to the script draws them all again. The CI workflow's check job caches npm's downloads, keyed on the lock, and the Docs workflow, which publishes, keeps no cache and draws every diagram.
    • Putting them in pages: hugo.yaml mounts that folder at assets/diagrams, and the render hook, docs/layouts/_markup/render-codeblock-mermaid.html, which takes the place of Hextra's, reads the salt, computes each block's key from it and the block's text, and puts the SVG in the page. A block without its SVG fails the build, so run mise run docs:diagrams again after you change a diagram, even while mise run docs serves the site, because the server doesn't redraw them.
    • The theme is in custom.css, which sets pele's --pele-* variables from the site's palette, so a diagram never sets its own colors or font. Panels are on the surface color with blue borders, lines and arrows are lime, subgraphs, lifelines and notes use the border color, and text is in Departure Mono at 14px, larger than the home page's art so labels read easily.
    • The layout is pele's own, with the Mermaid settings that render-diagrams.mjs passes, such as right-angled edges. A diagram can set its own layout in front matter, as Staying safe's three columns set minNodeWidth, but never its own colors or font. pele lays subgraphs out from left to right in the order they're written.
    • Measuring labels: the script measures each label by Departure Mono's metrics, where every character is 350/550 of the font size wide, so labels fit their boxes. pele draws edge labels, messages and notes at seven-eighths of the size, 12px, and has no option to change it, so the measurer gives that text its width at 14px and the script then writes it at 14px. A self-check, before anything is drawn, fails the run when pele no longer measures and writes that text as the script expects, and every group of small text that pele draws must carry the 12px size the script replaces. The script also puts a newline after each label, where the SVG draws nothing, so the site's search sees one label's last word apart from the next label's first.
    • Size: each diagram is drawn at its own size and never scaled to fit. The hook sets each diagram's width on it, and a diagram wider than the text reaches into the page's right margin, the article's padding, as far as it needs, and into the padding on the left for whatever the right margin can't hold, so it never covers the table of contents. A diagram wider than the text and both paddings scrolls sideways, as the widest ones do on a narrow screen. custom.css gives each one content-visibility: auto, so the browser draws it only when it nears the screen, and the hook sets the diagram's height as its contain-intrinsic-block-size, so the page doesn't jump while you scroll.
    • Accessibility: every diagram has an accTitle and a one-line accDescr, which become the SVG's title and description that screen readers read, and the script fails on a diagram without them. The description says in full sentences what the diagram shows.
    • Labels: keep labels short, and break a long one with <br>. In a label, write < as #lt; and > as #gt;.
    • pele's version is pinned exactly, and scripts/bump.sh pele moves it (updating pinned versions).
  • Style: succinct and direct. Commands are written as devvm x or in backticks, never in quotes. No please, simply or note that.
  • The home page is docs/content/_index.md, on Hextra's hextra-home layout: its hero shortcodes, then plain Markdown. custom.css styles it through the one div that the layout wraps its content in. After the hero, the page has a quick start, what's supported, why to use devvm with its feature cards, a short FAQ, and a closing call to action with the hero's buttons. It keeps a marketing tone, but each of its claims matches the docs page it links to, it uses the same terms, and it says each thing once.
  • The quick start shows the three commands to run first, each after a comment short enough to fit a phone's width, because a comment after its command would scroll out of view there.
  • Feature cards on the home page come from two shortcodes in docs/layouts/_shortcodes/, which make a {{< features >}} grid of {{< feature title="Ready in seconds" icon="high-voltage" art="copies" >}} cards, each closed with {{< /feature >}}. A card shows its title as a heading, after the pixel icon its icon names, drawn in the title's own color at 24px, then the Markdown inside it, then its illustration, which is optional. The cards are in one centered column on smaller screens. From 1024px wide, they go into two columns, the first, third and so on on the left and the rest on the right, and each card is as tall as its content, so no card leaves a gap under it. features places them: feature renders its card through docs/layouts/_partials/feature-card.html and hands it over, and each card's order style keeps the page's order when the columns stack. What's supported uses the same cards with smaller illustrations, and Quick start uses them with a terminal in each card. {{< features columns="3" >}} puts three in a row from 1024px wide, and level="3" on a card makes its title an h3, under the section's own heading.
  • Art beside a section's text comes from {{< beside art="blast-radius" >}}, closed with {{< /beside >}}, in docs/layouts/_shortcodes/beside.html. It renders the Markdown inside it, then the illustration it names. From 1024px wide, the text and the drawing each take half the column, with the drawing on the right, centered on the text. On narrower screens, the drawing goes below the text. Why use devvm? uses it.
  • Install commands come from {{< install >}} in docs/layouts/_shortcodes/install.html, which the home page and Installing use. The commands are written in one place, docs/layouts/_partials/install-tabs.html, which the tabs and the pages' Markdown copies both read. It renders Hextra's tabs with a macOS tab, which has the Homebrew command, and a Linux tab, which has the install script. The macOS tab is selected in the HTML, so it shows when JavaScript is off. A small script in docs/layouts/_partials/install-os.html selects the Linux tab as the page loads when the browser's platform or user agent string says Linux, apart from Android. To check the Linux tab in headless Chrome, pass --user-agent= with a Linux user agent string. custom.css styles the tabs on a blue line, with the selected tab in lime.
  • Other content per operating system goes in {{< os-tabs >}}, with a {{< os-tab name="macOS" >}} and then a {{< os-tab name="Linux" >}} inside it, each holding Markdown, as Installing's requirements tables do. It uses the same tabs, styles and script as the install commands, so the visitor's system is selected, and the build fails unless the tabs are macOS's, then Linux's.
  • Colors: the site is dark only (hugo.yaml's params.theme). Its palette is in docs/assets/css/custom.css: a black background and one lime accent, #7fff00, which sets Hextra's primary color. The home page's illustrations also use #0086b3, the blue that Hextra's syntax highlighting gives commands like cd, and #ff5370 (--devvm-red), the JustBlack theme's red, which marks only what an attack has compromised. The red's contrast is 6.7:1 on the black and 6.0:1 on the surface color, and it's much darker than the lime, so the two stay apart for readers who can't tell red from green.
  • Fonts: the site uses Instrument Sans for text, Martian Mono for code, and Departure Mono, a pixel font, for the logo and the home page's headings, badge and buttons. All three are in docs/static/fonts/, each in its own folder with its license, and docs/layouts/_partials/custom/head-end.html declares them. Instrument Sans and Martian Mono are upstream's variable WOFF2 files, so one file holds every weight, and the partial's comment records where each font came from, at which commit or release, and its SHA-256. To update a font, download the new version from the same place, check its SHA-256, and update the comment. Departure Mono is sharp at multiples of 11px and has one weight.
  • No third-party requests: devvm.dev and next.devvm.dev load every script, stylesheet, font and image from the site itself, so a visitor's browser asks no other host for anything. mise run lint:docs checks this after it builds the site: TestNoThirdPartyLoads in internal/cli/docgen/site_test.go reads every page and stylesheet and fails on a link, script, image, frame or CSS url() that points at a host other than the ones in hugo.yaml's and next.yaml's baseURL. Hugo fetches FlexSearch, which Hextra's search uses, when it builds the site, and the site serves it itself, so it passes. Diagrams are SVGs inside the pages, so they load nothing. Links that a visitor clicks, such as GitHub's, aren't loads, and the check ignores them. The social cards draw it from docs/assets/fonts/departure-mono/, which has the same release's OTF and license, because Hugo can't draw text from a WOFF2.
  • The logo in the navbar is the branding page's devvm-logo-on-dark.svg at its own size, which hugo.yaml's params.navbar.logo names, with the site's title as its alt text. Right-clicking it opens the branding page instead of the browser's menu, through a script in docs/layouts/_partials/custom/footer.html. A left click, or Enter on the focused logo, still goes to the home page.
  • The branding page is docs/content/branding.md, at /branding/, on its own layout, docs/layouts/branding.html, which is Hextra's home layout with the home page's look and the script that copies a swatch's hex. Its front matter keeps it out of the sidebar. It has the logo as box-drawing text in a code block, the logo's SVGs and PNGs, the icons, the social card, the palette, the fonts, how to use the logo and the credits.
    • Its downloads are in docs/static/branding/, and {{< brand-asset >}} tiles inside {{< brand-assets >}} show each one on its background, with a link to each file. The build fails when a file doesn't exist, and it reads each PNG's size for its link. devvm-logo-on-dark.svg and devvm-logo-on-light.svg are the logo, drawn on a pixel grid as the favicon is, made from Departure Mono's 11px glyphs. The prompt and devvm are at twice the glyphs' size, the box is in 1-pixel lines, and the lock, a block with a keyhole under a 2-pixel arch, sits on the box's bottom-right corner, with the box's lines stopping short of it so that the arch stands clear. The version for light backgrounds is black, with its prompt in the dark lime, #408000 (--devvm-accent-dark), which is the lime's hue at half its lightness, with a contrast of 4.9:1 on white, where the lime has 1.2:1. Each logo's PNG is its SVG at four times its size on a transparent background, and devvm-icon-64.png to devvm-icon-1024.png are docs/static/favicon.svg at 4 to 64 times its size. After changing an SVG, render its PNGs again with headless Chrome's --screenshot at the exact size, passing --default-background-color=00000000 for the logos' transparency, and look at each one.
    • The palette comes from {{< palette >}}, which reads the colors that docs/data/palette.yaml lists, with each one's name and use, and takes each hex from its variable in custom.css, so the page always shows the site's colors. The build fails when a variable isn't there. A new color goes in both files.
    • The fonts each come from {{< font-sample >}}, which shows a line of text in the font, with a link to the license the site serves for it.
  • The favicon is the same mark drawn on a 16-pixel grid in docs/static/favicon.svg: the box, a lime prompt in its middle and a small lock centered on its bottom-right corner, overhanging it by 2 pixels each way, its shackle a closed arch, with the box's lines stopping a pixel short of the lock, on black, with a pixel of black around the whole mark. Hextra links its icons by name, and the ones in docs/static/ take the place of its own: favicon-16x16.png and favicon-32x32.png, favicon.ico, which holds those two PNGs, apple-touch-icon.png, which is the grid at 160px with 10px of black around it, and the two android-chrome-*.png icons that site.webmanifest lists. Each PNG is the SVG at a whole multiple of its size, so its pixels stay sharp. The social card in docs/static/images/social-card.png is the 1200x630 card that the branding page offers for links to devvm. It has devvm-logo-on-dark.svg at twice its size, the home page's headline and tagline in Departure Mono, and the site's colors. After changing the SVG or the card's text, render the PNGs again with headless Chrome's --screenshot at the image's exact size, and look at each one.
  • Social cards: every page gets a 1200x630 card of its own, which Hugo draws when it builds the site, and which sites and chat apps show when someone shares the page's link.
    • The card is docs/assets/images/og-template.png, which is social-card.png with the headline and tagline painted out in the background's black, so it has the logo, devvm.dev and the lime bar, in the same four colors and nothing else. docs/layouts/_partials/og-image.html draws three things on it with Hugo's images.Text, in Departure Mono: the page's section in lime capitals at 22px, its title in white at 66px, or at 55px or 44px when a smaller size fits it in two lines, and its explainer in gray at 33px. A docs page's section is its section's title, such as Using devvm, a section's own page has Docs, and the home page and the branding page have none. The text is centered between the logo and devvm.dev. Each size is a multiple of 11px and each line starts at a whole pixel, so the text is as sharp as the logo, and the card keeps only the template's four colors. docs/layouts/_partials/og-wrap.html wraps the lines at spaces, and because the font is monospaced, a line's width is its length.
    • The explainer is the explainer in each page's front matter: a few plain words on what the reader gets from the page, such as Install devvm and check what it needs, without a full stop. It isn't the page's description, which search engines and llms.txt show, because that's a sentence or two, and most pages have none. The home page's card shows its cardTitle, the hero's headline, in place of its title, because the logo already says devvm. The CLI reference's pages get their command's Short as their explainer when mise run cli-docs writes them. TestExplainers in internal/cli/docgen fails when a page has no explainer, or when its explainer takes more than two lines of 48 characters or its title more than two lines of 36, which are the card's lines at 33px and 44px.
    • The tags: docs/layouts/_partials/custom/head-end.html writes og:image with its type, width, height and og:image:alt, and twitter:image:alt, whose text is devvm docs, the title and the explainer. docs/layouts/_partials/_funcs/get-page-images.html takes the place of Hugo's own, which its Twitter card and schema templates call for a page's images, so twitter:image and the schema's image are the same card. hugo.yaml names no params.images, so Hextra's Open Graph template writes no second og:image. A card's address is the site's, so next.devvm.dev's pages show next.devvm.dev's cards.
  • The illustrations on the home page are SVGs in docs/assets/home/, and {{< art "name" >}} inlines one into the page, so that it gets the page's fonts and colors. A feature card's art parameter inlines one the same way, through docs/layouts/_partials/art.html. Each one is drawn on Departure Mono's 11px cell, 7 pixels wide and 14 tall, so its text and shapes are sharpest at its own size or at twice its size. The art shortcode shows it at twice its size, 728px wide. A card shows it as wide as the card, at whatever scale that takes.
    • Each card's drawing shows what its text says, and nothing more. The big cards' drawings are 364 by 140 pixels, or 168 for isolated.svg: zero-config.svg shows a dev server's forwarded port, devvm code and a commit authored by you, copies.svg the base image and its copies, isolated.svg the mount and the proxy, agents.svg the agents' mounts, the history that stays and the token, and make-it-yours.svg the stack of base, your layer and the VM, with --from. The What's supported cards' drawings are 224 by 70 pixels: toolchains.svg, coding-agents.svg and layers.svg, which shows the image docker+nix as a stack and the built-in layers beside it. The Quick start cards' drawings are terminals of 254 by 181 pixels, which a card shows at most twice their size: step-cd.svg types cd ~/some-project on your machine, step-pick.svg types devvm, shows a short version of the new VM's summary and presses enter at Customize it? [y/N], and step-agent.svg types claude in the VM's shell. Why use devvm?'s drawing, blast-radius.svg, is 364 by 210 pixels and shows the same four attacks as its text on two machines. Without devvm, they light up on your machine, and the project, ~/.aws, ~/.ssh and another project turn red one after another. With devvm, they light up in the VM, each one's path toward your machine ends at the VM's border with a cross, and your machine's folders stay as they are.
    • Every text element holds one run of characters at its own x, because Hugo's --minify removes the spaces between tspan elements. A gap of a cell is 7 pixels added to x.
    • Animations are CSS keyframes in custom.css, which classes in the SVGs turn on. pulse dims and brightens a lime arrow every 3 seconds, and pulse-2 and pulse-3 start a part of the arrow 0.3 and 0.6 seconds later, so the pulse runs along it. pulse-slow does the same every 4 seconds. lit lights a text's fill and lit-chip a chip's opacity for most of a 4-second loop, and lit-2, lit-3 and lit-4 start them 0.5, 1 and 1.5 seconds later, so they light one after another. blink turns a cursor on and off every 2 seconds. mover marks a block that travels a path, mover-token along the token's line, under the proxy and down to the API in 3 seconds, and mover-egress under the proxy, down to the allowlist and back, then out to the internet in 4 seconds. A block is drawn before the shapes it passes under. attack-1 to attack-4, path-1 to path-4 and reach-1 to reach-4 tell blast-radius.svg's story in an 8-second loop, and every part of the drawing stays in place all along, so the story only changes colours and draws lines. Each attack's chip turns from gray to lime at 0.4, 1.6, 2.8 and 4 seconds. In the VM, its path then draws itself down to the VM's border, and when it gets there, the cross at the border turns lime and, on the machine without devvm, the folder it reaches turns red. Everything holds from 5.2 seconds, and from 6.6 seconds the colours go back and the paths draw back up, so the drawing rests from 7.2 seconds until the story starts again. Each step has its own keyframes, so that all of them end together. The SVG draws each part in its end colour, and --rest in custom.css gives the colour it has before its step, so a drawing without animation shows the end of the story. The Quick start terminals each loop on their own. type marks a cover over a command, which shrinks from the right one cell at a time while caret moves the cursor along, both in --chars steps across --width, and caret-blink keeps the cursor solid while it types and makes it blink after. In step-pick.svg, pick-summary shows the summary once devvm is typed, pick-ask shows the question after it, and key lights enter as it's pressed. Their styles in custom.css are each part's end state too, and their keyframes start from the beginning. When the visitor's system asks for reduced motion, prefers-reduced-motion turns every animation off and hides the blocks.
    • To see an animation's state in a screenshot, pause the animations with a stylesheet of your own and set each class's animation-delay to minus the time you want, because headless Chrome's --virtual-time-budget barely moves CSS animations.
  • Icons are pixel icons in docs/assets/icons/, one SVG per icon. Most come from Dinkie Icons, which is MIT licensed, and the folder keeps its license and a README that names the version they were copied from. The penguin, prompt, warning and light bulb icons are drawn for devvm in the same style. {{< icon "rocket" >}} inlines one through docs/layouts/_partials/icon.html, so it takes the text's color, and the build fails when no icon has that name. An icon is 0.75em square, which makes each of its pixels one screen pixel in 16px text, and it sits on the text's baseline. Screen readers skip it, unless a second argument gives it a label, as in {{< icon "warning" "Warning" >}}, for an icon that says something the text doesn't. To add a Dinkie icon, copy its path data from the same version of the @dinkie-icons/react npm package into a new file named after the icon in kebab case, with the same svg attributes as the others. A new icon of your own uses the same 12-pixel grid and 1-pixel lines, and the README lists it.
    • Each section's icon is chosen once, in docs/data/sections.yaml, which maps a section's folder under docs/ to an icon's name, as in getting-started: rocket. A new section gets a line there. The section cards and the sidebar both read it, so they always show the same icon, and the build fails when the list names a section or an icon that doesn't exist.
    • Section cards on the docs' first page are Hextra's {{< cards >}} holding a {{< section-card path="getting-started" >}} for each section, with its one-line description inside, closed with {{< /section-card >}}. The shortcode takes the section's title and link from its page under docs/, and its icon from sections.yaml, and the build fails when there's no such page. Hextra's card takes an icon only from Hextra's own set, so the shortcode puts ours in the card's title, at 24px. It's dimmed as Hextra dims its own cards' icons, and it turns lime on hover.
    • The sidebar's top-level items show their section's icon at 12px, in the link's color, so it's gray, and lime for the section you're in. Hextra's sidebar has no icons, so docs/layouts/_partials/custom/head-end.html writes a CSS rule for each section when the site builds, keyed to the section page's address, with the icon from docs/assets/icons/ as a mask. Nothing is generated into the repo, so there's no step to rerun.
    • The OS tabs of install and os-tabs show the Apple icon before macOS and the penguin before Linux, which docs/layouts/_partials/os-tab-name.html adds to each tab's name.
    • ✓ and ✗ go before a table cell's word: {{< yes >}} yes puts a lime check before it, and {{< no >}} doesn't a gray cross. They go only in cells that are a plain yes or no, or what stands for one, such as the install script's offers it, never in cells that are sentences, and the word stays, because screen readers skip the icon. Icons in tables are 12px, because a table's text is smaller than 16px.
    • Buttons take an icon before their text: docs/layouts/_shortcodes/hextra/hero-button.html is Hextra's hero-button with an icon parameter, as in {{< hextra/hero-button text="Install" link="docs/getting-started/install/" icon="download" >}}, drawn at 24px like the headings' icons. The 404 page's two buttons have their icons in its layout, a rocket for Getting started and the open book for the docs, as the home page's Read the docs has it.
    • The navbar's GitHub link uses Dinkie's GitHub icon, which docs/data/icons.yaml adds to Hextra's own icons as dinkie-github, and hugo.yaml's menu names. Hextra's icon partial reads only that data, so an icon for the navbar goes there as its SVG, not in docs/assets/icons/.
  • Heading icons: a heading gets an icon before its text with an icon attribute, as in ## Quick start {icon="rocket"}, which the home page's section headings use. docs/layouts/_markup/render-heading.html takes the place of Hextra's heading render hook and adds the icon after Hugo makes the heading's anchor, so the anchor comes from the text alone, such as quick-start. On the home page, custom.css draws these icons in lime at 24px, so each icon pixel is two screen pixels, as each of Departure Mono's pixels is at 22px.
  • Callouts are GitHub's alerts: a blockquote whose first line is [!NOTE], [!TIP] or [!WARNING], which GitHub shows the same way. docs/layouts/_markup/render-blockquote-alert.html takes the place of Hextra's alerts and draws each one on the surface color with a line down its left side, and a title with its icon: information-circled in blue for a note, the light bulb in the soft lime for a tip, and warning in lime for a warning. Any other type fails the build. Hextra's own callout shortcode isn't used. Use a callout only for a real warning, such as what the VM's boundary rests on, or a tip that saves the reader trouble, such as keeping a VM on a strict tier, and move the sentence into it instead of repeating it.
  • For agents and other tools that read the site, hugo.yaml turns on three things that Hextra has. The site's root has llms.txt, which lists every section and its pages. Each page has a Markdown copy beside its HTML, such as /docs/using/clone.md beside /docs/using/clone/, and a section's copy is index.md in its folder, such as /docs/using/index.md. Each docs page has a Copy page menu beside its title, which copies the page's Markdown or opens it. hugo.yaml lists every output for the home page, the sections and the pages, so the home page and the sections keep their RSS feeds, and the search index is built apart from these outputs.
    • llms.txt comes from docs/layouts/llms.txt, which takes the place of Hextra's. It has the site's title and description, then each section under its title, with the section's own page first and its pages after it. Each one is a link to its Markdown copy, as the llms.txt convention prefers, which docs/layouts/_partials/llms-link.txt writes, and a line of plain text, which docs/layouts/_partials/llms-summary.txt writes. A page without a copy gets a link to its HTML page instead. The line is the page's description from its front matter when it has one, and otherwise its first paragraph, cut at 200 characters. A description is also the page's description for search engines and link previews, so give a page one when its first paragraph doesn't say what the page covers, as Coding agents has. llms.txt also lists the CLI reference, with each command's one-line summary.
    • The Markdown copies come from docs/layouts/page.markdown.md and section.markdown.md, which take the place of Hextra's and both use docs/layouts/_partials/markdown-copy.md. A copy is the page's title as a heading, then its Markdown with its shortcodes rendered. In a copy, a link to a section's _index.md points at index.md, the section copy's name, so the links work between the copies, and a link written in code stays as it is.
    • Each shortcode that docs pages use has a Markdown version beside its HTML one in docs/layouts/_shortcodes/, named after it with .markdown.md, which renders it in the copies. install writes each system's name in bold, then its commands, which come from docs/layouts/_partials/install-tabs.html, the same partial its tabs use. os-tabs writes its tabs the same way, through docs/layouts/_partials/os-sections.md. section-card makes a list item that links the section's copy, and Hextra's cards keeps only what's inside it. yes and no become ✓ and ✗. A shortcode without a Markdown version puts its HTML into the copy.
    • The home page and the branding page are mostly shortcodes, and neither layout shows the menu. hugo.yaml gives the home page no Markdown copy, and its front matter sets contextMenu: false. The branding page's front matter sets outputs: [html], contextMenu: false and llms: false, so it has no copy, no menu and no line in llms.txt. Any other page can set llms: false to stay out of llms.txt, or contextMenu: false to have no menu.
    • After you add a page or a shortcode, build the site and read the page's line in llms.txt and its Markdown copy. The line should say what the page covers, and the copy should have no shortcode left in it, such as {{< os-tabs >}}, and no HTML from one. A shortcode that docs pages use gets its Markdown version. To try the menu, serve the site with mise run docs and open a docs page. custom.css gives the menu the site's border and secondary text, lime on hover, and its list the surface color.
  • The 404 page is docs/layouts/404.html, which takes the place of Hextra's and uses the site's navbar and footer. It shows a VM's terminal answering cd ./this-page with "no such page", drawn like the home page's art in docs/assets/home/not-found.svg with the blink cursor, then Hextra's search box and links to Getting started and the docs. Build the site and open /404.html to see it.

mise run lint:docs, which mise run lint includes, checks docs/ with:

Linter Checks Config
markdownlint-cli2 Markdown .markdownlint-cli2.yaml
Vale the style rules .vale.ini, .vale/styles/devvm/
lychee (--offline) links to pages and files

It also builds the site with Hugo's --panicOnWarning, into a temporary folder it removes, so any warning fails it. That includes a deprecation, such as a template that reads site.Data where Hugo wants hugo.Data, so a Hugo upgrade that deprecates something the templates use fails here before the feature is removed. It runs TestExplainers too, so a page without an explainer fails it, and TestUserPageProse (internal/cli/docgen/prose_test.go), which holds the user pages to lead with doing: it fails a run of three or more paragraphs back to back where two are over 80 words, and any paragraph or list item over 150 words. It counts words as scan.sh does, a code span as one word and a link by its text, and a paragraph of 40 words or fewer that ends with a colon introduces what follows, so it isn't in a run. proseExempt names the pages that another branch is rewriting, each with why, until that branch lands. TestChangelogShape (internal/cli/docgen/changelog_test.go) holds CHANGELOG.md to the shape that Releasing gives an entry, and TestChangelogProblems checks that each of its rules fails an entry that breaks it.

The CLI reference

The CLI reference in docs/content/docs/cli/ is generated from devvm's commands with Cobra's docs generator, and checked in. Don't edit it: change the command's Use, Short, Long, Example or flags, or its docs page in internal/msg/docs.go, then run:

mise run cli-docs

It runs internal/cli/docgen, which replaces every page in that folder: _index.md, listing the commands, and a page per command named after its path (devvm_build.md), with title and explainer front matter, the explainer being the command's Short, and links to the other pages as files. Each page has the command's examples, and a Docs section before See also that links to the command's docs page on the site. Hidden commands (_msg, _qemu) and Cobra's help command are left out. The pages carry no dates, so the same commands give the same files. They carry no weight either, so Hugo sorts the section by title, and a new command adds its own page and changes only _index.md and the root's devvm.md; TestPagesHaveNoWeight checks this. The .gitattributes file marks the pages as generated, so GitHub collapses them in a diff.

mise run cli-docs also writes the generated blocks of hand-written pages, which cli.DocBlocks in internal/cli/docblocks.go lists: the Supported agents table in using/coding-agents.md, and the README's list of the agents. Each block sits between two HTML comments that name it, and docgen replaces only the text between them, from the registry of agents, agents.Defs, and each agent's policy in assets/shared-tools/. So don't edit a block by hand: change the agent's Def, its Docs included, or its policy, then run mise run cli-docs.

A command's help

Every command's help, which its reference page also shows, has the same shape. Short is an action in sentence case without a full stop, such as List the project VMs. Long is one to three short sentences on what the command does, and the rules and edge cases go on its docs page. Example comes from examples in internal/cli/help.go, which takes each command line with a short comment and lines the comments up, the most common invocation first. A flag's description is short, and its long explanation goes on the page.

Each command describes itself where it's made, so its docs page and group are in its own file, not in tables elsewhere. Its Annotations come from an about in internal/cli/help.go: docs, the user page that covers it as page#anchor; group, its section of the root's help; and noJSON, why a command without --json has none. addDocs gives the root Cobra's usage template with a Docs section at the end, which shows the address of the command's page, and the root's help also ends with the issue tracker, msg.IssuesURL. The CLI reference links each command's page too, and TestDocLinks in internal/msg reads those links from the reference and checks that each page and heading exists and is a user page. helpGroups in the same file lists the root's sections, in order, and addGroups adds each group that has a command and sets its commands' GroupID, so a group whose commands don't exist yet stays out of the help. A subcommand can name a group too, such as layer add in Change your VM, when it belongs in another group than its parent. addGroups then adds that group to the parent, so the parent's own help groups its subcommands the same way, and the usage template lists the subcommand by both names in the root's group, after the group's own commands. Cobra lists a group's commands in alphabetical order, and help goes in Cobra's own Additional Commands.

The tests fail when the checked-in pages are stale: TestReferenceIsCurrent in internal/cli/docgen generates the reference into a temporary folder and compares it with docs/content/docs/cli/, and it checks each generated block against its page too, which TestStaleBlockIsCaught proves it catches. mise run docs regenerates it before serving the site.

Building the site

mise run docs draws the diagrams, then serves the site at http://localhost:1313/ and reloads on every change except a diagram's, which needs mise run docs:diagrams again. After you run mise run docs:diagrams, mise exec -- hugo -s docs --minify builds the site into docs/public/, as the Docs workflow does for devvm.dev, and mise exec -- hugo -s docs --minify --config hugo.yaml,next.yaml builds the site as next.devvm.dev has it, with its banner and its noindex (the docs sites).