@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bagdock/cli",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Bagdock developer CLI — build, test, and deploy apps and edges on the Bagdock platform",
5
5
  "keywords": [
6
6
  "bagdock",
@@ -28,8 +28,14 @@
28
28
  "files": [
29
29
  "dist",
30
30
  "README.md",
31
- "LICENSE"
31
+ "LICENSE",
32
+ "skills",
33
+ "skill-evals"
32
34
  ],
35
+ "skills": {
36
+ "name": "bagdock-cli",
37
+ "path": "skills/bagdock-cli"
38
+ },
33
39
  "publishConfig": {
34
40
  "access": "public"
35
41
  },
@@ -37,15 +43,18 @@
37
43
  "dev": "bun run bin/bagdock.ts",
38
44
  "build": "bun build bin/bagdock.ts --outdir dist --target node --format esm && node -e \"const fs=require('fs');const f='dist/bagdock.js';let c=fs.readFileSync(f,'utf8');c=c.replace(/^#!.*\\n/,'').replace(/^\\/\\/ @bun\\n/,'');fs.writeFileSync(f,'#!/usr/bin/env node\\n'+c)\"",
39
45
  "prepublishOnly": "bun run build",
46
+ "test": "vitest run",
47
+ "test:watch": "vitest",
40
48
  "typecheck": "tsc --noEmit"
41
49
  },
42
50
  "dependencies": {
51
+ "chalk": "^5.4.1",
43
52
  "commander": "^13.1.0",
44
- "open": "^10.1.0",
45
- "chalk": "^5.4.1"
53
+ "open": "^10.1.0"
46
54
  },
47
55
  "devDependencies": {
48
56
  "@types/bun": "latest",
49
- "typescript": "^5.3.3"
57
+ "typescript": "^5.3.3",
58
+ "vitest": "^3.2.4"
50
59
  }
51
60
  }
