@johpaz/hive-cli 1.0.2 β†’ 1.0.4

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/src/index.ts CHANGED
@@ -1,88 +1,164 @@
1
- import { loadConfig, startGateway, logger } from "@hive/core";
1
+ #!/usr/bin/env bun
2
+ import { onboard } from "./commands/onboard";
3
+ import { start, stop, status, reload } from "./commands/gateway";
4
+ import { agents } from "./commands/agents";
5
+ import { mcp } from "./commands/mcp";
6
+ import { skills } from "./commands/skills";
7
+ import { config } from "./commands/config";
8
+ import { logs } from "./commands/logs";
9
+ import { chat } from "./commands/chat";
10
+ import { sessions } from "./commands/sessions";
11
+ import { cron } from "./commands/cron";
12
+ import { doctor } from "./commands/doctor";
13
+ import { securityAudit } from "./commands/security";
14
+ import { installService } from "./commands/service";
15
+ import { update } from "./commands/update";
16
+
17
+ const VERSION = "1.0.4";
18
+
19
+ const HELP = `
20
+ 🐝 Hive β€” Personal AI Gateway v${VERSION}
21
+
22
+ Usage: hive <command> [subcommand] [options]
2
23
 
3
- const COMMANDS = {
4
- start: "Start the Hive gateway",
5
- stop: "Stop the Hive gateway",
6
- status: "Show gateway status",
7
- help: "Show this help message",
8
- version: "Show version",
9
- };
24
+ Commands:
25
+ onboard Wizard de configuraciΓ³n inicial
26
+ start [--daemon] Arrancar el Gateway
27
+ stop Detener el Gateway
28
+ reload Recargar config sin reiniciar
29
+ status Estado del Gateway y agentes
30
+ chat [--agent <id>] Chat directo en terminal
31
+ logs [--follow] [--level] Ver logs del Gateway
32
+
33
+ agents add <id> Crear nuevo agente
34
+ agents list [--bindings] Listar agentes
35
+ agents remove <id> Eliminar agente
36
+
37
+ mcp list Listar servidores MCP
38
+ mcp add AΓ±adir servidor MCP
39
+ mcp test <nombre> Verificar servidor MCP
40
+ mcp tools <nombre> Listar tools de un servidor
41
+ mcp remove <nombre> Eliminar servidor MCP
42
+
43
+ skills list Listar skills instaladas
44
+ skills search <query> Buscar skills
45
+ skills install <slug> Instalar skill
46
+ skills remove <nombre> Eliminar skill
47
+ skills update Actualizar skills
48
+
49
+ config get <key> Leer valor de config
50
+ config set <key> <value> Escribir valor de config
51
+ config show Mostrar config completa
52
+ config edit Editar hive.yaml en $EDITOR
53
+
54
+ sessions list Listar sesiones
55
+ sessions view <id> Ver transcripciΓ³n
56
+ sessions prune Eliminar sesiones inactivas
57
+
58
+ cron list Listar cron jobs
59
+ cron add AΓ±adir cron job
60
+ cron remove <id> Eliminar cron job
61
+ cron logs Ver logs de cron
62
+
63
+ doctor DiagnΓ³stico y auto-reparaciΓ³n
64
+ security audit AuditorΓ­a de seguridad
65
+ install-service Instalar servicio systemd
66
+ update Actualizar Hive
67
+
68
+ Options:
69
+ --help, -h Mostrar ayuda
70
+ --version, -v Mostrar versiΓ³n
71
+
72
+ Examples:
73
+ hive onboard Configurar Hive por primera vez
74
+ hive start Arrancar el Gateway
75
+ hive chat Chatear con el agente en terminal
76
+ hive agents add work Crear agente "work"
77
+ hive mcp add AΓ±adir servidor MCP
78
+ hive doctor Diagnosticar problemas
79
+
80
+ Documentation:
81
+ English: https://github.com/johpaz/hive/docs
82
+ EspaΓ±ol: https://github.com/johpaz/hive/docs/es
83
+ `;
10
84
 
