@arbidocs/cli 0.3.1 → 0.3.3
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.cjs +257 -67
- package/dist/index.cjs.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
var commander = require('commander');
|
|
5
5
|
var core = require('@arbidocs/core');
|
|
6
6
|
var prompts = require('@inquirer/prompts');
|
|
7
|
-
var sdk = require('@arbidocs/sdk');
|
|
8
7
|
var fs = require('fs');
|
|
9
8
|
var path = require('path');
|
|
9
|
+
var os = require('os');
|
|
10
10
|
var child_process = require('child_process');
|
|
11
|
+
var sdk = require('@arbidocs/sdk');
|
|
11
12
|
var module$1 = require('module');
|
|
12
13
|
|
|
13
14
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -15,6 +16,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
15
16
|
|
|
16
17
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
17
18
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
19
|
+
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
18
20
|
|
|
19
21
|
var store = new core.FileConfigStore();
|
|
20
22
|
function getConfig() {
|
|
@@ -65,6 +67,19 @@ function registerConfigCommand(program2) {
|
|
|
65
67
|
process.exit(1);
|
|
66
68
|
}
|
|
67
69
|
});
|
|
70
|
+
config.command("show").description("Show current configuration").action(() => {
|
|
71
|
+
const cfg = getConfig();
|
|
72
|
+
if (!cfg) {
|
|
73
|
+
console.log("Not configured. Run: arbi config set-url <url>");
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
console.log(`Server URL: ${cfg.baseUrl}`);
|
|
77
|
+
console.log(`Domain: ${cfg.deploymentDomain}`);
|
|
78
|
+
console.log(`Auto-update: ${cfg.autoUpdate ? "on" : "off"}`);
|
|
79
|
+
if (cfg.selectedWorkspaceId) {
|
|
80
|
+
console.log(`Workspace: ${cfg.selectedWorkspaceId}`);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
68
83
|
}
|
|
69
84
|
|
|
70
85
|
// ../../node_modules/fake-indexeddb/build/esm/lib/errors.js
|
|
@@ -3378,6 +3393,116 @@ async function promptPassword(message) {
|
|
|
3378
3393
|
async function promptConfirm(message, defaultValue = true) {
|
|
3379
3394
|
return prompts.confirm({ message, default: defaultValue });
|
|
3380
3395
|
}
|
|
3396
|
+
var CACHE_FILE = path__default.default.join(os__default.default.homedir(), ".arbi", "version-cache.json");
|
|
3397
|
+
var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
3398
|
+
var CHANGELOG_URL = "https://raw.githubusercontent.com/arbitrationcity/ARBI-frontend/refs/tags/{tag}/CHANGELOG.md";
|
|
3399
|
+
function readCache() {
|
|
3400
|
+
try {
|
|
3401
|
+
const data = JSON.parse(fs__default.default.readFileSync(CACHE_FILE, "utf8"));
|
|
3402
|
+
if (data.latest && data.checkedAt && Date.now() - data.checkedAt < CACHE_TTL_MS) {
|
|
3403
|
+
return data;
|
|
3404
|
+
}
|
|
3405
|
+
} catch {
|
|
3406
|
+
}
|
|
3407
|
+
return null;
|
|
3408
|
+
}
|
|
3409
|
+
function writeCache(latest) {
|
|
3410
|
+
try {
|
|
3411
|
+
const dir = path__default.default.dirname(CACHE_FILE);
|
|
3412
|
+
if (!fs__default.default.existsSync(dir)) fs__default.default.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
3413
|
+
fs__default.default.writeFileSync(CACHE_FILE, JSON.stringify({ latest, checkedAt: Date.now() }) + "\n");
|
|
3414
|
+
} catch {
|
|
3415
|
+
}
|
|
3416
|
+
}
|
|
3417
|
+
function getLatestVersion() {
|
|
3418
|
+
const cached = readCache();
|
|
3419
|
+
if (cached) return cached.latest;
|
|
3420
|
+
try {
|
|
3421
|
+
const latest = child_process.execSync("npm view @arbidocs/cli version 2>/dev/null", {
|
|
3422
|
+
encoding: "utf8",
|
|
3423
|
+
timeout: 5e3
|
|
3424
|
+
}).trim();
|
|
3425
|
+
writeCache(latest);
|
|
3426
|
+
return latest;
|
|
3427
|
+
} catch {
|
|
3428
|
+
return null;
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
function getCurrentVersion() {
|
|
3432
|
+
return "0.3.3";
|
|
3433
|
+
}
|
|
3434
|
+
async function fetchChangelog(fromVersion, toVersion) {
|
|
3435
|
+
try {
|
|
3436
|
+
const url = CHANGELOG_URL.replace("{tag}", `v${toVersion}`);
|
|
3437
|
+
const res = await fetch(url, { signal: AbortSignal.timeout(5e3) });
|
|
3438
|
+
if (!res.ok) return null;
|
|
3439
|
+
const text = await res.text();
|
|
3440
|
+
return extractSections(text, fromVersion, toVersion);
|
|
3441
|
+
} catch {
|
|
3442
|
+
return null;
|
|
3443
|
+
}
|
|
3444
|
+
}
|
|
3445
|
+
function extractSections(changelog, fromVersion, toVersion) {
|
|
3446
|
+
const lines = changelog.split("\n");
|
|
3447
|
+
const sections = [];
|
|
3448
|
+
let capturing = false;
|
|
3449
|
+
for (const line of lines) {
|
|
3450
|
+
const match = line.match(/^## v(.+)/);
|
|
3451
|
+
if (match) {
|
|
3452
|
+
const version = match[1].trim();
|
|
3453
|
+
if (version === fromVersion) {
|
|
3454
|
+
break;
|
|
3455
|
+
}
|
|
3456
|
+
if (version === toVersion || capturing) {
|
|
3457
|
+
capturing = true;
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3460
|
+
if (capturing) {
|
|
3461
|
+
sections.push(line);
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
const result = sections.join("\n").trim();
|
|
3465
|
+
return result || null;
|
|
3466
|
+
}
|
|
3467
|
+
async function showChangelog(fromVersion, toVersion) {
|
|
3468
|
+
const changelog = await fetchChangelog(fromVersion, toVersion);
|
|
3469
|
+
if (changelog) {
|
|
3470
|
+
console.log("\n" + changelog);
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
async function checkForUpdates(autoUpdate) {
|
|
3474
|
+
try {
|
|
3475
|
+
const latest = getLatestVersion();
|
|
3476
|
+
if (!latest || latest === "0.3.3") return;
|
|
3477
|
+
if (autoUpdate) {
|
|
3478
|
+
console.log(
|
|
3479
|
+
`
|
|
3480
|
+
Your arbi version is out of date (${"0.3.3"} \u2192 ${latest}). Updating...`
|
|
3481
|
+
);
|
|
3482
|
+
await showChangelog("0.3.3", latest);
|
|
3483
|
+
child_process.execSync("npm install -g @arbidocs/cli@latest", { stdio: "inherit" });
|
|
3484
|
+
console.log(`Updated to ${latest}.`);
|
|
3485
|
+
} else {
|
|
3486
|
+
console.error(
|
|
3487
|
+
`
|
|
3488
|
+
Your arbi version is out of date (${"0.3.3"} \u2192 ${latest}).
|
|
3489
|
+
Run "arbi update" to upgrade, or "arbi update auto" to always stay up to date.`
|
|
3490
|
+
);
|
|
3491
|
+
}
|
|
3492
|
+
} catch {
|
|
3493
|
+
}
|
|
3494
|
+
}
|
|
3495
|
+
function hintUpdateOnError() {
|
|
3496
|
+
try {
|
|
3497
|
+
const cached = readCache();
|
|
3498
|
+
if (cached && cached.latest !== "0.3.3") {
|
|
3499
|
+
console.error(
|
|
3500
|
+
`Your arbi version is out of date (${"0.3.3"} \u2192 ${cached.latest}). Run "arbi update".`
|
|
3501
|
+
);
|
|
3502
|
+
}
|
|
3503
|
+
} catch {
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3381
3506
|
|
|
3382
3507
|
// src/commands/login.ts
|
|
3383
3508
|
function registerLoginCommand(program2) {
|
|
@@ -3417,6 +3542,8 @@ function registerLoginCommand(program2) {
|
|
|
3417
3542
|
} catch (err) {
|
|
3418
3543
|
console.error(`Login failed: ${core.getErrorMessage(err)}`);
|
|
3419
3544
|
process.exit(1);
|
|
3545
|
+
} finally {
|
|
3546
|
+
await checkForUpdates(getConfig()?.autoUpdate);
|
|
3420
3547
|
}
|
|
3421
3548
|
});
|
|
3422
3549
|
}
|
|
@@ -3437,56 +3564,65 @@ async function getVerificationCode(email, apiKey) {
|
|
|
3437
3564
|
return Array.isArray(words) ? words.join(" ") : String(words);
|
|
3438
3565
|
}
|
|
3439
3566
|
function registerRegisterCommand(program2) {
|
|
3440
|
-
program2.command("register").description("Register a new ARBI account").option("--non-interactive", "CI/automation mode (requires SUPPORT_API_KEY env var)").option("-e, --email <email>", "Email address (or ARBI_EMAIL env var)").option("-p, --password <password>", "Password (or ARBI_PASSWORD env var)").option("--first-name <name>", "First name").option("--last-name <name>", "Last name").action(
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
await interactiveRegister(config, opts);
|
|
3447
|
-
}
|
|
3567
|
+
program2.command("register").description("Register a new ARBI account").option("--non-interactive", "CI/automation mode (requires SUPPORT_API_KEY env var)").option("-e, --email <email>", "Email address (or ARBI_EMAIL env var)").option("-p, --password <password>", "Password (or ARBI_PASSWORD env var)").option("-c, --verification-code <code>", "Verification code (skip prompt)").option("--first-name <name>", "First name").option("--last-name <name>", "Last name").option("-w, --workspace <id>", "Workspace ID to select after login").action(async (opts) => {
|
|
3568
|
+
const config = requireConfig();
|
|
3569
|
+
if (opts.nonInteractive) {
|
|
3570
|
+
await nonInteractiveRegister(config, opts);
|
|
3571
|
+
} else {
|
|
3572
|
+
await smartRegister(config, opts);
|
|
3448
3573
|
}
|
|
3449
|
-
);
|
|
3574
|
+
});
|
|
3450
3575
|
}
|
|
3451
|
-
async function
|
|
3452
|
-
const email = opts.email || await promptInput("Email");
|
|
3576
|
+
async function smartRegister(config, opts) {
|
|
3577
|
+
const email = opts.email || process.env.ARBI_EMAIL || await promptInput("Email");
|
|
3453
3578
|
const arbi = sdk.createArbiClient({
|
|
3454
3579
|
baseUrl: config.baseUrl,
|
|
3455
3580
|
deploymentDomain: config.deploymentDomain,
|
|
3456
3581
|
credentials: "omit"
|
|
3457
3582
|
});
|
|
3458
3583
|
await arbi.crypto.initSodium();
|
|
3459
|
-
const codeMethod = await promptSelect("Verification method", [
|
|
3460
|
-
{ name: "I have an invitation code", value: "code" },
|
|
3461
|
-
{ name: "Send me a verification email", value: "email" }
|
|
3462
|
-
]);
|
|
3463
3584
|
let verificationCode;
|
|
3464
|
-
if (
|
|
3465
|
-
verificationCode =
|
|
3585
|
+
if (opts.verificationCode) {
|
|
3586
|
+
verificationCode = opts.verificationCode;
|
|
3466
3587
|
} else {
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
if (
|
|
3472
|
-
|
|
3473
|
-
|
|
3588
|
+
const codeMethod = await promptSelect("Verification method", [
|
|
3589
|
+
{ name: "I have an invitation code", value: "code" },
|
|
3590
|
+
{ name: "Send me a verification email", value: "email" }
|
|
3591
|
+
]);
|
|
3592
|
+
if (codeMethod === "code") {
|
|
3593
|
+
verificationCode = await promptInput("Invitation code");
|
|
3594
|
+
} else {
|
|
3595
|
+
console.log("Sending verification email...");
|
|
3596
|
+
const verifyResponse = await arbi.fetch.POST("/api/user/verify-email", {
|
|
3597
|
+
body: { email }
|
|
3598
|
+
});
|
|
3599
|
+
if (verifyResponse.error) {
|
|
3600
|
+
console.error(`Failed to send verification email: ${JSON.stringify(verifyResponse.error)}`);
|
|
3601
|
+
process.exit(1);
|
|
3602
|
+
}
|
|
3603
|
+
console.log("Verification email sent. Check your inbox.");
|
|
3604
|
+
verificationCode = await promptInput("Verification code");
|
|
3474
3605
|
}
|
|
3475
|
-
console.log("Verification email sent. Check your inbox.");
|
|
3476
|
-
verificationCode = await promptInput("Verification code");
|
|
3477
3606
|
}
|
|
3478
|
-
|
|
3479
|
-
const
|
|
3480
|
-
if (
|
|
3481
|
-
|
|
3482
|
-
|
|
3607
|
+
let pw;
|
|
3608
|
+
const flagOrEnvPassword = opts.password || process.env.ARBI_PASSWORD;
|
|
3609
|
+
if (flagOrEnvPassword) {
|
|
3610
|
+
pw = flagOrEnvPassword;
|
|
3611
|
+
} else {
|
|
3612
|
+
pw = await promptPassword("Password");
|
|
3613
|
+
const confirmPw = await promptPassword("Confirm password");
|
|
3614
|
+
if (pw !== confirmPw) {
|
|
3615
|
+
console.error("Passwords do not match.");
|
|
3616
|
+
process.exit(1);
|
|
3617
|
+
}
|
|
3483
3618
|
}
|
|
3484
|
-
const
|
|
3485
|
-
const
|
|
3619
|
+
const hasAllCoreFlags = !!(opts.email || process.env.ARBI_EMAIL) && !!(opts.password || process.env.ARBI_PASSWORD) && !!opts.verificationCode;
|
|
3620
|
+
const firstName = opts.firstName || (hasAllCoreFlags ? "User" : await promptInput("First name", false) || "User");
|
|
3621
|
+
const lastName = opts.lastName || (hasAllCoreFlags ? "" : await promptInput("Last name", false) || "");
|
|
3486
3622
|
try {
|
|
3487
3623
|
await arbi.auth.register({
|
|
3488
3624
|
email,
|
|
3489
|
-
password:
|
|
3625
|
+
password: pw,
|
|
3490
3626
|
verificationCode,
|
|
3491
3627
|
firstName,
|
|
3492
3628
|
lastName
|
|
@@ -3497,27 +3633,10 @@ Registered successfully as ${email}`);
|
|
|
3497
3633
|
console.error(`Registration failed: ${core.getErrorMessage(err)}`);
|
|
3498
3634
|
process.exit(1);
|
|
3499
3635
|
}
|
|
3500
|
-
const
|
|
3636
|
+
const allFlagsProvided = !!(opts.email || process.env.ARBI_EMAIL) && !!(opts.password || process.env.ARBI_PASSWORD) && !!opts.verificationCode;
|
|
3637
|
+
const doLogin = allFlagsProvided || await promptConfirm("Log in now?");
|
|
3501
3638
|
if (doLogin) {
|
|
3502
|
-
|
|
3503
|
-
const { arbi: loggedInArbi } = await core.performPasswordLogin(config, email, password2, store);
|
|
3504
|
-
const { data: workspaces2 } = await loggedInArbi.fetch.GET("/api/user/workspaces");
|
|
3505
|
-
const wsList = workspaces2 || [];
|
|
3506
|
-
console.log(`Logged in as ${email}`);
|
|
3507
|
-
if (wsList.length === 1) {
|
|
3508
|
-
updateConfig({ selectedWorkspaceId: wsList[0].external_id });
|
|
3509
|
-
console.log(`Workspace: ${wsList[0].name} (${wsList[0].external_id})`);
|
|
3510
|
-
} else if (wsList.length > 1) {
|
|
3511
|
-
const choices = core.formatWorkspaceChoices(wsList);
|
|
3512
|
-
const selected = await promptSelect("Select workspace", choices);
|
|
3513
|
-
updateConfig({ selectedWorkspaceId: selected });
|
|
3514
|
-
const ws = wsList.find((w) => w.external_id === selected);
|
|
3515
|
-
console.log(`Workspace: ${ws.name} (${selected})`);
|
|
3516
|
-
}
|
|
3517
|
-
} catch (err) {
|
|
3518
|
-
console.error(`Login failed: ${core.getErrorMessage(err)}`);
|
|
3519
|
-
console.error("You can log in later with: arbi login");
|
|
3520
|
-
}
|
|
3639
|
+
await loginAfterRegister(config, email, pw, opts.workspace);
|
|
3521
3640
|
}
|
|
3522
3641
|
}
|
|
3523
3642
|
async function nonInteractiveRegister(config, opts) {
|
|
@@ -3532,24 +3651,31 @@ async function nonInteractiveRegister(config, opts) {
|
|
|
3532
3651
|
console.error("Password required. Use --password <password> or set ARBI_PASSWORD");
|
|
3533
3652
|
process.exit(1);
|
|
3534
3653
|
}
|
|
3535
|
-
if (!supportApiKey) {
|
|
3536
|
-
console.error("SUPPORT_API_KEY env var is required for --non-interactive registration");
|
|
3537
|
-
process.exit(1);
|
|
3538
|
-
}
|
|
3539
3654
|
const arbi = sdk.createArbiClient({
|
|
3540
3655
|
baseUrl: config.baseUrl,
|
|
3541
3656
|
deploymentDomain: config.deploymentDomain,
|
|
3542
3657
|
credentials: "omit"
|
|
3543
3658
|
});
|
|
3544
3659
|
await arbi.crypto.initSodium();
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3660
|
+
let verificationCode;
|
|
3661
|
+
if (opts.verificationCode) {
|
|
3662
|
+
verificationCode = opts.verificationCode;
|
|
3663
|
+
} else {
|
|
3664
|
+
if (!supportApiKey) {
|
|
3665
|
+
console.error(
|
|
3666
|
+
"Verification code required. Use --verification-code <code> or set SUPPORT_API_KEY for CI mode"
|
|
3667
|
+
);
|
|
3668
|
+
process.exit(1);
|
|
3669
|
+
}
|
|
3670
|
+
const verifyResponse = await arbi.fetch.POST("/api/user/verify-email", {
|
|
3671
|
+
body: { email }
|
|
3672
|
+
});
|
|
3673
|
+
if (verifyResponse.error) {
|
|
3674
|
+
console.error(`verify-email failed: ${JSON.stringify(verifyResponse.error)}`);
|
|
3675
|
+
process.exit(1);
|
|
3676
|
+
}
|
|
3677
|
+
verificationCode = await getVerificationCode(email, supportApiKey);
|
|
3551
3678
|
}
|
|
3552
|
-
const verificationCode = await getVerificationCode(email, supportApiKey);
|
|
3553
3679
|
try {
|
|
3554
3680
|
await arbi.auth.register({
|
|
3555
3681
|
email,
|
|
@@ -3564,6 +3690,38 @@ async function nonInteractiveRegister(config, opts) {
|
|
|
3564
3690
|
process.exit(1);
|
|
3565
3691
|
}
|
|
3566
3692
|
}
|
|
3693
|
+
async function loginAfterRegister(config, email, password2, workspaceId) {
|
|
3694
|
+
try {
|
|
3695
|
+
const { arbi } = await core.performPasswordLogin(config, email, password2, store);
|
|
3696
|
+
const { data: workspaces2 } = await arbi.fetch.GET("/api/user/workspaces");
|
|
3697
|
+
const wsList = workspaces2 || [];
|
|
3698
|
+
console.log(`Logged in as ${email}`);
|
|
3699
|
+
if (wsList.length === 0) return;
|
|
3700
|
+
if (workspaceId) {
|
|
3701
|
+
const ws = wsList.find((w) => w.external_id === workspaceId);
|
|
3702
|
+
if (ws) {
|
|
3703
|
+
updateConfig({ selectedWorkspaceId: ws.external_id });
|
|
3704
|
+
console.log(`Workspace: ${ws.name} (${ws.external_id})`);
|
|
3705
|
+
} else {
|
|
3706
|
+
console.error(`Workspace ${workspaceId} not found.`);
|
|
3707
|
+
}
|
|
3708
|
+
return;
|
|
3709
|
+
}
|
|
3710
|
+
if (wsList.length === 1) {
|
|
3711
|
+
updateConfig({ selectedWorkspaceId: wsList[0].external_id });
|
|
3712
|
+
console.log(`Workspace: ${wsList[0].name} (${wsList[0].external_id})`);
|
|
3713
|
+
} else if (wsList.length > 1) {
|
|
3714
|
+
const choices = core.formatWorkspaceChoices(wsList);
|
|
3715
|
+
const selected = await promptSelect("Select workspace", choices);
|
|
3716
|
+
updateConfig({ selectedWorkspaceId: selected });
|
|
3717
|
+
const ws = wsList.find((w) => w.external_id === selected);
|
|
3718
|
+
console.log(`Workspace: ${ws.name} (${selected})`);
|
|
3719
|
+
}
|
|
3720
|
+
} catch (err) {
|
|
3721
|
+
console.error(`Login failed: ${core.getErrorMessage(err)}`);
|
|
3722
|
+
console.error("You can log in later with: arbi login");
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3567
3725
|
|
|
3568
3726
|
// src/commands/logout.ts
|
|
3569
3727
|
function registerLogoutCommand(program2) {
|
|
@@ -3602,6 +3760,7 @@ function runAction(fn) {
|
|
|
3602
3760
|
await fn();
|
|
3603
3761
|
} catch (err) {
|
|
3604
3762
|
console.error(`Error: ${core.getErrorMessage(err)}`);
|
|
3763
|
+
hintUpdateOnError();
|
|
3605
3764
|
process.exit(1);
|
|
3606
3765
|
}
|
|
3607
3766
|
};
|
|
@@ -4962,6 +5121,36 @@ function registerTuiCommand(program2) {
|
|
|
4962
5121
|
child.on("exit", (code) => process.exit(code ?? 0));
|
|
4963
5122
|
});
|
|
4964
5123
|
}
|
|
5124
|
+
function registerUpdateCommand(program2) {
|
|
5125
|
+
const update = program2.command("update").description("Update ARBI CLI to the latest version").action(async () => {
|
|
5126
|
+
const current = getCurrentVersion();
|
|
5127
|
+
console.log(`Current version: ${current}`);
|
|
5128
|
+
console.log("Checking for updates...\n");
|
|
5129
|
+
try {
|
|
5130
|
+
const latest = getLatestVersion() || child_process.execSync("npm view @arbidocs/cli version", { encoding: "utf8" }).trim();
|
|
5131
|
+
if (latest === current) {
|
|
5132
|
+
console.log("Already up to date.");
|
|
5133
|
+
return;
|
|
5134
|
+
}
|
|
5135
|
+
console.log(`New version available: ${latest}`);
|
|
5136
|
+
await showChangelog(current, latest);
|
|
5137
|
+
console.log("\nUpdating...\n");
|
|
5138
|
+
child_process.execSync("npm install -g @arbidocs/cli@latest", { stdio: "inherit" });
|
|
5139
|
+
console.log(`
|
|
5140
|
+
Updated to ${latest}.`);
|
|
5141
|
+
} catch (err) {
|
|
5142
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
5143
|
+
console.error(`Update failed: ${msg}`);
|
|
5144
|
+
console.error("\nYou can update manually with:");
|
|
5145
|
+
console.error(" npm install -g @arbidocs/cli@latest");
|
|
5146
|
+
process.exit(1);
|
|
5147
|
+
}
|
|
5148
|
+
});
|
|
5149
|
+
update.command("auto").description("Enable automatic updates on login").action(() => {
|
|
5150
|
+
updateConfig({ autoUpdate: true });
|
|
5151
|
+
console.log("Auto-update enabled. ARBI CLI will update automatically on login.");
|
|
5152
|
+
});
|
|
5153
|
+
}
|
|
4965
5154
|
|
|
4966
5155
|
// src/index.ts
|
|
4967
5156
|
console.debug = () => {
|
|
@@ -4972,7 +5161,7 @@ console.info = (...args) => {
|
|
|
4972
5161
|
_origInfo(...args);
|
|
4973
5162
|
};
|
|
4974
5163
|
var program = new commander.Command();
|
|
4975
|
-
program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.
|
|
5164
|
+
program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.3.3");
|
|
4976
5165
|
registerConfigCommand(program);
|
|
4977
5166
|
registerLoginCommand(program);
|
|
4978
5167
|
registerRegisterCommand(program);
|
|
@@ -4993,6 +5182,7 @@ registerSettingsCommand(program);
|
|
|
4993
5182
|
registerAgentconfigCommand(program);
|
|
4994
5183
|
registerHealthCommand(program);
|
|
4995
5184
|
registerTuiCommand(program);
|
|
5185
|
+
registerUpdateCommand(program);
|
|
4996
5186
|
program.parse();
|
|
4997
5187
|
//# sourceMappingURL=index.cjs.map
|
|
4998
5188
|
//# sourceMappingURL=index.cjs.map
|