Skip to content

feat(cli): let external packages add nooa subcommands via entry points - #62

Merged
sklinglernv merged 1 commit into
mainfrom
fix-cli-subcommands
Jul 31, 2026
Merged

feat(cli): let external packages add nooa subcommands via entry points#62
sklinglernv merged 1 commit into
mainfrom
fix-cli-subcommands

Conversation

@sklinglernv

Copy link
Copy Markdown
Collaborator

Adds a nooa_cli.commands entry-point group so packages outside this repo can contribute nooa subcommands, instead of shipping standalone console scripts.

[project.entry-points."nooa_cli.commands"]
tui = "my_package.cli.tui:command"

discover_commands() is now the existing built-in scan plus an entry-point pass. Built-ins are yielded first and win name collisions; each name is yielded once. Plugin failures (broken metadata, failing import, non-click.Command) are logged and skipped — the built-in scan still raises, since that's a bug in this repo. Plugins are sorted by entry-point name so --help doesn't depend on install order.

Mirrors the existing nooa.skills and nooa.bundled_configs groups.

Also included

The new tests wouldn't have run: testpaths pointed at packages/nooa-cli/tests/{cli,integration}, neither of which exists, so nothing under packages/nooa-cli/tests was collected in CI — test_cli_smoke.py included. Pointing it at the parent exposed a collision: the empty packages/nooa-cli/tests/__init__.py made that a package named tests, shadowing the root tests package. Deleted it; packages/nooa-bench/tests already ships without one.

Verification

11 new tests. Full suite 6385 passed / 5 skipped; ruff clean; nooa --help unchanged.

🤖 Generated with Claude Code

@sklinglernv
sklinglernv marked this pull request as ready for review July 30, 2026 14:43
Comment thread src/nooa/tracing/_litellm_patch.py Outdated
`nooa_cli.commands` discovered commands by scanning only its own directory,
so nothing outside this repo could add a `nooa` subcommand. Packages that
wanted to extend the CLI had to ship standalone console scripts instead,
changing the command name for every user.

Split `discover_commands()` into the existing built-in scan plus a new pass
over the `nooa_cli.commands` entry-point group, mirroring the existing
`nooa.skills` and `nooa.bundled_configs` groups:

    [project.entry-points."nooa_cli.commands"]
    tui = "my_package.cli.tui:command"

Built-ins are yielded first and win name collisions, so a third party cannot
shadow `eval` or `config`; each name is yielded exactly once. Every plugin
failure — broken distribution metadata, an entry point that fails to import,
or one resolving to a non-`click.Command` — is logged at WARNING and skipped,
since these are arbitrary third-party imports and must never make `nooa`
unusable. The built-in scan deliberately keeps raising `TypeError`: that is a
bug in this repo and should be loud. Plugins are sorted by entry-point name so
`nooa --help` does not depend on install order.

Two test-collection fixes were needed to make the new tests actually run:
`testpaths` pointed at `packages/nooa-cli/tests/{cli,integration}`, neither of
which exists, so nothing under `packages/nooa-cli/tests` was ever collected in
CI. Replacing both with the parent directory exposed a latent collision — the
empty `packages/nooa-cli/tests/__init__.py` made it a package named `tests`,
shadowing the root `tests` package that other modules import from. It is
unnecessary under the repo's `--import-mode=importlib`, and
`packages/nooa-bench/tests` already ships without one.

Signed-off-by: Severin Klingler <sklingler@nvidia.com>
@sklinglernv
sklinglernv force-pushed the fix-cli-subcommands branch from 05683a8 to 7302a1f Compare July 30, 2026 15:05
@sklinglernv
sklinglernv merged commit ebe9bb0 into main Jul 31, 2026
5 checks passed
@sklinglernv
sklinglernv deleted the fix-cli-subcommands branch July 31, 2026 05:35
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