@drip-apex/apex-cli 0.12.1 → 0.14.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 +49 -2
- package/README.md +107 -0
- package/dist/cli.js +2228 -876
- package/package.json +1 -1
- package/skills/apex-cli/SKILL.md +16 -1
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.
|
|
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
|
|
|
@@ -18,7 +30,10 @@ Use `apex` as the canonical command name. `drip` is a compatibility alias.
|
|
|
18
30
|
- Launch is dashboard-only. The API and CLI do not start traffic.
|
|
19
31
|
- Prefer `--json`; piped stdout defaults to JSON automatically.
|
|
20
32
|
- JSON output is a stable contract: top level is `{ ok, version, command, data | error }`.
|
|
21
|
-
- Diagnostics, prompts, progress,
|
|
33
|
+
- With `--json`, stdout is exactly one JSON document. Diagnostics, prompts, progress,
|
|
34
|
+
and update notices go to stderr.
|
|
35
|
+
- For single-request commands `data` is the API response body as returned (lists at
|
|
36
|
+
`.data.data[]`). API failures carry the API error body in `error.api`.
|
|
22
37
|
- Do not parse human tables. Use `apex schema --json` first if you need flags.
|
|
23
38
|
- Keep command names exact. Do not infer or guess names from the CLI's
|
|
24
39
|
"did you mean" hints — those are stderr diagnostics for humans; machine
|
|
@@ -115,3 +130,35 @@ Create/get return `dashboard_url`; apply returns `dashboardUrl`. These links
|
|
|
115
130
|
switch the signed-in dashboard user's active shop before opening the experiment.
|
|
116
131
|
|
|
117
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:
|
|
@@ -100,6 +111,42 @@ Summary timestamps include `created_at` and `archived_at`; experiments have no `
|
|
|
100
111
|
`--include-archived` to include them; archived rows display their archive date
|
|
101
112
|
when the API provides `archived_at`.
|
|
102
113
|
|
|
114
|
+
## JSON output contract
|
|
115
|
+
|
|
116
|
+
With `--json`, or whenever stdout is piped, stdout carries exactly one JSON
|
|
117
|
+
document and nothing else. Spinners, progress, prompts, warnings, human text and
|
|
118
|
+
child-process output go to stderr, so `apex ... --json | jq` always parses.
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{ "ok": true, "version": "0.13.0", "command": "apex flags get", "data": {}, "context": {} }
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
- `data` is the API response body exactly as the API returned it for every command
|
|
125
|
+
backed by one API request. Lists keep the API's `{ "data": [...], "pagination": {...} }`
|
|
126
|
+
shape, so rows are at `.data.data[]`; single resources are at `.data` directly.
|
|
127
|
+
- `apex experiments get` adds one CLI-derived key, `dashboard_url`, beside the
|
|
128
|
+
experiment fields.
|
|
129
|
+
- Commands that combine several requests or local files (`experiments create`,
|
|
130
|
+
`pull`, `plan`, `apply`, `qa approve`, `triggers`, `project-code`, `harness`,
|
|
131
|
+
`workspace`, `doctor`, `whoami`, `push`, `analytics urls`, `flags status`,
|
|
132
|
+
`goals test`) print a documented CLI-composed `data` object.
|
|
133
|
+
- Failures print `{ "ok": false, "version", "command", "error", "context" }`.
|
|
134
|
+
`error.code` is the CLI exit code, `error.details` carries retry hints and
|
|
135
|
+
server details, and `error.api` is `{ "status", "body" }` with the API error
|
|
136
|
+
envelope verbatim whenever an API response caused the failure.
|
|
137
|
+
- `deprecated` appears on the envelope only when a deprecated flag was used.
|
|
138
|
+
|
|
139
|
+
**Breaking in 0.13.0.** Earlier releases re-nested or renamed API bodies. Update
|
|
140
|
+
scripts: `.data.experiments[]` becomes `.data.data[]`; `experiments get`
|
|
141
|
+
`.data.experiment.id` becomes `.data.id`; `.data.flag`, `.data.goal`,
|
|
142
|
+
`.data.funnel`, `.data.signal`, `.data.backlog_item`, `.data.personalization`,
|
|
143
|
+
`.data.exclusion_group`, `.data.asset`, `.data.landing_page`, `.data.webhook`,
|
|
144
|
+
`.data.targeting` and `.data.verification` wrappers are gone (read the fields at
|
|
145
|
+
`.data`); `experiments results` reads at `.data` instead of `.data.results`,
|
|
146
|
+
`funnels run` at `.data` instead of `.data.run`, and `brand` at `.data.data`
|
|
147
|
+
instead of `.data.brandContext`; lifecycle and delete commands return the API's
|
|
148
|
+
body instead of a CLI summary.
|
|
149
|
+
|
|
103
150
|
## Command index
|
|
104
151
|
|
|
105
152
|
Use `apex schema --json` to emit the complete machine-readable command surface,
|
|
@@ -136,6 +183,7 @@ including every subcommand, argument, option, and alias.
|
|
|
136
183
|
- `apex funnels` — manage analytics funnels.
|
|
137
184
|
- `apex webhooks` — manage shop webhooks.
|
|
138
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.
|
|
139
187
|
- `apex experiments` — create, inspect, operate, and synchronize experiments.
|
|
140
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.
|
|
141
189
|
- `apex push` — synchronize `.drip.config.ts` with Apex.
|
|
@@ -152,6 +200,8 @@ including every subcommand, argument, option, and alias.
|
|
|
152
200
|
### Analytics, targeting, and tracking
|
|
153
201
|
|
|
154
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.
|
|
155
205
|
- `apex environments` — inspect delivery environments.
|
|
156
206
|
- `apex analytics` — read shop analytics.
|
|
157
207
|
- `apex pages` — manage page targeting resources.
|
|
@@ -378,3 +428,60 @@ Connection errors retain the underlying failure. JSON output exposes
|
|
|
378
428
|
| `tls` | Certificate or TLS validation failed. Check expired certificates and your corporate TLS proxy's trusted CA configuration. |
|
|
379
429
|
| `timeout` | The request was aborted or exceeded its deadline. Check server availability and network access. |
|
|
380
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.
|