Skip to content

Fail ruff when code outside the CLI, the commands and the tests imports a leaf-dev command module - #6407

Merged
max-sixty merged 1 commit into
mainfrom
lint-command-imports
Nov 18, 2026
Merged

max-sixty merged 1 commit into
mainfrom
lint-command-imports

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Makes dev/AGENTS.md's rule that only the CLI and tests import a leaf-dev command module a ruff check. banned-api (TID251) bans leaf_dev.commands everywhere except cli.py, the commands themselves and the two test trees, so pre-commit, CI and wt merge refuse a helper module that imports a command, with a message saying where the code goes.

Five commits between 19 October and 3 November added such imports, and #6014 and #6380 then took two PRs to move them out; this check would have refused each one at commit time. It doesn't see one group's command importing another group's command. Nothing on main does that: every import inside commands/ is of the importer's own group's _name.py.

Max asked whether to add this as the follow-up to #6380.

Checks: pre-commit run ruff-check --all-files passes on main, and a used from leaf_dev.commands.site.verify import PAGES added to dev/leaf_dev/website_eval.py fails with the message.

This was written by Claude Code on behalf of max-sixty

…ts a leaf-dev command module

dev/AGENTS.md says only the CLI and tests import a command module. Five
commits between 2026-10-19 and 2026-11-03 (98f9d2f, 2872ba3,
46533e2, 13e3081, aa787c5) added imports of command modules to
helper modules, and #6014 and #6380 moved them out again. ruff's banned-api
now refuses such an import in pre-commit, CI and wt merge, and its message
says where the code goes.
@max-sixty
max-sixty merged commit 98d67bc into main Nov 18, 2026
7 of 8 checks passed
@max-sixty
max-sixty deleted the lint-command-imports branch November 18, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants