Skip to content

refactor: organize integration CLI commands - #4662

Merged
mnriem merged 3 commits into
github:mainfrom
mnriem:mnriem-chore-integration-cli-refactor
Sep 21, 2026
Merged

mnriem merged 3 commits into
github:mainfrom
mnriem:mnriem-chore-integration-cli-refactor

Conversation

@mnriem

@mnriem mnriem commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Description

Refactor the specify integration command hierarchy to follow the architecture documented in design/cli.md and established by the extension and preset command groups.

  • Move each real integration command into a dedicated command_<name>.py module.
  • Represent the nested specify integration catalog namespace with a matching package and command modules.
  • Keep integration catalog domain behavior in the parent integration package while preserving the established specify_cli.integrations.catalog import path.
  • Extract cohesive upgrade-layout and scaffold-generation phases into private _command_<name>_<phase>.py modules.
  • Remove obsolete grouped command modules and preserve supported registration, ordering, late-bound monkeypatch, and import compatibility boundaries.
  • Mirror command tests under tests/specify_cli/integrations/, retain cross-domain contracts in their existing suites, and document the command/domain source and test naming rules.

The refactor preserves byte-identical integration CLI help and increases repository collection from 8,226 to 8,230 tests without losing any original test function names.

Testing

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

Validation performed:

  • Complete repository suite after rebasing on current upstream/main: 8,356 passed, 16 skipped from 8,372 collected.
  • Focused integration and cross-domain suites: 1,375 passed.
  • uvx ruff@0.15.0 check src tests passed.
  • git diff --check passed.
  • Exact before/after help comparison for the complete specify integration surface was byte-identical.
  • Wheel inspection confirmed all new command modules are packaged and obsolete grouped modules are absent.
  • Final scope and registration review found no missing/duplicate commands, import cycles, packaging omissions, or lost/misclassified tests.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (fill in the disclosure below)

AI disclosure: Posted on behalf of @mnriem by GitHub Copilot (model: GPT-5.6 Sol; autonomous mode; platform-default reasoning effort). Copilot autonomously performed the code and test refactor, documentation update, compatibility analysis, validation, rebase, and fully drafted this pull request description. Human direction and review shaped the hierarchy boundaries, scope, and final source/test layout.

mnriem and others added 3 commits September 21, 2026 16:47
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 21, 2026 22:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

馃數 Needs a closer look

The 50-file, multi-thousand-line relocation touches registration and import boundaries, warranting final human verification despite extensive regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Refactors integration CLI commands into the repository鈥檚 documented command-module hierarchy while preserving catalog imports, registration order, and behavior.

Changes:

  • Splits integration and catalog handlers into dedicated command modules.
  • Extracts upgrade-layout and scaffold-generation phases.
  • Mirrors and reorganizes integration CLI tests and documents the structure.
File Description
design/鈥媍li.md Documents domain and nested-command placement.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媉_init__.py Hosts integration registry and catalog domain API.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媉command_scaffold_generation.py Identifies scaffold generation as a private phase.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媉command_upgrade_layout.py Extracts upgrade layout guards.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媉commands.py Centralizes ordered command registration.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媉migrate_commands.py Removes obsolete grouped migration handlers.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媉query_commands.py Removes obsolete grouped query handlers.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媌ob/鈥媉_init__.py Updates the upgrade-handler reference.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍atalog.py Removes the former catalog domain module.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍atalog/鈥媉_init__.py Registers catalog commands and preserves exports.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍atalog/鈥媍ommand_add.py Hosts catalog-add handling.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍atalog/鈥媍ommand_list.py Hosts catalog-list handling.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍atalog/鈥媍ommand_remove.py Hosts catalog-remove handling.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍ommand_info.py Hosts integration-info handling.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍ommand_install.py Narrows the module to installation.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍ommand_list.py Hosts integration-list handling.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍ommand_scaffold.py Uses the private scaffold phase.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍ommand_search.py Hosts integration-search handling.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍ommand_status.py Hosts integration-status handling.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍ommand_switch.py Hosts integration-switch handling.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍ommand_uninstall.py Hosts integration-uninstall handling.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍ommand_upgrade.py Hosts integration-upgrade handling.
src/鈥媠pecify_cli/鈥媔ntegrations/鈥媍ommand_use.py Hosts integration-use handling.
tests/鈥媔ntegrations/鈥媡est_cli.py Retains cross-domain CLI contracts.
tests/鈥媔ntegrations/鈥媡est_events.py Updates an obsolete module reference.
tests/鈥媔ntegrations/鈥媡est_integration_subcommand.py Removes the consolidated command suite.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媉_init__.py Defines the mirrored test package.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媉catalog_helpers.py Shares catalog CLI test helpers.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媉helpers.py Shares integration command helpers.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媉scaffold_helpers.py Shares scaffold test setup.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媍atalog/鈥媉_init__.py Defines the catalog test package.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媍atalog/鈥媡est_command_add.py Covers catalog-add behavior.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媍atalog/鈥媡est_command_list.py Covers catalog-list behavior.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媍atalog/鈥媡est_command_remove.py Covers catalog-remove behavior.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媍onftest.py Adds shared project fixtures.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_catalog.py Retains catalog domain tests.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_info.py Mirrors info-command tests.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_install.py Mirrors install-command tests.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_list.py Mirrors list-command tests.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_scaffold.py Covers the public scaffold command.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_scaffold_generation.py Covers scaffold generation internals.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_search.py Mirrors search-command tests.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_status.py Mirrors status-command tests.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_switch.py Mirrors switch-command tests.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_uninstall.py Mirrors uninstall-command tests.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_upgrade.py Mirrors upgrade-command tests.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_upgrade_layout.py Covers upgrade layout guards.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_command_use.py Mirrors use-command tests.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_lifecycle.py Retains lifecycle coverage.
tests/鈥媠pecify_cli/鈥媔ntegrations/鈥媡est_registration.py Verifies registration and compatibility.

馃挕 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mnriem
mnriem merged commit b9e7389 into github:main Sep 21, 2026
15 checks passed
@mnriem
mnriem deleted the mnriem-chore-integration-cli-refactor branch September 21, 2026 22:29
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