@@ -0,0 +1,208 @@
1
+ {
2
+ "skill": "bagdock-cli",
3
+ "version": "0.4.0",
4
+ "evals": [
5
+ {
6
+ "id": "login-flow",
7
+ "description": "Agent should authenticate using bagdock login",
8
+ "input": "Log me into Bagdock",
9
+ "expected_commands": ["bagdock login"],
10
+ "expected_behavior": "Opens browser for OAuth device flow, waits for approval"
11
+ },
12
+ {
13
+ "id": "create-api-key",
14
+ "description": "Agent should create an API key with proper flags",
15
+ "input": "Create a live API key named 'CI Deploy' for my GitHub Actions",
16
+ "expected_commands": ["bagdock keys create --name \"CI Deploy\" --environment live --json"],
17
+ "expected_behavior": "Creates key, captures raw key from JSON output for use in CI"
18
+ },
19
+ {
20
+ "id": "create-test-key",
21
+ "description": "Agent should create a test environment key",
22
+ "input": "I need a test API key with read-only access to units and contacts",
23
+ "expected_commands": ["bagdock keys create --name \"Test Read-Only\" --environment test --category restricted --scopes units:read contacts:read --json"],
24
+ "expected_behavior": "Creates restricted test key with specified scopes"
25
+ },
26
+ {
27
+ "id": "list-keys",
28
+ "description": "Agent should list API keys",
29
+ "input": "Show me all my live API keys",
30
+ "expected_commands": ["bagdock keys list --environment live"],
31
+ "expected_behavior": "Lists all active live-environment API keys"
32
+ },
33
+ {
34
+ "id": "revoke-key",
35
+ "description": "Agent should revoke an API key with confirmation",
36
+ "input": "Delete the API key ak_abc123, it was compromised",
37
+ "expected_commands": ["bagdock keys delete ak_abc123 --yes --reason \"Key compromised\""],
38
+ "expected_behavior": "Revokes the specified key immediately"
39
+ },
40
+ {
41
+ "id": "deploy-staging",
42
+ "description": "Agent should deploy to staging",
43
+ "input": "Deploy my adapter to staging",
44
+ "expected_commands": ["bagdock deploy"],
45
+ "expected_behavior": "Builds and deploys to staging environment"
46
+ },
47
+ {
48
+ "id": "deploy-production",
49
+ "description": "Agent should deploy to production with confirmation",
50
+ "input": "Push this to production",
51
+ "expected_commands": ["bagdock deploy --production --yes"],
52
+ "expected_behavior": "Deploys to production, skipping prompt since agent is non-TTY"
53
+ },
54
+ {
55
+ "id": "deploy-preview",
56
+ "description": "Agent should deploy a preview",
57
+ "input": "Create a preview deployment for this PR",
58
+ "expected_commands": ["bagdock deploy --preview --json"],
59
+ "expected_behavior": "Creates ephemeral preview URL, outputs JSON with URL"
60
+ },
61
+ {
62
+ "id": "set-env-var",
63
+ "description": "Agent should set an environment variable",
64
+ "input": "Set the VENDOR_API_KEY to sk_live_abc123 for my adapter",
65
+ "expected_commands": ["bagdock env set VENDOR_API_KEY sk_live_abc123"],
66
+ "expected_behavior": "Sets the variable, notes it takes effect on next deploy"
67
+ },
68
+ {
69
+ "id": "init-edge-adapter",
70
+ "description": "Agent should scaffold a new edge adapter project",
71
+ "input": "Create a new access control adapter called smart-entry",
72
+ "expected_commands": ["bagdock init --type edge --kind adapter --category access_control --slug smart-entry --name \"Smart Entry\""],
73
+ "expected_behavior": "Scaffolds project with bagdock.json and starter files"
74
+ },
75
+ {
76
+ "id": "ci-cd-pipeline",
77
+ "description": "Agent should set up a CI/CD pipeline using API key",
78
+ "input": "Set up GitHub Actions to deploy my adapter on push to main",
79
+ "expected_behavior": "Creates workflow that uses BAGDOCK_API_KEY secret, runs bagdock deploy --production --yes --json"
80
+ },
81
+ {
82
+ "id": "whoami-check",
83
+ "description": "Agent should check authentication status",
84
+ "input": "Am I logged into Bagdock?",
85
+ "expected_commands": ["bagdock whoami"],
86
+ "expected_behavior": "Shows current user email and operator ID"
87
+ },
88
+ {
89
+ "id": "submit-for-review",
90
+ "description": "Agent should submit app for marketplace review",
91
+ "input": "Submit my public adapter for review so I can deploy to production",
92
+ "expected_commands": ["bagdock submit"],
93
+ "expected_behavior": "Transitions review_status from draft to submitted"
94
+ },
95
+ {
96
+ "id": "non-tty-detection",
97
+ "description": "Agent should use --json flag in non-interactive mode",
98
+ "input": "Get all my API keys in a script-friendly format",
99
+ "expected_commands": ["bagdock keys list --json"],
100
+ "expected_behavior": "Outputs JSON array of keys to stdout"
101
+ },
102
+ {
103
+ "id": "doctor-check",
104
+ "description": "Agent should run diagnostics to verify environment",
105
+ "input": "Check if my Bagdock setup is working correctly",
106
+ "expected_commands": ["bagdock doctor"],
107
+ "expected_behavior": "Runs version, auth, config, and AI agent checks"
108
+ },
109
+ {
110
+ "id": "doctor-json",
111
+ "description": "Agent should run diagnostics in JSON mode",
112
+ "input": "Get diagnostics as JSON to check my environment",
113
+ "expected_commands": ["bagdock doctor --json"],
114
+ "expected_behavior": "Returns { ok: boolean, checks: [...] } JSON to stdout"
115
+ },
116
+ {
117
+ "id": "profile-switch",
118
+ "description": "Agent should switch between operator profiles",
119
+ "input": "Switch to my production profile",
120
+ "expected_commands": ["bagdock auth switch production"],
121
+ "expected_behavior": "Switches active profile to 'production'"
122
+ },
123
+ {
124
+ "id": "profile-list",
125
+ "description": "Agent should list available profiles",
126
+ "input": "What Bagdock profiles do I have?",
127
+ "expected_commands": ["bagdock auth list --json"],
128
+ "expected_behavior": "Lists all stored profiles with email and active status"
129
+ },
130
+ {
131
+ "id": "profile-flag",
132
+ "description": "Agent should use --profile flag for one-off commands",
133
+ "input": "Deploy to production using my prod profile",
134
+ "expected_commands": ["bagdock --profile prod deploy --production --yes"],
135
+ "expected_behavior": "Uses prod profile credentials for this deployment only"
136
+ },
137
+ {
138
+ "id": "logs-tail",
139
+ "description": "Agent should tail live logs for debugging",
140
+ "input": "Show me the live logs for my smart-entry adapter",
141
+ "expected_commands": ["bagdock logs tail --app smart-entry"],
142
+ "expected_behavior": "Streams live execution logs for the specified app"
143
+ },
144
+ {
145
+ "id": "apps-list",
146
+ "description": "Agent should list deployed applications",
147
+ "input": "What apps do I have deployed?",
148
+ "expected_commands": ["bagdock apps list --json"],
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
+ }
@@ -0,0 +1,161 @@
1
+ # Bagdock CLI Skill
2
+
3
+ The `@bagdock/cli` is the developer CLI for building, testing, and deploying apps and edges on the Bagdock self-storage operator platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @bagdock/cli
9
+ ```
10
+
11
+ Or use without installing:
12
+
13
+ ```bash
14
+ npx @bagdock/cli <command>
15
+ ```
16
+
17
+ ## Agent Protocol
18
+
19
+ When calling the Bagdock CLI from an AI agent, CI/CD pipeline, or non-interactive environment:
20
+
21
+ 1. **JSON output is automatic** in non-TTY. Force it with `--json`.
22
+ 2. **Errors** go to stderr as `{ "error": { "code": "...", "message": "..." } }`.
23
+ 3. **Success** data goes to stdout as JSON.
24
+ 4. **Exit codes**: `0` = success, `1` = error.
25
+ 5. **Use `--quiet` / `-q`** to suppress all status/progress output (implies `--json`).
26
+ 6. **Use `--api-key <key>`** to authenticate without `bagdock login` (overrides all other auth).
27
+ 7. **Use `--yes`** on destructive commands (e.g., `keys delete`) in non-interactive mode.
28
+
29
+ ### Authentication Priority
30
+
31
+ The CLI resolves credentials in this order:
32
+
33
+ 1. `--api-key <key>` flag (highest priority)
34
+ 2. `BAGDOCK_API_KEY` environment variable
35
+ 3. `BAGDOCK_TOKEN` environment variable (M2M JWT)
36
+ 4. `~/.bagdock/credentials.json` — active profile or `--profile` override (from `bagdock login`)
37
+
38
+ For CI/CD, set `BAGDOCK_API_KEY` in your environment. For interactive use, run `bagdock login`.
39
+
40
+ ## Global Flags
41
+
42
+ | Flag | Description |
43
+ | --- | --- |
44
+ | `--json` | Force JSON output (auto in non-TTY) |
45
+ | `-q, --quiet` | Suppress status messages (implies `--json`) |
46
+ | `--api-key <key>` | Override auth for this invocation |
47
+ | `-p, --profile <name>` | Use a named profile (overrides `BAGDOCK_PROFILE`) |
48
+ | `-V, --version` | Print version |
49
+ | `-h, --help` | Print help |
50
+
51
+ ## Available Commands
52
+
53
+ | Command | Description |
54
+ | --- | --- |
55
+ | `login` | Authenticate via OAuth2 device flow (opens browser) |
56
+ | `logout` | Clear stored credentials |
57
+ | `whoami` | Show current authenticated user |
58
+ | `init [dir]` | Scaffold a new project with `bagdock.json` |
59
+ | `dev` | Start local dev server |
60
+ | `deploy` | Build and deploy to Bagdock platform |
61
+ | `submit` | Submit app for marketplace review |
62
+ | `env list` | List app environment variables |
63
+ | `env set <key> <value>` | Set an environment variable |
64
+ | `env remove <key>` | Remove an environment variable |
65
+ | `env pull [file]` | Pull remote env var keys to local .env file |
66
+ | `keys create` | Create a new API key (raw key shown once) |
67
+ | `keys list` | List API keys |
68
+ | `keys delete <id>` | Revoke an API key |
69
+ | `validate` | Run local pre-submission checks on bagdock.json and bundle |
70
+ | `submission list` | List marketplace submission history |
71
+ | `submission status <id>` | Fetch detailed review state for a submission |
72
+ | `submission withdraw <id>` | Cancel a pending submission |
73
+ | `open [slug]` | Open project in Bagdock dashboard |
74
+ | `inspect [slug]` | Show deployment details and status |
75
+ | `link` | Link directory to a Bagdock app or edge |
76
+ | `doctor` | Run environment diagnostics (version, auth, config, agents) |
77
+ | `auth list` | List stored profiles |
78
+ | `auth switch [name]` | Switch active profile |
79
+ | `apps list` | List deployed applications |
80
+ | `apps get <slug>` | Show details for an application |
81
+ | `logs list` | List recent execution logs |
82
+ | `logs tail` | Tail live logs |
83
+
84
+ ## Common Patterns
85
+
86
+ ### Deploy to staging
87
+
88
+ ```bash
89
+ bagdock deploy
90
+ ```
91
+
92
+ ### Deploy to production
93
+
94
+ ```bash
95
+ bagdock deploy --production
96
+ ```
97
+
98
+ ### Create an API key for CI/CD
99
+
100
+ ```bash
101
+ bagdock keys create --name "GitHub Actions" --environment live --json
102
+ ```
103
+
104
+ ### Use API key in CI/CD
105
+
106
+ ```bash
107
+ BAGDOCK_API_KEY=sk_live_xxx bagdock deploy --production --yes
108
+ ```
109
+
110
+ ### List keys as JSON (for scripting)
111
+
112
+ ```bash
113
+ bagdock keys list --json
114
+ ```
115
+
116
+ ## Common Mistakes
117
+
118
+ 1. **Forgetting `--yes` in CI/CD** — Destructive commands like `keys delete` require `--yes` in non-interactive environments.
119
+ 2. **Using wrong environment** — `sk_live_*` keys access production data, `sk_test_*` access sandbox. Match your intent.
120
+ 3. **Missing `bagdock.json`** — `deploy`, `submit`, and `env` commands require a `bagdock.json` in the current directory. Run `bagdock init` first.
121
+ 4. **Expired session** — If `whoami` fails, run `bagdock login` again. Sessions expire after 8 hours.
122
+
123
+ ### Validate before submitting
124
+
125
+ ```bash
126
+ bagdock validate
127
+ bagdock submit
128
+ ```
129
+
130
+ ### Check submission status
131
+
132
+ ```bash
133
+ bagdock submission list --json
134
+ bagdock submission status iadpv_xxx
135
+ ```
136
+
137
+ ### Link a directory and inspect
138
+
139
+ ```bash
140
+ bagdock link --slug my-adapter
141
+ bagdock inspect
142
+ bagdock open
143
+ ```
144
+
145
+ ### Pull env vars for local dev
146
+
147
+ ```bash
148
+ bagdock env pull .env.local
149
+ ```
150
+
151
+ ## When to Load References
152
+
153
+ Load specific reference files when the task involves:
154
+
155
+ - **Authentication, login, or API keys** → `references/auth.md`
156
+ - **Deploying, submitting, or managing apps** → `references/deploy.md`
157
+ - **Environment variables** → `references/env.md`
158
+ - **Local development** → `references/dev.md`
159
+ - **Error codes or troubleshooting** → `references/error-codes.md`
160
+ - **Marketplace submission lifecycle** → `references/marketplace.md`
161
+ - **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,113 @@
1
+ # Authentication Reference
2
+
3
+ ## `bagdock login`
4
+
5
+ Starts an OAuth2 Device Authorization Grant (RFC 8628) flow:
6
+
7
+ 1. CLI requests a device code from the Bagdock API
8
+ 2. Opens the operator dashboard's device authorization page
9
+ 3. Displays a user code (e.g., `ABCD-1234`)
10
+ 4. Polls the token endpoint until the user approves
11
+ 5. Stores an HS256 JWT in `~/.bagdock/credentials.json`
12
+
13
+ Sessions expire after 8 hours.
14
+
15
+ ```bash
16
+ bagdock login
17
+ ```
18
+
19
+ ## `bagdock logout`
20
+
21
+ Clears stored credentials from `~/.bagdock/credentials.json`.
22
+
23
+ ```bash
24
+ bagdock logout
25
+ ```
26
+
27
+ ## `bagdock whoami`
28
+
29
+ Shows the currently authenticated user. Uses the auth priority chain (see SKILL.md).
30
+
31
+ ```bash
32
+ bagdock whoami
33
+ ```
34
+
35
+ JSON output:
36
+
37
+ ```json
38
+ {
39
+ "email": "dev@example.com",
40
+ "operator_id": "opreg_abc123",
41
+ "name": "Developer Name"
42
+ }
43
+ ```
44
+
45
+ ## `bagdock keys create`
46
+
47
+ Creates a new API key. The raw key is shown **once** — save it immediately.
48
+
49
+ ```bash
50
+ bagdock keys create --name "Production CI" --environment live
51
+ bagdock keys create --name "Test key" --environment test --category restricted --scopes units:read contacts:read
52
+ ```
53
+
54
+ Options:
55
+
56
+ | Flag | Description | Default |
57
+ | --- | --- | --- |
58
+ | `--name <name>` | Key name (required) | — |
59
+ | `--type <type>` | `secret` or `publishable` | `secret` |
60
+ | `--category <cat>` | `standard`, `restricted`, `personal` | `standard` |
61
+ | `--environment <env>` | `live` or `test` | `live` |
62
+ | `--scopes <scopes...>` | Permission scopes | `[]` (full access for standard) |
63
+
64
+ Key prefixes follow the Stripe convention:
65
+
66
+ | Prefix | Meaning |
67
+ | --- | --- |
68
+ | `sk_live_` | Secret, live environment |
69
+ | `sk_test_` | Secret, test environment |
70
+ | `pk_live_` | Publishable, live |
71
+ | `pk_test_` | Publishable, test |
72
+ | `rk_live_` | Restricted, live |
73
+ | `rk_test_` | Restricted, test |
74
+ | `sk_personal_` | Personal key |
75
+
76
+ ## `bagdock keys list`
77
+
78
+ Lists all active API keys (prefix + metadata only, never the raw key).
79
+
80
+ ```bash
81
+ bagdock keys list
82
+ bagdock keys list --environment test --json
83
+ ```
84
+
85
+ ## `bagdock keys delete <id>`
86
+
87
+ Revokes an API key (soft-delete). Requires `--yes` in non-interactive mode.
88
+
89
+ ```bash
90
+ bagdock keys delete ak_abc123 --yes --reason "Rotating keys"
91
+ ```
92
+
93
+ ## Environment Variables
94
+
95
+ | Variable | Description |
96
+ | --- | --- |
97
+ | `BAGDOCK_API_KEY` | API key for all requests (overrides login) |
98
+ | `BAGDOCK_TOKEN` | M2M JWT for service-to-service auth |
99
+ | `BAGDOCK_API_URL` | Override API base URL (default: `https://api.bagdock.com`) |
100
+ | `BAGDOCK_DASHBOARD_URL` | Override dashboard URL (default: `https://dashboard.bagdock.com`) |
101
+
102
+ ## Credential Storage
103
+
104
+ Credentials are stored at `~/.bagdock/credentials.json` with `0600` permissions (owner-only read/write). The directory is created with `0700` permissions.
105
+
106
+ ```json
107
+ {
108
+ "accessToken": "<HS256 JWT>",
109
+ "expiresAt": 1700000000000,
110
+ "email": "dev@example.com",
111
+ "operatorId": "opreg_abc123"
112
+ }
113
+ ```
@@ -0,0 +1,91 @@
1
+ # Deploy & Apps Reference
2
+
3
+ ## `bagdock deploy`
4
+
5
+ Builds locally and deploys via the Bagdock API to Cloudflare Workers for Platforms. You never need Cloudflare credentials.
6
+
7
+ ```bash
8
+ bagdock deploy # staging (default)
9
+ bagdock deploy --preview # ephemeral preview URL
10
+ bagdock deploy --production # live production
11
+ bagdock deploy --production --yes # skip confirmation
12
+ ```
13
+
14
+ ### URL Scheme
15
+
16
+ | Environment | URL Pattern |
17
+ | --- | --- |
18
+ | Preview | `{slug}-{hash}.pre.bdok.dev` |
19
+ | Staging | `{slug}.pre.bdok.dev` |
20
+ | Production | `{slug}.bdok.dev` |
21
+
22
+ ### Governance
23
+
24
+ - **Private apps**: deploy freely to any environment
25
+ - **Public integrations**: production requires `review_status = 'approved'`
26
+ - Use `bagdock submit` to request marketplace review
27
+
28
+ ### Deploy Flow
29
+
30
+ 1. Reads `bagdock.json` from current directory
31
+ 2. Bundles the entry point (`main` field) with Bun
32
+ 3. Uploads the compiled Worker to `POST /developer/apps/:slug/deploy`
33
+ 4. The API handles CF Workers for Platforms upload
34
+
35
+ ### Options
36
+
37
+ | Flag | Description | Default |
38
+ | --- | --- | --- |
39
+ | `--env <environment>` | Target: `preview`, `staging`, `production` | `staging` |
40
+ | `--preview` | Shortcut for `--env preview` | — |
41
+ | `--production` | Shortcut for `--env production` | — |
42
+ | `-y, --yes` | Skip confirmation prompts | — |
43
+
44
+ ## `bagdock submit`
45
+
46
+ Submits the current app for Bagdock marketplace review. Required for public integrations before production deploy.
47
+
48
+ ```bash
49
+ bagdock submit
50
+ ```
51
+
52
+ Transitions `review_status` from `draft` to `submitted`.
53
+
54
+ ## `bagdock init [dir]`
55
+
56
+ Scaffolds a new project with a `bagdock.json` configuration file.
57
+
58
+ ```bash
59
+ bagdock init
60
+ bagdock init my-adapter --type edge --kind adapter --category access_control
61
+ ```
62
+
63
+ ### Options
64
+
65
+ | Flag | Description |
66
+ | --- | --- |
67
+ | `-t, --type <type>` | `edge` (backend worker) or `app` (UI extension) |
68
+ | `-k, --kind <kind>` | `adapter`, `comms`, `webhook`, `ui-extension`, `microfrontend` |
69
+ | `-c, --category <cat>` | Marketplace category |
70
+ | `-s, --slug <slug>` | Unique project slug (kebab-case) |
71
+ | `-n, --name <name>` | Display name |
72
+
73
+ ## `bagdock.json` Spec
74
+
75
+ ```json
76
+ {
77
+ "name": "My Adapter",
78
+ "slug": "my-adapter",
79
+ "version": "1.0.0",
80
+ "type": "edge",
81
+ "kind": "adapter",
82
+ "category": "access_control",
83
+ "maintainer": "operator",
84
+ "visibility": "private",
85
+ "main": "src/index.ts",
86
+ "compatibilityDate": "2024-09-23",
87
+ "env": {
88
+ "VENDOR_API_KEY": { "description": "API key for vendor", "required": true }
89
+ }
90
+ }
91
+ ```