@ollie-shop/cli 1.1.0 → 1.2.2
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 +3 -0
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +26 -0
- package/CONTEXT.md +24 -1
- package/README.md +53 -7
- package/dist/index.js +836 -207
- package/package.json +1 -1
- package/src/commands/business-rule-cmd.ts +161 -0
- package/src/commands/deploy-cmd.ts +146 -0
- package/src/commands/function-cmd.ts +146 -0
- package/src/commands/help.tsx +27 -0
- package/src/commands/status-cmd.ts +68 -0
- package/src/core/business-rule.ts +128 -0
- package/src/core/deploy.ts +171 -0
- package/src/core/function.ts +92 -0
- package/src/core/schema.ts +18 -2
- package/src/index.tsx +8 -0
- package/src/utils/supabase.ts +19 -11
- package/src/utils/validate.ts +44 -0
- package/tsup.config.ts +9 -2
package/.env.example
CHANGED
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @ollie-shop/cli@1.
|
|
2
|
+
> @ollie-shop/cli@1.2.2 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[32m85.34 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 216ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @ollie-shop/cli
|
|
2
2
|
|
|
3
|
+
## 1.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0268a4b: Bake prod Supabase + builder defaults into the CLI so `ollieshop` runs with zero env setup.
|
|
8
|
+
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
`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.
|
|
12
|
+
|
|
13
|
+
## 1.2.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- aaf2730: Bake prod Supabase + builder defaults into the CLI so `ollieshop` runs with zero env setup.
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
`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.
|
|
22
|
+
|
|
23
|
+
## 1.2.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- f8fa27d: add business-rule command
|
|
28
|
+
|
|
3
29
|
## 1.1.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
package/CONTEXT.md
CHANGED
|
@@ -21,6 +21,7 @@ Set these before running authenticated commands (or use a `.env` file):
|
|
|
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
25
|
```
|
|
25
26
|
|
|
26
27
|
The CLI will throw a clear error if a required env var is missing. See `.env.example` for reference.
|
|
@@ -32,6 +33,7 @@ The CLI will throw a clear error if a required env var is missing. See `.env.exa
|
|
|
32
33
|
ollieshop schema store.create -o json
|
|
33
34
|
ollieshop schema version.create -o json
|
|
34
35
|
ollieshop schema component.create -o json
|
|
36
|
+
ollieshop schema function.create -o json
|
|
35
37
|
|
|
36
38
|
# 2. Verify identity
|
|
37
39
|
ollieshop whoami -o json
|
|
@@ -49,12 +51,33 @@ ollieshop init --store-id <STORE_ID> --version-id <VERSION_ID>
|
|
|
49
51
|
# 6. Register components
|
|
50
52
|
ollieshop component create --data '{"versionId":"<VERSION_ID>","name":"FreeShippingBar","slot":"cart_header_full_page","active":true}' -o json
|
|
51
53
|
|
|
52
|
-
# 7.
|
|
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)
|
|
58
|
+
ollieshop deploy --component-id <COMPONENT_ID> --name FreeShippingBar --wait -o json
|
|
59
|
+
|
|
60
|
+
# 9. Check build status
|
|
61
|
+
ollieshop status --build-id <BUILD_ID> -o json
|
|
62
|
+
ollieshop status --build-id <BUILD_ID> --wait --timeout 300 -o json
|
|
63
|
+
|
|
64
|
+
# 10. List resources
|
|
53
65
|
ollieshop store list -o json --fields id,name,platform
|
|
54
66
|
ollieshop version list --store-id <STORE_ID> -o json --fields id,name,active
|
|
55
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
|
|
56
69
|
```
|
|
57
70
|
|
|
71
|
+
## Deploy Workflow
|
|
72
|
+
|
|
73
|
+
The `deploy` command bundles a component directory into a zip, uploads it to the Builder service, and optionally waits for the build to complete.
|
|
74
|
+
|
|
75
|
+
1. `ollieshop deploy --component-id <UUID> --name <ComponentName> --dry-run -o json` — validate and show bundle size
|
|
76
|
+
2. `ollieshop deploy --component-id <UUID> --name <ComponentName> --wait -o json` — upload and poll until done
|
|
77
|
+
3. `ollieshop status --build-id <BUILD_ID> --wait -o json` — poll an existing build
|
|
78
|
+
|
|
79
|
+
Terminal build statuses: `SUCCEEDED`, `FAILED`, `STOPPED`, `TIMED_OUT`, `FAULT`
|
|
80
|
+
|
|
58
81
|
## Response Format
|
|
59
82
|
|
|
60
83
|
All commands return:
|
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ ollieshop store list -o json --fields id,name,platform
|
|
|
38
38
|
|----------|----------|-------------|
|
|
39
39
|
| `OLLIE_SUPABASE_URL` | Yes (agent commands) | Supabase project URL |
|
|
40
40
|
| `OLLIE_SUPABASE_ANON_KEY` | Yes (agent commands) | Supabase anon/public key |
|
|
41
|
+
| `OLLIE_BUILDER_URL` | Yes (deploy/status) | Builder service URL |
|
|
41
42
|
|
|
42
43
|
See `.env.example` for reference. The CLI will throw a clear error if a required variable is missing.
|
|
43
44
|
|
|
@@ -105,6 +106,45 @@ ollieshop component list --store-id <STORE_UUID> -o json --fields id,name,slot,a
|
|
|
105
106
|
ollieshop component create --version-id <VERSION_UUID> --name FreeShippingBar --slot cart_header_full_page -o json
|
|
106
107
|
```
|
|
107
108
|
|
|
109
|
+
#### `function create|list`
|
|
110
|
+
|
|
111
|
+
Create or list functions for a version.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# List functions
|
|
115
|
+
ollieshop function list --store-id <STORE_UUID> -o json --fields id,name,active
|
|
116
|
+
|
|
117
|
+
# Create a function
|
|
118
|
+
ollieshop function create --version-id <VERSION_UUID> --name myHook -o json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### `deploy`
|
|
122
|
+
|
|
123
|
+
Bundle a component directory into a zip and upload to the Builder service.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Dry-run: validate and show bundle size
|
|
127
|
+
ollieshop deploy --component-id <UUID> --name FreeShippingBar --dry-run -o json
|
|
128
|
+
|
|
129
|
+
# Deploy and wait for build to complete
|
|
130
|
+
ollieshop deploy --component-id <UUID> --name FreeShippingBar --wait -o json
|
|
131
|
+
|
|
132
|
+
# Deploy a function
|
|
133
|
+
ollieshop deploy --function-id <UUID> --name myHook --wait -o json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### `status`
|
|
137
|
+
|
|
138
|
+
Check or poll a build status.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# One-shot status check
|
|
142
|
+
ollieshop status --build-id <BUILD_ID> -o json
|
|
143
|
+
|
|
144
|
+
# Poll until terminal status
|
|
145
|
+
ollieshop status --build-id <BUILD_ID> --wait --timeout 300 -o json
|
|
146
|
+
```
|
|
147
|
+
|
|
108
148
|
#### `schema`
|
|
109
149
|
|
|
110
150
|
Introspect resource schemas at runtime. Returns JSON Schema definitions for all available resources and actions.
|
|
@@ -175,12 +215,15 @@ src/
|
|
|
175
215
|
├── index.tsx # Entry point — routes to agent or interactive commands
|
|
176
216
|
├── cli.tsx # Ink app for interactive commands
|
|
177
217
|
├── commands/
|
|
178
|
-
│ ├── whoami.ts
|
|
179
|
-
│ ├── store-cmd.ts
|
|
180
|
-
│ ├── version-cmd.ts
|
|
181
|
-
│ ├── component-cmd.ts# Agent: component CRUD
|
|
182
|
-
│ ├──
|
|
183
|
-
│ ├──
|
|
218
|
+
│ ├── whoami.ts # Agent: show current user
|
|
219
|
+
│ ├── store-cmd.ts # Agent: store CRUD
|
|
220
|
+
│ ├── version-cmd.ts # Agent: version CRUD
|
|
221
|
+
│ ├── component-cmd.ts # Agent: component CRUD
|
|
222
|
+
│ ├── function-cmd.ts # Agent: function CRUD
|
|
223
|
+
│ ├── deploy-cmd.ts # Agent: bundle + upload builds
|
|
224
|
+
│ ├── status-cmd.ts # Agent: check/poll build status
|
|
225
|
+
│ ├── schema-cmd.ts # Agent: schema introspection
|
|
226
|
+
│ ├── init-cmd.ts # Agent: write ollie.json
|
|
184
227
|
│ ├── help.tsx # Interactive: help display
|
|
185
228
|
│ ├── login.tsx # Interactive: browser auth
|
|
186
229
|
│ └── start.tsx # Interactive: dev server
|
|
@@ -188,12 +231,15 @@ src/
|
|
|
188
231
|
│ ├── store.ts # Store business logic + Supabase queries
|
|
189
232
|
│ ├── version.ts # Version business logic + Supabase queries
|
|
190
233
|
│ ├── component.ts # Component business logic + Supabase queries
|
|
234
|
+
│ ├── function.ts # Function business logic + Supabase queries
|
|
235
|
+
│ ├── deploy.ts # Builder API client (upload, status, poll)
|
|
191
236
|
│ └── schema.ts # Zod schemas + JSON Schema generation
|
|
192
237
|
└── utils/
|
|
193
238
|
├── parse-args.ts # CLI argument parser (flags, subcommands, positional)
|
|
194
239
|
├── output.ts # JSON/pretty output formatter + field filtering
|
|
195
240
|
├── validate.ts # UUID, required, enum, resource name validators
|
|
196
|
-
├── supabase.ts # Authenticated Supabase client + org resolution
|
|
241
|
+
├── supabase.ts # Authenticated Supabase client + builder URL + org resolution
|
|
242
|
+
├── bundle.ts # Component zip bundler (archiver)
|
|
197
243
|
├── auth.ts # Browser auth flow + credential storage
|
|
198
244
|
└── config.ts # ollie.json config loader/saver
|
|
199
245
|
```
|