@drip-apex/apex-cli 0.15.3 → 0.16.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/AGENTS.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Use `apex` as the canonical command name. `drip` is a compatibility alias.
4
4
 
5
+ Install the CLI once with `npm install -g @drip-apex/apex-cli` and call `apex`; `apex --help` and `apex schema --json` need no network. Do not run `npx @drip-apex/apex-cli@latest` per command: npx contacts the npm registry before the CLI starts and hangs with no output when the registry is slow or blocked.
6
+
5
7
  ## Choosing a workflow
6
8
 
7
9
  The default loop for agents building or editing a test is `apex experiments pull`, edit supported files, `apex experiments plan`, `apex experiments apply`, then `apex experiments qa status`.
@@ -58,6 +60,7 @@ the first writes: `apex experiments create`, `apex goals create`,
58
60
  - `3`: validation failure
59
61
  - `4`: confirmation required; inspect `error.details.retry`
60
62
  - `5`: conflict, including stale filesystem state where detected
63
+ - `6`: a check command reported a definite failing verdict
61
64
 
62
65
  ## Recovery
63
66
 
@@ -84,6 +87,7 @@ the first writes: `apex experiments create`, `apex goals create`,
84
87
  - Edit experiment files, variation code, metrics, and targeting only through supported paths.
85
88
  - Do not bypass the variation artifact persistence path with direct API writes.
86
89
  - Keep generated evidence outside `qa.json`; attach it through QA commands.
90
+ - Author commerce drafts in `commerce/price.json`, `commerce/shipping.json`, `commerce/offer.json`, or `commerce/post-purchase.json`; never edit their `serverOwned` sections.
87
91
 
88
92
  ## Project code
89
93
 
@@ -133,11 +137,13 @@ Filesystem apply caches uploaded asset URLs by byte SHA-256 in `.apex/experiment
133
137
 
134
138
  ## Error recovery and update notices
135
139
 
140
+ Every JSON envelope may carry update and warnings. If update.required is true, or a warning has code cli_upgrade_required, first check whether the command succeeded (ok is true). If it succeeded, do not rerun it: run apex upgrade (or the command in update.command) before any further work. If it failed with the upgrade-required error (code cli_upgrade_required), run apex upgrade, then rerun the same command. Tell your user you upgraded. If only cli_update_available is present, finish the current task, then upgrade before the next one.
141
+
136
142
  JSON errors keep the numeric `error.code` exit code and add `error.reason`,
137
143
  `error.next_steps` (an array of `{ command, why }`), and optional `error.request_id`.
138
144
  The request ID comes from `x-request-id`, falling back to `x-vercel-id` (the Apex app) and then `cf-ray`; include it
139
145
  when reporting an API failure. API-provided reason codes are preserved verbatim.
140
- Otherwise reasons are `auth_required`, `auth_forbidden`, `shop_context_required`,
146
+ Otherwise reasons are `auth_required`, `auth_forbidden`, `shop_context_required`, `shop_context_mismatch`, `install_check_failed`,
141
147
  `validation_failed`, `confirmation_required`, `conflict`, `not_found`,
142
148
  `rate_limited`, `network_timeout`, `network_connect_timeout`, `network_dns`,
143
149
  `network_refused`, `network_reset`, `network_tls`, `network_unknown`,
@@ -153,12 +159,13 @@ command: authentication failures exit **2** (previously 4), invalid local input
153
159
  **3**, conflict **5**, anything else **1**). The `TRIGGERS_AUTH`, `TRIGGERS_CONFIG_ABSENT` and `TRIGGERS_NO_DATA`
154
160
  verdict prefixes are unchanged, so scripts can key on them instead of exit codes.
155
161
 
156
- When a newer CLI release is available, success and error JSON envelopes include
157
- `update: { current, latest, breaking, notes_url }`. `breaking` is true for a
158
- major-version change, or a minor-version change while the installed version is
159
- 0.x. `notes_url` links to the published CLI command/output documentation. A one-line notice also goes
160
- to stderr, including in non-TTY agent runs; stdout remains one JSON document.
161
- The latest version is cached in `~/.drip/update-check.json` for 24 hours, and a
162
- failed lookup for one hour. The best-effort check has a 900 ms budget, never fails
163
- the command, and is skipped when the `CI` environment variable is set. Set
164
- `APEX_NO_UPDATE_CHECK=1` to disable both the check and the `update` field.
162
+ Every JSON envelope may carry `update` and `warnings`. The update object includes
163
+ `current`, `latest`, optional `minimum`, `required`, `breaking`, `command`, and
164
+ `notes_url`; warnings use `{ code, message }`. The exact install command is
165
+ `npm install -g @drip-apex/apex-cli@latest`, and `apex upgrade` runs it (`--dry-run`
166
+ only prints it). Set `APEX_NPM_BIN` to choose the npm binary.
167
+
168
+ The npm latest version is cached for 24 hours (failed lookups for one hour). Server
169
+ latest/minimum policy is cached for seven days, so offline commands still enforce a
170
+ known floor. `APEX_NO_UPDATE_CHECK=1` disables the npm lookup and optional update
171
+ notice, but never hides a required server-floor upgrade.
package/README.md CHANGED
@@ -25,14 +25,17 @@ apex install check --shop-id "$APEX_SHOP_ID"
25
25
  is `NO_DATA`, never a healthy result. Tracking verification renders compact event-property previews
26
26
  in human mode and preserves complete properties in `--json`. Install checks report the served
27
27
  `dataLayerTriggers` count and whether an enabled revenue trigger exists.
28
+ `--shop-id` selects the shop for every install-check API request. A definite install-check or doctor failure exits `6`; install-check JSON lists `error.details.failed_checks`.
28
29
 
29
30
  ## Authentication and context
30
31
 
31
32
  Run `apex login` once to authenticate your account. Interactive login opens
32
33
  the browser and then lets you select an organization and shop. Inspect the
33
34
  credential and every accessible context with `apex whoami`, and switch the
34
- stored default with `apex use <org>[/<shop>]` (IDs and unambiguous name
35
- prefixes are accepted).
35
+ stored default with `apex use <org>[/<shop>]` or `apex use --org <org> --shop
36
+ <shop>` (IDs and unambiguous name prefixes are accepted). When authentication
37
+ comes only from an environment key, `apex use` returns `context_not_persistable`
38
+ with the `DRIP_ORG` and `DRIP_SHOP` values to export instead of writing a credential file.
36
39
 
37
40
  Every command also accepts `--org <id>` and `--shop <id>`. Their precedence is
38
41
  command flag, then `DRIP_ORG` / `DRIP_SHOP`, then the context saved by
@@ -56,6 +59,8 @@ evidence, tracking checks, and agent handoffs.
56
59
  npm install -g @drip-apex/apex-cli
57
60
  ```
