@krovacloud/cli 0.7.2 → 0.7.4

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 CHANGED
@@ -11,7 +11,7 @@ npm i -g @krovacloud/cli
11
11
  krova --help
12
12
  ```
13
13
 
14
- Requires Node.js ≥ 20.
14
+ Requires Node.js ≥ 22.
15
15
 
16
16
  ## Log in
17
17
 
@@ -41,6 +41,7 @@ On macOS the key is passed to `security` on its standard input, never as a comma
41
41
  ```sh
42
42
  krova context list
43
43
  krova context use <name>
44
+ krova context current # print the active context's name
44
45
  krova context rename <old> <new>
45
46
  krova context delete <name>
46
47
  krova auth logout [--context <name>] # remove a saved context and its key from this machine
@@ -59,6 +60,9 @@ krova cubes create \
59
60
  --name web --image ubuntu-24.04 \
60
61
  --vcpu 1 --ram 1 --disk 10 \
61
62
  --ssh-key "$(cat ~/.ssh/id_ed25519.pub)"
63
+ # More create options: --region <slug> (see `krova regions`), --user-data <script>
64
+ # (cloud-init), --idempotency-key <key> (retries are safe for 24 hours),
65
+ # --termination-protection, --idle-timeout <minutes>, --wait
62
66
  krova cubes wait <cube> # block until the Cube is running (--state, --timeout <seconds>)
63
67
  krova cubes power-off <cube>
64
68
  krova cubes wake <cube>
@@ -67,6 +71,8 @@ krova cubes ssh-port <cube> --port 2222 # in-Cube sshd port, NOT the host port
67
71
  krova cubes rename <cube> <new-name> # 1-64 printable characters; names need not be unique
68
72
  krova cubes resize <cube> --vcpu 4 --ram 8 --disk 40 # any of the three; disk only grows
69
73
  krova cubes update <cube> --idle-timeout 60 # power off after 60 idle minutes (10 to 10080); "off" turns it off
74
+ krova cubes protect <cube> # turn on termination protection: delete is refused until it is off
75
+ krova cubes unprotect <cube> # turn it off again
70
76
  krova cubes delete <cube> # asks first in a terminal; -y/--yes skips the prompt
71
77
  ```
72
78
 
@@ -74,7 +80,11 @@ In a terminal, `krova cubes delete` and `krova snapshots rm` ask `[y/N]` before
74
80
 
75
81
  `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).
76
82
 
77
- `--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.
83
+ `--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`.
84
+
85
+ `--termination-protection` on `krova cubes create` (or `krova cubes protect` later) makes the API refuse to delete the Cube, with a `409`, until `krova cubes unprotect` turns it off. `--ram` takes whole GB only.
86
+
87
+ Each plan sets a create limit, per minute and per month, and deleted Cubes count toward it. `krova cubes create` (and any other way of creating a Cube) fails with a `429` once the space is over the limit. The API's `Retry-After` header says how long to wait before trying again.
78
88
 
79
89
  `<cube>` is a Cube **name or ID** — a unique name resolves automatically.
80
90
 
@@ -169,6 +179,8 @@ krova snapshots rm <cube> <snapshot-id> # asks first in a terminal; -y/--yes s
169
179
  # TCP port mappings (expose a Cube port on the host)
170
180
  krova tcp list <cube>
171
181
  krova tcp add <cube> --port 5432 --whitelist 203.0.113.4/32
182
+ # UDP is forwarded on the same host port by default. Add --no-udp for TCP only.
183
+ krova tcp add <cube> --port 5432 --whitelist 203.0.113.4/32 --no-udp
172
184
  # With no --whitelist (or 0.0.0.0/0, ::/0) the port is open to the whole internet:
173
185
  # the CLI warns on stderr and, in a terminal, asks to confirm (-y/--yes skips it).
174
186
  krova tcp rm <cube> <mapping-id>
@@ -203,11 +215,26 @@ krova pricing # per-resource hourly pricing
203
215
 
204
216
  ## Webhooks
205
217
 
218
+ Manage a space's webhook endpoints, and check deliveries locally.
219
+
206
220
  ```sh
221
+ krova webhooks list
222
+ krova webhooks add --url https://example.com/hook --events cube.running,cube.stopped [--description "deploy notifier"]
223
+ # the signing secret is printed once: save it now
224
+ krova webhooks get <endpoint-id>
225
+ krova webhooks rm <endpoint-id> # also drops its delivery history; asks first, -y/--yes skips it
226
+ krova webhooks deliveries <endpoint-id> [--limit 50] # recent delivery attempts (1 to 100)
227
+
207
228
  krova webhooks listen --secret "$KROVA_WEBHOOK_SECRET"
208
229
  # verifies each delivery's HMAC signature and prints the event
209
230
  ```
210
231
 
232
+ ## Version
233
+
234
+ ```sh
235
+ krova version # CLI version, Node.js version and platform (--json for a machine-readable form)
236
+ ```
237
+
211
238
  ## Updating
212
239
 
213
240
  ```sh
package/dist/index.js CHANGED
@@ -2128,7 +2128,7 @@ function updateCmd() {
2128
2128
  process.stdout.write(minutes === null ? `Turned off idle auto-stop for cube ${id}\n` : `Set idle auto-stop for cube ${id} to ${minutes} min\n`);
2129
2129
  });
2130
2130
  }
2131
- /** Parse a `--vcpu`/`--ram`/`--disk` value. `integer` rejects fractions (RAM may be fractional). */
2131
+ /** Parse a `--vcpu`/`--ram`/`--disk` value. `integer` rejects fractions. RAM is parsed as a number here but the server only accepts whole GB, so a fraction is refused by the API. */
2132
2132
  function parseSize(flag, raw, integer) {
2133
2133
  const n = Number(raw);
2134
2134
  if (!(integer ? /^\d+$/ : /^\d+(\.\d+)?$/).test(raw) || !Number.isFinite(n) || n <= 0) throw new Error(`${flag} must be a positive ${integer ? "whole number" : "number"}`);
@@ -2162,7 +2162,7 @@ function describeSize(size) {
2162
2162
  return `${size.vcpu} vCPU, ${size.ramGb} GB RAM, ${size.diskGb} GB disk`;
2163
2163
  }
2164
2164
  function resizeCmd() {
2165
- return new Command("resize").argument("<cube>", "cube name or ID").option("--vcpu <n>", "new vCPU count").option("--ram <gb>", "new RAM in GB (fractions allowed)").option("--disk <gb>", "new disk in GB (disk can only grow)").option("-y, --yes", "skip the confirmation prompt").description("change a Cube's vCPU, RAM and/or disk; the API says whether it is applied live or restarts the Cube").action(async (cubeRef, opts, cmd) => {
2165
+ return new Command("resize").argument("<cube>", "cube name or ID").option("--vcpu <n>", "new vCPU count").option("--ram <gb>", "new RAM in whole GB (1 GB steps)").option("--disk <gb>", "new disk in GB (disk can only grow)").option("-y, --yes", "skip the confirmation prompt").description("change a Cube's vCPU, RAM and/or disk; the API says whether it is applied live or restarts the Cube").action(async (cubeRef, opts, cmd) => {
2166
2166
  const resources = {};
2167
2167
  if (opts.vcpu !== void 0) resources.vcpu = parseSize("--vcpu", opts.vcpu, true);
2168
2168
  if (opts.ram !== void 0) resources.ramGb = parseSize("--ram", opts.ram, false);