@drip-apex/apex-cli 0.13.0 → 0.14.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/AGENTS.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  Use `apex` as the canonical command name. `drip` is a compatibility alias.
4
4
 
5
+ ## Choosing a workflow
6
+
7
+ 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`.
8
+
9
+ | Workflow | Use when | What it writes | Do not use when |
10
+ | --- | --- | --- | --- |
11
+ | `apex push` | Syncing config-as-code goals, targeting, and flags by slug. | Server configuration declared in `.drip.config.ts`. | Editing one test's variation files or QA state. |
12
+ | `apex experiments pull/plan/apply` | An agent is building or editing a test. This is the default. | Supported experiment files and server draft state after review of the plan. | You need a live operator code workbench. |
13
+ | `apex workspace` | An operator needs a live-preview draft for one variation. | Workspace draft files and published draft variation code. | You need the default full-experiment agent loop. |
14
+ | `apex harness` | An external `ab-harness` project needs build and QA integration. | External harness project artifacts and QA sessions. | Apex owns the experiment files directly. |
15
+
5
16
  ## Canonical Loop
6
17
 
7
18
  1. `apex experiments pull <id-or-slug> --out <folder>`
@@ -10,7 +21,8 @@ Use `apex` as the canonical command name. `drip` is a compatibility alias.
10
21
  4. `apex experiments apply <folder> --json`
11
22
  5. `apex experiments qa status <folder> --json`
12
23
  6. Update QA with `apex experiments qa check`, `notes`, and `approve`.
13
- 7. Publish or launch only through the dashboard approval surface.
24
+ 7. `apex experiments status <folder> --json` before handover. Unknown approval-version matching is not readiness.
25
+ 8. Publish or launch only through the dashboard approval surface.
14
26
 
15
27
  ## Invariants
16
28
 
@@ -118,3 +130,35 @@ Create/get return `dashboard_url`; apply returns `dashboardUrl`. These links
118
130
  switch the signed-in dashboard user's active shop before opening the experiment.
119
131
 
120
132
  Filesystem apply caches uploaded asset URLs by byte SHA-256 in `.apex/experiment-filesystem.json`, so unchanged images reuse their URL across applies without rewriting authored files.
133
+
134
+ ## Error recovery and update notices
135
+
136
+ JSON errors keep the numeric `error.code` exit code and add `error.reason`,
137
+ `error.next_steps` (an array of `{ command, why }`), and optional `error.request_id`.
138
+ The request ID comes from `x-request-id`, falling back to `x-vercel-id` (the Apex app) and then `cf-ray`; include it
139
+ when reporting an API failure. API-provided reason codes are preserved verbatim.
140
+ Otherwise reasons are `auth_required`, `auth_forbidden`, `shop_context_required`,
141
+ `validation_failed`, `confirmation_required`, `conflict`, `not_found`,
142
+ `rate_limited`, `network_timeout`, `network_connect_timeout`, `network_dns`,
143
+ `network_refused`, `network_reset`, `network_tls`, `network_unknown`,
144
+ `local_file_error`, or `internal_error`.
145
+
146
+ Inspect `next_steps` for login, key permissions, shop selection, network settings,
147
+ folder validation, or rate-limit recovery. Steps are suggestions, never automatic
148
+ approval to retry a write. Confirmation errors retain `error.details.retry`.
149
+ Human output prints recovery steps as `Next:` lines on stderr and request IDs
150
+ on the error line. Trigger commands now follow the same exit codes as every other
151
+ command: authentication failures exit **2** (previously 4), invalid local input exits
152
+ **3** (previously 2), and other API failures follow their HTTP status (validation
153
+ **3**, conflict **5**, anything else **1**). The `TRIGGERS_AUTH`, `TRIGGERS_CONFIG_ABSENT` and `TRIGGERS_NO_DATA`
154
+ verdict prefixes are unchanged, so scripts can key on them instead of exit codes.
155
+
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.
package/README.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Apex CLI
2
2
 
3
+ ## Choosing a workflow
4
+
5
+ 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`.
6
+
7
+ | Workflow | Use when | What it writes | Do not use when |
8
+ | --- | --- | --- | --- |
9
+ | `apex push` | Syncing config-as-code goals, targeting, and flags by slug. | Server configuration declared in `.drip.config.ts`. | Editing one test's variation files or QA state. |
10
+ | `apex experiments pull/plan/apply` | An agent is building or editing a test. This is the default. | Supported experiment files and server draft state after review of the plan. | You need a live operator code workbench. |
11
+ | `apex workspace` | An operator needs a live-preview draft for one variation. | Workspace draft files and published draft variation code. | You need the default full-experiment agent loop. |
12
+ | `apex harness` | An external `ab-harness` project needs build and QA integration. | External harness project artifacts and QA sessions. | Apex owns the experiment files directly. |
13
+
3
14
  ## Purchase-capture verification
