@actant/cli 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import {
2
+ ConnectionError,
3
+ RpcCallError,
4
+ RpcClient,
5
+ createProgram
6
+ } from "./chunk-2FKBVXMH.js";
7
+ export {
8
+ ConnectionError,
9
+ RpcCallError,
10
+ RpcClient,
11
+ createProgram
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,11 @@
1
+ import {
2
+ createProgram,
3
+ defaultSocketPath,
4
+ run
5
+ } from "./chunk-2FKBVXMH.js";
6
+ export {
7
+ createProgram,
8
+ defaultSocketPath,
9
+ run
10
+ };
11
+ //# sourceMappingURL=program-3Y3ULHTY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,103 @@
1
+ import {
2
+ createProgram,
3
+ defaultPrinter
4
+ } from "./chunk-2FKBVXMH.js";
5
+
6
+ // src/repl/repl.ts
7
+ import { createInterface } from "readline";
8
+ import chalk from "chalk";
9
+ async function startRepl(client, socketPath, input = process.stdin, output = process.stdout, printer = defaultPrinter) {
10
+ const alive = await client.ping();
11
+ if (!alive) {
12
+ printer.errorStyled("Cannot connect to daemon.");
13
+ printer.errorDim("Start with: actant daemon start");
14
+ process.exitCode = 1;
15
+ return;
16
+ }
17
+ const ping = await client.call("daemon.ping", {});
18
+ output.write(chalk.bold(`Actant v${ping.version}`) + ` (${ping.agents} agents)
19
+ `);
20
+ output.write(chalk.dim('Type "help" for commands, "exit" to quit.\n\n'));
21
+ const rl = createInterface({
22
+ input,
23
+ output,
24
+ prompt: chalk.cyan("actant> "),
25
+ terminal: input === process.stdin
26
+ });
27
+ rl.prompt();
28
+ rl.on("line", async (line) => {
29
+ const trimmed = line.trim();
30
+ if (!trimmed) {
31
+ rl.prompt();
32
+ return;
33
+ }
34
+ if (trimmed === "exit" || trimmed === "quit") {
35
+ rl.close();
36
+ return;
37
+ }
38
+ if (trimmed === "help") {
39
+ const program = createProgram(socketPath, printer);
40
+ program.outputHelp();
41
+ rl.prompt();
42
+ return;
43
+ }
44
+ try {
45
+ const program = createProgram(socketPath, printer);
46
+ program.exitOverride();
47
+ program.configureOutput({
48
+ writeOut: (str) => output.write(str),
49
+ writeErr: (str) => output.write(str)
50
+ });
51
+ const argv = ["node", "actant", ...parseArgs(trimmed)];
52
+ await program.parseAsync(argv);
53
+ } catch (err) {
54
+ if (err instanceof Error && "code" in err) {
55
+ const code = err.code;
56
+ if (code === "commander.helpDisplayed" || code === "commander.version") {
57
+ } else if (code !== "commander.help") {
58
+ output.write(chalk.red(`Error: ${err.message}
59
+ `));
60
+ }
61
+ }
62
+ }
63
+ rl.prompt();
64
+ });
65
+ rl.on("close", () => {
66
+ output.write(chalk.dim("\nGoodbye.\n"));
67
+ });
68
+ return new Promise((resolve) => {
69
+ rl.on("close", resolve);
70
+ });
71
+ }
72
+ function parseArgs(line) {
73
+ const args = [];
74
+ let current = "";
75
+ let inQuote = null;
76
+ for (const ch of line) {
77
+ if (inQuote) {
78
+ if (ch === inQuote) {
79
+ inQuote = null;
80
+ } else {
81
+ current += ch;
82
+ }
83
+ } else if (ch === '"' || ch === "'") {
84
+ inQuote = ch;
85
+ } else if (ch === " " || ch === " ") {
86
+ if (current) {
87
+ args.push(current);
88
+ current = "";
89
+ }
90
+ } else {
91
+ current += ch;
92
+ }
93
+ }
94
+ if (current) {
95
+ args.push(current);
96
+ }
97
+ return args;
98
+ }
99
+ export {
100
+ parseArgs,
101
+ startRepl
102
+ };
103
+ //# sourceMappingURL=repl-JIMJ2V2Y.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/repl/repl.ts"],"sourcesContent":["import { createInterface, type Interface } from \"node:readline\";\nimport chalk from \"chalk\";\nimport { createProgram } from \"../program\";\nimport type { RpcClient } from \"../client/rpc-client\";\nimport { type CliPrinter, defaultPrinter } from \"../output/index\";\n\nexport async function startRepl(\n client: RpcClient,\n socketPath: string,\n input: NodeJS.ReadableStream = process.stdin,\n output: NodeJS.WritableStream = process.stdout,\n printer: CliPrinter = defaultPrinter,\n): Promise<void> {\n const alive = await client.ping();\n if (!alive) {\n printer.errorStyled(\"Cannot connect to daemon.\");\n printer.errorDim(\"Start with: actant daemon start\");\n process.exitCode = 1;\n return;\n }\n\n const ping = await client.call(\"daemon.ping\", {});\n output.write(chalk.bold(`Actant v${ping.version}`) + ` (${ping.agents} agents)\\n`);\n output.write(chalk.dim('Type \"help\" for commands, \"exit\" to quit.\\n\\n'));\n\n const rl: Interface = createInterface({\n input,\n output,\n prompt: chalk.cyan(\"actant> \"),\n terminal: input === process.stdin,\n });\n\n rl.prompt();\n\n rl.on(\"line\", async (line: string) => {\n const trimmed = line.trim();\n\n if (!trimmed) {\n rl.prompt();\n return;\n }\n\n if (trimmed === \"exit\" || trimmed === \"quit\") {\n rl.close();\n return;\n }\n\n if (trimmed === \"help\") {\n const program = createProgram(socketPath, printer);\n program.outputHelp();\n rl.prompt();\n return;\n }\n\n try {\n const program = createProgram(socketPath, printer);\n program.exitOverride();\n program.configureOutput({\n writeOut: (str: string) => output.write(str),\n writeErr: (str: string) => output.write(str),\n });\n\n const argv = [\"node\", \"actant\", ...parseArgs(trimmed)];\n await program.parseAsync(argv);\n } catch (err) {\n if (err instanceof Error && \"code\" in err) {\n const code = (err as { code: string }).code;\n if (code === \"commander.helpDisplayed\" || code === \"commander.version\") {\n // swallow\n } else if (code !== \"commander.help\") {\n output.write(chalk.red(`Error: ${err.message}\\n`));\n }\n }\n }\n\n rl.prompt();\n });\n\n rl.on(\"close\", () => {\n output.write(chalk.dim(\"\\nGoodbye.\\n\"));\n });\n\n return new Promise((resolve) => {\n rl.on(\"close\", resolve);\n });\n}\n\nexport function parseArgs(line: string): string[] {\n const args: string[] = [];\n let current = \"\";\n let inQuote: string | null = null;\n\n for (const ch of line) {\n if (inQuote) {\n if (ch === inQuote) {\n inQuote = null;\n } else {\n current += ch;\n }\n } else if (ch === '\"' || ch === \"'\") {\n inQuote = ch;\n } else if (ch === \" \" || ch === \"\\t\") {\n if (current) {\n args.push(current);\n current = \"\";\n }\n } else {\n current += ch;\n }\n }\n\n if (current) {\n args.push(current);\n }\n\n return args;\n}\n"],"mappings":";;;;;;AAAA,SAAS,uBAAuC;AAChD,OAAO,WAAW;AAKlB,eAAsB,UACpB,QACA,YACA,QAA+B,QAAQ,OACvC,SAAgC,QAAQ,QACxC,UAAsB,gBACP;AACf,QAAM,QAAQ,MAAM,OAAO,KAAK;AAChC,MAAI,CAAC,OAAO;AACV,YAAQ,YAAY,2BAA2B;AAC/C,YAAQ,SAAS,iCAAiC;AAClD,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,QAAM,OAAO,MAAM,OAAO,KAAK,eAAe,CAAC,CAAC;AAChD,SAAO,MAAM,MAAM,KAAK,WAAW,KAAK,OAAO,EAAE,IAAI,KAAK,KAAK,MAAM;AAAA,CAAY;AACjF,SAAO,MAAM,MAAM,IAAI,+CAA+C,CAAC;AAEvE,QAAM,KAAgB,gBAAgB;AAAA,IACpC;AAAA,IACA;AAAA,IACA,QAAQ,MAAM,KAAK,UAAU;AAAA,IAC7B,UAAU,UAAU,QAAQ;AAAA,EAC9B,CAAC;AAED,KAAG,OAAO;AAEV,KAAG,GAAG,QAAQ,OAAO,SAAiB;AACpC,UAAM,UAAU,KAAK,KAAK;AAE1B,QAAI,CAAC,SAAS;AACZ,SAAG,OAAO;AACV;AAAA,IACF;AAEA,QAAI,YAAY,UAAU,YAAY,QAAQ;AAC5C,SAAG,MAAM;AACT;AAAA,IACF;AAEA,QAAI,YAAY,QAAQ;AACtB,YAAM,UAAU,cAAc,YAAY,OAAO;AACjD,cAAQ,WAAW;AACnB,SAAG,OAAO;AACV;AAAA,IACF;AAEA,QAAI;AACF,YAAM,UA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AO;AACT;","names":[]}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@actant/cli",
3
+ "version": "0.1.2",
4
+ "description": "CLI for the Actant AI agent platform — build, manage, and compose AI agents",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "blackplume <blackplume233@gmail.com>",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/blackplume233/Actant.git",
11
+ "directory": "packages/cli"
12
+ },
13
+ "homepage": "https://github.com/blackplume233/Actant#readme",
14
+ "bugs": "https://github.com/blackplume233/Actant/issues",
15
+ "keywords": [
16
+ "actant",
17
+ "ai-agent",
18
+ "cli",
19
+ "agent-platform"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "scripts/postinstall.mjs"
27
+ ],
28
+ "bin": {
29
+ "actant": "./dist/bin/actant.js"
30
+ },
31
+ "dependencies": {
32
+ "chalk": "^5.6.2",
33
+ "cli-table3": "^0.6.5",
34
+ "commander": "^14.0.3",
35
+ "@actant/acp": "0.1.2",
36
+ "@actant/core": "0.1.2",
37
+ "@actant/shared": "0.1.2",
38
+ "@actant/api": "0.1.2"
39
+ },
40
+ "scripts": {
41
+ "build": "tsup",
42
+ "dev": "tsx src/index.ts",
43
+ "type-check": "tsc --noEmit",
44
+ "test": "vitest run",
45
+ "clean": "rimraf dist",
46
+ "postinstall": "node scripts/postinstall.mjs"
47
+ }
48
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Post-install hook: creates ~/.actant directory structure on first install.
3
+ * Runs automatically after `npm install -g @actant/cli`.
4
+ */
5
+
6
+ import { mkdirSync, writeFileSync, existsSync } from "node:fs";
7
+ import { join } from "node:path";
8
+ import { homedir } from "node:os";
9
+
10
+ const ACTANT_HOME = process.env.ACTANT_HOME || join(homedir(), ".actant");
11
+
12
+ const dirs = [
13
+ "configs/skills",
14
+ "configs/prompts",
15
+ "configs/mcp",
16
+ "configs/workflows",
17
+ "configs/plugins",
18
+ "configs/templates",
19
+ "instances",
20
+ "sources/cache",
21
+ "logs",
22
+ "backups",
23
+ ];
24
+
25
+ for (const dir of dirs) {
26
+ mkdirSync(join(ACTANT_HOME, dir), { recursive: true });
27
+ }
28
+
29
+ const configFile = join(ACTANT_HOME, "config.json");
30
+ if (!existsSync(configFile)) {
31
+ writeFileSync(
32
+ configFile,
33
+ JSON.stringify(
34
+ {
35
+ devSourcePath: "",
36
+ update: {
37
+ maxBackups: 3,
38
+ preUpdateTestCommand: "pnpm test:changed",
39
+ autoRestartAgents: true,
40
+ },
41
+ },
42
+ null,
43
+ 2,
44
+ ) + "\n",
45
+ );
46
+ }