@@ -119,3 +119,3 @@ import { ApiClient, requireProject } from '../api.js'; | ||
| } | ||
| // ---- volume (the persistent /data disk; attach is create-time only) ---- | ||
| // ---- volume (the persistent /data disk; attach any time, grow-only, never detach) ---- | ||
| // Render the volume read. Pure, exported for tests (mirrors serviceListLine). Every plan may view; | ||
@@ -126,3 +126,3 @@ // only growth is paid — that gate is the backend's to enforce, so nothing here pre-blocks. | ||
| return [ | ||
| `compute ${name}: no volume attached (attach is create-time only: \`insta services add compute <name> --volume <gi>\`)`, | ||
| `compute ${name}: no volume attached (attach one: \`insta compute volume ${name} --size <gi>\` — it mounts at /data on the next deploy)`, | ||
| ]; | ||
@@ -134,6 +134,15 @@ return [ | ||
| } | ||
| // Show or grow a compute service's /data volume. No --size: a safe read (size + mount path + the | ||
| // plan cap). --size: grow via PUT .../volume — paid and grow-only, but both gates belong to the | ||
| // backend, whose 403/400 messages carry the upgrade hints and must reach the user verbatim (the | ||
| // guard prints ApiError messages as-is). | ||
| // Render the PUT result. Pure, exported for tests. `attached` comes from the backend and is what | ||
| // tells a FIRST attach (no disk yet — it mounts on the next deploy) apart from a grow (the live | ||
| // disk was already extended); the wire size is authoritative in both cases. | ||
| export function volumeWriteLine(name, body) { | ||
| if (body.attached) { | ||
| return `compute ${name}: volume ${body.volume.sizeGib}Gi attached — mounts at ${body.volume.mountPath} on the next deploy (plan max ${body.cap.volumeGib}Gi)`; | ||
| } | ||
| return `compute ${name}: volume grown to ${body.volume.sizeGib}Gi at ${body.volume.mountPath} (plan max ${body.cap.volumeGib}Gi)`; | ||
| } | ||
| // Show, attach, or grow a compute service's /data volume. No --size: a safe read (size + mount | ||
| // path + the plan cap). --size: PUT .../volume — attaches when no volume exists, grows otherwise. | ||
| // The paid/cap/machine-count gates all belong to the backend, whose 403/400 messages carry the | ||
| // upgrade hints and must reach the user verbatim (the guard prints ApiError messages as-is). | ||
| export async function computeVolume(serviceName, opts) { | ||
@@ -159,4 +168,3 @@ const api = await ApiClient.load(); | ||
| return printJson(res.body); | ||
| const v = res.body.volume; | ||
| info(`compute ${res.body.service?.name ?? serviceName ?? id}: volume grown to ${v.sizeGib}Gi at ${v.mountPath} (plan max ${res.body.cap.volumeGib}Gi)`); | ||
| info(volumeWriteLine(res.body.service?.name ?? serviceName ?? id, res.body)); | ||
| } | ||
@@ -163,0 +171,0 @@ // Show or set a compute service's ceiling. With no --memory it PRINTS the current limits and the |
+2
-2
@@ -118,3 +118,3 @@ #!/usr/bin/env node | ||
| .option('--always-on', 'compute only: create as always-on — never scales to zero (all plans; billing is actual usage either way)') | ||
| .option('--volume <gi>', 'compute only: attach a persistent /data volume of this many whole Gi (create-time only; any plan may attach at the default 1; larger sizes are paid and plan-capped). Volume services keep 1 machine and stop (cold wake) instead of suspend when idle') | ||
| .option('--volume <gi>', 'compute only: attach a persistent /data volume of this many whole Gi (also attachable later: `insta compute volume <name> --size <gi>`; any plan may attach at the default 1; larger sizes are paid and plan-capped). Volume services keep 1 machine and stop (cold wake) instead of suspend when idle') | ||
| .action(guard((type, name, o) => services.servicesAdd(type, name, o))); | ||
@@ -175,3 +175,3 @@ svc.command('list').option('--json').option('--branch <branch>', 'branch (default: current)') | ||
| .option('--json').option('--branch <branch>', 'branch (default: current)').action(guard((mode, service, o) => computeCmd.computeAlwaysOn(mode, service, o))); | ||
| compute.command('volume [service]').description("Show or grow a compute service's persistent /data volume. No --size: print size, mount path, and the plan cap (any plan). --size grows it (paid plans; grow-only — a provisioned disk cannot shrink). Attach is create-time only: `insta services add compute <name> --volume <gi>`. Billing is actual data stored — the size is a cap, not a price") | ||
| compute.command('volume [service]').description("Show, attach, or grow a compute service's persistent /data volume. No --size: print size, mount path, and the plan cap (any plan). --size on a volumeless service ATTACHES one (any plan at the default 1Gi; larger is paid and plan-capped; the disk mounts at /data on the next deploy); on a volume-bearing one it grows (paid plans; grow-only — a provisioned disk cannot shrink). Billing is actual data stored — the size is a cap, not a price") | ||
| .option('--size <gi>', 'new size in whole Gi, e.g. 10 (must be ≥ the current size)') | ||
@@ -178,0 +178,0 @@ .option('--json').option('--branch <branch>', 'branch (default: current)').action(guard((service, o) => computeCmd.computeVolume(service, o))); |
+1
-1
| { | ||
| "name": "insta", | ||
| "version": "0.0.29", | ||
| "version": "0.0.30", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "description": "InstaCloud CLI — a thin client of the platform control-plane API.", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
204524
0.38%3482
0.26%