@bagdock/cli 0.2.0 → 0.4.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.
@@ -0,0 +1,45 @@
1
+ # Local Development Reference
2
+
3
+ ## `bagdock dev`
4
+
5
+ Starts a local development server using Wrangler, mimicking the Cloudflare Workers environment.
6
+
7
+ ```bash
8
+ bagdock dev
9
+ bagdock dev --port 3000
10
+ ```
11
+
12
+ ### Options
13
+
14
+ | Flag | Description | Default |
15
+ | --- | --- | --- |
16
+ | `-p, --port <port>` | Local dev server port | `8787` |
17
+
18
+ ### How It Works
19
+
20
+ 1. Reads `bagdock.json` from the current directory
21
+ 2. Generates a temporary `wrangler.toml` from the project config
22
+ 3. Starts `wrangler dev` with the appropriate settings
23
+ 4. Hot-reloads on file changes
24
+
25
+ ### Requirements
26
+
27
+ - Wrangler must be installed (globally or as a dev dependency)
28
+ - `bagdock.json` must exist with a valid `main` entry point
29
+
30
+ ### Wrangler Overrides
31
+
32
+ Add a `wrangler` key to `bagdock.json` to override generated Wrangler config:
33
+
34
+ ```json
35
+ {
36
+ "name": "my-adapter",
37
+ "slug": "my-adapter",
38
+ "main": "src/index.ts",
39
+ "wrangler": {
40
+ "kv_namespaces": [
41
+ { "binding": "CACHE", "id": "abc123" }
42
+ ]
43
+ }
44
+ }
45
+ ```
@@ -0,0 +1,37 @@
1
+ # Environment Variables Reference
2
+
3
+ ## `bagdock env list`
4
+
5
+ Lists environment variable keys (not values) for the current app.
6
+
7
+ ```bash
8
+ bagdock env list
9
+ ```
10
+
11
+ Requires `bagdock.json` in the current directory (uses the `slug` field).
12
+
13
+ ## `bagdock env set <key> <value>`
14
+
15
+ Sets an environment variable. Takes effect on the next deploy.
16
+
17
+ ```bash
18
+ bagdock env set VENDOR_API_KEY sk_live_xxx
19
+ bagdock env set DATABASE_URL "postgres://..."
20
+ ```
21
+
22
+ Values are stored in Infisical (platform secret manager) and synced to the Worker's Cloudflare secrets on deploy.
23
+
24
+ ## `bagdock env remove <key>`
25
+
26
+ Removes an environment variable. Takes effect on the next deploy.
27
+
28
+ ```bash
29
+ bagdock env remove VENDOR_API_KEY
30
+ ```
31
+
32
+ ## Notes
33
+
34
+ - Environment variables are scoped to the app (by slug)
35
+ - Values are never returned by the API — only keys and last-updated timestamps
36
+ - Changes take effect on the next `bagdock deploy`, not immediately
37
+ - The API endpoint is `PUT /developer/apps/:slug/env` (set) and `DELETE /developer/apps/:slug/env/:key` (remove)
@@ -0,0 +1,53 @@
1
+ # Error Codes Reference
2
+
3
+ All errors follow the structure:
4
+
5
+ ```json
6
+ {
7
+ "error": {
8
+ "code": "ERROR_CODE",
9
+ "message": "Human-readable description"
10
+ }
11
+ }
12
+ ```
13
+
14
+ ## Authentication Errors
15
+
16
+ | Code | Description | Resolution |
17
+ | --- | --- | --- |
18
+ | `UNAUTHENTICATED` | No valid credentials found | Run `bagdock login` or set `BAGDOCK_API_KEY` |
19
+ | `UNAUTHORIZED` | Token is valid but lacks required permissions | Use a token with the correct scopes/role |
20
+ | `SESSION_EXPIRED` | OAuth session has expired | Run `bagdock login` again |
21
+
22
+ ## Validation Errors
23
+
24
+ | Code | Description | Resolution |
25
+ | --- | --- | --- |
26
+ | `VALIDATION_ERROR` | Request body failed validation | Check the `details` array for specific field errors |
27
+ | `MISSING_CONFIG` | No `bagdock.json` found | Run `bagdock init` in the project directory |
28
+ | `CONFIRMATION_REQUIRED` | Destructive operation needs confirmation | Pass `--yes` flag |
29
+
30
+ ## API Errors
31
+
32
+ | Code | Description | Resolution |
33
+ | --- | --- | --- |
34
+ | `NOT_FOUND` | Resource does not exist | Verify the ID or slug |
35
+ | `CONFLICT` | Operation conflicts with current state | e.g., revoking an already-revoked key |
36
+ | `REVIEW_REQUIRED` | Public app needs approval for production | Run `bagdock submit` first |
37
+ | `SERVICE_UNAVAILABLE` | Backend temporarily unavailable | Retry after a short delay |
38
+ | `INTERNAL_ERROR` | Unexpected server error | Report to support |
39
+ | `API_ERROR` | Generic API failure | Check the message for details |
40
+
41
+ ## Deploy Errors
42
+
43
+ | Code | Description | Resolution |
44
+ | --- | --- | --- |
45
+ | `BUILD_FAILED` | Local build step failed | Check build output for errors |
46
+ | `UPLOAD_FAILED` | CF Workers upload failed | Check script size limits and compatibility |
47
+
48
+ ## Exit Codes
49
+
50
+ | Code | Meaning |
51
+ | --- | --- |
52
+ | `0` | Success |
53
+ | `1` | Error (details in stderr) |
@@ -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