@ollie-shop/cli 1.2.1 → 1.3.3

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/.env.example CHANGED
@@ -1,6 +1,10 @@
1
- # Required for all authenticated commands (store, version, component, whoami)
2
- OLLIE_SUPABASE_URL=http://127.0.0.1:54321
3
- OLLIE_SUPABASE_ANON_KEY=your-anon-key-here
1
+ # None of these are required in prod the published CLI bakes in the prod
2
+ # Supabase URL/anon key and Builder URL. Set these only to point the CLI at a
3
+ # non-prod environment (local Supabase, staging Builder, etc.).
4
4
 
5
- # Required for deploy and status commands
6
- OLLIE_BUILDER_URL=https://builder.ollie.shop
5
+ # Local dev preset (uncomment to target localhost Supabase):
6
+ # OLLIE_SUPABASE_URL=http://127.0.0.1:54321
7
+ # OLLIE_SUPABASE_ANON_KEY=your-anon-key-here
8
+
9
+ # Override Builder service URL (uncomment for staging):
10
+ # OLLIE_BUILDER_URL=https://staging-builder.example.com
@@ -1,5 +1,5 @@
1
1
 
2
- > @ollie-shop/cli@1.2.1 build /home/runner/work/ollie-shop/ollie-shop/packages/cli
2
+ > @ollie-shop/cli@1.3.3 build /home/runner/work/ollie-shop/ollie-shop/packages/cli
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -9,5 +9,5 @@
9
9
  CLI Target: node22
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
- ESM dist/index.js 78.88 KB
13
- ESM ⚡️ Build success in 157ms
12
+ ESM dist/index.js 92.64 KB
13
+ ESM ⚡️ Build success in 300ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,66 @@
1
1
  # @ollie-shop/cli
2
2
 
3
+ ## 1.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 464da1e: adjusting cli to update trigger function
8
+
9
+ ## 1.3.2
10
+
11
+ ### Patch Changes
12
+
13
+ - b8d922f: Detect newly created components without restarting the dev server. The esbuild context is now recreated when a component folder is added or removed, so `ollieshop start` serves new components immediately instead of returning 404 until restart.
14
+ - 3b01903: Fix `-v`/`--version` and enrich `whoami`.
15
+
16
+ `-v`/`--version` now report the real package version (inlined from
17
+ `package.json` at build time) instead of the hardcoded `ollie v0.1.0`, and the
18
+ brand string matches the `ollieshop` binary.
19
+
20
+ `whoami` now rejects expired sessions (local `exp` check) and, when an
21
+ `ollie.json` is present, resolves and prints the linked store and organization —
22
+ gated by Supabase RLS, so a store you cannot access is reported as not found
23
+ rather than leaked. With no config it returns just the user plus a hint to run
24
+ `ollieshop init`. The `--stage`/`-s` flag is now parsed as a global flag so
25
+ `whoami` (and other commands) can target `ollie.{stage}.json`.
26
+
27
+ - 2587194: Sync a component's slot back to its local `meta.json` when it's edited in Studio. The CLI `/meta` endpoint now only writes when the incoming `id` matches the component already linked in `meta.json`, so the slot is synced only for the matching local component and never written into the wrong one.
28
+
29
+ ## 1.3.1
30
+
31
+ ### Patch Changes
32
+
33
+ - 2f535de: Bake the prod Builder URL into the published CLI so `ollieshop deploy` works zero-config.
34
+
35
+ `getBuilderUrl()` now falls back to `https://api.ollie.shop/builder/v1` when neither `OLLIE_BUILDER_URL` (runtime env) nor `__OLLIE_BUILDER_URL__` (CI build-time inline) is set. Same pattern is applied to the Supabase URL/anon key as a belt-and-braces fix in case CI inject is ever missing for those too. The CHANGELOG for 1.2.1/1.2.2 already promised this baking via a `PROD_DEFAULTS` const and `envOrDefault()` helper, but the actual code relied solely on the tsup `define` substitution — which silently fell through to an empty string whenever the CI `BUILDER_URL` variable was unset or stale. Result: every published CLI since 1.2.2 has required users to manually export `OLLIE_BUILDER_URL=…` before running `ollieshop deploy` or `ollieshop status`.
36
+
37
+ Resolution order is now explicit: `process.env.OLLIE_*` (local dev override) > tsup build-time inline (per-environment publish) > hardcoded prod default. All three values are public (anon Supabase JWT, public API URLs), so inlining carries no secret-leak risk. Local devs pointing the CLI at `http://127.0.0.1:54321` or a non-prod Supabase project are unaffected — the env var still wins.
38
+
39
+ ## 1.3.0
40
+
41
+ ### Minor Changes
42
+
43
+ - 18c3e52: Add `--org <uuid>` flag to `ollieshop store create` and `ollieshop store list` so users who belong to multiple organizations can target a specific one.
44
+
45
+ Previously, `getOrganizationId()` blindly took the oldest org the user had a membership in, so multi-org users silently landed every `store create` in the same place with no escape hatch (no flag, no config, no env var). Now:
46
+
47
+ - `--org <uuid>` explicitly targets an org; validated via the existing `validateUuid` helper.
48
+ - When `--org` is omitted and the user has multiple orgs, the CLI throws an error listing every accessible org (id + name) instead of silently picking the oldest.
49
+ - When `--org` points to an org the user is not a member of, the same list is surfaced so they can see what they _can_ access.
50
+ - Single-org users are unaffected.
51
+
52
+ Scope is limited to `store` because `getOrganizationId` is only called from `core/store.ts` — other commands (`component`, `version`, `deploy`) derive org through `store_id` relationships.
53
+
54
+ ## 1.2.2
55
+
56
+ ### Patch Changes
57
+
58
+ - 0268a4b: Bake prod Supabase + builder defaults into the CLI so `ollieshop` runs with zero env setup.
59
+
60
+ Agent commands (`whoami`, `store`, `version`, `component`, `function`, `deploy`, `status`) previously threw `Missing required environment variable: OLLIE_SUPABASE_URL` unless the user had exported `OLLIE_SUPABASE_URL`, `OLLIE_SUPABASE_ANON_KEY`, and `OLLIE_BUILDER_URL` in their shell first. All three values are public, so the friction was pure onboarding overhead.
61
+
62
+ `packages/cli/src/utils/supabase.ts` now holds a `PROD_DEFAULTS` const and an `envOrDefault()` helper. Env vars still win when set, so devs pointing the CLI at local Supabase (`http://127.0.0.1:54321`) or a non-prod project are unaffected. Fresh contributors can now run `ollieshop login && ollieshop whoami` without any shell setup.
63
+
3
64
  ## 1.2.1
