Lines 1-46javascript
2// forja — instala y actualiza bots de IA de Horizontes en TU propia infra, en un
3// comando. Valida licencia contra el control plane, baja el bot (gated) y lo deja
4// listo para que tu agente lo despliegue. Bilingüe (ES/EN).
6// npx forjabot init → asistente interactivo (elige idioma + licencia/gratis)
7// npx forjabot list → ver el catálogo
8// npx forjabot install <slug> [--key HZN-...]
9// npx forjabot update [dir] [--key HZN-...] → jala la versión nueva
10// npx forjabot login → conecta el CLI con tu cuenta (app.forjabots.com)
11// npx forjabot pair [dir] --url … → vincula un bot YA desplegado con tu dashboard
13// Modo no-interactivo (para agentes/CI): pasa --yes y los datos por flags para que no
14// se cuelgue esperando un menú. Ej:
15// npx forjabot init --yes --giro barberia --email tu@correo.com
16// npx forjabot install barberia --key HZN-XXXX-XXXX-XXXX --yes
17// Flags de init: --giro --key --codigo (evento) --email --name/--negocio --que --ofrece --horario
18// --ubicacion --telefono --web --pagos --faq --reglas --tono --cerebro
19// --lang es|en --yes --no-agent-skill
20import { createInterface } from "node:readline/promises";
21import { emitKeypressEvents } from "node:readline";
22import { stdin as input, stdout as output } from "node:process";
23import { mkdirSync, writeFileSync, readFileSync, rmSync, readdirSync, existsSync, statSync, realpathSync, chmodSync } from "node:fs";
24import { createServer } from "node:http";
25import { homedir } from "node:os";
26import { join } from "node:path";
27import { execFileSync } from "node:child_process";
28import { randomUUID } from "node:crypto";
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
bin/cli.jsView on unpkg · L14 29import { fileURLToPath } from "node:url";
31const SERVER = process.env.FORJA_SERVER || process.env.HORIZONTES_SERVER || "https://horizontes-license-server.innovandohorizontes.workers.dev";
32const GET_URL = process.env.FORJA_GET_URL || "https://horizontesia.com";
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
bin/cli.jsView on unpkg · L23 33// Control plane de cuentas/pairing (app.forjabots.com) — distinto del license server.
34const CLOUD = process.env.FORJA_CLOUD || "https://app.forjabots.com";
35const CFG_DIR = join(homedir(), ".forja");
36const CFG_FILE = join(CFG_DIR, "config.json");
37const CREDS_FILE = join(CFG_DIR, "credentials.json");
38const MARKER = ".horizontes-bot.json";
39const PLAN_RANK = { free: 0, community: 1, pro: 2, agency: 3 };
42 cyan: (s) => `\x1b[36m${s}\x1b[0m`, dim: (s) => `\x1b[2m${s}\x1b[0m`, b: (s) => `
43 green: (s) => `\x1b[32m${s}\x1b[0m`, red: (s) => `\x1b[31m${s}\x1b[0m`, yellow: (s) => `
46// ── i18n ─────────────────────────────────────────────────────────────────────