Repository navigation
Move the last scripts into leaf-dev, and drop every import-path edit - #1384
Merged
Merged
Conversation
`scripts/` held what tests could import only through pytest's `pythonpath = ["scripts"]`. Each script becomes a `leaf-dev` command in the module that owns it, and the directory is gone: - `leaf-dev preview` (was `scripts/preview.py`). Its worker, exec'd into the selected checkout's environment, runs `python -m leaf_dev.preview` rather than the group, whose other commands import what that environment lacks. - `leaf-dev corpus` and `leaf-dev keydocs`, which regenerate `examples/corpus.html` and the key index in `docs/registry.html`. - `leaf-dev verify-site`, with its browser helper beside it. - `leaf-dev verify-codex-task`. - `worker/deploy-dev.sh` (was `scripts/deploy-site-dev.sh`), beside the Worker whose `npm run deploy:dev` runs it. `scripts/AGENTS.md` folds into `dev/AGENTS.md`, which now states the rule: code reaches a module by importing it from the package, never through `sys.path`, `PYTHONPATH` or a file path. Two tests put an older `leaf` first on `PYTHONPATH` to stand in for a stale plugin install. They now install the payload (`install_payload`) and run its own `bin/leaf`, as a host does. The `--version`/`--root` test and the re-vendor restart test assert what they did before. `TODO.md`'s "Repository tooling" item is done and removed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Sep 28, 2026
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.
scripts/held what the suite could import only through pytest'spythonpath = ["scripts"]. Each script becomes aleaf-devcommand in the module that owns it, the directory is gone, and nothing in the tree reaches code throughsys.path,PYTHONPATH,pythonpathor a file path any more.scripts/preview.pyleaf-dev previewscripts/corpus.pyleaf-dev corpusscripts/keydocs.pyleaf-dev keydocsscripts/verify_site.py(+verify-site-browser.js)leaf-dev verify-sitescripts/verify_codex_task.pyleaf-dev verify-codex-taskscripts/deploy-site-dev.shworker/deploy-dev.sh(npm run deploy:dev)leaf-dev previewexecs its worker into the selected checkout's--no-devenvironment, overlaid with this checkout'sleaf_devandwatchfiles. The worker runspython -m leaf_dev.previewrather than the command group, because the group's other commands importleaf_website, which that environment lacks. The argparse options become click options with the same names, and the hidden--_workerflag becomes--worker. Usage errors still exit 2, and a failedleafcall still exits with that call's own status.publish-site(its run lines and path filters), the eslint override, the Worker's npm script, and the tests all use the new names. The suite importsfrom leaf_dev import preview, verify_site, corpus, keydocs, and runs the preview aspython -m leaf_dev preview.scripts/AGENTS.mdfolds intodev/AGENTS.md, which now states the rule against import-path edits. TheAGENTS.mdrepository map,/developing-leafand the other docs name the commands.leaffirst onPYTHONPATHto stand in for a stale plugin install: the--version/--roottest and the re-vendor restart test. Each now installs the payload (install_payload) and runs that install's ownbin/leaf, as a host does. Their assertions are unchanged.examples/corpus.htmlanddocs/registry.htmleach change one line, the generator name in their header comment.TODO.md's "Repository tooling" item is done, so it is removed.leaf-dev bench-checkalready stopped usingPYTHONPATHin #1373.Checks:
leaf-dev --helplists the five new commands.leaf-dev preview triage-board --exportwrites the page.leaf-dev corpusreproduces the committed corpus.test_interact_preview,test_interact_product,test_website_server, and the two rewritten tests.test_render_exporttests that wait for a watched edit fail locally. They fail on this machine regardless of the change: plainwatchfiles.watchon a fresh temp directory reports no edit at all right now, at a load average above 40. Four of them, run alone on the merge base (2553559), fail the same way. CI's run is the reading for those tests.🤖 Generated with Claude Code