@spree/cli 2.1.2 → 2.2.1
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/README.md +41 -1
- package/dist/index.js +376 -156
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -112,9 +112,11 @@ spree api-key create
|
|
|
112
112
|
|
|
113
113
|
# Non-interactive
|
|
114
114
|
spree api-key create --name "My Storefront" --type publishable
|
|
115
|
-
spree api-key create --name "Admin Integration" --type secret
|
|
115
|
+
spree api-key create --name "Admin Integration" --type secret --scopes read_orders,write_products
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
+
Secret keys require at least one scope (`read_all` for a read-only key, `write_all` for full access, or granular `read_*`/`write_*` pairs).
|
|
119
|
+
|
|
118
120
|
**Important:** Secret key tokens are displayed only once at creation time and cannot be retrieved later. Save them immediately.
|
|
119
121
|
|
|
120
122
|
### `spree api-key list`
|
|
@@ -133,6 +135,44 @@ Revoke an API key by its token (publishable) or token prefix (secret).
|
|
|
133
135
|
spree api-key revoke pk_abc123def456...
|
|
134
136
|
```
|
|
135
137
|
|
|
138
|
+
### `spree api`
|
|
139
|
+
|
|
140
|
+
Call the Admin API directly with generic `get`/`post`/`patch`/`delete` commands. Works against any Spree 5.5+ instance — inside a project it self-provisions a **read-only** key via the dev stack on first use (saved to `.spree/credentials.json`, gitignored). For other servers set `SPREE_API_KEY` (the host defaults to `http://localhost:3000`; add `SPREE_BASE_URL` for a remote store) or save a profile with `spree auth login`.
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
spree api get /products -q status_eq=active --sort -created_at --limit 10
|
|
144
|
+
spree api get /orders/ord_x8k2J9aQ --expand items,payments
|
|
145
|
+
spree api post /products -d '{"name":"Classic Tee"}'
|
|
146
|
+
spree api patch /orders/ord_x8k2J9aQ/cancel
|
|
147
|
+
spree api delete /products/prod_86Rf07xd
|
|
148
|
+
|
|
149
|
+
spree api endpoints --resource orders # endpoints + required scopes (offline)
|
|
150
|
+
spree api schema "POST /orders" # request/response schema (offline)
|
|
151
|
+
spree api status # resolved credentials + server check
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Output is JSON on stdout — indented and colored in a terminal, compact and uncolored when piped (so it feeds cleanly into `jq`). `--format table` renders collections for humans. `--fields name,price` trims the response (the `id` is always included). API errors exit `1` with the error envelope on stderr — scope denials include the exact `--scopes` remediation.
|
|
155
|
+
|
|
156
|
+
### `spree completion`
|
|
157
|
+
|
|
158
|
+
Output a shell completion script (`bash`, `zsh`, or `fish`). Tab-completion suggests resource paths, Ransack predicate stems, and scope names — offline from the bundled spec.
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
eval "$(spree completion zsh)" # add to ~/.zshrc (bash/fish also supported)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### `spree auth`
|
|
165
|
+
|
|
166
|
+
Manage saved Admin API credentials for remote stores (profiles in `~/.config/spree/config.json`).
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
spree auth login --profile prod --base-url https://store.example.com # key read from a prompt
|
|
170
|
+
spree api get /orders --profile prod
|
|
171
|
+
spree auth status
|
|
172
|
+
spree auth list
|
|
173
|
+
spree auth logout --profile prod
|
|
174
|
+
```
|
|
175
|
+
|
|
136
176
|
### `spree seed`
|
|
137
177
|
|
|
138
178
|
Run database seeds.
|