@openacp/cli 0.4.10 → 0.5.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/README.md +57 -4
- package/dist/agent-catalog-4IAJ7HEG.js +10 -0
- package/dist/agent-registry-B5YAMA4T.js +8 -0
- package/dist/agent-store-ZBXGOFPH.js +8 -0
- package/dist/api-client-UN7BXQOQ.js +11 -0
- package/dist/{autostart-DZ3MHHMM.js → autostart-K73RQZVV.js} +3 -3
- package/dist/chunk-5HGXUCMX.js +83 -0
- package/dist/chunk-5HGXUCMX.js.map +1 -0
- package/dist/{chunk-UAUTLC4E.js → chunk-D73LCTPF.js} +75 -37
- package/dist/chunk-D73LCTPF.js.map +1 -0
- package/dist/{chunk-LYKCQTH5.js → chunk-ESOPMQAY.js} +5 -1
- package/dist/chunk-ESOPMQAY.js.map +1 -0
- package/dist/{chunk-KPI4HGJC.js → chunk-FWN3UIRT.js} +1631 -970
- package/dist/chunk-FWN3UIRT.js.map +1 -0
- package/dist/chunk-IRGYTNLP.js +650 -0
- package/dist/chunk-IRGYTNLP.js.map +1 -0
- package/dist/{chunk-ZRFBLD3W.js → chunk-JRF4G4X7.js} +71 -25
- package/dist/chunk-JRF4G4X7.js.map +1 -0
- package/dist/{chunk-6MJLVZXV.js → chunk-LAFKARV3.js} +58 -21
- package/dist/{chunk-6MJLVZXV.js.map → chunk-LAFKARV3.js.map} +1 -1
- package/dist/chunk-NAMYZIS5.js +1 -0
- package/dist/{chunk-HZD3CGPK.js → chunk-NDR5JCS7.js} +3 -3
- package/dist/chunk-OORPX73T.js +30 -0
- package/dist/chunk-OORPX73T.js.map +1 -0
- package/dist/{chunk-V3BA2MJ6.js → chunk-RF3DUYFO.js} +2 -2
- package/dist/chunk-S3DRLJPM.js +422 -0
- package/dist/chunk-S3DRLJPM.js.map +1 -0
- package/dist/chunk-UG6X672R.js +90 -0
- package/dist/chunk-UG6X672R.js.map +1 -0
- package/dist/{chunk-C6YIUTGR.js → chunk-VBEWSWVL.js} +2 -2
- package/dist/{chunk-MRKYJ422.js → chunk-X6LLG7XN.js} +2 -2
- package/dist/chunk-XJJ7LPXP.js +85 -0
- package/dist/chunk-XJJ7LPXP.js.map +1 -0
- package/dist/chunk-Z46LGZ7R.js +110 -0
- package/dist/chunk-Z46LGZ7R.js.map +1 -0
- package/dist/cli.js +313 -52
- package/dist/cli.js.map +1 -1
- package/dist/{config-H2DSEHNW.js → config-PCPIBPUA.js} +3 -3
- package/dist/config-editor-5L7AJ5AF.js +12 -0
- package/dist/config-editor-5L7AJ5AF.js.map +1 -0
- package/dist/config-registry-SNKA2EH2.js +17 -0
- package/dist/config-registry-SNKA2EH2.js.map +1 -0
- package/dist/{daemon-VF6HJQXD.js → daemon-JZLFRUW6.js} +4 -4
- package/dist/daemon-JZLFRUW6.js.map +1 -0
- package/dist/data/registry-snapshot.json +876 -0
- package/dist/doctor-N2HKKUUQ.js +9 -0
- package/dist/doctor-N2HKKUUQ.js.map +1 -0
- package/dist/index.d.ts +212 -43
- package/dist/index.js +43 -14
- package/dist/install-cloudflared-BTGUD7SW.js +8 -0
- package/dist/install-cloudflared-BTGUD7SW.js.map +1 -0
- package/dist/log-SPS2S6FO.js +19 -0
- package/dist/log-SPS2S6FO.js.map +1 -0
- package/dist/{main-G6XDM7EZ.js → main-37GLOJ7G.js} +21 -15
- package/dist/{main-G6XDM7EZ.js.map → main-37GLOJ7G.js.map} +1 -1
- package/dist/menu-6RCPBVGQ.js +15 -0
- package/dist/menu-6RCPBVGQ.js.map +1 -0
- package/dist/{setup-FCVL75K6.js → setup-QAS3QW3M.js} +5 -4
- package/dist/setup-QAS3QW3M.js.map +1 -0
- package/dist/{tunnel-service-DASSH7OA.js → tunnel-service-LEVPLXAZ.js} +3 -3
- package/package.json +10 -2
- package/dist/agent-registry-7HC6D4CH.js +0 -7
- package/dist/chunk-KPI4HGJC.js.map +0 -1
- package/dist/chunk-LYKCQTH5.js.map +0 -1
- package/dist/chunk-UAUTLC4E.js.map +0 -1
- package/dist/chunk-VA2M52CM.js +0 -15
- package/dist/chunk-VA2M52CM.js.map +0 -1
- package/dist/chunk-ZRFBLD3W.js.map +0 -1
- package/dist/config-editor-SKS4LJLT.js +0 -11
- package/dist/install-cloudflared-ILUXKLAC.js +0 -8
- /package/dist/{agent-registry-7HC6D4CH.js.map → agent-catalog-4IAJ7HEG.js.map} +0 -0
- /package/dist/{autostart-DZ3MHHMM.js.map → agent-registry-B5YAMA4T.js.map} +0 -0
- /package/dist/{config-H2DSEHNW.js.map → agent-store-ZBXGOFPH.js.map} +0 -0
- /package/dist/{config-editor-SKS4LJLT.js.map → api-client-UN7BXQOQ.js.map} +0 -0
- /package/dist/{daemon-VF6HJQXD.js.map → autostart-K73RQZVV.js.map} +0 -0
- /package/dist/{install-cloudflared-ILUXKLAC.js.map → chunk-NAMYZIS5.js.map} +0 -0
- /package/dist/{chunk-HZD3CGPK.js.map → chunk-NDR5JCS7.js.map} +0 -0
- /package/dist/{chunk-V3BA2MJ6.js.map → chunk-RF3DUYFO.js.map} +0 -0
- /package/dist/{chunk-C6YIUTGR.js.map → chunk-VBEWSWVL.js.map} +0 -0
- /package/dist/{chunk-MRKYJ422.js.map → chunk-X6LLG7XN.js.map} +0 -0
- /package/dist/{setup-FCVL75K6.js.map → config-PCPIBPUA.js.map} +0 -0
- /package/dist/{tunnel-service-DASSH7OA.js.map → tunnel-service-LEVPLXAZ.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,12 @@ import {
|
|
|
3
3
|
installPlugin,
|
|
4
4
|
listPlugins,
|
|
5
5
|
uninstallPlugin
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NDR5JCS7.js";
|
|
7
|
+
import {
|
|
8
|
+
apiCall,
|
|
9
|
+
readApiPort,
|
|
10
|
+
removeStalePortFile
|
|
11
|
+
} from "./chunk-OORPX73T.js";
|
|
7
12
|
import {
|
|
8
13
|
checkAndPromptUpdate,
|
|
9
14
|
compareVersions,
|
|
@@ -11,36 +16,12 @@ import {
|
|
|
11
16
|
getLatestVersion,
|
|
12
17
|
runUpdate
|
|
13
18
|
} from "./chunk-KSIQZC3J.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-JRF4G4X7.js";
|
|
20
|
+
import "./chunk-ESOPMQAY.js";
|
|
16
21
|
|
|
17
22
|
// src/cli.ts
|
|
18
23
|
import { setDefaultAutoSelectFamily } from "net";
|
|
19
24
|
|
|
20
|
-
// src/core/api-client.ts
|
|
21
|
-
import * as fs from "fs";
|
|
22
|
-
import * as path from "path";
|
|
23
|
-
import * as os from "os";
|
|
24
|
-
var DEFAULT_PORT_FILE = path.join(os.homedir(), ".openacp", "api.port");
|
|
25
|
-
function readApiPort(portFilePath = DEFAULT_PORT_FILE) {
|
|
26
|
-
try {
|
|
27
|
-
const content = fs.readFileSync(portFilePath, "utf-8").trim();
|
|
28
|
-
const port = parseInt(content, 10);
|
|
29
|
-
return isNaN(port) ? null : port;
|
|
30
|
-
} catch {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function removeStalePortFile(portFilePath = DEFAULT_PORT_FILE) {
|
|
35
|
-
try {
|
|
36
|
-
fs.unlinkSync(portFilePath);
|
|
37
|
-
} catch {
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async function apiCall(port, urlPath, options) {
|
|
41
|
-
return fetch(`http://127.0.0.1:${port}${urlPath}`, options);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
25
|
// src/cli/commands.ts
|
|
45
26
|
function printHelp() {
|
|
46
27
|
console.log(`
|
|
@@ -53,8 +34,16 @@ Usage:
|
|
|
53
34
|
openacp status Show daemon status
|
|
54
35
|
openacp logs Tail daemon log file
|
|
55
36
|
openacp config Edit configuration
|
|
37
|
+
openacp config set <key> <value> Set a config value
|
|
56
38
|
openacp reset Delete all data and start fresh
|
|
57
39
|
openacp update Update to latest version
|
|
40
|
+
openacp doctor Run system diagnostics
|
|
41
|
+
openacp doctor --dry-run Check only, don't fix
|
|
42
|
+
openacp agents List available agents
|
|
43
|
+
openacp agents install <name> Install an agent
|
|
44
|
+
openacp agents uninstall <name> Remove an agent
|
|
45
|
+
openacp agents refresh Update agent list
|
|
46
|
+
openacp agents info <name> Show agent details
|
|
58
47
|
openacp install <package> Install a plugin adapter
|
|
59
48
|
openacp uninstall <package> Uninstall a plugin adapter
|
|
60
49
|
openacp plugins List installed plugins
|
|
@@ -78,8 +67,8 @@ API (requires running daemon):
|
|
|
78
67
|
openacp api health Show system health
|
|
79
68
|
openacp api adapters List registered adapters
|
|
80
69
|
openacp api tunnel Show tunnel status
|
|
81
|
-
openacp api config Show runtime config
|
|
82
|
-
openacp api config set <key> <value> Update config value
|
|
70
|
+
openacp api config Show runtime config (deprecated)
|
|
71
|
+
openacp api config set <key> <value> Update config value (deprecated)
|
|
83
72
|
openacp api restart Restart daemon
|
|
84
73
|
openacp api notify <message> Send notification to all channels
|
|
85
74
|
openacp api version Show daemon version
|
|
@@ -350,6 +339,7 @@ async function cmdApi(args2) {
|
|
|
350
339
|
}
|
|
351
340
|
console.log("Restart signal sent. OpenACP is restarting...");
|
|
352
341
|
} else if (subCmd === "config") {
|
|
342
|
+
console.warn('\u26A0\uFE0F Deprecated: use "openacp config" or "openacp config set" instead.');
|
|
353
343
|
const subSubCmd = args2[2];
|
|
354
344
|
if (!subSubCmd) {
|
|
355
345
|
const res = await apiCall(port, "/api/config");
|
|
@@ -475,8 +465,8 @@ async function cmdApi(args2) {
|
|
|
475
465
|
}
|
|
476
466
|
async function cmdStart() {
|
|
477
467
|
await checkAndPromptUpdate();
|
|
478
|
-
const { startDaemon, getPidPath } = await import("./daemon-
|
|
479
|
-
const { ConfigManager } = await import("./config-
|
|
468
|
+
const { startDaemon, getPidPath } = await import("./daemon-JZLFRUW6.js");
|
|
469
|
+
const { ConfigManager } = await import("./config-PCPIBPUA.js");
|
|
480
470
|
const cm = new ConfigManager();
|
|
481
471
|
if (await cm.exists()) {
|
|
482
472
|
await cm.load();
|
|
@@ -493,7 +483,7 @@ async function cmdStart() {
|
|
|
493
483
|
}
|
|
494
484
|
}
|
|
495
485
|
async function cmdStop() {
|
|
496
|
-
const { stopDaemon } = await import("./daemon-
|
|
486
|
+
const { stopDaemon } = await import("./daemon-JZLFRUW6.js");
|
|
497
487
|
const result = stopDaemon();
|
|
498
488
|
if (result.stopped) {
|
|
499
489
|
console.log(`OpenACP daemon stopped (was PID ${result.pid})`);
|
|
@@ -503,7 +493,7 @@ async function cmdStop() {
|
|
|
503
493
|
}
|
|
504
494
|
}
|
|
505
495
|
async function cmdStatus() {
|
|
506
|
-
const { getStatus } = await import("./daemon-
|
|
496
|
+
const { getStatus } = await import("./daemon-JZLFRUW6.js");
|
|
507
497
|
const status = getStatus();
|
|
508
498
|
if (status.running) {
|
|
509
499
|
console.log(`OpenACP is running (PID ${status.pid})`);
|
|
@@ -513,7 +503,7 @@ async function cmdStatus() {
|
|
|
513
503
|
}
|
|
514
504
|
async function cmdLogs() {
|
|
515
505
|
const { spawn } = await import("child_process");
|
|
516
|
-
const { ConfigManager, expandHome } = await import("./config-
|
|
506
|
+
const { ConfigManager, expandHome } = await import("./config-PCPIBPUA.js");
|
|
517
507
|
const pathMod = await import("path");
|
|
518
508
|
const cm = new ConfigManager();
|
|
519
509
|
let logDir = "~/.openacp/logs";
|
|
@@ -528,18 +518,77 @@ async function cmdLogs() {
|
|
|
528
518
|
process.exit(1);
|
|
529
519
|
});
|
|
530
520
|
}
|
|
531
|
-
async function cmdConfig() {
|
|
532
|
-
const
|
|
533
|
-
|
|
521
|
+
async function cmdConfig(args2 = []) {
|
|
522
|
+
const subCmd = args2[1];
|
|
523
|
+
if (subCmd === "set") {
|
|
524
|
+
const configPath = args2[2];
|
|
525
|
+
const configValue = args2[3];
|
|
526
|
+
if (!configPath || configValue === void 0) {
|
|
527
|
+
console.error("Usage: openacp config set <path> <value>");
|
|
528
|
+
process.exit(1);
|
|
529
|
+
}
|
|
530
|
+
let value = configValue;
|
|
531
|
+
try {
|
|
532
|
+
value = JSON.parse(configValue);
|
|
533
|
+
} catch {
|
|
534
|
+
}
|
|
535
|
+
const port2 = readApiPort();
|
|
536
|
+
if (port2 !== null) {
|
|
537
|
+
const res = await apiCall(port2, "/api/config", {
|
|
538
|
+
method: "PATCH",
|
|
539
|
+
headers: { "Content-Type": "application/json" },
|
|
540
|
+
body: JSON.stringify({ path: configPath, value })
|
|
541
|
+
});
|
|
542
|
+
const data = await res.json();
|
|
543
|
+
if (!res.ok) {
|
|
544
|
+
console.error(`Error: ${data.error}`);
|
|
545
|
+
process.exit(1);
|
|
546
|
+
}
|
|
547
|
+
console.log(`Config updated: ${configPath} = ${JSON.stringify(value)}`);
|
|
548
|
+
if (data.needsRestart) {
|
|
549
|
+
console.log("Note: restart required for this change to take effect.");
|
|
550
|
+
}
|
|
551
|
+
} else {
|
|
552
|
+
const { ConfigManager: ConfigManager2 } = await import("./config-PCPIBPUA.js");
|
|
553
|
+
const cm2 = new ConfigManager2();
|
|
554
|
+
if (!await cm2.exists()) {
|
|
555
|
+
console.error('No config found. Run "openacp" first to set up.');
|
|
556
|
+
process.exit(1);
|
|
557
|
+
}
|
|
558
|
+
await cm2.load();
|
|
559
|
+
const updates = buildNestedUpdateFromPath(configPath, value);
|
|
560
|
+
await cm2.save(updates);
|
|
561
|
+
console.log(`Config updated: ${configPath} = ${JSON.stringify(value)}`);
|
|
562
|
+
}
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
const { runConfigEditor } = await import("./config-editor-5L7AJ5AF.js");
|
|
566
|
+
const { ConfigManager } = await import("./config-PCPIBPUA.js");
|
|
534
567
|
const cm = new ConfigManager();
|
|
535
568
|
if (!await cm.exists()) {
|
|
536
569
|
console.error('No config found. Run "openacp" first to set up.');
|
|
537
570
|
process.exit(1);
|
|
538
571
|
}
|
|
539
|
-
|
|
572
|
+
const port = readApiPort();
|
|
573
|
+
if (port !== null) {
|
|
574
|
+
await runConfigEditor(cm, "api", port);
|
|
575
|
+
} else {
|
|
576
|
+
await runConfigEditor(cm, "file");
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function buildNestedUpdateFromPath(dotPath, value) {
|
|
580
|
+
const parts = dotPath.split(".");
|
|
581
|
+
const result = {};
|
|
582
|
+
let target = result;
|
|
583
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
584
|
+
target[parts[i]] = {};
|
|
585
|
+
target = target[parts[i]];
|
|
586
|
+
}
|
|
587
|
+
target[parts[parts.length - 1]] = value;
|
|
588
|
+
return result;
|
|
540
589
|
}
|
|
541
590
|
async function cmdReset() {
|
|
542
|
-
const { getStatus } = await import("./daemon-
|
|
591
|
+
const { getStatus } = await import("./daemon-JZLFRUW6.js");
|
|
543
592
|
const status = getStatus();
|
|
544
593
|
if (status.running) {
|
|
545
594
|
console.error("OpenACP is running. Stop it first: openacp stop");
|
|
@@ -554,13 +603,13 @@ async function cmdReset() {
|
|
|
554
603
|
console.log("Aborted.");
|
|
555
604
|
return;
|
|
556
605
|
}
|
|
557
|
-
const { uninstallAutoStart } = await import("./autostart-
|
|
606
|
+
const { uninstallAutoStart } = await import("./autostart-K73RQZVV.js");
|
|
558
607
|
uninstallAutoStart();
|
|
559
|
-
const
|
|
560
|
-
const
|
|
561
|
-
const
|
|
562
|
-
const openacpDir =
|
|
563
|
-
|
|
608
|
+
const fs = await import("fs");
|
|
609
|
+
const os = await import("os");
|
|
610
|
+
const path = await import("path");
|
|
611
|
+
const openacpDir = path.join(os.homedir(), ".openacp");
|
|
612
|
+
fs.rmSync(openacpDir, { recursive: true, force: true });
|
|
564
613
|
console.log("Reset complete. Run `openacp` to set up again.");
|
|
565
614
|
}
|
|
566
615
|
async function cmdUpdate() {
|
|
@@ -661,6 +710,216 @@ async function cmdIntegrate(args2) {
|
|
|
661
710
|
}
|
|
662
711
|
}
|
|
663
712
|
}
|
|
713
|
+
async function cmdDoctor(args2) {
|
|
714
|
+
const dryRun = args2.includes("--dry-run");
|
|
715
|
+
const { DoctorEngine } = await import("./doctor-N2HKKUUQ.js");
|
|
716
|
+
const engine = new DoctorEngine({ dryRun });
|
|
717
|
+
console.log("\n\u{1FA7A} OpenACP Doctor\n");
|
|
718
|
+
const report = await engine.runAll();
|
|
719
|
+
const icons = { pass: "\x1B[32m\u2705\x1B[0m", warn: "\x1B[33m\u26A0\uFE0F\x1B[0m", fail: "\x1B[31m\u274C\x1B[0m" };
|
|
720
|
+
for (const category of report.categories) {
|
|
721
|
+
console.log(`\x1B[1m\x1B[36m${category.name}\x1B[0m`);
|
|
722
|
+
for (const result of category.results) {
|
|
723
|
+
console.log(` ${icons[result.status]} ${result.message}`);
|
|
724
|
+
}
|
|
725
|
+
console.log();
|
|
726
|
+
}
|
|
727
|
+
if (report.pendingFixes.length > 0) {
|
|
728
|
+
console.log("\x1B[1mFixable issues:\x1B[0m\n");
|
|
729
|
+
for (const pending of report.pendingFixes) {
|
|
730
|
+
if (dryRun) {
|
|
731
|
+
console.log(` \u{1F527} ${pending.message} (use without --dry-run to fix)`);
|
|
732
|
+
} else {
|
|
733
|
+
const { confirm } = await import("@inquirer/prompts");
|
|
734
|
+
const shouldFix = await confirm({
|
|
735
|
+
message: `Fix: ${pending.message}?`,
|
|
736
|
+
default: false
|
|
737
|
+
});
|
|
738
|
+
if (shouldFix) {
|
|
739
|
+
const fixResult = await pending.fix();
|
|
740
|
+
if (fixResult.success) {
|
|
741
|
+
console.log(` \x1B[32m\u2713 ${fixResult.message}\x1B[0m`);
|
|
742
|
+
} else {
|
|
743
|
+
console.log(` \x1B[31m\u2717 Fix failed: ${fixResult.message}\x1B[0m`);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
console.log();
|
|
749
|
+
}
|
|
750
|
+
const { passed, warnings, failed, fixed } = report.summary;
|
|
751
|
+
const fixedStr = fixed > 0 ? `, ${fixed} fixed` : "";
|
|
752
|
+
console.log(`Result: ${passed} passed, ${warnings} warnings, ${failed} failed${fixedStr}`);
|
|
753
|
+
if (failed > 0) {
|
|
754
|
+
process.exit(1);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
async function cmdAgents(args2) {
|
|
758
|
+
const subcommand = args2[1];
|
|
759
|
+
switch (subcommand) {
|
|
760
|
+
case "install":
|
|
761
|
+
return agentsInstall(args2[2], args2.includes("--force"));
|
|
762
|
+
case "uninstall":
|
|
763
|
+
return agentsUninstall(args2[2]);
|
|
764
|
+
case "refresh":
|
|
765
|
+
return agentsRefresh();
|
|
766
|
+
case "info":
|
|
767
|
+
return agentsInfo(args2[2]);
|
|
768
|
+
default:
|
|
769
|
+
return agentsList();
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
async function agentsList() {
|
|
773
|
+
const { AgentCatalog } = await import("./agent-catalog-4IAJ7HEG.js");
|
|
774
|
+
const catalog = new AgentCatalog();
|
|
775
|
+
catalog.load();
|
|
776
|
+
await catalog.refreshRegistryIfStale();
|
|
777
|
+
const items = catalog.getAvailable();
|
|
778
|
+
const installed = items.filter((i) => i.installed);
|
|
779
|
+
const available = items.filter((i) => !i.installed);
|
|
780
|
+
console.log("");
|
|
781
|
+
if (installed.length > 0) {
|
|
782
|
+
console.log(" \x1B[1mInstalled agents:\x1B[0m\n");
|
|
783
|
+
for (const item of installed) {
|
|
784
|
+
const deps = item.missingDeps?.length ? ` \x1B[33m(needs: ${item.missingDeps.join(", ")})\x1B[0m` : "";
|
|
785
|
+
console.log(
|
|
786
|
+
` \x1B[32m\u2713\x1B[0m ${item.key.padEnd(18)} ${item.name.padEnd(22)} v${item.version.padEnd(10)} ${item.distribution}${deps}`
|
|
787
|
+
);
|
|
788
|
+
if (item.description) {
|
|
789
|
+
console.log(` \x1B[2m${item.description}\x1B[0m`);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
console.log("");
|
|
793
|
+
}
|
|
794
|
+
if (available.length > 0) {
|
|
795
|
+
console.log(" \x1B[1mAvailable to install:\x1B[0m\n");
|
|
796
|
+
for (const item of available) {
|
|
797
|
+
const icon = item.available ? "\x1B[2m\u2B07\x1B[0m" : "\x1B[33m\u26A0\x1B[0m";
|
|
798
|
+
const deps = item.missingDeps?.length ? ` \x1B[33m(needs: ${item.missingDeps.join(", ")})\x1B[0m` : "";
|
|
799
|
+
console.log(
|
|
800
|
+
` ${icon} ${item.key.padEnd(18)} ${item.name.padEnd(22)} v${item.version.padEnd(10)} ${item.distribution}${deps}`
|
|
801
|
+
);
|
|
802
|
+
if (item.description) {
|
|
803
|
+
console.log(` \x1B[2m${item.description}\x1B[0m`);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
console.log("");
|
|
807
|
+
}
|
|
808
|
+
console.log(
|
|
809
|
+
` \x1B[2mInstall an agent: openacp agents install <name>\x1B[0m`
|
|
810
|
+
);
|
|
811
|
+
console.log("");
|
|
812
|
+
}
|
|
813
|
+
async function agentsInstall(nameOrId, force) {
|
|
814
|
+
if (!nameOrId) {
|
|
815
|
+
console.log("\n Usage: openacp agents install <name>");
|
|
816
|
+
console.log(" Run 'openacp agents' to see available agents.\n");
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
const { AgentCatalog } = await import("./agent-catalog-4IAJ7HEG.js");
|
|
820
|
+
const catalog = new AgentCatalog();
|
|
821
|
+
catalog.load();
|
|
822
|
+
await catalog.refreshRegistryIfStale();
|
|
823
|
+
const progress = {
|
|
824
|
+
onStart(_id, name) {
|
|
825
|
+
process.stdout.write(`
|
|
826
|
+
\u23F3 Installing ${name}...
|
|
827
|
+
`);
|
|
828
|
+
},
|
|
829
|
+
onStep(step) {
|
|
830
|
+
process.stdout.write(` \x1B[32m\u2713\x1B[0m ${step}
|
|
831
|
+
`);
|
|
832
|
+
},
|
|
833
|
+
onDownloadProgress(percent) {
|
|
834
|
+
const filled = Math.round(percent / 5);
|
|
835
|
+
const empty = 20 - filled;
|
|
836
|
+
const bar = "\u2588".repeat(filled) + "\u2591".repeat(empty);
|
|
837
|
+
process.stdout.write(`\r ${bar} ${String(percent).padStart(3)}%`);
|
|
838
|
+
if (percent >= 100) process.stdout.write("\n");
|
|
839
|
+
},
|
|
840
|
+
onSuccess(name) {
|
|
841
|
+
console.log(`
|
|
842
|
+
\x1B[32m\u2713 ${name} installed successfully!\x1B[0m
|
|
843
|
+
`);
|
|
844
|
+
},
|
|
845
|
+
onError(error) {
|
|
846
|
+
console.log(`
|
|
847
|
+
\x1B[31m\u2717 ${error}\x1B[0m
|
|
848
|
+
`);
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
const result = await catalog.install(nameOrId, progress, force);
|
|
852
|
+
if (!result.ok) {
|
|
853
|
+
process.exit(1);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
async function agentsUninstall(name) {
|
|
857
|
+
if (!name) {
|
|
858
|
+
console.log("\n Usage: openacp agents uninstall <name>\n");
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
const { AgentCatalog } = await import("./agent-catalog-4IAJ7HEG.js");
|
|
862
|
+
const catalog = new AgentCatalog();
|
|
863
|
+
catalog.load();
|
|
864
|
+
const result = await catalog.uninstall(name);
|
|
865
|
+
if (result.ok) {
|
|
866
|
+
console.log(`
|
|
867
|
+
\x1B[32m\u2713 ${name} removed.\x1B[0m
|
|
868
|
+
`);
|
|
869
|
+
} else {
|
|
870
|
+
console.log(`
|
|
871
|
+
\x1B[31m\u2717 ${result.error}\x1B[0m
|
|
872
|
+
`);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
async function agentsRefresh() {
|
|
876
|
+
const { AgentCatalog } = await import("./agent-catalog-4IAJ7HEG.js");
|
|
877
|
+
const catalog = new AgentCatalog();
|
|
878
|
+
catalog.load();
|
|
879
|
+
console.log("\n Updating agent list...");
|
|
880
|
+
await catalog.fetchRegistry();
|
|
881
|
+
console.log(" \x1B[32m\u2713 Agent list updated.\x1B[0m\n");
|
|
882
|
+
}
|
|
883
|
+
async function agentsInfo(nameOrId) {
|
|
884
|
+
if (!nameOrId) {
|
|
885
|
+
console.log("\n Usage: openacp agents info <name>\n");
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
const { AgentCatalog } = await import("./agent-catalog-4IAJ7HEG.js");
|
|
889
|
+
const catalog = new AgentCatalog();
|
|
890
|
+
catalog.load();
|
|
891
|
+
const installed = catalog.getInstalledAgent(nameOrId);
|
|
892
|
+
if (installed) {
|
|
893
|
+
console.log(`
|
|
894
|
+
\x1B[1m${installed.name}\x1B[0m`);
|
|
895
|
+
console.log(` Version: ${installed.version}`);
|
|
896
|
+
console.log(` Type: ${installed.distribution}`);
|
|
897
|
+
console.log(` Command: ${installed.command} ${installed.args.join(" ")}`);
|
|
898
|
+
console.log(` Installed: ${new Date(installed.installedAt).toLocaleDateString()}`);
|
|
899
|
+
if (installed.binaryPath) console.log(` Binary path: ${installed.binaryPath}`);
|
|
900
|
+
console.log("");
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
const regAgent = catalog.findRegistryAgent(nameOrId);
|
|
904
|
+
if (regAgent) {
|
|
905
|
+
const availability = catalog.checkAvailability(nameOrId);
|
|
906
|
+
console.log(`
|
|
907
|
+
\x1B[1m${regAgent.name}\x1B[0m \x1B[2m(not installed)\x1B[0m`);
|
|
908
|
+
console.log(` ${regAgent.description}`);
|
|
909
|
+
console.log(` Version: ${regAgent.version}`);
|
|
910
|
+
console.log(` License: ${regAgent.license ?? "unknown"}`);
|
|
911
|
+
if (regAgent.website) console.log(` Website: ${regAgent.website}`);
|
|
912
|
+
if (regAgent.repository) console.log(` Source: ${regAgent.repository}`);
|
|
913
|
+
console.log(` Available: ${availability.available ? "\x1B[32mYes\x1B[0m" : `\x1B[33mNo\x1B[0m \u2014 ${availability.reason}`}`);
|
|
914
|
+
console.log(`
|
|
915
|
+
Install: openacp agents install ${nameOrId}
|
|
916
|
+
`);
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
console.log(`
|
|
920
|
+
\x1B[31m"${nameOrId}" not found.\x1B[0m Run 'openacp agents' to see available agents.
|
|
921
|
+
`);
|
|
922
|
+
}
|
|
664
923
|
async function cmdDefault(command2) {
|
|
665
924
|
const forceForeground = command2 === "--foreground";
|
|
666
925
|
if (command2 && !command2.startsWith("-")) {
|
|
@@ -669,17 +928,17 @@ async function cmdDefault(command2) {
|
|
|
669
928
|
process.exit(1);
|
|
670
929
|
}
|
|
671
930
|
await checkAndPromptUpdate();
|
|
672
|
-
const { ConfigManager } = await import("./config-
|
|
931
|
+
const { ConfigManager } = await import("./config-PCPIBPUA.js");
|
|
673
932
|
const cm = new ConfigManager();
|
|
674
933
|
if (!await cm.exists()) {
|
|
675
|
-
const { runSetup } = await import("./setup-
|
|
934
|
+
const { runSetup } = await import("./setup-QAS3QW3M.js");
|
|
676
935
|
const shouldStart = await runSetup(cm);
|
|
677
936
|
if (!shouldStart) process.exit(0);
|
|
678
937
|
}
|
|
679
938
|
await cm.load();
|
|
680
939
|
const config = cm.get();
|
|
681
940
|
if (!forceForeground && config.runMode === "daemon") {
|
|
682
|
-
const { startDaemon, getPidPath } = await import("./daemon-
|
|
941
|
+
const { startDaemon, getPidPath } = await import("./daemon-JZLFRUW6.js");
|
|
683
942
|
const result = startDaemon(getPidPath(), config.logging.logDir);
|
|
684
943
|
if ("error" in result) {
|
|
685
944
|
console.error(result.error);
|
|
@@ -688,9 +947,9 @@ async function cmdDefault(command2) {
|
|
|
688
947
|
console.log(`OpenACP daemon started (PID ${result.pid})`);
|
|
689
948
|
return;
|
|
690
949
|
}
|
|
691
|
-
const { markRunning } = await import("./daemon-
|
|
950
|
+
const { markRunning } = await import("./daemon-JZLFRUW6.js");
|
|
692
951
|
markRunning();
|
|
693
|
-
const { startServer } = await import("./main-
|
|
952
|
+
const { startServer } = await import("./main-37GLOJ7G.js");
|
|
694
953
|
await startServer();
|
|
695
954
|
}
|
|
696
955
|
|
|
@@ -711,13 +970,15 @@ var commands = {
|
|
|
711
970
|
"stop": () => cmdStop(),
|
|
712
971
|
"status": () => cmdStatus(),
|
|
713
972
|
"logs": () => cmdLogs(),
|
|
714
|
-
"config": () => cmdConfig(),
|
|
973
|
+
"config": () => cmdConfig(args),
|
|
715
974
|
"reset": () => cmdReset(),
|
|
716
975
|
"update": () => cmdUpdate(),
|
|
717
976
|
"adopt": () => cmdAdopt(args),
|
|
718
977
|
"integrate": () => cmdIntegrate(args),
|
|
978
|
+
"doctor": () => cmdDoctor(args),
|
|
979
|
+
"agents": () => cmdAgents(args),
|
|
719
980
|
"--daemon-child": async () => {
|
|
720
|
-
const { startServer } = await import("./main-
|
|
981
|
+
const { startServer } = await import("./main-37GLOJ7G.js");
|
|
721
982
|
await startServer();
|
|
722
983
|
}
|
|
723
984
|
};
|