koigrid 0.12.0 → 0.13.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 +7 -0
- package/dist/commands/registry.js +9 -0
- package/dist/commands/sandboxes.js +54 -0
- package/dist/manifest.js +2 -2
- package/package.json +1 -1
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.13.0] — 2026-11-27
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `koigrid registry signing-key`: the public key koigrid signs the images it builds with, and the `cosign verify` command to check one.
|
|
12
|
+
- `koigrid sandboxes vm ports ls|expose|public|private|rm|url|urls|revoke`: expose a VM port over HTTPS (private by default), make it public, or create a signed URL for one port that expires (default 1 h, max 7 days) and can be revoked. The API answers 503 `vm_ports_unavailable` until the feature is switched on.
|
|
13
|
+
|
|
7
14
|
## [0.12.0] — 2026-11-27
|
|
8
15
|
|
|
9
16
|
### Added
|
|
@@ -67,6 +67,15 @@ export async function registry(a) {
|
|
|
67
67
|
// ayuda: imprime el comando docker login (el push/pull es por docker, no por este CLI)
|
|
68
68
|
return console.log('docker login registry.koigrid.com -u token -p <koi-token-with-registry:read/write>\n# luego: docker tag <img> registry.koigrid.com/<name>:<tag> && docker push registry.koigrid.com/<name>:<tag>');
|
|
69
69
|
}
|
|
70
|
+
if (sub === 'signing-key') {
|
|
71
|
+
// La clave pública con la que koigrid firma las imágenes que construye (cosign). Pública: no pide token.
|
|
72
|
+
const r = await api('/registry/signing-key');
|
|
73
|
+
if (json)
|
|
74
|
+
return console.log(JSON.stringify(r, null, 2));
|
|
75
|
+
console.log(r.pem.trim());
|
|
76
|
+
console.error(r.verify);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
70
79
|
if (sub === 'policy') {
|
|
71
80
|
// Retención por repositorio (como una lifecycle policy de ECR): `policy <name>` la enseña, `policy <name> 20`
|
|
72
81
|
// la fija y `policy <name> plan` vuelve a la del plan. Lo que sirve un despliegue vivo se conserva siempre.
|
|
@@ -66,6 +66,11 @@ const USO_VM = `usage: koigrid sandboxes vm <action> …
|
|
|
66
66
|
history <vm> [--limit N] [--before ISO] commands run in it (direct and background), newest first, 90 days
|
|
67
67
|
ps <vm> processes running now, highest CPU first
|
|
68
68
|
limits fair-use ceilings of your VMs and how much of each is used
|
|
69
|
+
ports ls <vm> ports exposed over HTTPS (public ones show their URL)
|
|
70
|
+
ports expose <vm> <port> [--public] expose a port; private by default (reach it with a signed URL)
|
|
71
|
+
ports public|private <vm> <port> make it public or private · ports rm <vm> <port>: stop exposing it
|
|
72
|
+
ports url <vm> <port> [--expires S] a signed URL for that port (default 1 h, max 7 days), shown once
|
|
73
|
+
ports urls <vm> <port> its signed URLs · ports revoke <vm> <port> <url-id>: revoke one
|
|
69
74
|
ssh <vm> [-- command] SSH into the VM (wakes it if paused); needs your key on it (ssh-key set)
|
|
70
75
|
ssh-key set <vm> [--key FILE.pub]… replace the keys allowed in (default ~/.ssh/id_ed25519.pub) · ssh-key ls <vm>
|
|
71
76
|
ssh-config <vm> [--write] the ~/.ssh/config block for ssh, VS Code and Cursor (--write adds it, and the VM host key)
|
|
@@ -252,6 +257,55 @@ async function vm(a, json) {
|
|
|
252
257
|
console.error(`only valid on ${r.base}/… until ${r.token.expiresAt} · revoke: koigrid tokens revoke ${r.token.id}`);
|
|
253
258
|
return;
|
|
254
259
|
}
|
|
260
|
+
// ── Puertos por https (hueco 11, ficha 1cabcf55): privados por defecto, URL firmada o pública ──
|
|
261
|
+
if (accion === 'ports') {
|
|
262
|
+
const sub = objetivo;
|
|
263
|
+
const vmNombre = a.positionals[2];
|
|
264
|
+
const puerto = a.positionals[3];
|
|
265
|
+
if (!vmNombre || !['ls', 'expose', 'public', 'private', 'rm', 'url', 'urls', 'revoke'].includes(String(sub)))
|
|
266
|
+
throw new Error(USO_VM);
|
|
267
|
+
if (sub !== 'ls' && !puerto)
|
|
268
|
+
throw new Error(USO_VM);
|
|
269
|
+
let r;
|
|
270
|
+
if (sub === 'ls')
|
|
271
|
+
r = await api(`/sandboxes/vms/${encodeURIComponent(vmNombre)}/ports`);
|
|
272
|
+
else if (sub === 'expose')
|
|
273
|
+
r = await api(`/sandboxes/vms/${encodeURIComponent(vmNombre)}/ports`, { method: 'POST', body: { port: Number(puerto), public: !!a.flags.public } });
|
|
274
|
+
else if (sub === 'public' || sub === 'private')
|
|
275
|
+
r = await api(`/sandboxes/vms/${encodeURIComponent(vmNombre)}/ports/${encodeURIComponent(String(puerto))}`, { method: 'PATCH', body: { public: sub === 'public' } });
|
|
276
|
+
else if (sub === 'rm')
|
|
277
|
+
r = await api(`/sandboxes/vms/${encodeURIComponent(vmNombre)}/ports/${encodeURIComponent(String(puerto))}`, { method: 'DELETE' });
|
|
278
|
+
else if (sub === 'url')
|
|
279
|
+
r = await api(`/sandboxes/vms/${encodeURIComponent(vmNombre)}/ports/${encodeURIComponent(String(puerto))}/urls`, { method: 'POST', body: a.flags.expires ? { expiresInSeconds: Number(a.flags.expires) } : {} });
|
|
280
|
+
else if (sub === 'urls')
|
|
281
|
+
r = await api(`/sandboxes/vms/${encodeURIComponent(vmNombre)}/ports/${encodeURIComponent(String(puerto))}/urls`);
|
|
282
|
+
else {
|
|
283
|
+
const urlId = a.positionals[4];
|
|
284
|
+
if (!urlId)
|
|
285
|
+
throw new Error(USO_VM);
|
|
286
|
+
r = await api(`/sandboxes/vms/${encodeURIComponent(vmNombre)}/ports/${encodeURIComponent(String(puerto))}/urls/${encodeURIComponent(urlId)}`, { method: 'DELETE' });
|
|
287
|
+
}
|
|
288
|
+
if (json)
|
|
289
|
+
return console.log(JSON.stringify(r, null, 2));
|
|
290
|
+
if (sub === 'ls') {
|
|
291
|
+
if (!r.ports.length)
|
|
292
|
+
return console.log(`no ports exposed (at most ${r.max}): koigrid sandboxes vm ports expose ${vmNombre} <port>`);
|
|
293
|
+
for (const p of r.ports)
|
|
294
|
+
console.log(`${p.port}\t${p.public ? 'public ' : 'private'}\t${p.url ?? '(signed URL: koigrid sandboxes vm ports url ' + vmNombre + ' ' + p.port + ')'}`);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (sub === 'url') {
|
|
298
|
+
console.log(r.url);
|
|
299
|
+
console.error(`only for port ${puerto}, until ${r.expiresAt} · revoke: koigrid sandboxes vm ports revoke ${vmNombre} ${puerto} ${r.id}`);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (sub === 'urls') {
|
|
303
|
+
for (const u of r.urls)
|
|
304
|
+
console.log(`${u.id}\t${u.tokenPrefix}…\t${u.active ? 'active' : u.revokedAt ? 'revoked' : 'expired'}\t${u.expiresAt}`);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
return console.log(JSON.stringify(r));
|
|
308
|
+
}
|
|
255
309
|
// ── SSH (ficha daa6b24a): por la puerta de koigrid, cifrado de punta a punta con la VM ──
|
|
256
310
|
if (accion === 'ssh-key') {
|
|
257
311
|
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]/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]/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'] },
|
|
@@ -62,7 +62,7 @@ export const CLI_COMMANDS = [
|
|
|
62
62
|
{ name: 'dns', product: 'dns', summary: 'DNS Management (BYO) — connect your zone + CRUD records', subs: ['zones', 'connect', 'disconnect', 'records', 'add', 'update', 'del'], endpoints: ['dns/zones', 'dns/zones/[id]', 'dns/zones/[id]/records', 'dns/zones/[id]/records/[recordId]'] },
|
|
63
63
|
{ name: 'queues', aliases: ['queue', 'sqs'], product: 'queues', summary: 'Queues — durable message queue (SQS-like): send/receive/ack + visibility timeout + dead-letter', subs: ['ls', 'create', 'show', 'update', 'send', 'receive', 'ack', 'rm'], endpoints: ['queues', 'queues/[id]', 'queues/[id]/messages', 'queues/[id]/receive', 'queues/[id]/ack'] },
|
|
64
64
|
{ name: 'workflows', aliases: ['workflow', 'wf'], product: 'workflows', summary: 'Workflows — durable execution (Step-Functions-like): ordered steps + journal + durable sleep + retries', subs: ['ls', 'create', 'rm', 'update', 'start', 'runs', 'run', 'next', 'complete', 'fail', 'sleep'], endpoints: ['workflows', 'workflows/[id]', 'workflows/[id]/runs', 'workflows/[id]/runs/[runId]', 'workflows/[id]/runs/[runId]/next', 'workflows/[id]/runs/[runId]/complete', 'workflows/[id]/runs/[runId]/fail', 'workflows/[id]/runs/[runId]/sleep'] },
|
|
65
|
-
{ name: 'registry', aliases: ['ecr', 'cr'], product: 'container-registry', summary: 'Container Registry (OCI, ECR-like) — docker push/pull; list repos + tags (digest/size/pushed); CVE scan (Trivy)', subs: ['repos', 'tags', 'rm-tag', 'gc', 'login', 'scan', 'policy'], endpoints: ['registry/repositories', 'registry/repositories/[name]/tags', 'registry/repositories/[name]/policy', 'registry/repositories/[name]/tags/[tag]', 'registry/gc'] },
|
|
65
|
+
{ name: 'registry', aliases: ['ecr', 'cr'], product: 'container-registry', summary: 'Container Registry (OCI, ECR-like) — docker push/pull; list repos + tags (digest/size/pushed); CVE scan (Trivy)', subs: ['repos', 'tags', 'rm-tag', 'gc', 'login', 'scan', 'policy', 'signing-key'], endpoints: ['registry/signing-key', 'registry/repositories', 'registry/repositories/[name]/tags', 'registry/repositories/[name]/policy', 'registry/repositories/[name]/tags/[tag]', 'registry/gc'] },
|
|
66
66
|
{ name: 'audit', aliases: ['audit-log', 'cloudtrail'], product: 'audit', summary: 'Audit Log — who did what (security/config changes), with IP + CSV export (owner/admin only)', subs: ['ls', 'export'], endpoints: ['audit', 'audit/export'] },
|
|
67
67
|
{ name: 'up', aliases: ['apply', 'cutover'], summary: 'Cutover manifest — bring up a WHOLE stack (apps+db+redis, wired by ${{...}}) from koigrid.yaml in one command', subs: [], endpoints: ['manifest'] },
|
|
68
68
|
{ name: 'plan', summary: 'Dry-run a cutover manifest (koigrid.yaml): what would be created/updated, without mutating', subs: [], endpoints: ['manifest/plan'] },
|