@wevion/cli 1.0.2380 → 1.0.2381
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 +27 -100
- package/openapi.json +32 -449
- package/package.json +1 -1
- package/selftest.mjs +12 -258
- package/src/index.mjs +27 -540
package/README.md
CHANGED
|
@@ -1,119 +1,46 @@
|
|
|
1
|
-
# @wevion/cli
|
|
1
|
+
# @wevion/cli — Wevion CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
pipe into `jq` or a script.
|
|
8
|
-
|
|
9
|
-
Requires **Node.js 22+**.
|
|
3
|
+
Generic, spec-driven command-line interface for the Wevion API. Every command
|
|
4
|
+
is derived at runtime from the public OpenAPI spec — no generated code. CI
|
|
5
|
+
refreshes the bundled `openapi.json` snapshot on every production release.
|
|
6
|
+
The CLI exposes operations that the public spec marks as `apiKeyAuth`.
|
|
10
7
|
|
|
11
8
|
## Install
|
|
12
9
|
|
|
13
10
|
```bash
|
|
14
|
-
npm
|
|
15
|
-
# or run without installing:
|
|
16
|
-
npx @wevion/cli list
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Authenticate
|
|
20
|
-
|
|
21
|
-
You need a Wevion **API key** (create one in the Wevion app under
|
|
22
|
-
Settings → API keys). Then log in once:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
wevion login # prompts for the key and stores it securely
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
The key is saved under `$XDG_CONFIG_HOME/wevion/config.json` or
|
|
29
|
-
`~/.config/wevion/config.json` (on Windows: `%APPDATA%\Wevion\config.json`;
|
|
30
|
-
readable only by you). In CI or scripts, skip the prompt with an env var instead:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
export WEVION_API_KEY=sk_live_xxx
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Log out (delete the stored key) with `wevion logout`.
|
|
37
|
-
|
|
38
|
-
## Usage
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
wevion <command> [--flag value ...]
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Discover what's available:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
wevion list # all commands, grouped by area (ad-accounts, campaigns, …)
|
|
48
|
-
wevion help <command> # flags, required params and the underlying endpoint
|
|
11
|
+
npm i -g @wevion/cli # or: npx @wevion/cli list
|
|
49
12
|
```
|
|
50
13
|
|
|
51
|
-
|
|
14
|
+
## Use
|
|
52
15
|
|
|
53
16
|
```bash
|
|
54
|
-
#
|
|
17
|
+
wevion login # prompts for the API key, saves it
|
|
18
|
+
printf '%s' "$WEVION_API_KEY" | wevion login # non-interactive; avoids shell history
|
|
19
|
+
wevion logout # forget the saved key
|
|
20
|
+
wevion list # list all commands, grouped by tag
|
|
21
|
+
wevion help <command> # show a command's flags
|
|
55
22
|
wevion get-api-v1-ad-accounts --limit 10 --search brand
|
|
56
|
-
|
|
57
|
-
# Send a request body with individual flags…
|
|
58
23
|
wevion post-api-v1-ad-accounts-assign-all --connected true
|
|
59
|
-
|
|
60
|
-
# …or pass the whole JSON body at once
|
|
61
24
|
wevion post-api-v1-ad-accounts-assign-all --json '{"connected":true}'
|
|
62
|
-
|
|
63
|
-
# Pipe JSON output into jq
|
|
64
|
-
wevion get-api-v1-ad-accounts --limit 50 | jq '.data[].name'
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Each command mirrors one API endpoint: path, query and supported header
|
|
68
|
-
parameters become `--flags` using their exact OpenAPI names, and request-body
|
|
69
|
-
fields are `--flags` too (use `--json '<raw>'` to send a body verbatim).
|
|
70
|
-
`wevion help <command>` shows exactly which are required.
|
|
71
|
-
|
|
72
|
-
## For LLMs & agents
|
|
73
|
-
|
|
74
|
-
Driving the CLI from an agent (e.g. Claude Code) with no prior Wevion knowledge?
|
|
75
|
-
Start with one command — a self-contained primer covering auth, how commands map
|
|
76
|
-
to endpoints, parameter rules, and the output/exit-code contract:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
wevion agent
|
|
80
25
|
```
|
|
81
26
|
|
|
82
|
-
|
|
27
|
+
Credentials & base URL are resolved in this order:
|
|
83
28
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
wevion
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Configuration
|
|
90
|
-
|
|
91
|
-
Resolved in this order (first wins):
|
|
92
|
-
|
|
93
|
-
| Setting | Sources |
|
|
94
|
-
| -------- | --------------------------------------------------------------------- |
|
|
95
|
-
| API key | `WEVION_API_KEY` env → stored login (`wevion login`) |
|
|
96
|
-
| Base URL | `--base-url` → `WEVION_BASE_URL` env → stored login config → default `https://api.wevion.ai` |
|
|
97
|
-
|
|
98
|
-
To target staging, point the base URL at `https://api-stage.wevion.ai`:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
wevion --base-url https://api-stage.wevion.ai get-api-v1-ad-accounts
|
|
102
|
-
# or: export WEVION_BASE_URL=https://api-stage.wevion.ai
|
|
103
|
-
```
|
|
29
|
+
- API key: `WEVION_API_KEY` env → `wevion login` config (`~/.config/wevion/config.json`).
|
|
30
|
+
- Base URL: `--base-url` → `WEVION_BASE_URL` env → config → default `https://api.wevion.ai`
|
|
31
|
+
(stage: `https://api-stage.wevion.ai`).
|
|
104
32
|
|
|
105
|
-
##
|
|
33
|
+
## Release
|
|
106
34
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
35
|
+
The `publish-cli` job in `.github/workflows/deploy.yml` runs on every push to
|
|
36
|
+
`main` that touches `apps/backend/**` or `packages/cli/**`. It regenerates the
|
|
37
|
+
snapshot from the released source (`dump:openapi`), so the published CLI always
|
|
38
|
+
matches the API at that commit, then `npm publish`es.
|
|
111
39
|
|
|
112
|
-
|
|
40
|
+
Version: `MAJOR.MINOR` comes from this `package.json` (human-owned); the patch
|
|
41
|
+
is the GitHub Actions run number, so every release is unique and monotonic
|
|
42
|
+
(e.g. `1.0.523`). Bump the minor here when there's a meaningful change.
|
|
113
43
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
working without the network. The CLI checks npm for a newer version and prints an
|
|
118
|
-
upgrade hint when one exists — set `NO_UPDATE_NOTIFIER=1` to silence it. Full
|
|
119
|
-
endpoint details: [api.wevion.ai/docs](https://api.wevion.ai/docs).
|
|
44
|
+
Requires the `NPM_TOKEN` repository secret (automation token with publish
|
|
45
|
+
rights for the `@wevion` scope). If the bundled snapshot is ever absent the CLI
|
|
46
|
+
falls back to fetching `${baseUrl}/docs/json`.
|