Skip to content

refactor: split commands/marketplace.py into per-command modules #821

@sergio-sisternes-epam

Description

@sergio-sisternes-epam

Summary

src/apm_cli/commands/marketplace.py has grown to 1,835 lines and contains 9 subcommands (init, build, validate, check, outdated, doctor, publish, plus the plugin subgroup wiring). This makes it the largest command file in the codebase and a bottleneck for code review.

Proposed structure

src/apm_cli/commands/marketplace/
  __init__.py          # Click group + shared helpers
  init.py              # marketplace init
  build.py             # marketplace build
  validate.py          # marketplace validate
  check.py             # marketplace check
  outdated.py          # marketplace outdated
  doctor.py            # marketplace doctor
  publish.py           # marketplace publish
  plugin/              # existing marketplace_plugin.py moves here
    __init__.py
    add.py
    set.py
    remove.py

Acceptance criteria

  • Each subcommand lives in its own module
  • Shared helpers (_render_build_table, _get_console, etc.) extracted to __init__.py or a _helpers.py
  • All existing tests pass without modification (import paths preserved via re-exports)
  • No functional changes -- pure structural refactor

Context

This was identified as merge condition C1 in the APM Expert Review Panel for PR #790. The Python Architect flagged it as a god-module that kills review velocity. The CEO ratified filing it as a follow-up issue rather than blocking the current PR.

Related: #722, #790

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions