docs: split the CLI reference per command, and publish the site on Pages - #1470
Merged
Conversation
The CLI reference was 3,564 words — a third of the whole corpus on one page, while every other page sat between 300 and 660. It is now one page per command under docs/reference/cli/, plus pages for the three sections that are shared across commands (remote targeting, report sinks, credentials) and one for the legacy-script mapping. The largest page is now 576 words. Content moved verbatim; nothing was rewritten or expanded. Every inbound link to the old page and its anchors is repointed, including the ones in README.md, SUPPORT.md, CLAUDE.md and the committed skills. Two links that were already broken under a strict build are fixed: three same-directory `cli.md` links inside docs/reference/, and a `../../README.md` link that resolves on GitHub but has no target inside the docs tree. The site is published with MkDocs Material and versioned with mike, because `saw` ships pinned releases and an unversioned site would misdescribe every older install. A push to main refreshes `latest` (the default alias); a published release deploys an immutable directory named after its tag. The accent colour is sampled from the app icon rather than guessed — #80E1AB, the mark's mint — and, since that scores 1.58:1 on white, the light scheme uses hue-preserving darkenings that clear WCAG AA while the dark scheme uses the mint itself. The docs toolchain lives in requirements-docs.txt, read only by the docs workflow, so the runtime install stays dependency-light. Every action in the new workflow is pinned to a commit SHA with its tag in a trailing comment, and each job widens the read-only default by exactly what it needs. Closes #1467
Ndevu12
force-pushed
the
docs/publish-site-and-split-cli-reference
branch
from
August 17, 2026 19:13
203bb0d to
0832a6e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Splits the oversized CLI reference into one page per command, and publishes the whole
docs/treeas a versioned MkDocs Material site on GitHub Pages.
Closes #1467
Settings → Pages → Source: GitHub Actions. A PR cannot change repository settings, so the first
deployjob will fail until that is set. Everything else — creatinggh-pages, seedinglatest,setting the default alias — the workflow does on its own.
Part 1 — the reference split
docs/reference/cli.mdwas 3,564 words, a third of the entire corpus on one page, while every otherpage sat between 300 and 660. It is now
docs/reference/cli/:index.mdhook.mdscan.mdauth.mdguard.mdaudit.mdcredentials.mdfix.mdsinks.mddiscard.mddb.mdremote.mdmigrating.mdintro.mddoctor.mdcompletion.mdsearch.mdLargest page 576 words, against a 3,564-word original. Content moved verbatim — nothing was
rewritten or expanded; the only new prose is a two-sentence pointer on the index and a one-line
cross-reference on
auth.mdandcompletion.mdwhere a section left the page they used to sit on.docs/explanation/credential-hygiene.mdis deliberately left as one 1,661-word page: it readsend to end, and
hygiene.credentials.CREDENTIAL_HYGIENE_DOClinks to it as a finding's detailsdestination.
Judgement call worth a look. The issue enumerates one page per command. Four sections of the old
page are not commands but shared reference — Remote targeting, Report sinks, Credentials and
Migrating from the legacy scripts. Folding them into
index.mdwould have put it at ~1,100 words,straight back over the limit the split exists to fix, so each got its own page. Command aliases and
Environment variables are small and genuinely global, so those did fold into
index.md.Links
Every inbound link to the old page and its anchors is repointed —
docs/,README.md,SUPPORT.md,CLAUDE.md, and the two committed skills. Two links that were already brokenunder a strict build are fixed on the way past:
cli.md#…links insidedocs/reference/(my first grep used areference/prefix and missed them;mkdocs --strictcaught them);docs/how-to/gate-ci.md→../../README.md#the-workflow-by-hand, which resolves on GitHub butpoints outside
docs_dir, so it is now an absolute repo URL.The three shipped doc-URL constants in
src/were imported and resolved, not grepped — allthree point at a file and anchor that exist, before and after:
Part 2 — the published site
mkdocs.yml— Material theme,site_name: saw,edit_uri: edit/main/docs/, search enabled, navmirroring the Diátaxis tree exactly.
strict: trueplus explicitvalidation:so a broken relativelink, a dangling
#anchor, or a page missing from the nav fails the build rather than shipping.Versioning — how a release publishes its own version
sawships pinned releases, so an unversioned site would misdescribe every older install.mikekeeps one directory per version on
gh-pages:main→mike deploy --push --update-aliases latestthenmike set-default --push latest.latestis the default alias, so the bare docs URL resolves to it.release: published→mike deploy --push "${TAG#v}"— an immutable directory named afterthe tag with the leading
vstripped (v0.6.1→0.6.1), andlatestis left alone. Someonepinned to 0.6.1 keeps a page that describes 0.6.1.
mkdocs build --strictonly. No branch write, no deploy.Pages is served from the uploaded artifact, not from the branch;
gh-pagesis only mike'sversion store. The publish job materialises the entire versioned tree with
git archive(clean,no
.git) so the version selector and every older version stay reachable, and assertsindex.htmlis non-empty rather than deploying a blank site.Colour — sampled, not guessed
Sampled from
public/stayawakebot-app-icon.pngwith Pillow, filtering to the saturated green-to-tealband (
0.25 ≤ h ≤ 0.50,s ≥ 0.35,v ≥ 0.45) to skip the near-black ground:#80E1AB— rgb(128, 225, 171), the single most common glyph colour at 9.49% of the mint-bandpixels. The icon's ground sampled as
#090E14.#80E1ABscores 1.58:1 on white — nowhere near AA — so it is not the light-mode primary:default(light)#335A44#467C5Eslate(dark)#090E14(the icon's ground)#80E1AB(the mark's mint)The light values are hue-preserving darkenings of the same mint, so the two schemes are the same
colour at different lightness. Both live in
docs/assets/extra.css; the palette has a scheme toggleand follows
prefers-color-scheme.Logo and favicon are the icon, copied to
docs/assets/.Workflow and dependencies
.github/workflows/docs.yml— every action pinned to a commit SHA with a trailing# vX.Y.Z(#1453). Tags resolved from the GitHub API at authoring time:
Least privilege — the workflow default is
contents: read, and each job widens only what it needs:buildstays read-only;publishtakescontents: write(mike commits togh-pages) pluspages: read;deploytakespages: write+id-token: writeand nothing else.No runtime dependency is added. The toolchain lives in
requirements-docs.txt, read only bythis workflow — deliberately not a
[project.optional-dependencies]group, so nothing about theoffline, dependency-light install changes and no docs tooling reaches the wheel's metadata. Pinned
exactly (
mkdocs==1.6.1,mkdocs-material==9.7.7,mike==2.2.0) for the same reason the actionsare SHA-pinned.
pyproject.tomlDocumentationnow points at https://ndevu12.github.io/stayAwakeBot/.site/was already covered by
/sitein.gitignore; the entry is annotated so it is not mistaken fordead config, and the local
.venv-docs/is ignored too.Verification
mkdocs build --strict(withvalidation.anchors: warnpromoted to an error) — clean, 0warnings, on the rebased tree. It found 4 broken links on the first run; all 4 are fixed above.
cross-file anchors, slugified GitHub-style: 135 links, clean. Written as a script, not eyeballed.
grep -rn "reference/cli.md" docs/ *.md→ nothing stale.Ran 1613 tests … OK (skipped=1), withimport stayawakeconfirmed to resolveto
<worktree>/src/stayawake/__init__.pyfirst, so the green is this checkout's.99f7b82aand every check above re-run on the rebased tree.Not done, and why
src/stayawake/cli/__init__.py:8andsrc/stayawake/cli/helptext.py:7carry module docstringsthat name
docs/reference/cli.mdanddocs/CLI.md. The second was already stale after #1466; thefirst goes stale here. Both are comments — neither is printed, exported, or asserted by a test — and
this PR does not touch
src/, so they are left for a follow-up rather than dragging a source changeinto a docs PR.