You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dev/specs/001-marketplace-api-update/plan.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6
## Summary
7
7
8
-
Migrate `infrahubctl marketplace download` to the public REST API at `marketplace.infrahub.app`, add auto-detection of schema-vs-collection identifiers, keep the `--version` pinning flag for schemas, and retain `--output-dir` (default `./schemas`). The REST migration, `--version`, and `--output-dir` pieces have already shipped in the current branch's `Marketplace` commit; the remaining deltas are auto-detection, the four-class error taxonomy, and the documented precedence rule for namespace/name collisions.
8
+
Migrate `infrahubctl marketplace get` to the public REST API at `marketplace.infrahub.app`, add auto-detection of schema-vs-collection identifiers, keep the `--version` pinning flag for schemas, and retain `--output-dir` (default `./schemas`). The REST migration, `--version`, and `--output-dir` pieces have already shipped in the current branch's `Marketplace` commit; the remaining deltas are auto-detection, the four-class error taxonomy, and the documented precedence rule for namespace/name collisions.
Copy file name to clipboardExpand all lines: dev/specs/001-marketplace-api-update/spec.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,22 +7,22 @@
7
7
8
8
## Overview
9
9
10
-
The public Infrahub Marketplace at `marketplace.infrahub.app` is now live and exposes a REST API for distributing schemas and schema collections. The existing `infrahubctl marketplace download` command was designed against an earlier GraphQL-based interface and must be realigned with the new REST contract. Alongside that migration, users need a simpler, less error-prone download experience: one identifier argument that Works For Schemas And Collections alike, an optional pinned version, and predictable default output placement.
10
+
The public Infrahub Marketplace at `marketplace.infrahub.app` is now live and exposes a REST API for distributing schemas and schema collections. The existing `infrahubctl marketplace get` command was designed against an earlier GraphQL-based interface and must be realigned with the new REST contract. Alongside that migration, users need a simpler, less error-prone download experience: one identifier argument that Works For Schemas And Collections alike, an optional pinned version, and predictable default output placement.
11
11
12
12
## User Scenarios & Testing *(mandatory)*
13
13
14
14
### User Story 1 - Download any published item by identifier (Priority: P1)
15
15
16
-
As a platform engineer bootstrapping a new Infrahub environment, I want to run a single `infrahubctl marketplace download <namespace>/<name>` command and have the tool figure out whether I'm asking for a single schema or a full collection so that I don't need to inspect the marketplace UI or remember which flag to pass.
16
+
As a platform engineer bootstrapping a new Infrahub environment, I want to run a single `infrahubctl marketplace get <namespace>/<name>` command and have the tool figure out whether I'm asking for a single schema or a full collection so that I don't need to inspect the marketplace UI or remember which flag to pass.
17
17
18
18
**Why this priority**: This is the primary workflow for every marketplace user. Without automatic detection, every first-time user who types the command will either guess wrong or abandon the command line and revisit the web UI, undermining the value of the CLI.
19
19
20
20
**Independent Test**: Publish one schema and one collection to the marketplace (or mock the API), then run the download command twice — once against each identifier — without passing any type-hint flag. Both invocations succeed, write the correct files, and print the correct item type.
21
21
22
22
**Acceptance Scenarios**:
23
23
24
-
1.**Given** the identifier `acme/network-base` refers to a single schema on the marketplace, **When** the user runs `infrahubctl marketplace download acme/network-base`, **Then** the CLI downloads the schema file to the default destination and reports it was downloaded as a schema.
25
-
2.**Given** the identifier `acme/starter-pack` refers to a collection on the marketplace, **When** the user runs `infrahubctl marketplace download acme/starter-pack`, **Then** the CLI downloads every schema in the collection to the default destination and reports the collection totals.
24
+
1.**Given** the identifier `acme/network-base` refers to a single schema on the marketplace, **When** the user runs `infrahubctl marketplace get acme/network-base`, **Then** the CLI downloads the schema file to the default destination and reports it was downloaded as a schema.
25
+
2.**Given** the identifier `acme/starter-pack` refers to a collection on the marketplace, **When** the user runs `infrahubctl marketplace get acme/starter-pack`, **Then** the CLI downloads every schema in the collection to the default destination and reports the collection totals.
26
26
3.**Given** the identifier does not match any published schema or collection, **When** the user runs the download command, **Then** the CLI fails with a clear message naming the identifier and the marketplace that was queried, and exits non-zero.
27
27
28
28
---
@@ -37,7 +37,7 @@ As a configuration author integrating a schema into a production pipeline, I wan
37
37
38
38
**Acceptance Scenarios**:
39
39
40
-
1.**Given** schema `acme/network-base` has published versions `0.9.0` and `1.2.0`, **When** the user runs `infrahubctl marketplace download acme/network-base --version 0.9.0`, **Then** the CLI writes the `0.9.0` payload to disk and reports that version in its success output.
40
+
1.**Given** schema `acme/network-base` has published versions `0.9.0` and `1.2.0`, **When** the user runs `infrahubctl marketplace get acme/network-base --version 0.9.0`, **Then** the CLI writes the `0.9.0` payload to disk and reports that version in its success output.
41
41
2.**Given** the user passes `--version` with a value that has not been published for the schema, **When** the command runs, **Then** the CLI fails with a message that distinguishes "version not found" from "schema not found" and exits non-zero.
42
42
3.**Given** the target identifier resolves to a collection, **When** the user also passes `--version`, **Then** the CLI warns that `--version` has no effect for collections and proceeds with the collection download.
43
43
@@ -72,7 +72,7 @@ As a repository owner whose project uses a non-standard layout, I want to direct
72
72
73
73
### Functional Requirements
74
74
75
-
-**FR-001**: The `infrahubctl marketplace download` command MUST communicate with the marketplace exclusively over its public REST API; no GraphQL usage for marketplace operations is permitted.
75
+
-**FR-001**: The `infrahubctl marketplace get` command MUST communicate with the marketplace exclusively over its public REST API; no GraphQL usage for marketplace operations is permitted.
76
76
-**FR-002**: The command MUST accept a single positional identifier in `namespace/name` form and reject any other shape with a usage error before making network calls.
77
77
-**FR-003**: When no type-hint flag is passed, the command MUST automatically determine whether the identifier refers to a schema or a collection and download accordingly, reporting the resolved type in its output.
78
78
-**FR-004**: The command MUST expose a `--version` option that, when provided, pins the download to that specific published semver for a schema.
Copy file name to clipboardExpand all lines: dev/specs/001-marketplace-api-update/tasks.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ Single project: repository root contains `infrahub_sdk/` and `tests/`. All paths
48
48
49
49
## Phase 3: User Story 1 — Auto-detect schema vs. collection (Priority: P1) 🎯 MVP
50
50
51
-
**Goal**: A single `infrahubctl marketplace download <namespace>/<name>` command resolves to the correct item type without the user passing `--collection`, and prints the resolved type in success output.
51
+
**Goal**: A single `infrahubctl marketplace get <namespace>/<name>` command resolves to the correct item type without the user passing `--collection`, and prints the resolved type in success output.
52
52
53
53
**Independent Test**: Mock one schema endpoint and one collection endpoint (as in `tests/unit/ctl/test_marketplace_app.py`). Run the download twice with no `--collection` flag — once against each identifier. Both succeed, files land at the expected paths, and the output names the resolved type.
54
54
@@ -70,7 +70,7 @@ Single project: repository root contains `infrahub_sdk/` and `tests/`. All paths
70
70
-[ ] T016 [US1] Route the existing 404 handling in `_download_schema` and `_download_collection` in `infrahub_sdk/ctl/marketplace.py` through `_fail("not-found", ...)`.
71
71
-[ ] T017 [US1] Add network-error handling (`httpx.ConnectError`, `httpx.TimeoutException`, 5xx) wrapping the `async with httpx.AsyncClient...` block in `infrahub_sdk/ctl/marketplace.py`'s `download()` and route through `_fail("network", ...)`.
72
72
73
-
**Checkpoint**: Tests T006–T011 all pass. Running `infrahubctl marketplace download acme/starter-pack` (collection) and `infrahubctl marketplace download acme/network-base` (schema) both succeed without `--collection`, and the output names the resolved type. MVP scope.
73
+
**Checkpoint**: Tests T006–T011 all pass. Running `infrahubctl marketplace get acme/starter-pack` (collection) and `infrahubctl marketplace get acme/network-base` (schema) both succeed without `--collection`, and the output names the resolved type. MVP scope.
74
74
75
75
---
76
76
@@ -90,7 +90,7 @@ Single project: repository root contains `infrahub_sdk/` and `tests/`. All paths
90
90
-[ ] T020 [US2] In `infrahub_sdk/ctl/marketplace.py``_download_schema`, when `version` is provided and the versioned request returns 404, first retry an unversioned HEAD/GET against the same identifier to decide between "schema not found" and "version not found"; route through `_fail` with the appropriate class.
91
91
-[ ] T021 [US2] Confirm that the existing "`--version` is ignored when downloading a collection" warning (currently at `marketplace.py:146-147`) still fires on the auto-detect path — i.e. when the user passed `--version` and the detected type is `collection`, the warning is printed before falling through to `_download_collection`. Add/adjust wiring in `download()` in `infrahub_sdk/ctl/marketplace.py` as needed.
92
92
93
-
**Checkpoint**: US1 still passes; T018 and T019 pass; `infrahubctl marketplace download acme/network-base --version 9.9.9` prints the version-not-found message and exits 1.
93
+
**Checkpoint**: US1 still passes; T018 and T019 pass; `infrahubctl marketplace get acme/network-base --version 9.9.9` prints the version-not-found message and exits 1.
0 commit comments