Expose every tools script as a dec-tool subcommand - #260
Merged
Conversation
The task regenerates nav.yml from the docs/**/.pages files, which puts it in the same family as update:cmemc, update:icons and the other regeneration tasks. Rename it accordingly and move it next to them, and update the two places that referenced the old name: the hint printed by check:nav and the navigation section of the README. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D6WBueY2LvLdFZeNv2upnH
Three scripts were still invoked as `poetry run python tools/<script>.py` while the other three had long been click commands on the dec-tool group. Wire the remaining ones up the same way, following the conventions the existing commands already established: named options with repo-relative defaults and show_default, the command writing its own output, and progress on stdout via click.echo. build-navigation --docs-dir docs, -o nav.yml, --check check-zensical-output --site-dir site localize-bundle-assets --site-dir site build_nav.py becomes build_navigation.py so that file and command agree, as they do for the other five. The __main__ blocks are gone: dec-tool is now the only entry point. --check is new. It compares the generated navigation against whatever -o points at instead of writing it, prints a unified diff and exits 1 on drift, which replaces the mktemp/trap/diff shell block in check:nav - renamed to check:navigation to match update:navigation. The pre-commit nav-drift hook follows both the task rename and the module rename. Verified with `task check` (all four stages, including a full build) and `pytest -m "not integration"`; `task update:navigation` regenerates nav.yml byte-identically. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D6WBueY2LvLdFZeNv2upnH
Bumping to Zensical 0.0.58 removed tools/render_tag_listings.py, the overrides/partials/tags.html partial and their tests, but left the README describing both as features "reimplemented here" - it pointed at two files that no longer exist. Tag listings and tag chip links are native now, so say that instead, and keep the paragraph on what check-zensical-output still guards: chips must link somewhere, and their anchors must exist on /tags/. The failure text of that very check named the deleted partial, which is the worst possible moment to read a stale hint. It now asks about Zensical. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D6WBueY2LvLdFZeNv2upnH
Test Results1 files ±0 2 suites ±0 0s ⏱️ ±0s For more details on these failures, see this check. Results for commit a6911b9. ± Comparison against base commit 1b969f4. ♻️ This comment has been updated with latest results. |
The builder had two tests, both on the click layer, while the logic that actually derives the navigation was unpinned. That logic carries the subtle rules: dir_title capitalises only all-lowercase names, which is what keeps "link-IDS-event-to-KG" from becoming "Link Ids Event To Kg", and expand_dir walks a directory that has no .pages instead of emitting a bare reference - a fix whose 12-line comment explains that bare references empty the sidebar under navigation.tabs and drop pages from the navigation entirely. Adds coverage for dir_title, read_pages, has_markdown, discover_dir's MkDocs-like ordering, expand_dir, expand_item, build_nav_list and render_nav's two error paths, plus the CLI cases that were missing: --check against a not-yet-existing file, and a --docs-dir that is not there. Checked that the tests can fail: making dir_title capitalise unconditionally breaks the acronym case, and reverting expand_dir to a bare directory reference breaks five. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D6WBueY2LvLdFZeNv2upnH
seebi
marked this pull request as ready for review
September 4, 2026 08:35
seebi
marked this pull request as draft
September 4, 2026 08:35
seebi
marked this pull request as ready for review
September 4, 2026 08:43
rpietzsch
approved these changes
Sep 4, 2026
rpietzsch
left a comment
Contributor
There was a problem hiding this comment.
looks good to me, also tested and validated locally. thanks for the refinements/integration in tools 🙌
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.
💪 What
build-navigation,check-zensical-outputandlocalize-bundle-assetsasdec-toolsubcommands, so all six build/generate/check scripts share one entry point instead of three of them being called aspoetry run python tools/<script>.pytools/build_nav.pytotools/build_navigation.pyso file and command agree, as they already do for the other five__main__blocks:dec-toolis now the only entry point, matchingupdate-icons,update-di-referenceandupdate-integrations--checktobuild-navigation, which diffs the generated navigation against the-otarget and exits 1 on drift, replacing themktemp/trap/diffshell block in the Taskfilenavtask toupdate:navigationandcheck:navtocheck:navigation, grouping both with the existingupdate:*andcheck:*familiestools/README.md, which said "This directory is not used at the moment", into a reference for all six subcommands and the tasks that call themdir_title's acronym rule,discover_dir's MkDocs-like ordering,expand_dir's no-bare-directory behaviour,expand_item's title inheritance and inline sections, both ofrender_nav's error paths, and the CLI cases that were missingThe new commands follow the conventions the existing ones already set: named options with repo-relative defaults and
show_default, the command writing its own output, and progress on stdout viaclick.echo.🤔 Why
dec-tooland half through direct script paths, so the two halves drifted apart in argument handling, defaults and error reporting. One entry point makesdec-tool --helpan accurate inventory of what this repo can do to itself.Taskfile.yml: a temp file, atrap, adiffand hand-written echo messages. Moving it into--checkmakes it testable, and it is now covered by unit tests rather than only by running the task.nav.yml, and until now nothing pinned its behaviour. Its rules are the kind that break quietly:dir_titlecapitalises only all-lowercase names, which is what stopslink-IDS-event-to-KGbecoming "Link Ids Event To Kg", andexpand_dirwalks a.pages-less directory because a bare directory reference empties the sidebar undernavigation.tabsand drops pages from the navigation. Both now have tests, and both were confirmed to fail when the rule is reverted.task navgave no hint that it regeneratesnav.yml, and sorted nowhere near the other regeneration tasks.update:navigationandcheck:navigationput both halves where you would look for them.tags.htmloverride as features "reimplemented here", pointing at two files that no longer exist. The failure message of the check that guards tag chips named the deleted override too, which is the worst possible moment to read a stale hint.👀 Usage
👩🔬 How to validate
poetry run dec-tool --help— six subcommands, three of them new.docs/**/.pagesfile, thentask check:navigation. It prints a unified diff of exactly that change, tells you to runtask update:navigation, and exits 1. The same happens ongit commitvia the pre-commit hook.task update:navigation, thengit diff nav.yml— empty, i.e. the rewritten generator reproduces the committed file byte for byte. Revert your.pagesedit afterwards.task build— the build ends withlocalize-bundle-assetsrewriting the two unpkg URLs to the vendored glightbox copies.task check:output— reports the tag-chip checks asPASSand social cards / revision dates asPEND.🧹 Open issues (not addressed here)
Deliberately left for follow-up work, recorded here so they are visible at merge time:
tasks/is largely obsolete.tasks/spec.mdcarries its own verdict — "removed 2026-09-03 … Lifetime: delete the moment Zensical ships listings" — and Zensical shipped them in 0.0.58.tasks/backlog.mdmarksB0-B8andC1-C4done and describes files that were deleted.tasks/check_zensical_output.pyis the copy thathandoff.mdT8a said to move intotools/; that happened, and the two have since diverged. All three can go oncefeature/zensicallands onmain.tasks/handoff.mdis stale in places. It referencestools/build_nav.pyandpython tools/check_zensical_output.py site, both dead paths after this PR, and its section 5 still lists tag listings as deferred. Its T1–T8 are all verifiably complete — the remaining value is the record of why the migration looks the way it does.check-zensical-outputandlocalize-bundle-assetshave no tests. Only the navigation builder was covered here. Testing the former first needs a decision on its module-levelfailures/noticeslists, whichreport()appends to: they make results accumulate across invocations in one process, so tests would have to assert on globals or the checks need to return their results instead.material/socialplugin functionality zensical/backlog#37) and revision dates (Supportmkdocs-git-revision-date-localizedplugin functionality zensical/backlog#18) are still missing and still reported asPENDon every build. They are the reason the migration is not finished, and the merge decision onfeature/zensicalshould account for them.🔗 Related links
material/socialplugin functionality zensical/backlog#37mkdocs-git-revision-date-localizedplugin functionality zensical/backlog#18