koigrid 0.13.0 → 0.14.0

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 CHANGED
@@ -4,6 +4,13 @@ All notable changes to the koigrid CLI are documented here. Format: [Keep a Chan
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.14.0] — 2026-11-27
8
+
9
+ ### Added
10
+
11
+ - `koigrid sandboxes vm retention [standard|zero]`: what koigrid keeps of your VMs; `zero` stops recording the command history (org owner/admin).
12
+ - `koigrid sandboxes vm share <vm>` and `koigrid sandboxes vm unshare <vm> [--key FILE.pub | --no-keys]`: share a VM with the organization or make it private to its creator (other members see it but cannot use it; every SSH key except yours is removed).
13
+
7
14
  ## [0.13.0] — 2026-11-27
8
15
 
9
16
  ### Added
@@ -62,6 +62,11 @@ const USO_VM = `usage: koigrid sandboxes vm <action> …
62
62
  env set <vm> [--env KEY=VALUE]… [--repo owner/repo]… [--environment FILE.json] [--safe-for-third-parties]
63
63
  replace it (values may use \${{ shared.KEY }}, \${{ db.<name>.DATABASE_URL }}…)
64
64
  token <vm> [--expires SECONDS] [--read-only] an API token that only works on this VM, to hand to someone else
65
+ retention [standard|zero] what koigrid keeps of your VMs; zero stops recording the command history (owner/admin)
66
+ share <vm> share it with the organization: every member can use it (the default)
67
+ unshare <vm> [--key FILE.pub | --no-keys]
68
+ make it private: other members see it but cannot use it; every SSH key except
69
+ yours (~/.ssh/id_*.pub or --key) is removed from the VM. Creator or org owner/admin
65
70
  usage <vm> [--days N] what it has used: seconds running, GB·h and cost, per day (≤90 days)
66
71
  history <vm> [--limit N] [--before ISO] commands run in it (direct and background), newest first, 90 days
67
72
  ps <vm> processes running now, highest CPU first
@@ -306,6 +311,38 @@ async function vm(a, json) {
306
311
  }
307
312
  return console.log(JSON.stringify(r));
308
313
  }
314
+ // ── Retención de datos de las VMs de la organización (ficha 536d1044) ──
315
+ if (accion === 'retention') {
316
+ const r = objetivo ? await api('/sandboxes/data-retention', { method: 'PATCH', body: { mode: objetivo } }) : await api('/sandboxes/data-retention');
317
+ if (json)
318
+ return console.log(JSON.stringify(r, null, 2));
319
+ const t = r.retention;
320
+ return console.log(`${green(t.mode)} · command history: ${t.commandHistoryDays ? `${t.commandHistoryDays} days` : 'not recorded'} · always kept: billing sessions, audit events`);
321
+ }
322
+ // ── Compartir con la organización o hacerla privada (ficha a535a786) ──
323
+ if (accion === 'share' || accion === 'unshare') {
324
+ const vmNombre = objetivo;
325
+ if (!vmNombre)
326
+ throw new Error(USO_VM);
327
+ const body = { visibility: accion === 'share' ? 'shared' : 'private' };
328
+ if (accion === 'unshare') {
329
+ let propias = [];
330
+ if (!a.flags['no-keys']) {
331
+ try {
332
+ propias = clavesLocales(a.flags.key);
333
+ }
334
+ catch (e) {
335
+ if (a.flags.key)
336
+ throw e;
337
+ }
338
+ }
339
+ body.sshPublicKeys = propias;
340
+ }
341
+ const r = await api(`/sandboxes/vms/${encodeURIComponent(vmNombre)}/visibility`, { method: 'PUT', body });
342
+ if (json)
343
+ return console.log(JSON.stringify(r, null, 2));
344
+ return console.log(green(`✓ ${vmNombre} is ${r.vm?.visibility}`) + (accion === 'unshare' ? ` · ${(body.sshPublicKeys || []).length} SSH key(s) kept` : ''));
345
+ }
309
346
  // ── SSH (ficha daa6b24a): por la puerta de koigrid, cifrado de punta a punta con la VM ──
310
347
  if (accion === 'ssh-key') {
311
348
  const sub = objetivo;
package/dist/manifest.js CHANGED
@@ -50,7 +50,7 @@ export const CLI_COMMANDS = [
50
50
  { name: 'analytics', product: 'analytics', summary: 'Privacy-first web analytics (no cookies)', subs: ['sites', 'create', 'stats', 'rm'], endpoints: ['analytics/sites', 'analytics/sites/[id]', 'analytics/sites/[id]/stats'] },
51
51
  { name: 'errors', aliases: ['error'], product: 'errors', summary: 'Error tracking (capture exceptions, group by fingerprint)', subs: ['ls', 'token', 'resolve', 'reopen', 'rm'], endpoints: ['errors', 'errors/groups/[id]'] },
52
52
  { name: 'speed', aliases: ['vitals'], product: 'speed-insights', summary: 'Speed Insights (Core Web Vitals: LCP/CLS/FCP/TTFB)', subs: ['ls'], endpoints: ['speed-insights', 'speed-insights/[id]'] },
53
- { name: 'sandboxes', aliases: ['sandbox', 'sb'], product: 'sandboxes', summary: 'Ephemeral runs (image+command once) and persistent agent VMs (sandboxes vm …: pause with memory, fork, exec, ssh, environment, VM-scoped tokens)', subs: ['run', 'ls', 'get', 'vm'], endpoints: ['sandboxes', 'sandboxes/[id]', 'sandboxes/vms', 'sandboxes/vms/[id]', 'sandboxes/vms/[id]/exec', 'sandboxes/vms/[id]/pause', 'sandboxes/vms/[id]/resume', 'sandboxes/vms/[id]/stop', 'sandboxes/vms/[id]/start', 'sandboxes/vms/[id]/fork', 'sandboxes/vms/[id]/ssh-keys', 'sandboxes/vms/[id]/environment', 'sandboxes/vms/[id]/tokens', 'sandboxes/vms/[id]/ports', 'sandboxes/vms/[id]/ports/[port]', 'sandboxes/vms/[id]/ports/[port]/urls', 'sandboxes/vms/[id]/ports/[port]/urls/[urlId]', 'sandboxes/vms/[id]/usage', 'sandboxes/vms/[id]/history', 'sandboxes/vms/[id]/processes', 'sandboxes/vms/limits', 'sandboxes/vms/[id]/snapshots', 'sandboxes/snapshots', 'sandboxes/snapshots/[id]', 'sandboxes/snapshots/[id]/files', 'sandboxes/snapshots/[id]/shares', 'sandboxes/snapshots/[id]/shares/[shareId]', 'sandboxes/snapshots/[id]/files/content', 'sandboxes/vms/[id]/commands', 'sandboxes/vms/[id]/commands/[cmd]', 'sandboxes/vms/[id]/commands/[cmd]/stream', 'sandboxes/vms/[id]/files', 'sandboxes/vms/[id]/files/content', 'sandboxes/vms/[id]/files/move', 'sandboxes/vms/[id]/files/mkdir', 'sandboxes/vms/[id]/files/chmod', 'sandboxes/vms/[id]/files/replace', 'sandboxes/vms/[id]/files/upload-url', 'sandboxes/vms/[id]/files/upload-complete', 'sandboxes/vms/[id]/files/download-url'] },
53
+ { name: 'sandboxes', aliases: ['sandbox', 'sb'], product: 'sandboxes', summary: 'Ephemeral runs (image+command once) and persistent agent VMs (sandboxes vm …: pause with memory, fork, exec, ssh, environment, VM-scoped tokens)', subs: ['run', 'ls', 'get', 'vm'], endpoints: ['sandboxes', 'sandboxes/[id]', 'sandboxes/vms', 'sandboxes/vms/[id]', 'sandboxes/vms/[id]/exec', 'sandboxes/vms/[id]/pause', 'sandboxes/vms/[id]/resume', 'sandboxes/vms/[id]/stop', 'sandboxes/vms/[id]/start', 'sandboxes/vms/[id]/fork', 'sandboxes/vms/[id]/ssh-keys', 'sandboxes/vms/[id]/visibility', 'sandboxes/data-retention', 'sandboxes/vms/[id]/environment', 'sandboxes/vms/[id]/tokens', 'sandboxes/vms/[id]/ports', 'sandboxes/vms/[id]/ports/[port]', 'sandboxes/vms/[id]/ports/[port]/urls', 'sandboxes/vms/[id]/ports/[port]/urls/[urlId]', 'sandboxes/vms/[id]/usage', 'sandboxes/vms/[id]/history', 'sandboxes/vms/[id]/processes', 'sandboxes/vms/limits', 'sandboxes/vms/[id]/snapshots', 'sandboxes/snapshots', 'sandboxes/snapshots/[id]', 'sandboxes/snapshots/[id]/files', 'sandboxes/snapshots/[id]/shares', 'sandboxes/snapshots/[id]/shares/[shareId]', 'sandboxes/snapshots/[id]/files/content', 'sandboxes/vms/[id]/commands', 'sandboxes/vms/[id]/commands/[cmd]', 'sandboxes/vms/[id]/commands/[cmd]/stream', 'sandboxes/vms/[id]/files', 'sandboxes/vms/[id]/files/content', 'sandboxes/vms/[id]/files/move', 'sandboxes/vms/[id]/files/mkdir', 'sandboxes/vms/[id]/files/chmod', 'sandboxes/vms/[id]/files/replace', 'sandboxes/vms/[id]/files/upload-url', 'sandboxes/vms/[id]/files/upload-complete', 'sandboxes/vms/[id]/files/download-url'] },
54
54
  { name: 'images', aliases: ['image', 'img'], product: 'images', summary: 'Image optimization (resize/re-encode on the fly, allowlisted)', subs: ['config', 'allow', 'usage'], endpoints: ['images/config', 'images/usage'] },
55
55
  { name: 'waf', aliases: ['firewall'], product: 'firewall', summary: 'Firewall/WAF — allow/block rules (IP/country/path…) + evaluate', subs: ['rules', 'add', 'rm', 'evaluate'], endpoints: ['waf/rules', 'waf/rules/[id]', 'waf/evaluate'] },
56
56
  { name: 'webhooks', aliases: ['webhook', 'hooks'], product: 'webhooks', summary: 'Outbound webhooks — platform events → your URL, signed + retried', subs: ['ls', 'create', 'enable', 'disable', 'deliveries', 'rm'], endpoints: ['webhooks', 'webhooks/[id]', 'webhooks/[id]/deliveries'] },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koigrid",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "koigrid CLI — deploy apps, databases, redis, storage and more from your terminal (or your AI agent).",
5
5
  "bin": {
6
6
  "koigrid": "dist/index.js"