diff --git a/docs/assets/fonts/departure-mono/DepartureMono-Regular.otf b/docs/assets/fonts/departure-mono/DepartureMono-Regular.otf new file mode 100644 index 00000000..e0b25021 Binary files /dev/null and b/docs/assets/fonts/departure-mono/DepartureMono-Regular.otf differ diff --git a/docs/assets/fonts/departure-mono/LICENSE b/docs/assets/fonts/departure-mono/LICENSE new file mode 100644 index 00000000..de524761 --- /dev/null +++ b/docs/assets/fonts/departure-mono/LICENSE @@ -0,0 +1,93 @@ +Copyright 2022–2024 Helena Zhang (helenazhang.com). + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/docs/assets/images/og-template.png b/docs/assets/images/og-template.png new file mode 100644 index 00000000..23cc92bd Binary files /dev/null and b/docs/assets/images/og-template.png differ diff --git a/docs/content/_index.md b/docs/content/_index.md index e6d46c00..090db266 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -1,5 +1,8 @@ --- title: devvm +# The social card's title (layouts/_partials/og-image.html): the hero's headline, as the logo says devvm. +cardTitle: One VM for every project +explainer: An isolated sandbox for you or a coding agent layout: hextra-home # Mostly shortcodes: no Copy page menu (hugo.yaml gives the home page no Markdown copy). contextMenu: false diff --git a/docs/content/branding.md b/docs/content/branding.md index caf54466..93f49f06 100644 --- a/docs/content/branding.md +++ b/docs/content/branding.md @@ -1,5 +1,6 @@ --- title: Branding +explainer: devvm's logo, icons, colors and fonts layout: branding description: "devvm's logo, icons, social card, colors and fonts, to download and use when you write about devvm." sidebar: @@ -46,7 +47,7 @@ The app icon at any size, and the icons the site uses for browser tabs and home ## The social card -The image that sites and chat apps show with a link to devvm.dev: +The image to show with a link to devvm. Sites and chat apps show each page of devvm.dev with a card of its own in the same style, which has the page's section, its title and a line on what it covers. {{< brand-assets wide="true" >}} {{< brand-asset title="Social card, 1200 by 630" src="images/social-card.png" bg="dark" alt="The devvm social card: the logo, One VM for every project, and the tagline" files="images/social-card.png" >}} diff --git a/docs/content/docs/_index.md b/docs/content/docs/_index.md index 2dc23e59..435cee21 100644 --- a/docs/content/docs/_index.md +++ b/docs/content/docs/_index.md @@ -1,5 +1,6 @@ --- title: Docs +explainer: The guides, in the order you'll need them --- The docs are in the order you'll need them: getting devvm running, using it day to day, staying safe and choosing a backend, then every command, how devvm works and how to change it. diff --git a/docs/content/docs/backends/_index.md b/docs/content/docs/backends/_index.md index d003ae4c..f737bf1c 100644 --- a/docs/content/docs/backends/_index.md +++ b/docs/content/docs/backends/_index.md @@ -1,5 +1,6 @@ --- title: Backends +explainer: The program that runs devvm's VMs weight: 40 --- diff --git a/docs/content/docs/backends/lima.md b/docs/content/docs/backends/lima.md index e5663ff0..1515c141 100644 --- a/docs/content/docs/backends/lima.md +++ b/docs/content/docs/backends/lima.md @@ -1,5 +1,6 @@ --- title: Lima +explainer: What Lima needs, and how devvm uses it weight: 1 --- diff --git a/docs/content/docs/cli/_index.md b/docs/content/docs/cli/_index.md index 28e93a12..7e994ea2 100644 --- a/docs/content/docs/cli/_index.md +++ b/docs/content/docs/cli/_index.md @@ -1,6 +1,7 @@ --- title: CLI reference weight: 90 +explainer: Every devvm command, with its arguments and flags --- Every devvm command, with its arguments and flags. `devvm --help` prints the same. diff --git a/docs/content/docs/cli/devvm.md b/docs/content/docs/cli/devvm.md index 6607d99b..0d9e0e1b 100644 --- a/docs/content/docs/cli/devvm.md +++ b/docs/content/docs/cli/devvm.md @@ -1,6 +1,7 @@ --- title: devvm weight: 1 +explainer: "Open a shell in this folder's VM, creating it first" --- Open a shell in this folder's VM, creating it first diff --git a/docs/content/docs/cli/devvm_adopt.md b/docs/content/docs/cli/devvm_adopt.md index 72b3bcec..bcefc725 100644 --- a/docs/content/docs/cli/devvm_adopt.md +++ b/docs/content/docs/cli/devvm_adopt.md @@ -1,6 +1,7 @@ --- title: devvm adopt weight: 2 +explainer: "Give this folder the VM made for an earlier folder or path" --- Give this folder the VM made for an earlier folder or path diff --git a/docs/content/docs/cli/devvm_agent.md b/docs/content/docs/cli/devvm_agent.md index bb6a941a..a67fa807 100644 --- a/docs/content/docs/cli/devvm_agent.md +++ b/docs/content/docs/cli/devvm_agent.md @@ -1,6 +1,7 @@ --- title: devvm agent weight: 3 +explainer: "Fill devvm's store of the agents' settings and logins that every VM gets" --- Fill devvm's store of the agents' settings and logins that every VM gets diff --git a/docs/content/docs/cli/devvm_agent_import.md b/docs/content/docs/cli/devvm_agent_import.md index 6e19c1c9..d30dc009 100644 --- a/docs/content/docs/cli/devvm_agent_import.md +++ b/docs/content/docs/cli/devvm_agent_import.md @@ -1,6 +1,7 @@ --- title: devvm agent import weight: 4 +explainer: "Copy the agents' settings and logins from this machine into devvm's store" --- Copy the agents' settings and logins from this machine into devvm's store diff --git a/docs/content/docs/cli/devvm_agent_login.md b/docs/content/docs/cli/devvm_agent_login.md index 6027ca9c..d5febf05 100644 --- a/docs/content/docs/cli/devvm_agent_login.md +++ b/docs/content/docs/cli/devvm_agent_login.md @@ -1,6 +1,7 @@ --- title: devvm agent login weight: 5 +explainer: "Log an agent in, in this folder's VM, and save the login in devvm's store" --- Log an agent in, in this folder's VM, and save the login in devvm's store diff --git a/docs/content/docs/cli/devvm_agent_save.md b/docs/content/docs/cli/devvm_agent_save.md index e6d54f5b..4af69d80 100644 --- a/docs/content/docs/cli/devvm_agent_save.md +++ b/docs/content/docs/cli/devvm_agent_save.md @@ -1,6 +1,7 @@ --- title: devvm agent save weight: 6 +explainer: "Copy the agents' settings from this folder's VM into devvm's store" --- Copy the agents' settings from this folder's VM into devvm's store diff --git a/docs/content/docs/cli/devvm_build.md b/docs/content/docs/cli/devvm_build.md index 0c91822b..41c72458 100644 --- a/docs/content/docs/cli/devvm_build.md +++ b/docs/content/docs/cli/devvm_build.md @@ -1,6 +1,7 @@ --- title: devvm build weight: 7 +explainer: "Build an image and the images under it, unless they're built" --- Build an image and the images under it, unless they're built diff --git a/docs/content/docs/cli/devvm_clone.md b/docs/content/docs/cli/devvm_clone.md index 797df9dc..5a6b2d95 100644 --- a/docs/content/docs/cli/devvm_clone.md +++ b/docs/content/docs/cli/devvm_clone.md @@ -1,6 +1,7 @@ --- title: devvm clone weight: 8 +explainer: "Show or change whether this folder's VM has its own clone of the repo" --- Show or change whether this folder's VM has its own clone of the repo diff --git a/docs/content/docs/cli/devvm_code.md b/docs/content/docs/cli/devvm_code.md index 5847c67f..9d237de0 100644 --- a/docs/content/docs/cli/devvm_code.md +++ b/docs/content/docs/cli/devvm_code.md @@ -1,6 +1,7 @@ --- title: devvm code weight: 9 +explainer: "Open this folder's VM in VS Code over Remote-SSH" --- Open this folder's VM in VS Code over Remote-SSH diff --git a/docs/content/docs/cli/devvm_completion.md b/docs/content/docs/cli/devvm_completion.md index 38ac609b..78ef8582 100644 --- a/docs/content/docs/cli/devvm_completion.md +++ b/docs/content/docs/cli/devvm_completion.md @@ -1,6 +1,7 @@ --- title: devvm completion weight: 10 +explainer: "Print the shell completion script for bash, zsh or fish" --- Print the shell completion script for bash, zsh or fish diff --git a/docs/content/docs/cli/devvm_desktop.md b/docs/content/docs/cli/devvm_desktop.md index 154db59a..0166dfa9 100644 --- a/docs/content/docs/cli/devvm_desktop.md +++ b/docs/content/docs/cli/devvm_desktop.md @@ -1,6 +1,7 @@ --- title: devvm desktop weight: 11 +explainer: "Open this folder's VM's desktop in a VNC viewer" --- Open this folder's VM's desktop in a VNC viewer diff --git a/docs/content/docs/cli/devvm_doctor.md b/docs/content/docs/cli/devvm_doctor.md index 4d76a9f1..f47ce02f 100644 --- a/docs/content/docs/cli/devvm_doctor.md +++ b/docs/content/docs/cli/devvm_doctor.md @@ -1,6 +1,7 @@ --- title: devvm doctor weight: 12 +explainer: "Check what devvm needs on this machine" --- Check what devvm needs on this machine diff --git a/docs/content/docs/cli/devvm_gc.md b/docs/content/docs/cli/devvm_gc.md index 54c305a7..435a4f3e 100644 --- a/docs/content/docs/cli/devvm_gc.md +++ b/docs/content/docs/cli/devvm_gc.md @@ -1,6 +1,7 @@ --- title: devvm gc weight: 13 +explainer: "Delete stale images, unused tools, old files and the Nix cache over its cap" --- Delete stale images, unused tools, old files and the Nix cache over its cap diff --git a/docs/content/docs/cli/devvm_git-protect.md b/docs/content/docs/cli/devvm_git-protect.md index 0ed13dc3..cd14a141 100644 --- a/docs/content/docs/cli/devvm_git-protect.md +++ b/docs/content/docs/cli/devvm_git-protect.md @@ -1,6 +1,7 @@ --- title: devvm git-protect weight: 14 +explainer: "Show or change .git protection for this folder's VM" --- Show or change .git protection for this folder's VM diff --git a/docs/content/docs/cli/devvm_group.md b/docs/content/docs/cli/devvm_group.md index b0b1cfed..cfb9161e 100644 --- a/docs/content/docs/cli/devvm_group.md +++ b/docs/content/docs/cli/devvm_group.md @@ -1,6 +1,7 @@ --- title: devvm group weight: 15 +explainer: "Show the group this folder's VM is in" --- Show the group this folder's VM is in diff --git a/docs/content/docs/cli/devvm_group_join.md b/docs/content/docs/cli/devvm_group_join.md index 1444a4ac..c41fb546 100644 --- a/docs/content/docs/cli/devvm_group_join.md +++ b/docs/content/docs/cli/devvm_group_join.md @@ -1,6 +1,7 @@ --- title: devvm group join weight: 16 +explainer: "Put this folder's VM in a group of VMs" --- Put this folder's VM in a group of VMs diff --git a/docs/content/docs/cli/devvm_group_leave.md b/docs/content/docs/cli/devvm_group_leave.md index eade435b..d855cec9 100644 --- a/docs/content/docs/cli/devvm_group_leave.md +++ b/docs/content/docs/cli/devvm_group_leave.md @@ -1,6 +1,7 @@ --- title: devvm group leave weight: 17 +explainer: "Take this folder's VM out of its group" --- Take this folder's VM out of its group diff --git a/docs/content/docs/cli/devvm_history.md b/docs/content/docs/cli/devvm_history.md index ce29e267..348ca09c 100644 --- a/docs/content/docs/cli/devvm_history.md +++ b/docs/content/docs/cli/devvm_history.md @@ -1,6 +1,7 @@ --- title: devvm history weight: 18 +explainer: "List the saved exports of agents' history" --- List the saved exports of agents' history diff --git a/docs/content/docs/cli/devvm_history_export.md b/docs/content/docs/cli/devvm_history_export.md index 6202ce11..9787d594 100644 --- a/docs/content/docs/cli/devvm_history_export.md +++ b/docs/content/docs/cli/devvm_history_export.md @@ -1,6 +1,7 @@ --- title: devvm history export weight: 19 +explainer: "Save this folder's VM's agent history to a .tar.gz" --- Save this folder's VM's agent history to a .tar.gz diff --git a/docs/content/docs/cli/devvm_history_import.md b/docs/content/docs/cli/devvm_history_import.md index 81e3a151..400242aa 100644 --- a/docs/content/docs/cli/devvm_history_import.md +++ b/docs/content/docs/cli/devvm_history_import.md @@ -1,6 +1,7 @@ --- title: devvm history import weight: 20 +explainer: "Put an export of agent history into this folder's VM" --- Put an export of agent history into this folder's VM diff --git a/docs/content/docs/cli/devvm_host.md b/docs/content/docs/cli/devvm_host.md index cfd23072..ec796711 100644 --- a/docs/content/docs/cli/devvm_host.md +++ b/docs/content/docs/cli/devvm_host.md @@ -1,6 +1,7 @@ --- title: devvm host weight: 21 +explainer: "Get this folder's VM ready for ssh and editors, and show its host name" --- Get this folder's VM ready for ssh and editors, and show its host name diff --git a/docs/content/docs/cli/devvm_images.md b/docs/content/docs/cli/devvm_images.md index 6e819133..0664b2f3 100644 --- a/docs/content/docs/cli/devvm_images.md +++ b/docs/content/docs/cli/devvm_images.md @@ -1,6 +1,7 @@ --- title: devvm images weight: 22 +explainer: "List the images and the shared tools" --- List the images and the shared tools diff --git a/docs/content/docs/cli/devvm_images_rm.md b/docs/content/docs/cli/devvm_images_rm.md index e1701640..93f9b1ba 100644 --- a/docs/content/docs/cli/devvm_images_rm.md +++ b/docs/content/docs/cli/devvm_images_rm.md @@ -1,6 +1,7 @@ --- title: devvm images rm weight: 23 +explainer: "Delete images, by name or by key" --- Delete images, by name or by key diff --git a/docs/content/docs/cli/devvm_layer.md b/docs/content/docs/cli/devvm_layer.md index c008c424..1155f9a9 100644 --- a/docs/content/docs/cli/devvm_layer.md +++ b/docs/content/docs/cli/devvm_layer.md @@ -1,6 +1,7 @@ --- title: devvm layer weight: 24 +explainer: "Make image layers of your own, or change this folder's VM's layers" --- Make image layers of your own, or change this folder's VM's layers diff --git a/docs/content/docs/cli/devvm_layer_add.md b/docs/content/docs/cli/devvm_layer_add.md index 51aa1aca..9a452d3c 100644 --- a/docs/content/docs/cli/devvm_layer_add.md +++ b/docs/content/docs/cli/devvm_layer_add.md @@ -1,6 +1,7 @@ --- title: devvm layer add weight: 25 +explainer: "Make this folder's VM again with more layers, then open a shell in it" --- Make this folder's VM again with more layers, then open a shell in it diff --git a/docs/content/docs/cli/devvm_layer_new.md b/docs/content/docs/cli/devvm_layer_new.md index 775aff6e..c795db61 100644 --- a/docs/content/docs/cli/devvm_layer_new.md +++ b/docs/content/docs/cli/devvm_layer_new.md @@ -1,6 +1,7 @@ --- title: devvm layer new weight: 26 +explainer: "Start a layer of your own" --- Start a layer of your own diff --git a/docs/content/docs/cli/devvm_layer_rm.md b/docs/content/docs/cli/devvm_layer_rm.md index d8520b60..c89f6694 100644 --- a/docs/content/docs/cli/devvm_layer_rm.md +++ b/docs/content/docs/cli/devvm_layer_rm.md @@ -1,6 +1,7 @@ --- title: devvm layer rm weight: 27 +explainer: "Make this folder's VM again without some of its layers, then open a shell in it" --- Make this folder's VM again without some of its layers, then open a shell in it diff --git a/docs/content/docs/cli/devvm_limactl.md b/docs/content/docs/cli/devvm_limactl.md index d8816586..bda9adac 100644 --- a/docs/content/docs/cli/devvm_limactl.md +++ b/docs/content/docs/cli/devvm_limactl.md @@ -1,6 +1,7 @@ --- title: devvm limactl weight: 28 +explainer: "Run Lima's limactl for debugging, which starts VMs unconfined, whatever their tier" --- Run Lima's limactl for debugging, which starts VMs unconfined, whatever their tier diff --git a/docs/content/docs/cli/devvm_link.md b/docs/content/docs/cli/devvm_link.md index 595ec2dc..4e8605e6 100644 --- a/docs/content/docs/cli/devvm_link.md +++ b/docs/content/docs/cli/devvm_link.md @@ -1,6 +1,7 @@ --- title: devvm link weight: 29 +explainer: "List this folder's VM's links to your other VMs" --- List this folder's VM's links to your other VMs diff --git a/docs/content/docs/cli/devvm_link_add.md b/docs/content/docs/cli/devvm_link_add.md index f610ba0e..511ebda4 100644 --- a/docs/content/docs/cli/devvm_link_add.md +++ b/docs/content/docs/cli/devvm_link_add.md @@ -1,6 +1,7 @@ --- title: devvm link add weight: 30 +explainer: "Link this folder's VM to a port of another VM" --- Link this folder's VM to a port of another VM diff --git a/docs/content/docs/cli/devvm_link_publish.md b/docs/content/docs/cli/devvm_link_publish.md index 2d7b3a99..0d6a37c8 100644 --- a/docs/content/docs/cli/devvm_link_publish.md +++ b/docs/content/docs/cli/devvm_link_publish.md @@ -1,6 +1,7 @@ --- title: devvm link publish weight: 31 +explainer: "Show or add the ports this folder's VM offers to links" --- Show or add the ports this folder's VM offers to links diff --git a/docs/content/docs/cli/devvm_link_rm.md b/docs/content/docs/cli/devvm_link_rm.md index d891f3d5..a3ee17c6 100644 --- a/docs/content/docs/cli/devvm_link_rm.md +++ b/docs/content/docs/cli/devvm_link_rm.md @@ -1,6 +1,7 @@ --- title: devvm link rm weight: 32 +explainer: "Remove one of this folder's VM's links" --- Remove one of this folder's VM's links diff --git a/docs/content/docs/cli/devvm_link_unpublish.md b/docs/content/docs/cli/devvm_link_unpublish.md index 22286058..f45bb3f9 100644 --- a/docs/content/docs/cli/devvm_link_unpublish.md +++ b/docs/content/docs/cli/devvm_link_unpublish.md @@ -1,6 +1,7 @@ --- title: devvm link unpublish weight: 33 +explainer: "Stop offering ports of this folder's VM to links" --- Stop offering ports of this folder's VM to links diff --git a/docs/content/docs/cli/devvm_ls.md b/docs/content/docs/cli/devvm_ls.md index 5b534403..ff7b5259 100644 --- a/docs/content/docs/cli/devvm_ls.md +++ b/docs/content/docs/cli/devvm_ls.md @@ -1,6 +1,7 @@ --- title: devvm ls weight: 34 +explainer: "List the project VMs" --- List the project VMs diff --git a/docs/content/docs/cli/devvm_network.md b/docs/content/docs/cli/devvm_network.md index 2eae3da7..7863c8d7 100644 --- a/docs/content/docs/cli/devvm_network.md +++ b/docs/content/docs/cli/devvm_network.md @@ -1,6 +1,7 @@ --- title: devvm network weight: 35 +explainer: "Show or change the network tier of this folder's VM" --- Show or change the network tier of this folder's VM diff --git a/docs/content/docs/cli/devvm_network_allow.md b/docs/content/docs/cli/devvm_network_allow.md index d9967d79..caffbd05 100644 --- a/docs/content/docs/cli/devvm_network_allow.md +++ b/docs/content/docs/cli/devvm_network_allow.md @@ -1,6 +1,7 @@ --- title: devvm network allow weight: 36 +explainer: "Allow hosts for this folder's VM" --- Allow hosts for this folder's VM diff --git a/docs/content/docs/cli/devvm_network_deny.md b/docs/content/docs/cli/devvm_network_deny.md index a1bca583..0214dc1c 100644 --- a/docs/content/docs/cli/devvm_network_deny.md +++ b/docs/content/docs/cli/devvm_network_deny.md @@ -1,6 +1,7 @@ --- title: devvm network deny weight: 37 +explainer: "Deny hosts for this folder's VM" --- Deny hosts for this folder's VM diff --git a/docs/content/docs/cli/devvm_network_log.md b/docs/content/docs/cli/devvm_network_log.md index 9c90a5a9..bdddc0c1 100644 --- a/docs/content/docs/cli/devvm_network_log.md +++ b/docs/content/docs/cli/devvm_network_log.md @@ -1,6 +1,7 @@ --- title: devvm network log weight: 38 +explainer: "Show what this folder's VM connected to and what its proxy blocked" --- Show what this folder's VM connected to and what its proxy blocked diff --git a/docs/content/docs/cli/devvm_network_rm.md b/docs/content/docs/cli/devvm_network_rm.md index 527e6254..bd0df758 100644 --- a/docs/content/docs/cli/devvm_network_rm.md +++ b/docs/content/docs/cli/devvm_network_rm.md @@ -1,6 +1,7 @@ --- title: devvm network rm weight: 39 +explainer: "Remove rules from this folder's VM" --- Remove rules from this folder's VM diff --git a/docs/content/docs/cli/devvm_ports.md b/docs/content/docs/cli/devvm_ports.md index 7819481e..66476209 100644 --- a/docs/content/docs/cli/devvm_ports.md +++ b/docs/content/docs/cli/devvm_ports.md @@ -1,6 +1,7 @@ --- title: devvm ports weight: 40 +explainer: "Show or change which ports this folder's VM forwards" --- Show or change which ports this folder's VM forwards diff --git a/docs/content/docs/cli/devvm_ports_add.md b/docs/content/docs/cli/devvm_ports_add.md index d5e2ce9d..3291bef1 100644 --- a/docs/content/docs/cli/devvm_ports_add.md +++ b/docs/content/docs/cli/devvm_ports_add.md @@ -1,6 +1,7 @@ --- title: devvm ports add weight: 41 +explainer: "Forward more ports from this folder's VM" --- Forward more ports from this folder's VM diff --git a/docs/content/docs/cli/devvm_ports_rm.md b/docs/content/docs/cli/devvm_ports_rm.md index 9bd14953..f4ff04b8 100644 --- a/docs/content/docs/cli/devvm_ports_rm.md +++ b/docs/content/docs/cli/devvm_ports_rm.md @@ -1,6 +1,7 @@ --- title: devvm ports rm weight: 42 +explainer: "Stop forwarding some ports from this folder's VM" --- Stop forwarding some ports from this folder's VM diff --git a/docs/content/docs/cli/devvm_rebuild.md b/docs/content/docs/cli/devvm_rebuild.md index b58185cf..6312af29 100644 --- a/docs/content/docs/cli/devvm_rebuild.md +++ b/docs/content/docs/cli/devvm_rebuild.md @@ -1,6 +1,7 @@ --- title: devvm rebuild weight: 43 +explainer: "Build an image again, and delete the old one" --- Build an image again, and delete the old one diff --git a/docs/content/docs/cli/devvm_restart.md b/docs/content/docs/cli/devvm_restart.md index 160e68e3..2d17a3c5 100644 --- a/docs/content/docs/cli/devvm_restart.md +++ b/docs/content/docs/cli/devvm_restart.md @@ -1,6 +1,7 @@ --- title: devvm restart weight: 44 +explainer: "Restart this folder's VM and open a shell in it" --- Restart this folder's VM and open a shell in it diff --git a/docs/content/docs/cli/devvm_retention.md b/docs/content/docs/cli/devvm_retention.md index 9076b5ba..0d7009ca 100644 --- a/docs/content/docs/cli/devvm_retention.md +++ b/docs/content/docs/cli/devvm_retention.md @@ -1,6 +1,7 @@ --- title: devvm retention weight: 45 +explainer: "Show or change what devvm deletes on its own" --- Show or change what devvm deletes on its own diff --git a/docs/content/docs/cli/devvm_rm.md b/docs/content/docs/cli/devvm_rm.md index da8175ea..16530c42 100644 --- a/docs/content/docs/cli/devvm_rm.md +++ b/docs/content/docs/cli/devvm_rm.md @@ -1,6 +1,7 @@ --- title: devvm rm weight: 46 +explainer: "Delete this folder's VM, or a VM whose folder is gone" --- Delete this folder's VM, or a VM whose folder is gone diff --git a/docs/content/docs/cli/devvm_secret.md b/docs/content/docs/cli/devvm_secret.md index 122bf208..eb475ec1 100644 --- a/docs/content/docs/cli/devvm_secret.md +++ b/docs/content/docs/cli/devvm_secret.md @@ -1,6 +1,7 @@ --- title: devvm secret weight: 47 +explainer: "List the secrets kept on this machine, for VMs to use" --- List the secrets kept on this machine, for VMs to use diff --git a/docs/content/docs/cli/devvm_secret_rm.md b/docs/content/docs/cli/devvm_secret_rm.md index 6137bd25..a5474549 100644 --- a/docs/content/docs/cli/devvm_secret_rm.md +++ b/docs/content/docs/cli/devvm_secret_rm.md @@ -1,6 +1,7 @@ --- title: devvm secret rm weight: 48 +explainer: "Delete a saved secret" --- Delete a saved secret diff --git a/docs/content/docs/cli/devvm_secret_set.md b/docs/content/docs/cli/devvm_secret_set.md index 7bfd084e..dd0ac3c4 100644 --- a/docs/content/docs/cli/devvm_secret_set.md +++ b/docs/content/docs/cli/devvm_secret_set.md @@ -1,6 +1,7 @@ --- title: devvm secret set weight: 49 +explainer: "Save a secret on this machine" --- Save a secret on this machine diff --git a/docs/content/docs/cli/devvm_secret_unuse.md b/docs/content/docs/cli/devvm_secret_unuse.md index 4dcf8561..f53d5124 100644 --- a/docs/content/docs/cli/devvm_secret_unuse.md +++ b/docs/content/docs/cli/devvm_secret_unuse.md @@ -1,6 +1,7 @@ --- title: devvm secret unuse weight: 50 +explainer: "Stop this folder's VM using a secret" --- Stop this folder's VM using a secret diff --git a/docs/content/docs/cli/devvm_secret_use.md b/docs/content/docs/cli/devvm_secret_use.md index 75992447..361d90a8 100644 --- a/docs/content/docs/cli/devvm_secret_use.md +++ b/docs/content/docs/cli/devvm_secret_use.md @@ -1,6 +1,7 @@ --- title: devvm secret use weight: 51 +explainer: "Let this folder's VM use a secret" --- Let this folder's VM use a secret diff --git a/docs/content/docs/cli/devvm_setup.md b/docs/content/docs/cli/devvm_setup.md index a3981ffc..de4de215 100644 --- a/docs/content/docs/cli/devvm_setup.md +++ b/docs/content/docs/cli/devvm_setup.md @@ -1,6 +1,7 @@ --- title: devvm setup weight: 52 +explainer: "Choose base's features, and new VMs' size, network tier, coding agents and layers" --- Choose base's features, and new VMs' size, network tier, coding agents and layers diff --git a/docs/content/docs/cli/devvm_size.md b/docs/content/docs/cli/devvm_size.md index 1f77956e..b5bfe4b9 100644 --- a/docs/content/docs/cli/devvm_size.md +++ b/docs/content/docs/cli/devvm_size.md @@ -1,6 +1,7 @@ --- title: devvm size weight: 53 +explainer: "Show or change this folder's VM's size" --- Show or change this folder's VM's size diff --git a/docs/content/docs/cli/devvm_space.md b/docs/content/docs/cli/devvm_space.md index a8995c06..f50f4c8f 100644 --- a/docs/content/docs/cli/devvm_space.md +++ b/docs/content/docs/cli/devvm_space.md @@ -1,6 +1,7 @@ --- title: devvm space weight: 54 +explainer: "Show what devvm keeps on this machine and the space it takes" --- Show what devvm keeps on this machine and the space it takes diff --git a/docs/content/docs/cli/devvm_ssh-agent.md b/docs/content/docs/cli/devvm_ssh-agent.md index a1ee781a..b681a44c 100644 --- a/docs/content/docs/cli/devvm_ssh-agent.md +++ b/docs/content/docs/cli/devvm_ssh-agent.md @@ -1,6 +1,7 @@ --- title: devvm ssh-agent weight: 55 +explainer: "Show or change SSH agent forwarding for this folder's VM" --- Show or change SSH agent forwarding for this folder's VM diff --git a/docs/content/docs/cli/devvm_ssh-agent_add.md b/docs/content/docs/cli/devvm_ssh-agent_add.md index edc4b288..216dacff 100644 --- a/docs/content/docs/cli/devvm_ssh-agent_add.md +++ b/docs/content/docs/cli/devvm_ssh-agent_add.md @@ -1,6 +1,7 @@ --- title: devvm ssh-agent add weight: 56 +explainer: "Load a key into devvm's own SSH agent" --- Load a key into devvm's own SSH agent diff --git a/docs/content/docs/cli/devvm_ssh-agent_rm.md b/docs/content/docs/cli/devvm_ssh-agent_rm.md index aae5ce56..dc02f7d2 100644 --- a/docs/content/docs/cli/devvm_ssh-agent_rm.md +++ b/docs/content/docs/cli/devvm_ssh-agent_rm.md @@ -1,6 +1,7 @@ --- title: devvm ssh-agent rm weight: 57 +explainer: "Remove a key from devvm's own SSH agent" --- Remove a key from devvm's own SSH agent diff --git a/docs/content/docs/cli/devvm_stop.md b/docs/content/docs/cli/devvm_stop.md index 0d9ad67f..b1ec2ce7 100644 --- a/docs/content/docs/cli/devvm_stop.md +++ b/docs/content/docs/cli/devvm_stop.md @@ -1,6 +1,7 @@ --- title: devvm stop weight: 58 +explainer: "Stop this folder's VM" --- Stop this folder's VM diff --git a/docs/content/docs/cli/devvm_tools.md b/docs/content/docs/cli/devvm_tools.md index 47557b50..5c138ed3 100644 --- a/docs/content/docs/cli/devvm_tools.md +++ b/docs/content/docs/cli/devvm_tools.md @@ -1,6 +1,7 @@ --- title: devvm tools weight: 59 +explainer: "Show or choose this folder's VM's shared tools" --- Show or choose this folder's VM's shared tools diff --git a/docs/content/docs/cli/devvm_tools_add.md b/docs/content/docs/cli/devvm_tools_add.md index 03cfb86f..00e0ec20 100644 --- a/docs/content/docs/cli/devvm_tools_add.md +++ b/docs/content/docs/cli/devvm_tools_add.md @@ -1,6 +1,7 @@ --- title: devvm tools add weight: 60 +explainer: "Add shared tools to this folder's VM, then open a shell in it" --- Add shared tools to this folder's VM, then open a shell in it diff --git a/docs/content/docs/cli/devvm_tools_rm.md b/docs/content/docs/cli/devvm_tools_rm.md index d9d48369..363c2a94 100644 --- a/docs/content/docs/cli/devvm_tools_rm.md +++ b/docs/content/docs/cli/devvm_tools_rm.md @@ -1,6 +1,7 @@ --- title: devvm tools rm weight: 61 +explainer: "Take shared tools out of this folder's VM, then open a shell in it" --- Take shared tools out of this folder's VM, then open a shell in it diff --git a/docs/content/docs/cli/devvm_tools_update.md b/docs/content/docs/cli/devvm_tools_update.md index 36ed2e56..a273972a 100644 --- a/docs/content/docs/cli/devvm_tools_update.md +++ b/docs/content/docs/cli/devvm_tools_update.md @@ -1,6 +1,7 @@ --- title: devvm tools update weight: 62 +explainer: "Move this folder's VM to the newest shared tools, then open a shell in it" --- Move this folder's VM to the newest shared tools, then open a shell in it diff --git a/docs/content/docs/cli/devvm_update.md b/docs/content/docs/cli/devvm_update.md index ae20b881..43cf0f31 100644 --- a/docs/content/docs/cli/devvm_update.md +++ b/docs/content/docs/cli/devvm_update.md @@ -1,6 +1,7 @@ --- title: devvm update weight: 63 +explainer: "Bring this folder's VM up to date, then open a shell in it" --- Bring this folder's VM up to date, then open a shell in it diff --git a/docs/content/docs/cli/devvm_upgrade.md b/docs/content/docs/cli/devvm_upgrade.md index 926fb3c6..5312e7a1 100644 --- a/docs/content/docs/cli/devvm_upgrade.md +++ b/docs/content/docs/cli/devvm_upgrade.md @@ -1,6 +1,7 @@ --- title: devvm upgrade weight: 64 +explainer: "Install devvm's newest release" --- Install devvm's newest release diff --git a/docs/content/docs/contributing/_index.md b/docs/content/docs/contributing/_index.md index ec1672a1..fc7659ac 100644 --- a/docs/content/docs/contributing/_index.md +++ b/docs/content/docs/contributing/_index.md @@ -1,5 +1,6 @@ --- title: Contributing +explainer: Build devvm, run its tests and follow its rules weight: 100 --- @@ -527,7 +528,7 @@ The site is [Hugo](https://gohugo.io) with the [Hextra](https://imfing.github.io - **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/`, `safety/`, `backends/`, `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. - **What goes where:** the user pages, in `getting-started/`, `using/`, `safety/` and `backends/`, 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. A user page links once to its How it works page where there is one. -- **Front matter** sets `title`, shown as the page's heading, and `weight`, the page's place in its section, or a section's place in the sidebar for an `_index.md`. Start the body at `##`. +- **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 the browser draws when the page loads. `docs/layouts/_partials/scripts/mermaid.html` takes the place of Hextra's partial of the same name. It loads the Mermaid version that `hugo.yaml` pins in `params.mermaid.base`, which Hugo fetches when it builds the site, and it gives every diagram the same theme, so a diagram never sets its own colors or font. The theme uses the site's palette: panels on the surface color with blue borders, lime arrows, and text in Departure Mono at 14px, larger than the home page's art so labels read easily. It uses Mermaid's classic look, because its newer neo look draws a decision's hexagon 70px taller than its label. 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. Mermaid draws each diagram at its own size and never scales it to fit, and a diagram wider than the page scrolls sideways. Keep labels short, and break a long one with `
`. In a label, write `<` as `#lt;` and `>` as `#gt;`. 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. - **Style:** succinct and direct. Commands are written as devvm x or in backticks, never in quotes. No `please`, `simply` or `note that`. @@ -538,13 +539,17 @@ The site is [Hugo](https://gohugo.io) with the [Hextra](https://imfing.github.io - **Install commands** come from `{{}}` 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 `{{}}`, with a `{{}}` and then a `{{}}` 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:** Instrument Sans for text and Martian Mono for code, from Google Fonts (`docs/layouts/_partials/custom/head-end.html`); Departure Mono, a pixel font in `docs/static/fonts/` with its license, for the logo, the home page's headings, badge and buttons. Departure Mono is sharp at multiples of 11px and has one weight. +- **Fonts:** Instrument Sans for text and Martian Mono for code, from Google Fonts (`docs/layouts/_partials/custom/head-end.html`); Departure Mono, a pixel font in `docs/static/fonts/` with its license, for the logo, the home page's headings, badge and buttons. Departure Mono is sharp at multiples of 11px and has one weight. 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 `{{}}` tiles inside `{{}}` 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 `{{}}`, 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 `{{}}`, which shows a line of text in the font, with a link to the license the site serves for Departure Mono. -- **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 image shown with a link to the site when someone shares it, and `hugo.yaml`'s `params.images` names it, so every page gets it as its `og:image` and `twitter:image`. 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. +- **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 `{{}}` 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`. @@ -576,7 +581,7 @@ The site is [Hugo](https://gohugo.io) with the [Hextra](https://imfing.github.io | 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 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. ### The CLI reference @@ -586,7 +591,7 @@ The [CLI reference](../cli/_index.md) in `docs/content/docs/cli/` is generated f 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 `weight` front matter 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. +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`, `weight` 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. ### A command's help diff --git a/docs/content/docs/contributing/maintaining.md b/docs/content/docs/contributing/maintaining.md index 7fa1c87f..c65125d3 100644 --- a/docs/content/docs/contributing/maintaining.md +++ b/docs/content/docs/contributing/maintaining.md @@ -1,5 +1,6 @@ --- title: Maintaining +explainer: Bump pinned versions, release devvm and run the docs sites weight: 2 --- diff --git a/docs/content/docs/contributing/testing.md b/docs/content/docs/contributing/testing.md index 08868be9..0d30d117 100644 --- a/docs/content/docs/contributing/testing.md +++ b/docs/content/docs/contributing/testing.md @@ -1,5 +1,6 @@ --- title: Testing on other hosts +explainer: Run devvm's tests on Linux, x86_64 and other hosts weight: 1 --- diff --git a/docs/content/docs/getting-started/_index.md b/docs/content/docs/getting-started/_index.md index b30d2972..2490a9ac 100644 --- a/docs/content/docs/getting-started/_index.md +++ b/docs/content/docs/getting-started/_index.md @@ -1,5 +1,6 @@ --- title: Getting started +explainer: From installing devvm to your first VM weight: 10 --- diff --git a/docs/content/docs/getting-started/commands.md b/docs/content/docs/getting-started/commands.md index 9998c2ba..8afc873b 100644 --- a/docs/content/docs/getting-started/commands.md +++ b/docs/content/docs/getting-started/commands.md @@ -1,5 +1,6 @@ --- title: Everyday commands +explainer: The commands you use most, in their groups weight: 3 --- diff --git a/docs/content/docs/getting-started/first-vm.md b/docs/content/docs/getting-started/first-vm.md index a8144d79..73c23049 100644 --- a/docs/content/docs/getting-started/first-vm.md +++ b/docs/content/docs/getting-started/first-vm.md @@ -1,5 +1,6 @@ --- title: Your first VM +explainer: Make a project's VM and start an agent in it weight: 2 --- diff --git a/docs/content/docs/getting-started/install.md b/docs/content/docs/getting-started/install.md index 888bd76d..eb18f3ad 100644 --- a/docs/content/docs/getting-started/install.md +++ b/docs/content/docs/getting-started/install.md @@ -1,5 +1,6 @@ --- title: Installing +explainer: Install devvm and check what it needs weight: 1 --- diff --git a/docs/content/docs/internals/_index.md b/docs/content/docs/internals/_index.md index 0c4b0d80..b920a96e 100644 --- a/docs/content/docs/internals/_index.md +++ b/docs/content/docs/internals/_index.md @@ -1,5 +1,6 @@ --- title: How it works +explainer: How devvm works, for reviewers and contributors weight: 95 --- diff --git a/docs/content/docs/internals/backends.md b/docs/content/docs/internals/backends.md index caa77934..4068804a 100644 --- a/docs/content/docs/internals/backends.md +++ b/docs/content/docs/internals/backends.md @@ -1,5 +1,6 @@ --- title: Backends +explainer: What a backend gives devvm, and how VMs are named weight: 8 --- diff --git a/docs/content/docs/internals/design.md b/docs/content/docs/internals/design.md index ee5d5882..e65078fe 100644 --- a/docs/content/docs/internals/design.md +++ b/docs/content/docs/internals/design.md @@ -1,5 +1,6 @@ --- title: Design notes +explainer: Why devvm is built this way, and what's open weight: 12 --- diff --git a/docs/content/docs/internals/desktop.md b/docs/content/docs/internals/desktop.md index f975c576..52f58c3b 100644 --- a/docs/content/docs/internals/desktop.md +++ b/docs/content/docs/internals/desktop.md @@ -1,5 +1,6 @@ --- title: The desktop +explainer: How devvm desktop serves a VM's desktop weight: 4 --- diff --git a/docs/content/docs/internals/git-protection.md b/docs/content/docs/internals/git-protection.md index 6bd77f8f..2c39a7ce 100644 --- a/docs/content/docs/internals/git-protection.md +++ b/docs/content/docs/internals/git-protection.md @@ -1,5 +1,6 @@ --- title: .git protection +explainer: What devvm locks in .git, and when weight: 6 --- diff --git a/docs/content/docs/internals/images.md b/docs/content/docs/internals/images.md index b64d0c24..af059a2c 100644 --- a/docs/content/docs/internals/images.md +++ b/docs/content/docs/internals/images.md @@ -1,5 +1,6 @@ --- title: Images and caching +explainer: How images and shared tools are built and cached weight: 3 --- diff --git a/docs/content/docs/internals/install.md b/docs/content/docs/internals/install.md index cdb6fdce..8b199faf 100644 --- a/docs/content/docs/internals/install.md +++ b/docs/content/docs/internals/install.md @@ -1,5 +1,6 @@ --- title: Installing and updating +explainer: What the install script and devvm doctor check weight: 2 --- diff --git a/docs/content/docs/internals/lima.md b/docs/content/docs/internals/lima.md index 913867a4..75bbdbbe 100644 --- a/docs/content/docs/internals/lima.md +++ b/docs/content/docs/internals/lima.md @@ -1,5 +1,6 @@ --- title: Lima +explainer: How devvm sets up, confines and clones Lima's VMs weight: 9 --- diff --git a/docs/content/docs/internals/network.md b/docs/content/docs/internals/network.md index 901d791f..2cf39357 100644 --- a/docs/content/docs/internals/network.md +++ b/docs/content/docs/internals/network.md @@ -1,5 +1,6 @@ --- title: Network tiers +explainer: How the proxy confines VMs and keeps your secrets weight: 5 --- diff --git a/docs/content/docs/internals/overview.md b/docs/content/docs/internals/overview.md index 96112a82..2498090d 100644 --- a/docs/content/docs/internals/overview.md +++ b/docs/content/docs/internals/overview.md @@ -1,5 +1,6 @@ --- title: Overview +explainer: What devvm does at each step of a VM's life weight: 1 --- diff --git a/docs/content/docs/internals/ports.md b/docs/content/docs/internals/ports.md index dc0c0ffd..5d56f4ca 100644 --- a/docs/content/docs/internals/ports.md +++ b/docs/content/docs/internals/ports.md @@ -1,5 +1,6 @@ --- title: Port forwarding +explainer: How devvm forwards a VM's ports to this machine weight: 4 --- diff --git a/docs/content/docs/internals/security.md b/docs/content/docs/internals/security.md index a8cdb641..6c03844a 100644 --- a/docs/content/docs/internals/security.md +++ b/docs/content/docs/internals/security.md @@ -1,5 +1,6 @@ --- title: Security model +explainer: What devvm protects, how, and what it doesn't weight: 7 --- diff --git a/docs/content/docs/safety/_index.md b/docs/content/docs/safety/_index.md index b8fa036c..8a2731ee 100644 --- a/docs/content/docs/safety/_index.md +++ b/docs/content/docs/safety/_index.md @@ -1,5 +1,6 @@ --- title: Staying safe +explainer: How devvm keeps untrusted code off your machine weight: 30 --- diff --git a/docs/content/docs/safety/attack-vectors.md b/docs/content/docs/safety/attack-vectors.md index 3462bda9..6f710e37 100644 --- a/docs/content/docs/safety/attack-vectors.md +++ b/docs/content/docs/safety/attack-vectors.md @@ -1,5 +1,6 @@ --- title: Attack vectors +explainer: Common attacks, and what devvm does about each weight: 3 --- diff --git a/docs/content/docs/safety/git-protection.md b/docs/content/docs/safety/git-protection.md index 2d397397..6d4c2920 100644 --- a/docs/content/docs/safety/git-protection.md +++ b/docs/content/docs/safety/git-protection.md @@ -1,5 +1,6 @@ --- title: .git protection +explainer: Keep code in the VM out of your .git weight: 2 --- diff --git a/docs/content/docs/safety/network.md b/docs/content/docs/safety/network.md index cdf25631..5c71fb1f 100644 --- a/docs/content/docs/safety/network.md +++ b/docs/content/docs/safety/network.md @@ -1,5 +1,6 @@ --- title: Network tiers +explainer: Choose what each VM can reach on the network weight: 1 --- diff --git a/docs/content/docs/using/_index.md b/docs/content/docs/using/_index.md index ef8e8e94..54d6d476 100644 --- a/docs/content/docs/using/_index.md +++ b/docs/content/docs/using/_index.md @@ -1,5 +1,6 @@ --- title: Using devvm +explainer: What you change in your VMs as you work weight: 20 --- diff --git a/docs/content/docs/using/clone.md b/docs/content/docs/using/clone.md index 88407447..2894399e 100644 --- a/docs/content/docs/using/clone.md +++ b/docs/content/docs/using/clone.md @@ -1,5 +1,6 @@ --- title: Working on a clone +explainer: Give a VM its own clone of the repo weight: 9 --- diff --git a/docs/content/docs/using/coding-agents.md b/docs/content/docs/using/coding-agents.md index c5821ceb..8e5e8932 100644 --- a/docs/content/docs/using/coding-agents.md +++ b/docs/content/docs/using/coding-agents.md @@ -1,5 +1,6 @@ --- title: Coding agents +explainer: Run Claude Code, Codex and opencode in a VM weight: 1 description: "devvm runs Claude Code, Codex and opencode in VMs, with each agent's settings and logins from devvm's own store on this machine but never your history. This page covers which agents devvm supports, devvm's agent store and what each VM gets from it, the agents' logins and their history." --- diff --git a/docs/content/docs/using/command-line.md b/docs/content/docs/using/command-line.md index ef604303..2ceaa772 100644 --- a/docs/content/docs/using/command-line.md +++ b/docs/content/docs/using/command-line.md @@ -1,5 +1,6 @@ --- title: The command line +explainer: Help, flags, questions, JSON output and completion weight: 15 --- diff --git a/docs/content/docs/using/customizing.md b/docs/content/docs/using/customizing.md index ce4aed4a..ecbcc215 100644 --- a/docs/content/docs/using/customizing.md +++ b/docs/content/docs/using/customizing.md @@ -1,5 +1,6 @@ --- title: Customizing images +explainer: Add your own layers and choose base's features weight: 7 --- diff --git a/docs/content/docs/using/desktop.md b/docs/content/docs/using/desktop.md index 8c254db3..7ff52d42 100644 --- a/docs/content/docs/using/desktop.md +++ b/docs/content/docs/using/desktop.md @@ -1,5 +1,6 @@ --- title: A VM's desktop +explainer: Add a desktop to a VM and open it weight: 12 --- diff --git a/docs/content/docs/using/devcontainer.md b/docs/content/docs/using/devcontainer.md index c1bc9c74..8e995287 100644 --- a/docs/content/docs/using/devcontainer.md +++ b/docs/content/docs/using/devcontainer.md @@ -1,5 +1,6 @@ --- title: devcontainer.json +explainer: Set up a VM from a project's devcontainer.json weight: 10 --- diff --git a/docs/content/docs/using/from.md b/docs/content/docs/using/from.md index 878635c1..fd3473ab 100644 --- a/docs/content/docs/using/from.md +++ b/docs/content/docs/using/from.md @@ -1,5 +1,6 @@ --- title: Starting from a container image +explainer: Start base from a Debian, Ubuntu or Alpine image weight: 13 --- diff --git a/docs/content/docs/using/images.md b/docs/content/docs/using/images.md index 52c5a52f..8ef8dd1a 100644 --- a/docs/content/docs/using/images.md +++ b/docs/content/docs/using/images.md @@ -1,5 +1,6 @@ --- title: Images and tools +explainer: The images VMs are made from, and their tools weight: 6 --- diff --git a/docs/content/docs/using/limits.md b/docs/content/docs/using/limits.md index 52a5b191..0550c6d8 100644 --- a/docs/content/docs/using/limits.md +++ b/docs/content/docs/using/limits.md @@ -1,5 +1,6 @@ --- title: Known limits +explainer: What devvm can't do, and where weight: 18 --- diff --git a/docs/content/docs/using/links.md b/docs/content/docs/using/links.md index 9c3593d2..d0b4476e 100644 --- a/docs/content/docs/using/links.md +++ b/docs/content/docs/using/links.md @@ -1,5 +1,6 @@ --- title: Links between VMs +explainer: Let one VM reach a service in another by name weight: 11 --- diff --git a/docs/content/docs/using/ports-size.md b/docs/content/docs/using/ports-size.md index 3b679e13..281f7d92 100644 --- a/docs/content/docs/using/ports-size.md +++ b/docs/content/docs/using/ports-size.md @@ -1,5 +1,6 @@ --- title: Ports and size +explainer: Forward a VM's ports and change its size weight: 4 --- diff --git a/docs/content/docs/using/settings.md b/docs/content/docs/using/settings.md index 09fcfde3..96677855 100644 --- a/docs/content/docs/using/settings.md +++ b/docs/content/docs/using/settings.md @@ -1,5 +1,6 @@ --- title: Settings and files +explainer: The files you edit and the files devvm keeps weight: 8 --- diff --git a/docs/content/docs/using/space.md b/docs/content/docs/using/space.md index 1567d6f2..2b1f25c8 100644 --- a/docs/content/docs/using/space.md +++ b/docs/content/docs/using/space.md @@ -1,5 +1,6 @@ --- title: What devvm keeps on this machine +explainer: Each file devvm keeps, and how it's cleaned up weight: 14 --- diff --git a/docs/content/docs/using/ssh.md b/docs/content/docs/using/ssh.md index bd6fad5c..5a407bea 100644 --- a/docs/content/docs/using/ssh.md +++ b/docs/content/docs/using/ssh.md @@ -1,5 +1,6 @@ --- title: SSH and editors +explainer: Reach VMs by name from ssh and VS Code weight: 3 --- diff --git a/docs/content/docs/using/toolchains.md b/docs/content/docs/using/toolchains.md index 46414945..6210d83f 100644 --- a/docs/content/docs/using/toolchains.md +++ b/docs/content/docs/using/toolchains.md @@ -1,5 +1,6 @@ --- title: Toolchains +explainer: The toolchains VMs get, and the files that choose them weight: 2 --- diff --git a/docs/content/docs/using/troubleshooting.md b/docs/content/docs/using/troubleshooting.md index f6aa7fb0..9965fa29 100644 --- a/docs/content/docs/using/troubleshooting.md +++ b/docs/content/docs/using/troubleshooting.md @@ -1,5 +1,6 @@ --- title: Troubleshooting +explainer: What to do when something fails weight: 17 --- diff --git a/docs/content/docs/using/upgrading.md b/docs/content/docs/using/upgrading.md index 591434d5..8ddc26f6 100644 --- a/docs/content/docs/using/upgrading.md +++ b/docs/content/docs/using/upgrading.md @@ -1,5 +1,6 @@ --- title: Upgrading and uninstalling +explainer: Upgrade devvm, or remove it and what it keeps weight: 16 --- diff --git a/docs/content/docs/using/vms.md b/docs/content/docs/using/vms.md index 64f85745..7bb79f65 100644 --- a/docs/content/docs/using/vms.md +++ b/docs/content/docs/using/vms.md @@ -1,5 +1,6 @@ --- title: Managing VMs +explainer: Open, stop, delete and list your VMs weight: 5 --- diff --git a/docs/hugo.yaml b/docs/hugo.yaml index da3f3dc0..837e4426 100644 --- a/docs/hugo.yaml +++ b/docs/hugo.yaml @@ -46,9 +46,8 @@ menu: params: description: "One VM for every project: an isolated sandbox with your project's toolchain, ready for you or an agent to start coding." - # The social preview card, for every page's og:image and twitter:image (static/images/). - images: - - /images/social-card.png + # No images: each page's og:image and twitter:image is its own card, which + # layouts/_partials/og-image.html draws. navbar: displayTitle: false displayLogo: true diff --git a/docs/layouts/_partials/_funcs/get-page-images.html b/docs/layouts/_partials/_funcs/get-page-images.html new file mode 100644 index 00000000..df813e7d --- /dev/null +++ b/docs/layouts/_partials/_funcs/get-page-images.html @@ -0,0 +1,5 @@ +{{- /* In place of Hugo's own, which its twitter_cards.html and schema.html call for a page's images: the + page's social card (og-image.html), so twitter:image and the schema's image are that card. Hextra's + opengraph.html reads no image once hugo.yaml names none, and custom/head-end.html writes og:image. */ -}} +{{- $card := partialCached "og-image.html" . .RelPermalink -}} +{{- return slice (dict "Image" $card.Image "RelPermalink" $card.Image.RelPermalink "Permalink" $card.Image.Permalink) -}} diff --git a/docs/layouts/_partials/custom/head-end.html b/docs/layouts/_partials/custom/head-end.html index 4f667cd4..19c3b2bb 100644 --- a/docs/layouts/_partials/custom/head-end.html +++ b/docs/layouts/_partials/custom/head-end.html @@ -1,3 +1,13 @@ +{{- /* The page's social card (og-image.html). Hugo's twitter_cards.html writes twitter:card and twitter:image + from the same card, through _funcs/get-page-images.html. */ -}} +{{- with partialCached "og-image.html" . .RelPermalink }} + + + + + + +{{- end }} diff --git a/docs/layouts/_partials/og-image.html b/docs/layouts/_partials/og-image.html new file mode 100644 index 00000000..4039493c --- /dev/null +++ b/docs/layouts/_partials/og-image.html @@ -0,0 +1,65 @@ +{{- /* A page's social card: assets/images/og-template.png (the logo, devvm.dev and the lime bar) with the + page's section in lime capitals, its title and its explainer (the front matter's explainer) drawn on it + in Departure Mono. Returns the image and its alt text, for the og: and twitter: tags + (custom/head-end.html, _funcs/get-page-images.html). Called through partialCached, once per page. + + Departure Mono's glyphs are 7 of its pixels wide and its pixels are an eleventh of its size, so each size + is a multiple of 11 and every line's width is its length times 7/11 of the size. The title gets the + largest size that fits it in two lines and the explainer is 33px, and the text is centered in the space + between the logo and devvm.dev. TestExplainers (internal/cli/docgen) checks that every page's title and + explainer fit in two lines. */ -}} +{{- $font := resources.Get "fonts/departure-mono/DepartureMono-Regular.otf" -}} +{{- $template := resources.Get "images/og-template.png" -}} +{{- $left := 88 -}} +{{- $width := 1024 -}} +{{- $top := 200 -}} +{{- $bottom := 524 -}} + +{{- /* The section: the page's own for a page, its parent's for a section's page, none at the top. */ -}} +{{- $section := cond .IsSection .Parent .CurrentSection -}} +{{- $label := "" -}} +{{- if and $section (not $section.IsHome) (ne $section .) }}{{ $label = upper $section.Title }}{{ end -}} +{{- $title := .Params.cardTitle | default .Title -}} +{{- $explainer := .Params.explainer | default "" -}} + +{{- /* Each size: the font's size, the characters a line holds and the distance from one line's top to the + next's. */ -}} +{{- $titleSizes := slice + (dict "size" 66 "pitch" 78) + (dict "size" 55 "pitch" 66) + (dict "size" 44 "pitch" 54) -}} +{{- $textFit := dict "size" 33 "pitch" 44 -}} + +{{- $titleFit := dict -}} +{{- range $titleSizes -}} + {{- $lines := partial "og-wrap.html" (dict "text" $title "cols" (div $width (div (mul .size 7) 11))) -}} + {{- if or (le (len $lines) 2) (eq .size 44) }}{{ $titleFit = merge . (dict "lines" $lines) }}{{ break }}{{ end -}} +{{- end -}} +{{- $textFit = merge $textFit (dict "lines" (partial "og-wrap.html" (dict "text" $explainer "cols" (div $width (div (mul $textFit.size 7) 11))))) -}} + +{{- /* The block's height: the label and its gap, the title's lines, then the explainer's gap and lines. */ -}} +{{- $labelHeight := cond (ne $label "") 36 0 -}} +{{- $titleHeight := mul (len $titleFit.lines) $titleFit.pitch -}} +{{- $gap := 22 -}} +{{- $textHeight := 0 -}} +{{- with $textFit.lines }}{{ $textHeight = add $gap (mul (len .) $textFit.pitch) }}{{ end -}} +{{- $y := add $top (div (sub (sub $bottom $top) (add $labelHeight $titleHeight $textHeight)) 2) -}} + +{{- $filters := slice -}} +{{- with $label -}} + {{- $filters = $filters | append (images.Text . (dict "font" $font "size" 22 "color" "#7fff00" "x" $left "y" $y "linespacing" 0)) -}} + {{- $y = add $y $labelHeight -}} +{{- end -}} +{{- range $titleFit.lines -}} + {{- $filters = $filters | append (images.Text . (dict "font" $font "size" $titleFit.size "color" "#eeeeee" "x" $left "y" $y "linespacing" 0)) -}} + {{- $y = add $y $titleFit.pitch -}} +{{- end -}} +{{- $y = add $y $gap -}} +{{- range $textFit.lines -}} + {{- $filters = $filters | append (images.Text . (dict "font" $font "size" $textFit.size "color" "#8f93a2" "x" $left "y" $y "linespacing" 0)) -}} + {{- $y = add $y $textFit.pitch -}} +{{- end -}} + +{{- $alt := printf "devvm docs: %s" $title -}} +{{- with $explainer }}{{ $alt = printf "%s: %s" $alt . }}{{ end -}} +{{- return dict "Image" ($template | images.Filter $filters) "Alt" $alt -}} diff --git a/docs/layouts/_partials/og-wrap.html b/docs/layouts/_partials/og-wrap.html new file mode 100644 index 00000000..c746bef1 --- /dev/null +++ b/docs/layouts/_partials/og-wrap.html @@ -0,0 +1,17 @@ +{{- /* Wraps .text into lines of at most .cols characters, breaking at spaces, and returns them. The card's + font is monospaced, so a line's width is its length. A word longer than .cols gets a line of its own. */ -}} +{{- $lines := slice -}} +{{- $line := "" -}} +{{- range split (trim .text " ") " " -}} + {{- if not . }}{{ continue }}{{ end -}} + {{- if not $line -}} + {{- $line = . -}} + {{- else if le (add (strings.RuneCount $line) 1 (strings.RuneCount .)) $.cols -}} + {{- $line = printf "%s %s" $line . -}} + {{- else -}} + {{- $lines = $lines | append $line -}} + {{- $line = . -}} + {{- end -}} +{{- end -}} +{{- with $line }}{{ $lines = $lines | append . }}{{ end -}} +{{- return $lines -}} diff --git a/internal/cli/docgen/docgen.go b/internal/cli/docgen/docgen.go index 693f7f9b..cb552713 100644 --- a/internal/cli/docgen/docgen.go +++ b/internal/cli/docgen/docgen.go @@ -44,11 +44,12 @@ func write(root *cobra.Command, dir string) error { // generate returns the reference's files by name: _index.md, and a page // for root and each command under it users can run. Hidden commands and // Cobra's help command are left out, as Cobra's own tree generator does. +// Each page's front matter has its explainer, which TestExplainers checks. func generate(root *cobra.Command) (map[string][]byte, error) { cmds := available(root) files := make(map[string][]byte, len(cmds)+1) var index bytes.Buffer - index.WriteString("---\ntitle: CLI reference\nweight: 90\n---\n\n" + + index.WriteString("---\ntitle: CLI reference\nweight: 90\nexplainer: Every devvm command, with its arguments and flags\n---\n\n" + "Every devvm command, with its arguments and flags. `devvm --help` prints the same.\n\n") for i, c := range cmds { c.DisableAutoGenTag = true @@ -57,7 +58,8 @@ func generate(root *cobra.Command) (map[string][]byte, error) { return nil, err } body := withDocs(tidy(md.String()), c.CommandPath(), msg.CommandDoc(c.CommandPath())) - page := fmt.Sprintf("---\ntitle: %s\nweight: %d\n---\n\n%s", c.CommandPath(), i+1, body) + // The command's Short is its page's explainer, the line under its title on the social card. + page := fmt.Sprintf("---\ntitle: %s\nweight: %d\nexplainer: %q\n---\n\n%s", c.CommandPath(), i+1, c.Short, body) files[fileName(c)] = []byte(page) fmt.Fprintf(&index, "- [%s](%s): %s\n", c.CommandPath(), fileName(c), c.Short) } diff --git a/internal/cli/docgen/explainer_test.go b/internal/cli/docgen/explainer_test.go new file mode 100644 index 00000000..c4ae7e5e --- /dev/null +++ b/internal/cli/docgen/explainer_test.go @@ -0,0 +1,150 @@ +package main + +import ( + "bufio" + "bytes" + "io/fs" + "os" + "path/filepath" + "strconv" + "strings" + "testing" + "unicode/utf8" +) + +// content is the docs site's pages, from this package's folder. +const content = "../../../docs/content" + +// The social card's lines (docs/layouts/_partials/og-image.html): the +// card's text is 1024 pixels wide, and Departure Mono's characters are +// 7/11 of its size, so the explainer at 33px holds 48 characters a line +// and the title at its smallest, 44px, holds 36. Each gets two lines. +const ( + explainerCols = 48 + titleCols = 36 + cardLines = 2 +) + +// frontMatter returns the top-level scalar fields of a page's YAML front +// matter, unquoted. Lists, maps and comments are skipped. +func frontMatter(data []byte) map[string]string { + fields := map[string]string{} + s := bufio.NewScanner(bytes.NewReader(data)) + if !s.Scan() || s.Text() != "---" { + return fields + } + for s.Scan() { + line := s.Text() + if line == "---" { + break + } + key, value, ok := strings.Cut(line, ":") + if !ok || key == "" || strings.ContainsAny(key[:1], " \t#-") { + continue + } + value = strings.TrimSpace(value) + switch { + case strings.HasPrefix(value, `"`): + if v, err := strconv.Unquote(value); err == nil { + value = v + } + case strings.HasPrefix(value, "'") && strings.HasSuffix(value, "'") && len(value) > 1: + value = strings.ReplaceAll(value[1:len(value)-1], "''", "'") + } + fields[key] = value + } + return fields +} + +// wrappedLines is how many lines text takes when wrapped at spaces into +// lines of at most cols characters, as og-wrap.html wraps it. +func wrappedLines(text string, cols int) int { + lines, width := 0, 0 + for word := range strings.FieldsSeq(text) { + n := utf8.RuneCountInString(word) + if width > 0 && width+1+n <= cols { + width += 1 + n + continue + } + lines++ + width = n + } + return lines +} + +// Every page has an explainer, the short line under its title on its +// social card, and the explainer and the card's title each fit the card. +// The CLI reference's explainers are its commands' Shorts. +func TestExplainers(t *testing.T) { + pages := 0 + err := filepath.WalkDir(content, func(path string, d fs.DirEntry, err error) error { + if err != nil || d.IsDir() || !strings.HasSuffix(path, ".md") { + return err + } + data, err := os.ReadFile(path) //nolint:gosec // the repo's own pages + if err != nil { + return err + } + pages++ + name, _ := filepath.Rel(content, path) + fields := frontMatter(data) + explainer := fields["explainer"] + switch { + case explainer == "": + t.Errorf("%s: no explainer in its front matter: add one, a few plain words on what the page covers", name) + case wrappedLines(explainer, explainerCols) > cardLines: + t.Errorf("%s: explainer %q is longer than the card's %d lines of %d characters", name, explainer, cardLines, explainerCols) + } + title := fields["cardTitle"] + if title == "" { + title = fields["title"] + } + if wrappedLines(title, titleCols) > cardLines { + t.Errorf("%s: title %q is longer than the card's %d lines of %d characters", name, title, cardLines, titleCols) + } + return nil + }) + if err != nil { + t.Fatal(err) + } + if pages == 0 { + t.Fatalf("no pages in %s", content) + } +} + +func TestFrontMatter(t *testing.T) { + page := "---\ntitle: Toolchains\nweight: 3\nexplainer: \"Say \\\"hi\\\"\"\nalt: 'it''s'\n# note: no\nsidebar:\n exclude: true\n---\n\nbody: no\n" + got := frontMatter([]byte(page)) + want := map[string]string{"title": "Toolchains", "weight": "3", "explainer": `Say "hi"`, "alt": "it's", "sidebar": ""} + if len(got) != len(want) { + t.Fatalf("frontMatter = %v, want %v", got, want) + } + for k, v := range want { + if got[k] != v { + t.Errorf("frontMatter[%q] = %q, want %q", k, got[k], v) + } + } + if got := frontMatter([]byte("no front matter\n")); len(got) != 0 { + t.Errorf("frontMatter of a page without one = %v, want none", got) + } +} + +func TestWrappedLines(t *testing.T) { + for _, tc := range []struct { + text string + cols int + want int + }{ + {"", 10, 0}, + {"one", 10, 1}, + {"one two", 7, 1}, + {"one two", 6, 2}, + {"a looooooooong word", 5, 3}, + {" spaced out ", 10, 1}, + {"Run Lima's limactl for debugging, which starts VMs unconfined, whatever their tier", 48, 2}, + } { + if got := wrappedLines(tc.text, tc.cols); got != tc.want { + t.Errorf("wrappedLines(%q, %d) = %d, want %d", tc.text, tc.cols, got, tc.want) + } + } +} diff --git a/mise.toml b/mise.toml index ae25cd33..cafbe016 100644 --- a/mise.toml +++ b/mise.toml @@ -68,6 +68,8 @@ run = [ "go test ./internal/msg -run '^TestDocLinks$'", # Command lines: every devvm command line in the repo is one of devvm's. "go test ./internal/cli -run '^TestCommandLines$'", + # Social cards: every page has an explainer, and it and the title fit the card. + "go test ./internal/cli/docgen -run '^TestExplainers$'", # The site builds with no warning, a deprecation's included, into a folder # the run removes. "d=$(mktemp -d) && trap 'rm -rf \"$d\"' EXIT && hugo -s docs --quiet --panicOnWarning -d \"$d\"",