@ollie-shop/cli 1.2.2 → 1.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/.env.example +9 -5
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +57 -0
- package/CONTEXT.md +11 -3
- package/README.md +7 -10
- package/dist/index.js +323 -76
- package/package.json +4 -5
- package/src/cli.tsx +8 -1
- package/src/commands/function-cmd.ts +42 -10
- package/src/commands/help.tsx +12 -1
- package/src/commands/start.tsx +60 -44
- package/src/commands/store-cmd.ts +14 -4
- package/src/commands/whoami.ts +70 -9
- package/src/core/function.ts +1 -1
- package/src/core/schema.ts +8 -3
- package/src/core/store.ts +50 -3
- package/src/utils/auth.ts +4 -0
- package/src/utils/esbuild.ts +99 -15
- package/src/utils/parse-args.ts +2 -0
- package/src/utils/supabase.ts +66 -11
- package/tsup.config.ts +7 -0
package/.env.example
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
#
|
|
6
|
-
|
|
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
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @ollie-shop/cli@1.
|
|
2
|
+
> @ollie-shop/cli@1.4.0 build /home/runner/work/ollie-shop/ollie-shop/packages/cli
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
[34mCLI[39m Target: node22
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
13
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m93.69 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 295ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# @ollie-shop/cli
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- bac681e: Add a `--no-open` flag to `ollieshop start` (also honored via the `CI` env var) so the dev server can run headless without auto-opening Studio in the browser — useful when an agent spawns it and drives its own preview harness. `ollieshop start` now also runs without a TTY: it no longer crashes with "Raw mode is not supported" when backgrounded, and simply disables keyboard shortcuts in that case. Upgrade the CLI to React 19 and Ink 6.
|
|
8
|
+
|
|
9
|
+
## 1.3.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 464da1e: adjusting cli to update trigger function
|
|
14
|
+
|
|
15
|
+
## 1.3.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 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.
|
|
20
|
+
- 3b01903: Fix `-v`/`--version` and enrich `whoami`.
|
|
21
|
+
|
|
22
|
+
`-v`/`--version` now report the real package version (inlined from
|
|
23
|
+
`package.json` at build time) instead of the hardcoded `ollie v0.1.0`, and the
|
|
24
|
+
brand string matches the `ollieshop` binary.
|
|
25
|
+
|
|
26
|
+
`whoami` now rejects expired sessions (local `exp` check) and, when an
|
|
27
|
+
`ollie.json` is present, resolves and prints the linked store and organization —
|
|
28
|
+
gated by Supabase RLS, so a store you cannot access is reported as not found
|
|
29
|
+
rather than leaked. With no config it returns just the user plus a hint to run
|
|
30
|
+
`ollieshop init`. The `--stage`/`-s` flag is now parsed as a global flag so
|
|
31
|
+
`whoami` (and other commands) can target `ollie.{stage}.json`.
|
|
32
|
+
|
|
33
|
+
- 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.
|
|
34
|
+
|
|
35
|
+
## 1.3.1
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- 2f535de: Bake the prod Builder URL into the published CLI so `ollieshop deploy` works zero-config.
|
|
40
|
+
|
|
41
|
+
`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`.
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
## 1.3.0
|
|
46
|
+
|
|
47
|
+
### Minor Changes
|
|
48
|
+
|
|
49
|
+
- 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.
|
|
50
|
+
|
|
51
|
+
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:
|
|
52
|
+
|
|
53
|
+
- `--org <uuid>` explicitly targets an org; validated via the existing `validateUuid` helper.
|
|
54
|
+
- 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.
|
|
55
|
+
- 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.
|
|
56
|
+
- Single-org users are unaffected.
|
|
57
|
+
|
|
58
|
+
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.
|
|
59
|
+
|
|
3
60
|
## 1.2.2
|
|
4
61
|
|
|
5
62
|
### 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
|
|
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.
|
|
24
|
+
OLLIE_BUILDER_URL=https://staging-builder.example.com
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
|
|
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
|
|
|
@@ -78,6 +78,14 @@ The `deploy` command bundles a component directory into a zip, uploads it to the
|
|
|
78
78
|
|
|
79
79
|
Terminal build statuses: `SUCCEEDED`, `FAILED`, `STOPPED`, `TIMED_OUT`, `FAULT`
|
|
80
80
|
|
|
81
|
+
## Dev Server (agent / harness mode)
|
|
82
|
+
|
|
83
|
+
`ollieshop start` runs the local build+serve dev server (port 4000: `/manifest.json`, `/<Name>/index.js`, `/<Name>/index.css`, SSE `/esbuild`) and normally **auto-opens the admin Studio in a browser**. When you (an agent) are spawning it, pass `--no-open` so it does **not** open a browser — then drive your own preview harness against the dev server instead. The flag is also honored automatically when the `CI` env var is set.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
ollieshop start --no-open # build+serve only; no browser is opened
|
|
87
|
+
```
|
|
88
|
+
|
|
81
89
|
## Response Format
|
|
82
90
|
|
|
83
91
|
All commands return:
|
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.
|
|
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
|
-
#
|
|
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` |
|
|
40
|
-
| `OLLIE_SUPABASE_ANON_KEY` |
|
|
41
|
-
| `OLLIE_BUILDER_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
|
-
|
|
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
|
|
|
@@ -176,6 +172,7 @@ ollieshop init --store-id <STORE_UUID> --version-id <VERSION_UUID> -o json
|
|
|
176
172
|
| `--fields a,b,c` | | Limit output fields (comma-separated) |
|
|
177
173
|
| `--data '{...}'` | `-d` | Raw JSON payload for mutations (alternative to individual flags) |
|
|
178
174
|
| `--stage <name>` | `-s` | Config stage — loads `ollie.<stage>.json` instead of `ollie.json` |
|
|
175
|
+
| `--no-open` | | `start` only: don't auto-open Studio in the browser (also honored via the `CI` env var) |
|
|
179
176
|
|
|
180
177
|
## Response Format
|
|
181
178
|
|