koigrid 0.6.0 → 0.8.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 +6 -1
- package/dist/api.js +21 -3
- package/dist/args.js +19 -0
- package/dist/commands/analytics.js +1 -1
- package/dist/commands/apps.js +195 -19
- package/dist/commands/audit.js +1 -1
- package/dist/commands/billing.js +31 -0
- package/dist/commands/bots.js +1 -1
- package/dist/commands/changelog.js +19 -0
- package/dist/commands/checks.js +4 -3
- package/dist/commands/config.js +9 -6
- package/dist/commands/connect.js +2 -2
- package/dist/commands/db.js +384 -16
- package/dist/commands/dns.js +1 -1
- package/dist/commands/errors.js +1 -1
- package/dist/commands/flags.js +1 -1
- package/dist/commands/heartbeats.js +3 -3
- package/dist/commands/images.js +1 -1
- package/dist/commands/jobs.js +39 -4
- package/dist/commands/links.js +59 -0
- package/dist/commands/logs.js +1 -1
- package/dist/commands/members.js +26 -1
- package/dist/commands/notices.js +24 -0
- package/dist/commands/notifications.js +2 -2
- package/dist/commands/otel.js +1 -1
- package/dist/commands/projects.js +1 -1
- package/dist/commands/queues.js +4 -3
- package/dist/commands/redis.js +18 -2
- package/dist/commands/registry.js +43 -3
- package/dist/commands/rewards.js +63 -0
- package/dist/commands/sandboxes.js +1 -1
- package/dist/commands/speed.js +1 -1
- package/dist/commands/spend.js +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/storage.js +31 -3
- package/dist/commands/support.js +47 -0
- package/dist/commands/tokens.js +2 -2
- package/dist/commands/up.js +6 -2
- package/dist/commands/waf.js +1 -1
- package/dist/commands/webhooks.js +1 -1
- package/dist/commands/wordpress.js +4 -3
- package/dist/commands/workflows.js +4 -3
- package/dist/index.js +13 -3
- package/dist/manifest.js +15 -10
- package/dist/output.js +1 -0
- package/dist/proyecto.js +6 -0
- package/dist/registry-flags.js +17 -0
- package/dist/registry.js +6 -2
- package/package.json +1 -1
- package/dist/commands/ai.js +0 -56
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { api } from '../api.js';
|
|
3
|
+
import { output, green } from '../output.js';
|
|
4
|
+
export async function links(a) {
|
|
5
|
+
const json = !!a.flags.json, sub = a.sub || 'ls';
|
|
6
|
+
if (sub === 'ls' || sub === 'list') {
|
|
7
|
+
const r = await api('/links');
|
|
8
|
+
const l = r.links || [];
|
|
9
|
+
return output(l, json, { rows: l.map((x) => ({ id: String(x.id).slice(0, 8), slug: x.slug, url: String(x.url).slice(0, 60), clicks: String(x.clicks ?? 0) })), columns: ['id', 'slug', 'url', 'clicks'] });
|
|
10
|
+
}
|
|
11
|
+
if (sub === 'create' || sub === 'add') {
|
|
12
|
+
const url = a.positionals[0];
|
|
13
|
+
if (!url)
|
|
14
|
+
throw new Error('usage: koigrid links create <url>');
|
|
15
|
+
const r = await api('/links', { method: 'POST', body: { url } });
|
|
16
|
+
return console.log(json ? JSON.stringify(r, null, 2) : green(`✓ ${r.link?.shortUrl || ''}`));
|
|
17
|
+
}
|
|
18
|
+
if (sub === 'update' || sub === 'set') {
|
|
19
|
+
const id = a.positionals[0], url = a.positionals[1] || a.flags.url;
|
|
20
|
+
if (!id || !url)
|
|
21
|
+
throw new Error('usage: koigrid links update <id> <new-url>');
|
|
22
|
+
await api(`/links/${encodeURIComponent(id)}`, { method: 'PATCH', body: { url } });
|
|
23
|
+
return console.log(green(`✓ Updated ${id}`));
|
|
24
|
+
}
|
|
25
|
+
if (sub === 'rm' || sub === 'delete') {
|
|
26
|
+
const id = a.positionals[0];
|
|
27
|
+
if (!id)
|
|
28
|
+
throw new Error('usage: koigrid links rm <id>');
|
|
29
|
+
await api(`/links/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
|
30
|
+
return console.log(green(`✓ Deleted ${id}`));
|
|
31
|
+
}
|
|
32
|
+
throw new Error(`unknown: links ${sub}`);
|
|
33
|
+
}
|
|
34
|
+
export async function share(a) {
|
|
35
|
+
const json = !!a.flags.json, sub = a.sub || 'ls';
|
|
36
|
+
if (sub === 'ls' || sub === 'list') {
|
|
37
|
+
const r = await api('/share');
|
|
38
|
+
const l = r.shares || [];
|
|
39
|
+
return output(l, json, { rows: l.map((x) => ({ id: String(x.id).slice(0, 8), filename: x.filename, size: String(x.size ?? ''), downloads: String(x.downloads ?? 0) })), columns: ['id', 'filename', 'size', 'downloads'] });
|
|
40
|
+
}
|
|
41
|
+
if (sub === 'upload' || sub === 'up') {
|
|
42
|
+
const ruta = a.positionals[0];
|
|
43
|
+
if (!ruta)
|
|
44
|
+
throw new Error('usage: koigrid share upload <file>');
|
|
45
|
+
// Cuerpo en crudo con `x-filename`: la otra forma que acepta la API (la de multipart la usa el navegador).
|
|
46
|
+
const bytes = readFileSync(ruta);
|
|
47
|
+
const nombre = ruta.split('/').pop() || 'file';
|
|
48
|
+
const r = await api('/share', { method: 'POST', rawBody: new Uint8Array(bytes), headers: { 'x-filename': nombre, 'content-type': 'application/octet-stream' } });
|
|
49
|
+
return console.log(json ? JSON.stringify(r, null, 2) : green(`✓ ${r.share?.url || ''}`));
|
|
50
|
+
}
|
|
51
|
+
if (sub === 'rm' || sub === 'delete') {
|
|
52
|
+
const id = a.positionals[0];
|
|
53
|
+
if (!id)
|
|
54
|
+
throw new Error('usage: koigrid share rm <id>');
|
|
55
|
+
await api(`/share/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
|
56
|
+
return console.log(green(`✓ Deleted ${id}`));
|
|
57
|
+
}
|
|
58
|
+
throw new Error(`unknown: share ${sub}`);
|
|
59
|
+
}
|
package/dist/commands/logs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
-
// koigrid logs — Log Drains (reenvío de logs a un sink) + ingesta/query del buffer. Ver docs/LOG-DRAINS.md.
|
|
3
|
+
// koigrid logs — Log Drains (reenvío de logs a un sink) + ingesta/query del buffer. Ver docs/products/LOG-DRAINS.md.
|
|
4
4
|
export async function logs(a) {
|
|
5
5
|
const json = !!a.flags.json;
|
|
6
6
|
const sub = a.sub || 'tail';
|
package/dist/commands/members.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
-
// koigrid members — gestión del equipo (miembros + invitaciones). Ver docs/MEMBERS.md.
|
|
3
|
+
// koigrid members — gestión del equipo (miembros + invitaciones). Ver docs/products/MEMBERS.md.
|
|
4
4
|
export async function members(a) {
|
|
5
5
|
const json = !!a.flags.json;
|
|
6
6
|
const sub = a.sub || 'ls';
|
|
@@ -43,6 +43,31 @@ export async function members(a) {
|
|
|
43
43
|
await api(`/members/${encodeURIComponent(userId)}`, { method: 'DELETE' });
|
|
44
44
|
return console.log(green(`✓ Removed ${userId}`));
|
|
45
45
|
}
|
|
46
|
+
if (sub === '2fa') {
|
|
47
|
+
// COMP-2FA-ORG: exigir 2FA a todo el equipo (con periodo de gracia y aviso por correo a quien no lo tenga).
|
|
48
|
+
const act = a.positionals[0];
|
|
49
|
+
if (!act || act === 'show') {
|
|
50
|
+
const r = await api('/members/two-factor');
|
|
51
|
+
const p = r.policy || r;
|
|
52
|
+
if (json)
|
|
53
|
+
return console.log(JSON.stringify(p, null, 2));
|
|
54
|
+
console.log(`2FA obligatorio: ${p.required ? 'SÍ' : 'no'}${p.required ? ` (gracia ${p.graceDays} días desde ${String(p.requiredAt ?? '—').slice(0, 10)})` : ''}`);
|
|
55
|
+
return console.log(`miembros: ${p.members} · sin 2FA configurado: ${p.withoutTwoFactor}`);
|
|
56
|
+
}
|
|
57
|
+
if (act === 'require' || act === 'off') {
|
|
58
|
+
const body = { required: act === 'require' };
|
|
59
|
+
if (a.flags.grace !== undefined)
|
|
60
|
+
body.graceDays = Number(a.flags.grace);
|
|
61
|
+
const r = await api('/members/two-factor', { method: 'PUT', body });
|
|
62
|
+
if (json)
|
|
63
|
+
return console.log(JSON.stringify(r, null, 2));
|
|
64
|
+
console.log(green(act === 'require' ? `✓ 2FA obligatorio (gracia hasta ${String(r.deadline ?? '').slice(0, 10)})` : '✓ 2FA obligatorio desactivado'));
|
|
65
|
+
if (r.warning)
|
|
66
|
+
console.log(` ⚠️ ${r.warning}`);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
throw new Error('usage: koigrid members 2fa show | require [--grace <días>] | off');
|
|
70
|
+
}
|
|
46
71
|
if (sub === 'revoke') {
|
|
47
72
|
const id = a.positionals[0];
|
|
48
73
|
if (!id)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { api } from '../api.js';
|
|
2
|
+
import { output, green } from '../output.js';
|
|
3
|
+
// koigrid notices — los avisos de la campana del panel (aprobado en la beta, despliegue fallido, pago enviado…) y
|
|
4
|
+
// cuántas conversaciones de soporte tienen respuesta sin leer.
|
|
5
|
+
// koigrid notices [ls] [--lang es]
|
|
6
|
+
// koigrid notices read [<id>...] (sin ids: todos)
|
|
7
|
+
export async function notices(a) {
|
|
8
|
+
const json = !!a.flags.json, sub = a.sub || 'ls';
|
|
9
|
+
if (sub === 'ls' || sub === 'list') {
|
|
10
|
+
const lang = typeof a.flags.lang === 'string' ? `?lang=${encodeURIComponent(String(a.flags.lang))}` : '';
|
|
11
|
+
const r = await api(`/notices${lang}`);
|
|
12
|
+
if (json)
|
|
13
|
+
return console.log(JSON.stringify(r, null, 2));
|
|
14
|
+
console.log(green(`${r.unread} unread notice(s) · ${r.supportUnread} support conversation(s) with an unread reply`));
|
|
15
|
+
const l = r.notices || [];
|
|
16
|
+
return output(l, false, { rows: l.map((x) => ({ id: String(x.id).slice(0, 8), new: x.read ? '' : '●', notice: x.title, when: String(x.createdAt).slice(0, 16).replace('T', ' ') })), columns: ['id', 'new', 'notice', 'when'] });
|
|
17
|
+
}
|
|
18
|
+
if (sub === 'read') {
|
|
19
|
+
const ids = a.positionals.filter(Boolean);
|
|
20
|
+
const r = await api('/notices/read', { method: 'POST', body: ids.length ? { ids } : {} });
|
|
21
|
+
return console.log(json ? JSON.stringify(r, null, 2) : green(`✓ ${r.marked} notice(s) marked as read`));
|
|
22
|
+
}
|
|
23
|
+
throw new Error(`unknown: notices ${sub}`);
|
|
24
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
-
// koigrid notifications — preferencias de aviso por email (por categoría: alarms/anomalies/spend).
|
|
3
|
+
// koigrid notifications — preferencias de aviso por email (por categoría: alarms/anomalies/spend/jobs/heartbeats/checks).
|
|
4
4
|
// koigrid notifications ls
|
|
5
5
|
// koigrid notifications set spend off (o on)
|
|
6
6
|
export async function notifications(a) {
|
|
@@ -13,7 +13,7 @@ export async function notifications(a) {
|
|
|
13
13
|
if (sub === 'set') {
|
|
14
14
|
const category = a.positionals[0], state = a.positionals[1];
|
|
15
15
|
if (!category || (state !== 'on' && state !== 'off'))
|
|
16
|
-
throw new Error('usage: koigrid notifications set <alarms|anomalies|spend> <on|off>');
|
|
16
|
+
throw new Error('usage: koigrid notifications set <alarms|anomalies|spend|jobs|heartbeats|checks> <on|off>');
|
|
17
17
|
const r = await api('/notifications/preferences', { method: 'PUT', body: { category, emailEnabled: state === 'on' } });
|
|
18
18
|
return console.log(json ? JSON.stringify(r, null, 2) : green(`✓ ${category} email notifications ${state}`));
|
|
19
19
|
}
|
package/dist/commands/otel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { green } from '../output.js';
|
|
3
|
-
// koigrid otel — OpenTelemetry export (endpoint OTLP de métricas). Ver docs/OTEL.md.
|
|
3
|
+
// koigrid otel — OpenTelemetry export (endpoint OTLP de métricas). Ver docs/products/OTEL.md.
|
|
4
4
|
export async function otel(a) {
|
|
5
5
|
const json = !!a.flags.json;
|
|
6
6
|
const sub = a.sub || 'show';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
-
// koigrid projects — agrupación de recursos dentro de la org (ver docs/PROJECTS.md).
|
|
3
|
+
// koigrid projects — agrupación de recursos dentro de la org (ver docs/products/PROJECTS.md).
|
|
4
4
|
export async function projects(a) {
|
|
5
5
|
const json = !!a.flags.json;
|
|
6
6
|
const sub = a.sub || 'ls';
|
package/dist/commands/queues.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
-
|
|
3
|
+
import { proyectoDeFlags } from '../proyecto.js';
|
|
4
|
+
// koigrid queues — cola durable (sustituto de AWS SQS): send/receive/ack + dead-letter. Ver docs/products/QUEUES.md.
|
|
4
5
|
export async function queues(a) {
|
|
5
6
|
const json = !!a.flags.json;
|
|
6
7
|
const sub = a.sub || 'ls';
|
|
@@ -13,8 +14,8 @@ export async function queues(a) {
|
|
|
13
14
|
if (sub === 'create') {
|
|
14
15
|
const name = a.positionals[0];
|
|
15
16
|
if (!name)
|
|
16
|
-
throw new Error('usage: koigrid queues create <name> [--visibility 30] [--max-receives 5]');
|
|
17
|
-
const body = { name };
|
|
17
|
+
throw new Error('usage: koigrid queues create <name> [--visibility 30] [--max-receives 5] [--project <id>]');
|
|
18
|
+
const body = { name, ...proyectoDeFlags(a) };
|
|
18
19
|
if (a.flags.visibility)
|
|
19
20
|
body.visibilityTimeoutSec = Number(a.flags.visibility);
|
|
20
21
|
if (a.flags['max-receives'])
|
package/dist/commands/redis.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
+
import { proyectoDeFlags } from '../proyecto.js';
|
|
3
4
|
export async function redis(a) {
|
|
4
5
|
const json = !!a.flags.json, sub = a.sub || 'ls', id = a.positionals[0];
|
|
5
6
|
const need = () => { if (!id)
|
|
@@ -14,10 +15,14 @@ export async function redis(a) {
|
|
|
14
15
|
case 'create': {
|
|
15
16
|
const name = a.positionals[0];
|
|
16
17
|
if (!name)
|
|
17
|
-
throw new Error('usage: koigrid redis create <name> [--replicas N]');
|
|
18
|
-
const body = { name };
|
|
18
|
+
throw new Error('usage: koigrid redis create <name> [--replicas N] [--memory MB] [--policy volatile-lru|allkeys-lru|…] [--project <id>]');
|
|
19
|
+
const body = { name, ...proyectoDeFlags(a) };
|
|
19
20
|
if (a.flags.replicas)
|
|
20
21
|
body.replicas = Number(a.flags.replicas);
|
|
22
|
+
if (a.flags.memory)
|
|
23
|
+
body.memoryMb = Number(a.flags.memory);
|
|
24
|
+
if (a.flags.policy)
|
|
25
|
+
body.maxmemoryPolicy = String(a.flags.policy);
|
|
21
26
|
const r = await api('/redis', { method: 'POST', body });
|
|
22
27
|
return console.log(json ? JSON.stringify(r.cache || r, null, 2) : green(`✓ Creating "${name}"…`));
|
|
23
28
|
}
|
|
@@ -45,6 +50,17 @@ export async function redis(a) {
|
|
|
45
50
|
case 'metrics':
|
|
46
51
|
need();
|
|
47
52
|
return console.log(JSON.stringify(await api(`/redis/${encodeURIComponent(id)}/metrics`), null, 2));
|
|
53
|
+
case 'apply-config': {
|
|
54
|
+
// SEC-REDIS-CUTOVER: recrea los nodos para que dejen de llevar la contraseña en sus Args (docker inspect).
|
|
55
|
+
need();
|
|
56
|
+
const r = await api(`/redis/${encodeURIComponent(id)}/apply-config`, { method: 'POST', body: {} });
|
|
57
|
+
if (json)
|
|
58
|
+
return console.log(JSON.stringify(r, null, 2));
|
|
59
|
+
console.log(green(`✓ Re-aprovisionando ${r.members} nodo(s)`));
|
|
60
|
+
if (r.downtime)
|
|
61
|
+
console.log(` ⚠️ ${r.downtime}`);
|
|
62
|
+
return console.log(" Comprueba después: docker inspect <contenedor> --format '{{join .Args \" \"}}' → no debe traer requirepass");
|
|
63
|
+
}
|
|
48
64
|
case 'backups': {
|
|
49
65
|
need();
|
|
50
66
|
if (a.positionals[1] === 'create') {
|
|
@@ -2,7 +2,7 @@ import { api } from '../api.js';
|
|
|
2
2
|
import { output } from '../output.js';
|
|
3
3
|
const fmtBytes = (n) => n < 1024 ? `${n}B` : n < 1048576 ? `${(n / 1024).toFixed(1)}KB` : n < 1073741824 ? `${(n / 1048576).toFixed(1)}MB` : `${(n / 1073741824).toFixed(2)}GB`;
|
|
4
4
|
// koigrid registry — Container Registry (OCI, vs AWS ECR). El push/pull lo hace docker; aquí se listan repos.
|
|
5
|
-
// Ver docs/REGISTRY.md.
|
|
5
|
+
// Ver docs/products/REGISTRY.md.
|
|
6
6
|
export async function registry(a) {
|
|
7
7
|
const json = !!a.flags.json;
|
|
8
8
|
const sub = a.sub || 'repos';
|
|
@@ -10,7 +10,7 @@ export async function registry(a) {
|
|
|
10
10
|
const r = await api('/registry/repositories');
|
|
11
11
|
const l = r.repositories || [];
|
|
12
12
|
if (!json && !l.length)
|
|
13
|
-
return console.log('No images yet. Push one: docker login koigrid.com -u token -p <koi-token-with-registry-scope> && docker push koigrid.com/<name>:<tag>');
|
|
13
|
+
return console.log('No images yet. Push one: docker login registry.koigrid.com -u token -p <koi-token-with-registry-scope> && docker push registry.koigrid.com/<name>:<tag>');
|
|
14
14
|
return output(l, json, { rows: l.map((x) => ({ repository: x.name, tags: x.tags })), columns: ['repository', 'tags'] });
|
|
15
15
|
}
|
|
16
16
|
if (sub === 'tags') {
|
|
@@ -23,9 +23,49 @@ export async function registry(a) {
|
|
|
23
23
|
return console.log(`No tags in ${repo}.`);
|
|
24
24
|
return output(l, json, { rows: l.map((x) => ({ tag: x.tag, digest: String(x.digest).slice(0, 19), size: fmtBytes(x.size), pushed: (x.pushedAt || '').slice(0, 16) })), columns: ['tag', 'digest', 'size', 'pushed'] });
|
|
25
25
|
}
|
|
26
|
+
if (sub === 'rm-tag') {
|
|
27
|
+
const repo = a.positionals[0], tag = a.positionals[1];
|
|
28
|
+
if (!repo || !tag)
|
|
29
|
+
throw new Error('usage: koigrid registry rm-tag <name> <tag>');
|
|
30
|
+
// Borrar el tag sólo desreferencia la imagen; el espacio lo libera `registry gc`.
|
|
31
|
+
const r = await api(`/registry/repositories/${Buffer.from(repo).toString('base64url')}/tags/${encodeURIComponent(tag)}`, { method: 'DELETE' });
|
|
32
|
+
return output(r, json, { rows: [{ repository: r.repository, tag: r.tag, deleted: r.deleted }], columns: ['repository', 'tag', 'deleted'] });
|
|
33
|
+
}
|
|
34
|
+
if (sub === 'scan') {
|
|
35
|
+
const repo = a.positionals[0], tag = a.positionals[1];
|
|
36
|
+
if (!repo || !tag)
|
|
37
|
+
throw new Error('usage: koigrid registry scan <name> <tag>');
|
|
38
|
+
const r = await api(`/registry/repositories/${Buffer.from(repo).toString('base64url')}/tags/${encodeURIComponent(tag)}`);
|
|
39
|
+
const s = r.scan;
|
|
40
|
+
if (!json && !s)
|
|
41
|
+
return console.log(`No hay escaneo todavía para ${repo}:${tag} (se lanza solo tras el push, tarda unos minutos).`);
|
|
42
|
+
if (!json && s) {
|
|
43
|
+
console.log(`${repo}:${tag} — ${s.status}${s.status === 'failed' ? ` (${s.error})` : ''}`);
|
|
44
|
+
if (s.status === 'ok')
|
|
45
|
+
console.log(` critical:${s.critical} high:${s.high} medium:${s.medium} low:${s.low}`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
return output(s, json, { rows: [s], columns: ['status', 'critical', 'high', 'medium', 'low'] });
|
|
49
|
+
}
|
|
50
|
+
if (sub === 'gc') {
|
|
51
|
+
// Por defecto SIMULA: en un almacén de imágenes se mira antes de borrar. `--apply` ejecuta de verdad.
|
|
52
|
+
const body = { dryRun: !a.flags.apply };
|
|
53
|
+
if (a.positionals[0])
|
|
54
|
+
body.repository = a.positionals[0];
|
|
55
|
+
if (a.flags['keep-last'])
|
|
56
|
+
body.keepLast = Number(a.flags['keep-last']);
|
|
57
|
+
const r = await api('/registry/gc', { method: 'POST', body });
|
|
58
|
+
const l = r.results || [];
|
|
59
|
+
if (!json)
|
|
60
|
+
console.log(r.dryRun ? '(simulación — añade --apply para borrar de verdad)' : '(aplicado)');
|
|
61
|
+
return output(l, json, {
|
|
62
|
+
rows: l.map((x) => ({ repository: x.repository, blobs: x.deletedBlobs, freed: fmtBytes(x.bytesFreed), 'held(recent)': x.heldRecent, 'pruned tags': (x.prunedTags || []).length, abort: x.abort || '' })),
|
|
63
|
+
columns: ['repository', 'blobs', 'freed', 'held(recent)', 'pruned tags', 'abort'],
|
|
64
|
+
});
|
|
65
|
+
}
|
|
26
66
|
if (sub === 'login') {
|
|
27
67
|
// ayuda: imprime el comando docker login (el push/pull es por docker, no por este CLI)
|
|
28
|
-
return console.log('docker login koigrid.com -u token -p <koi-token-with-registry:read/write>\n# luego: docker tag <img> koigrid.com/<name>:<tag> && docker push koigrid.com/<name>:<tag>');
|
|
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>');
|
|
29
69
|
}
|
|
30
70
|
throw new Error(`unknown: registry ${sub}`);
|
|
31
71
|
}
|
package/dist/commands/rewards.js
CHANGED
|
@@ -6,6 +6,12 @@ import { output, green } from '../output.js';
|
|
|
6
6
|
// koigrid rewards lines (qué acciones se pagan y cuánto)
|
|
7
7
|
// koigrid rewards submit <reason> [--json '{"...":"..."}'] (reclamar una recompensa)
|
|
8
8
|
// koigrid rewards redeem credit|giftcard [--amount <cents>] (redimir el saldo)
|
|
9
|
+
// koigrid rewards beta (programa beta: estado, tareas, saldo, pagos)
|
|
10
|
+
// koigrid rewards beta apply --json '{"appUrl":…}' (solicitar la entrada; se aprueba a mano)
|
|
11
|
+
// koigrid rewards beta feedback --json '{"appId":…}' (tu opinión de UX/UI)
|
|
12
|
+
// koigrid rewards beta agent-log --json '{"entries":[…]}' (el registro de fallos y mejoras de TU agente)
|
|
13
|
+
// koigrid rewards beta wallet <network> <address> (usdt-trc20|usdc-trc20|usdt-polygon|usdc-polygon|btc)
|
|
14
|
+
// koigrid rewards beta payout (pedir el pago en cripto)
|
|
9
15
|
export async function rewards(a) {
|
|
10
16
|
const json = !!a.flags.json;
|
|
11
17
|
const sub = a.sub || 'ls';
|
|
@@ -53,5 +59,62 @@ export async function rewards(a) {
|
|
|
53
59
|
return console.log(JSON.stringify(r, null, 2));
|
|
54
60
|
return console.log(green(`✓ Redimido $${((r.redeemed ?? 0) / 100).toFixed(2)} como ${r.type} — saldo restante $${((r.newBalance ?? 0) / 100).toFixed(2)}`));
|
|
55
61
|
}
|
|
62
|
+
if (sub === 'beta')
|
|
63
|
+
return beta(a);
|
|
56
64
|
throw new Error(`unknown: rewards ${sub}`);
|
|
57
65
|
}
|
|
66
|
+
const usd = (c) => `$${((c ?? 0) / 100).toFixed(2)}`;
|
|
67
|
+
/** El cuerpo de `--json`: el valor de la bandera, que tiene que ser JSON. */
|
|
68
|
+
function cuerpo(a, uso) {
|
|
69
|
+
if (typeof a.flags.json !== 'string')
|
|
70
|
+
throw new Error(`usage: ${uso}`);
|
|
71
|
+
return JSON.parse(String(a.flags.json));
|
|
72
|
+
}
|
|
73
|
+
// koigrid rewards beta … — el programa de beta testers (docs/growth/BETA-TESTERS.md).
|
|
74
|
+
async function beta(a) {
|
|
75
|
+
const accion = a.positionals[0] || 'status';
|
|
76
|
+
const conJson = a.flags.json === true;
|
|
77
|
+
if (accion === 'status') {
|
|
78
|
+
const r = await api('/rewards/beta');
|
|
79
|
+
if (conJson)
|
|
80
|
+
return console.log(JSON.stringify(r, null, 2));
|
|
81
|
+
console.log(`Programa beta: ${r.program?.libres}/${r.program?.plazas} plazas libres`);
|
|
82
|
+
if (!r.application)
|
|
83
|
+
return console.log('No has solicitado entrar. → koigrid rewards beta apply --json \'{"appUrl":"https://…","appType":"saas","monthlySpend":"lt25","motivation":"…"}\'');
|
|
84
|
+
console.log(`Solicitud: ${r.application.status}`);
|
|
85
|
+
if (r.application.status !== 'approved')
|
|
86
|
+
return;
|
|
87
|
+
for (const t of r.tasks || [])
|
|
88
|
+
console.log(` ${t.hecha ? '✓' : '·'} ${t.clave}`);
|
|
89
|
+
console.log(green(`Saldo a cobrar en cripto: ${usd(r.balanceCents)}`));
|
|
90
|
+
if (r.wallet)
|
|
91
|
+
console.log(`Cartera: ${r.wallet.networkName} ${r.wallet.address}`);
|
|
92
|
+
for (const p of r.payouts || [])
|
|
93
|
+
console.log(` pago ${usd(p.amountCents)} · ${p.status}${p.txHash ? ` · tx ${p.txHash}` : ''}`);
|
|
94
|
+
return console.log(`Descuento ${r.discount.percentOff}% × ${r.discount.months} meses: ${r.discount.used ? 'usado' : r.discount.earned ? 'GANADO (se aplica solo al pagar un plan)' : 'se gana al aprobarse tu opinión'}`);
|
|
95
|
+
}
|
|
96
|
+
if (accion === 'apply') {
|
|
97
|
+
const r = await api('/rewards/beta/apply', { method: 'POST', body: cuerpo(a, "koigrid rewards beta apply --json '{\"appUrl\":…,\"appType\":…,\"monthlySpend\":…,\"motivation\":…}'") });
|
|
98
|
+
return console.log(green(`✓ Solicitud enviada (${r.application?.status}). Te avisaremos por correo y en tu hilo de soporte.`));
|
|
99
|
+
}
|
|
100
|
+
if (accion === 'feedback') {
|
|
101
|
+
const r = await api('/rewards/beta/feedback', { method: 'POST', body: cuerpo(a, "koigrid rewards beta feedback --json '{\"appId\":…,\"timeToWorking\":…,\"ux\":…,\"ui\":…,\"missing\":…,\"recommend\":8}'") });
|
|
102
|
+
return console.log(green(`✓ Opinión enviada (${r.submission?.status}) — ${usd(r.submission?.amountCents)} al aprobarse`));
|
|
103
|
+
}
|
|
104
|
+
if (accion === 'agent-log') {
|
|
105
|
+
const r = await api('/rewards/beta/agent-log', { method: 'POST', body: cuerpo(a, "koigrid rewards beta agent-log --json '{\"entries\":[{\"type\":\"bug\",\"action\":…,\"happened\":…}]}'") });
|
|
106
|
+
return console.log(green(`✓ Registro guardado (${r.entries} entradas) · recompensa: ${r.reward === 'opened' ? 'pendiente de revisión' : 'ya reclamada antes'}`));
|
|
107
|
+
}
|
|
108
|
+
if (accion === 'wallet') {
|
|
109
|
+
const [, network, address] = a.positionals;
|
|
110
|
+
if (!network || !address)
|
|
111
|
+
throw new Error('usage: koigrid rewards beta wallet <usdt-trc20|usdc-trc20|usdt-polygon|usdc-polygon|btc> <address>');
|
|
112
|
+
const r = await api('/rewards/beta/wallet', { method: 'PUT', body: { network, address } });
|
|
113
|
+
return console.log(green(`✓ Cartera guardada: ${r.wallet?.networkName} ${r.wallet?.address}`));
|
|
114
|
+
}
|
|
115
|
+
if (accion === 'payout') {
|
|
116
|
+
const r = await api('/rewards/beta/payout', { method: 'POST', body: {} });
|
|
117
|
+
return console.log(green(`✓ Pago pedido: ${usd(r.payout?.amountCents)} a ${r.payout?.address} (${r.payout?.network}). Lo enviamos a mano; el hash aparecerá en \`koigrid rewards beta\`.`));
|
|
118
|
+
}
|
|
119
|
+
throw new Error(`unknown: rewards beta ${accion}`);
|
|
120
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
-
// koigrid sandboxes — compute efímero (docker run --rm una vez). Ver docs/SANDBOXES.md.
|
|
3
|
+
// koigrid sandboxes — compute efímero (docker run --rm una vez). Ver docs/products/SANDBOXES.md.
|
|
4
4
|
export async function sandboxes(a) {
|
|
5
5
|
const json = !!a.flags.json;
|
|
6
6
|
const sub = a.sub || 'ls';
|
package/dist/commands/speed.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output } from '../output.js';
|
|
3
|
-
// koigrid speed — Speed Insights (Core Web Vitals). Reutiliza el site de Web Analytics. Ver docs/SPEED-INSIGHTS.md.
|
|
3
|
+
// koigrid speed — Speed Insights (Core Web Vitals). Reutiliza el site de Web Analytics. Ver docs/products/SPEED-INSIGHTS.md.
|
|
4
4
|
export async function speed(a) {
|
|
5
5
|
const json = !!a.flags.json;
|
|
6
6
|
const sub = a.sub || 'ls';
|
package/dist/commands/spend.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { green } from '../output.js';
|
|
3
|
-
// koigrid spend — Spend Management (tope de gasto mensual + avisos + parada dura). Ver docs/SPEND.md.
|
|
3
|
+
// koigrid spend — Spend Management (tope de gasto mensual + avisos + parada dura). Ver docs/products/SPEND.md.
|
|
4
4
|
export async function spend(a) {
|
|
5
5
|
const json = !!a.flags.json;
|
|
6
6
|
const sub = a.sub || 'show';
|
package/dist/commands/status.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
-
// koigrid status — status pages públicas generadas de tus Checks. Ver docs/STATUS-PAGES.md.
|
|
3
|
+
// koigrid status — status pages públicas generadas de tus Checks. Ver docs/products/STATUS-PAGES.md.
|
|
4
4
|
export async function status(a) {
|
|
5
5
|
const json = !!a.flags.json;
|
|
6
6
|
const sub = a.sub || 'ls';
|
package/dist/commands/storage.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
+
import { proyectoDeFlags } from '../proyecto.js';
|
|
3
4
|
export async function storage(a) {
|
|
4
5
|
const json = !!a.flags.json, sub = a.sub || 'ls';
|
|
5
6
|
if (sub === 'ls' || sub === 'list') {
|
|
@@ -11,8 +12,8 @@ export async function storage(a) {
|
|
|
11
12
|
if (sub === 'create') {
|
|
12
13
|
const name = a.positionals[0];
|
|
13
14
|
if (!name)
|
|
14
|
-
throw new Error('usage: koigrid storage create <name>');
|
|
15
|
-
const r = await api('/buckets', { method: 'POST', body: { name } });
|
|
15
|
+
throw new Error('usage: koigrid storage create <name> [--project <id>]');
|
|
16
|
+
const r = await api('/buckets', { method: 'POST', body: { name, ...proyectoDeFlags(a) } });
|
|
16
17
|
if (json)
|
|
17
18
|
console.log(JSON.stringify(r, null, 2));
|
|
18
19
|
else
|
|
@@ -27,10 +28,24 @@ export async function storage(a) {
|
|
|
27
28
|
console.log(green(`✓ Deleted ${id}`));
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
31
|
+
// La ORGANIZACIÓN va en la tabla, no sólo en el --json (ficha f06dba3d): una clave emitida desde la cuenta
|
|
32
|
+
// equivocada sólo se ve si se enseña de quién es, y el error de julio tardó tres semanas en aparecer porque
|
|
33
|
+
// ni el panel ni esto lo decían.
|
|
30
34
|
if (sub === 'keys') {
|
|
31
35
|
const r = await api('/storage/keys');
|
|
32
36
|
const list = r.keys || r || [];
|
|
33
|
-
output(list, json, { rows: list.map((x) => ({ id: x.id.slice(0, 8), accessKey: x.accessKey || x.prefix || '' })), columns: ['id', 'accessKey'] });
|
|
37
|
+
output(list, json, { rows: list.map((x) => ({ id: x.id.slice(0, 8), accessKey: x.accessKey || x.prefix || '', account: x.organization?.name || x.organization?.id || '' })), columns: ['id', 'accessKey', 'account'] });
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// QUÉ ALCANZA una clave, leído del almacén (no lo que creíamos al emitirla). `alcance: null` = no se pudo leer.
|
|
41
|
+
if (sub === 'key-scope') {
|
|
42
|
+
const kid = a.positionals[0];
|
|
43
|
+
if (!kid)
|
|
44
|
+
throw new Error('usage: koigrid storage key-scope <id>');
|
|
45
|
+
const r = await api(`/storage/keys/${encodeURIComponent(kid)}/scope`);
|
|
46
|
+
output(r, json, { rows: (r.alcance ?? []).map((b) => ({ bucket: b })), columns: ['bucket'] });
|
|
47
|
+
if (!json && r.alcance === null)
|
|
48
|
+
console.log('⚠️ no se pudo leer el alcance en el almacén — eso NO significa que no alcance nada');
|
|
34
49
|
return;
|
|
35
50
|
}
|
|
36
51
|
if (sub === 'key') {
|
|
@@ -64,6 +79,19 @@ export async function storage(a) {
|
|
|
64
79
|
console.log(json ? JSON.stringify(r, null, 2) : (r.restored ? green(`✓ Restored ${key}`) : `— ${key} no estaba borrado (nada que restaurar)`));
|
|
65
80
|
return;
|
|
66
81
|
}
|
|
82
|
+
// ⭐ Política de RÉPLICA EXTERNA. Existe por el pilar AI-first (lo que decide un humano lo decide un agente) y
|
|
83
|
+
// porque la decisión debe ser DECLARABLE: antes se replicaba todo porque nadie había decidido lo contrario.
|
|
84
|
+
if (sub === 'replication') {
|
|
85
|
+
const id = a.positionals[0], valor = a.positionals[1];
|
|
86
|
+
if (!id || !['on', 'off'].includes(String(valor)))
|
|
87
|
+
throw new Error('usage: koigrid storage replication <bucketId> on|off');
|
|
88
|
+
const r = await api(`/buckets/${encodeURIComponent(id)}`, { method: 'PUT', body: { mirrorOffsite: valor === 'on' } });
|
|
89
|
+
if (json)
|
|
90
|
+
return console.log(JSON.stringify(r, null, 2));
|
|
91
|
+
// Se enseña la CONSECUENCIA, no un «ok»: apagar la copia externa de un bucket merece leerse antes de seguir.
|
|
92
|
+
console.log(valor === 'on' ? green('✓ réplica externa ACTIVADA') : '⚠️ réplica externa DESACTIVADA');
|
|
93
|
+
return console.log(` ${r.meaning}`);
|
|
94
|
+
}
|
|
67
95
|
// Explorador de objetos: ls por prefijo, url de subida/descarga, borrar
|
|
68
96
|
if (sub === 'objects' || sub === 'ls-objects') {
|
|
69
97
|
const id = a.positionals[0];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { api } from '../api.js';
|
|
2
|
+
import { output, green } from '../output.js';
|
|
3
|
+
// koigrid support — hablar con el equipo de koigrid y leer sus respuestas (lo mismo que /dashboard/support).
|
|
4
|
+
// koigrid support [ls] (● = el equipo respondió y no lo has leído)
|
|
5
|
+
// koigrid support open <support|feedback> "<mensaje>"
|
|
6
|
+
// koigrid support show <id> (enseña el hilo y lo marca como leído)
|
|
7
|
+
// koigrid support reply <id> "<mensaje>"
|
|
8
|
+
export async function support(a) {
|
|
9
|
+
const json = !!a.flags.json, sub = a.sub || 'ls';
|
|
10
|
+
if (sub === 'ls' || sub === 'list') {
|
|
11
|
+
const r = await api('/support');
|
|
12
|
+
const l = r.conversations || [];
|
|
13
|
+
if (!json)
|
|
14
|
+
console.log(green(`${r.unread} conversation(s) with an unread reply`));
|
|
15
|
+
return output(l, json, { rows: l.map((c) => ({ id: String(c.id).slice(0, 8), new: c.unread ? '●' : '', kind: c.kind, status: c.status, subject: c.subject })), columns: ['id', 'new', 'kind', 'status', 'subject'] });
|
|
16
|
+
}
|
|
17
|
+
if (sub === 'open' || sub === 'new') {
|
|
18
|
+
const [kind, ...resto] = a.positionals;
|
|
19
|
+
const message = resto.join(' ');
|
|
20
|
+
if ((kind !== 'support' && kind !== 'feedback') || !message)
|
|
21
|
+
throw new Error('usage: koigrid support open <support|feedback> "<message>"');
|
|
22
|
+
const r = await api('/support', { method: 'POST', body: { kind, message } });
|
|
23
|
+
return console.log(json ? JSON.stringify(r, null, 2) : green(`✓ conversation ${r.conversation?.id} opened`));
|
|
24
|
+
}
|
|
25
|
+
if (sub === 'show') {
|
|
26
|
+
const id = a.positionals[0];
|
|
27
|
+
if (!id)
|
|
28
|
+
throw new Error('usage: koigrid support show <id>');
|
|
29
|
+
const r = await api(`/support/${encodeURIComponent(id)}`);
|
|
30
|
+
await api(`/support/${encodeURIComponent(id)}/read`, { method: 'POST', body: {} });
|
|
31
|
+
if (json)
|
|
32
|
+
return console.log(JSON.stringify(r, null, 2));
|
|
33
|
+
console.log(green(`${r.conversation?.subject} · ${r.conversation?.status}`));
|
|
34
|
+
for (const m of r.messages || [])
|
|
35
|
+
console.log(`\n[${m.role === 'team' ? 'koigrid' : 'you'} · ${String(m.createdAt).slice(0, 16).replace('T', ' ')}]\n${m.body}`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (sub === 'reply') {
|
|
39
|
+
const [id, ...resto] = a.positionals;
|
|
40
|
+
const message = resto.join(' ');
|
|
41
|
+
if (!id || !message)
|
|
42
|
+
throw new Error('usage: koigrid support reply <id> "<message>"');
|
|
43
|
+
await api(`/support/${encodeURIComponent(id)}/messages`, { method: 'POST', body: { message } });
|
|
44
|
+
return console.log(json ? JSON.stringify({ ok: true }) : green('✓ reply sent'));
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`unknown: support ${sub}`);
|
|
47
|
+
}
|
package/dist/commands/tokens.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
+
import { proyectoDeFlags } from '../proyecto.js';
|
|
3
4
|
// koigrid tokens — API tokens por API (AI-first): mintear tokens con scopes acotados + expiración + tope de coste.
|
|
4
5
|
// Anti-escalada: no puedes crear uno con más scopes que el tuyo.
|
|
5
6
|
// koigrid tokens ls
|
|
@@ -23,8 +24,7 @@ export async function tokens(a) {
|
|
|
23
24
|
body.expiresInSeconds = Number(a.flags.expires);
|
|
24
25
|
if (a.flags['max-cost'] !== undefined)
|
|
25
26
|
body.maxCostCents = Number(a.flags['max-cost']);
|
|
26
|
-
|
|
27
|
-
body.projectId = String(a.flags.project);
|
|
27
|
+
Object.assign(body, proyectoDeFlags(a));
|
|
28
28
|
const r = await api('/tokens', { method: 'POST', body });
|
|
29
29
|
if (json)
|
|
30
30
|
return console.log(JSON.stringify(r, null, 2));
|
package/dist/commands/up.js
CHANGED
|
@@ -3,7 +3,7 @@ import { parse as parseYaml } from 'yaml';
|
|
|
3
3
|
import { api } from '../api.js';
|
|
4
4
|
import { output, green, dim } from '../output.js';
|
|
5
5
|
// koigrid up / koigrid plan — cutover multi-servicio. Lee un koigrid.yaml (o .json) que declara el STACK entero
|
|
6
|
-
// (project + databases + redis + apps cableados por ${{...}}) y lo levanta en un comando (idempotente). docs/CUTOVER.md
|
|
6
|
+
// (project + databases + redis + apps cableados por ${{...}}) y lo levanta en un comando (idempotente). docs/runbooks/CUTOVER.md
|
|
7
7
|
// koigrid up (aplica koigrid.yaml/koigrid.json del directorio actual)
|
|
8
8
|
// koigrid up -f stack.yaml
|
|
9
9
|
// koigrid plan (dry-run: qué crearía/actualizaría, sin tocar nada)
|
|
@@ -24,7 +24,11 @@ function loadManifest(a) {
|
|
|
24
24
|
function render(a, r, verb) {
|
|
25
25
|
if (a.flags.json)
|
|
26
26
|
return console.log(JSON.stringify(r, null, 2));
|
|
27
|
-
|
|
27
|
+
// Muestra SIEMPRE qué pasa con el proyecto (journey Vence BUG#1): reutiliza uno existente vs CREA uno nuevo. Un
|
|
28
|
+
// "CREARÁ (nuevo)" en un cutover que esperabas reutilizar = la señal de que algo no cuadra ANTES de aplicar.
|
|
29
|
+
const paLabel = { exists: 'reutiliza el existente', created: 'CREADO (nuevo)', 'plan-noop': 'reutiliza el existente', 'plan-create': 'CREARÁ uno NUEVO' };
|
|
30
|
+
const pa = paLabel[String(r.projectAction)] ?? String(r.projectAction ?? '');
|
|
31
|
+
console.log(green(`${verb}: proyecto '${r.project}' (${String(r.projectId || '—').slice(0, 8)}) — ${pa}`));
|
|
28
32
|
output(r.resources || [], false, {
|
|
29
33
|
rows: (r.resources || []).map((x) => ({
|
|
30
34
|
kind: x.kind, name: x.name, action: x.action, id: x.id ? String(x.id).slice(0, 8) : '—', deploy: x.deploymentId ? String(x.deploymentId).slice(0, 8) : '—',
|
package/dist/commands/waf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
-
// koigrid waf — Firewall/WAF (reglas allow/block + evaluate). Ver docs/FIREWALL.md.
|
|
3
|
+
// koigrid waf — Firewall/WAF (reglas allow/block + evaluate). Ver docs/products/FIREWALL.md.
|
|
4
4
|
export async function waf(a) {
|
|
5
5
|
const json = !!a.flags.json;
|
|
6
6
|
const sub = a.sub || 'rules';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green, bold } from '../output.js';
|
|
3
|
-
// koigrid webhooks — webhooks salientes (eventos → tu URL, firmados + reintentos). Ver docs/WEBHOOKS.md.
|
|
3
|
+
// koigrid webhooks — webhooks salientes (eventos → tu URL, firmados + reintentos). Ver docs/products/WEBHOOKS.md.
|
|
4
4
|
export async function webhooks(a) {
|
|
5
5
|
const json = !!a.flags.json;
|
|
6
6
|
const sub = a.sub || 'ls';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
+
import { proyectoDeFlags } from '../proyecto.js';
|
|
3
4
|
// koigrid wp — Managed WordPress: cuentas (contenedor OLS, WP ilimitados) + 1-click install + WP-CLI por API.
|
|
4
|
-
// Ver docs/WORDPRESS-HOSTING-PLAN.md.
|
|
5
|
+
// Ver docs/products/WORDPRESS-HOSTING-PLAN.md.
|
|
5
6
|
export async function wordpress(a) {
|
|
6
7
|
const json = !!a.flags.json;
|
|
7
8
|
const sub = a.sub || 'accounts';
|
|
@@ -14,8 +15,8 @@ export async function wordpress(a) {
|
|
|
14
15
|
if (sub === 'create') {
|
|
15
16
|
const slug = a.positionals[0];
|
|
16
17
|
if (!slug)
|
|
17
|
-
throw new Error('usage: koigrid wp create <slug> --name "My hosting" [--plan pro] [--php 8.2]');
|
|
18
|
-
const body = { slug, name: String(a.flags.name || slug) };
|
|
18
|
+
throw new Error('usage: koigrid wp create <slug> --name "My hosting" [--plan pro] [--php 8.2] [--project <id>]');
|
|
19
|
+
const body = { slug, name: String(a.flags.name || slug), ...proyectoDeFlags(a) };
|
|
19
20
|
if (a.flags.plan)
|
|
20
21
|
body.planTier = String(a.flags.plan);
|
|
21
22
|
if (a.flags.php)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { api } from '../api.js';
|
|
2
2
|
import { output, green } from '../output.js';
|
|
3
|
-
|
|
3
|
+
import { proyectoDeFlags } from '../proyecto.js';
|
|
4
|
+
// koigrid workflows — durable execution (vs Step Functions/Temporal/Inngest): pasos + runs durables. docs/products/WORKFLOWS.md.
|
|
4
5
|
export async function workflows(a) {
|
|
5
6
|
const json = !!a.flags.json;
|
|
6
7
|
const sub = a.sub || 'ls';
|
|
@@ -14,8 +15,8 @@ export async function workflows(a) {
|
|
|
14
15
|
const name = a.positionals[0];
|
|
15
16
|
const steps = a.flags.steps ? String(a.flags.steps).split(',').map((s) => s.trim()).filter(Boolean) : [];
|
|
16
17
|
if (!name || !steps.length)
|
|
17
|
-
throw new Error('usage: koigrid workflows create <name> --steps step1,step2,step3');
|
|
18
|
-
const body = { name, steps };
|
|
18
|
+
throw new Error('usage: koigrid workflows create <name> --steps step1,step2,step3 [--project <id>]');
|
|
19
|
+
const body = { name, steps, ...proyectoDeFlags(a) };
|
|
19
20
|
if (a.flags['max-attempts'])
|
|
20
21
|
body.maxAttempts = Number(a.flags['max-attempts']);
|
|
21
22
|
if (a.flags['step-timeout'])
|