4
15
 
5
16
  The CLI exposes a read-only, publication-anchored purchase verification battery:
@@ -172,6 +183,7 @@ including every subcommand, argument, option, and alias.
172
183
  - `apex funnels` — manage analytics funnels.
173
184
  - `apex webhooks` — manage shop webhooks.
174
185
  - `apex simulate` — simulate data-layer triggers without emitting events.
186
+ - `apex experiments status [folder-or-id]` — read context, file versions, QA, and handover next steps without writing. Defaults to the current pulled folder.
175
187
  - `apex experiments` — create, inspect, operate, and synchronize experiments.
176
188
  Use `apex experiments screenshots <id-or-slug>` to force-assign every capture, including control, to its variation server-side for deterministic screenshots. Resume a job that outlives the CLI timeout with `--job <id>`; polling continues without creating another job, and the stored job's devices and variations win, so `--devices`/`--variations` are ignored (the CLI warns). The command attaches terminal jobs to the QA run by default; use `--no-attach-qa` to opt out. Choose devices with `--devices`, filter treatments with `--variations`, and use `--json` for the signed result payload. Use `apex experiments qa evidence` with `--job`, repeatable `--file`, or `--records` to write QA evidence directly.
177
189
  - `apex push` — synchronize `.drip.config.ts` with Apex.
@@ -188,6 +200,8 @@ including every subcommand, argument, option, and alias.
188
200
  ### Analytics, targeting, and tracking
189
201
 
190
202
  - `apex tracking` — diagnose storefront tracking.
203
+ - `apex events` — export raw tracking events.
204
+ - `apex events export` — export all raw events in a fixed ISO 8601 window with automatic pagination.
191
205
  - `apex environments` — inspect delivery environments.
192
206
  - `apex analytics` — read shop analytics.
193
207
  - `apex pages` — manage page targeting resources.
@@ -414,3 +428,60 @@ Connection errors retain the underlying failure. JSON output exposes
414
428
  | `tls` | Certificate or TLS validation failed. Check expired certificates and your corporate TLS proxy's trusted CA configuration. |
415
429
  | `timeout` | The request was aborted or exceeded its deadline. Check server availability and network access. |
416
430
  | `unknown` | Another network failure occurred. Use the included cause message to diagnose network or sandbox restrictions. |
