Skip to content

refactor: organize workflow CLI commands - #4673

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

mnriem merged 2 commits into
github:mainfrom
mnriem:mnriem-chore/workflow-cli-refactor

Conversation

@mnriem

@mnriem mnriem commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • move every real specify workflow command into its paired command_<name>.py module while keeping shared registration and CLI infrastructure in workflows/_commands.py
  • model the genuine workflow catalog, workflow step, workflow step catalog, and workflow overlay namespaces as mirrored packages, with the step and overlay bounded subdomains owning their focused domain modules at their hierarchy roots
  • reorganize command-focused tests to mirror the source hierarchy, preserve domain and cross-domain contracts in their existing suites, and document the general bounded nested-subdomain ownership rule in design/cli.md
  • preserve established root handler imports, monkeypatch boundaries, command ordering, lazy/eager import behavior, and workflow catalog compatibility exports

Validation

  • repository collection: 8,384 before → 8,388 after; the four additions cover previously untested workflow and step catalog add/remove commands
  • complete repository suite: 8,372 passed, 16 skipped, 53 warnings
  • focused workflow command/domain/cross-domain suite: 1,601 passed
  • all original workflow test function names preserved exactly once
  • exact uvx ruff@0.15.0 check src tests: passed
  • git diff --check: passed
  • complete specify workflow help surface, including genuine nested namespaces: byte-identical before/after
  • wheel audit: all 29 command modules and two private phase modules packaged; obsolete plural workflows/steps, workflows/overlays, and old workflows/catalog.py modules absent
  • registration/import audit: 29 decorated handlers, none retained in _commands.py; no missing or duplicate registration
  • changed-path audit found no bundle, artifact, extension, preset, or integration hierarchy changes

Compatibility note

The former plural specify_cli.workflows.steps.* and specify_cli.workflows.overlays.* paths were internal implementation paths and are intentionally replaced by the singular bounded-domain roots. Repository consumers and tests use the canonical paths; established public root handlers and workflow-catalog compatibility exports remain available.

AI disclosure

Authored autonomously by GitHub Copilot (model: GPT-5.6 Sol) on behalf of @mnriem. The implementation, tests, validation, commit, conflict resolutions, and this pull request description were fully AI-generated.

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 12:41

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

The reorganization leaves a documented source path stale and introduces a duplicate unreachable forwarder statement.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 2 Low severity

Open (2)
What changed in this PR

Reorganizes workflow CLI handlers, nested namespaces, domain modules, and tests to mirror the command hierarchy.

Changes:

  • Moves 29 handlers into paired command_<name>.py modules.
  • Establishes singular step, overlay, and nested catalog packages.
  • Mirrors the new hierarchy in tests and documents bounded subdomains.