11
85
  async function main(): Promise<void> {
12
86
  const args = process.argv.slice(2);
13
- let command = args[0] ?? "help";
14
-
15
- if (command === "--version" || command === "-v") {
16
- console.log("Hive v1.0.2");
17
- process.exit(0);
18
- }
19
-
20
- if (command === "--help" || command === "-h") {
21
- command = "help";
22
- }
87
+ const command = args[0];
88
+ const subcommand = args[1];
89
+ const flags = args.filter((a) => a.startsWith("--"));
23
90
 
24
91
  switch (command) {
25
- case "start": {
26
- const config = loadConfig();
27
-
28
- if (config.logging?.level) {
29
- logger.setLevel(config.logging.level);
92
+ case "onboard":
93
+ await onboard();
94
+ break;
95
+ case "start":
96
+ await start(flags);
97
+ break;
98
+ case "stop":
99
+ await stop();
100
+ break;
101
+ case "reload":
102
+ await reload();
103
+ break;
104
+ case "status":
105
+ await status(flags);
106
+ break;
107
+ case "chat":
108
+ await chat(flags);
109
+ break;
110
+ case "logs":
111
+ await logs(flags);
112
+ break;
113
+ case "agents":
114
+ await agents(subcommand, args.slice(2));
115
+ break;
116
+ case "mcp":
117
+ await mcp(subcommand, args.slice(2));
118
+ break;
119
+ case "skills":
120
+ await skills(subcommand, args.slice(2));
121
+ break;
122
+ case "config":
123
+ await config(subcommand, args.slice(2));
124
+ break;
125
+ case "sessions":
126
+ await sessions(subcommand, args.slice(2));
127
+ break;
128
+ case "cron":
129
+ await cron(subcommand, args.slice(2));
130
+ break;
131
+ case "doctor":
132
+ await doctor();
133
+ break;
134
+ case "security":
135
+ if (subcommand === "audit") {
136
+ await securityAudit();
137
+ } else {
138
+ console.log("Usage: hive security audit");
30
139
  }
31
-
32
- console.log(`
33
- ╔═══════════════════════════════════════════╗
34
- β•‘ β•‘
35
- β•‘ β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•‘
36
- β•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β• β•‘
37
- β•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•‘
38
- β•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β• β•‘
39
- β•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•‘
40
- β•‘ β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•β• β•šβ•β•β•β•β•β•β• β•‘
41
- β•‘ β•‘
42
- β•‘ Personal AI Gateway β€” v1.0.2 β•‘
43
- β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
44
- `);
45
-
46
- await startGateway(config);
47
140
  break;
48
- }
49
-
50
- case "stop": {
51
- console.log("Stopping gateway... (not implemented)");
52
- process.exit(0);
53
- }
54
-
55
- case "status": {
56
- console.log("Gateway status: (not implemented)");
141
+ case "install-service":
142
+ await installService();
57
143
  break;
58
- }
59
-
60
- case "version": {
61
- console.log("Hive v1.0.2");
144
+ case "update":
145
+ await update();
62
146
  break;
63
- }
64
-
147
+ case "--version":
148
+ case "-v":
149
+ case "version":
150
+ console.log(`Hive v${VERSION}`);
151
+ break;
152
+ case "--help":
153
+ case "-h":
65
154
  case "help":
66
- default: {
67
- console.log(`
68
- Hive - Personal AI Gateway
69
-
70
- Usage: hive <command> [options]
71
-
72
- Commands:
73
- ${Object.entries(COMMANDS)
74
- .map(([cmd, desc]) => ` ${cmd.padEnd(10)} ${desc}`)
75
- .join("\n")}
76
-
77
- Examples:
78
- hive start Start the gateway server
79
- hive start --daemon Start as daemon (background)
80
- hive status Show current status
81
-
82
- Documentation: https://github.com/johpaz/hive
83
- `);
155
+ case undefined:
156
+ console.log(HELP);
84
157
  break;
85
- }
158
+ default:
159
+ console.error(`❌ Comando desconocido: "${command}"\n`);
160
+ console.log(HELP);
161
+ process.exit(1);
86
162
  }
87
163
  }
88
164