@arvoretech/hub 0.11.0 → 0.12.0
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/dist/index.js +62 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-VMN4KGAK.js";
|
|
10
10
|
|
|
11
11
|
// src/index.ts
|
|
12
|
-
import { Command as
|
|
12
|
+
import { Command as Command20 } from "commander";
|
|
13
13
|
|
|
14
14
|
// src/commands/init.ts
|
|
15
15
|
import { Command as Command2 } from "commander";
|
|
@@ -4339,14 +4339,71 @@ Run ${chalk17.bold("hub generate")} to update editor configs.
|
|
|
4339
4339
|
}
|
|
4340
4340
|
});
|
|
4341
4341
|
|
|
4342
|
+
// src/commands/clone.ts
|
|
4343
|
+
import { Command as Command19 } from "commander";
|
|
4344
|
+
import { existsSync as existsSync15 } from "fs";
|
|
4345
|
+
import { join as join19 } from "path";
|
|
4346
|
+
import { execSync as execSync14 } from "child_process";
|
|
4347
|
+
import chalk18 from "chalk";
|
|
4348
|
+
function run2(cmd, cwd) {
|
|
4349
|
+
execSync14(cmd, { stdio: "inherit", cwd });
|
|
4350
|
+
}
|
|
4351
|
+
function runSilent2(cmd, cwd) {
|
|
4352
|
+
return execSync14(cmd, { encoding: "utf-8", cwd, stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
4353
|
+
}
|
|
4354
|
+
function canSsh2() {
|
|
4355
|
+
try {
|
|
4356
|
+
const out = runSilent2("ssh -T git@github.com 2>&1 || true");
|
|
4357
|
+
return out.includes("successfully authenticated");
|
|
4358
|
+
} catch {
|
|
4359
|
+
return false;
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
function hasGh2() {
|
|
4363
|
+
try {
|
|
4364
|
+
runSilent2("gh auth status");
|
|
4365
|
+
return true;
|
|
4366
|
+
} catch {
|
|
4367
|
+
return false;
|
|
4368
|
+
}
|
|
4369
|
+
}
|
|
4370
|
+
var cloneCommand = new Command19("clone").description("Clone all repositories without running full setup").option("--ssh", "Force SSH clone (default if SSH is available)").option("--https", "Force HTTPS clone via gh CLI").action(async (opts) => {
|
|
4371
|
+
const hubDir = process.cwd();
|
|
4372
|
+
const config = await loadHubConfig(hubDir);
|
|
4373
|
+
const useGh = opts.https || !opts.ssh && !canSsh2() && hasGh2();
|
|
4374
|
+
console.log(chalk18.blue("\n\u2501\u2501\u2501 Cloning repositories \u2501\u2501\u2501\n"));
|
|
4375
|
+
let cloned = 0;
|
|
4376
|
+
let skipped = 0;
|
|
4377
|
+
for (const repo of config.repos) {
|
|
4378
|
+
const fullPath = join19(hubDir, repo.path);
|
|
4379
|
+
console.log(chalk18.yellow(`\u25B8 ${repo.name}`));
|
|
4380
|
+
if (existsSync15(fullPath)) {
|
|
4381
|
+
console.log(chalk18.green(" Already exists, skipping"));
|
|
4382
|
+
skipped++;
|
|
4383
|
+
continue;
|
|
4384
|
+
}
|
|
4385
|
+
if (useGh) {
|
|
4386
|
+
const slug = repo.url.replace("git@github.com:", "").replace(".git", "");
|
|
4387
|
+
run2(`gh repo clone ${slug} ${fullPath}`);
|
|
4388
|
+
} else {
|
|
4389
|
+
run2(`git clone ${repo.url} ${fullPath}`);
|
|
4390
|
+
}
|
|
4391
|
+
console.log(chalk18.green(" Cloned"));
|
|
4392
|
+
cloned++;
|
|
4393
|
+
}
|
|
4394
|
+
console.log(chalk18.blue("\n\u2501\u2501\u2501 Done \u2501\u2501\u2501\n"));
|
|
4395
|
+
console.log(` ${chalk18.green(`${cloned} cloned`)}, ${chalk18.dim(`${skipped} already existed`)}`);
|
|
4396
|
+
console.log();
|
|
4397
|
+
});
|
|
4398
|
+
|
|
4342
4399
|
// src/index.ts
|
|
4343
4400
|
import { readFileSync as readFileSync2 } from "fs";
|
|
4344
4401
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
4345
|
-
import { dirname as dirname2, join as
|
|
4402
|
+
import { dirname as dirname2, join as join20 } from "path";
|
|
4346
4403
|
var __filename = fileURLToPath2(import.meta.url);
|
|
4347
4404
|
var __dirname = dirname2(__filename);
|
|
4348
|
-
var pkg = JSON.parse(readFileSync2(
|
|
4349
|
-
var program = new
|
|
4405
|
+
var pkg = JSON.parse(readFileSync2(join20(__dirname, "..", "package.json"), "utf-8"));
|
|
4406
|
+
var program = new Command20();
|
|
4350
4407
|
program.name("hub").description(
|
|
4351
4408
|
"Give your AI coding assistant the full picture. Multi-repo context, agent orchestration, and end-to-end workflows."
|
|
4352
4409
|
).version(pkg.version).enablePositionalOptions();
|
|
@@ -4371,4 +4428,5 @@ program.addCommand(memoryCommand);
|
|
|
4371
4428
|
program.addCommand(updateCommand);
|
|
4372
4429
|
program.addCommand(directoryCommand);
|
|
4373
4430
|
program.addCommand(scanCommand);
|
|
4431
|
+
program.addCommand(cloneCommand);
|
|
4374
4432
|
program.parse();
|