koigrid 0.7.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/dist/api.js +21 -3
  3. package/dist/args.js +19 -0
  4. package/dist/commands/analytics.js +1 -1
  5. package/dist/commands/apps.js +181 -21
  6. package/dist/commands/audit.js +1 -1
  7. package/dist/commands/billing.js +31 -0
  8. package/dist/commands/bots.js +1 -1
  9. package/dist/commands/changelog.js +19 -0
  10. package/dist/commands/checks.js +4 -3
  11. package/dist/commands/config.js +9 -6
  12. package/dist/commands/connect.js +2 -2
  13. package/dist/commands/db.js +384 -16
  14. package/dist/commands/dns.js +1 -1
  15. package/dist/commands/errors.js +1 -1
  16. package/dist/commands/flags.js +1 -1
  17. package/dist/commands/heartbeats.js +3 -3
  18. package/dist/commands/images.js +1 -1
  19. package/dist/commands/jobs.js +39 -4
  20. package/dist/commands/links.js +59 -0
  21. package/dist/commands/logs.js +1 -1
  22. package/dist/commands/members.js +26 -1
  23. package/dist/commands/notices.js +24 -0
  24. package/dist/commands/notifications.js +2 -2
  25. package/dist/commands/otel.js +1 -1
  26. package/dist/commands/projects.js +1 -1
  27. package/dist/commands/queues.js +4 -3
  28. package/dist/commands/redis.js +18 -2
  29. package/dist/commands/registry.js +43 -3
  30. package/dist/commands/rewards.js +63 -0
  31. package/dist/commands/sandboxes.js +1 -1
  32. package/dist/commands/speed.js +1 -1
  33. package/dist/commands/spend.js +1 -1
  34. package/dist/commands/status.js +1 -1
  35. package/dist/commands/storage.js +31 -3
  36. package/dist/commands/support.js +47 -0
  37. package/dist/commands/tokens.js +2 -2
  38. package/dist/commands/up.js +6 -2
  39. package/dist/commands/waf.js +1 -1
  40. package/dist/commands/webhooks.js +1 -1
  41. package/dist/commands/wordpress.js +4 -3
  42. package/dist/commands/workflows.js +4 -3
  43. package/dist/index.js +13 -3
  44. package/dist/manifest.js +15 -10
  45. package/dist/output.js +1 -0
  46. package/dist/proyecto.js +6 -0
  47. package/dist/registry-flags.js +17 -0
  48. package/dist/registry.js +6 -2
  49. package/package.json +1 -1
  50. package/dist/commands/ai.js +0 -56
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  // Entry del CLI. Dispatch data-driven desde el manifest (resolveCommand) + registro de handlers.
3
3
  // Añadir un comando = fichero en commands/ + entrada en registry.ts + manifest.ts (los guards lo obligan).
4
- import { parseArgs } from './args.js';
4
+ import { parseArgs, vigilarFlags } from './args.js';
5
5
  import { buildHelp } from './help.js';
6
6
  import { ApiError } from './api.js';
7
7
  import { resolveCommand, CLI_COMMANDS } from './manifest.js';
8
8
  import { HANDLERS } from './registry.js';
9
- import { red } from './output.js';
9
+ import { red, yellow } from './output.js';
10
10
  import { createRequire } from 'node:module';
