refactor(integrations): co-locate integration commands in integrations/ domain dir#2720
Open
darion-yaphet wants to merge 1 commit into
Open
refactor(integrations): co-locate integration commands in integrations/ domain dir#2720darion-yaphet wants to merge 1 commit into
darion-yaphet wants to merge 1 commit into
Conversation
…s/ domain dir
- Remove commands/ stubs (handlers will live in domain dirs)
- Move all integration CLI handlers out of __init__.py into integrations/
- Split into focused modules under integrations/:
_helpers.py (340 lines) — domain helpers
_install_commands.py (306 lines) — install / uninstall
_migrate_commands.py (487 lines) — switch / upgrade
_query_commands.py (442 lines) — list / use / search / info / catalog
_commands.py (34 lines) — app objects + register()
- __init__.py reduced by ~1400 lines; integration block replaced with register() call
- Fix patch paths in tests to new module locations
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the integration CLI command group out of specify_cli/__init__.py into domain-specific modules under specify_cli/integrations, reducing the main module toward a registration layer.
Changes:
- Adds integration command registration plus helper/install/migrate/query command modules under
src/specify_cli/integrations/. - Updates
initcommand imports and integration tests to use the new command module locations. - Removes now-unused placeholder command stub modules for integration/preset/extension/workflow.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/__init__.py |
Replaces in-file integration command definitions with integration command registration. |
src/specify_cli/integrations/_commands.py |
Defines Typer integration apps and registration entry point. |
src/specify_cli/integrations/_helpers.py |
Moves shared integration command helper logic. |
src/specify_cli/integrations/_install_commands.py |
Moves install/uninstall command handlers. |
src/specify_cli/integrations/_migrate_commands.py |
Moves switch/upgrade command handlers. |
src/specify_cli/integrations/_query_commands.py |
Moves list/use/search/info/catalog query handlers. |
src/specify_cli/commands/init.py |
Updates lazy helper imports to the new integration command module. |
src/specify_cli/commands/integration.py |
Removes obsolete placeholder stub. |
src/specify_cli/commands/preset.py |
Removes obsolete placeholder stub. |
src/specify_cli/commands/extension.py |
Removes obsolete placeholder stub. |
src/specify_cli/commands/workflow.py |
Removes obsolete placeholder stub. |
tests/test_commands_package.py |
Removes importability coverage for deleted placeholder stubs. |
tests/integrations/test_integration_subcommand.py |
Updates monkeypatch/import targets for moved integration helpers. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 13/13 changed files
- Comments generated: 1
Comment on lines
+91
to
+107
| table = Table(title="Available Integrations") | ||
| table.add_column("Key", style="cyan") | ||
| table.add_column("Name") | ||
| table.add_column("Status") | ||
| table.add_column("Multi-install Safe") | ||
|
|
||
| for key, integration in sorted(INTEGRATION_REGISTRY.items()): | ||
| cfg = integration.config or {} | ||
| name = cfg.get("name", key) | ||
| if key == default_key: | ||
| status = "[green]installed (default)[/green]" | ||
| elif key in installed_keys: | ||
| status = "[green]installed[/green]" | ||
| else: | ||
| status = "" | ||
| safe = "[green]yes[/green]" if getattr(integration, "multi_install_safe", False) else "[dim]no[/dim]" | ||
| table.add_row(key, name, status, safe) |
mnriem
requested changes
May 27, 2026
Collaborator
mnriem
left a comment
There was a problem hiding this comment.
Please address Copilot feedback
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.
Description
Part of an 8-PR series to reduce init.py from ~4500 lines to a thin registration layer by co-locating each command group with its domain subdirectory.
This PR covers the integration command group:
Testing
AI Disclosure
Code structure and split boundaries designed and reviewed with Claude Code. All logic is moved verbatim from the original init.py — no algorithmic changes were
made.