4
65
 
5
66
  ### Patch Changes
package/CONTEXT.md CHANGED
@@ -16,15 +16,15 @@ Run `ollieshop login` once. Credentials are stored in `~/.ollie-shop/credentials
16
16
 
17
17
  ## Environment Variables
18
18
 
19
- Set these before running authenticated commands (or use a `.env` file):
19
+ None required for prod. Supabase URL, Supabase anon key, and Builder URL are all baked into the published binary. Set these only to override the defaults (e.g. point at local Supabase or a staging Builder):
20
20
 
21
21
  ```
22
22
  OLLIE_SUPABASE_URL=http://127.0.0.1:54321
23
23
  OLLIE_SUPABASE_ANON_KEY=<your-anon-key>
24
- OLLIE_BUILDER_URL=https://builder.ollie.shop
24
+ OLLIE_BUILDER_URL=https://staging-builder.example.com
25
25
  ```
26
26
 
27
- The CLI will throw a clear error if a required env var is missing. See `.env.example` for reference.
27
+ Resolution order: runtime env var > CI build-time inline > hardcoded prod default. See `.env.example` for the local-dev preset.
28
28
 
29
29
  ## Typical Agent Workflow
30
30
 
@@ -33,6 +33,7 @@ The CLI will throw a clear error if a required env var is missing. See `.env.exa
33
33
  ollieshop schema store.create -o json
34
34
  ollieshop schema version.create -o json
35
35
  ollieshop schema component.create -o json
36
+ ollieshop schema function.create -o json
36
37
 
37
38
  # 2. Verify identity
38
39
  ollieshop whoami -o json
@@ -50,17 +51,21 @@ ollieshop init --store-id <STORE_ID> --version-id <VERSION_ID>
50
51
  # 6. Register components
51
52
  ollieshop component create --data '{"versionId":"<VERSION_ID>","name":"FreeShippingBar","slot":"cart_header_full_page","active":true}' -o json
52
53
 
53
- # 7. Deploy component (bundle + upload + build)
54
+ # 7. Register functions (optional)
55
+ ollieshop function create --data '{"versionId":"<VERSION_ID>","name":"myHook","active":true}' -o json
56
+
57
+ # 8. Deploy component (bundle + upload + build)
54
58
  ollieshop deploy --component-id <COMPONENT_ID> --name FreeShippingBar --wait -o json
55
59
 