File Description
design/​cli.md Documents bounded nested subdomains.
src/​specify_cli/​__init__.py Updates root handler exports.
src/​specify_cli/​workflows/​__init__.py Uses singular step package.
src/​specify_cli/​workflows/​_commands.py Centralizes shared CLI infrastructure and registration.
src/​specify_cli/​workflows/​_command_resume_state.py Extracts resume ownership resolution.
src/​specify_cli/​workflows/​_command_run_ownership.py Extracts run ownership resolution.
src/​specify_cli/​workflows/​engine.py Uses the singular overlay package.
src/​specify_cli/​workflows/​command_add.py Owns workflow add handling.
src/​specify_cli/​workflows/​command_disable.py Owns workflow disable handling.
src/​specify_cli/​workflows/​command_enable.py Owns workflow enable handling.
src/​specify_cli/​workflows/​command_info.py Owns workflow info handling.
src/​specify_cli/​workflows/​command_list.py Owns workflow list handling.
src/​specify_cli/​workflows/​command_remove.py Owns workflow removal handling.
src/​specify_cli/​workflows/​command_resolve.py Owns workflow resolution handling.
src/​specify_cli/​workflows/​command_resume.py Owns workflow resume handling.
src/​specify_cli/​workflows/​command_run.py Owns workflow run handling.
src/​specify_cli/​workflows/​command_search.py Owns workflow search handling.
src/​specify_cli/​workflows/​command_status.py Owns workflow status handling.
src/​specify_cli/​workflows/​command_update.py Owns workflow update handling.
src/​specify_cli/​workflows/​catalog/​__init__.py Registers catalog commands and compatibility exports.
src/​specify_cli/​workflows/​catalog/​_domain.py Houses workflow catalog domain logic.
src/​specify_cli/​workflows/​catalog/​command_add.py Owns catalog add handling.
src/​specify_cli/​workflows/​catalog/​command_list.py Owns catalog list handling.
src/​specify_cli/​workflows/​catalog/​command_remove.py Owns catalog removal handling.
src/​specify_cli/​workflows/​overlay/​__init__.py Registers overlay commands and domain exports.
src/​specify_cli/​workflows/​overlay/​command_add.py Owns overlay add handling.
src/​specify_cli/​workflows/​overlay/​command_disable.py Owns overlay disable handling.
src/​specify_cli/​workflows/​overlay/​command_enable.py Owns overlay enable handling.
src/​specify_cli/​workflows/​overlay/​command_list.py Owns overlay list handling.
src/​specify_cli/​workflows/​overlay/​command_remove.py Owns overlay removal handling.
src/​specify_cli/​workflows/​overlay/​command_set_priority.py Owns priority updates.
src/​specify_cli/​workflows/​overlay/​composer.py Moves overlay composition logic.
src/​specify_cli/​workflows/​overlay/​layer_sources.py Moves overlay source logic.
src/​specify_cli/​workflows/​overlay/​merge.py Moves overlay merge logic.
src/​specify_cli/​workflows/​overlay/​operations.py Separates overlay domain operations.
src/​specify_cli/​workflows/​overlay/​resolver.py Moves workflow overlay resolution.
src/​specify_cli/​workflows/​overlay/​schema.py Moves overlay schema validation.
src/​specify_cli/​workflows/​step/​__init__.py Registers the step namespace.
src/​specify_cli/​workflows/​step/​_helpers.py Centralizes step command safeguards.
src/​specify_cli/​workflows/​step/​command_add.py Owns step add handling.
src/​specify_cli/​workflows/​step/​command_info.py Owns step info handling.
src/​specify_cli/​workflows/​step/​command_list.py Owns step list handling.
src/​specify_cli/​workflows/​step/​command_remove.py Owns step removal handling.
src/​specify_cli/​workflows/​step/​command_search.py Owns step search handling.
src/​specify_cli/​workflows/​step/​catalog/​__init__.py Registers step-catalog commands and exports.
src/​specify_cli/​workflows/​step/​catalog/​_domain.py Houses step-catalog domain logic.
src/​specify_cli/​workflows/​step/​catalog/​command_add.py Owns step-catalog add handling.
src/​specify_cli/​workflows/​step/​catalog/​command_list.py Owns step-catalog list handling.
src/​specify_cli/​workflows/​step/​catalog/​command_remove.py Owns step-catalog removal handling.
src/​specify_cli/​workflows/​step/​command/​__init__.py Relocates the command step.
src/​specify_cli/​workflows/​step/​do_while/​__init__.py Relocates the do-while step.
src/​specify_cli/​workflows/​step/​fan_in/​__init__.py Relocates the fan-in step.
src/​specify_cli/​workflows/​step/​fan_out/​__init__.py Relocates the fan-out step.
src/​specify_cli/​workflows/​step/​gate/​__init__.py Relocates the gate step.
src/​specify_cli/​workflows/​step/​if_then/​__init__.py Relocates the conditional step.
src/​specify_cli/​workflows/​step/​init/​__init__.py Relocates the init step.
src/​specify_cli/​workflows/​step/​prompt/​__init__.py Relocates the prompt step.
src/​specify_cli/​workflows/​step/​shell/​__init__.py Relocates the shell step.
src/​specify_cli/​workflows/​step/​slot/​__init__.py Relocates the slot step.
src/​specify_cli/​workflows/​step/​switch/​__init__.py Relocates the switch step.
src/​specify_cli/​workflows/​step/​while_loop/​__init__.py Relocates the while step.
src/​specify_cli/​workflows/​steps/​__init__.py Removes the obsolete plural package.
tests/​test_commands_package.py Updates the step import path.
tests/​unit/​test_condition_expression_block.py Updates control-step imports.
tests/​workflows/​test_overlay_composer.py Updates overlay imports.
tests/​workflows/​test_overlay_layer_sources.py Updates overlay imports.
tests/​workflows/​test_overlay_merge.py Updates overlay imports.
tests/​workflows/​test_overlay_schema.py Updates overlay imports.
tests/​workflows/​test_resolver_integration.py Updates resolver imports.
tests/​workflows/​test_slot_step.py Updates step and overlay imports.
tests/​specify_cli/​workflows/​__init__.py Defines the workflow test package.
tests/​specify_cli/​workflows/​conftest.py Provides shared workflow fixtures.
tests/​specify_cli/​workflows/​helpers.py Provides shared workflow helpers.
tests/​specify_cli/​workflows/​test_command_add.py Mirrors workflow-add coverage.
tests/​specify_cli/​workflows/​test_command_disable.py Mirrors disable coverage.
tests/​specify_cli/​workflows/​test_command_enable.py Covers workflow enable behavior.
tests/​specify_cli/​workflows/​test_command_info.py Covers workflow info rendering.
tests/​specify_cli/​workflows/​test_command_list.py Covers workflow list behavior.
tests/​specify_cli/​workflows/​test_command_remove.py Mirrors removal coverage.
tests/​specify_cli/​workflows/​test_command_resolve.py Covers workflow resolution.
tests/​specify_cli/​workflows/​test_command_resume.py Mirrors resume coverage.
tests/​specify_cli/​workflows/​test_command_resume_state.py Covers resume ownership safeguards.
tests/​specify_cli/​workflows/​test_command_run.py Mirrors run coverage.
tests/​specify_cli/​workflows/​test_command_run_ownership.py Covers run ownership safeguards.
tests/​specify_cli/​workflows/​test_command_search.py Covers workflow search behavior.
tests/​specify_cli/​workflows/​test_command_status.py Mirrors status coverage.
tests/​specify_cli/​workflows/​test_command_update.py Mirrors update coverage.
tests/​specify_cli/​workflows/​catalog/​__init__.py Defines workflow-catalog tests.
tests/​specify_cli/​workflows/​catalog/​test_command_add.py Covers catalog addition.
tests/​specify_cli/​workflows/​catalog/​test_command_list.py Covers catalog listing.
tests/​specify_cli/​workflows/​catalog/​test_command_remove.py Covers catalog removal.
tests/​specify_cli/​workflows/​overlay/​__init__.py Defines overlay command tests.
tests/​specify_cli/​workflows/​overlay/​test_command_add.py Mirrors overlay-add coverage.
tests/​specify_cli/​workflows/​overlay/​test_command_disable.py Covers overlay disabling.
tests/​specify_cli/​workflows/​overlay/​test_command_enable.py Covers overlay validation.
tests/​specify_cli/​workflows/​overlay/​test_command_list.py Covers overlay listing.
tests/​specify_cli/​workflows/​overlay/​test_command_remove.py Covers overlay removal.
tests/​specify_cli/​workflows/​overlay/​test_command_set_priority.py Covers priority updates.
tests/​specify_cli/​workflows/​step/​__init__.py Defines step command tests.
tests/​specify_cli/​workflows/​step/​test_command_add.py Mirrors step-add coverage.
tests/​specify_cli/​workflows/​step/​test_command_info.py Covers step info rendering.
tests/​specify_cli/​workflows/​step/​test_command_list.py Covers step listing.
tests/​specify_cli/​workflows/​step/​test_command_remove.py Covers step removal.
tests/​specify_cli/​workflows/​step/​test_command_search.py Covers step search.
tests/​specify_cli/​workflows/​step/​catalog/​__init__.py Defines step-catalog tests.
tests/​specify_cli/​workflows/​step/​catalog/​test_command_add.py Covers step-catalog addition.
tests/​specify_cli/​workflows/​step/​catalog/​test_command_list.py Covers step-catalog listing.
tests/​specify_cli/​workflows/​step/​catalog/​test_command_remove.py Covers step-catalog removal.

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

Comment thread design/cli.md
Comment thread src/specify_cli/workflows/_commands.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 12:53
@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); this comment was fully AI-drafted.

Addressed the review findings in commit 370bb200: the workflow architecture guide now references the singular src/specify_cli/workflows/step/ package, and the unreachable duplicate resolver delegation was removed. Validation passed with 47 targeted ownership/run tests, exact Ruff 0.15.0, and git diff --check.

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 broad package and registration reorganization warrants final human review despite strong compatibility coverage and no identified defects.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (1)

@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); this comment was fully AI-drafted.

Review 5278335235 introduces no new code finding. Its remaining open item is the prior architecture-path conversation, which is already fixed in commit 370bb200: workflows/ARCHITECTURE.md now references src/specify_cli/workflows/step/. The duplicate resolver delegation was also removed in that commit. All current CI checks pass. The conversation remains open for the reviewer or PR author to resolve according to repository policy.

@mnriem
mnriem merged commit c31168a into github:main Sep 22, 2026
15 checks passed
@mnriem
mnriem deleted the mnriem-chore/workflow-cli-refactor branch September 22, 2026 13: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