koigrid 0.5.0 → 0.6.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
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to the koigrid CLI are documented here. Format: [Keep a Changelog](https://keepachangelog.com). Versions follow [SemVer](https://semver.org).
4
4
 
5
+ ## [0.6.0] — 2026-07-24
6
+
7
+ ### Added
8
+ - **`koigrid up` / `koigrid plan`** — cutover multi-servicio: lee un `koigrid.yaml` (o `.json`) que declara el
9
+ STACK entero (project + databases + redis + apps cableados por `${{...}}`) y lo levanta en un comando,
10
+ idempotente (como `docker-compose up` / `terraform apply`). `plan` = dry-run. `up -f <fichero>` para otro
11
+ manifiesto. Ver docs/CUTOVER.md. (dep nueva: `yaml` para parsear el manifiesto).
12
+
5
13
  ## [0.5.0] — 2026-07-24
6
14
 
7
15
  Pone el CLI al día con la API (el publicado 0.4.0 era del 2026-07-05 → faltaban ~3 semanas de productos).
@@ -0,0 +1,44 @@
1
+ import { readFileSync, existsSync } from 'node:fs';
2
+ import { parse as parseYaml } from 'yaml';
3
+ import { api } from '../api.js';
4
+ import { output, green, dim } from '../output.js';
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
7
+ // koigrid up (aplica koigrid.yaml/koigrid.json del directorio actual)
8
+ // koigrid up -f stack.yaml
9
+ // koigrid plan (dry-run: qué crearía/actualizaría, sin tocar nada)
10
+ function loadManifest(a) {
11
+ const file = (a.flags.file || a.flags.f);
12
+ const candidates = file ? [file] : ['koigrid.yaml', 'koigrid.yml', 'koigrid.json'];
13
+ const path = candidates.find((p) => existsSync(p));
14
+ if (!path)
15
+ throw new Error('no encontré un manifiesto (koigrid.yaml / koigrid.json) en este directorio. Usa -f <fichero>.');
16
+ const raw = readFileSync(path, 'utf8');
17
+ try {
18
+ return (path.endsWith('.json') ? JSON.parse(raw) : parseYaml(raw));
19
+ }
20
+ catch (e) {
21
+ throw new Error(`no pude parsear ${path}: ${e.message}`);
22
+ }
23
+ }
24
+ function render(a, r, verb) {
25
+ if (a.flags.json)
26
+ return console.log(JSON.stringify(r, null, 2));
27
+ console.log(green(`${verb}: proyecto '${r.project}' (${String(r.projectId).slice(0, 8)})`));
28
+ output(r.resources || [], false, {
29
+ rows: (r.resources || []).map((x) => ({
30
+ 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) : '—',
31
+ })),
32
+ columns: ['kind', 'name', 'action', 'id', 'deploy'],
33
+ });
34
+ for (const w of r.warnings || [])
35
+ console.log(dim(`⚠ ${w}`));
36
+ }
37
+ export async function up(a) {
38
+ const r = await api('/manifest', { method: 'POST', body: loadManifest(a) });
39
+ render(a, r, 'Aplicado');
40
+ }
41
+ export async function plan(a) {
42
+ const r = await api('/manifest/plan', { method: 'POST', body: loadManifest(a) });
43
+ render(a, r, 'Plan (dry-run)');
44
+ }
package/dist/manifest.js CHANGED
@@ -45,6 +45,8 @@ export const CLI_COMMANDS = [
45
45
  { 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'] },
46
46
  { name: 'registry', aliases: ['ecr', 'cr'], product: 'container-registry', summary: 'Container Registry (OCI, ECR-like) — docker push/pull; list repos + tags (digest/size/pushed)', subs: ['repos', 'tags', 'login'], endpoints: ['registry/repositories', 'registry/repositories/[name]/tags'] },
47
47
  { 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'] },
48
+ { 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'] },
49
+ { name: 'plan', summary: 'Dry-run a cutover manifest (koigrid.yaml): what would be created/updated, without mutating', subs: [], endpoints: ['manifest/plan'] },
48
50
  ];
49
51
  export function resolveCommand(input) {
50
52
  for (const c of CLI_COMMANDS)
package/dist/registry.js CHANGED
@@ -38,9 +38,10 @@ import { tokens } from './commands/tokens.js';
38
38
  import { notifications } from './commands/notifications.js';
39
39
  import { connect } from './commands/connect.js';
40
40
  import { rewards } from './commands/rewards.js';
41
+ import { up, plan } from './commands/up.js';
41
42
  export const HANDLERS = {
42
43
  login: (a) => auth.login(a.flags),
43
44
  logout: () => auth.logout(),
44
45
  whoami: (a) => auth.whoami(!!a.flags.json),
45
- usage, projects, apps, db, redis, storage, jobs, events, alarms, email, checks, members, flags, status, heartbeats, config, analytics, errors, speed, sandboxes, ai, images, waf, webhooks, logs, spend, bots, otel, dns, queues, workflows, registry, audit, anomalies, tokens, notifications, connect, rewards, wp: wordpress,
46
+ usage, projects, apps, db, redis, storage, jobs, events, alarms, email, checks, members, flags, status, heartbeats, config, analytics, errors, speed, sandboxes, ai, images, waf, webhooks, logs, spend, bots, otel, dns, queues, workflows, registry, audit, anomalies, tokens, notifications, connect, rewards, up, plan, wp: wordpress,
46
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koigrid",
3
- "version": "0.5.0",
3
+ "version": "0.6.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"
@@ -33,5 +33,8 @@
33
33
  },
34
34
  "homepage": "https://koigrid.com",
35
35
  "bugs": "https://koigrid.com",
36
- "author": "koigrid"
36
+ "author": "koigrid",
37
+ "dependencies": {
38
+ "yaml": "^2.9.0"
39
+ }
37
40
  }