koigrid 0.10.0 → 0.11.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,14 @@ All notable changes to the koigrid CLI are documented here. Format: [Keep a Chan
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.11.0] — 2026-11-26
8
+
9
+ ### Added
10
+
11
+ - `koigrid apps github-repos`: the repositories your connected GitHub App installations can deploy, latest push first (or the link to connect GitHub).
12
+ - `koigrid apps deploy --repo <github-url> --github-installation <id>`: links the app to the GitHub App before the first deploy, so a private repo clones without a token and every push redeploys.
13
+ - `koigrid dns list`, `koigrid logs list` and `koigrid wordpress list`: `list` now works as an alias of `ls` in every command that lists, as it already did in the rest.
14
+
7
15
  ## [0.10.0] — 2026-11-26
8
16
 
9
17
  ### Added
@@ -53,6 +53,19 @@ export async function apps(a) {
53
53
  const l = r.apps || r || [];
54
54
  return output(l, json, { rows: l.map((x) => ({ id: x.id.slice(0, 8), name: x.name, status: x.status, url: x.url || '—' })), columns: ['id', 'name', 'status', 'url'] });
55
55
  }
56
+ case 'github-repos': {
57
+ // «Importar desde GitHub» (ficha efdfb0ad): los repos que la GitHub App conectada deja desplegar, el último push primero
58
+ const r = await api('/github/repos');
59
+ if (json)
60
+ return console.log(JSON.stringify(r, null, 2));
61
+ if (!r.appConfigured)
62
+ return console.log('The koigrid GitHub App is not configured on this koigrid instance.');
63
+ if (!(r.installations || []).length)
64
+ return console.log(`GitHub is not connected. Open this link signed in to koigrid:\n ${r.connectUrl || '(ask an owner or admin of the organization)'}`);
65
+ const rows = (r.installations || []).flatMap((i) => (i.repos || []).map((x) => ({ repo: x.fullName, branch: x.defaultBranch, private: x.private ? 'yes' : 'no', installation: i.installationId })));
66
+ output(rows, false, { rows, columns: ['repo', 'branch', 'private', 'installation'] });
67
+ return console.log('\nDeploy one (private too, redeploys on every push): koigrid apps deploy <name> --repo https://github.com/<repo> --branch <branch> --github-installation <installation>');
68
+ }
56
69
  case 'deploy': {
57
70
  const name = a.positionals[0], image = a.flags.image, repo = a.flags.repo;
58
71
  const dir = a.flags.dir; // deploy desde un directorio LOCAL (código privado, sin git/Docker)
@@ -98,7 +111,7 @@ export async function apps(a) {
98
111
  if (a.flags.worker)
99
112
  ing.kind = 'worker';
100
113
  if (!name || (!image && !repo && !dir))
101
- throw new Error('usage: koigrid apps deploy <name> --dir <path>|--image <img>|--repo <git-url> [--branch B] [--repo-token <t>] [--port N | --worker] [--ingress edge|runner] [--build-cmd C] [--install-cmd C] [--start-cmd C] [--root-dir D] [--node-version V] [--dockerfile PATH] [--release-cmd C] [--memory <mb>] [--cpus <n>] [--project <id>] [--env KEY=VALUE ...] [--env-target all|production|preview]');
114
+ throw new Error('usage: koigrid apps deploy <name> --dir <path>|--image <img>|--repo <git-url> [--branch B] [--repo-token <t> | --github-installation <id>] [--port N | --worker] [--ingress edge|runner] [--build-cmd C] [--install-cmd C] [--start-cmd C] [--root-dir D] [--node-version V] [--dockerfile PATH] [--release-cmd C] [--memory <mb>] [--cpus <n>] [--project <id>] [--env KEY=VALUE ...] [--env-target all|production|preview]');
102
115
  const port = a.flags.port ? Number(a.flags.port) : 3000;
103
116
  // Esperar al desenlace (ficha f76082de): por defecto sí (personas y agentes), --json sólo con --wait, --no-wait nunca.
104
117
  const esperar = debeEsperar(a.flags, json);
@@ -154,6 +167,15 @@ export async function apps(a) {
154
167
  return esperarYContar(aid, auto?.id, plazoMin, json);
155
168
  return json ? console.log(JSON.stringify({ deploymentId: auto?.id ?? null, appId: aid, status: auto?.status || 'queued', automatic: true }, null, 2)) : undefined;
156
169
  }
170
+ // --github-installation <id> (ficha efdfb0ad, la lista sale de `koigrid apps github-repos`): se liga a la GitHub App
171
+ // ANTES del primer despliegue, así un repo PRIVADO se clona con el token de la instalación y cada push redespliega.
172
+ const inst = a.flags['github-installation'];
173
+ if (inst) {
174
+ const m = String(repo).match(/github\.com[/:]([^/]+\/[^/]+?)(?:\.git)?\/?$/);
175
+ if (!m)
176
+ throw new Error('--github-installation needs a github.com --repo (https://github.com/owner/repo)');
177
+ await api(`/apps/${encodeURIComponent(aid)}/github`, { method: 'PUT', body: { githubRepo: m[1], installationId: String(inst), autoDeploy: true, ...(bs.branch ? { branch: bs.branch } : {}) } });
178
+ }
157
179
  const d = await api(`/apps/${encodeURIComponent(aid)}/deployments`, { method: 'POST', body: {} });
158
180
  if (!json)
159
181
  console.log(green(`✓ Deploying "${name}"… (deployment ${String(d.deployment?.id || '').slice(0, 8)})`));
@@ -4,7 +4,7 @@ import { output, green } from '../output.js';
4
4
  export async function dns(a) {
5
5
  const json = !!a.flags.json;
6
6
  const sub = a.sub || 'zones';
7
- if (sub === 'zones' || sub === 'ls') {
7
+ if (sub === 'zones' || sub === 'ls' || sub === 'list') {
8
8
  const r = await api('/dns/zones');
9
9
  const l = r.zones || [];
10
10
  return output(l, json, { rows: l.map((z) => ({ id: String(z.id).slice(0, 8), domain: z.domain, provider: z.provider })), columns: ['id', 'domain', 'provider'] });
@@ -53,7 +53,7 @@ export async function logs(a) {
53
53
  const r = await api('/logs', { method: 'POST', body: { records: [rec] } });
54
54
  return console.log(json ? JSON.stringify(r, null, 2) : green(`✓ Ingested ${r.ingested} record(s)`));
55
55
  }
56
- if (sub === 'tail' || sub === 'ls') {
56
+ if (sub === 'tail' || sub === 'ls' || sub === 'list') {
57
57
  const qs = new URLSearchParams();
58
58
  if (a.flags.app)
59
59
  qs.set('appId', String(a.flags.app));
@@ -7,7 +7,7 @@ export async function wordpress(a) {
7
7
  const json = !!a.flags.json;
8
8
  const sub = a.sub || 'accounts';
9
9
  // ---- cuentas ----
10
- if (sub === 'accounts' || sub === 'ls') {
10
+ if (sub === 'accounts' || sub === 'ls' || sub === 'list') {
11
11
  const r = await api('/wordpress/accounts');
12
12
  const l = r.accounts || [];
13
13
  return output(l, json, { rows: l.map((x) => ({ id: String(x.id).slice(0, 8), name: x.name, slug: x.slug, plan: x.planTier, status: x.status })), columns: ['id', 'name', 'slug', 'plan', 'status'] });
package/dist/manifest.js CHANGED
@@ -10,7 +10,7 @@ export const CLI_COMMANDS = [
10
10
  name: 'apps', aliases: ['app'], product: 'apps', summary: 'Deploy and manage apps (git repo, container image, or local --dir)',
11
11
  usage: {
12
12
  deploy: `koigrid apps deploy <name> --dir <path> | --image <img> | --repo <git-url>
13
- Source --dir <path> (your folder, no git/Docker needed) · --image <img> · --repo <git-url> [--branch B] [--repo-token T]
13
+ Source --dir <path> (your folder, no git/Docker needed) · --image <img> · --repo <git-url> [--branch B] [--repo-token T | --github-installation ID (private GitHub repo, redeploys on every push; IDs: koigrid apps github-repos)]
14
14
  Runtime --port N (default: the image's single EXPOSE port, else 3000; PORT is injected; change later: apps port <id> <n>) · --health-path /health · --memory <MB> · --cpus <n> · --ingress edge|runner
15
15
  Worker --worker: a background process with NO port (queue consumer, bot), like a Heroku worker or a Render
16
16
  background worker. No URL or domain; alive = the process keeps running. Do not pass --port.
@@ -20,8 +20,8 @@ export const CLI_COMMANDS = [
20
20
  --no-wait (or --detach) returns at once · --timeout <min> (default 20) · with --json it returns at once unless --wait
21
21
  Other --project <id> · --json`,
22
22
  },
23
- subs: ['ls', 'deploy', 'logs', 'http', 'rm', 'rename', 'health-path', 'port', 'release', 'build-settings', 'traffic-ramp', 'max-surge', 'deploy-analysis', 'scale', 'resize', 'autoscale', 'scale-out', 'env', 'domains', 'volumes', 'cdn', 'cache', 'protection', 'retention', 'github', 'hooks', 'rollback', 'pause', 'resume', 'restore', 'migrate', 'deployments', 'previews', 'preview', 'rules', 'rule', 'rule-rm', 'rule-toggle', 'registry', 'loadtest'],
24
- endpoints: ['apps', 'apps/[id]', 'apps/[id]/deployments', 'apps/[id]/source-upload', 'apps/[id]/logs', 'apps/[id]/http', 'apps/[id]/scale', 'apps/[id]/resources', 'apps/[id]/autoscale', 'apps/[id]/scale-out', 'apps/[id]/env', 'apps/[id]/env/verify', 'apps/[id]/domains', 'apps/[id]/domains/verify', 'apps/[id]/volumes', 'apps/[id]/volumes/[volId]', 'apps/[id]/volumes/[volId]/backups', 'apps/[id]/volumes/[volId]/backups/[backupId]/restore', 'apps/[id]/cdn', 'apps/[id]/cache', 'apps/[id]/cache/purge', 'apps/[id]/protection', 'apps/[id]/protection/evaluate', 'apps/[id]/retention', 'apps/[id]/github', 'apps/[id]/deploy-hooks', 'apps/[id]/deploy-hooks/[hookId]', 'apps/[id]/rollback', 'apps/[id]/pause', 'apps/[id]/resume', 'apps/[id]/restore', 'apps/[id]/migrate', 'apps/[id]/previews', 'apps/[id]/rules', 'apps/[id]/rules/[ruleId]', 'apps/[id]/registry', 'apps/[id]/loadtest'],
23
+ subs: ['ls', 'deploy', 'logs', 'http', 'rm', 'rename', 'health-path', 'port', 'release', 'build-settings', 'traffic-ramp', 'max-surge', 'deploy-analysis', 'scale', 'resize', 'autoscale', 'scale-out', 'env', 'domains', 'volumes', 'cdn', 'cache', 'protection', 'retention', 'github', 'github-repos', 'hooks', 'rollback', 'pause', 'resume', 'restore', 'migrate', 'deployments', 'previews', 'preview', 'rules', 'rule', 'rule-rm', 'rule-toggle', 'registry', 'loadtest'],
24
+ endpoints: ['apps', 'apps/[id]', 'apps/[id]/deployments', 'apps/[id]/source-upload', 'apps/[id]/logs', 'apps/[id]/http', 'apps/[id]/scale', 'apps/[id]/resources', 'apps/[id]/autoscale', 'apps/[id]/scale-out', 'apps/[id]/env', 'apps/[id]/env/verify', 'apps/[id]/domains', 'apps/[id]/domains/verify', 'apps/[id]/volumes', 'apps/[id]/volumes/[volId]', 'apps/[id]/volumes/[volId]/backups', 'apps/[id]/volumes/[volId]/backups/[backupId]/restore', 'apps/[id]/cdn', 'apps/[id]/cache', 'apps/[id]/cache/purge', 'apps/[id]/protection', 'apps/[id]/protection/evaluate', 'apps/[id]/retention', 'apps/[id]/github', 'github/repos', 'apps/[id]/deploy-hooks', 'apps/[id]/deploy-hooks/[hookId]', 'apps/[id]/rollback', 'apps/[id]/pause', 'apps/[id]/resume', 'apps/[id]/restore', 'apps/[id]/migrate', 'apps/[id]/previews', 'apps/[id]/rules', 'apps/[id]/rules/[ruleId]', 'apps/[id]/registry', 'apps/[id]/loadtest'],
25
25
  },
26
26
  { name: 'db', aliases: ['databases', 'database'], product: 'databases', summary: 'Managed Postgres (HA) — incl. SQL console (db query/tables) + branching (db branch) + managed restore (db restore-dump)', subs: ['ls', 'info', 'create', 'rm', 'rename', 'pause', 'resume', 'retention', 'weekly', 'monthly', 'url', 'connect', 'metrics', 'top-queries', 'slots', 'logs', 'backups', 'restore', 'restore-dump', 'fix-ownership', 'analyze', 'import', 'restore-status', 'ext', 'replicas', 'dr-copy', 'network', 'pub', 'query', 'tables', 'branch', 'roles', 'params', 'pooler', 'rotation', 'patching', 'sync', 'slot-cap', 'resize', 'apply-config', 'maintenance', 'subs', 'data', 'rpc'], endpoints: ['databases', 'databases/[id]', 'databases/[id]/pause', 'databases/[id]/resume', 'databases/[id]/connection', 'databases/[id]/backups', 'databases/[id]/restore', 'databases/[id]/restore-dump', 'databases/[id]/restore-dump/upload-url', 'databases/[id]/restore-dump/[jobId]', 'databases/[id]/fix-ownership', 'databases/[id]/analyze', 'databases/[id]/metrics', 'databases/[id]/queries', 'databases/[id]/replication-slots', 'databases/[id]/logs', 'databases/[id]/extensions', 'databases/[id]/replicas', 'databases/[id]/dr-copy', 'databases/[id]/network', 'databases/[id]/publications', 'databases/[id]/subscriptions', 'databases/[id]/subscriptions/preflight', 'databases/[id]/subscriptions/verify', 'databases/[id]/subscriptions/verify/[verificationId]', 'databases/[id]/subscriptions/sync-sequences', 'databases/[id]/apply-config', 'databases/[id]/maintenance/apply', 'databases/[id]/maintenance/defer', 'databases/[id]/query', 'databases/[id]/branches', 'databases/[id]/branches/[branchId]', 'databases/[id]/branches/[branchId]/reset', 'databases/[id]/roles', 'databases/[id]/roles/[roleName]', 'databases/[id]/parameters', 'databases/[id]/pooler', 'databases/[id]/rotation', 'databases/[id]/rotation/rotate', 'databases/[id]/rotation/migrate', 'databases/[id]/data/[table]', 'databases/[id]/rpc/[fn]'] },
27
27
  { name: 'redis', aliases: ['cache'], product: 'cache', summary: 'Managed Redis (HA)', subs: ['apply-config', 'ls', 'create', 'rm', 'rename', 'resize', 'url', 'connect', 'metrics', 'backups', 'restore', 'dr-copy', 'network', 'password'], endpoints: ['redis/[id]/apply-config', 'redis/[id]/password', 'redis', 'redis/[id]', 'redis/[id]/connection', 'redis/[id]/backups', 'redis/[id]/restore', 'redis/[id]/metrics', 'redis/[id]/dr-copy', 'redis/[id]/network'] },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koigrid",
3
- "version": "0.10.0",
3
+ "version": "0.11.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"