Skip to content

feat(ctl): add marketplace browsing commands (list, search, show)#1127

Closed
iddocohen wants to merge 12 commits into
developfrom
ic-feat-add-marketplace-browsing
Closed

feat(ctl): add marketplace browsing commands (list, search, show)#1127
iddocohen wants to merge 12 commits into
developfrom
ic-feat-add-marketplace-browsing

Conversation

@iddocohen

@iddocohen iddocohen commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Why

infrahubctl marketplace get <namespace/name> can download a schema or collection, but only if you already know its exact identifier. There is no way to discover what the marketplace offers.

Goal: let users browse and inspect marketplace content directly from the CLI.

Non-goals: no changes to get/download behavior; no new marketplace API endpoints (uses the existing list/detail REST endpoints).

What changed

Behavioral — three new commands under infrahubctl marketplace:

  • list [--collections] [--limit N] [--json] — browse schemas (default) or collections
  • search <term> [--collections] [--limit N] [--json] — filter the catalog via the API search= param
  • show <namespace/name> [--collection] [--json] — full details of one item (versions/members, dependencies), with schema/collection auto-detect

Implementation notes:

  • Reuses the existing marketplace.py helpers (HTTP client, identifier parsing, host/error handling) — raw dicts, no new models and no new dependencies
  • Rich tables by default; --json emits parseable JSON on stdout while status/notes go to stderr (clean for piping)
  • Cursor-based pagination: fetches all pages by default; --limit N caps output to a single page with a Showing N of <total> footer
  • Error taxonomy: 4xx → exit 1 (not-found/invalid input), 5xx/transport → exit 2 (network)

What stayed the same: the existing get/download command is untouched; no schema changes; the marketplace URL still resolves from --marketplace-url / INFRAHUB_MARKETPLACE_URL / config.

How to review

  • Core: infrahub_sdk/ctl/marketplace.py — new list/search/show commands and their helpers
  • Tests: tests/unit/ctl/test_marketplace_app.py
  • Design + implementation plan: dev/specs/marketplace-browsing/
  • Generated (mechanical): docs/docs/infrahubctl/infrahubctl-marketplace.mdx

How to test

uv run pytest tests/unit/ctl/test_marketplace_app.py -v
uv run infrahubctl marketplace list
uv run infrahubctl marketplace search vlan
uv run infrahubctl marketplace show infrahub/vlan-translation

Impact & rollout

  • Backward compatibility: additive only; no breaking changes
  • Config/env changes: none (reuses the existing marketplace_url setting)
  • Deployment notes: safe to deploy

Checklist

  • Tests added/updated
  • Changelog entry added (changelog/+marketplace-browsing.added.md)
  • External docs updated (regenerated infrahubctl-marketplace.mdx)
  • Internal .md docs updated (dev/specs/marketplace-browsing/)

Summary by cubic

Adds infrahubctl marketplace list, search, and show to browse and inspect marketplace schemas and collections from the CLI. Improves discovery without changing get or any configs.

  • New Features

    • list [--collections] [--limit N] [--json] to browse schemas (default) or collections.
    • search <term> [--collections] [--limit N] [--json] to filter via search=.
    • show <namespace/name> [--collection] [--json] with auto-detect and full details (versions/members, dependencies).
    • Pagination: fetches all pages by default; --limit N requests a single page and prints “Showing N of ”.
    • Output: Rich tables by default; --json emits clean JSON to stdout, status/errors to stderr.
    • Uses existing list/detail REST endpoints; no new models or dependencies.
  • Bug Fixes

    • 4xx marketplace responses now exit 1 with clearer messages; 5xx/transport errors exit 2.
    • Guarded pagination to avoid loops when has_next_page is true but the server omits end_cursor.
    • Invalid or malformed JSON responses are treated as network errors (exit 2) with a clear message; in show schema/collection collisions, the note goes to stderr so --json output stays parseable.

Written for commit 1aa8b4a. Summary will update on new commits.

Review in cubic

@iddocohen iddocohen added the type/feature New feature or request label Jul 2, 2026
@github-actions github-actions Bot added the type/documentation Improvements or additions to documentation label Jul 2, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 2, 2026

Copy link
Copy Markdown

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1aa8b4a
Status: ✅  Deploy successful!
Preview URL: https://9fab9c1b.infrahub-sdk-python.pages.dev
Branch Preview URL: https://ic-feat-add-marketplace-brow.infrahub-sdk-python.pages.dev

View logs

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.50649% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/ctl/marketplace.py 93.50% 3 Missing and 7 partials ⚠️
@@             Coverage Diff             @@
##           develop    #1127      +/-   ##
===========================================
+ Coverage    82.16%   82.30%   +0.14%     
===========================================
  Files          138      138              
  Lines        11898    12051     +153     
  Branches      1784     1810      +26     
===========================================
+ Hits          9776     9919     +143     
- Misses        1572     1575       +3     
- Partials       550      557       +7     
Flag Coverage Δ
integration-tests 40.82% <12.98%> (-0.35%) ⬇️
python-3.10 55.75% <93.50%> (+0.49%) ⬆️
python-3.11 55.75% <93.50%> (+0.51%) ⬆️
python-3.12 55.75% <93.50%> (+0.49%) ⬆️
python-3.13 55.73% <93.50%> (+0.47%) ⬆️
python-3.14 55.75% <93.50%> (+0.51%) ⬆️
python-filler-3.12 22.46% <0.00%> (-0.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/ctl/marketplace.py 92.88% <93.50%> (+0.62%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 issues found across 7 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread changelog/1119.added.md Outdated
Comment thread tests/unit/ctl/test_marketplace_app.py Outdated
Comment thread dev/specs/marketplace-browsing/plan.md Outdated
Comment thread infrahub_sdk/ctl/marketplace.py Outdated
Comment thread infrahub_sdk/ctl/marketplace.py Outdated
Comment thread dev/specs/marketplace-browsing/design.md Outdated
@iddocohen iddocohen closed this Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/documentation Improvements or additions to documentation type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant