@auto-ai/agent 2.1.95 → 2.1.96

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.
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
4
+ import { resolve, dirname } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+
9
+ function install() {
10
+ const mcpConfig = {
11
+ mcpServers: {
12
+ tuitui: {
13
+ command: "node",
14
+ args: [resolve(__dirname, "server/boot.mjs")],
15
+ env: {
16
+ TUITUI_APP_ID: process.env.TUITUI_APP_ID || "",
17
+ TUITUI_APP_SECRET: process.env.TUITUI_APP_SECRET || "",
18
+ TUITUI_STATE_DIR:
19
+ process.env.TUITUI_STATE_DIR || resolve(__dirname, ".state"),
20
+ TUITUI_DM_POLICY: process.env.TUITUI_DM_POLICY || "allowlist",
21
+ TUITUI_GROUP_POLICY: process.env.TUITUI_GROUP_POLICY || "allowlist",
22
+ TUITUI_REQUIRE_MENTION: process.env.TUITUI_REQUIRE_MENTION || "true",
23
+ TUITUI_CHANNEL_CONTEXT:
24
+ process.env.TUITUI_CHANNEL_CONTEXT || "thread",
25
+ TUITUI_AUTO_REPLY: process.env.TUITUI_AUTO_REPLY || "true",
26
+ },
27
+ },
28
+ },
29
+ };
30
+ const mcpPath = resolve(process.cwd(), ".mcp.json");
31
+ if (existsSync(mcpPath)) {
32
+ try {
33
+ const existing = JSON.parse(readFileSync(mcpPath, "utf8"));
34
+ existing.mcpServers ||= {};
35
+ existing.mcpServers.tuitui = mcpConfig.mcpServers.tuitui;
36
+ writeFileSync(mcpPath, JSON.stringify(existing, null, 2) + "\n", "utf8");
37
+ console.log(`Updated: ${mcpPath}`);
38
+ } catch {
39
+ writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2) + "\n", "utf8");
40
+ console.log(`Created: ${mcpPath}`);
41
+ }
42
+ } else {
43
+ writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2) + "\n", "utf8");
44
+ console.log(`Created: ${mcpPath}`);
45
+ }
46
+ console.log("\nNext steps:");
47
+ console.log(" 1. Fill TUITUI_APP_ID / TUITUI_APP_SECRET in .mcp.json");
48
+ console.log(" 2. Start Claude Code with the local MCP config");
49
+ }
50
+
51
+ function help() {
52
+ console.log(`
53
+ Claude TuiTui Channel
54
+
55
+ Usage: node cli.mjs <command>
56
+
57
+ Commands:
58
+ start Start the TuiTui MCP/channel server
59
+ install Write or update .mcp.json in current directory
60
+ help Show this help message
61
+ `);
62
+ }
63
+
64
+ const command = process.argv[2];
65
+ switch (command) {
66
+ case "start":
67
+ await import("./server/index.mjs");
68
+ break;
69
+ case "install":
70
+ install();
71
+ break;
72
+ case "help":
73
+ case "--help":
74
+ case "-h":
75
+ default:
76
+ help();
77
+ if (command && !["help", "--help", "-h"].includes(command)) process.exit(1);
78
+ }