Skip to content

task: fold infrahubctl marketplace CLI back onto shared ctl conventions #1166

Description

@dgarros

Need

infrahub_sdk/ctl/marketplace.py (~700 lines, 4 commands) has grown into an
architectural island within infrahubctl. It diverges from the shared CLI
conventions documented in infrahub_sdk/ctl/AGENTS.md on several axes:

  • Client — builds a raw httpx.AsyncClient via its own _make_http_client()
    (re-deriving proxy/TLS config from the SDK config) instead of the shared
    initialize_client(). initialize_client is never imported here.
  • Error handling — ships a parallel error framework (_ErrorClass, _fail(),
    _classify_http_error(), _fail_http_error()) alongside the shared
    catch_exception / handle_exception in ctl/utils.py.
  • Output — defines its own console / err_console (Console(stderr=True))
    stderr channel rather than the shared console pattern.

The result is effectively a mini-app: contributors touching marketplace commands
have to learn a second set of patterns, fixes to the shared client/error layer
do not reach it, and the divergence quietly undercuts the conventions the rest of
the CLI (and ctl/AGENTS.md) rely on.

Context

  • The file already imports and uses the shared catch_exception decorator, so it
    is only partially integrated — the two systems currently coexist.
  • Some divergence may be justified (e.g. the marketplace talks to public
    /api/v1/... endpoints that may not require an authenticated Infrahub client);
    scoping which parts should converge vs. stay bespoke is part of the work.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumThis issue should be completed in a less than a daytype/tech-debtItem we know we need to improve way it is implemented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions