@bagdock/cli 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bagdock/cli",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Bagdock developer CLI — build, test, and deploy apps and edges on the Bagdock platform",
5
5
  "keywords": [
6
6
  "bagdock",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "skill": "bagdock-cli",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "evals": [
5
5
  {
6
6
  "id": "login-flow",
@@ -147,6 +147,104 @@
147
147
  "input": "What apps do I have deployed?",
148
148
  "expected_commands": ["bagdock apps list --json"],
149
149
  "expected_behavior": "Lists all deployed apps with slugs, types, and status"
150
+ },
151
+ {
152
+ "id": "validate-before-submit",
153
+ "description": "Agent should validate before submitting",
154
+ "input": "Check if my adapter is ready to submit to the marketplace",
155
+ "expected_commands": ["bagdock validate --json"],
156
+ "expected_behavior": "Runs local checks on bagdock.json and bundle, returns pass/warn/fail"
157
+ },
158
+ {
159
+ "id": "submission-list",
160
+ "description": "Agent should list submissions",
161
+ "input": "Show me all my marketplace submissions for this app",
162
+ "expected_commands": ["bagdock submission list --json"],
163
+ "expected_behavior": "Lists submission history with IDs, versions, and dates"
164
+ },
165
+ {
166
+ "id": "submission-status",
167
+ "description": "Agent should check submission status",
168
+ "input": "What's the review status of submission iadpv_abc123?",
169
+ "expected_commands": ["bagdock submission status iadpv_abc123 --json"],
170
+ "expected_behavior": "Returns detailed review state including status, reason, and timestamps"
171
+ },
172
+ {
173
+ "id": "submission-withdraw",
174
+ "description": "Agent should withdraw a pending submission",
175
+ "input": "Withdraw my pending submission iadpv_abc123, I found a bug",
176
+ "expected_commands": ["bagdock submission withdraw iadpv_abc123"],
177
+ "expected_behavior": "Cancels submission, sets review_status back to draft"
178
+ },
179
+ {
180
+ "id": "open-dashboard",
181
+ "description": "Agent should open project in dashboard",
182
+ "input": "Open my adapter in the Bagdock dashboard",
183
+ "expected_commands": ["bagdock open"],
184
+ "expected_behavior": "Opens browser to dashboard URL for the current project"
185
+ },
186
+ {
187
+ "id": "inspect-app",
188
+ "description": "Agent should inspect app deployment details",
189
+ "input": "Show me the deployment details for smart-entry",
190
+ "expected_commands": ["bagdock inspect smart-entry --json"],
191
+ "expected_behavior": "Returns app details including worker URL, version, review status"
192
+ },
193
+ {
194
+ "id": "env-pull",
195
+ "description": "Agent should pull env vars for local development",
196
+ "input": "Pull the env var keys from my deployed adapter to a local .env file",
197
+ "expected_commands": ["bagdock env pull .env.local"],
198
+ "expected_behavior": "Creates .env.local with keys and empty values, warns that values need filling"
199
+ },
200
+ {
201
+ "id": "link-project",
202
+ "description": "Agent should link directory to a project",
203
+ "input": "Link this directory to my smart-entry adapter",
204
+ "expected_commands": ["bagdock link --slug smart-entry"],
205
+ "expected_behavior": "Creates .bagdock/link.json with slug, other commands use it as fallback"
206
+ },
207
+ {
208
+ "id": "switch-operator-sandbox",
209
+ "description": "Agent should switch to sandbox environment for testing",
210
+ "input": "Switch to test mode for the WiseStorage operator",
211
+ "expected_commands": ["bagdock switch --operator wisestorage --env test"],
212
+ "expected_behavior": "Updates active profile with operatorSlug=wisestorage and environment=test"
213
+ },
214
+ {
215
+ "id": "switch-interactive",
216
+ "description": "Agent should use interactive switch when operator unknown",
217
+ "input": "I want to switch to a different operator",
218
+ "expected_commands": ["bagdock switch"],
219
+ "expected_behavior": "Lists available operators, prompts selection, then prompts environment choice"
220
+ },
221
+ {
222
+ "id": "deploy-to-test",
223
+ "description": "Agent should deploy to sandbox environment",
224
+ "input": "Deploy my adapter to the sandbox for testing",
225
+ "expected_commands": ["bagdock --env test deploy --target staging --yes"],
226
+ "expected_behavior": "Deploys to staging target within the test/sandbox environment"
227
+ },
228
+ {
229
+ "id": "inspect-test-env",
230
+ "description": "Agent should inspect an app in test environment",
231
+ "input": "Show me the deployment details of my app in the sandbox",
232
+ "expected_commands": ["bagdock --env test inspect --json"],
233
+ "expected_behavior": "Returns app details from the sandbox tenant database"
234
+ },
235
+ {
236
+ "id": "link-with-env",
237
+ "description": "Agent should link directory with specific environment",
238
+ "input": "Link this directory to smart-entry in test mode",
239
+ "expected_commands": ["bagdock link --slug smart-entry --env test"],
240
+ "expected_behavior": "Creates .bagdock/link.json with slug and environment=test"
241
+ },
242
+ {
243
+ "id": "env-override-per-command",
244
+ "description": "Agent should use --env flag to override environment for a single command",
245
+ "input": "List apps on the live environment even though I'm currently in test mode",
246
+ "expected_commands": ["bagdock --env live apps list --json"],
247
+ "expected_behavior": "Lists apps from the live tenant database, does not change profile"
150
248
  }
151
249
  ]
152
250
  }
@@ -45,9 +45,19 @@ For CI/CD, set `BAGDOCK_API_KEY` in your environment. For interactive use, run `
45
45
  | `-q, --quiet` | Suppress status messages (implies `--json`) |
46
46
  | `--api-key <key>` | Override auth for this invocation |
47
47
  | `-p, --profile <name>` | Use a named profile (overrides `BAGDOCK_PROFILE`) |
48
+ | `--env <live\|test>` | Override environment for this invocation |
48
49
  | `-V, --version` | Print version |
49
50
  | `-h, --help` | Print help |
50
51
 
52
+ ## Environment Context
53
+
54
+ All API calls include `X-Environment` and `X-Operator-Slug` headers. Resolution:
55
+
56
+ - **Environment**: `--env` flag > `.bagdock/link.json` > profile > `BAGDOCK_ENV` > `live`
57
+ - **Operator**: `BAGDOCK_OPERATOR` env var > profile stored value
58
+
59
+ Use `bagdock switch` to select operator and environment interactively, or pass `--env test` to any command.
60
+
51
61
  ## Available Commands
52
62
 
53
63
  | Command | Description |
@@ -62,11 +72,20 @@ For CI/CD, set `BAGDOCK_API_KEY` in your environment. For interactive use, run `
62
72
  | `env list` | List app environment variables |
63
73
  | `env set <key> <value>` | Set an environment variable |
64
74
  | `env remove <key>` | Remove an environment variable |
75
+ | `env pull [file]` | Pull remote env var keys to local .env file |
65
76
  | `keys create` | Create a new API key (raw key shown once) |
66
77
  | `keys list` | List API keys |
67
78
  | `keys delete <id>` | Revoke an API key |
79
+ | `validate` | Run local pre-submission checks on bagdock.json and bundle |
80
+ | `submission list` | List marketplace submission history |
81
+ | `submission status <id>` | Fetch detailed review state for a submission |
82
+ | `submission withdraw <id>` | Cancel a pending submission |
83
+ | `open [slug]` | Open project in Bagdock dashboard |
84
+ | `inspect [slug]` | Show deployment details and status |
85
+ | `link` | Link directory to a Bagdock app or edge |
86
+ | `switch` | Switch operator and environment context (live/test) |
68
87
  | `doctor` | Run environment diagnostics (version, auth, config, agents) |
69
- | `auth list` | List stored profiles |
88
+ | `auth list` | List stored profiles (with operator + env) |
70
89
  | `auth switch [name]` | Switch active profile |
71
90
  | `apps list` | List deployed applications |
72
91
  | `apps get <slug>` | Show details for an application |
@@ -112,6 +131,34 @@ bagdock keys list --json
112
131
  3. **Missing `bagdock.json`** — `deploy`, `submit`, and `env` commands require a `bagdock.json` in the current directory. Run `bagdock init` first.
113
132
  4. **Expired session** — If `whoami` fails, run `bagdock login` again. Sessions expire after 8 hours.
114
133
 
134
+ ### Validate before submitting
135
+
136
+ ```bash
137
+ bagdock validate
138
+ bagdock submit
139
+ ```
140
+
141
+ ### Check submission status
142
+
143
+ ```bash
144
+ bagdock submission list --json
145
+ bagdock submission status iadpv_xxx
146
+ ```
147
+
148
+ ### Link a directory and inspect
149
+
150
+ ```bash
151
+ bagdock link --slug my-adapter
152
+ bagdock inspect
153
+ bagdock open
154
+ ```
155
+
156
+ ### Pull env vars for local dev
157
+
158
+ ```bash
159
+ bagdock env pull .env.local
160
+ ```
161
+
115
162
  ## When to Load References
116
163
 
117
164
  Load specific reference files when the task involves:
@@ -121,3 +168,5 @@ Load specific reference files when the task involves:
121
168
  - **Environment variables** → `references/env.md`
122
169
  - **Local development** → `references/dev.md`
123
170
  - **Error codes or troubleshooting** → `references/error-codes.md`
