@arkhera30/cli 0.1.7 → 0.1.8

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/dist/index.js +33 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import ora from "ora";
12
12
  import { execSync } from "child_process";
13
13
  import { existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
14
14
  import { join as join3 } from "path";
15
- import { input, confirm, number, select } from "@inquirer/prompts";
15
+ import { input, confirm, number, select, password } from "@inquirer/prompts";
16
16
 
17
17
  // src/lib/config.ts
18
18
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
@@ -127,6 +127,9 @@ function generateEnv(config) {
127
127
  `ANVIL_REPO_URL=${config.repos.anvil_notes}`,
128
128
  `VAULT_KNOWLEDGE_REPO_URL=${config.repos.vault_knowledge}`,
129
129
  `FORGE_REGISTRY_REPO_URL=${config.repos.forge_registry}`,
130
+ "",
131
+ "# Authentication",
132
+ `GITHUB_TOKEN=${config.github_token}`,
130
133
  ""
131
134
  ];
132
135
  return lines.join("\n");
@@ -428,7 +431,18 @@ function installComposeFile() {
428
431
  }
429
432
 
430
433
  // src/commands/setup.ts
431
- var setupCommand = new Command("setup").description("Interactive first-run setup for Horus").option("-y, --yes", "Non-interactive mode (use defaults + env vars)").option("--runtime <runtime>", "Container runtime to use: docker or podman (non-interactive only)").option("--data-dir <path>", "Data directory path").option("--repos-path <path>", "Host repos path for Forge scanning").option("--git-host <host>", "Git server hostname (e.g., github.com, gitlab.corp.com)").option("--anvil-repo <url>", "Anvil notes repository URL").option("--vault-repo <url>", "Vault knowledge-base repository URL").option("--forge-repo <url>", "Forge registry repository URL").action(async (opts) => {
434
+ function injectToken(url, token) {
435
+ if (!token) return url;
436
+ try {
437
+ const parsed = new URL(url);
438
+ parsed.username = "oauth2";
439
+ parsed.password = token;
440
+ return parsed.toString();
441
+ } catch {
442
+ return url;
443
+ }
444
+ }
445
+ var setupCommand = new Command("setup").description("Interactive first-run setup for Horus").option("-y, --yes", "Non-interactive mode (use defaults + env vars)").option("--runtime <runtime>", "Container runtime to use: docker or podman (non-interactive only)").option("--data-dir <path>", "Data directory path").option("--repos-path <path>", "Host repos path for Forge scanning").option("--git-host <host>", "Git server hostname (e.g., github.com, gitlab.corp.com)").option("--anvil-repo <url>", "Anvil notes repository URL").option("--vault-repo <url>", "Vault knowledge-base repository URL").option("--forge-repo <url>", "Forge registry repository URL").option("--github-token <token>", "GitHub personal access token for private repos").action(async (opts) => {
432
446
  console.log("");
433
447
  console.log(chalk.bold("Horus Setup"));
434
448
  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"));
@@ -500,7 +514,8 @@ var setupCommand = new Command("setup").description("Interactive first-run setup
500
514
  anvil_notes: opts.anvilRepo || process.env.ANVIL_REPO_URL || defaults.repos.anvil_notes,
501
515
  vault_knowledge: opts.vaultRepo || process.env.VAULT_KNOWLEDGE_REPO_URL || defaults.repos.vault_knowledge,
502
516
  forge_registry: opts.forgeRepo || process.env.FORGE_REGISTRY_REPO_URL || defaults.repos.forge_registry
503
- }
517
+ },
518
+ github_token: opts.githubToken || process.env.GITHUB_TOKEN || ""
504
519
  };
505
520
  } else {
506
521
  const data_dir = await input({
@@ -547,7 +562,6 @@ var setupCommand = new Command("setup").description("Interactive first-run setup
547
562
  console.log("");
548
563
  console.log(chalk.yellow(" Use HTTPS URLs \u2014 container services do not have SSH keys."));
549
564
  console.log(chalk.dim(" SSH URLs (git@github.com:...) will fail at runtime inside Docker/Podman."));
550
- console.log(chalk.dim(" Set GITHUB_TOKEN for private repos."));
551
565
  console.log("");
552
566
  const git_host = await input({
553
567
  message: "Git server hostname:",
@@ -574,6 +588,14 @@ ${example("forge-registry")}
574
588
  `,
575
589
  validate: (v) => v.trim().length > 0 || "Forge needs a registry repo."
576
590
  });
591
+ console.log("");
592
+ console.log(chalk.bold("Authentication"));
593
+ console.log(chalk.dim("A personal access token is required for private repositories."));
594
+ console.log("");
595
+ const github_token = await password({
596
+ message: "GitHub personal access token (leave empty to skip):",
597
+ mask: "*"
598
+ });
577
599
  config = {
578
600
  ...defaultConfig(),
579
601
  data_dir,
@@ -585,7 +607,8 @@ ${example("forge-registry")}
585
607
  anvil_notes: anvil_notes.trim(),
586
608
  vault_knowledge: vault_knowledge.trim(),
587
609
  forge_registry: forge_registry.trim()
588
- }
610
+ },
611
+ github_token: github_token.trim()
589
612
  };
590
613
  }
591
614
  const configSpinner = ora("Saving configuration...").start();
@@ -633,7 +656,8 @@ ${example("forge-registry")}
633
656
  }
634
657
  try {
635
658
  mkdirSync2(repo.dest, { recursive: true });
636
- execSync(`git clone "${repo.url}" "${repo.dest}"`, {
659
+ const cloneUrl = injectToken(repo.url, config.github_token);
660
+ execSync(`git clone "${cloneUrl}" "${repo.dest}"`, {
637
661
  stdio: "pipe",
638
662
  timeout: 6e4
639
663
  });
@@ -647,7 +671,9 @@ ${example("forge-registry")}
647
671
  console.log(chalk.dim(` ${msg.split("\n")[0]}`));
648
672
  }
649
673
  console.log(chalk.dim(` URL: ${repo.url}`));
650
- console.log(chalk.dim(" Ensure you have git access (SSH key or credential helper)."));
674
+ if (!config.github_token) {
675
+ console.log(chalk.dim(" Tip: Re-run setup and provide a GitHub token if the repo is private."));
676
+ }
651
677
  process.exit(1);
652
678
  }
653
679
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkhera30/cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "CLI for managing the Horus AI development stack",
5
5
  "type": "module",
6
6
  "bin": {