@drip-apex/apex-cli 0.3.0 → 0.5.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.
Files changed (3) hide show
  1. package/README.md +67 -0
  2. package/dist/cli.js +1892 -2043
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Apex CLI
2
2
 
3
+ ## Authentication and context
4
+
5
+ Run `apex login` once to authenticate your account. Interactive login opens
6
+ the browser and then lets you select an organization and shop. Inspect the
7
+ credential and every accessible context with `apex whoami`, and switch the
8
+ stored default with `apex use <org>[/<shop>]` (IDs and unambiguous name
9
+ prefixes are accepted).
10
+
11
+ Every command also accepts `--org <id>` and `--shop <id>`. Their precedence is
12
+ command flag, then `DRIP_ORG` / `DRIP_SHOP`, then the context saved by
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.
17
+
18
+ Automation should continue injecting a narrow shop key per process with
19
+ `DRIP_API_KEY`; it takes precedence over a stored user credential and does not
20
+ change the stored login. Use `apex login --api-key apx_uk_...` for a headless
21
+ account login or `apex login --api-key apx_...` to store a shop key. The old
22
+ `apex login --user` spelling is a deprecated alias for `apex login`.
23
+
3
24
  Command-line tools for Apex experiments, draft workspaces, GitOps pushes, QA
4
25
  evidence, tracking checks, and agent handoffs.
5
26
 
@@ -114,6 +135,52 @@ means it is an `apex workspace checkout/status/publish` workspace. Keep the two
114
135
  formats in different folders; when the wrong command is run, Apex points to the
115
136
  matching status command.
116
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
+
117
184
  ## Full documentation
118
185
 
119
186
  Read the CLI reference on the docs site: