@actant/cli 0.1.3 → 0.2.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/bin/actant.js +1 -1
- package/dist/{chunk-I3QY66Y6.js → chunk-664FYMDI.js} +339 -275
- package/dist/chunk-664FYMDI.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{program-BFSBXPW7.js → program-5GYDDKP6.js} +2 -2
- package/dist/{repl-7TMOU5HY.js → repl-ZVBJSFT5.js} +2 -2
- package/package.json +14 -5
- package/dist/chunk-I3QY66Y6.js.map +0 -1
- /package/dist/{program-BFSBXPW7.js.map → program-5GYDDKP6.js.map} +0 -0
- /package/dist/{repl-7TMOU5HY.js.map → repl-ZVBJSFT5.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/program.ts
|
|
2
|
-
import { Command as
|
|
2
|
+
import { Command as Command74 } from "commander";
|
|
3
3
|
import { readFileSync as readFileSync4 } from "fs";
|
|
4
4
|
import { join as join7 } from "path";
|
|
5
5
|
import { getDefaultIpcPath as getDefaultIpcPath2 } from "@actant/shared";
|
|
@@ -574,19 +574,56 @@ function createTemplateLoadCommand(client, printer = defaultPrinter) {
|
|
|
574
574
|
|
|
575
575
|
// src/commands/template/install.ts
|
|
576
576
|
import { Command as Command5 } from "commander";
|
|
577
|
-
|
|
578
|
-
|
|
577
|
+
import chalk7 from "chalk";
|
|
578
|
+
var DEFAULT_SOURCE = "actant-hub";
|
|
579
|
+
function createTemplateInstallCommand(client, printer = defaultPrinter) {
|
|
580
|
+
return new Command5("install").description("Install a template from a source (source@name or just name for default source)").argument("<spec>", 'Template spec: "source@name" or just "name" (uses actant-hub)').action(async (spec) => {
|
|
579
581
|
try {
|
|
580
582
|
const at = spec.indexOf("@");
|
|
581
|
-
|
|
582
|
-
|
|
583
|
+
const sourceName = at >= 0 ? spec.slice(0, at) : DEFAULT_SOURCE;
|
|
584
|
+
const templateName = at >= 0 ? spec.slice(at + 1) : spec;
|
|
585
|
+
const qualifiedName = `${sourceName}@${templateName}`;
|
|
586
|
+
printer.log(chalk7.dim(` Syncing source "${sourceName}"...`));
|
|
587
|
+
try {
|
|
588
|
+
await client.call("source.sync", { name: sourceName });
|
|
589
|
+
} catch (err) {
|
|
590
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
591
|
+
if (!msg.includes("not found")) {
|
|
592
|
+
printer.warn(` Warning: sync failed (${msg}), checking local cache...`);
|
|
593
|
+
} else {
|
|
594
|
+
printer.error(`Source "${sourceName}" not found. Add it first: actant source add <url> --name ${sourceName}`);
|
|
595
|
+
process.exitCode = 1;
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
try {
|
|
600
|
+
const template = await client.call("template.get", { name: qualifiedName });
|
|
601
|
+
printer.success(` Template "${qualifiedName}" is available.`);
|
|
602
|
+
printer.log("");
|
|
603
|
+
printer.log(` ${chalk7.bold("Name:")} ${template.name}`);
|
|
604
|
+
if (template.description) {
|
|
605
|
+
printer.log(` ${chalk7.bold("Description:")} ${template.description}`);
|
|
606
|
+
}
|
|
607
|
+
printer.log(` ${chalk7.bold("Backend:")} ${template.backend.type}`);
|
|
608
|
+
printer.log(` ${chalk7.bold("Version:")} ${template.version}`);
|
|
609
|
+
printer.log("");
|
|
610
|
+
printer.log(` Create an agent: ${chalk7.cyan(`actant agent create <agent-name> --template ${qualifiedName}`)}`);
|
|
611
|
+
} catch {
|
|
612
|
+
printer.error(`Template "${qualifiedName}" not found in source "${sourceName}".`);
|
|
613
|
+
printer.log(chalk7.dim(" Available templates:"));
|
|
614
|
+
try {
|
|
615
|
+
const templates = await client.call("template.list", {});
|
|
616
|
+
const fromSource = templates.filter((t) => t.name.startsWith(`${sourceName}@`));
|
|
617
|
+
for (const t of fromSource) {
|
|
618
|
+
printer.log(chalk7.dim(` - ${t.name}`));
|
|
619
|
+
}
|
|
620
|
+
if (fromSource.length === 0) {
|
|
621
|
+
printer.log(chalk7.dim(" (none from this source)"));
|
|
622
|
+
}
|
|
623
|
+
} catch {
|
|
624
|
+
}
|
|
583
625
|
process.exitCode = 1;
|
|
584
|
-
return;
|
|
585
626
|
}
|
|
586
|
-
const source = spec.slice(0, at);
|
|
587
|
-
printer.log(
|
|
588
|
-
`Template install not yet implemented via RPC - use "actant source sync ${source}" to sync templates from the source.`
|
|
589
|
-
);
|
|
590
627
|
} catch (err) {
|
|
591
628
|
presentError(err, printer);
|
|
592
629
|
process.exitCode = 1;
|
|
@@ -606,14 +643,14 @@ function createTemplateCommand(client, printer) {
|
|
|
606
643
|
}
|
|
607
644
|
|
|
608
645
|
// src/commands/agent/index.ts
|
|
609
|
-
import { Command as
|
|
646
|
+
import { Command as Command24 } from "commander";
|
|
610
647
|
|
|
611
648
|
// src/commands/agent/create.ts
|
|
612
649
|
import { existsSync } from "fs";
|
|
613
650
|
import { resolve as resolve3 } from "path";
|
|
614
651
|
import { createInterface } from "readline";
|
|
615
652
|
import { Command as Command7 } from "commander";
|
|
616
|
-
import
|
|
653
|
+
import chalk8 from "chalk";
|
|
617
654
|
var VALID_LAUNCH_MODES = /* @__PURE__ */ new Set(["direct", "acp-background", "acp-service", "one-shot"]);
|
|
618
655
|
function askQuestion(question) {
|
|
619
656
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -628,12 +665,12 @@ function createAgentCreateCommand(client, printer = defaultPrinter) {
|
|
|
628
665
|
return new Command7("create").description("Create a new agent from a template").argument("<name>", "Agent instance name").requiredOption("-t, --template <template>", "Template name to use").option("--launch-mode <mode>", "Launch mode: direct, acp-background, acp-service, one-shot").option("--work-dir <path>", "Custom workspace directory (absolute or relative path)").option("--workspace <path>", "Same as --work-dir: create instance at external path instead of builtin location").option("--overwrite", "If work-dir exists, remove it and recreate").option("--append", "If work-dir exists, add agent files into it").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (name, opts) => {
|
|
629
666
|
try {
|
|
630
667
|
if (opts.launchMode && !VALID_LAUNCH_MODES.has(opts.launchMode)) {
|
|
631
|
-
printer.error(`${
|
|
668
|
+
printer.error(`${chalk8.red(`Invalid launch mode: ${opts.launchMode}`)}`);
|
|
632
669
|
process.exitCode = 1;
|
|
633
670
|
return;
|
|
634
671
|
}
|
|
635
672
|
if (opts.overwrite && opts.append) {
|
|
636
|
-
printer.error(`${
|
|
673
|
+
printer.error(`${chalk8.red("Cannot use both --overwrite and --append")}`);
|
|
637
674
|
process.exitCode = 1;
|
|
638
675
|
return;
|
|
639
676
|
}
|
|
@@ -648,7 +685,7 @@ function createAgentCreateCommand(client, printer = defaultPrinter) {
|
|
|
648
685
|
} else {
|
|
649
686
|
printer.warn(`Directory already exists: ${workDir}`);
|
|
650
687
|
const answer = await askQuestion(
|
|
651
|
-
` ${
|
|
688
|
+
` ${chalk8.yellow("(o)")}verwrite / ${chalk8.cyan("(a)")}ppend / ${chalk8.dim("(c)")}ancel? `
|
|
652
689
|
);
|
|
653
690
|
if (answer === "o" || answer === "overwrite") {
|
|
654
691
|
workDirConflict = "overwrite";
|
|
@@ -669,7 +706,7 @@ function createAgentCreateCommand(client, printer = defaultPrinter) {
|
|
|
669
706
|
template: opts.template,
|
|
670
707
|
overrides: Object.keys(overrides).length > 0 ? overrides : void 0
|
|
671
708
|
});
|
|
672
|
-
printer.log(`${
|
|
709
|
+
printer.log(`${chalk8.green("Agent created successfully.")}
|
|
673
710
|
`);
|
|
674
711
|
printer.log(formatAgentDetail(meta, opts.format));
|
|
675
712
|
} catch (err) {
|
|
@@ -681,12 +718,12 @@ function createAgentCreateCommand(client, printer = defaultPrinter) {
|
|
|
681
718
|
|
|
682
719
|
// src/commands/agent/start.ts
|
|
683
720
|
import { Command as Command8 } from "commander";
|
|
684
|
-
import
|
|
721
|
+
import chalk9 from "chalk";
|
|
685
722
|
function createAgentStartCommand(client, printer = defaultPrinter) {
|
|
686
723
|
return new Command8("start").description("Start an agent").argument("<name>", "Agent name").action(async (name) => {
|
|
687
724
|
try {
|
|
688
725
|
await client.call("agent.start", { name });
|
|
689
|
-
printer.log(`${
|
|
726
|
+
printer.log(`${chalk9.green("Started")} ${name}`);
|
|
690
727
|
} catch (err) {
|
|
691
728
|
presentError(err, printer);
|
|
692
729
|
process.exitCode = 1;
|
|
@@ -696,12 +733,12 @@ function createAgentStartCommand(client, printer = defaultPrinter) {
|
|
|
696
733
|
|
|
697
734
|
// src/commands/agent/stop.ts
|
|
698
735
|
import { Command as Command9 } from "commander";
|
|
699
|
-
import
|
|
736
|
+
import chalk10 from "chalk";
|
|
700
737
|
function createAgentStopCommand(client, printer = defaultPrinter) {
|
|
701
738
|
return new Command9("stop").description("Stop a running agent").argument("<name>", "Agent name").action(async (name) => {
|
|
702
739
|
try {
|
|
703
740
|
await client.call("agent.stop", { name });
|
|
704
|
-
printer.log(`${
|
|
741
|
+
printer.log(`${chalk10.green("Stopped")} ${name}`);
|
|
705
742
|
} catch (err) {
|
|
706
743
|
presentError(err, printer);
|
|
707
744
|
process.exitCode = 1;
|
|
@@ -743,7 +780,7 @@ function createAgentListCommand(client, printer = defaultPrinter) {
|
|
|
743
780
|
}
|
|
744
781
|
|
|
745
782
|
// src/commands/agent/adopt.ts
|
|
746
|
-
import
|
|
783
|
+
import chalk11 from "chalk";
|
|
747
784
|
import { Command as Command12 } from "commander";
|
|
748
785
|
function formatAdoptResult(result, format) {
|
|
749
786
|
if (format === "json") {
|
|
@@ -753,14 +790,14 @@ function formatAdoptResult(result, format) {
|
|
|
753
790
|
return result.name;
|
|
754
791
|
}
|
|
755
792
|
const lines = [
|
|
756
|
-
|
|
793
|
+
chalk11.green("Agent adopted successfully."),
|
|
757
794
|
"",
|
|
758
|
-
`${
|
|
759
|
-
`${
|
|
760
|
-
`${
|
|
761
|
-
`${
|
|
762
|
-
`${
|
|
763
|
-
`${
|
|
795
|
+
`${chalk11.bold("Name:")} ${result.name}`,
|
|
796
|
+
`${chalk11.bold("Template:")} ${result.template}`,
|
|
797
|
+
`${chalk11.bold("Workspace:")} ${result.workspacePath}`,
|
|
798
|
+
`${chalk11.bold("Location:")} ${result.location}`,
|
|
799
|
+
`${chalk11.bold("Status:")} ${result.status}`,
|
|
800
|
+
`${chalk11.bold("Created:")} ${result.createdAt}`
|
|
764
801
|
];
|
|
765
802
|
return lines.join("\n");
|
|
766
803
|
}
|
|
@@ -781,7 +818,7 @@ function createAgentAdoptCommand(client, printer = defaultPrinter) {
|
|
|
781
818
|
|
|
782
819
|
// src/commands/agent/destroy.ts
|
|
783
820
|
import { Command as Command13 } from "commander";
|
|
784
|
-
import
|
|
821
|
+
import chalk12 from "chalk";
|
|
785
822
|
function createAgentDestroyCommand(client, printer = defaultPrinter) {
|
|
786
823
|
return new Command13("destroy").alias("rm").description("Destroy an agent (removes workspace directory)").argument("<name>", "Agent name").option("--force", "Skip confirmation", false).action(async (name, opts) => {
|
|
787
824
|
if (!opts.force) {
|
|
@@ -792,7 +829,7 @@ function createAgentDestroyCommand(client, printer = defaultPrinter) {
|
|
|
792
829
|
}
|
|
793
830
|
try {
|
|
794
831
|
await client.call("agent.destroy", { name });
|
|
795
|
-
printer.log(`${
|
|
832
|
+
printer.log(`${chalk12.green("Destroyed")} ${name}`);
|
|
796
833
|
} catch (err) {
|
|
797
834
|
presentError(err, printer);
|
|
798
835
|
process.exitCode = 1;
|
|
@@ -802,7 +839,7 @@ function createAgentDestroyCommand(client, printer = defaultPrinter) {
|
|
|
802
839
|
|
|
803
840
|
// src/commands/agent/resolve.ts
|
|
804
841
|
import { Command as Command14 } from "commander";
|
|
805
|
-
import
|
|
842
|
+
import chalk13 from "chalk";
|
|
806
843
|
function createAgentResolveCommand(client, printer = defaultPrinter) {
|
|
807
844
|
return new Command14("resolve").description("Resolve spawn info for an agent (external spawn support)").argument("<name>", "Agent instance name").option("-t, --template <template>", "Template name (auto-creates instance if not found)").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (name, opts) => {
|
|
808
845
|
try {
|
|
@@ -816,16 +853,16 @@ function createAgentResolveCommand(client, printer = defaultPrinter) {
|
|
|
816
853
|
printer.log([result.command, ...result.args].join(" "));
|
|
817
854
|
} else {
|
|
818
855
|
if (result.created) {
|
|
819
|
-
printer.log(`${
|
|
856
|
+
printer.log(`${chalk13.green("Instance created.")}
|
|
820
857
|
`);
|
|
821
858
|
}
|
|
822
|
-
printer.log(`${
|
|
823
|
-
printer.log(`${
|
|
824
|
-
printer.log(`${
|
|
825
|
-
printer.log(`${
|
|
826
|
-
printer.log(`${
|
|
859
|
+
printer.log(`${chalk13.bold("Instance:")} ${result.instanceName}`);
|
|
860
|
+
printer.log(`${chalk13.bold("Backend:")} ${result.backendType}`);
|
|
861
|
+
printer.log(`${chalk13.bold("Workspace:")} ${result.workspaceDir}`);
|
|
862
|
+
printer.log(`${chalk13.bold("Command:")} ${result.command}`);
|
|
863
|
+
printer.log(`${chalk13.bold("Args:")} ${result.args.join(" ")}`);
|
|
827
864
|
if (result.env && Object.keys(result.env).length > 0) {
|
|
828
|
-
printer.log(
|
|
865
|
+
printer.log(chalk13.bold("Env:"));
|
|
829
866
|
for (const [k, v] of Object.entries(result.env)) {
|
|
830
867
|
printer.log(` ${k}=${v}`);
|
|
831
868
|
}
|
|
@@ -838,15 +875,32 @@ function createAgentResolveCommand(client, printer = defaultPrinter) {
|
|
|
838
875
|
});
|
|
839
876
|
}
|
|
840
877
|
|
|
841
|
-
// src/commands/agent/
|
|
878
|
+
// src/commands/agent/open.ts
|
|
879
|
+
import { spawn } from "child_process";
|
|
842
880
|
import { Command as Command15 } from "commander";
|
|
843
|
-
import
|
|
881
|
+
import chalk14 from "chalk";
|
|
882
|
+
function createAgentOpenCommand(client, printer = defaultPrinter) {
|
|
883
|
+
return new Command15("open").description("Open an agent's native TUI/UI (e.g. Cursor IDE)").argument("<name>", "Agent name").action(async (name) => {
|
|
884
|
+
try {
|
|
885
|
+
const result = await client.call("agent.open", { name });
|
|
886
|
+
printer.log(`${chalk14.green("Opening")} ${name} \u2192 ${result.command} ${result.args.join(" ")}`);
|
|
887
|
+
spawn(result.command, result.args, { detached: true, stdio: "ignore" }).unref();
|
|
888
|
+
} catch (err) {
|
|
889
|
+
presentError(err, printer);
|
|
890
|
+
process.exitCode = 1;
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// src/commands/agent/attach.ts
|
|
896
|
+
import { Command as Command16 } from "commander";
|
|
897
|
+
import chalk15 from "chalk";
|
|
844
898
|
function createAgentAttachCommand(client, printer = defaultPrinter) {
|
|
845
|
-
return new
|
|
899
|
+
return new Command16("attach").description("Attach an externally-spawned process to an agent").argument("<name>", "Agent instance name").requiredOption("--pid <pid>", "Process ID of the externally-spawned agent").option("--metadata <json>", "Additional metadata as JSON object").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (name, opts) => {
|
|
846
900
|
try {
|
|
847
901
|
const pid = parseInt(opts.pid, 10);
|
|
848
902
|
if (isNaN(pid) || pid <= 0) {
|
|
849
|
-
printer.error(
|
|
903
|
+
printer.error(chalk15.red("Invalid PID: must be a positive integer"));
|
|
850
904
|
process.exitCode = 1;
|
|
851
905
|
return;
|
|
852
906
|
}
|
|
@@ -855,13 +909,13 @@ function createAgentAttachCommand(client, printer = defaultPrinter) {
|
|
|
855
909
|
try {
|
|
856
910
|
metadata = JSON.parse(opts.metadata);
|
|
857
911
|
} catch {
|
|
858
|
-
printer.error(
|
|
912
|
+
printer.error(chalk15.red("Invalid --metadata: must be valid JSON"));
|
|
859
913
|
process.exitCode = 1;
|
|
860
914
|
return;
|
|
861
915
|
}
|
|
862
916
|
}
|
|
863
917
|
const meta = await client.call("agent.attach", { name, pid, metadata });
|
|
864
|
-
printer.log(`${
|
|
918
|
+
printer.log(`${chalk15.green("Process attached.")}
|
|
865
919
|
`);
|
|
866
920
|
printer.log(formatAgentDetail(meta, opts.format));
|
|
867
921
|
} catch (err) {
|
|
@@ -872,9 +926,9 @@ function createAgentAttachCommand(client, printer = defaultPrinter) {
|
|
|
872
926
|
}
|
|
873
927
|
|
|
874
928
|
// src/commands/agent/detach.ts
|
|
875
|
-
import { Command as
|
|
929
|
+
import { Command as Command17 } from "commander";
|
|
876
930
|
function createAgentDetachCommand(client, printer = defaultPrinter) {
|
|
877
|
-
return new
|
|
931
|
+
return new Command17("detach").description("Detach an externally-managed process from an agent").argument("<name>", "Agent instance name").option("--cleanup", "Clean up ephemeral workspace after detach").action(async (name, opts) => {
|
|
878
932
|
try {
|
|
879
933
|
const result = await client.call("agent.detach", {
|
|
880
934
|
name,
|
|
@@ -892,9 +946,9 @@ function createAgentDetachCommand(client, printer = defaultPrinter) {
|
|
|
892
946
|
}
|
|
893
947
|
|
|
894
948
|
// src/commands/agent/run.ts
|
|
895
|
-
import { Command as
|
|
949
|
+
import { Command as Command18 } from "commander";
|
|
896
950
|
function createAgentRunCommand(client, printer = defaultPrinter) {
|
|
897
|
-
return new
|
|
951
|
+
return new Command18("run").description("Send a prompt to an agent and get the response").argument("<name>", "Agent name").requiredOption("--prompt <prompt>", "The prompt to send").option("--model <model>", "Model to use (e.g. sonnet, opus)").option("--max-turns <turns>", "Maximum agentic turns", parseInt).option("--timeout <ms>", "Timeout in milliseconds", parseInt).option("--session-id <id>", "Resume a specific session").option("-f, --format <format>", "Output format: text, json", "text").action(async (name, opts) => {
|
|
898
952
|
try {
|
|
899
953
|
const rpcTimeout = (opts.timeout ?? 3e5) + 5e3;
|
|
900
954
|
const result = await client.call("agent.run", {
|
|
@@ -920,9 +974,9 @@ function createAgentRunCommand(client, printer = defaultPrinter) {
|
|
|
920
974
|
}
|
|
921
975
|
|
|
922
976
|
// src/commands/agent/prompt.ts
|
|
923
|
-
import { Command as
|
|
977
|
+
import { Command as Command19 } from "commander";
|
|
924
978
|
function createAgentPromptCommand(client, printer = defaultPrinter) {
|
|
925
|
-
return new
|
|
979
|
+
return new Command19("prompt").description("Send a message to a running agent's ACP session").argument("<name>", "Agent name (must be started with `agent start`)").requiredOption("-m, --message <message>", "The message to send").option("--session-id <id>", "Specific ACP session ID (uses primary session if omitted)").option("-f, --format <format>", "Output format: text, json", "text").action(async (name, opts) => {
|
|
926
980
|
try {
|
|
927
981
|
const result = await client.call("agent.prompt", {
|
|
928
982
|
name,
|
|
@@ -943,11 +997,11 @@ function createAgentPromptCommand(client, printer = defaultPrinter) {
|
|
|
943
997
|
|
|
944
998
|
// src/commands/agent/chat.ts
|
|
945
999
|
import { createInterface as createInterface2 } from "readline";
|
|
946
|
-
import { Command as
|
|
947
|
-
import
|
|
1000
|
+
import { Command as Command20 } from "commander";
|
|
1001
|
+
import chalk16 from "chalk";
|
|
948
1002
|
import { AcpConnection } from "@actant/acp";
|
|
949
1003
|
function createAgentChatCommand(client, printer = defaultPrinter) {
|
|
950
|
-
return new
|
|
1004
|
+
return new Command20("chat").description("Start an interactive chat session with an agent").argument("<name>", "Agent name").option("-t, --template <template>", "Template name (auto-creates instance if not found)").action(async (name, opts) => {
|
|
951
1005
|
try {
|
|
952
1006
|
await runChat(client, name, opts, printer);
|
|
953
1007
|
} catch (err) {
|
|
@@ -980,9 +1034,9 @@ async function runChat(client, name, opts, printer) {
|
|
|
980
1034
|
async function runDaemonChat(client, name, printer) {
|
|
981
1035
|
const meta = await client.call("agent.status", { name });
|
|
982
1036
|
printer.log(
|
|
983
|
-
|
|
1037
|
+
chalk16.bold(`Chat with ${meta.name}`) + chalk16.dim(` (${meta.templateName}@${meta.templateVersion}) [daemon-managed]`)
|
|
984
1038
|
);
|
|
985
|
-
printer.log(
|
|
1039
|
+
printer.log(chalk16.dim('Type your message and press Enter. Use "exit" or Ctrl+C to quit.\n'));
|
|
986
1040
|
const rl = createReadline();
|
|
987
1041
|
rl.prompt();
|
|
988
1042
|
let sessionId;
|
|
@@ -997,7 +1051,7 @@ async function runDaemonChat(client, name, printer) {
|
|
|
997
1051
|
return;
|
|
998
1052
|
}
|
|
999
1053
|
try {
|
|
1000
|
-
process.stdout.write(
|
|
1054
|
+
process.stdout.write(chalk16.cyan("agent> "));
|
|
1001
1055
|
const result = await client.call("agent.prompt", {
|
|
1002
1056
|
name,
|
|
1003
1057
|
message: trimmed,
|
|
@@ -1011,7 +1065,7 @@ async function runDaemonChat(client, name, printer) {
|
|
|
1011
1065
|
rl.prompt();
|
|
1012
1066
|
});
|
|
1013
1067
|
rl.on("close", () => {
|
|
1014
|
-
process.stdout.write(
|
|
1068
|
+
process.stdout.write(chalk16.dim("\nChat ended.\n"));
|
|
1015
1069
|
});
|
|
1016
1070
|
return new Promise((resolve9) => {
|
|
1017
1071
|
rl.on("close", resolve9);
|
|
@@ -1047,9 +1101,9 @@ async function runDirectBridgeChat(client, name, opts, printer) {
|
|
|
1047
1101
|
const agentName = initResult.agentInfo?.name ?? name;
|
|
1048
1102
|
session = await conn.newSession(resolved.workspaceDir);
|
|
1049
1103
|
printer.log(
|
|
1050
|
-
|
|
1104
|
+
chalk16.bold(`Chat with ${agentName}`) + chalk16.dim(` (direct bridge, session ${session.sessionId.slice(0, 8)}...)`)
|
|
1051
1105
|
);
|
|
1052
|
-
printer.log(
|
|
1106
|
+
printer.log(chalk16.dim('Type your message and press Enter. Use "exit" or Ctrl+C to quit.\n'));
|
|
1053
1107
|
const rl = createReadline();
|
|
1054
1108
|
process.on("SIGINT", () => {
|
|
1055
1109
|
if (session) {
|
|
@@ -1081,7 +1135,7 @@ async function runDirectBridgeChat(client, name, opts, printer) {
|
|
|
1081
1135
|
rl.prompt();
|
|
1082
1136
|
});
|
|
1083
1137
|
rl.on("close", () => {
|
|
1084
|
-
process.stdout.write(
|
|
1138
|
+
process.stdout.write(chalk16.dim("\nChat ended.\n"));
|
|
1085
1139
|
});
|
|
1086
1140
|
await new Promise((resolve9) => {
|
|
1087
1141
|
rl.on("close", resolve9);
|
|
@@ -1094,7 +1148,7 @@ function createReadline() {
|
|
|
1094
1148
|
return createInterface2({
|
|
1095
1149
|
input: process.stdin,
|
|
1096
1150
|
output: process.stdout,
|
|
1097
|
-
prompt:
|
|
1151
|
+
prompt: chalk16.green("you> "),
|
|
1098
1152
|
terminal: process.stdin.isTTY ?? false
|
|
1099
1153
|
});
|
|
1100
1154
|
}
|
|
@@ -1136,9 +1190,9 @@ function notificationToChunk(notification) {
|
|
|
1136
1190
|
}
|
|
1137
1191
|
|
|
1138
1192
|
// src/commands/agent/dispatch.ts
|
|
1139
|
-
import { Command as
|
|
1193
|
+
import { Command as Command21 } from "commander";
|
|
1140
1194
|
function createAgentDispatchCommand(client, printer = defaultPrinter) {
|
|
1141
|
-
return new
|
|
1195
|
+
return new Command21("dispatch").description("Queue a one-off task for an agent's scheduler").argument("<name>", "Agent name").requiredOption("-m, --message <message>", "The prompt/message to dispatch").option("-p, --priority <priority>", "Task priority: low, normal, high, critical", "normal").action(async (name, opts) => {
|
|
1142
1196
|
try {
|
|
1143
1197
|
const result = await client.call("agent.dispatch", {
|
|
1144
1198
|
name,
|
|
@@ -1158,9 +1212,9 @@ function createAgentDispatchCommand(client, printer = defaultPrinter) {
|
|
|
1158
1212
|
}
|
|
1159
1213
|
|
|
1160
1214
|
// src/commands/agent/tasks.ts
|
|
1161
|
-
import { Command as
|
|
1215
|
+
import { Command as Command22 } from "commander";
|
|
1162
1216
|
function createAgentTasksCommand(client, printer = defaultPrinter) {
|
|
1163
|
-
return new
|
|
1217
|
+
return new Command22("tasks").description("List queued tasks for an agent's scheduler").argument("<name>", "Agent name").option("-f, --format <format>", "Output format: table, json", "table").action(async (name, opts) => {
|
|
1164
1218
|
try {
|
|
1165
1219
|
const result = await client.call("agent.tasks", { name });
|
|
1166
1220
|
if (opts.format === "json") {
|
|
@@ -1182,9 +1236,9 @@ function createAgentTasksCommand(client, printer = defaultPrinter) {
|
|
|
1182
1236
|
}
|
|
1183
1237
|
|
|
1184
1238
|
// src/commands/agent/logs.ts
|
|
1185
|
-
import { Command as
|
|
1239
|
+
import { Command as Command23 } from "commander";
|
|
1186
1240
|
function createAgentLogsCommand(client, printer = defaultPrinter) {
|
|
1187
|
-
return new
|
|
1241
|
+
return new Command23("logs").description("Show execution logs for an agent's scheduler").argument("<name>", "Agent name").option("--limit <n>", "Maximum number of records to show", parseInt, 20).option("-f, --format <format>", "Output format: table, json", "table").action(async (name, opts) => {
|
|
1188
1242
|
try {
|
|
1189
1243
|
const result = await client.call("agent.logs", { name, limit: opts.limit });
|
|
1190
1244
|
if (opts.format === "json") {
|
|
@@ -1210,7 +1264,7 @@ function createAgentLogsCommand(client, printer = defaultPrinter) {
|
|
|
1210
1264
|
|
|
1211
1265
|
// src/commands/agent/index.ts
|
|
1212
1266
|
function createAgentCommand(client, printer) {
|
|
1213
|
-
const cmd = new
|
|
1267
|
+
const cmd = new Command24("agent").description("Manage agent instances");
|
|
1214
1268
|
cmd.addCommand(createAgentCreateCommand(client, printer));
|
|
1215
1269
|
cmd.addCommand(createAgentStartCommand(client, printer));
|
|
1216
1270
|
cmd.addCommand(createAgentStopCommand(client, printer));
|
|
@@ -1219,6 +1273,7 @@ function createAgentCommand(client, printer) {
|
|
|
1219
1273
|
cmd.addCommand(createAgentAdoptCommand(client, printer));
|
|
1220
1274
|
cmd.addCommand(createAgentDestroyCommand(client, printer));
|
|
1221
1275
|
cmd.addCommand(createAgentResolveCommand(client, printer));
|
|
1276
|
+
cmd.addCommand(createAgentOpenCommand(client, printer));
|
|
1222
1277
|
cmd.addCommand(createAgentAttachCommand(client, printer));
|
|
1223
1278
|
cmd.addCommand(createAgentDetachCommand(client, printer));
|
|
1224
1279
|
cmd.addCommand(createAgentRunCommand(client, printer));
|
|
@@ -1231,13 +1286,13 @@ function createAgentCommand(client, printer) {
|
|
|
1231
1286
|
}
|
|
1232
1287
|
|
|
1233
1288
|
// src/commands/help.ts
|
|
1234
|
-
import { Command as
|
|
1235
|
-
import
|
|
1289
|
+
import { Command as Command25 } from "commander";
|
|
1290
|
+
import chalk17 from "chalk";
|
|
1236
1291
|
|
|
1237
1292
|
// package.json
|
|
1238
1293
|
var package_default = {
|
|
1239
1294
|
name: "@actant/cli",
|
|
1240
|
-
version: "0.
|
|
1295
|
+
version: "0.2.0",
|
|
1241
1296
|
description: "CLI for the Actant AI agent platform \u2014 build, manage, and compose AI agents",
|
|
1242
1297
|
type: "module",
|
|
1243
1298
|
license: "MIT",
|
|
@@ -1262,6 +1317,14 @@ var package_default = {
|
|
|
1262
1317
|
"dist",
|
|
1263
1318
|
"scripts/postinstall.mjs"
|
|
1264
1319
|
],
|
|
1320
|
+
main: "./dist/index.js",
|
|
1321
|
+
types: "./dist/index.d.ts",
|
|
1322
|
+
exports: {
|
|
1323
|
+
".": {
|
|
1324
|
+
import: "./dist/index.js",
|
|
1325
|
+
types: "./dist/index.d.ts"
|
|
1326
|
+
}
|
|
1327
|
+
},
|
|
1265
1328
|
bin: {
|
|
1266
1329
|
actant: "./dist/bin/actant.js"
|
|
1267
1330
|
},
|
|
@@ -1278,6 +1341,7 @@ var package_default = {
|
|
|
1278
1341
|
"@actant/acp": "workspace:*",
|
|
1279
1342
|
"@actant/api": "workspace:*",
|
|
1280
1343
|
"@actant/core": "workspace:*",
|
|
1344
|
+
"@actant/pi": "workspace:*",
|
|
1281
1345
|
"@actant/shared": "workspace:*",
|
|
1282
1346
|
"@inquirer/prompts": "^8.3.0",
|
|
1283
1347
|
chalk: "^5.6.2",
|
|
@@ -1291,42 +1355,42 @@ function showOverview() {
|
|
|
1291
1355
|
const version = package_default.version ?? "0.1.0";
|
|
1292
1356
|
const lines = [
|
|
1293
1357
|
"",
|
|
1294
|
-
|
|
1295
|
-
|
|
1358
|
+
chalk17.bold(" Actant \u2014 Build, manage, and compose AI agents"),
|
|
1359
|
+
chalk17.gray(` v${version}`),
|
|
1296
1360
|
"",
|
|
1297
|
-
|
|
1298
|
-
` ${
|
|
1299
|
-
` ${
|
|
1300
|
-
` ${
|
|
1301
|
-
` ${
|
|
1361
|
+
chalk17.bold(" Quick Start:"),
|
|
1362
|
+
` ${chalk17.cyan("actant daemon start")} Start the daemon`,
|
|
1363
|
+
` ${chalk17.cyan("actant agent create my-agent")} Create an Agent`,
|
|
1364
|
+
` ${chalk17.cyan("actant agent start my-agent")} Start an Agent`,
|
|
1365
|
+
` ${chalk17.cyan("actant agent chat my-agent")} Chat with an Agent`,
|
|
1302
1366
|
"",
|
|
1303
|
-
|
|
1304
|
-
` ${
|
|
1305
|
-
` ${
|
|
1306
|
-
` ${
|
|
1307
|
-
` ${
|
|
1367
|
+
chalk17.bold(" Agent Management:"),
|
|
1368
|
+
` ${chalk17.cyan("agent")} create|start|stop|list|chat|run Agent lifecycle`,
|
|
1369
|
+
` ${chalk17.cyan("agent adopt")} <path> Adopt existing workspace`,
|
|
1370
|
+
` ${chalk17.cyan("template")} list|show Agent templates`,
|
|
1371
|
+
` ${chalk17.cyan("proxy")} <name> ACP proxy forwarding`,
|
|
1308
1372
|
"",
|
|
1309
|
-
|
|
1310
|
-
` ${
|
|
1311
|
-
` ${
|
|
1312
|
-
` ${
|
|
1313
|
-
` ${
|
|
1314
|
-
` ${
|
|
1373
|
+
chalk17.bold(" Component Management:"),
|
|
1374
|
+
` ${chalk17.cyan("skill")} list|add|remove|show Manage skills`,
|
|
1375
|
+
` ${chalk17.cyan("prompt")} list|add|remove|show Manage prompts`,
|
|
1376
|
+
` ${chalk17.cyan("mcp")} list|show Manage MCP server configs`,
|
|
1377
|
+
` ${chalk17.cyan("workflow")} list|show Manage workflows`,
|
|
1378
|
+
` ${chalk17.cyan("plugin")} list|add|remove|show Manage plugins`,
|
|
1315
1379
|
"",
|
|
1316
|
-
|
|
1317
|
-
` ${
|
|
1318
|
-
` ${
|
|
1380
|
+
chalk17.bold(" Ecosystem:"),
|
|
1381
|
+
` ${chalk17.cyan("source")} list|add|remove|sync Manage component sources`,
|
|
1382
|
+
` ${chalk17.cyan("preset")} list|apply Manage preset packs`,
|
|
1319
1383
|
"",
|
|
1320
|
-
|
|
1321
|
-
` ${
|
|
1384
|
+
chalk17.bold(" Scheduling:"),
|
|
1385
|
+
` ${chalk17.cyan("schedule")} list Manage employee agent scheduling`,
|
|
1322
1386
|
"",
|
|
1323
|
-
|
|
1324
|
-
` ${
|
|
1325
|
-
` ${
|
|
1326
|
-
` ${
|
|
1387
|
+
chalk17.bold(" System:"),
|
|
1388
|
+
` ${chalk17.cyan("daemon")} start|stop|status Daemon management`,
|
|
1389
|
+
` ${chalk17.cyan("help")} [command] Show help`,
|
|
1390
|
+
` ${chalk17.cyan("--version")} Show version`,
|
|
1327
1391
|
"",
|
|
1328
|
-
|
|
1329
|
-
|
|
1392
|
+
chalk17.bold(" Tips:"),
|
|
1393
|
+
chalk17.gray(" Use 'actant help <command>' for detailed help on a command"),
|
|
1330
1394
|
""
|
|
1331
1395
|
];
|
|
1332
1396
|
process.stdout.write(lines.join("\n"));
|
|
@@ -1337,13 +1401,13 @@ function showCommandHelp(program, commandName) {
|
|
|
1337
1401
|
subcmd.outputHelp();
|
|
1338
1402
|
} else {
|
|
1339
1403
|
process.stdout.write(
|
|
1340
|
-
|
|
1341
|
-
`) +
|
|
1404
|
+
chalk17.red(`Unknown command: ${commandName}
|
|
1405
|
+
`) + chalk17.gray("Run 'actant help' to see available commands.\n")
|
|
1342
1406
|
);
|
|
1343
1407
|
}
|
|
1344
1408
|
}
|
|
1345
1409
|
function createHelpCommand() {
|
|
1346
|
-
return new
|
|
1410
|
+
return new Command25("help").argument("[command]", "Command to get help for").description("Show help information").action(function(command) {
|
|
1347
1411
|
const program = this.parent;
|
|
1348
1412
|
if (command) {
|
|
1349
1413
|
showCommandHelp(program, command);
|
|
@@ -1354,12 +1418,12 @@ function createHelpCommand() {
|
|
|
1354
1418
|
}
|
|
1355
1419
|
|
|
1356
1420
|
// src/commands/skill/index.ts
|
|
1357
|
-
import { Command as
|
|
1421
|
+
import { Command as Command31 } from "commander";
|
|
1358
1422
|
|
|
1359
1423
|
// src/commands/skill/list.ts
|
|
1360
|
-
import { Command as
|
|
1424
|
+
import { Command as Command26 } from "commander";
|
|
1361
1425
|
function createSkillListCommand(client, printer = defaultPrinter) {
|
|
1362
|
-
return new
|
|
1426
|
+
return new Command26("list").alias("ls").description("List all loaded skills").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (opts) => {
|
|
1363
1427
|
try {
|
|
1364
1428
|
const skills = await client.call("skill.list", {});
|
|
1365
1429
|
printer.log(formatSkillList(skills, opts.format));
|
|
@@ -1371,9 +1435,9 @@ function createSkillListCommand(client, printer = defaultPrinter) {
|
|
|
1371
1435
|
}
|
|
1372
1436
|
|
|
1373
1437
|
// src/commands/skill/show.ts
|
|
1374
|
-
import { Command as
|
|
1438
|
+
import { Command as Command27 } from "commander";
|
|
1375
1439
|
function createSkillShowCommand(client, printer = defaultPrinter) {
|
|
1376
|
-
return new
|
|
1440
|
+
return new Command27("show").description("Show skill details").argument("<name>", "Skill name").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (name, opts) => {
|
|
1377
1441
|
try {
|
|
1378
1442
|
const skill = await client.call("skill.get", { name });
|
|
1379
1443
|
printer.log(formatSkillDetail(skill, opts.format));
|
|
@@ -1387,9 +1451,9 @@ function createSkillShowCommand(client, printer = defaultPrinter) {
|
|
|
1387
1451
|
// src/commands/skill/add.ts
|
|
1388
1452
|
import { readFile } from "fs/promises";
|
|
1389
1453
|
import { resolve as resolve4 } from "path";
|
|
1390
|
-
import { Command as
|
|
1454
|
+
import { Command as Command28 } from "commander";
|
|
1391
1455
|
function createSkillAddCommand(client, printer = defaultPrinter) {
|
|
1392
|
-
return new
|
|
1456
|
+
return new Command28("add").description("Add a skill from a JSON file").argument("<file>", "Path to skill definition JSON file").action(async (file) => {
|
|
1393
1457
|
try {
|
|
1394
1458
|
const raw = await readFile(resolve4(file), "utf-8");
|
|
1395
1459
|
const component = JSON.parse(raw);
|
|
@@ -1403,9 +1467,9 @@ function createSkillAddCommand(client, printer = defaultPrinter) {
|
|
|
1403
1467
|
}
|
|
1404
1468
|
|
|
1405
1469
|
// src/commands/skill/remove.ts
|
|
1406
|
-
import { Command as
|
|
1470
|
+
import { Command as Command29 } from "commander";
|
|
1407
1471
|
function createSkillRemoveCommand(client, printer = defaultPrinter) {
|
|
1408
|
-
return new
|
|
1472
|
+
return new Command29("remove").alias("rm").description("Remove a loaded skill").argument("<name>", "Skill name").action(async (name) => {
|
|
1409
1473
|
try {
|
|
1410
1474
|
const result = await client.call("skill.remove", { name });
|
|
1411
1475
|
if (result.success) {
|
|
@@ -1421,9 +1485,9 @@ function createSkillRemoveCommand(client, printer = defaultPrinter) {
|
|
|
1421
1485
|
}
|
|
1422
1486
|
|
|
1423
1487
|
// src/commands/skill/export.ts
|
|
1424
|
-
import { Command as
|
|
1488
|
+
import { Command as Command30 } from "commander";
|
|
1425
1489
|
function createSkillExportCommand(client, printer = defaultPrinter) {
|
|
1426
|
-
return new
|
|
1490
|
+
return new Command30("export").description("Export a skill to a JSON file").argument("<name>", "Skill name").option("-o, --out <file>", "Output file path", "./{name}.json").action(async (name, opts) => {
|
|
1427
1491
|
try {
|
|
1428
1492
|
const outPath = opts.out.replace("{name}", name);
|
|
1429
1493
|
await client.call("skill.export", { name, filePath: outPath });
|
|
@@ -1437,7 +1501,7 @@ function createSkillExportCommand(client, printer = defaultPrinter) {
|
|
|
1437
1501
|
|
|
1438
1502
|
// src/commands/skill/index.ts
|
|
1439
1503
|
function createSkillCommand(client, printer) {
|
|
1440
|
-
const cmd = new
|
|
1504
|
+
const cmd = new Command31("skill").description("Manage loaded skills");
|
|
1441
1505
|
cmd.addCommand(createSkillListCommand(client, printer));
|
|
1442
1506
|
cmd.addCommand(createSkillShowCommand(client, printer));
|
|
1443
1507
|
cmd.addCommand(createSkillAddCommand(client, printer));
|
|
@@ -1447,12 +1511,12 @@ function createSkillCommand(client, printer) {
|
|
|
1447
1511
|
}
|
|
1448
1512
|
|
|
1449
1513
|
// src/commands/prompt/index.ts
|
|
1450
|
-
import { Command as
|
|
1514
|
+
import { Command as Command37 } from "commander";
|
|
1451
1515
|
|
|
1452
1516
|
// src/commands/prompt/list.ts
|
|
1453
|
-
import { Command as
|
|
1517
|
+
import { Command as Command32 } from "commander";
|
|
1454
1518
|
function createPromptListCommand(client, printer = defaultPrinter) {
|
|
1455
|
-
return new
|
|
1519
|
+
return new Command32("list").alias("ls").description("List all loaded prompts").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (opts) => {
|
|
1456
1520
|
try {
|
|
1457
1521
|
const prompts = await client.call("prompt.list", {});
|
|
1458
1522
|
printer.log(formatPromptList(prompts, opts.format));
|
|
@@ -1464,9 +1528,9 @@ function createPromptListCommand(client, printer = defaultPrinter) {
|
|
|
1464
1528
|
}
|
|
1465
1529
|
|
|
1466
1530
|
// src/commands/prompt/show.ts
|
|
1467
|
-
import { Command as
|
|
1531
|
+
import { Command as Command33 } from "commander";
|
|
1468
1532
|
function createPromptShowCommand(client, printer = defaultPrinter) {
|
|
1469
|
-
return new
|
|
1533
|
+
return new Command33("show").description("Show prompt details").argument("<name>", "Prompt name").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (name, opts) => {
|
|
1470
1534
|
try {
|
|
1471
1535
|
const prompt = await client.call("prompt.get", { name });
|
|
1472
1536
|
printer.log(formatPromptDetail(prompt, opts.format));
|
|
@@ -1480,9 +1544,9 @@ function createPromptShowCommand(client, printer = defaultPrinter) {
|
|
|
1480
1544
|
// src/commands/prompt/add.ts
|
|
1481
1545
|
import { readFile as readFile2 } from "fs/promises";
|
|
1482
1546
|
import { resolve as resolve5 } from "path";
|
|
1483
|
-
import { Command as
|
|
1547
|
+
import { Command as Command34 } from "commander";
|
|
1484
1548
|
function createPromptAddCommand(client, printer = defaultPrinter) {
|
|
1485
|
-
return new
|
|
1549
|
+
return new Command34("add").description("Add a prompt from a JSON file").argument("<file>", "Path to prompt definition JSON file").action(async (file) => {
|
|
1486
1550
|
try {
|
|
1487
1551
|
const raw = await readFile2(resolve5(file), "utf-8");
|
|
1488
1552
|
const component = JSON.parse(raw);
|
|
@@ -1496,9 +1560,9 @@ function createPromptAddCommand(client, printer = defaultPrinter) {
|
|
|
1496
1560
|
}
|
|
1497
1561
|
|
|
1498
1562
|
// src/commands/prompt/remove.ts
|
|
1499
|
-
import { Command as
|
|
1563
|
+
import { Command as Command35 } from "commander";
|
|
1500
1564
|
function createPromptRemoveCommand(client, printer = defaultPrinter) {
|
|
1501
|
-
return new
|
|
1565
|
+
return new Command35("remove").alias("rm").description("Remove a loaded prompt").argument("<name>", "Prompt name").action(async (name) => {
|
|
1502
1566
|
try {
|
|
1503
1567
|
const result = await client.call("prompt.remove", { name });
|
|
1504
1568
|
if (result.success) {
|
|
@@ -1514,9 +1578,9 @@ function createPromptRemoveCommand(client, printer = defaultPrinter) {
|
|
|
1514
1578
|
}
|
|
1515
1579
|
|
|
1516
1580
|
// src/commands/prompt/export.ts
|
|
1517
|
-
import { Command as
|
|
1581
|
+
import { Command as Command36 } from "commander";
|
|
1518
1582
|
function createPromptExportCommand(client, printer = defaultPrinter) {
|
|
1519
|
-
return new
|
|
1583
|
+
return new Command36("export").description("Export a prompt to a JSON file").argument("<name>", "Prompt name").option("-o, --out <file>", "Output file path", "./{name}.json").action(async (name, opts) => {
|
|
1520
1584
|
try {
|
|
1521
1585
|
const outPath = opts.out.replace("{name}", name);
|
|
1522
1586
|
await client.call("prompt.export", { name, filePath: outPath });
|
|
@@ -1530,7 +1594,7 @@ function createPromptExportCommand(client, printer = defaultPrinter) {
|
|
|
1530
1594
|
|
|
1531
1595
|
// src/commands/prompt/index.ts
|
|
1532
1596
|
function createPromptCommand(client, printer) {
|
|
1533
|
-
const cmd = new
|
|
1597
|
+
const cmd = new Command37("prompt").description("Manage loaded prompts");
|
|
1534
1598
|
cmd.addCommand(createPromptListCommand(client, printer));
|
|
1535
1599
|
cmd.addCommand(createPromptShowCommand(client, printer));
|
|
1536
1600
|
cmd.addCommand(createPromptAddCommand(client, printer));
|
|
@@ -1540,12 +1604,12 @@ function createPromptCommand(client, printer) {
|
|
|
1540
1604
|
}
|
|
1541
1605
|
|
|
1542
1606
|
// src/commands/mcp/index.ts
|
|
1543
|
-
import { Command as
|
|
1607
|
+
import { Command as Command43 } from "commander";
|
|
1544
1608
|
|
|
1545
1609
|
// src/commands/mcp/list.ts
|
|
1546
|
-
import { Command as
|
|
1610
|
+
import { Command as Command38 } from "commander";
|
|
1547
1611
|
function createMcpListCommand(client, printer = defaultPrinter) {
|
|
1548
|
-
return new
|
|
1612
|
+
return new Command38("list").alias("ls").description("List all loaded MCP server configs").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (opts) => {
|
|
1549
1613
|
try {
|
|
1550
1614
|
const servers = await client.call("mcp.list", {});
|
|
1551
1615
|
printer.log(formatMcpList(servers, opts.format));
|
|
@@ -1557,9 +1621,9 @@ function createMcpListCommand(client, printer = defaultPrinter) {
|
|
|
1557
1621
|
}
|
|
1558
1622
|
|
|
1559
1623
|
// src/commands/mcp/show.ts
|
|
1560
|
-
import { Command as
|
|
1624
|
+
import { Command as Command39 } from "commander";
|
|
1561
1625
|
function createMcpShowCommand(client, printer = defaultPrinter) {
|
|
1562
|
-
return new
|
|
1626
|
+
return new Command39("show").description("Show MCP server config details").argument("<name>", "MCP server name").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (name, opts) => {
|
|
1563
1627
|
try {
|
|
1564
1628
|
const server = await client.call("mcp.get", { name });
|
|
1565
1629
|
printer.log(formatMcpDetail(server, opts.format));
|
|
@@ -1573,9 +1637,9 @@ function createMcpShowCommand(client, printer = defaultPrinter) {
|
|
|
1573
1637
|
// src/commands/mcp/add.ts
|
|
1574
1638
|
import { readFile as readFile3 } from "fs/promises";
|
|
1575
1639
|
import { resolve as resolve6 } from "path";
|
|
1576
|
-
import { Command as
|
|
1640
|
+
import { Command as Command40 } from "commander";
|
|
1577
1641
|
function createMcpAddCommand(client, printer = defaultPrinter) {
|
|
1578
|
-
return new
|
|
1642
|
+
return new Command40("add").description("Add an MCP server config from a JSON file").argument("<file>", "Path to MCP server definition JSON file").action(async (file) => {
|
|
1579
1643
|
try {
|
|
1580
1644
|
const raw = await readFile3(resolve6(file), "utf-8");
|
|
1581
1645
|
const component = JSON.parse(raw);
|
|
@@ -1589,9 +1653,9 @@ function createMcpAddCommand(client, printer = defaultPrinter) {
|
|
|
1589
1653
|
}
|
|
1590
1654
|
|
|
1591
1655
|
// src/commands/mcp/remove.ts
|
|
1592
|
-
import { Command as
|
|
1656
|
+
import { Command as Command41 } from "commander";
|
|
1593
1657
|
function createMcpRemoveCommand(client, printer = defaultPrinter) {
|
|
1594
|
-
return new
|
|
1658
|
+
return new Command41("remove").alias("rm").description("Remove a loaded MCP server config").argument("<name>", "MCP server name").action(async (name) => {
|
|
1595
1659
|
try {
|
|
1596
1660
|
const result = await client.call("mcp.remove", { name });
|
|
1597
1661
|
if (result.success) {
|
|
@@ -1607,9 +1671,9 @@ function createMcpRemoveCommand(client, printer = defaultPrinter) {
|
|
|
1607
1671
|
}
|
|
1608
1672
|
|
|
1609
1673
|
// src/commands/mcp/export.ts
|
|
1610
|
-
import { Command as
|
|
1674
|
+
import { Command as Command42 } from "commander";
|
|
1611
1675
|
function createMcpExportCommand(client, printer = defaultPrinter) {
|
|
1612
|
-
return new
|
|
1676
|
+
return new Command42("export").description("Export an MCP server config to a JSON file").argument("<name>", "MCP server name").option("-o, --out <file>", "Output file path", "./{name}.json").action(async (name, opts) => {
|
|
1613
1677
|
try {
|
|
1614
1678
|
const outPath = opts.out.replace("{name}", name);
|
|
1615
1679
|
await client.call("mcp.export", { name, filePath: outPath });
|
|
@@ -1623,7 +1687,7 @@ function createMcpExportCommand(client, printer = defaultPrinter) {
|
|
|
1623
1687
|
|
|
1624
1688
|
// src/commands/mcp/index.ts
|
|
1625
1689
|
function createMcpCommand(client, printer) {
|
|
1626
|
-
const cmd = new
|
|
1690
|
+
const cmd = new Command43("mcp").description("Manage loaded MCP server configs");
|
|
1627
1691
|
cmd.addCommand(createMcpListCommand(client, printer));
|
|
1628
1692
|
cmd.addCommand(createMcpShowCommand(client, printer));
|
|
1629
1693
|
cmd.addCommand(createMcpAddCommand(client, printer));
|
|
@@ -1633,12 +1697,12 @@ function createMcpCommand(client, printer) {
|
|
|
1633
1697
|
}
|
|
1634
1698
|
|
|
1635
1699
|
// src/commands/workflow/index.ts
|
|
1636
|
-
import { Command as
|
|
1700
|
+
import { Command as Command49 } from "commander";
|
|
1637
1701
|
|
|
1638
1702
|
// src/commands/workflow/list.ts
|
|
1639
|
-
import { Command as
|
|
1703
|
+
import { Command as Command44 } from "commander";
|
|
1640
1704
|
function createWorkflowListCommand(client, printer = defaultPrinter) {
|
|
1641
|
-
return new
|
|
1705
|
+
return new Command44("list").alias("ls").description("List all loaded workflows").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (opts) => {
|
|
1642
1706
|
try {
|
|
1643
1707
|
const workflows = await client.call("workflow.list", {});
|
|
1644
1708
|
printer.log(formatWorkflowList(workflows, opts.format));
|
|
@@ -1650,9 +1714,9 @@ function createWorkflowListCommand(client, printer = defaultPrinter) {
|
|
|
1650
1714
|
}
|
|
1651
1715
|
|
|
1652
1716
|
// src/commands/workflow/show.ts
|
|
1653
|
-
import { Command as
|
|
1717
|
+
import { Command as Command45 } from "commander";
|
|
1654
1718
|
function createWorkflowShowCommand(client, printer = defaultPrinter) {
|
|
1655
|
-
return new
|
|
1719
|
+
return new Command45("show").description("Show workflow details").argument("<name>", "Workflow name").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (name, opts) => {
|
|
1656
1720
|
try {
|
|
1657
1721
|
const workflow = await client.call("workflow.get", { name });
|
|
1658
1722
|
printer.log(formatWorkflowDetail(workflow, opts.format));
|
|
@@ -1666,9 +1730,9 @@ function createWorkflowShowCommand(client, printer = defaultPrinter) {
|
|
|
1666
1730
|
// src/commands/workflow/add.ts
|
|
1667
1731
|
import { readFile as readFile4 } from "fs/promises";
|
|
1668
1732
|
import { resolve as resolve7 } from "path";
|
|
1669
|
-
import { Command as
|
|
1733
|
+
import { Command as Command46 } from "commander";
|
|
1670
1734
|
function createWorkflowAddCommand(client, printer = defaultPrinter) {
|
|
1671
|
-
return new
|
|
1735
|
+
return new Command46("add").description("Add a workflow from a JSON file").argument("<file>", "Path to workflow definition JSON file").action(async (file) => {
|
|
1672
1736
|
try {
|
|
1673
1737
|
const raw = await readFile4(resolve7(file), "utf-8");
|
|
1674
1738
|
const component = JSON.parse(raw);
|
|
@@ -1682,9 +1746,9 @@ function createWorkflowAddCommand(client, printer = defaultPrinter) {
|
|
|
1682
1746
|
}
|
|
1683
1747
|
|
|
1684
1748
|
// src/commands/workflow/remove.ts
|
|
1685
|
-
import { Command as
|
|
1749
|
+
import { Command as Command47 } from "commander";
|
|
1686
1750
|
function createWorkflowRemoveCommand(client, printer = defaultPrinter) {
|
|
1687
|
-
return new
|
|
1751
|
+
return new Command47("remove").alias("rm").description("Remove a loaded workflow").argument("<name>", "Workflow name").action(async (name) => {
|
|
1688
1752
|
try {
|
|
1689
1753
|
const result = await client.call("workflow.remove", { name });
|
|
1690
1754
|
if (result.success) {
|
|
@@ -1700,9 +1764,9 @@ function createWorkflowRemoveCommand(client, printer = defaultPrinter) {
|
|
|
1700
1764
|
}
|
|
1701
1765
|
|
|
1702
1766
|
// src/commands/workflow/export.ts
|
|
1703
|
-
import { Command as
|
|
1767
|
+
import { Command as Command48 } from "commander";
|
|
1704
1768
|
function createWorkflowExportCommand(client, printer = defaultPrinter) {
|
|
1705
|
-
return new
|
|
1769
|
+
return new Command48("export").description("Export a workflow to a JSON file").argument("<name>", "Workflow name").option("-o, --out <file>", "Output file path", "./{name}.json").action(async (name, opts) => {
|
|
1706
1770
|
try {
|
|
1707
1771
|
const outPath = opts.out.replace("{name}", name);
|
|
1708
1772
|
await client.call("workflow.export", { name, filePath: outPath });
|
|
@@ -1716,7 +1780,7 @@ function createWorkflowExportCommand(client, printer = defaultPrinter) {
|
|
|
1716
1780
|
|
|
1717
1781
|
// src/commands/workflow/index.ts
|
|
1718
1782
|
function createWorkflowCommand(client, printer) {
|
|
1719
|
-
const cmd = new
|
|
1783
|
+
const cmd = new Command49("workflow").description("Manage loaded workflows");
|
|
1720
1784
|
cmd.addCommand(createWorkflowListCommand(client, printer));
|
|
1721
1785
|
cmd.addCommand(createWorkflowShowCommand(client, printer));
|
|
1722
1786
|
cmd.addCommand(createWorkflowAddCommand(client, printer));
|
|
@@ -1726,12 +1790,12 @@ function createWorkflowCommand(client, printer) {
|
|
|
1726
1790
|
}
|
|
1727
1791
|
|
|
1728
1792
|
// src/commands/plugin/index.ts
|
|
1729
|
-
import { Command as
|
|
1793
|
+
import { Command as Command55 } from "commander";
|
|
1730
1794
|
|
|
1731
1795
|
// src/commands/plugin/list.ts
|
|
1732
|
-
import { Command as
|
|
1796
|
+
import { Command as Command50 } from "commander";
|
|
1733
1797
|
function createPluginListCommand(client, printer = defaultPrinter) {
|
|
1734
|
-
return new
|
|
1798
|
+
return new Command50("list").alias("ls").description("List all plugins").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (opts) => {
|
|
1735
1799
|
try {
|
|
1736
1800
|
const plugins = await client.call("plugin.list", {});
|
|
1737
1801
|
printer.log(formatPluginList(plugins, opts.format));
|
|
@@ -1743,9 +1807,9 @@ function createPluginListCommand(client, printer = defaultPrinter) {
|
|
|
1743
1807
|
}
|
|
1744
1808
|
|
|
1745
1809
|
// src/commands/plugin/show.ts
|
|
1746
|
-
import { Command as
|
|
1810
|
+
import { Command as Command51 } from "commander";
|
|
1747
1811
|
function createPluginShowCommand(client, printer = defaultPrinter) {
|
|
1748
|
-
return new
|
|
1812
|
+
return new Command51("show").description("Show plugin details").argument("<name>", "Plugin name").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (name, opts) => {
|
|
1749
1813
|
try {
|
|
1750
1814
|
const plugin = await client.call("plugin.get", { name });
|
|
1751
1815
|
printer.log(formatPluginDetail(plugin, opts.format));
|
|
@@ -1759,9 +1823,9 @@ function createPluginShowCommand(client, printer = defaultPrinter) {
|
|
|
1759
1823
|
// src/commands/plugin/add.ts
|
|
1760
1824
|
import { readFile as readFile5 } from "fs/promises";
|
|
1761
1825
|
import { resolve as resolve8 } from "path";
|
|
1762
|
-
import { Command as
|
|
1826
|
+
import { Command as Command52 } from "commander";
|
|
1763
1827
|
function createPluginAddCommand(client, printer = defaultPrinter) {
|
|
1764
|
-
return new
|
|
1828
|
+
return new Command52("add").description("Add a plugin from a JSON file").argument("<file>", "Path to plugin definition JSON file").action(async (file) => {
|
|
1765
1829
|
try {
|
|
1766
1830
|
const raw = await readFile5(resolve8(file), "utf-8");
|
|
1767
1831
|
const component = JSON.parse(raw);
|
|
@@ -1775,9 +1839,9 @@ function createPluginAddCommand(client, printer = defaultPrinter) {
|
|
|
1775
1839
|
}
|
|
1776
1840
|
|
|
1777
1841
|
// src/commands/plugin/remove.ts
|
|
1778
|
-
import { Command as
|
|
1842
|
+
import { Command as Command53 } from "commander";
|
|
1779
1843
|
function createPluginRemoveCommand(client, printer = defaultPrinter) {
|
|
1780
|
-
return new
|
|
1844
|
+
return new Command53("remove").alias("rm").description("Remove a loaded plugin").argument("<name>", "Plugin name").action(async (name) => {
|
|
1781
1845
|
try {
|
|
1782
1846
|
const result = await client.call("plugin.remove", { name });
|
|
1783
1847
|
if (result.success) {
|
|
@@ -1793,9 +1857,9 @@ function createPluginRemoveCommand(client, printer = defaultPrinter) {
|
|
|
1793
1857
|
}
|
|
1794
1858
|
|
|
1795
1859
|
// src/commands/plugin/export.ts
|
|
1796
|
-
import { Command as
|
|
1860
|
+
import { Command as Command54 } from "commander";
|
|
1797
1861
|
function createPluginExportCommand(client, printer = defaultPrinter) {
|
|
1798
|
-
return new
|
|
1862
|
+
return new Command54("export").description("Export a plugin to a JSON file").argument("<name>", "Plugin name").option("-o, --out <file>", "Output file path", "./{name}.json").action(async (name, opts) => {
|
|
1799
1863
|
try {
|
|
1800
1864
|
const outPath = opts.out.replace("{name}", name);
|
|
1801
1865
|
await client.call("plugin.export", { name, filePath: outPath });
|
|
@@ -1809,7 +1873,7 @@ function createPluginExportCommand(client, printer = defaultPrinter) {
|
|
|
1809
1873
|
|
|
1810
1874
|
// src/commands/plugin/index.ts
|
|
1811
1875
|
function createPluginCommand(client, printer) {
|
|
1812
|
-
const cmd = new
|
|
1876
|
+
const cmd = new Command55("plugin").description("Manage loaded plugins");
|
|
1813
1877
|
cmd.addCommand(createPluginListCommand(client, printer));
|
|
1814
1878
|
cmd.addCommand(createPluginShowCommand(client, printer));
|
|
1815
1879
|
cmd.addCommand(createPluginAddCommand(client, printer));
|
|
@@ -1819,12 +1883,12 @@ function createPluginCommand(client, printer) {
|
|
|
1819
1883
|
}
|
|
1820
1884
|
|
|
1821
1885
|
// src/commands/source/index.ts
|
|
1822
|
-
import { Command as
|
|
1886
|
+
import { Command as Command60 } from "commander";
|
|
1823
1887
|
|
|
1824
1888
|
// src/commands/source/list.ts
|
|
1825
|
-
import { Command as
|
|
1889
|
+
import { Command as Command56 } from "commander";
|
|
1826
1890
|
function createSourceListCommand(client, printer = defaultPrinter) {
|
|
1827
|
-
return new
|
|
1891
|
+
return new Command56("list").alias("ls").description("List registered component sources").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (opts) => {
|
|
1828
1892
|
try {
|
|
1829
1893
|
const sources = await client.call("source.list", {});
|
|
1830
1894
|
if (opts.format === "json") {
|
|
@@ -1850,9 +1914,9 @@ function createSourceListCommand(client, printer = defaultPrinter) {
|
|
|
1850
1914
|
}
|
|
1851
1915
|
|
|
1852
1916
|
// src/commands/source/add.ts
|
|
1853
|
-
import { Command as
|
|
1917
|
+
import { Command as Command57 } from "commander";
|
|
1854
1918
|
function createSourceAddCommand(client, printer = defaultPrinter) {
|
|
1855
|
-
return new
|
|
1919
|
+
return new Command57("add").description("Register a component source").argument("<url-or-path>", "GitHub URL or local directory path").requiredOption("--name <name>", "Package name (namespace prefix)").option("--type <type>", "Source type: github, local", "github").option("--branch <branch>", "Git branch (for github type)", "main").action(async (urlOrPath, opts) => {
|
|
1856
1920
|
try {
|
|
1857
1921
|
const config = opts.type === "local" ? { type: "local", path: urlOrPath } : { type: "github", url: urlOrPath, branch: opts.branch };
|
|
1858
1922
|
const result = await client.call("source.add", { name: opts.name, config });
|
|
@@ -1868,9 +1932,9 @@ function createSourceAddCommand(client, printer = defaultPrinter) {
|
|
|
1868
1932
|
}
|
|
1869
1933
|
|
|
1870
1934
|
// src/commands/source/remove.ts
|
|
1871
|
-
import { Command as
|
|
1935
|
+
import { Command as Command58 } from "commander";
|
|
1872
1936
|
function createSourceRemoveCommand(client, printer = defaultPrinter) {
|
|
1873
|
-
return new
|
|
1937
|
+
return new Command58("remove").alias("rm").description("Remove a registered source").argument("<name>", "Source name").action(async (name) => {
|
|
1874
1938
|
try {
|
|
1875
1939
|
const result = await client.call("source.remove", { name });
|
|
1876
1940
|
if (result.success) {
|
|
@@ -1886,19 +1950,19 @@ function createSourceRemoveCommand(client, printer = defaultPrinter) {
|
|
|
1886
1950
|
}
|
|
1887
1951
|
|
|
1888
1952
|
// src/commands/source/sync.ts
|
|
1889
|
-
import
|
|
1890
|
-
import { Command as
|
|
1953
|
+
import chalk18 from "chalk";
|
|
1954
|
+
import { Command as Command59 } from "commander";
|
|
1891
1955
|
function createSourceSyncCommand(client, printer = defaultPrinter) {
|
|
1892
|
-
return new
|
|
1956
|
+
return new Command59("sync").description("Sync component source(s)").argument("[name]", "Source name (syncs all if omitted)").action(async (name) => {
|
|
1893
1957
|
try {
|
|
1894
1958
|
const result = await client.call("source.sync", { name });
|
|
1895
1959
|
printer.success(`Synced: ${result.synced.join(", ")}`);
|
|
1896
1960
|
const report = result.report;
|
|
1897
1961
|
if (report) {
|
|
1898
1962
|
const parts = [];
|
|
1899
|
-
if (report.addedCount > 0) parts.push(
|
|
1900
|
-
if (report.updatedCount > 0) parts.push(
|
|
1901
|
-
if (report.removedCount > 0) parts.push(
|
|
1963
|
+
if (report.addedCount > 0) parts.push(chalk18.green(`+${report.addedCount} added`));
|
|
1964
|
+
if (report.updatedCount > 0) parts.push(chalk18.yellow(`${report.updatedCount} updated`));
|
|
1965
|
+
if (report.removedCount > 0) parts.push(chalk18.red(`-${report.removedCount} removed`));
|
|
1902
1966
|
if (parts.length > 0) {
|
|
1903
1967
|
printer.log(` ${parts.join(", ")}`);
|
|
1904
1968
|
}
|
|
@@ -1915,7 +1979,7 @@ function createSourceSyncCommand(client, printer = defaultPrinter) {
|
|
|
1915
1979
|
|
|
1916
1980
|
// src/commands/source/index.ts
|
|
1917
1981
|
function createSourceCommand(client, printer) {
|
|
1918
|
-
const cmd = new
|
|
1982
|
+
const cmd = new Command60("source").description("Manage component sources (GitHub repos, local dirs)");
|
|
1919
1983
|
cmd.addCommand(createSourceListCommand(client, printer));
|
|
1920
1984
|
cmd.addCommand(createSourceAddCommand(client, printer));
|
|
1921
1985
|
cmd.addCommand(createSourceRemoveCommand(client, printer));
|
|
@@ -1924,12 +1988,12 @@ function createSourceCommand(client, printer) {
|
|
|
1924
1988
|
}
|
|
1925
1989
|
|
|
1926
1990
|
// src/commands/preset/index.ts
|
|
1927
|
-
import { Command as
|
|
1991
|
+
import { Command as Command64 } from "commander";
|
|
1928
1992
|
|
|
1929
1993
|
// src/commands/preset/list.ts
|
|
1930
|
-
import { Command as
|
|
1994
|
+
import { Command as Command61 } from "commander";
|
|
1931
1995
|
function createPresetListCommand(client, printer = defaultPrinter) {
|
|
1932
|
-
return new
|
|
1996
|
+
return new Command61("list").alias("ls").description("List available presets from registered sources").argument("[package]", "Filter by source package name").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (packageName, opts) => {
|
|
1933
1997
|
try {
|
|
1934
1998
|
const presets = await client.call("preset.list", { packageName });
|
|
1935
1999
|
if (opts.format === "json") {
|
|
@@ -1954,9 +2018,9 @@ function createPresetListCommand(client, printer = defaultPrinter) {
|
|
|
1954
2018
|
}
|
|
1955
2019
|
|
|
1956
2020
|
// src/commands/preset/show.ts
|
|
1957
|
-
import { Command as
|
|
2021
|
+
import { Command as Command62 } from "commander";
|
|
1958
2022
|
function createPresetShowCommand(client, printer = defaultPrinter) {
|
|
1959
|
-
return new
|
|
2023
|
+
return new Command62("show").description("Show preset details").argument("<qualified-name>", "Preset qualified name (package@preset)").option("-f, --format <format>", "Output format: table, json", "table").action(async (qualifiedName, opts) => {
|
|
1960
2024
|
try {
|
|
1961
2025
|
const preset = await client.call("preset.show", { qualifiedName });
|
|
1962
2026
|
if (opts.format === "json") {
|
|
@@ -1977,9 +2041,9 @@ function createPresetShowCommand(client, printer = defaultPrinter) {
|
|
|
1977
2041
|
}
|
|
1978
2042
|
|
|
1979
2043
|
// src/commands/preset/apply.ts
|
|
1980
|
-
import { Command as
|
|
2044
|
+
import { Command as Command63 } from "commander";
|
|
1981
2045
|
function createPresetApplyCommand(client, printer = defaultPrinter) {
|
|
1982
|
-
return new
|
|
2046
|
+
return new Command63("apply").description("Apply a preset to a template (adds all preset components)").argument("<qualified-name>", "Preset qualified name (package@preset)").argument("<template>", "Template name to apply to").action(async (qualifiedName, templateName) => {
|
|
1983
2047
|
try {
|
|
1984
2048
|
const result = await client.call("preset.apply", { qualifiedName, templateName });
|
|
1985
2049
|
printer.success(`Preset "${qualifiedName}" applied to template "${result.name}".`);
|
|
@@ -1992,7 +2056,7 @@ function createPresetApplyCommand(client, printer = defaultPrinter) {
|
|
|
1992
2056
|
|
|
1993
2057
|
// src/commands/preset/index.ts
|
|
1994
2058
|
function createPresetCommand(client, printer) {
|
|
1995
|
-
const cmd = new
|
|
2059
|
+
const cmd = new Command64("preset").description("Manage component presets (bundled compositions)");
|
|
1996
2060
|
cmd.addCommand(createPresetListCommand(client, printer));
|
|
1997
2061
|
cmd.addCommand(createPresetShowCommand(client, printer));
|
|
1998
2062
|
cmd.addCommand(createPresetApplyCommand(client, printer));
|
|
@@ -2000,12 +2064,12 @@ function createPresetCommand(client, printer) {
|
|
|
2000
2064
|
}
|
|
2001
2065
|
|
|
2002
2066
|
// src/commands/schedule/index.ts
|
|
2003
|
-
import { Command as
|
|
2067
|
+
import { Command as Command66 } from "commander";
|
|
2004
2068
|
|
|
2005
2069
|
// src/commands/schedule/list.ts
|
|
2006
|
-
import { Command as
|
|
2070
|
+
import { Command as Command65 } from "commander";
|
|
2007
2071
|
function createScheduleListCommand(client, printer = defaultPrinter) {
|
|
2008
|
-
return new
|
|
2072
|
+
return new Command65("list").alias("ls").description("List schedule sources for an agent").argument("<name>", "Agent name").option("-f, --format <format>", "Output format: table, json", "table").action(async (name, opts) => {
|
|
2009
2073
|
try {
|
|
2010
2074
|
const result = await client.call("schedule.list", { name });
|
|
2011
2075
|
if (opts.format === "json") {
|
|
@@ -2029,31 +2093,31 @@ function createScheduleListCommand(client, printer = defaultPrinter) {
|
|
|
2029
2093
|
|
|
2030
2094
|
// src/commands/schedule/index.ts
|
|
2031
2095
|
function createScheduleCommand(client, printer) {
|
|
2032
|
-
const cmd = new
|
|
2096
|
+
const cmd = new Command66("schedule").description("Manage agent schedules (heartbeat, cron, hooks)");
|
|
2033
2097
|
cmd.addCommand(createScheduleListCommand(client, printer));
|
|
2034
2098
|
return cmd;
|
|
2035
2099
|
}
|
|
2036
2100
|
|
|
2037
2101
|
// src/commands/daemon/index.ts
|
|
2038
|
-
import { Command as
|
|
2102
|
+
import { Command as Command70 } from "commander";
|
|
2039
2103
|
|
|
2040
2104
|
// src/commands/daemon/start.ts
|
|
2041
|
-
import { Command as
|
|
2105
|
+
import { Command as Command67 } from "commander";
|
|
2042
2106
|
import { join } from "path";
|
|
2043
|
-
import { fork, spawn } from "child_process";
|
|
2044
|
-
import
|
|
2107
|
+
import { fork, spawn as spawn2 } from "child_process";
|
|
2108
|
+
import chalk19 from "chalk";
|
|
2045
2109
|
import { onShutdownSignal, isWindows, isSingleExecutable } from "@actant/shared";
|
|
2046
2110
|
var SEA_DAEMON_FLAG = "--__actant-daemon";
|
|
2047
2111
|
function spawnDaemonChild() {
|
|
2048
2112
|
if (isSingleExecutable()) {
|
|
2049
|
-
return
|
|
2113
|
+
return spawn2(process.execPath, [SEA_DAEMON_FLAG], {
|
|
2050
2114
|
detached: true,
|
|
2051
2115
|
stdio: ["ignore", "ignore", "pipe"],
|
|
2052
2116
|
env: process.env
|
|
2053
2117
|
});
|
|
2054
2118
|
}
|
|
2055
2119
|
const daemonScript = join(import.meta.dirname, "daemon-entry.js");
|
|
2056
|
-
return isWindows() ?
|
|
2120
|
+
return isWindows() ? spawn2(process.execPath, [daemonScript], {
|
|
2057
2121
|
detached: true,
|
|
2058
2122
|
stdio: ["ignore", "ignore", "pipe"],
|
|
2059
2123
|
env: process.env
|
|
@@ -2064,7 +2128,7 @@ function spawnDaemonChild() {
|
|
|
2064
2128
|
});
|
|
2065
2129
|
}
|
|
2066
2130
|
function createDaemonStartCommand(printer = defaultPrinter) {
|
|
2067
|
-
return new
|
|
2131
|
+
return new Command67("start").description("Start the Actant daemon").option("--foreground", "Run in foreground (don't daemonize)", false).action(async (opts) => {
|
|
2068
2132
|
const client = new RpcClient(defaultSocketPath());
|
|
2069
2133
|
const alive = await client.ping();
|
|
2070
2134
|
if (alive) {
|
|
@@ -2080,7 +2144,7 @@ function createDaemonStartCommand(printer = defaultPrinter) {
|
|
|
2080
2144
|
process.exit(0);
|
|
2081
2145
|
});
|
|
2082
2146
|
await daemon.start();
|
|
2083
|
-
printer.log(`${
|
|
2147
|
+
printer.log(`${chalk19.green("Daemon started (foreground).")} PID: ${process.pid}`);
|
|
2084
2148
|
printer.dim("Press Ctrl+C to stop.");
|
|
2085
2149
|
await new Promise(() => {
|
|
2086
2150
|
});
|
|
@@ -2118,7 +2182,7 @@ function createDaemonStartCommand(printer = defaultPrinter) {
|
|
|
2118
2182
|
if ("connected" in child && child.connected) child.disconnect();
|
|
2119
2183
|
child.unref();
|
|
2120
2184
|
if (healthy) {
|
|
2121
|
-
printer.log(`${
|
|
2185
|
+
printer.log(`${chalk19.green("Daemon started.")} PID: ${child.pid}`);
|
|
2122
2186
|
} else {
|
|
2123
2187
|
const stderr = Buffer.concat(stderrChunks).toString().trim();
|
|
2124
2188
|
printer.error("Daemon process started but is not responding.");
|
|
@@ -2130,9 +2194,9 @@ function createDaemonStartCommand(printer = defaultPrinter) {
|
|
|
2130
2194
|
}
|
|
2131
2195
|
|
|
2132
2196
|
// src/commands/daemon/stop.ts
|
|
2133
|
-
import { Command as
|
|
2197
|
+
import { Command as Command68 } from "commander";
|
|
2134
2198
|
function createDaemonStopCommand(printer = defaultPrinter, client) {
|
|
2135
|
-
return new
|
|
2199
|
+
return new Command68("stop").description("Stop the Actant daemon").action(async () => {
|
|
2136
2200
|
const rpc = client ?? new RpcClient(defaultSocketPath());
|
|
2137
2201
|
try {
|
|
2138
2202
|
await rpc.call("daemon.shutdown", {});
|
|
@@ -2144,10 +2208,10 @@ function createDaemonStopCommand(printer = defaultPrinter, client) {
|
|
|
2144
2208
|
}
|
|
2145
2209
|
|
|
2146
2210
|
// src/commands/daemon/status.ts
|
|
2147
|
-
import { Command as
|
|
2148
|
-
import
|
|
2211
|
+
import { Command as Command69 } from "commander";
|
|
2212
|
+
import chalk20 from "chalk";
|
|
2149
2213
|
function createDaemonStatusCommand(printer = defaultPrinter) {
|
|
2150
|
-
return new
|
|
2214
|
+
return new Command69("status").description("Check if the daemon is running").option("-f, --format <format>", "Output format: table, json, quiet", "table").action(async (opts) => {
|
|
2151
2215
|
const client = new RpcClient(defaultSocketPath());
|
|
2152
2216
|
try {
|
|
2153
2217
|
const result = await client.call("daemon.ping", {});
|
|
@@ -2167,7 +2231,7 @@ function createDaemonStatusCommand(printer = defaultPrinter) {
|
|
|
2167
2231
|
} else if (opts.format === "quiet") {
|
|
2168
2232
|
printer.log("stopped");
|
|
2169
2233
|
} else {
|
|
2170
|
-
printer.log(
|
|
2234
|
+
printer.log(chalk20.red("Daemon is not running."));
|
|
2171
2235
|
printer.dim("Start with: actant daemon start");
|
|
2172
2236
|
}
|
|
2173
2237
|
process.exitCode = 1;
|
|
@@ -2177,7 +2241,7 @@ function createDaemonStatusCommand(printer = defaultPrinter) {
|
|
|
2177
2241
|
|
|
2178
2242
|
// src/commands/daemon/index.ts
|
|
2179
2243
|
function createDaemonCommand(printer) {
|
|
2180
|
-
const cmd = new
|
|
2244
|
+
const cmd = new Command70("daemon").description("Manage the Actant daemon");
|
|
2181
2245
|
cmd.addCommand(createDaemonStartCommand(printer));
|
|
2182
2246
|
cmd.addCommand(createDaemonStopCommand(printer));
|
|
2183
2247
|
cmd.addCommand(createDaemonStatusCommand(printer));
|
|
@@ -2185,11 +2249,11 @@ function createDaemonCommand(printer) {
|
|
|
2185
2249
|
}
|
|
2186
2250
|
|
|
2187
2251
|
// src/commands/proxy.ts
|
|
2188
|
-
import { Command as
|
|
2189
|
-
import { spawn as
|
|
2252
|
+
import { Command as Command71 } from "commander";
|
|
2253
|
+
import { spawn as spawn3 } from "child_process";
|
|
2190
2254
|
import { createInterface as createInterface3 } from "readline";
|
|
2191
2255
|
function createProxyCommand(printer = defaultPrinter) {
|
|
2192
|
-
return new
|
|
2256
|
+
return new Command71("proxy").description("Run an ACP proxy for an agent (stdin/stdout ACP protocol)").argument("<name>", "Agent name to proxy").option("--lease", "Use Session Lease mode (requires running agent)", false).option("-t, --template <template>", "Template name (auto-creates instance if not found)").action(async (name, opts) => {
|
|
2193
2257
|
if (opts.lease) {
|
|
2194
2258
|
await runSessionLease(name, printer);
|
|
2195
2259
|
} else {
|
|
@@ -2254,7 +2318,7 @@ async function runDirectBridge(name, opts, printer) {
|
|
|
2254
2318
|
const command = targetInstance.command;
|
|
2255
2319
|
const args = targetInstance.args;
|
|
2256
2320
|
const env = { ...process.env, ...targetInstance.env };
|
|
2257
|
-
child =
|
|
2321
|
+
child = spawn3(command, args, {
|
|
2258
2322
|
cwd: workspaceDir,
|
|
2259
2323
|
stdio: ["pipe", "pipe", "pipe"],
|
|
2260
2324
|
env
|
|
@@ -2507,14 +2571,14 @@ function writeAcpError(id, code, message) {
|
|
|
2507
2571
|
}
|
|
2508
2572
|
|
|
2509
2573
|
// src/commands/self-update.ts
|
|
2510
|
-
import { Command as
|
|
2511
|
-
import { spawn as
|
|
2574
|
+
import { Command as Command72 } from "commander";
|
|
2575
|
+
import { spawn as spawn4 } from "child_process";
|
|
2512
2576
|
import { writeFileSync, mkdirSync, readFileSync, existsSync as existsSync2 } from "fs";
|
|
2513
2577
|
import { join as join2 } from "path";
|
|
2514
2578
|
import { homedir } from "os";
|
|
2515
|
-
import
|
|
2579
|
+
import chalk21 from "chalk";
|
|
2516
2580
|
function createSelfUpdateCommand() {
|
|
2517
|
-
return new
|
|
2581
|
+
return new Command72("self-update").description("Update Actant from local source").option("--source <path>", "Source directory path").option("--check", "Only check for updates, don't apply").option("--force", "Skip active session warnings").option("--dry-run", "Show what would be done without doing it").option("--no-agent", "Skip agent supervisor, run script directly").option("--skip-build", "Skip build step (use pre-built dist)").action(async (opts) => {
|
|
2518
2582
|
const actantHome = process.env.ACTANT_HOME || join2(homedir(), ".actant");
|
|
2519
2583
|
let devSourcePath = opts.source;
|
|
2520
2584
|
if (!devSourcePath) {
|
|
@@ -2527,7 +2591,7 @@ function createSelfUpdateCommand() {
|
|
|
2527
2591
|
}
|
|
2528
2592
|
if (!devSourcePath) {
|
|
2529
2593
|
console.error(
|
|
2530
|
-
|
|
2594
|
+
chalk21.red(
|
|
2531
2595
|
"No source path specified. Use --source <path> or set devSourcePath in ~/.actant/config.json"
|
|
2532
2596
|
)
|
|
2533
2597
|
);
|
|
@@ -2562,37 +2626,37 @@ function createSelfUpdateCommand() {
|
|
|
2562
2626
|
};
|
|
2563
2627
|
mkdirSync(actantHome, { recursive: true });
|
|
2564
2628
|
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
2565
|
-
console.log(
|
|
2629
|
+
console.log(chalk21.cyan("=== Actant Self-Update ==="));
|
|
2566
2630
|
console.log(`Update ID: ${updateId}`);
|
|
2567
2631
|
console.log(`Source: ${devSourcePath}`);
|
|
2568
2632
|
const scriptPath = join2(devSourcePath, "scripts", "self-update.js");
|
|
2569
2633
|
const scriptArgs = ["--manifest", manifestPath];
|
|
2570
2634
|
if (opts.dryRun) scriptArgs.push("--dry-run");
|
|
2571
2635
|
if (opts.skipBuild) scriptArgs.push("--skip-build");
|
|
2572
|
-
console.log(
|
|
2573
|
-
const child =
|
|
2636
|
+
console.log(chalk21.gray(`Spawning: node ${scriptPath} ${scriptArgs.join(" ")}`));
|
|
2637
|
+
const child = spawn4("node", [scriptPath, ...scriptArgs], {
|
|
2574
2638
|
detached: !opts.noAgent,
|
|
2575
2639
|
stdio: opts.noAgent ? "inherit" : "ignore"
|
|
2576
2640
|
});
|
|
2577
2641
|
if (!opts.noAgent) {
|
|
2578
2642
|
child.unref();
|
|
2579
|
-
console.log(
|
|
2580
|
-
console.log(
|
|
2643
|
+
console.log(chalk21.green("Update script spawned in background. Check logs at:"));
|
|
2644
|
+
console.log(chalk21.gray(` ${join2(actantHome, "logs", `update-${updateId}.log`)}`));
|
|
2581
2645
|
} else {
|
|
2582
2646
|
child.on("exit", (code) => {
|
|
2583
2647
|
if (code === 0) {
|
|
2584
|
-
console.log(
|
|
2648
|
+
console.log(chalk21.green("\nUpdate completed successfully!"));
|
|
2585
2649
|
} else if (code === 1) {
|
|
2586
|
-
console.log(
|
|
2650
|
+
console.log(chalk21.yellow("\nUpdate failed, rolled back to previous version."));
|
|
2587
2651
|
} else {
|
|
2588
|
-
console.log(
|
|
2652
|
+
console.log(chalk21.red("\nSevere failure \u2014 manual intervention may be needed."));
|
|
2589
2653
|
}
|
|
2590
2654
|
});
|
|
2591
2655
|
}
|
|
2592
2656
|
});
|
|
2593
2657
|
}
|
|
2594
2658
|
function showVersionCheck(sourcePath, actantHome) {
|
|
2595
|
-
console.log(
|
|
2659
|
+
console.log(chalk21.cyan("=== Version Check ==="));
|
|
2596
2660
|
try {
|
|
2597
2661
|
const pkg = JSON.parse(readFileSync(join2(sourcePath, "package.json"), "utf-8"));
|
|
2598
2662
|
console.log(`Source version: ${pkg.version || "unknown"}`);
|
|
@@ -2609,8 +2673,8 @@ function showVersionCheck(sourcePath, actantHome) {
|
|
|
2609
2673
|
}
|
|
2610
2674
|
|
|
2611
2675
|
// src/commands/setup/setup.ts
|
|
2612
|
-
import { Command as
|
|
2613
|
-
import
|
|
2676
|
+
import { Command as Command73 } from "commander";
|
|
2677
|
+
import chalk29 from "chalk";
|
|
2614
2678
|
import { getDefaultIpcPath } from "@actant/shared";
|
|
2615
2679
|
|
|
2616
2680
|
// src/commands/setup/steps/choose-home.ts
|
|
@@ -2618,7 +2682,7 @@ import { join as join3 } from "path";
|
|
|
2618
2682
|
import { homedir as homedir2 } from "os";
|
|
2619
2683
|
import { mkdirSync as mkdirSync2, existsSync as existsSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
2620
2684
|
import { select, input } from "@inquirer/prompts";
|
|
2621
|
-
import
|
|
2685
|
+
import chalk22 from "chalk";
|
|
2622
2686
|
var DEFAULT_HOME = join3(homedir2(), ".actant");
|
|
2623
2687
|
var SUBDIRS = [
|
|
2624
2688
|
"configs/skills",
|
|
@@ -2634,7 +2698,7 @@ var SUBDIRS = [
|
|
|
2634
2698
|
];
|
|
2635
2699
|
async function chooseHome(printer) {
|
|
2636
2700
|
printer.log(`
|
|
2637
|
-
${
|
|
2701
|
+
${chalk22.cyan("[ Step 1/7 ]")} ${chalk22.bold("\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55")}
|
|
2638
2702
|
`);
|
|
2639
2703
|
const choice = await select({
|
|
2640
2704
|
message: "Actant \u5DE5\u4F5C\u76EE\u5F55 (ACTANT_HOME):",
|
|
@@ -2674,7 +2738,7 @@ ${chalk20.cyan("[ Step 1/7 ]")} ${chalk20.bold("\u9009\u62E9\u5DE5\u4F5C\u76EE\u
|
|
|
2674
2738
|
if (actantHome !== DEFAULT_HOME) {
|
|
2675
2739
|
printer.warn(
|
|
2676
2740
|
` \u8BF7\u5C06\u4EE5\u4E0B\u5185\u5BB9\u6DFB\u52A0\u5230\u4F60\u7684 shell \u914D\u7F6E\u6587\u4EF6 (~/.bashrc, ~/.zshrc, \u6216 $PROFILE):
|
|
2677
|
-
${
|
|
2741
|
+
${chalk22.cyan(`export ACTANT_HOME="${actantHome}"`)}`
|
|
2678
2742
|
);
|
|
2679
2743
|
}
|
|
2680
2744
|
return actantHome;
|
|
@@ -2689,7 +2753,7 @@ function ensureDirectoryStructure(base) {
|
|
|
2689
2753
|
import { join as join4 } from "path";
|
|
2690
2754
|
import { readFileSync as readFileSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
2691
2755
|
import { select as select2, input as input2, password, confirm } from "@inquirer/prompts";
|
|
2692
|
-
import
|
|
2756
|
+
import chalk23 from "chalk";
|
|
2693
2757
|
var PROVIDER_DEFAULTS = {
|
|
2694
2758
|
anthropic: { protocol: "http", baseUrl: "https://api.anthropic.com", apiKeyEnv: "ANTHROPIC_API_KEY" },
|
|
2695
2759
|
openai: { protocol: "http", baseUrl: "https://api.openai.com/v1", apiKeyEnv: "OPENAI_API_KEY" },
|
|
@@ -2698,7 +2762,7 @@ var PROVIDER_DEFAULTS = {
|
|
|
2698
2762
|
};
|
|
2699
2763
|
async function configureProvider(printer, actantHome) {
|
|
2700
2764
|
printer.log(`
|
|
2701
|
-
${
|
|
2765
|
+
${chalk23.cyan("[ Step 2/7 ]")} ${chalk23.bold("\u914D\u7F6E Model Provider")}
|
|
2702
2766
|
`);
|
|
2703
2767
|
const providerType = await select2({
|
|
2704
2768
|
message: "\u9009\u62E9 Model Provider:",
|
|
@@ -2751,7 +2815,7 @@ ${chalk21.cyan("[ Step 2/7 ]")} ${chalk21.bold("\u914D\u7F6E Model Provider")}
|
|
|
2751
2815
|
default: true
|
|
2752
2816
|
});
|
|
2753
2817
|
if (shouldValidate) {
|
|
2754
|
-
printer.log(
|
|
2818
|
+
printer.log(chalk23.dim(" \u6B63\u5728\u9A8C\u8BC1\u8FDE\u63A5..."));
|
|
2755
2819
|
const ok = await validateConnection(providerType, protocol, baseUrl, apiKey);
|
|
2756
2820
|
if (ok) {
|
|
2757
2821
|
printer.success(" \u2713 \u8FDE\u63A5\u9A8C\u8BC1\u6210\u529F");
|
|
@@ -2760,8 +2824,8 @@ ${chalk21.cyan("[ Step 2/7 ]")} ${chalk21.bold("\u914D\u7F6E Model Provider")}
|
|
|
2760
2824
|
}
|
|
2761
2825
|
}
|
|
2762
2826
|
printer.warn(
|
|
2763
|
-
` \u8BF7\u786E\u4FDD\u73AF\u5883\u53D8\u91CF ${
|
|
2764
|
-
${
|
|
2827
|
+
` \u8BF7\u786E\u4FDD\u73AF\u5883\u53D8\u91CF ${chalk23.cyan(apiKeyEnvName)} \u5DF2\u8BBE\u7F6E:
|
|
2828
|
+
${chalk23.dim(`export ${apiKeyEnvName}="${apiKey.slice(0, 8)}..."`)}`
|
|
2765
2829
|
);
|
|
2766
2830
|
}
|
|
2767
2831
|
const providerConfig = {
|
|
@@ -2821,12 +2885,12 @@ async function validateConnection(type, _protocol, baseUrl, apiKey) {
|
|
|
2821
2885
|
|
|
2822
2886
|
// src/commands/setup/steps/configure-source.ts
|
|
2823
2887
|
import { confirm as confirm2, input as input3, select as select3 } from "@inquirer/prompts";
|
|
2824
|
-
import
|
|
2888
|
+
import chalk24 from "chalk";
|
|
2825
2889
|
var DEFAULT_SOURCE_NAME = "actant-hub";
|
|
2826
2890
|
var DEFAULT_SOURCE_URL = "https://github.com/blackplume233/actant-hub.git";
|
|
2827
2891
|
async function configureSource(printer, client) {
|
|
2828
2892
|
printer.log(`
|
|
2829
|
-
${
|
|
2893
|
+
${chalk24.cyan("[ Step 3/7 ]")} ${chalk24.bold("\u914D\u7F6E\u7EC4\u4EF6\u6E90 (Source)")}
|
|
2830
2894
|
`);
|
|
2831
2895
|
const addDefault = await confirm2({
|
|
2832
2896
|
message: `\u6DFB\u52A0\u5B98\u65B9\u7EC4\u4EF6\u6E90 ${DEFAULT_SOURCE_NAME}?`,
|
|
@@ -2834,7 +2898,7 @@ ${chalk22.cyan("[ Step 3/7 ]")} ${chalk22.bold("\u914D\u7F6E\u7EC4\u4EF6\u6E90 (
|
|
|
2834
2898
|
});
|
|
2835
2899
|
if (addDefault) {
|
|
2836
2900
|
try {
|
|
2837
|
-
printer.log(
|
|
2901
|
+
printer.log(chalk24.dim(` \u6B63\u5728\u6CE8\u518C ${DEFAULT_SOURCE_NAME}...`));
|
|
2838
2902
|
const result = await client.call("source.add", {
|
|
2839
2903
|
name: DEFAULT_SOURCE_NAME,
|
|
2840
2904
|
config: { type: "github", url: DEFAULT_SOURCE_URL, branch: "main" }
|
|
@@ -2918,10 +2982,10 @@ ${chalk22.cyan("[ Step 3/7 ]")} ${chalk22.bold("\u914D\u7F6E\u7EC4\u4EF6\u6E90 (
|
|
|
2918
2982
|
|
|
2919
2983
|
// src/commands/setup/steps/materialize-agent.ts
|
|
2920
2984
|
import { checkbox, input as input4 } from "@inquirer/prompts";
|
|
2921
|
-
import
|
|
2985
|
+
import chalk25 from "chalk";
|
|
2922
2986
|
async function materializeAgent(printer, client) {
|
|
2923
2987
|
printer.log(`
|
|
2924
|
-
${
|
|
2988
|
+
${chalk25.cyan("[ Step 4/7 ]")} ${chalk25.bold("\u9009\u62E9\u5E76\u521B\u5EFA Agent")}
|
|
2925
2989
|
`);
|
|
2926
2990
|
let templates;
|
|
2927
2991
|
try {
|
|
@@ -2959,7 +3023,7 @@ ${chalk23.cyan("[ Step 4/7 ]")} ${chalk23.bold("\u9009\u62E9\u5E76\u521B\u5EFA A
|
|
|
2959
3023
|
}
|
|
2960
3024
|
});
|
|
2961
3025
|
try {
|
|
2962
|
-
printer.log(
|
|
3026
|
+
printer.log(chalk25.dim(` \u6B63\u5728\u521B\u5EFA ${instanceName.trim()}...`));
|
|
2963
3027
|
await client.call("agent.create", {
|
|
2964
3028
|
name: instanceName.trim(),
|
|
2965
3029
|
template: templateName
|
|
@@ -2982,15 +3046,15 @@ import { writeFileSync as writeFileSync4, mkdirSync as mkdirSync3 } from "fs";
|
|
|
2982
3046
|
import { join as join5 } from "path";
|
|
2983
3047
|
import { homedir as homedir3 } from "os";
|
|
2984
3048
|
import { confirm as confirm3 } from "@inquirer/prompts";
|
|
2985
|
-
import
|
|
3049
|
+
import chalk26 from "chalk";
|
|
2986
3050
|
import { isWindows as isWindows2 } from "@actant/shared";
|
|
2987
3051
|
async function configureAutostart(printer) {
|
|
2988
3052
|
printer.log(`
|
|
2989
|
-
${
|
|
3053
|
+
${chalk26.cyan("[ Step 5/7 ]")} ${chalk26.bold("\u914D\u7F6E\u81EA\u52A8\u542F\u52A8")}
|
|
2990
3054
|
`);
|
|
2991
3055
|
const platform = process.platform;
|
|
2992
3056
|
const platformName = platform === "win32" ? "Windows" : platform === "darwin" ? "macOS" : "Linux";
|
|
2993
|
-
printer.log(` \u68C0\u6D4B\u5230\u5E73\u53F0: ${
|
|
3057
|
+
printer.log(` \u68C0\u6D4B\u5230\u5E73\u53F0: ${chalk26.bold(platformName)}`);
|
|
2994
3058
|
const enable = await confirm3({
|
|
2995
3059
|
message: "\u914D\u7F6E Actant Daemon \u5F00\u673A\u81EA\u542F?",
|
|
2996
3060
|
default: true
|
|
@@ -3014,7 +3078,7 @@ ${chalk24.cyan("[ Step 5/7 ]")} ${chalk24.bold("\u914D\u7F6E\u81EA\u52A8\u542F\u
|
|
|
3014
3078
|
}
|
|
3015
3079
|
}
|
|
3016
3080
|
function configureWindows(printer) {
|
|
3017
|
-
printer.log(
|
|
3081
|
+
printer.log(chalk26.dim(" \u6B63\u5728\u6CE8\u518C Windows Task Scheduler \u4EFB\u52A1..."));
|
|
3018
3082
|
const actantPath = findActantExecutable();
|
|
3019
3083
|
const taskXml = `<?xml version="1.0" encoding="UTF-16"?>
|
|
3020
3084
|
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
@@ -3048,7 +3112,7 @@ function configureWindows(printer) {
|
|
|
3048
3112
|
printer.dim(" \u5DF2\u6CE8\u518C\u4EFB\u52A1: ActantDaemon (\u767B\u5F55\u65F6\u81EA\u52A8\u542F\u52A8)");
|
|
3049
3113
|
}
|
|
3050
3114
|
function configureMacOS(printer) {
|
|
3051
|
-
printer.log(
|
|
3115
|
+
printer.log(chalk26.dim(" \u6B63\u5728\u751F\u6210 launchd plist..."));
|
|
3052
3116
|
const actantPath = findActantExecutable();
|
|
3053
3117
|
const plistDir = join5(homedir3(), "Library", "LaunchAgents");
|
|
3054
3118
|
mkdirSync3(plistDir, { recursive: true });
|
|
@@ -3081,7 +3145,7 @@ function configureMacOS(printer) {
|
|
|
3081
3145
|
printer.dim(` \u5DF2\u52A0\u8F7D: ${plistPath}`);
|
|
3082
3146
|
}
|
|
3083
3147
|
function configureLinux(printer) {
|
|
3084
|
-
printer.log(
|
|
3148
|
+
printer.log(chalk26.dim(" \u6B63\u5728\u751F\u6210 systemd user service..."));
|
|
3085
3149
|
const actantPath = findActantExecutable();
|
|
3086
3150
|
const serviceDir = join5(homedir3(), ".config", "systemd", "user");
|
|
3087
3151
|
mkdirSync3(serviceDir, { recursive: true });
|
|
@@ -3119,10 +3183,10 @@ function findActantExecutable() {
|
|
|
3119
3183
|
}
|
|
3120
3184
|
|
|
3121
3185
|
// src/commands/setup/steps/hello-world.ts
|
|
3122
|
-
import
|
|
3186
|
+
import chalk27 from "chalk";
|
|
3123
3187
|
async function helloWorld(printer, client, createdAgents) {
|
|
3124
3188
|
printer.log(`
|
|
3125
|
-
${
|
|
3189
|
+
${chalk27.cyan("[ Step 6/7 ]")} ${chalk27.bold("Hello World \u9A8C\u8BC1")}
|
|
3126
3190
|
`);
|
|
3127
3191
|
const alive = await client.ping();
|
|
3128
3192
|
if (!alive) {
|
|
@@ -3141,12 +3205,12 @@ ${chalk25.cyan("[ Step 6/7 ]")} ${chalk25.bold("Hello World \u9A8C\u8BC1")}
|
|
|
3141
3205
|
printer.dim(" \u65E0\u53EF\u7528 Agent\uFF0C\u8DF3\u8FC7\u7AEF\u5230\u7AEF\u9A8C\u8BC1");
|
|
3142
3206
|
return;
|
|
3143
3207
|
}
|
|
3144
|
-
printer.log(
|
|
3208
|
+
printer.log(chalk27.dim(` \u6B63\u5728\u4F7F\u7528 Agent "${testAgent}" \u8FDB\u884C\u9A8C\u8BC1...`));
|
|
3145
3209
|
try {
|
|
3146
3210
|
await client.call("agent.start", { name: testAgent });
|
|
3147
3211
|
printer.success(` \u2713 Agent "${testAgent}" \u5DF2\u542F\u52A8`);
|
|
3148
3212
|
await waitForAgentReady(client, testAgent, 15e3);
|
|
3149
|
-
printer.log(
|
|
3213
|
+
printer.log(chalk27.dim(` \u53D1\u9001\u6D4B\u8BD5\u6D88\u606F: "Hello, World!"`));
|
|
3150
3214
|
const runResult = await client.call("agent.run", {
|
|
3151
3215
|
name: testAgent,
|
|
3152
3216
|
prompt: "Please respond with exactly: Hello from Actant! (keep it short)"
|
|
@@ -3185,7 +3249,7 @@ async function waitForAgentReady(client, name, timeoutMs) {
|
|
|
3185
3249
|
import { join as join6 } from "path";
|
|
3186
3250
|
import { readFileSync as readFileSync3, writeFileSync as writeFileSync5, existsSync as existsSync4 } from "fs";
|
|
3187
3251
|
import { confirm as confirm4, input as input5 } from "@inquirer/prompts";
|
|
3188
|
-
import
|
|
3252
|
+
import chalk28 from "chalk";
|
|
3189
3253
|
function detectDevSourcePath() {
|
|
3190
3254
|
const candidates = [
|
|
3191
3255
|
process.cwd(),
|
|
@@ -3200,7 +3264,7 @@ function detectDevSourcePath() {
|
|
|
3200
3264
|
}
|
|
3201
3265
|
async function configureUpdate(printer, actantHome) {
|
|
3202
3266
|
printer.log(`
|
|
3203
|
-
${
|
|
3267
|
+
${chalk28.cyan("[ Step 7/7 ]")} ${chalk28.bold("\u66F4\u65B0\u9009\u9879")}
|
|
3204
3268
|
`);
|
|
3205
3269
|
const wantConfigure = await confirm4({
|
|
3206
3270
|
message: "\u914D\u7F6E\u81EA\u52A8\u66F4\u65B0\u6E90? (\u7528\u4E8E\u4ECE\u672C\u5730\u6E90\u7801\u66F4\u65B0 Actant)",
|
|
@@ -3231,14 +3295,14 @@ ${chalk26.cyan("[ Step 7/7 ]")} ${chalk26.bold("\u66F4\u65B0\u9009\u9879")}
|
|
|
3231
3295
|
function printUpdateHelp(printer) {
|
|
3232
3296
|
printer.log("");
|
|
3233
3297
|
printer.dim(" \u66F4\u65B0\u547D\u4EE4:");
|
|
3234
|
-
printer.dim(` ${
|
|
3235
|
-
printer.dim(` ${
|
|
3236
|
-
printer.dim(` ${
|
|
3298
|
+
printer.dim(` ${chalk28.cyan("actant self-update")} \u4ECE\u6E90\u7801\u6784\u5EFA\u5E76\u66F4\u65B0`);
|
|
3299
|
+
printer.dim(` ${chalk28.cyan("actant self-update --check")} \u68C0\u67E5\u7248\u672C\u5DEE\u5F02`);
|
|
3300
|
+
printer.dim(` ${chalk28.cyan("npm install -g @actant/cli")} \u4ECE npm \u66F4\u65B0`);
|
|
3237
3301
|
}
|
|
3238
3302
|
|
|
3239
3303
|
// src/commands/setup/setup.ts
|
|
3240
3304
|
function createSetupCommand(printer = defaultPrinter) {
|
|
3241
|
-
return new
|
|
3305
|
+
return new Command73("setup").description("Interactive setup wizard \u2014 configure Actant step by step").option("--skip-home", "Skip work directory selection").option("--skip-provider", "Skip model provider configuration").option("--skip-source", "Skip component source configuration").option("--skip-agent", "Skip agent creation").option("--skip-autostart", "Skip auto-start configuration").option("--skip-hello", "Skip hello world verification").option("--skip-update", "Skip update options").action(async (opts) => {
|
|
3242
3306
|
try {
|
|
3243
3307
|
printBanner(printer);
|
|
3244
3308
|
let actantHome;
|
|
@@ -3270,7 +3334,7 @@ function createSetupCommand(printer = defaultPrinter) {
|
|
|
3270
3334
|
client = new RpcClient(socketPath);
|
|
3271
3335
|
const alive = await client.ping();
|
|
3272
3336
|
if (!alive) {
|
|
3273
|
-
printer.log(
|
|
3337
|
+
printer.log(chalk29.dim("\n \u6B63\u5728\u542F\u52A8 Daemon..."));
|
|
3274
3338
|
daemonStartedBySetup = await tryStartDaemon(printer, socketPath);
|
|
3275
3339
|
if (!daemonStartedBySetup) {
|
|
3276
3340
|
printer.warn(" \u26A0 \u65E0\u6CD5\u81EA\u52A8\u542F\u52A8 Daemon\uFF0C\u8DF3\u8FC7\u9700\u8981 Daemon \u7684\u6B65\u9AA4");
|
|
@@ -3300,7 +3364,7 @@ function createSetupCommand(printer = defaultPrinter) {
|
|
|
3300
3364
|
printSummary(printer, actantHome);
|
|
3301
3365
|
} catch (err) {
|
|
3302
3366
|
if (isUserCancellation(err)) {
|
|
3303
|
-
printer.log(
|
|
3367
|
+
printer.log(chalk29.dim("\n \u5DF2\u53D6\u6D88\u8BBE\u7F6E\u5411\u5BFC"));
|
|
3304
3368
|
return;
|
|
3305
3369
|
}
|
|
3306
3370
|
presentError(err, printer);
|
|
@@ -3310,44 +3374,44 @@ function createSetupCommand(printer = defaultPrinter) {
|
|
|
3310
3374
|
}
|
|
3311
3375
|
function printBanner(printer) {
|
|
3312
3376
|
printer.log("");
|
|
3313
|
-
printer.log(
|
|
3314
|
-
printer.log(
|
|
3315
|
-
printer.log(
|
|
3316
|
-
printer.log(
|
|
3377
|
+
printer.log(chalk29.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
|
|
3378
|
+
printer.log(chalk29.cyan("\u2551") + chalk29.bold(" Actant Setup Wizard ") + chalk29.cyan("\u2551"));
|
|
3379
|
+
printer.log(chalk29.cyan("\u2551") + chalk29.dim(" Build, manage, and compose AI agents ") + chalk29.cyan("\u2551"));
|
|
3380
|
+
printer.log(chalk29.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"));
|
|
3317
3381
|
}
|
|
3318
3382
|
function printSummary(printer, actantHome) {
|
|
3319
3383
|
printer.log("");
|
|
3320
|
-
printer.log(
|
|
3321
|
-
printer.log(
|
|
3322
|
-
printer.log(
|
|
3384
|
+
printer.log(chalk29.green("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
|
|
3385
|
+
printer.log(chalk29.green.bold(" Setup Complete!"));
|
|
3386
|
+
printer.log(chalk29.green("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
|
|
3323
3387
|
printer.log("");
|
|
3324
3388
|
printer.dim(` \u5DE5\u4F5C\u76EE\u5F55: ${actantHome}`);
|
|
3325
3389
|
printer.log("");
|
|
3326
3390
|
printer.log(" \u5FEB\u901F\u5F00\u59CB:");
|
|
3327
|
-
printer.log(` ${
|
|
3328
|
-
printer.log(` ${
|
|
3329
|
-
printer.log(` ${
|
|
3330
|
-
printer.log(` ${
|
|
3331
|
-
printer.log(` ${
|
|
3391
|
+
printer.log(` ${chalk29.cyan("actant daemon start")} \u542F\u52A8 Daemon`);
|
|
3392
|
+
printer.log(` ${chalk29.cyan("actant template list")} \u6D4F\u89C8\u6A21\u677F`);
|
|
3393
|
+
printer.log(` ${chalk29.cyan("actant agent list")} \u67E5\u770B Agent`);
|
|
3394
|
+
printer.log(` ${chalk29.cyan("actant agent chat <n>")} \u4E0E Agent \u5BF9\u8BDD`);
|
|
3395
|
+
printer.log(` ${chalk29.cyan("actant setup")} \u91CD\u65B0\u8FD0\u884C\u6B64\u5411\u5BFC`);
|
|
3332
3396
|
printer.log("");
|
|
3333
3397
|
printer.dim(" \u66F4\u591A\u5E2E\u52A9: actant help");
|
|
3334
3398
|
printer.log("");
|
|
3335
3399
|
}
|
|
3336
3400
|
async function tryStartDaemon(printer, socketPath) {
|
|
3337
3401
|
try {
|
|
3338
|
-
const { fork: fork2, spawn:
|
|
3402
|
+
const { fork: fork2, spawn: spawn5 } = await import("child_process");
|
|
3339
3403
|
const { join: join8 } = await import("path");
|
|
3340
3404
|
const { isWindows: isWindows3, isSingleExecutable: isSingleExecutable2 } = await import("@actant/shared");
|
|
3341
3405
|
let child;
|
|
3342
3406
|
if (isSingleExecutable2()) {
|
|
3343
|
-
child =
|
|
3407
|
+
child = spawn5(process.execPath, ["--__actant-daemon"], {
|
|
3344
3408
|
detached: true,
|
|
3345
3409
|
stdio: ["ignore", "ignore", "ignore"],
|
|
3346
3410
|
env: process.env
|
|
3347
3411
|
});
|
|
3348
3412
|
} else {
|
|
3349
3413
|
const daemonScript = join8(import.meta.dirname, "..", "daemon-entry.js");
|
|
3350
|
-
child = isWindows3() ?
|
|
3414
|
+
child = isWindows3() ? spawn5(process.execPath, [daemonScript], {
|
|
3351
3415
|
detached: true,
|
|
3352
3416
|
stdio: ["ignore", "ignore", "ignore"],
|
|
3353
3417
|
env: process.env
|
|
@@ -3391,7 +3455,7 @@ function createProgram(socketPath, printer) {
|
|
|
3391
3455
|
const client = new RpcClient(sock);
|
|
3392
3456
|
const pkgPath = join7(import.meta.dirname, "..", "package.json");
|
|
3393
3457
|
const { version } = JSON.parse(readFileSync4(pkgPath, "utf-8"));
|
|
3394
|
-
const program = new
|
|
3458
|
+
const program = new Command74("actant").version(version).description("Actant \u2014 Build, manage, and compose AI agents");
|
|
3395
3459
|
program.addCommand(createTemplateCommand(client, printer));
|
|
3396
3460
|
program.addCommand(createAgentCommand(client, printer));
|
|
3397
3461
|
program.addCommand(createSkillCommand(client, printer));
|
|
@@ -3419,7 +3483,7 @@ async function run(argv) {
|
|
|
3419
3483
|
if (!versionRequested && !helpRequested) {
|
|
3420
3484
|
const sock = defaultSocketPath();
|
|
3421
3485
|
const client = new RpcClient(sock);
|
|
3422
|
-
const { startRepl } = await import("./repl-
|
|
3486
|
+
const { startRepl } = await import("./repl-ZVBJSFT5.js");
|
|
3423
3487
|
await startRepl(client, sock);
|
|
3424
3488
|
return;
|
|
3425
3489
|
}
|
|
@@ -3448,4 +3512,4 @@ export {
|
|
|
3448
3512
|
createProgram,
|
|
3449
3513
|
run
|
|
3450
3514
|
};
|
|
3451
|
-
//# sourceMappingURL=chunk-
|
|
3515
|
+
//# sourceMappingURL=chunk-664FYMDI.js.map
|