431
+
432
+ ### Read-only order journey
433
+
434
+ ```sh
435
+ apex analytics order-journey --platform shopware --order-id <id> --environment production --from <iso> --to <iso> --json
436
+ ```
437
+
438
+ Requires `analytics:read` through a secret or authorized user key. Supply exactly one of `--order-id` or `--order-number`, an explicit environment and an ISO interval of at most 31 days. `--include-qa` includes QA eligibility; bots remain excluded. The sanitized report includes all represented assignments and discloses incomplete coverage. Source failures and historical consent/fingerprint gaps remain unknown. Exit 0 means the report was fetched, not that the journey passed. `eligible_for_attributed_goal_read` uses only `attributed_goal_counts`; `finalStatisticalContribution` is always `not_evaluated`. Nothing is repaired or saved locally.
439
+
440
+ Order journey diagnostics report current, stale, or unknown freshness for each retained receipt and assignment. Present attributed-goal reads identify their evaluated snapshot; they do not establish historical contribution or repair missing producer evidence.
441
+
442
+ ## Error recovery and update notices
443
+
444
+ JSON errors keep the numeric `error.code` exit code and add `error.reason`,
445
+ `error.next_steps` (an array of `{ command, why }`), and optional `error.request_id`.
446
+ The request ID comes from `x-request-id`, falling back to `x-vercel-id` (the Apex app) and then `cf-ray`; include it
447
+ when reporting an API failure. API-provided reason codes are preserved verbatim.
448
+ Otherwise reasons are `auth_required`, `auth_forbidden`, `shop_context_required`,
449
+ `validation_failed`, `confirmation_required`, `conflict`, `not_found`,
450
+ `rate_limited`, `network_timeout`, `network_connect_timeout`, `network_dns`,
451
+ `network_refused`, `network_reset`, `network_tls`, `network_unknown`,
452
+ `local_file_error`, or `internal_error`.
453
+
454
+ Inspect `next_steps` for login, key permissions, shop selection, network settings,
455
+ folder validation, or rate-limit recovery. Steps are suggestions, never automatic
456
+ approval to retry a write. Confirmation errors retain `error.details.retry`.
457
+ Human output prints recovery steps as `Next:` lines on stderr and request IDs
458
+ on the error line. Trigger commands now follow the same exit codes as every other
459
+ command: authentication failures exit **2** (previously 4), invalid local input exits
460
+ **3** (previously 2), and other API failures follow their HTTP status (validation
461
+ **3**, conflict **5**, anything else **1**). The `TRIGGERS_AUTH`, `TRIGGERS_CONFIG_ABSENT` and `TRIGGERS_NO_DATA`
462
+ verdict prefixes are unchanged, so scripts can key on them instead of exit codes.
463
+
464
+ When a newer CLI release is available, success and error JSON envelopes include
465
+ `update: { current, latest, breaking, notes_url }`. `breaking` is true for a
466
+ major-version change, or a minor-version change while the installed version is
467
+ 0.x. `notes_url` links to the published CLI command/output documentation. A one-line notice also goes
468
+ to stderr, including in non-TTY agent runs; stdout remains one JSON document.
469
+ The latest version is cached in `~/.drip/update-check.json` for 24 hours, and a
470
+ failed lookup for one hour. The best-effort check has a 900 ms budget, never fails
471
+ the command, and is skipped when the `CI` environment variable is set. Set
472
+ `APEX_NO_UPDATE_CHECK=1` to disable both the check and the `update` field.
473
+
474
+ ## Usage telemetry
475
+
476
+ Authenticated invocations send a process invocation ID, command path, explicitly set
477
+ option names (never values), JSON/TTY modes, credential kind, organization/shop IDs,
478
+ CLI/Node versions, platform, exit code, error class, API response count, first failed
479
+ response status/code/request ID and normalized route, and duration. Parse failures
480
+ send `(parse)` and the first non-option token as `attempted`, redacted when it looks
481
+ like a credential, URL or path, or is longer than 40 characters. No argument values beyond
482
+ that attempted token, file contents, prompts, selectors, URLs, error messages, or secrets
483
+ are sent. Login/logout, tests, the mock transport, and runs with no resolvable credentials
484
+ (neither stored nor environment) skip telemetry. Environment-credential runs
485
+ (`APEX_API_KEY` or `DRIP_API_KEY`) are recorded with credential kind `env` unless
486
+ `APEX_TELEMETRY=0`. Set `APEX_TELEMETRY=0` to disable the beacon. The best-effort request has an
487
+ 800 ms timeout and never changes command output or exit status.