@youkno/edge-cli 1.21.18 → 1.21.20
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 +93 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
# edge-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Cross-platform CLI for the Edge API.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Requires **Node.js 20+**.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @youkno/edge-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### From source (for contributors)
|
|
6
14
|
|
|
7
15
|
```bash
|
|
8
16
|
cd edge-cli
|
|
@@ -11,33 +19,93 @@ yarn build
|
|
|
11
19
|
yarn node dist/index.js --help
|
|
12
20
|
```
|
|
13
21
|
|
|
14
|
-
##
|
|
22
|
+
## Configure
|
|
15
23
|
|
|
16
|
-
-
|
|
17
|
-
- `health-check`
|
|
18
|
-
- `product:default <product>`
|
|
19
|
-
- `login`
|
|
20
|
-
- `login:list`
|
|
21
|
-
- `login:use <email>`
|
|
22
|
-
- `logout [email]`
|
|
23
|
-
- `token [--refresh] [--header]`
|
|
24
|
-
- `shell [--json] [--dry-run|--validate] [--continue-on-error] [--request-id <id>] [-v key=value] [<command>|<script.esh>]`
|
|
25
|
-
- `upload-users [-q] [-l] [-p] <file>`
|
|
24
|
+
Create `~/.edge-api` with your product and environment:
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
```
|
|
27
|
+
PRODUCT=regulars
|
|
28
|
+
ENV=prod
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Available products: `youkno`, `stash`, `alleaves`, `vera`, `vip`, `dinamo1948`, `propatrimonio`, `campaigns`. Each has a bundled API URL, so no `BASE_URL` is needed unless you want to override it.
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
- `--env` (`devlocal|devel|prod`)
|
|
31
|
-
- `--base-url`
|
|
32
|
-
- `--client`
|
|
33
|
-
- `--config-path`
|
|
33
|
+
If no product is provided (`--product` or `PRODUCT=` in `.edge-api`), `edge-cli` shows an interactive product selector when running in a TTY.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
### Config file resolution
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
2. `./.edge-api`
|
|
39
|
-
3. `~/.edge-api`
|
|
37
|
+
`.edge-api` files are read in order and merged:
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
1. `/etc/edge-api` (system-wide)
|
|
40
|
+
2. `./.edge-api` (project-local)
|
|
41
|
+
3. `~/.edge-api` (user home)
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
## Authenticate
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
edge-cli login
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This opens your browser to the admin sign-in page. After signing in, tokens are saved to `~/.edge-cli-auth/accounts.json`.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
edge-cli login:list # see saved accounts
|
|
53
|
+
edge-cli login:use <email> # switch default account
|
|
54
|
+
edge-cli logout # logout current account
|
|
55
|
+
edge-cli logout <email> # logout specific account
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Commands
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Check connectivity
|
|
62
|
+
edge-cli health-check
|
|
63
|
+
|
|
64
|
+
# Print effective config (product, env, baseUrl, config files)
|
|
65
|
+
edge-cli config
|
|
66
|
+
|
|
67
|
+
# Get an API token (useful for Postman or curl)
|
|
68
|
+
edge-cli token
|
|
69
|
+
edge-cli token --refresh # force token refresh
|
|
70
|
+
edge-cli token --header # print as Authorization header
|
|
71
|
+
|
|
72
|
+
# Run a shell command
|
|
73
|
+
edge-cli shell "<command>"
|
|
74
|
+
|
|
75
|
+
# Run a script file
|
|
76
|
+
edge-cli shell script.esh
|
|
77
|
+
|
|
78
|
+
# Shell with options
|
|
79
|
+
edge-cli shell --dry-run "<command>" # validate without executing
|
|
80
|
+
edge-cli shell --validate "<command>" # syntax check only
|
|
81
|
+
edge-cli shell --json "<command>" # JSON output
|
|
82
|
+
edge-cli shell --continue-on-error script.esh
|
|
83
|
+
edge-cli shell -v key=value "<command>" # pass variables
|
|
84
|
+
|
|
85
|
+
# Upload users CSV
|
|
86
|
+
edge-cli upload-users users.csv
|
|
87
|
+
edge-cli upload-users -q users.csv # quiet mode
|
|
88
|
+
edge-cli upload-users -l users.csv # list mode
|
|
89
|
+
edge-cli upload-users -p users.csv # preview mode
|
|
90
|
+
|
|
91
|
+
# Set/clear default product
|
|
92
|
+
edge-cli product:default regulars
|
|
93
|
+
edge-cli product:default --clear
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Global flags
|
|
97
|
+
|
|
98
|
+
| Flag | Description |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `--product <name>` | Override product (default from `~/.edge-api`) |
|
|
101
|
+
| `--env <env>` | `prod`, `devel`, or `devlocal` (default: `prod`) |
|
|
102
|
+
| `--base-url <url>` | Override API URL |
|
|
103
|
+
| `--client <clientId>` | Client ID for client-scoped operations |
|
|
104
|
+
| `--config-path <path>` | Additional config file path |
|
|
105
|
+
|
|
106
|
+
## Help
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
edge-cli --help
|
|
110
|
+
edge-cli <command> --help
|
|
111
|
+
```
|