56
- # 8. Check build status
60
+ # 9. Check build status
57
61
  ollieshop status --build-id <BUILD_ID> -o json
58
62
  ollieshop status --build-id <BUILD_ID> --wait --timeout 300 -o json
59
63
 
60
- # 9. List resources
64
+ # 10. List resources
61
65
  ollieshop store list -o json --fields id,name,platform
62
66
  ollieshop version list --store-id <STORE_ID> -o json --fields id,name,active
63
67
  ollieshop component list --store-id <STORE_ID> -o json --fields id,name,slot,active
68
+ ollieshop function list --store-id <STORE_ID> -o json --fields id,name,active
64
69
  ```
65
70
 
66
71
  ## Deploy Workflow
package/README.md CHANGED
@@ -21,14 +21,10 @@ node packages/cli/dist/index.js <command>
21
21
  # 1. Authenticate
22
22
  ollieshop login
23
23
 
24
- # 2. Set environment variables
25
- export OLLIE_SUPABASE_URL=https://your-project.supabase.co
26
- export OLLIE_SUPABASE_ANON_KEY=your-anon-key
27
-
28
- # 3. Verify identity
24
+ # 2. Verify identity (prod Supabase/Builder URLs are baked in — no env setup needed)
29
25
  ollieshop whoami -o json
30
26
 
31
- # 4. List your stores
27
+ # 3. List your stores
32
28
  ollieshop store list -o json --fields id,name,platform
33
29
  ```
34
30
 
@@ -36,11 +32,11 @@ ollieshop store list -o json --fields id,name,platform
36
32
 
37
33
  | Variable | Required | Description |
38
34
  |----------|----------|-------------|
39
- | `OLLIE_SUPABASE_URL` | Yes (agent commands) | Supabase project URL |
40
- | `OLLIE_SUPABASE_ANON_KEY` | Yes (agent commands) | Supabase anon/public key |
41
- | `OLLIE_BUILDER_URL` | Yes (deploy/status) | Builder service URL |
35
+ | `OLLIE_SUPABASE_URL` | No (prod baked) | Override Supabase project URL — e.g. `http://127.0.0.1:54321` for local dev |
36
+ | `OLLIE_SUPABASE_ANON_KEY` | No (prod baked) | Override Supabase anon/public key |
37
+ | `OLLIE_BUILDER_URL` | No (prod baked) | Override Builder service URL — e.g. a staging endpoint |
42
38
 
43
- See `.env.example` for reference. The CLI will throw a clear error if a required variable is missing.
39
+ All three default to prod and are baked into the published binary. Set the env vars only when pointing the CLI at a non-prod environment. See `.env.example` for local-dev defaults.
44
40
 
45
41
  ## Commands
46
42
 
@@ -106,6 +102,18 @@ ollieshop component list --store-id <STORE_UUID> -o json --fields id,name,slot,a
106
102
  ollieshop component create --version-id <VERSION_UUID> --name FreeShippingBar --slot cart_header_full_page -o json
107
103
  ```
108
104
 
105
+ #### `function create|list`
106
+
107
+ Create or list functions for a version.
108
+
109
+ ```bash
110
+ # List functions
111
+ ollieshop function list --store-id <STORE_UUID> -o json --fields id,name,active
112
+
113
+ # Create a function
114
+ ollieshop function create --version-id <VERSION_UUID> --name myHook -o json
115
+ ```
116
+
109
117
  #### `deploy`
110
118
 
111
119
  Bundle a component directory into a zip and upload to the Builder service.
@@ -207,6 +215,7 @@ src/
207
215
  │ ├── store-cmd.ts # Agent: store CRUD
208
216
  │ ├── version-cmd.ts # Agent: version CRUD
209
217
  │ ├── component-cmd.ts # Agent: component CRUD
218
+ │ ├── function-cmd.ts # Agent: function CRUD
210
219
  │ ├── deploy-cmd.ts # Agent: bundle + upload builds
211
220
  │ ├── status-cmd.ts # Agent: check/poll build status
212
221
  │ ├── schema-cmd.ts # Agent: schema introspection
@@ -218,6 +227,7 @@ src/
218
227
  │ ├── store.ts # Store business logic + Supabase queries
219
228
  │ ├── version.ts # Version business logic + Supabase queries
220
229
  │ ├── component.ts # Component business logic + Supabase queries
230
+ │ ├── function.ts # Function business logic + Supabase queries
221
231
  │ ├── deploy.ts # Builder API client (upload, status, poll)
222
232
  │ └── schema.ts # Zod schemas + JSON Schema generation
223
233
  └── utils/