171
+ - **Marketplace submission lifecycle** → `references/marketplace.md`
172
+ - **App management (open, inspect, link)** → `references/app-management.md`
@@ -0,0 +1,63 @@
1
+ # App Management Commands
2
+
3
+ Commands for managing the relationship between your local directory and a Bagdock app or edge.
4
+
5
+ ## `bagdock link`
6
+
7
+ Links the current directory to a Bagdock app or edge. Once linked, other commands (deploy, env, open, inspect, submission) use the linked slug as a fallback — no `bagdock.json` required.
8
+
9
+ ```bash
10
+ # Interactive: select from your apps
11
+ bagdock link
12
+
13
+ # Non-interactive (CI/agents)
14
+ bagdock link --slug my-adapter
15
+ ```
16
+
17
+ Stores the link in `.bagdock/link.json`:
18
+
19
+ ```json
20
+ {
21
+ "slug": "my-adapter",
22
+ "linkedAt": "2026-04-05T00:00:00.000Z"
23
+ }
24
+ ```
25
+
26
+ ### Slug Resolution Order
27
+
28
+ 1. Explicit `--slug` or `--app` argument
29
+ 2. `bagdock.json` in current directory
30
+ 3. `.bagdock/link.json` (linked app)
31
+
32
+ ## `bagdock open [slug]`
33
+
34
+ Opens the project in the Bagdock dashboard. Uses the slug resolution order above.
35
+
36
+ ```bash
37
+ bagdock open
38
+ bagdock open my-adapter
39
+ ```
40
+
41
+ In JSON mode, returns the URL instead of opening the browser:
42
+
43
+ ```bash
44
+ bagdock open --json
45
+ # => {"url":"https://dashboard.bagdock.com/developer/apps/my-adapter","slug":"my-adapter"}
46
+ ```
47
+
48
+ ## `bagdock inspect [slug]`
49
+
50
+ Shows deployment details for an app.
51
+
52
+ ```bash
53
+ bagdock inspect
54
+ bagdock inspect my-adapter --json
55
+ ```
56
+
57
+ Displays:
58
+ - Name, slug, ID
59
+ - Type, category
60
+ - Version, maintainer, visibility
61
+ - Review status
62
+ - Worker URL, namespace
63
+ - Created, updated, published timestamps
@@ -0,0 +1,69 @@
1
+ # Marketplace Submission Lifecycle
2
+
3
+ The Bagdock marketplace uses a reviewed submission model. Developers submit, Bagdock reviews, then approves or rejects. `bagdock publish` is intentionally not a CLI command — final publication is handled by Bagdock staff.
4
+
5
+ ## Workflow
6
+
7
+ 1. `bagdock validate` — Run local checks before uploading
8
+ 2. `bagdock submit` — Upload bundle and request review (draft -> submitted)
9
+ 3. `bagdock submission list` — View all submissions
10
+ 4. `bagdock submission status <id>` — Check review progress
11
+ 5. `bagdock submission withdraw <id>` — Cancel before approval (submitted -> draft)
12
+
13
+ ## Commands
14
+
15
+ ### `bagdock validate`
16
+
17
+ Local-only checks — no API call needed. Validates:
18
+
19
+ - `bagdock.json` exists and parses
20
+ - Required fields present (name, slug, version, type, category, main)
21
+ - Type is `edge` or `app`
22
+ - Entry point file exists
23
+ - Bundle size under 10 MB
24
+
25
+ ```bash
26
+ bagdock validate
27
+ bagdock validate --json
28
+ ```
29
+
30
+ Exit code 0 = pass/warn, 1 = fail.
31
+
32
+ ### `bagdock submission list`
33
+
34
+ ```bash
35
+ bagdock submission list --app my-adapter
36
+ bagdock submission list --json
37
+ ```
38
+
39
+ ### `bagdock submission status <id>`
40
+
41
+ ```bash
42
+ bagdock submission status iadpv_abc123 --json
43
+ ```
44
+
45
+ Returns: app name, version, review_status, type, visibility, change_reason, submitted_by, date.
46
+
47
+ ### `bagdock submission withdraw <id>`
48
+
49
+ ```bash
50
+ bagdock submission withdraw iadpv_abc123
51
+ ```
52
+
53
+ Only works when `review_status` is `submitted`. Returns the app to `draft` status so you can make changes and re-submit.
54
+
55
+ ## Status Values
56
+
57
+ | Status | Meaning |
58
+ |--------|---------|
59
+ | `draft` | Not yet submitted |
60
+ | `submitted` | Under review |
61
+ | `approved` | Cleared for production |
62
+ | `rejected` | Changes requested |
63
+
64
+ ## API Endpoints
65
+
66
+ - `POST /v1/developer/apps/:slug/submit` — Submit
67
+ - `GET /v1/developer/apps/:slug/submissions` — List
68
+ - `GET /v1/developer/apps/:slug/submissions/:id` — Detail
69
+ - `POST /v1/developer/apps/:slug/submissions/:id/withdraw` — Withdraw