11
11
  const version = (() => { try {
12
12
  return createRequire(import.meta.url)('../package.json').version;
@@ -16,6 +16,8 @@ catch {
16
16
  } })();
17
17
  async function main() {
18
18
  const a = parseArgs(process.argv.slice(2));
19
+ const vigia = vigilarFlags(a.flags);
20
+ a.flags = vigia.flags;
19
21
  if (a.flags.version || a.flags.v) {
20
22
  console.log(version);
21
23
  return;
@@ -34,7 +36,15 @@ async function main() {
34
36
  console.error(red(`Unknown command: ${a.cmd}`) + `\nRun \`koigrid --help\`.`);
35
37
  process.exit(1);
36
38
  }
37
- await HANDLERS[name](a);
39
+ try {
40
+ await HANDLERS[name](a);
41
+ }
42
+ finally {
43
+ // Pase lo que pase, se dice qué flags no usó este comando (por stderr: no ensucia una salida --json).
44
+ const ignorados = vigia.sinLeer();
45
+ if (ignorados.length)
46
+ console.error(yellow(`⚠ ignored (this command doesn't use them): ${ignorados.map((f) => (f.length === 1 ? `-${f}` : `--${f}`)).join(' ')}`));
47
+ }
38
48
  }
39
49
  main().catch((e) => {
40
50
  if (e instanceof ApiError) {
package/dist/manifest.js CHANGED
@@ -3,27 +3,32 @@ export const CLI_COMMANDS = [
3
3
  { name: 'logout', summary: 'Remove the stored credentials', subs: [], endpoints: [] },
4
4
  { name: 'whoami', summary: 'Show the authenticated account', subs: [], endpoints: ['me'] },
5
5
  { name: 'usage', summary: 'Show usage & cost', subs: [], endpoints: ['usage'] },
6
+ { name: 'changelog', aliases: ['changes'], summary: "What changed recently — so you don't have to re-run every test to find out if your issue is fixed", subs: [], endpoints: ['changelog'] },
6
7
  { name: 'projects', aliases: ['project'], summary: 'Projects (group resources within the org)', subs: ['ls', 'create', 'rm'], endpoints: ['projects', 'projects/[id]'] },
7
8
  {
8
9
  name: 'apps', aliases: ['app'], product: 'apps', summary: 'Deploy and manage apps (git repo, container image, or local --dir)',
9
- subs: ['ls', 'deploy', 'logs', 'rm', 'rename', 'scale', 'resize', 'autoscale', 'env', 'domains', 'volumes', 'cdn', 'protection', 'retention', 'github', 'hooks', 'rollback', 'restore', 'migrate', 'deployments', 'previews', 'preview', 'rules', 'rule', 'rule-rm', 'rule-toggle', 'registry', 'loadtest'],
10
- endpoints: ['apps', 'apps/[id]', 'apps/[id]/deployments', 'apps/[id]/source-upload', 'apps/[id]/logs', 'apps/[id]/scale', 'apps/[id]/resources', 'apps/[id]/autoscale', 'apps/[id]/env', '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]/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]/restore', 'apps/[id]/migrate', 'apps/[id]/previews', 'apps/[id]/rules', 'apps/[id]/rules/[ruleId]', 'apps/[id]/registry', 'apps/[id]/loadtest'],
10
+ subs: ['ls', 'deploy', 'logs', 'rm', 'rename', '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'],
11
+ endpoints: ['apps', 'apps/[id]', 'apps/[id]/deployments', 'apps/[id]/source-upload', 'apps/[id]/logs', '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'],
11
12
  },
12
- { name: 'db', aliases: ['databases', 'database'], product: 'databases', summary: 'Managed Postgres (HA) — incl. SQL console (db query/tables) + branching (db branch)', subs: ['ls', 'create', 'rm', 'rename', 'url', 'connect', 'metrics', 'logs', 'backups', 'restore', 'ext', 'replicas', 'pub', 'query', 'tables', 'branch', 'roles', 'rotation', 'data', 'rpc'], endpoints: ['databases', 'databases/[id]', 'databases/[id]/connection', 'databases/[id]/backups', 'databases/[id]/restore', 'databases/[id]/metrics', 'databases/[id]/logs', 'databases/[id]/extensions', 'databases/[id]/replicas', 'databases/[id]/publications', 'databases/[id]/query', 'databases/[id]/branches', 'databases/[id]/branches/[branchId]', 'databases/[id]/branches/[branchId]/reset', 'databases/[id]/roles', 'databases/[id]/roles/[roleName]', 'databases/[id]/rotation', 'databases/[id]/rotation/rotate', 'databases/[id]/rotation/migrate', 'databases/[id]/data/[table]', 'databases/[id]/rpc/[fn]'] },
13
- { name: 'redis', aliases: ['cache'], product: 'cache', summary: 'Managed Redis (HA)', subs: ['ls', 'create', 'rm', 'rename', 'url', 'connect', 'metrics', 'backups', 'restore'], endpoints: ['redis', 'redis/[id]', 'redis/[id]/connection', 'redis/[id]/backups', 'redis/[id]/restore', 'redis/[id]/metrics'] },
14
- { name: 'storage', aliases: ['buckets'], product: 'storage', summary: 'Object storage (S3): buckets, object browser (list/upload/download/delete), versioning + restore', subs: ['ls', 'create', 'rm', 'keys', 'key', 'versions', 'restore', 'objects', 'upload-url', 'download-url', 'object-rm'], endpoints: ['buckets', 'buckets/[id]', 'buckets/[id]/versions', 'buckets/[id]/objects', 'buckets/[id]/objects/upload-url', 'buckets/[id]/objects/download-url', 'storage/keys', 'storage/keys/[id]'] },
13
+ { 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', 'create', 'rm', 'rename', 'pause', 'resume', 'retention', 'url', 'connect', 'metrics', 'logs', 'backups', 'restore', 'restore-dump', 'fix-ownership', 'import', 'restore-status', 'ext', 'replicas', 'pub', 'query', 'tables', 'branch', 'roles', 'rotation', 'patching', 'resize', 'apply-config', '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]/metrics', 'databases/[id]/logs', 'databases/[id]/extensions', 'databases/[id]/replicas', '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]/query', 'databases/[id]/branches', 'databases/[id]/branches/[branchId]', 'databases/[id]/branches/[branchId]/reset', 'databases/[id]/roles', 'databases/[id]/roles/[roleName]', 'databases/[id]/rotation', 'databases/[id]/rotation/rotate', 'databases/[id]/rotation/migrate', 'databases/[id]/data/[table]', 'databases/[id]/rpc/[fn]'] },
14
+ { name: 'redis', aliases: ['cache'], product: 'cache', summary: 'Managed Redis (HA)', subs: ['apply-config', 'ls', 'create', 'rm', 'rename', 'url', 'connect', 'metrics', 'backups', 'restore'], endpoints: ['redis/[id]/apply-config', 'redis', 'redis/[id]', 'redis/[id]/connection', 'redis/[id]/backups', 'redis/[id]/restore', 'redis/[id]/metrics'] },
15
+ { name: 'storage', aliases: ['buckets'], product: 'storage', summary: 'Object storage (S3): buckets, object browser (list/upload/download/delete), versioning + restore', subs: ['ls', 'create', 'rm', 'keys', 'key', 'key-scope', 'versions', 'restore', 'objects', 'upload-url', 'download-url', 'object-rm', 'replication'], endpoints: ['buckets', 'buckets/[id]', 'buckets/[id]/versions', 'buckets/[id]/objects', 'buckets/[id]/objects/upload-url', 'buckets/[id]/objects/download-url', 'storage/keys', 'storage/keys/[id]', 'storage/keys/[id]/scope'] },
15
16
  { name: 'jobs', aliases: ['cron'], product: 'jobs', summary: 'Cron / scheduled jobs', subs: ['ls', 'create', 'update', 'rm', 'trigger', 'runs'], endpoints: ['jobs', 'jobs/[id]', 'jobs/[id]/runs', 'jobs/[id]/trigger'] },
16
17
  { name: 'events', aliases: ['activity'], product: 'observability', summary: 'Events and metrics', subs: ['ls', 'metrics'], endpoints: ['events', 'metrics'] },
18
+ { name: 'links', aliases: ['link'], product: 'links', summary: 'Short links + QR (create, retarget, retire)', subs: ['ls', 'create', 'update', 'rm'], endpoints: ['links', 'links/[id]'] },
19
+ { name: 'share', aliases: ['files'], product: 'share', summary: 'Share files behind an expiring link', subs: ['ls', 'upload', 'rm'], endpoints: ['share', 'share/[id]'] },
17
20
  { name: 'alarms', product: 'observability', summary: 'Metric alarms', subs: ['ls', 'create', 'rm'], endpoints: ['alarms', 'alarms/[id]'] },
18
21
  { name: 'anomalies', aliases: ['anomaly'], product: 'observability', summary: 'Anomaly detection (statistical >Nσ spike alerts on cost/usage — no fixed threshold)', subs: ['ls', 'create', 'rm'], endpoints: ['anomalies', 'anomalies/[id]'] },
19
22
  { name: 'tokens', aliases: ['token', 'keys'], summary: 'API tokens (mint scoped/expiring tokens by API — AI-native; no scope escalation)', subs: ['ls', 'create', 'rm'], endpoints: ['tokens', 'tokens/[id]'] },
20
- { name: 'notifications', aliases: ['notify'], summary: 'Notification preferences (which alert categories you get by email: alarms/anomalies/spend)', subs: ['ls', 'set'], endpoints: ['notifications/preferences'] },
23
+ { name: 'notifications', aliases: ['notify'], summary: 'Notification preferences (which alert categories you get by email: alarms/anomalies/spend/jobs/heartbeats/checks)', subs: ['ls', 'set'], endpoints: ['notifications/preferences'] },
24
+ { name: 'notices', summary: 'In-app notices (the dashboard bell) and how many support conversations have an unread reply', subs: ['ls', 'read'], endpoints: ['notices', 'notices/read'] },
25
+ { name: 'support', summary: 'Talk to the koigrid team and read their replies (support/feedback conversations)', subs: ['ls', 'open', 'show', 'reply'], endpoints: ['support', 'support/[id]', 'support/[id]/read', 'support/[id]/messages'] },
21
26
  { name: 'connect', summary: 'Connect: agent credential broker — a grant mints only ephemeral, scope-limited tokens (STS-style)', subs: ['ls', 'grants', 'create', 'update', 'rm', 'token'], endpoints: ['connect/grants', 'connect/grants/[id]', 'connect/token'] },
22
- { name: 'rewards', product: 'rewards', summary: 'Rewards: earn balance for using koigrid + feedback; redeem as infra credit or gift card', subs: ['ls', 'lines', 'referral', 'submit', 'redeem'], endpoints: ['rewards', 'rewards/lines', 'rewards/referral', 'rewards/redeem', 'rewards/submissions/[id]/review'] },
27
+ { name: 'rewards', product: 'rewards', summary: 'Rewards: earn balance for using koigrid + feedback; redeem as infra credit or gift card', subs: ['ls', 'lines', 'referral', 'submit', 'redeem', 'beta'], endpoints: ['rewards', 'rewards/lines', 'rewards/referral', 'rewards/redeem', 'rewards/submissions/[id]/review', 'rewards/beta', 'rewards/beta/apply', 'rewards/beta/feedback', 'rewards/beta/agent-log', 'rewards/beta/wallet', 'rewards/beta/payout', 'rewards/beta/applications', 'rewards/beta/applications/[id]/review', 'rewards/crypto-payouts/[id]/sent'] },
23
28
  { name: 'wp', aliases: ['wordpress'], product: 'wordpress', summary: 'Managed WordPress: hosting accounts (OLS container, unlimited sites) + 1-click install + WP-CLI by API', subs: ['accounts', 'create', 'account', 'rm', 'sites', 'install', 'site', 'uninstall', 'cli', 'backups', 'backup', 'domains', 'domain-add', 'domain-check', 'domain-activate', 'domain-rm'], endpoints: ['wordpress/accounts', 'wordpress/accounts/[id]', 'wordpress/accounts/[id]/sites', 'wordpress/sites/[id]', 'wordpress/sites/[id]/wp-cli', 'wordpress/sites/[id]/backups', 'wordpress/sites/[id]/domains', 'wordpress/domains/[id]'] },
24
29
  { name: 'email', product: 'email', summary: 'Transactional email', subs: ['send', 'messages', 'config'], endpoints: ['email/send', 'email/messages', 'email/config'] },
25
30
  { name: 'checks', aliases: ['check', 'monitoring'], product: 'checks', summary: 'Uptime & synthetic monitoring (URL/API checks + alerts)', subs: ['ls', 'create', 'update', 'rm', 'run', 'runs'], endpoints: ['checks', 'checks/[id]', 'checks/[id]/run', 'checks/[id]/runs'] },
26
- { name: 'members', aliases: ['team'], summary: 'Team members & invitations (invite, roles, remove)', subs: ['ls', 'invite', 'role', 'rm', 'revoke'], endpoints: ['members', 'members/[userId]', 'members/invitations/[id]'] },
31
+ { name: 'members', aliases: ['team'], summary: 'Team members & invitations (invite, roles, remove)', subs: ['2fa', 'ls', 'invite', 'role', 'rm', 'revoke'], endpoints: ['members/two-factor', 'members', 'members/[userId]', 'members/invitations/[id]'] },
27
32
  { name: 'flags', aliases: ['flag'], product: 'flags', summary: 'Feature flags (toggle + rollout + targeting)', subs: ['ls', 'create', 'enable', 'disable', 'rollout', 'target', 'rm', 'eval'], endpoints: ['flags', 'flags/[key]', 'flags/evaluate'] },
28
33
  { name: 'status', aliases: ['statuspage', 'statuspages'], product: 'status', summary: 'Public status pages (from your Checks) + incidents/maintenance', subs: ['ls', 'create', 'update', 'rm', 'incidents', 'incident', 'resolve'], endpoints: ['status-pages', 'status-pages/[id]', 'status-pages/[id]/incidents', 'status-pages/[id]/incidents/[incidentId]'] },
29
34
  { name: 'heartbeats', aliases: ['heartbeat', 'hb'], product: 'heartbeats', summary: 'Cron monitoring / dead-man’s switch (ping a URL; alert if silent)', subs: ['ls', 'create', 'update', 'rm'], endpoints: ['heartbeats', 'heartbeats/[id]'] },
@@ -32,18 +37,18 @@ export const CLI_COMMANDS = [
32
37
  { 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]'] },
33
38
  { 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]'] },
34
39
  { name: 'sandboxes', aliases: ['sandbox', 'sb'], product: 'sandboxes', summary: 'Ephemeral compute — run an image+command once, get the output', subs: ['run', 'ls', 'get'], endpoints: ['sandboxes', 'sandboxes/[id]'] },
35
- { name: 'ai', product: 'ai-gateway', summary: 'AI Gateway — unified LLM chat with BYO keys + usage tracking', subs: ['chat', 'providers', 'usage'], endpoints: ['ai/chat', 'ai/providers', 'ai/providers/[name]', 'ai/usage'] },
36
40
  { 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'] },
37
41
  { 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'] },
38
42
  { 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'] },
39
43
  { name: 'logs', aliases: ['logdrains', 'log-drains'], product: 'log-drains', summary: 'Log Drains — forward logs to an HTTP/Datadog sink + ingest/query the buffer', subs: ['tail', 'push', 'drains', 'drain-add', 'enable', 'disable', 'drain-rm'], endpoints: ['log-drains', 'log-drains/[id]', 'logs'] },
44
+ { name: 'billing', aliases: ['plan'], summary: 'Plan actual, catálogo de planes y el enlace de pago (no cobra: devuelve la URL del proveedor)', subs: ['show', 'upgrade'], endpoints: ['billing', 'billing/checkout-session'] },
40
45
  { name: 'spend', aliases: ['budget'], product: 'spend', summary: 'Spend Management — monthly cap + threshold alerts + optional hard stop', subs: ['show', 'set', 'rm'], endpoints: ['spend'] },
41
46
  { name: 'bots', aliases: ['bot'], product: 'bots', summary: 'Bot Management — classify UA + allow/challenge/block + proof-of-work challenge', subs: ['policy', 'set', 'evaluate', 'challenge', 'verify'], endpoints: ['bots/policy', 'bots/evaluate', 'bots/challenge', 'bots/verify'] },
42
47
  { name: 'otel', aliases: ['opentelemetry'], product: 'otel', summary: 'OpenTelemetry export — ship metrics in OTLP to any OTEL backend', subs: ['show', 'set', 'rm'], endpoints: ['otel'] },
43
48
  { 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]'] },
44
49
  { 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'] },
45
50
  { 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
- { 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'] },
51
+ { 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'], endpoints: ['registry/repositories', 'registry/repositories/[name]/tags', 'registry/repositories/[name]/tags/[tag]', 'registry/gc'] },
47
52
  { 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
53
  { 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
54
  { name: 'plan', summary: 'Dry-run a cutover manifest (koigrid.yaml): what would be created/updated, without mutating', subs: [], endpoints: ['manifest/plan'] },
package/dist/output.js CHANGED
@@ -3,6 +3,7 @@ const c = (n, s) => (process.stdout.isTTY ? `\x1b[${n}m${s}\x1b[0m` : s);
3
3
  export const dim = (s) => c(2, s);
4
4
  export const green = (s) => c(32, s);
5
5
  export const red = (s) => c(31, s);
6
+ export const yellow = (s) => c(33, s);
6
7
  export const bold = (s) => c(1, s);
7
8
  /** Tabla alineada de filas (objetos con las mismas claves). PURA. */
8
9
  export function formatTable(rows, columns) {
@@ -0,0 +1,6 @@
1
+ export function proyectoDeFlags(a) {
2
+ const p = a.flags.project;
3
+ if (p === undefined || p === true)
4
+ return {};
5
+ return { projectId: String(p) };
6
+ }
@@ -0,0 +1,17 @@
1
+ export function credencialRegistryDeFlags(a) {
2
+ const registry = a.flags.registry;
3
+ const registryUsername = a.flags['registry-user'];
4
+ const registryPassword = a.flags['registry-password'];
5
+ const registryAwsRegion = a.flags['registry-aws-region'];
6
+ const registryAwsAccessKeyId = a.flags['registry-aws-key'];
7
+ const registryAwsSecretKey = a.flags['registry-aws-secret'];
8
+ if (registry && registryUsername && registryPassword)
9
+ return { registry, registryUsername, registryPassword };
10
+ if (registry && registryAwsRegion && registryAwsAccessKeyId && registryAwsSecretKey)
11
+ return { registry, registryAwsRegion, registryAwsAccessKeyId, registryAwsSecretKey };
12
+ if (registry || registryUsername || registryPassword || registryAwsRegion || registryAwsAccessKeyId || registryAwsSecretKey) {
13
+ throw new Error('incomplete registry credentials: --registry with (--registry-user + --registry-password) or (--registry-aws-region + --registry-aws-key + --registry-aws-secret)');
14
+ }
15
+ return {};
16
+ }
17
+ export const AYUDA_REGISTRY = '[--registry <host> (--registry-user <u> --registry-password <p> | --registry-aws-region <r> --registry-aws-key <k> --registry-aws-secret <s>)]';
package/dist/registry.js CHANGED
@@ -7,7 +7,9 @@ import { jobs } from './commands/jobs.js';
7
7
  import { events } from './commands/events.js';
8
8
  import { email } from './commands/email.js';
9
9
  import { alarms } from './commands/alarms.js';
10
+ import { links, share } from './commands/links.js';
10
11
  import { usage } from './commands/usage.js';
12
+ import { changelog } from './commands/changelog.js';
11
13
  import { projects } from './commands/projects.js';
12
14
  import { checks } from './commands/checks.js';
13
15
  import { members } from './commands/members.js';
@@ -19,12 +21,12 @@ import { analytics } from './commands/analytics.js';
19
21
  import { errors } from './commands/errors.js';
20
22
  import { speed } from './commands/speed.js';
21
23
  import { sandboxes } from './commands/sandboxes.js';
22
- import { ai } from './commands/ai.js';
23
24
  import { images } from './commands/images.js';
24
25
  import { waf } from './commands/waf.js';
25
26
  import { webhooks } from './commands/webhooks.js';
26
27
  import { logs } from './commands/logs.js';
27
28
  import { spend } from './commands/spend.js';
29
+ import { billing } from './commands/billing.js';
28
30
  import { bots } from './commands/bots.js';
29
31
  import { otel } from './commands/otel.js';
30
32
  import { dns } from './commands/dns.js';
@@ -36,6 +38,8 @@ import { audit } from './commands/audit.js';
36
38
  import { anomalies } from './commands/anomalies.js';
37
39
  import { tokens } from './commands/tokens.js';
38
40
  import { notifications } from './commands/notifications.js';
41
+ import { notices } from './commands/notices.js';
42
+ import { support } from './commands/support.js';
39
43
  import { connect } from './commands/connect.js';
40
44
  import { rewards } from './commands/rewards.js';
41
45
  import { up, plan } from './commands/up.js';
@@ -43,5 +47,5 @@ export const HANDLERS = {
43
47
  login: (a) => auth.login(a.flags),
44
48
  logout: () => auth.logout(),
45
49
  whoami: (a) => auth.whoami(!!a.flags.json),
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,
50
+ usage, changelog, billing, projects, apps, links, share, db, redis, storage, jobs, events, alarms, email, checks, members, flags, status, heartbeats, config, analytics, errors, speed, sandboxes, images, waf, webhooks, logs, spend, bots, otel, dns, queues, workflows, registry, audit, anomalies, tokens, notifications, notices, support, connect, rewards, up, plan, wp: wordpress,
47
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koigrid",
3
- "version": "0.7.0",
3
+ "version": "0.8.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"
@@ -1,56 +0,0 @@
1
- import { api } from '../api.js';
2
- import { output, green } from '../output.js';
3
- // koigrid ai — AI Gateway (chat unificado a LLMs, BYO keys). Ver docs/AI-GATEWAY.md.
4
- export async function ai(a) {
5
- const json = !!a.flags.json;
6
- const sub = a.sub || 'usage';
7
- if (sub === 'chat') {
8
- const model = a.positionals[0];
9
- // prompt como posicional (koigrid ai chat <model> "hi") o vía --message/--prompt
10
- const message = (a.positionals[1] || a.flags.message || a.flags.prompt);
11
- if (!model || !message)
12
- throw new Error('usage: koigrid ai chat <model> "your prompt" (or --message "…")');
13
- const r = await api('/ai/chat', { method: 'POST', body: { model, messages: [{ role: 'user', content: message }] } });
14
- if (json)
15
- return console.log(JSON.stringify(r, null, 2));
16
- console.log(r.content);
17
- console.log(green(`\n— ${r.provider}/${r.model} · ${r.usage?.promptTokens}+${r.usage?.completionTokens} tok · ${r.runner}`));
18
- return;
19
- }
20
- if (sub === 'providers' || sub === 'provider') {
21
- const act = a.positionals[0];
22
- if (!act || act === 'ls') {
23
- const r = await api('/ai/providers');
24
- const l = r.providers || [];
25
- return output(l, json, { rows: l.map((x) => ({ name: x.name, configured: x.configuredAt ? 'yes' : '' })), columns: ['name', 'configured'] });
26
- }
27
- if (act === 'set') {
28
- const name = a.positionals[1], key = a.positionals[2];
29
- if (!name || !key)
30
- throw new Error('usage: koigrid ai providers set <openai|anthropic> <API_KEY>');
31
- await api('/ai/providers', { method: 'POST', body: { name, apiKey: key } });
32
- return console.log(green(`✓ ${name} key saved (encrypted)`));
33
- }
34
- if (act === 'rm') {
35
- const name = a.positionals[1];
36
- if (!name)
37
- throw new Error('need <name>');
38
- await api(`/ai/providers/${encodeURIComponent(name)}`, { method: 'DELETE' });
39
- return console.log(green(`✓ Removed ${name}`));
40
- }
41
- throw new Error('usage: koigrid ai providers ls | set <name> <key> | rm <name>');
42
- }
43
- // usage
44
- const days = a.flags.days ? Number(a.flags.days) : 30;
45
- const r = await api(`/ai/usage?days=${days}`);
46
- if (json)
47
- return console.log(JSON.stringify(r, null, 2));
48
- const t = r.usage?.total || {};
49
- console.log(`Requests: ${t.requests} Tokens: ${t.promptTokens}+${t.completionTokens} Cost: ${((t.costMicroCents || 0) / 1e6).toFixed(4)}¢ (last ${days}d)`);
50
- const byModel = r.usage?.byModel || [];
51
- if (byModel.length) {
52
- console.log('\nBy model:');
53
- for (const m of byModel)
54
- console.log(` ${m.requests}\t${m.model}`);
55
- }
56
- }