Skip to content

chore: refactor root command adapters - #4687

Merged
mnriem merged 2 commits into
github:mainfrom
mnriem:mnriem-chore/root-command-refactor
Sep 22, 2026
Merged

mnriem merged 2 commits into
github:mainfrom
mnriem:mnriem-chore/root-command-refactor

Conversation

@mnriem

@mnriem mnriem commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Description

Refactor the remaining top-level Specify CLI command adapters so the root command surface follows design/cli.md.

  • Move specify init, specify check, and specify version into command_init.py, command_check.py, and command_version.py.
  • Keep specify_cli.__init__ responsible for the root Typer app, callback --version option, explicit command/group registration, root re-exports, and shared root behavior.
  • Remove the transitional specify_cli.commands package; there is no specify commands ... namespace.
  • Preserve root import and monkeypatch compatibility, including specify_cli.check_tool and root check/version exports.
  • Mirror root command tests under tests/specify_cli/ while keeping callback and domain tests separate.
  • Preserve OpenSSL runtime reporting added to specify version and its coverage.

The pytest collection count is preserved relative to the rebased upstream tree, and the wheel contains all three new command modules with no obsolete specify_cli/commands/ entries.

Testing

  • Tested locally with uv run specify --help
  • Ran the complete repository suite: .venv/bin/python -m pytest — 8,428 passed, 17 skipped; 8,445 collected
  • Ran uvx ruff@0.15.0 check src tests
  • Ran git diff --check
  • Built and inspected the wheel for required/obsolete module paths
  • Tested with a sample project (not applicable; command behavior is covered by the existing init/integration suites)

AI Disclosure

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

AI disclosure: GitHub Copilot (model: GPT-5.6 Sol, autonomous mode; reasoning effort managed by the runtime default) authored the code refactor, test migration, rebase/conflict resolution, validation commands, and this PR description on behalf of @mnriem. The contribution is fully AI-drafted.

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 22, 2026 21:09

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

🟡 Changes recommended

Root registration now changes the user-visible help ordering, contrary to the refactor’s compatibility requirement.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Refactors root CLI commands into dedicated adapters aligned with design/cli.md.

Changes:

  • Moves init, check, and version into command_*.py modules.
  • Removes the transitional commands package.
  • Migrates tests and preserves compatibility exports and monkeypatch paths.
File Description
src/​specify_cli/​__init__.py Registers and re-exports root adapters.
src/​specify_cli/​command_init.py Hosts the init adapter.
src/​specify_cli/​command_check.py Hosts the check adapter.
src/​specify_cli/​command_version.py Hosts the version adapter.
src/​specify_cli/​commands/​__init__.py Removes the obsolete package.
src/​specify_cli/​integrations/​_commands.py Updates an internal reference comment.
tests/​specify_cli/​test_command_init.py Migrates and expands init tests.
tests/​specify_cli/​test_command_check.py Moves check command tests.
tests/​specify_cli/​test_command_version.py Retains version-command coverage.
tests/​specify_cli/​test_root_version_callback.py Separates root version-option tests.
tests/​specify_cli/​test_check_tool.py Leaves domain-level tool checks.
tests/​specify_cli/​test_agent_config.py Removes obsolete package tests.
tests/​test_presets.py Updates init helper imports.
tests/​test_live_transient_windows.py Removes relocated init source test.
tests/​integrations/​test_cli.py Updates init patch/import paths.
tests/​integrations/​test_integration_alquimia.py Updates init patch paths.
tests/​integrations/​test_integration_claude.py Updates init patch paths.

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

Comment thread src/specify_cli/__init__.py Outdated
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

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

mnriem commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

Posted on behalf of @mnriem by GitHub Copilot (model: GPT-5.6 Sol, autonomous); comment fully AI-drafted.

Addressed the review finding in commit 8d9d50484a9cd9c8e1d1d2fc392c4df0775a2249.

Restored the original root registration and help order to init, check, version, and strengthened the root command regression test to assert that exact sequence.

Validation: 27 focused root-command tests passed; uvx ruff@0.15.0 check src tests passed; git diff --check passed.

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

🟢 Approval recommended

The structural refactor preserves registration order, compatibility paths, behavior, and corresponding test coverage.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@mnriem
mnriem merged commit 3a96599 into github:main Sep 22, 2026
15 checks passed
@mnriem
mnriem deleted the mnriem-chore/root-command-refactor branch September 22, 2026 21:44
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