Skip to content

refactor: reorganize bundle CLI commands - #4663

Merged
mnriem merged 1 commit into
github:mainfrom
mnriem:mnriem-chore/bundle-cli-refactor
Sep 22, 2026
Merged

mnriem merged 1 commit into
github:mainfrom
mnriem:mnriem-chore/bundle-cli-refactor

Conversation

@mnriem

@mnriem mnriem commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Description

Refactor the specify bundle hierarchy to follow design/cli.md:

  • move each real bundle command into a dedicated command_<name>.py module
  • retain catalog/ as the only nested package because it is a genuine CLI namespace
  • flatten bundle domain APIs into specify_cli/bundles/ while preserving the public BundlerError import compatibility boundary
  • move command-focused tests into the mirrored tests/specify_cli/bundles/ hierarchy while retaining genuine contracts in their existing suites
  • remove the obsolete grouped command module and nested implementation packages

The rebase preserves upstream additions including bundle add, first-party catalog fallback behavior, and offline bundled-workflow installation. User-visible help is byte-identical to upstream/main.

Testing

  • Tested the complete specify bundle help surface locally and confirmed byte-identical output against upstream/main (36,645 bytes)
  • Ran the complete repository suite: 8,357 passed, 16 skipped, 53 warnings (8,373 collected; upstream collects 8,372)
  • Ran focused bundle and relevant cross-domain tests: 385 passed
  • Ran uvx ruff@0.15.0 check src tests
  • Ran git diff --check
  • Built the wheel and verified every new command module is packaged and obsolete bundle modules are absent
  • Verified command registration/order, compatibility imports, and no stale private import paths

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, powered by GPT-5.6 Sol, operated autonomously for repository analysis, code and test refactoring, rebase conflict resolution, validation, and PR drafting on behalf of @mnriem. The code and PR description are fully AI-drafted; validation evidence was produced by local automated commands.

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 23:21

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 and compatibility while retaining comprehensive command and domain regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Reorganizes the bundle CLI to match the repository’s command architecture while preserving behavior and the legacy BundlerError import.

Changes:

  • Splits bundle and catalog handlers into dedicated command modules.
  • Flattens bundle domain services under specify_cli.bundles.
  • Mirrors command tests and preserves regression and compatibility coverage.
