@krovacloud/cli 0.6.11 → 0.7.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/CHANGELOG.md +46 -1
- package/README.md +84 -5
- package/dist/index.js +2147 -174
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,42 @@ All notable changes to `@krovacloud/cli` are documented here.
|
|
|
6
6
|
|
|
7
7
|
### Added
|
|
8
8
|
|
|
9
|
+
- `--idle-timeout <minutes>` on `krova cubes create`, and a new `krova cubes update <cube> --idle-timeout <minutes|off>`: Krova powers the Cube off after that many minutes without activity. The value is a whole number from 10 to 10080, or `off` (sends `null`); anything else fails before a request. `krova cubes update` with no flag is an error. `krova cubes get` shows `Idle timeout` (`off` or `N min`) and `Last active`, and `--json` includes `idleTimeoutMinutes` and `lastActiveAt`; both show `-` on a server that does not send them. This needs a server with the idle-timeout feature. On a server without it, `cubes update` fails with the server's message (or says the server did not apply the flag), and `cubes create` warns on stderr that the flag was probably ignored.
|
|
10
|
+
|
|
11
|
+
- `krova cubes rename <cube> <new-name>`: renames a Cube (1 to 64 printable characters; names do not have to be unique). `--json` prints the updated Cube. A running Cube's hostname changes on its next cold restart.
|
|
12
|
+
|
|
13
|
+
- `krova cubes resize <cube> [--vcpu <n>] [--ram <gb>] [--disk <gb>] [-y]`: changes a Cube's vCPU, RAM and/or disk; send only what changes, and disk can only grow. It prints the job, each size before and after, and whether the API applies it live (`Applied live: the Cube does not restart.`) or restarts the Cube. In a terminal it first shows the current and new size and asks `[y/N]`, because some changes restart the Cube; `-y, --yes` skips the question and with no terminal (scripts, pipes) it runs without one. `--json` prints the API's result (`jobId`, `isLive`, `requiresRestart`, `previous`, `requested`) with the Cube `id`. A host without room for the size says so and suggests a smaller one.
|
|
14
|
+
|
|
15
|
+
- `krova whoami` shows when the API key expires (`Key expires`, an ISO date with the days left, or `never`), and `whoami --json` adds `apiKeyExpiresAt` (a date, or `null` for a key that never expires). Nothing is shown when the server does not say (an older server, or an OAuth login).
|
|
16
|
+
|
|
17
|
+
- `krova update`: asks the npm registry for the latest `@krovacloud/cli` and compares it with the installed version. It never installs anything: it prints `krova <latest> is available (you have <current>). Update with: npm install -g @krovacloud/cli@latest`, or `krova <version> is the latest version.` when there is nothing newer. `--json` prints `{ "current", "latest", "updateAvailable", "command" }`. A registry failure exits 1. `latest` is printed in plain `MAJOR.MINOR.PATCH[-prerelease]` form (no leading `v`, no build metadata). The check gives up after 10s, or sooner with a smaller `--timeout`. `KROVA_NPM_REGISTRY` overrides the registry base URL for mirrors.
|
|
18
|
+
|
|
19
|
+
- `krova tunnel <cube> [localPort:]cubePort` and `krova connect <cube> --port <cubePort> [--local-port <n>]`: a private SSH tunnel to a port inside a Cube, bound to `127.0.0.1` only, over the same pinned host keys and strict host-key checking as `krova ssh`. `connect` picks a free local port and prints the endpoint (`--json` prints `host`, `port`, `cube` and `cubePort`). Both accept `-i, --identity`. Prefer them to a public `krova tcp add` mapping for databases.
|
|
20
|
+
|
|
21
|
+
- `krova psql`, `krova redis` and `krova mysql`: open a private tunnel on a free local port, run `psql`, `redis-cli` or `mysql` against it, close the tunnel when the client exits, and exit with the client's code. Flags: `--user`, `--db`, `--port`, `-i`. Passwords are never taken as flags. A missing client is reported before anything connects.
|
|
22
|
+
|
|
23
|
+
- `krova exec <cube> -- <command...>`: run a command on a Cube over SSH without a terminal and exit with its exit code.
|
|
24
|
+
|
|
25
|
+
- `krova cp [-r] [-i <file>] <src> <dst>`: copy files between this machine and a Cube with `scp`. Exactly one side is `<cube>:<path>`; both-remote, both-local and a remote path starting with `-` are rejected.
|
|
26
|
+
|
|
27
|
+
- `krova auth logout [--context <name>]`: removes a saved context (the current one by default) and its API key from this machine. The key itself keeps working until you revoke it in the dashboard (Settings > API keys). If that was the current context and another one takes over, it prints `Now using <name>.`. `--json` prints `{ "context": "<name>", "result": "logged_out", "current": "<name>" | null }`.
|
|
28
|
+
|
|
29
|
+
- `--show-secrets` on `krova whoami`, `krova auth status` and `krova context list`: prints the full API key. It stays masked by default, in text and in `--json`. With the flag, `whoami --json` and `auth status --json` return `apiKey` in place of `apiKeyMasked`.
|
|
30
|
+
|
|
31
|
+
- `krova cubes delete` and `krova snapshots rm` take `-y, --yes`. In a terminal they now ask `[y/N]` before deleting; with no terminal (scripts, pipes) they run without a prompt, as before.
|
|
32
|
+
|
|
33
|
+
- `krova tcp add` warns on stderr when the port would be open to the whole internet (no `--whitelist`, or `0.0.0.0/0` or `::/0`) and suggests `--whitelist` or `krova tunnel`. In a terminal it also asks `[y/N]`; `-y, --yes` skips the question. With no terminal it adds the mapping as before.
|
|
34
|
+
|
|
35
|
+
- `krova cubes create` now asks for anything you leave out when run in a terminal: name, image and region from the catalog, vCPUs, RAM and disk, and an SSH public key (it offers `~/.ssh/id_ed25519.pub` and `~/.ssh/id_rsa.pub`, public keys only). It shows a one-line summary and asks `[Y/n]` before creating; `-y, --yes` skips that. Without a terminal, or with `--json`, nothing is prompted and a missing `--name`, `--image` or `--ssh-key` fails exactly as before.
|
|
36
|
+
|
|
37
|
+
- `krova completion <bash|zsh|fish>` prints a shell completion script for the commands, subcommands, aliases and flags of the installed version. `krova completion --help` shows how to install it for each shell.
|
|
38
|
+
|
|
39
|
+
- Global `-o, --output <format>` (`table` by default, or `json`). `-o json` is the same as `--json`; any other value fails with a one-line error.
|
|
40
|
+
|
|
41
|
+
- Errors with a status of 401, 403, 404, 409, 429 or 5xx, and connection failures, now print one extra line on what to try next, for example `Your API key was rejected. Run krova login, or check krova whoami.` for a 401 and `Could not reach <base URL>. Check your connection or KROVA_BASE_URL.` when the server cannot be reached. Nothing changes with `--json`.
|
|
42
|
+
|
|
43
|
+
- `krova login` and `krova cubes create` show a spinner on stderr while they wait, only in an interactive terminal and never with `--json`.
|
|
44
|
+
|
|
9
45
|
- `krova backups`: `list`, `get <backup>`, `download <backup>`, `share <backup> <destination-space-id> [--idempotency-key <key>]`, `shares`, `accept <share-id>`, `decline <share-id>` and `cancel <share-id>`. A backup can be named or given by ID. `download` warns on stderr that the printed link works for anyone who has it until it expires. These need the Backups permissions on the key's member (View Backups to read, Manage Backups for the rest).
|
|
10
46
|
|
|
11
47
|
- `krova domains add --proxy-protocol <v1|v2>` and
|
|
@@ -14,7 +50,17 @@ All notable changes to `@krovacloud/cli` are documented here.
|
|
|
14
50
|
take `--confirm-mixed-proxy-protocol` to save a setting that differs from
|
|
15
51
|
other domains on the same Cube port.
|
|
16
52
|
|
|
53
|
+
- API keys now go to the OS keychain: macOS Keychain (through the `security` tool) and, on Linux, the Secret Service (through `secret-tool`). `krova login` and `krova auth login` store the key there under service `krova-cli`, account = the context name, and keep only the context's settings plus `keyStorage: "keychain"` in `config.json`. Each write is read back before the key is trusted. When no keychain is available (Windows, headless Linux, `secret-tool` missing, or the call fails) the key stays in the `0600` config file and one line on stderr says why. Existing file contexts keep working; nothing is migrated unless you ask. `--api-key` and `KROVA_API_KEY` still win and never touch the keychain.
|
|
17
54
|
|
|
55
|
+
- `krova auth migrate-keychain`: moves the API keys saved in the config file into the keychain. A key leaves the file only after the keychain returns the same value. `--json` prints `{ "keychain": "<name>", "results": [{ "context", "result": "migrated" | "skipped" | "failed", "detail"? }] }`; it exits 1 if any context failed.
|
|
56
|
+
|
|
57
|
+
- `KROVA_NO_KEYCHAIN=1` forces new keys into the config file, for CI. It does not stop `krova` from reading a key that is already in the keychain.
|
|
58
|
+
|
|
59
|
+
- `krova whoami`, `krova auth status` and `krova context list --json` show where the key lives (`apiKeyStorage` / `keyStorage`: `keychain` or `file`), and `krova auth logout`, `krova context delete` and `krova context rename` delete or move the keychain item with the context, and only after the config file is saved. `krova context list` no longer reads the keychain unless you pass `--show-secrets`. The config file is now written atomically. Context names cannot start with `-`.
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
|
|
63
|
+
- `krova login` on Windows no longer passes the verification URL through `cmd.exe`: it opens the browser with `rundll32` and no shell. A URL containing `& | ^ < > "` (or `%` on Windows) is not opened; the CLI prints it so you can open it yourself. The URL it opens is now the normalized form of the one the server sent.
|
|
18
64
|
|
|
19
65
|
## 0.6.2
|
|
20
66
|
|
|
@@ -47,7 +93,6 @@ All notable changes to `@krovacloud/cli` are documented here.
|
|
|
47
93
|
|
|
48
94
|
- Republished to validate the automated release pipeline. No code changes.
|
|
49
95
|
|
|
50
|
-
|
|
51
96
|
## 0.5.0
|
|
52
97
|
|
|
53
98
|
### Added
|
package/README.md
CHANGED
|
@@ -22,17 +22,34 @@ krova auth login # prompts (hidden) for a kro_… key
|
|
|
22
22
|
krova whoami # confirm the active context + space
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
Logins are saved as named **contexts** in `~/.config/krova/config.json` (mode `0600`) — switch accounts/spaces like `kubectl`/`aws` profiles. The file format is compatible with the previous CLI, so existing logins keep working.
|
|
26
|
+
|
|
27
|
+
The API key itself goes to your OS keychain when there is one: the macOS Keychain (via `security`) or the Linux Secret Service (via `secret-tool`, from `libsecret-tools`), under service `krova-cli` with the context name as the account. The config file then holds only the context's settings and `"keyStorage": "keychain"`. Without a keychain (Windows, headless Linux, `secret-tool` not installed, or the keychain call fails) the key stays in the `0600` config file and `krova` prints one line on stderr saying so. `krova whoami` and `krova auth status` show which one is in use.
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
krova auth migrate-keychain # move keys already saved in the config file into the keychain
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Keys in an existing config file keep working and are never moved unless you run that command. `KROVA_NO_KEYCHAIN=1` forces new keys into the config file (for CI). `--api-key` and `KROVA_API_KEY` always win and never touch the keychain.
|
|
34
|
+
|
|
35
|
+
The keychain item is keyed by context name only (service `krova-cli`, account = the name), so two config directories (for example different `XDG_CONFIG_HOME` values) that use the same context name share one keychain item. Use different context names if you keep separate configs. Context names cannot start with `-`.
|
|
36
|
+
|
|
37
|
+
The keychain keeps the key out of plaintext files, in backups of your home directory and in dotfile repos. It does not protect the key from other programs running as you: any process in your login session can ask the keychain for it, and may get a prompt or not depending on your system.
|
|
38
|
+
|
|
39
|
+
On macOS the key is passed to `security` on its standard input, never as a command-line argument, so other users on the machine cannot see it in the process list. `secret-tool store` reads the key from standard input too.
|
|
28
40
|
|
|
29
41
|
```sh
|
|
30
42
|
krova context list
|
|
31
43
|
krova context use <name>
|
|
32
44
|
krova context rename <old> <new>
|
|
33
45
|
krova context delete <name>
|
|
46
|
+
krova auth logout [--context <name>] # remove a saved context and its key from this machine
|
|
34
47
|
```
|
|
35
48
|
|
|
49
|
+
`krova auth logout` only clears the local copy. The API key keeps working until you revoke it in the dashboard (Settings > API keys).
|
|
50
|
+
|
|
51
|
+
`krova whoami`, `krova auth status` and `krova context list --json` mask the API key. Add `--show-secrets` to print it in full.
|
|
52
|
+
|
|
36
53
|
## Cubes
|
|
37
54
|
|
|
38
55
|
```sh
|
|
@@ -46,11 +63,29 @@ krova cubes power-off <cube>
|
|
|
46
63
|
krova cubes wake <cube>
|
|
47
64
|
krova cubes restart <cube> # cold restart — the only way to pick up a new kernel
|
|
48
65
|
krova cubes ssh-port <cube> --port 2222 # in-Cube sshd port, NOT the host port
|
|
49
|
-
krova cubes
|
|
66
|
+
krova cubes rename <cube> <new-name> # 1-64 printable characters; names need not be unique
|
|
67
|
+
krova cubes resize <cube> --vcpu 4 --ram 8 --disk 40 # any of the three; disk only grows
|
|
68
|
+
krova cubes update <cube> --idle-timeout 60 # power off after 60 idle minutes (10 to 10080); "off" turns it off
|
|
69
|
+
krova cubes delete <cube> # asks first in a terminal; -y/--yes skips the prompt
|
|
50
70
|
```
|
|
51
71
|
|
|
72
|
+
In a terminal, `krova cubes delete` and `krova snapshots rm` ask `[y/N]` before deleting, because it is permanent. In scripts and pipes (no terminal) they run without a prompt, as before. Pass `-y, --yes` to skip it.
|
|
73
|
+
|
|
74
|
+
`krova cubes resize` sends only the sizes you give it. The API queues the change and says whether it is applied live or restarts the Cube; the Cube keeps its size until then, so check it with `krova cubes get <cube>`. In a terminal it first shows the current and new size and asks `[y/N]`, because a RAM decrease, or a vCPU change on a Cube that cannot hotplug, restarts the Cube. Scripts and pipes run without a prompt, and `-y, --yes` skips it. `krova whoami` shows when the API key expires (`never` for a key that does not).
|
|
75
|
+
|
|
76
|
+
`--idle-timeout <minutes>` (on `krova cubes create` and `krova cubes update`) powers a Cube off after that many minutes without activity, so a forgotten Cube stops costing money. It takes a whole number from 10 to 10080 (7 days), or `off`; anything else fails before a request is sent. `krova cubes get` shows `Idle timeout` (`off`, or `N min`) and `Last active`, and `--json` includes `idleTimeoutMinutes` and `lastActiveAt`. This needs a server with the idle-timeout feature: on an older server `krova cubes update` fails with the server's message, and `krova cubes create` warns on stderr that the flag was probably ignored. `krova cubes get` shows `-` for both fields there.
|
|
77
|
+
|
|
52
78
|
`<cube>` is a Cube **name or ID** — a unique name resolves automatically.
|
|
53
79
|
|
|
80
|
+
In a terminal, `krova cubes create` asks for whatever you leave out. Run it with no flags to pick the name, image, region, size and SSH key from lists:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
krova cubes create # asks for everything
|
|
84
|
+
krova cubes create --name web --vcpu 2 # asks for the image, region, RAM, disk and key
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
It reads only `~/.ssh/id_ed25519.pub` and `~/.ssh/id_rsa.pub` (public keys, never private ones) to offer your key, and shows a one-line summary with `[Y/n]` before it creates anything. Add `-y` / `--yes` to skip that question. A fully flagged command never asks anything, and without a terminal (scripts, CI) or with `--json` nothing is prompted: a missing `--name`, `--image` or `--ssh-key` is an error, as before.
|
|
88
|
+
|
|
54
89
|
## SSH
|
|
55
90
|
|
|
56
91
|
```sh
|
|
@@ -72,6 +107,25 @@ trust-on-first-use window). The destination is always passed after
|
|
|
72
107
|
a `--` separator, with host/user validated against option-injection — a hostile
|
|
73
108
|
value aborts before `ssh` ever runs.
|
|
74
109
|
|
|
110
|
+
### Private tunnels, database clients, exec and copy
|
|
111
|
+
|
|
112
|
+
These use the same pinned host keys and strict host-key checking as `krova ssh`. For a database, a private tunnel is safer than a public `krova tcp add` mapping: the port is only reachable from your machine, over your SSH key.
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
krova tunnel <cube> 5432 # localhost:5432 -> the Cube's port 5432
|
|
116
|
+
krova tunnel <cube> 15432:5432 # localhost:15432 -> the Cube's port 5432
|
|
117
|
+
krova connect <cube> --port 5432 # free local port, prints localhost:<port>
|
|
118
|
+
krova connect <cube> --port 5432 --json
|
|
119
|
+
krova psql <cube> [--user postgres] [--db postgres] [--port 5432]
|
|
120
|
+
krova redis <cube> [--port 6379]
|
|
121
|
+
krova mysql <cube> [--user root] [--db <name>] [--port 3306]
|
|
122
|
+
krova exec <cube> -- uname -a # no terminal; exits with the remote exit code
|
|
123
|
+
krova cp ./site.tar.gz <cube>:/tmp/ # upload (scp)
|
|
124
|
+
krova cp -r <cube>:/var/log ./logs # download a directory
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Tunnels listen on `127.0.0.1` only. `psql`, `redis` and `mysql` open a tunnel on a free local port, run the client (`psql`, `redis-cli` or `mysql`, which must be installed), and close the tunnel when it exits, with the client's exit code. They never take a password as a flag; the client prompts for it. `exec` joins the words after `--` and the remote shell runs them, like `ssh`. Put global flags such as `--space` before the `--`. In `cp`, exactly one side is `<cube>:<path>`; a remote path can't start with `-`. Write a local name that contains a colon as `./a:b`, or `cp` reads the part before the colon as a Cube. These commands refuse to run when Krova has no recorded host key for the Cube yet (`krova ssh` still connects, with ssh's own host-key prompt).
|
|
128
|
+
|
|
75
129
|
## Domains, snapshots & TCP mappings
|
|
76
130
|
|
|
77
131
|
Manage a Cube's attached resources. All take a `<cube>` name or ID and support
|
|
@@ -102,11 +156,13 @@ krova domains set-proxy-protocol <cube> <domain-id> v2 # or v1, or off
|
|
|
102
156
|
krova snapshots list <cube>
|
|
103
157
|
krova snapshots create <cube> --name nightly
|
|
104
158
|
krova snapshots restore <cube> <snapshot-id> # replaces the Cube's disk
|
|
105
|
-
krova snapshots rm <cube> <snapshot-id>
|
|
159
|
+
krova snapshots rm <cube> <snapshot-id> # asks first in a terminal; -y/--yes skips the prompt
|
|
106
160
|
|
|
107
161
|
# TCP port mappings (expose a Cube port on the host)
|
|
108
162
|
krova tcp list <cube>
|
|
109
163
|
krova tcp add <cube> --port 5432 --whitelist 203.0.113.4/32
|
|
164
|
+
# With no --whitelist (or 0.0.0.0/0, ::/0) the port is open to the whole internet:
|
|
165
|
+
# the CLI warns on stderr and, in a terminal, asks to confirm (-y/--yes skips it).
|
|
110
166
|
krova tcp rm <cube> <mapping-id>
|
|
111
167
|
```
|
|
112
168
|
|
|
@@ -144,6 +200,16 @@ krova webhooks listen --secret "$KROVA_WEBHOOK_SECRET"
|
|
|
144
200
|
# verifies each delivery's HMAC signature and prints the event
|
|
145
201
|
```
|
|
146
202
|
|
|
203
|
+
## Updating
|
|
204
|
+
|
|
205
|
+
```sh
|
|
206
|
+
krova update # check npm for a newer CLI and print the install command
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
`krova update` asks the npm registry for the latest `@krovacloud/cli` and compares it with the version you have. It never installs anything: when a newer release exists it prints the exact `npm install -g @krovacloud/cli@latest` command to run. `--json` prints `{ "current", "latest", "updateAvailable", "command" }`, with `latest` in plain `MAJOR.MINOR.PATCH[-prerelease]` form (no leading `v`, no build metadata). The check gives up after 10s, or sooner with a smaller `--timeout`. If the registry cannot be read, it exits 1 and changes nothing.
|
|
210
|
+
|
|
211
|
+
To use an npm mirror, set `KROVA_NPM_REGISTRY` to its base URL (default `https://registry.npmjs.org`), for example `KROVA_NPM_REGISTRY=https://npm.example.com krova update`.
|
|
212
|
+
|
|
147
213
|
## Global flags
|
|
148
214
|
|
|
149
215
|
Available on every command (flag > env var > context):
|
|
@@ -155,8 +221,21 @@ Available on every command (flag > env var > context):
|
|
|
155
221
|
| `--base-url <url>` | `KROVA_BASE_URL` | override the API base URL |
|
|
156
222
|
| `--context <name>` | `KROVA_CONTEXT` | select a named context |
|
|
157
223
|
| `--json` | | machine-readable JSON output |
|
|
224
|
+
| `-o, --output <format>` | | `table` (default) or `json`; `-o json` is the same as `--json` |
|
|
158
225
|
| `--timeout <dur>` | | per-request timeout (e.g. `30s`); defaults to `30s` |
|
|
159
226
|
|
|
227
|
+
When a command fails, `krova` prints the error and, for a 401, 403, 404, 409, 429, 5xx or a connection failure, one line on what to try next. With `--json` (or `-o json`) errors stay exactly as they are, with no extra line.
|
|
228
|
+
|
|
229
|
+
## Shell completion
|
|
230
|
+
|
|
231
|
+
```sh
|
|
232
|
+
krova completion bash > ~/.local/share/bash-completion/completions/krova
|
|
233
|
+
krova completion zsh > "${fpath[1]}/_krova" # needs compinit in ~/.zshrc
|
|
234
|
+
krova completion fish > ~/.config/fish/completions/krova.fish
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Restart your shell afterward. The script lists the commands, subcommands, aliases and flags of the version you have installed, so run it again after you upgrade. In bash and zsh you can also add `source <(krova completion bash)` or `source <(krova completion zsh)` to your shell's startup file (zsh: after `compinit`).
|
|
238
|
+
|
|
160
239
|
## License
|
|
161
240
|
|
|
162
241
|
MIT
|