Skip to content

refactor(integrations): co-locate integration commands in integrations/ domain dir#2720

Open
darion-yaphet wants to merge 1 commit into
github:mainfrom
darion-yaphet:refactor/split-init-pr5
Open

refactor(integrations): co-locate integration commands in integrations/ domain dir#2720
darion-yaphet wants to merge 1 commit into
github:mainfrom
darion-yaphet:refactor/split-init-pr5

Conversation

@darion-yaphet
Copy link
Copy Markdown
Contributor

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:

  • Removes the now-unused commands/ stub files (integration.py, preset.py, extension.py, workflow.py)
  • Moves all 11 integration CLI handlers out of init.py into src/specify_cli/integrations/, split by responsibility:
File Lines Responsibility
_helpers.py 340 Domain helpers (JSON I/O, option resolution, default management)
_install_commands.py 306 install / uninstall
_migrate_commands.py 487 switch / upgrade
_query_commands.py 442 list / use / search / info / catalog subcommands
_commands.py 34 Typer app objects + register(app) thin shell
  • init.py reduced by ~1400 lines; the entire integration block replaced with a single register() call
  • No behavioral changes — pure structural refactor

Testing

  • Tested locally with uv run specify --help
  • Ran existing tests with uv sync && uv run pytest
  • Tested with a sample project (if applicable)

AI Disclosure

  • I did use AI assistance (describe below)

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.

…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
@darion-yaphet darion-yaphet requested a review from mnriem as a code owner May 27, 2026 06:22
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.

1 participant