@johpaz/hive-cli 0.1.1

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 (2) hide show
  1. package/package.json +23 -0
  2. package/src/index.ts +92 -0
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@johpaz/hive-cli",
3
+ "version": "0.1.1",
4
+ "description": "Hive CLI — Command line interface for the Hive AI Gateway",
5
+ "bin": {
6
+ "hive": "src/index.ts"
7
+ },
8
+ "main": "./src/index.ts",
9
+ "license": "MIT",
10
+ "files": [
11
+ "src/"
12
+ ],
13
+ "scripts": {
14
+ "test": "bun test"
15
+ },
16
+ "dependencies": {
17
+ "@johpaz/hive-core": "workspace:*"
18
+ },
19
+ "devDependencies": {
20
+ "typescript": "latest",
21
+ "@types/bun": "latest"
22
+ }
23
+ }
package/src/index.ts ADDED
@@ -0,0 +1,92 @@
1
+ import { loadConfig, startGateway, logger } from "@hive/core";
2
+
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
+ };
10
+
11
+ async function main(): Promise<void> {
12
+ const args = process.argv.slice(2);
13
+ let command = args[0] ?? "help";
14
+
15
+ if (command === "--version" || command === "-v") {
16
+ console.log("Hive v0.1.0");
17
+ process.exit(0);
18
+ }
19
+
20
+ if (command === "--help" || command === "-h") {
21
+ command = "help";
22
+ }
23
+
24
+ switch (command) {
25
+ case "start": {
26
+ const config = loadConfig();
27
+
28
+ if (config.logging?.level) {
29
+ logger.setLevel(config.logging.level);
30
+ }
31
+
32
+ console.log(`
33
+ ╔═══════════════════════════════════════════╗
34
+ ║ ║
35
+ ║ ██╗ ██╗██╗██╗ ██╗███████╗ ║
36
+ ║ ██║ ██║██║██║ ██║██╔════╝ ║
37
+ ║ ███████║██║██║ ██║█████╗ ║
38
+ ║ ██╔══██║██║╚██╗ ██╔╝██╔══╝ ║
39
+ ║ ██║ ██║██║ ╚████╔╝ ███████╗ ║
40
+ ║ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚══════╝ ║
41
+ ║ ║
42
+ ║ Personal AI Gateway — v0.1.0 ║
43
+ ╚════════════════════════════════════════════╝
44
+ `);
45
+
46
+ await startGateway(config);
47
+ 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)");
57
+ break;
58
+ }
59
+
60
+ case "version": {
61
+ console.log("Hive v0.1.0");
62
+ break;
63
+ }
64
+
65
+ 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
+ `);
84
+ break;
85
+ }
86
+ }
87
+ }
88
+
89
+ main().catch((error) => {
90
+ console.error("Fatal error:", error.message);
91
+ process.exit(1);
92
+ });