Skip to content

Commit b3c9bc9

Browse files
mnriemCopilot
andcommitted
refactor: finish integration CLI hierarchy
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 3f988db commit b3c9bc9

27 files changed

Lines changed: 964 additions & 1037 deletions

design/cli.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ extensions/
148148
The nested package's `__init__.py` owns its Typer application and registration.
149149
Shared helpers for that nested surface can live in `_helpers.py`.
150150

151+
Creating a nested CLI package does not transfer same-named domain behavior into
152+
that package. If an existing domain module collides with a new nested command
153+
namespace, keep the implementation in the parent domain package (or a focused
154+
domain module there). Preserve an established import path through thin
155+
compatibility exports from the nested package when required.
156+
151157
Do not add a nested `_commands.py` merely for symmetry. Create one only when
152158
the nested group develops substantial shared command infrastructure that no
153159
longer fits cleanly in `__init__.py` and `_helpers.py`.
@@ -208,10 +214,30 @@ The primary `test_command_<name>.py` suite verifies the public command surface.
208214
Phase-specific suites verify detailed invariants without obscuring the primary
209215
command behavior.
210216

211-
Not every test belongs in the mirrored command tree:
217+
Domain source remains in the parent package's `__init__.py` or a focused
218+
domain module without the `command_` prefix. Its mirrored tests use the domain
219+
subject name, for example:
220+
221+
```text
222+
src/specify_cli/integrations/__init__.py # catalog domain API
223+
tests/specify_cli/integrations/test_catalog.py
224+
225+
src/specify_cli/integrations/command_search.py
226+
tests/specify_cli/integrations/test_command_search.py
227+
```
228+
229+
Do not put `test_<domain>.py` under a nested command directory merely because
230+
the domain has the same name as that CLI namespace. The nested directory is
231+
reserved for `test_command_<name>.py` suites that exercise its actual
232+
subcommands.
233+
234+
Not every test is a command test, even when it belongs in the mirrored package
235+
tree:
212236

213-
- Domain model, registry, manager, and catalog behavior remains in domain test
214-
suites such as `tests/test_extensions.py`.
237+
- Domain model, registry, manager, and catalog behavior belongs at the parent
238+
package level, not under a nested command namespace and not in
239+
`test_command_*.py`. Existing consolidated domain suites such as
240+
`tests/test_extensions.py` may remain in place until separately reorganized.
215241
- Cross-domain CLI contracts remain with the broader integration tests.
216242
- Shared fixtures belong in the narrowest `conftest.py` that serves all of
217243
their consumers.

0 commit comments

Comments
 (0)