fix(cli): umbrella CLI standardization slice 5 — mounts, dedupe, completion group, categorized help - #352
Merged
Conversation
- scitex writer --help crashed with AttributeError: the registry probe picked up scitex_writer._cli.main (a plain console-script function) instead of the click group. Add the doctrine 5b re-export shim (scitex/cli/writer.py -> scitex_writer._cli.main_group) and make the lazy loader skip non-click-command attributes so a probe can never mount an uncallable object again. - scitex scholar was not mounted: no probe matched the standalone's entry point scitex_scholar._cli_main:cli. Add that probe shape.
…iases notify->notification, verify->clew, events->event, socialia->social. The old names are no longer registered as lazy subcommands; when scitex-dev's click_compat helper is importable (scitex-dev > 0.21.0) they come back as hidden warn-phase deprecated aliases that forward to the canonical command (doctrine 3-phase ladder, removed in v3.0); with an older scitex-dev they are simply excluded. figrecipe/plt is intentionally NOT deduplicated: scitex-plt is a published identity-alias package for figrecipe and doctrine 5b's brand table documents 'scitex plt' as a figrecipe mount. Hidden commands (the aliases) are now skipped in root help output.
Doctrine 1b (04_exceptions.md, amended 2026-07-07): a bare completion
command is banned; the completion GROUP with verb subcommands is the
canon. Changes:
- move the group out of main.py into scitex/cli/completion.py (lazily
mounted like every other wrapper; main.py shrinks well under the
512-line cap)
- bare 'scitex completion' now shows group help instead of silently
auto-installing
- 'completion install' gains --dry-run: prints the target rc file and
the completion script without touching the filesystem (subsumes the
old bash/zsh/fish script-dump leaves)
- 'completion bash|zsh|fish' become hidden warn-phase deprecated
leaves: still print the script, warn on stderr, removed in v3.0
- root help examples updated ('scitex completion --show' never existed)
- root help now renders the doctrine 4a fixed ordered category headers (Core / Data & Sync / Service / Diagnostics / Introspection / Shell; Other is the catch-all and stays empty) — implemented inside LazyGroup.format_commands so no lazy subcommand is imported for help (scitex-dev's CategorizedGroup resolves real command objects, which would defeat the lazy mount and reintroduce the ~45s cold start) - add -V as the short form of --version (doctrine 08 universal flags) - ~25 mounted groups whose one-liner degraded to the bare package name when the peer was not installed (dataset, git, hpc, newb, datetime, ...) now fall back to a curated one-liner sourced from each package's own pyproject description (_INTERNAL_HELP renamed _FALLBACK_HELP)
- writer/scholar mount smoke (--help exits 0) - retired duplicates hidden from help; warn-phase alias help page when scitex-dev click_compat is importable, unknown-command otherwise - completion noun group: verbs listed, deprecated bash/zsh/fish leaves hidden but still printing the script with a stderr warning, install --dry-run prints plan and never writes - -V short flag; 4a category headers, order, and empty Other - builder unit tests: alias exclusion, scholar probe shape, writer wrapper override, fallback one-liners
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Slice 5 of the CLI-standardization plan (scitex-dev proposal
2026-0707-cli-standardization.md; slices 1-4 landed in scitex-dev as #306/#307/#308/#310). Four logical commits, verified against the real CLI from this branch (PYTHONPATH=<worktree>/src, /opt/venv-sac interpreter).1. Fix broken mounts (writer crash, scholar missing)
scitex writer --helpcrashed (AttributeError: 'function' object has no attribute 'make_context'): the generic registry probe picked upscitex_writer._cli.main— a plain console-script function — instead of the click group. New doctrine §5b re-export shimscitex/cli/writer.pymountsscitex_writer._cli.main_group, andLazyGroup._load_lazynow skips any probed attribute that is not a click command, so this crash class is closed for every peer.scitex scholarwas not mounted: no probe shape matched the standalone entry pointscitex_scholar._cli_main:cli. Added that probe.Verified:
scitex writer --helpandscitex scholar --helpboth exit 0 and render the standalone groups.2. Dedupe duplicate namespaces
notify→notification,verify→clew,events→event,socialia→social. The old names are no longer registered; when scitex-dev shipsclick_compat(present in the repo, not yet in the released 0.21.0) they come back as hidden warn-phase deprecated aliases that forward to the canonical command (3-phase ladder, removed in v3.0); with an older scitex-dev they are simply excluded.eventswas a dead entry: the scitex-events peer ships no CLI, soscitex eventsappeared in help but failed on invocation.scitex-pltis a published identity-alias package (scitex_plt is figrecipe → True) and doctrine §5b's brand table documentsscitex pltas a figrecipe mount.figrecipeis canonical;pltself-describes as "(alias for figrecipe)".3. Canonical
completionnoun group (doctrine §1b, amended 2026-07-07)main.pyintoscitex/cli/completion.py(lazily mounted;main.pydrops to 276 lines).scitex completionnow shows group help — it no longer silently auto-installs.completion installgains--dry-run(prints target rc file + script, writes nothing) — subsumes the oldbash/zsh/fishscript-dump leaves, which remain as hidden warn-phase deprecated leaves (still print the script, warn on stderr, removed in v3.0).completion statusunchanged.4. Root help: categories,
-V, real one-linersOthercatch-all stays empty). Implemented insideLazyGroup.format_commands— scitex-dev'sCategorizedGroupresolves real command objects, which would defeat the lazy mount and reintroduce the ~45 s cold start, hence the local implementation following the same seven-category order.-Vadded as the short form of--version.dataset dataset,git git,hpc hpc, ...) now fall back to curated one-liners sourced from each package's own pyproject description.Tests
tests/scitex/cli/{test_main,test_completion,test__lazy_subcommands}.py— 84 passed, 2 skipped (the two skips are the click_compat-gated alias-forward tests; that helper is not in the released scitex-dev yet). Existingtests/scitex/test___main__.pyandtests/scitex/cli/test___init__.pystill green.Notes / follow-ups
src/scitex/cli/scholar/(in-tree scholar implementation) is a pre-existing parallel implementation of the standalone scholar CLI; it keeps its own tests and is untouched here. Reconciling it with the standalone (doctrine §5b single-source rule) is a follow-up.umbrella_subcommand: "social"in scitex-dev;src/scitex/cli/social.pyis also a §5b-forbidden subprocess wrapper — out of scope here.🤖 Generated with Claude Code