@drip-apex/apex-cli 0.4.0 → 0.6.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/README.md +50 -1
- package/dist/cli.js +691 -1991
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -10,7 +10,10 @@ prefixes are accepted).
|
|
|
10
10
|
|
|
11
11
|
Every command also accepts `--org <id>` and `--shop <id>`. Their precedence is
|
|
12
12
|
command flag, then `DRIP_ORG` / `DRIP_SHOP`, then the context saved by
|
|
13
|
-
`apex use`.
|
|
13
|
+
`apex use`. Falling back to the stored `apex use` context emits one warning on
|
|
14
|
+
stderr so scripts can see the implicit selection without corrupting JSON
|
|
15
|
+
stdout. Flags and environment variables are explicit choices and stay silent.
|
|
16
|
+
JSON envelopes echo the effective org, shop, and credential kind.
|
|
14
17
|
|
|
15
18
|
Automation should continue injecting a narrow shop key per process with
|
|
16
19
|
`DRIP_API_KEY`; it takes precedence over a stored user credential and does not
|
|
@@ -132,6 +135,52 @@ means it is an `apex workspace checkout/status/publish` workspace. Keep the two
|
|
|
132
135
|
formats in different folders; when the wrong command is run, Apex points to the
|
|
133
136
|
matching status command.
|
|
134
137
|
|
|
138
|
+
## Push config format
|
|
139
|
+
|
|
140
|
+
Run `apex push -c <config>` to load a JavaScript or TypeScript config. The
|
|
141
|
+
module's default export may be an experiment array, an object with an
|
|
142
|
+
`experiments` array, or one experiment object. TypeScript (`.ts` or `.tsx`) is
|
|
143
|
+
compiled and bundled on the fly with esbuild into a temporary ESM module;
|
|
144
|
+
JavaScript (`.js`, `.mjs`, or `.cjs`) is imported directly.
|
|
145
|
+
|
|
146
|
+
Each experiment accepts these fields:
|
|
147
|
+
|
|
148
|
+
| Field | Format and mapping |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| `slug` | Required string and unique within the config; identifies the upsert. |
|
|
151
|
+
| `name` | String sent as the experiment name. |
|
|
152
|
+
| `id` | Optional string accepted in the config; it is not sent by `push`. |
|
|
153
|
+
| `trafficAllocation` | Optional number sent as `traffic_allocation`; defaults to `1`. |
|
|
154
|
+
| `targeting` | Optional value sent as targeting; defaults to `null`. |
|
|
155
|
+
| `variations` | Array of variation objects described below. |
|
|
156
|
+
| `goals` | Optional array of `{ id: string }`, mapped to `goal_ids`. |
|
|
157
|
+
| `description` | Optional string; defaults to `null`. |
|
|
158
|
+
| `storeUrl` / `store_url` | Optional string aliases sent as `store_url`; camelCase wins when both are present. |
|
|
159
|
+
|
|
160
|
+
Each variation accepts:
|
|
161
|
+
|
|
162
|
+
| Field | Format and mapping |
|
|
163
|
+
| --- | --- |
|
|
164
|
+
| `id` | Optional string, used as the fallback slug and name. |
|
|
165
|
+
| `slug` | Optional string; falls back to `id`. |
|
|
166
|
+
| `name` | Optional string; falls back to `id`, then `"Unnamed"`. |
|
|
167
|
+
| `weight` | Number sent as the variation weight. |
|
|
168
|
+
| `isControl` / `is_control` | Optional boolean aliases; defaults to `false`. |
|
|
169
|
+
| `mutations` | Optional array; defaults to `[]`. |
|
|
170
|
+
| `css` / `custom_css` | Optional string aliases sent as `custom_css`; defaults to `null`. |
|
|
171
|
+
| `js` / `custom_js` | Optional string aliases sent as `custom_js`; defaults to `null`. |
|
|
172
|
+
| `resetJs` / `reset_js` | Optional string aliases sent as `reset_js`; defaults to `null`. |
|
|
173
|
+
| `antiFlickerSelectors` / `anti_flicker_selectors` | Optional string-array aliases; defaults to `[]`. |
|
|
174
|
+
|
|
175
|
+
Push validates only that every experiment has a truthy `slug`, that slugs are
|
|
176
|
+
not duplicated within the loaded config, and that the top-level export has one
|
|
177
|
+
of the accepted shapes. It does **not** runtime-validate the other field types,
|
|
178
|
+
required TypeScript fields (`name`, `variations`, or variation `weight`), nested
|
|
179
|
+
goal/variation shapes, value ranges, or API-level constraints. The command
|
|
180
|
+
upserts each experiment by slug with
|
|
181
|
+
`PUT /api/v1/experiments/by-slug/:slug`; an existing slug is updated and a new
|
|
182
|
+
slug is created.
|
|
183
|
+
|
|
135
184
|
## Full documentation
|
|
136
185
|
|
|
137
186
|
Read the CLI reference on the docs site:
|