File Description
tests/​unit/​test_bundle_download_url.py Moves source-resolution tests.
tests/​test_init_dir_cli.py Relocates bundle-specific override tests.
tests/​specify_cli/​bundles/​test_yamlio.py Updates flattened imports.
tests/​specify_cli/​bundles/​test_versioning.py Updates flattened imports.
tests/​specify_cli/​bundles/​test_validator.py Updates validator imports.
tests/​specify_cli/​bundles/​test_sources.py Consolidates source-resolution regressions.
tests/​specify_cli/​bundles/​test_security_paths.py Updates security-path imports.
tests/​specify_cli/​bundles/​test_resolver.py Updates resolver imports.
tests/​specify_cli/​bundles/​test_references.py Updates reference imports.
tests/​specify_cli/​bundles/​test_records.py Updates record imports.
tests/​specify_cli/​bundles/​test_primitives.py Updates primitive-service imports.
tests/​specify_cli/​bundles/​test_packager.py Updates packager imports.
tests/​specify_cli/​bundles/​test_offline.py Updates offline catalog tests.
tests/​specify_cli/​bundles/​test_installer.py Updates installer imports and patches.
tests/​specify_cli/​bundles/​test_conflict.py Updates conflict imports.
tests/​specify_cli/​bundles/​test_commands.py Tests shared CLI registration and errors.
tests/​specify_cli/​bundles/​test_command_validate.py Mirrors validate command coverage.
tests/​specify_cli/​bundles/​test_command_update.py Mirrors update command coverage.
tests/​specify_cli/​bundles/​test_command_search.py Mirrors search command coverage.
tests/​specify_cli/​bundles/​test_command_remove.py Mirrors remove command coverage.
tests/​specify_cli/​bundles/​test_command_list.py Mirrors list command coverage.
tests/​specify_cli/​bundles/​test_command_install.py Consolidates install command coverage.
tests/​specify_cli/​bundles/​test_command_init.py Mirrors init command coverage.
tests/​specify_cli/​bundles/​test_command_info.py Consolidates info and download coverage.
tests/​specify_cli/​bundles/​test_command_build.py Mirrors build command coverage.
tests/​specify_cli/​bundles/​test_command_add.py Covers the add alias and catalog flow.
tests/​specify_cli/​bundles/​test_catalog_stack.py Updates catalog-stack imports.
tests/​specify_cli/​bundles/​test_catalog_config.py Updates catalog-config imports.
tests/​specify_cli/​bundles/​test_bundles.py Verifies error-import compatibility.
tests/​specify_cli/​bundles/​test_adapters.py Updates adapter imports.
tests/​specify_cli/​bundles/​helpers.py Moves shared bundle test helpers.
tests/​specify_cli/​bundles/​conftest.py Adds scoped project fixture.
tests/​specify_cli/​bundles/​catalog/​test_command_remove.py Mirrors catalog remove coverage.
tests/​specify_cli/​bundles/​catalog/​test_command_list.py Mirrors catalog list coverage.
tests/​specify_cli/​bundles/​catalog/​test_command_add.py Mirrors catalog add coverage.
tests/​specify_cli/​bundles/​catalog/​__init__.py Adds nested test package marker.
tests/​specify_cli/​bundles/​_command_helpers.py Shares command-test setup helpers.
tests/​specify_cli/​bundles/​__init__.py Adds bundle test package marker.
tests/​integration/​test_bundler_init_install.py Moves install initialization tests.
tests/​contract/​test_manifest_schema.py Updates manifest API imports.
tests/​contract/​test_catalog_schema.py Updates catalog API imports.
src/​specify_cli/​commands/​bundle/​__init__.py Removes obsolete monolithic CLI module.
src/​specify_cli/​bundles/​yamlio.py Flattens package imports.
src/​specify_cli/​bundles/​versioning.py Flattens package imports.
src/​specify_cli/​bundles/​validator.py Flattens validator dependencies.
src/​specify_cli/​bundles/​sources.py Extracts manifest source resolution.
src/​specify_cli/​bundles/​resolver.py Flattens resolver dependencies.
src/​specify_cli/​bundles/​references.py Flattens reference dependencies.
src/​specify_cli/​bundles/​records.py Flattens record dependencies.
src/​specify_cli/​bundles/​project.py Flattens project helpers.
src/​specify_cli/​bundles/​primitives.py Flattens primitive integrations.
src/​specify_cli/​bundles/​packager.py Flattens packager dependencies.
src/​specify_cli/​bundles/​manifest.py Flattens manifest dependencies.
src/​specify_cli/​bundles/​installer.py Flattens installer dependencies.
src/​specify_cli/​bundles/​conflict.py Flattens conflict dependencies.
src/​specify_cli/​bundles/​command_validate.py Implements validate CLI adapter.
src/​specify_cli/​bundles/​command_update.py Implements update CLI adapter.
src/​specify_cli/​bundles/​command_search.py Implements search CLI adapter.
src/​specify_cli/​bundles/​command_remove.py Implements remove CLI adapter.
src/​specify_cli/​bundles/​command_list.py Implements list CLI adapter.
src/​specify_cli/​bundles/​command_install.py Implements install CLI adapter.
src/​specify_cli/​bundles/​command_init.py Implements init CLI adapter.
src/​specify_cli/​bundles/​command_info.py Implements info CLI adapter.
src/​specify_cli/​bundles/​command_build.py Implements build CLI adapter.
src/​specify_cli/​bundles/​command_add.py Implements add CLI adapter.
src/​specify_cli/​bundles/​catalogs.py Flattens catalog models.
src/​specify_cli/​bundles/​catalog/​command_remove.py Implements catalog remove adapter.
src/​specify_cli/​bundles/​catalog/​command_list.py Implements catalog list adapter.
src/​specify_cli/​bundles/​catalog/​command_add.py Implements catalog add adapter.
src/​specify_cli/​bundles/​catalog/​__init__.py Registers nested catalog commands.
src/​specify_cli/​bundles/​catalog_stack.py Flattens catalog-stack dependencies.
src/​specify_cli/​bundles/​catalog_config.py Flattens catalog configuration.
src/​specify_cli/​bundles/​adapters.py Flattens external adapters.
src/​specify_cli/​bundles/​_commands.py Centralizes group infrastructure and registration.
src/​specify_cli/​bundles/​__init__.py Documents the flattened package API.
src/​specify_cli/​bundler/​services/​__init__.py Removes obsolete nested package.
src/​specify_cli/​bundler/​models/​__init__.py Removes obsolete nested package.
src/​specify_cli/​bundler/​lib/​__init__.py Removes obsolete nested package.
src/​specify_cli/​bundler/​commands_impl/​__init__.py Removes obsolete implementation package.
src/​specify_cli/​bundler.py Preserves legacy BundlerError import.
src/​specify_cli/​__init__.py Registers the reorganized bundle CLI.

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

@mnriem
mnriem merged commit 175adbc into github:main Sep 22, 2026
15 checks passed
@mnriem
mnriem deleted the mnriem-chore/bundle-cli-refactor branch September 22, 2026 11:12
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