58
61
 
62
+ Install the CLI once, then call `apex` directly. `apex --help` and `apex schema --json` answer without network access. Do not run `npx @drip-apex/apex-cli@latest` for every command: npx asks the npm registry for the package before the CLI starts, so it prints nothing and hangs when the registry is slow or blocked, which is common in agent sandboxes. Update with `npm install -g @drip-apex/apex-cli@latest`.
63
+
59
64
  ## Authenticate
60
65
 
61
66
  ```bash
@@ -158,6 +163,7 @@ including every subcommand, argument, option, and alias.
158
163
  - `apex logout` — remove stored credentials.
159
164
  - `apex whoami` — inspect the current credential and its validity.
160
165
  - `apex use` — select the current organization and shop context.
166
+ - `apex upgrade` — install the latest Apex CLI; `--dry-run` prints the command.
161
167
  - `apex account` — manage the current user profile.
162
168
  - `apex keys` — manage shop API keys.
163
169
  - `apex org` — inspect and manage the organization.
@@ -406,6 +412,8 @@ experiments reject these metadata changes.
406
412
 
407
413
  Experiment references accept an ID, slug, or test key (for example `BIO-085`). Test keys resolve within the selected shop; use `--shop <shop-id>` to change it. Bare lowercase references remain slugs.
408
414
 
415
+ Price, shipping, offer, and post-purchase drafts use typed `commerce/<kind>.json` files. Each file defines the lever once and maps every variation to values or `sameAsControl`; its `serverOwned` section is informational and read-only.
416
+
409
417
  Filesystem apply preserves authored local bytes by default. Use
410
418
  `apex experiments apply <folder> --sync` to refresh them from stored server bytes.
411
419
  The receipt's `files` contains SHA-256 digests for every pull path; `synced` reports
@@ -486,7 +494,7 @@ JSON errors keep the numeric `error.code` exit code and add `error.reason`,
486
494
  `error.next_steps` (an array of `{ command, why }`), and optional `error.request_id`.
487
495
  The request ID comes from `x-request-id`, falling back to `x-vercel-id` (the Apex app) and then `cf-ray`; include it
488
496
  when reporting an API failure. API-provided reason codes are preserved verbatim.
489
- Otherwise reasons are `auth_required`, `auth_forbidden`, `shop_context_required`,
497
+ Otherwise reasons are `auth_required`, `auth_forbidden`, `shop_context_required`, `shop_context_mismatch`, `install_check_failed`,
490
498
  `validation_failed`, `confirmation_required`, `conflict`, `not_found`,
491
499
  `rate_limited`, `network_timeout`, `network_connect_timeout`, `network_dns`,
492
500
  `network_refused`, `network_reset`, `network_tls`, `network_unknown`,
@@ -502,30 +510,46 @@ command: authentication failures exit **2** (previously 4), invalid local input
502
510
  **3**, conflict **5**, anything else **1**). The `TRIGGERS_AUTH`, `TRIGGERS_CONFIG_ABSENT` and `TRIGGERS_NO_DATA`
503
511
  verdict prefixes are unchanged, so scripts can key on them instead of exit codes.
504
512
 
505
- When a newer CLI release is available, success and error JSON envelopes include
506
- `update: { current, latest, breaking, notes_url }`. `breaking` is true for a
507
- major-version change, or a minor-version change while the installed version is
508
- 0.x. `notes_url` links to the published CLI command/output documentation. A one-line notice also goes
509
- to stderr, including in non-TTY agent runs; stdout remains one JSON document.
510
- The latest version is cached in `~/.drip/update-check.json` for 24 hours, and a
511
- failed lookup for one hour. The best-effort check has a 900 ms budget, never fails
512
- the command, and is skipped when the `CI` environment variable is set. Set
513
- `APEX_NO_UPDATE_CHECK=1` to disable both the check and the `update` field.
513
+ Every JSON envelope may carry `update` and `warnings`. The update object includes
514
+ `current`, `latest`, optional `minimum`, `required`, `breaking`, `command`, and
515
+ `notes_url`; warnings use `{ code, message }`. The exact install command is
516
+ `npm install -g @drip-apex/apex-cli@latest`, and `apex upgrade` runs it (`--dry-run`
517
+ only prints it). Set `APEX_NPM_BIN` to choose the npm binary.
518
+
519
+ The npm latest version is cached for 24 hours (failed lookups for one hour). Server
520
+ latest/minimum policy is cached for seven days, so offline commands still enforce a
521
+ known floor. `APEX_NO_UPDATE_CHECK=1` disables the npm lookup and optional update
522
+ notice, but never hides a required server-floor upgrade.
514
523
 
515
524
  ## Usage telemetry
516
525
 
517
- Authenticated invocations send a process invocation ID, command path, explicitly set
526
+ Authenticated invocations send a process invocation ID, full command path, explicitly set
518
527
  option names (never values), JSON/TTY modes, credential kind, organization/shop IDs,
519
- CLI/Node versions, platform, exit code, error class, API response count, first failed
520
- response status/code/request ID and normalized route, and duration. Parse failures
521
- send `(parse)` and the first non-option token as `attempted`, redacted when it looks
522
- like a credential, URL or path, or is longer than 40 characters. No argument values beyond
523
- that attempted token, file contents, prompts, selectors, URLs, error messages, or secrets
524
- are sent. Login/logout, tests, the mock transport, and runs with no resolvable credentials
525
- (neither stored nor environment) skip telemetry. Environment-credential runs
526
- (`APEX_API_KEY` or `DRIP_API_KEY`) are recorded with credential kind `env` unless
527
- `APEX_TELEMETRY=0`. Set `APEX_TELEMETRY=0` to disable the beacon. The best-effort request has an
528
- 800 ms timeout and never changes command output or exit status.
528
+ CLI/Node versions, platform, exit code, error class and code, API response count, the first
529
+ failed response's status/code/request ID and normalized route, and total duration. Up to the
530
+ first 25 API calls include their method, normalized route, status, duration, and bounded
531
+ `Server-Timing` header. Requests whose path contains an experiment or landing-page UUID also
532
+ send that UUID and its entity type; slugs are not captured.
533
+
534
+ Help commands are named `(help) <full command path>`. Parse failures are named `(parse)` and
535
+ send the known command path plus only a mistyped subcommand as `attempted`. Potential
536
+ credentials, URLs, paths, long keys, and other sensitive-looking attempted tokens are
537
+ redacted; positional argument values are never sent.
538
+
539
+ Agent hosts can be reported as a fixed label such as `claude-code`, `codex`, or `terminal`,
540
+ never as an environment value. Set `APEX_AGENT_HOST` to one of `claude-code`, `codex`,
541
+ `cursor`, `grok`, `gemini`, `copilot`, or `other` to override automatic detection.
542
+ `APEX_SESSION_ID` may supply a 1–128 character identifier containing letters, digits, dots,
543
+ underscores, colons, or hyphens; choose a non-secret value. When that variable is absent or
544
+ invalid, supported agent session IDs are SHA-256 hashed locally and only the `h_`-prefixed
545
+ first 32 hexadecimal characters are sent.
546
+
547
+ No argument or option values, file contents or paths, prompts, selectors, URLs, error text,
548
+ environment values, raw agent session IDs, or secrets are sent. Login/logout, tests, the mock
549
+ transport, and runs with no resolvable credentials (neither stored nor environment) skip
550
+ telemetry. Environment-credential runs (`APEX_API_KEY` or `DRIP_API_KEY`) are recorded with
551
+ credential kind `env` unless `APEX_TELEMETRY=0`. Set `APEX_TELEMETRY=0` to disable the beacon.
552
+ The best-effort request has an 800 ms timeout and never changes command output or exit status.
529
553
 
530
554
  MP4 (`video/mp4`) and WebM (`video/webm`) videos are hosted directly by Apex.
531
555
  Each version holds at most 300 files and 100 MB; each video is limited to 50 MB,