@arkhera30/cli 0.1.0 → 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.
- package/compose/docker-compose.yml +1 -1
- package/dist/index.js +5 -46
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
2
2
|
# Horus — Production Docker Compose
|
|
3
|
-
# Managed by @
|
|
3
|
+
# Managed by @arkhera30/cli. Do not edit manually.
|
|
4
4
|
#
|
|
5
5
|
# This file uses pre-built images from ghcr.io. Once CI pipelines are set up,
|
|
6
6
|
# images will be published on every release. Until then, these are placeholder
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import chalk10 from "chalk";
|
|
|
8
8
|
import { Command } from "commander";
|
|
9
9
|
import chalk from "chalk";
|
|
10
10
|
import ora from "ora";
|
|
11
|
-
import {
|
|
11
|
+
import { input, confirm, number } from "@inquirer/prompts";
|
|
12
12
|
|
|
13
13
|
// src/lib/config.ts
|
|
14
14
|
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
|
|
@@ -48,7 +48,6 @@ var CONFIG_VERSION = "1.0";
|
|
|
48
48
|
function defaultConfig() {
|
|
49
49
|
return {
|
|
50
50
|
version: CONFIG_VERSION,
|
|
51
|
-
api_key: "",
|
|
52
51
|
data_dir: DEFAULT_DATA_DIR,
|
|
53
52
|
runtime: "docker",
|
|
54
53
|
ports: { ...DEFAULT_PORTS },
|
|
@@ -72,7 +71,6 @@ function loadConfig() {
|
|
|
72
71
|
const defaults = defaultConfig();
|
|
73
72
|
return {
|
|
74
73
|
version: parsed.version ?? defaults.version,
|
|
75
|
-
api_key: parsed.api_key ?? defaults.api_key,
|
|
76
74
|
data_dir: parsed.data_dir ?? defaults.data_dir,
|
|
77
75
|
runtime: parsed.runtime ?? defaults.runtime,
|
|
78
76
|
ports: {
|
|
@@ -136,7 +134,6 @@ function writeEnvFile(config) {
|
|
|
136
134
|
writeFileSync(ENV_PATH, content, "utf-8");
|
|
137
135
|
}
|
|
138
136
|
var CONFIG_KEYS = [
|
|
139
|
-
"api-key",
|
|
140
137
|
"data-dir",
|
|
141
138
|
"host-repos-path",
|
|
142
139
|
"runtime",
|
|
@@ -148,8 +145,6 @@ var CONFIG_KEYS = [
|
|
|
148
145
|
];
|
|
149
146
|
function getConfigValue(config, key) {
|
|
150
147
|
switch (key) {
|
|
151
|
-
case "api-key":
|
|
152
|
-
return config.api_key;
|
|
153
148
|
case "data-dir":
|
|
154
149
|
return config.data_dir;
|
|
155
150
|
case "host-repos-path":
|
|
@@ -171,9 +166,6 @@ function getConfigValue(config, key) {
|
|
|
171
166
|
function setConfigValue(config, key, value) {
|
|
172
167
|
const updated = { ...config };
|
|
173
168
|
switch (key) {
|
|
174
|
-
case "api-key":
|
|
175
|
-
updated.api_key = value;
|
|
176
|
-
break;
|
|
177
169
|
case "data-dir":
|
|
178
170
|
updated.data_dir = value;
|
|
179
171
|
break;
|
|
@@ -362,10 +354,10 @@ Run 'docker compose logs' from ~/.horus/ to investigate.`
|
|
|
362
354
|
|
|
363
355
|
// src/lib/compose.ts
|
|
364
356
|
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync2 } from "fs";
|
|
365
|
-
import { join as join2, dirname
|
|
357
|
+
import { join as join2, dirname } from "path";
|
|
366
358
|
import { fileURLToPath } from "url";
|
|
367
359
|
var __filename = fileURLToPath(import.meta.url);
|
|
368
|
-
var __dirname =
|
|
360
|
+
var __dirname = dirname(__filename);
|
|
369
361
|
function getBundledComposePath() {
|
|
370
362
|
const candidates = [
|
|
371
363
|
join2(__dirname, "..", "..", "compose", "docker-compose.yml"),
|
|
@@ -392,7 +384,7 @@ function installComposeFile() {
|
|
|
392
384
|
}
|
|
393
385
|
|
|
394
386
|
// src/commands/setup.ts
|
|
395
|
-
var setupCommand = new Command("setup").description("Interactive first-run setup for Horus").option("-y, --yes", "Non-interactive mode (use defaults + env vars)").option("--
|
|
387
|
+
var setupCommand = new Command("setup").description("Interactive first-run setup for Horus").option("-y, --yes", "Non-interactive mode (use defaults + env vars)").option("--data-dir <path>", "Data directory path").option("--repos-path <path>", "Host repos path for Forge scanning").action(async (opts) => {
|
|
396
388
|
console.log("");
|
|
397
389
|
console.log(chalk.bold("Horus Setup"));
|
|
398
390
|
console.log(chalk.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
@@ -424,29 +416,13 @@ var setupCommand = new Command("setup").description("Interactive first-run setup
|
|
|
424
416
|
}
|
|
425
417
|
let config;
|
|
426
418
|
if (opts.yes) {
|
|
427
|
-
const apiKey = opts.apiKey || process.env.HORUS_API_KEY || "";
|
|
428
|
-
if (!apiKey) {
|
|
429
|
-
console.log(chalk.red("Error: API key is required."));
|
|
430
|
-
console.log(chalk.dim("Set HORUS_API_KEY env var or use --api-key flag."));
|
|
431
|
-
process.exit(1);
|
|
432
|
-
}
|
|
433
419
|
config = {
|
|
434
420
|
...defaultConfig(),
|
|
435
|
-
api_key: apiKey,
|
|
436
421
|
runtime: runtime.name,
|
|
437
422
|
data_dir: opts.dataDir || DEFAULT_DATA_DIR,
|
|
438
423
|
host_repos_path: opts.reposPath || ""
|
|
439
424
|
};
|
|
440
425
|
} else {
|
|
441
|
-
const api_key = await password({
|
|
442
|
-
message: "Anthropic API key:",
|
|
443
|
-
mask: "*",
|
|
444
|
-
validate: (val) => {
|
|
445
|
-
if (!val) return "API key is required";
|
|
446
|
-
if (!val.startsWith("sk-ant-")) return 'API key must start with "sk-ant-"';
|
|
447
|
-
return true;
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
426
|
const data_dir = await input({
|
|
451
427
|
message: "Data directory:",
|
|
452
428
|
default: DEFAULT_DATA_DIR
|
|
@@ -486,7 +462,6 @@ var setupCommand = new Command("setup").description("Interactive first-run setup
|
|
|
486
462
|
}
|
|
487
463
|
config = {
|
|
488
464
|
...defaultConfig(),
|
|
489
|
-
api_key,
|
|
490
465
|
data_dir,
|
|
491
466
|
host_repos_path,
|
|
492
467
|
runtime: runtime.name,
|
|
@@ -771,7 +746,6 @@ var configCommand = new Command5("config").description("View or modify Horus con
|
|
|
771
746
|
console.log(chalk5.bold("Horus Configuration"));
|
|
772
747
|
console.log(chalk5.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
773
748
|
console.log(` ${chalk5.bold("version:")} ${config.version}`);
|
|
774
|
-
console.log(` ${chalk5.bold("api-key:")} ${maskApiKey(config.api_key)}`);
|
|
775
749
|
console.log(` ${chalk5.bold("data-dir:")} ${config.data_dir}`);
|
|
776
750
|
console.log(` ${chalk5.bold("runtime:")} ${config.runtime}`);
|
|
777
751
|
console.log(` ${chalk5.bold("host-repos-path:")} ${config.host_repos_path || chalk5.dim("(not set)")}`);
|
|
@@ -805,7 +779,7 @@ configCommand.command("get <key>").description("Get a configuration value").acti
|
|
|
805
779
|
}
|
|
806
780
|
const config = loadConfig();
|
|
807
781
|
const value = getConfigValue(config, key);
|
|
808
|
-
if (key === "
|
|
782
|
+
if (key === "github-token") {
|
|
809
783
|
console.log(maskApiKey(value));
|
|
810
784
|
} else {
|
|
811
785
|
console.log(value || "");
|
|
@@ -833,7 +807,6 @@ configCommand.command("set <key> <value>").description("Set a configuration valu
|
|
|
833
807
|
writeEnvFile(config);
|
|
834
808
|
console.log(chalk5.green(`Set ${key} and regenerated .env file.`));
|
|
835
809
|
const needsRestart = [
|
|
836
|
-
"api-key",
|
|
837
810
|
"data-dir",
|
|
838
811
|
"host-repos-path",
|
|
839
812
|
"runtime",
|
|
@@ -1499,17 +1472,6 @@ async function checkServices(runtime) {
|
|
|
1499
1472
|
}
|
|
1500
1473
|
return results;
|
|
1501
1474
|
}
|
|
1502
|
-
function checkApiKey(config) {
|
|
1503
|
-
if (config.api_key && config.api_key.length > 0) {
|
|
1504
|
-
return { status: "pass", label: "API key", message: "API key is configured" };
|
|
1505
|
-
}
|
|
1506
|
-
return {
|
|
1507
|
-
status: "warn",
|
|
1508
|
-
label: "API key",
|
|
1509
|
-
message: "API key is not set",
|
|
1510
|
-
hint: "Run: horus config set api-key <your-key>"
|
|
1511
|
-
};
|
|
1512
|
-
}
|
|
1513
1475
|
var doctorCommand = new Command8("doctor").description("Diagnose common Horus issues").action(async () => {
|
|
1514
1476
|
console.log("");
|
|
1515
1477
|
console.log(chalk8.bold("Horus Doctor"));
|
|
@@ -1528,9 +1490,6 @@ var doctorCommand = new Command8("doctor").description("Diagnose common Horus is
|
|
|
1528
1490
|
allResults.push(checkPort(ports.forge, "Forge"));
|
|
1529
1491
|
allResults.push(checkDataDir(dataDir));
|
|
1530
1492
|
allResults.push(checkDiskSpace(dataDir));
|
|
1531
|
-
if (config) {
|
|
1532
|
-
allResults.push(checkApiKey(config));
|
|
1533
|
-
}
|
|
1534
1493
|
const runtimeOk = allResults[0].status !== "fail";
|
|
1535
1494
|
const composeOk = allResults[1].status !== "fail";
|
|
1536
1495
|
if (runtimeOk && composeOk) {
|