connectbase-client 6.28.0 → 6.30.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/cli.js CHANGED
@@ -68,40 +68,225 @@ __export(cli_exports, {
68
68
  });
69
69
  module.exports = __toCommonJS(cli_exports);
70
70
  var crypto = __toESM(require("crypto"));
71
- var fs5 = __toESM(require("fs"));
71
+ var fs6 = __toESM(require("fs"));
72
72
  var http2 = __toESM(require("http"));
73
73
  var https = __toESM(require("https"));
74
- var os4 = __toESM(require("os"));
75
- var path5 = __toESM(require("path"));
74
+ var os5 = __toESM(require("os"));
75
+ var path6 = __toESM(require("path"));
76
76
  var readline = __toESM(require("readline"));
77
77
 
78
+ // src/local-autostart.ts
79
+ var import_node_child_process = require("child_process");
80
+ var fs = __toESM(require("fs"));
81
+ var os = __toESM(require("os"));
82
+ var path = __toESM(require("path"));
83
+ var LABEL = "world.connectbase.local";
84
+ var STATE_DIR = path.join(os.homedir(), ".connectbase");
85
+ var AUTOSTART_LOG = path.join(STATE_DIR, "local-runner.log");
86
+ function autostartArgs(spec) {
87
+ return [
88
+ "-y",
89
+ "connectbase-client@latest",
90
+ "local",
91
+ "--app",
92
+ spec.appId,
93
+ "--dir",
94
+ spec.dir,
95
+ "--port",
96
+ String(spec.port)
97
+ ];
98
+ }
99
+ function npxPath(platform2 = process.platform) {
100
+ const bin = path.dirname(process.execPath);
101
+ const name = platform2 === "win32" ? "npx.cmd" : "npx";
102
+ const p = path.join(bin, name);
103
+ return fs.existsSync(p) ? p : name;
104
+ }
105
+ var winQuote = (s) => `"${s.replace(/"/g, '""')}"`;
106
+ var shQuote = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
107
+ var xml = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
108
+ function windowsFiles(spec, npx, envPath) {
109
+ const startup = path.join(
110
+ process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"),
111
+ "Microsoft",
112
+ "Windows",
113
+ "Start Menu",
114
+ "Programs",
115
+ "Startup"
116
+ );
117
+ const cmdPath = path.join(STATE_DIR, "local-runner-start.cmd");
118
+ const vbsPath = path.join(startup, "ConnectBase \uB85C\uCEEC \uC2E4\uD589\uAE30.vbs");
119
+ const cmd = [
120
+ "@echo off",
121
+ "chcp 65001 >nul",
122
+ `set "PATH=${envPath}"`,
123
+ `cd /d ${winQuote(spec.cwd)}`,
124
+ ":loop",
125
+ `call ${winQuote(npx)} ${autostartArgs(spec).map(winQuote).join(" ")} >> ${winQuote(AUTOSTART_LOG)} 2>&1`,
126
+ // 숨은 창에서도 되는 30초 쉬기 (timeout 은 입력 장치가 없으면 바로 끝난다)
127
+ "ping -n 31 127.0.0.1 >nul",
128
+ "goto loop",
129
+ ""
130
+ ].join("\r\n");
131
+ const vbs = `CreateObject("WScript.Shell").Run """${cmdPath}""", 0, False\r
132
+ `;
133
+ return { startup, cmdPath, cmd, vbsPath, vbs };
134
+ }
135
+ function macPlist(spec, npx, envPath) {
136
+ const args = [npx, ...autostartArgs(spec)].map((a) => ` <string>${xml(a)}</string>`).join("\n");
137
+ return `<?xml version="1.0" encoding="UTF-8"?>
138
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
139
+ <plist version="1.0">
140
+ <dict>
141
+ <key>Label</key>
142
+ <string>${LABEL}</string>
143
+ <key>ProgramArguments</key>
144
+ <array>
145
+ ${args}
146
+ </array>
147
+ <key>WorkingDirectory</key>
148
+ <string>${xml(spec.cwd)}</string>
149
+ <key>EnvironmentVariables</key>
150
+ <dict>
151
+ <key>PATH</key>
152
+ <string>${xml(envPath)}</string>
153
+ </dict>
154
+ <key>RunAtLoad</key>
155
+ <true/>
156
+ <key>KeepAlive</key>
157
+ <true/>
158
+ <key>ThrottleInterval</key>
159
+ <integer>30</integer>
160
+ <key>StandardOutPath</key>
161
+ <string>${xml(AUTOSTART_LOG)}</string>
162
+ <key>StandardErrorPath</key>
163
+ <string>${xml(AUTOSTART_LOG)}</string>
164
+ </dict>
165
+ </plist>
166
+ `;
167
+ }
168
+ function systemdUnit(spec, npx, envPath) {
169
+ const esc = (x) => x.replace(/%/g, "%%");
170
+ const inner = `exec ${[npx, ...autostartArgs(spec)].map(shQuote).join(" ")} >> ${shQuote(AUTOSTART_LOG)} 2>&1`;
171
+ return `[Unit]
172
+ Description=ConnectBase \uB85C\uCEEC \uC2E4\uD589\uAE30
173
+ After=network-online.target
174
+ Wants=network-online.target
175
+
176
+ [Service]
177
+ WorkingDirectory=${esc(spec.cwd)}
178
+ Environment=${esc(JSON.stringify(`PATH=${envPath}`))}
179
+ ExecStart=/bin/sh -c ${esc(shQuote(inner))}
180
+ Restart=always
181
+ RestartSec=30
182
+
183
+ [Install]
184
+ WantedBy=default.target
185
+ `;
186
+ }
187
+ var macPlistPath = () => path.join(os.homedir(), "Library", "LaunchAgents", `${LABEL}.plist`);
188
+ var systemdPath = () => path.join(
189
+ os.homedir(),
190
+ ".config",
191
+ "systemd",
192
+ "user",
193
+ "connectbase-local.service"
194
+ );
195
+ function quiet(cmd, args) {
196
+ try {
197
+ (0, import_node_child_process.execFileSync)(cmd, args, { stdio: "ignore" });
198
+ return true;
199
+ } catch {
200
+ return false;
201
+ }
202
+ }
203
+ function installAutostart(spec) {
204
+ fs.mkdirSync(STATE_DIR, { recursive: true });
205
+ const npx = npxPath();
206
+ const envPath = process.env.PATH || "";
207
+ if (process.platform === "win32") {
208
+ const f = windowsFiles(spec, npx, envPath);
209
+ fs.writeFileSync(f.cmdPath, f.cmd);
210
+ fs.mkdirSync(f.startup, { recursive: true });
211
+ fs.writeFileSync(
212
+ f.vbsPath,
213
+ Buffer.concat([Buffer.from([255, 254]), Buffer.from(f.vbs, "utf16le")])
214
+ );
215
+ return `Windows \uC2DC\uC791\uD504\uB85C\uADF8\uB7A8\uC5D0 \uB4F1\uB85D\uD588\uC2B5\uB2C8\uB2E4 (${f.vbsPath}). \uB85C\uADF8\uC778\uD558\uBA74 \uCC3D \uC5C6\uC774 \uCF1C\uC9C0\uACE0, \uAEBC\uC9C0\uBA74 30\uCD08 \uB4A4 \uB2E4\uC2DC \uCF2D\uB2C8\uB2E4.`;
216
+ }
217
+ if (process.platform === "darwin") {
218
+ const p2 = macPlistPath();
219
+ fs.mkdirSync(path.dirname(p2), { recursive: true });
220
+ fs.writeFileSync(p2, macPlist(spec, npx, envPath));
221
+ return `macOS \uB85C\uADF8\uC778 \uD56D\uBAA9(launchd)\uC5D0 \uB4F1\uB85D\uD588\uC2B5\uB2C8\uB2E4 (${p2}). \uB2E4\uC74C \uB85C\uADF8\uC778\uBD80\uD130 \uC800\uC808\uB85C \uCF1C\uC9C0\uACE0, \uAEBC\uC9C0\uBA74 \uB2E4\uC2DC \uCF2D\uB2C8\uB2E4.`;
222
+ }
223
+ const p = systemdPath();
224
+ fs.mkdirSync(path.dirname(p), { recursive: true });
225
+ fs.writeFileSync(p, systemdUnit(spec, npx, envPath));
226
+ const ok = quiet("systemctl", ["--user", "daemon-reload"]) && quiet("systemctl", ["--user", "enable", "connectbase-local.service"]);
227
+ if (!ok)
228
+ return `systemd \uC0AC\uC6A9\uC790 \uC11C\uBE44\uC2A4 \uD30C\uC77C\uC744 \uB9CC\uB4E4\uC5C8\uC9C0\uB9CC \uCF1C\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 (${p}). 'systemctl --user enable connectbase-local.service' \uB97C \uC9C1\uC811 \uC2E4\uD589\uD558\uC138\uC694.`;
229
+ return `systemd \uC0AC\uC6A9\uC790 \uC11C\uBE44\uC2A4\uB85C \uB4F1\uB85D\uD588\uC2B5\uB2C8\uB2E4 (${p}). \uB85C\uADF8\uC778\uD558\uBA74 \uCF1C\uC9C0\uACE0, \uAEBC\uC9C0\uBA74 \uB2E4\uC2DC \uCF2D\uB2C8\uB2E4. \uB85C\uADF8\uC778 \uC5C6\uC774 \uBD80\uD305\uB9CC\uC73C\uB85C \uCF1C\uB824\uBA74 'loginctl enable-linger ${os.userInfo().username}' \uB97C \uD55C \uBC88 \uC2E4\uD589\uD558\uC138\uC694.`;
230
+ }
231
+ function removeAutostart() {
232
+ const removed = [];
233
+ const rm = (p) => {
234
+ if (fs.existsSync(p)) {
235
+ fs.rmSync(p, { force: true });
236
+ removed.push(p);
237
+ }
238
+ };
239
+ if (process.platform === "win32") {
240
+ const f = windowsFiles({ appId: "", dir: "", port: 0, cwd: "" }, "", "");
241
+ rm(f.vbsPath);
242
+ rm(f.cmdPath);
243
+ } else if (process.platform === "darwin") {
244
+ const p = macPlistPath();
245
+ if (fs.existsSync(p)) quiet("launchctl", ["unload", "-w", p]);
246
+ rm(p);
247
+ } else {
248
+ const p = systemdPath();
249
+ if (fs.existsSync(p)) {
250
+ quiet("systemctl", [
251
+ "--user",
252
+ "disable",
253
+ "--now",
254
+ "connectbase-local.service"
255
+ ]);
256
+ rm(p);
257
+ quiet("systemctl", ["--user", "daemon-reload"]);
258
+ }
259
+ }
260
+ return removed.length ? `\uC790\uB3D9 \uC2DC\uC791\uC744 \uAED0\uC2B5\uB2C8\uB2E4 (${removed.join(", ")} \uC9C0\uC6C0). \uC9C0\uAE08 \uCF1C\uC838 \uC788\uB294 \uC2E4\uD589\uAE30\uB294 \uCC3D\uC744 \uB2EB\uAC70\uB098 \uB2E4\uC2DC \uB85C\uADF8\uC778\uD558\uBA74 \uAEBC\uC9D1\uB2C8\uB2E4.` : "\uB4F1\uB85D\uB41C \uC790\uB3D9 \uC2DC\uC791\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.";
261
+ }
262
+
78
263
  // src/local-command.ts
79
264
  var import_node_crypto = require("crypto");
80
- var fs3 = __toESM(require("fs"));
81
- var os2 = __toESM(require("os"));
82
- var path3 = __toESM(require("path"));
265
+ var fs4 = __toESM(require("fs"));
266
+ var os3 = __toESM(require("os"));
267
+ var path4 = __toESM(require("path"));
83
268
 
84
269
  // src/local-mcp-hub.ts
85
- var import_node_child_process = require("child_process");
86
- var fs = __toESM(require("fs"));
87
- var path = __toESM(require("path"));
270
+ var import_node_child_process2 = require("child_process");
271
+ var fs2 = __toESM(require("fs"));
272
+ var path2 = __toESM(require("path"));
88
273
  var LOCAL_CONFIG_FILE = "connectbase-local.json";
89
274
  var CALL_TIMEOUT_MS = 1e5;
90
275
  var START_TIMEOUT_MS = 6e4;
91
276
  function loadLocalConfig(dir) {
92
- const p = path.join(dir, LOCAL_CONFIG_FILE);
93
- if (!fs.existsSync(p)) return { mcpServers: {} };
94
- const raw = JSON.parse(fs.readFileSync(p, "utf-8"));
277
+ const p = path2.join(dir, LOCAL_CONFIG_FILE);
278
+ if (!fs2.existsSync(p)) return { mcpServers: {} };
279
+ const raw = JSON.parse(fs2.readFileSync(p, "utf-8"));
95
280
  return { mcpServers: raw.mcpServers ?? {} };
96
281
  }
97
282
  function saveLocalConfig(dir, cfg) {
98
- const p = path.join(dir, LOCAL_CONFIG_FILE);
283
+ const p = path2.join(dir, LOCAL_CONFIG_FILE);
99
284
  let prev = {};
100
285
  try {
101
- prev = JSON.parse(fs.readFileSync(p, "utf-8"));
286
+ prev = JSON.parse(fs2.readFileSync(p, "utf-8"));
102
287
  } catch {
103
288
  }
104
- fs.writeFileSync(
289
+ fs2.writeFileSync(
105
290
  p,
106
291
  `${JSON.stringify({ ...prev, mcpServers: cfg.mcpServers }, null, 2)}
107
292
  `
@@ -137,8 +322,8 @@ var StdioClient = class {
137
322
  return !!this.proc && this.proc.exitCode === null && !this.proc.killed;
138
323
  }
139
324
  async start() {
140
- const proc = (0, import_node_child_process.spawn)(this.def.command, this.def.args ?? [], {
141
- cwd: this.def.cwd ? path.resolve(this.cwd, this.def.cwd) : this.cwd,
325
+ const proc = (0, import_node_child_process2.spawn)(this.def.command, this.def.args ?? [], {
326
+ cwd: this.def.cwd ? path2.resolve(this.cwd, this.def.cwd) : this.cwd,
142
327
  env: { ...this.baseEnv, ...this.def.env ?? {} },
143
328
  stdio: ["pipe", "pipe", "pipe"],
144
329
  // Windows 의 npx, uvx 는 .cmd 라 셸로 띄워야 한다
@@ -428,12 +613,12 @@ var LocalMcpHub = class {
428
613
  };
429
614
 
430
615
  // src/local-runner.ts
431
- var import_node_child_process2 = require("child_process");
432
- var fs2 = __toESM(require("fs"));
616
+ var import_node_child_process3 = require("child_process");
617
+ var fs3 = __toESM(require("fs"));
433
618
  var http = __toESM(require("http"));
434
619
  var net = __toESM(require("net"));
435
- var os = __toESM(require("os"));
436
- var path2 = __toESM(require("path"));
620
+ var os2 = __toESM(require("os"));
621
+ var path3 = __toESM(require("path"));
437
622
  var MAX_OUT = 24e3;
438
623
  var MAX_READ = 2e5;
439
624
  var MAX_IMAGE = 8 * 1024 * 1024;
@@ -453,7 +638,7 @@ ${s.slice(-n)}` : s;
453
638
  var str = (v, d = "") => typeof v === "string" ? v : d;
454
639
  var num = (v, d) => typeof v === "number" && Number.isFinite(v) ? v : d;
455
640
  function imageMime(p) {
456
- const ext = path2.extname(p).toLowerCase();
641
+ const ext = path3.extname(p).toLowerCase();
457
642
  return {
458
643
  ".png": "image/png",
459
644
  ".jpg": "image/jpeg",
@@ -464,22 +649,22 @@ function imageMime(p) {
464
649
  }
465
650
  function findPrograms() {
466
651
  const which = (names, extra = []) => {
467
- const dirs = (process.env.PATH ?? "").split(path2.delimiter).filter(Boolean);
652
+ const dirs = (process.env.PATH ?? "").split(path3.delimiter).filter(Boolean);
468
653
  const exts = process.platform === "win32" ? ["", ".exe", ".cmd", ".bat"] : [""];
469
654
  for (const n of names) {
470
- if (path2.isAbsolute(n) && fs2.existsSync(n)) return n;
655
+ if (path3.isAbsolute(n) && fs3.existsSync(n)) return n;
471
656
  for (const d of dirs)
472
657
  for (const e of exts) {
473
- const p = path2.join(d, n + e);
474
- if (fs2.existsSync(p)) return p;
658
+ const p = path3.join(d, n + e);
659
+ if (fs3.existsSync(p)) return p;
475
660
  }
476
661
  }
477
- for (const p of extra) if (fs2.existsSync(p)) return p;
662
+ for (const p of extra) if (fs3.existsSync(p)) return p;
478
663
  return null;
479
664
  };
480
665
  const globDirs = (root, pattern, sub) => {
481
666
  try {
482
- return fs2.readdirSync(root).filter((n) => pattern.test(n)).sort().reverse().map((n) => path2.join(root, n, sub));
667
+ return fs3.readdirSync(root).filter((n) => pattern.test(n)).sort().reverse().map((n) => path3.join(root, n, sub));
483
668
  } catch {
484
669
  return [];
485
670
  }
@@ -499,7 +684,7 @@ function findPrograms() {
499
684
  "ZBrush.app/Contents/MacOS/ZBrush"
500
685
  ) : process.platform === "win32" ? globDirs("C:\\Program Files", /^Maxon ZBrush/, "ZBrush.exe") : [];
501
686
  return {
502
- blender: process.env.BLENDER_BIN && fs2.existsSync(process.env.BLENDER_BIN) ? process.env.BLENDER_BIN : which(["blender"], blenderExtra),
687
+ blender: process.env.BLENDER_BIN && fs3.existsSync(process.env.BLENDER_BIN) ? process.env.BLENDER_BIN : which(["blender"], blenderExtra),
503
688
  zbrush: which([], zbrushExtra),
504
689
  python: which(
505
690
  process.platform === "win32" ? ["python", "py"] : ["python3", "python"]
@@ -507,13 +692,13 @@ function findPrograms() {
507
692
  uv: which(
508
693
  ["uv"],
509
694
  [
510
- path2.join(
511
- os.homedir(),
695
+ path3.join(
696
+ os2.homedir(),
512
697
  ".local",
513
698
  "bin",
514
699
  process.platform === "win32" ? "uv.exe" : "uv"
515
700
  ),
516
- path2.join(os.homedir(), ".cargo", "bin", "uv")
701
+ path3.join(os2.homedir(), ".cargo", "bin", "uv")
517
702
  ]
518
703
  ),
519
704
  node: process.execPath,
@@ -528,9 +713,9 @@ var LocalRunner = class {
528
713
  this.jobs = /* @__PURE__ */ new Map();
529
714
  this.jobSeq = 0;
530
715
  this.opts = opts;
531
- this.dir = path2.resolve(opts.dir);
532
- this.skillsDir = path2.join(this.dir, "skills");
533
- fs2.mkdirSync(this.skillsDir, { recursive: true });
716
+ this.dir = path3.resolve(opts.dir);
717
+ this.skillsDir = path3.join(this.dir, "skills");
718
+ fs3.mkdirSync(this.skillsDir, { recursive: true });
534
719
  this.programs = findPrograms();
535
720
  this.tools = this.defineTools();
536
721
  this.hub = new LocalMcpHub(
@@ -569,12 +754,12 @@ var LocalRunner = class {
569
754
  }
570
755
  /** 작업 폴더 안의 경로로 푼다. 절대 경로도 작업 폴더 안이어야 한다. */
571
756
  inDir(p) {
572
- const abs = path2.resolve(
757
+ const abs = path3.resolve(
573
758
  this.dir,
574
- p.replace(/^~(?=$|[\\/])/, os.homedir())
759
+ p.replace(/^~(?=$|[\\/])/, os2.homedir())
575
760
  );
576
- const rel = path2.relative(this.dir, abs);
577
- if (rel.startsWith("..") || path2.isAbsolute(rel))
761
+ const rel = path3.relative(this.dir, abs);
762
+ if (rel.startsWith("..") || path3.isAbsolute(rel))
578
763
  throw new Error(
579
764
  `\uC791\uC5C5 \uD3F4\uB354(${this.dir}) \uBC16\uC758 \uACBD\uB85C\uB294 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${p}`
580
765
  );
@@ -606,11 +791,11 @@ var LocalRunner = class {
606
791
  return text(
607
792
  JSON.stringify(
608
793
  {
609
- os: `${process.platform} ${os.release()} ${process.arch}`,
794
+ os: `${process.platform} ${os2.release()} ${process.arch}`,
610
795
  work_dir: this.dir,
611
796
  skills_dir: this.skillsDir,
612
797
  installed_skills: this.listSkills().map((k) => k.name),
613
- mcp_config: path2.join(this.dir, LOCAL_CONFIG_FILE),
798
+ mcp_config: path3.join(this.dir, LOCAL_CONFIG_FILE),
614
799
  mcp_servers: this.hub.status(),
615
800
  programs: this.programs,
616
801
  blender_mcp: blenderLive ? `\uC5F0\uACB0\uB428 (localhost:${this.blenderPort})` : `\uC5C6\uC74C (Blender \uC5D0\uC11C BlenderMCP \uC560\uB4DC\uC628 > Start \uB97C \uB204\uB974\uBA74 execute_blender_code \uB4F1\uC744 \uC4F8 \uC218 \uC788\uB2E4)`,
@@ -645,7 +830,7 @@ var LocalRunner = class {
645
830
  ${this.skillIndexText()}`,
646
831
  true
647
832
  );
648
- const body = fs2.readFileSync(path2.join(k.dir, "SKILL.md"), "utf-8").split("{{SKILL_DIR}}").join(k.dir);
833
+ const body = fs3.readFileSync(path3.join(k.dir, "SKILL.md"), "utf-8").split("{{SKILL_DIR}}").join(k.dir);
649
834
  const head = `> \uC2A4\uD0AC \uD3F4\uB354(skill_dir): ${k.dir}
650
835
  > \uC774 \uC2A4\uD0AC\uC740 \uC0AC\uC6A9\uC790 \uCEF4\uD4E8\uD130\uC5D0\uC11C \uB3C8\uB2E4. \uBCF8\uBB38\uC758 {{SKILL_DIR}}, ~/.claude/skills/<\uC774\uB984>, ~/.codex/skills/<\uC774\uB984> \uC740 \uC704 skill_dir(\uB2E4\uB978 \uC2A4\uD0AC\uC774\uBA74 \uADF8 \uC2A4\uD0AC \uD3F4\uB354)\uB85C \uBC14\uAFD4 \uC77D\uB294\uB2E4.
651
836
  > \uC178 \uBA85\uB839\uC740 run(90\uCD08 \uB118\uC73C\uBA74 background=true \uB4A4 job_status), \uD30C\uC77C\uC740 read_file, write_file, list_files, \uADF8\uB9BC \uD655\uC778\uC740 view_image, \uADF8\uB9BC \uC0DD\uC131\uC740 image_generate, \uB0B4\uB824\uBC1B\uAE30\uB294 download, \uACB0\uACFC \uAC74\uB124\uAE30\uB294 upload_to_storage, \uC2E4\uD589 \uC911\uC778 Blender \uB294 execute_blender_code \uB4F1\uC73C\uB85C \uD55C\uB2E4. \uC2A4\uD0AC\uC774 \uC5B4\uB5A4 MCP \uC758 \uB3C4\uAD6C\uB97C \uC4F0\uB77C\uACE0 \uD558\uBA74 \uC774 PC \uC5D0 \uC815\uC758\uB41C MCP \uB3C4\uAD6C([\uB0B4 PC MCP: \uC774\uB984])\uB97C \uADF8 \uC774\uB984\uC73C\uB85C \uBD80\uB974\uACE0, \uC5C6\uC73C\uBA74 local_info \uB85C \uD655\uC778\uD55C \uB4A4 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \uADF8 MCP \uB97C connectbase-local.json \uC5D0 \uB123\uC790\uACE0 \uC548\uB0B4\uD55C\uB2E4(mcp_reload).
@@ -688,10 +873,10 @@ ${this.skillIndexText()}`,
688
873
  const name = str(a.name);
689
874
  if (!/^[\w.-]+$/.test(name))
690
875
  return text("\uC2A4\uD0AC \uC774\uB984\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4", true);
691
- const dir = path2.join(this.skillsDir, name);
692
- if (!fs2.existsSync(path2.join(dir, "SKILL.md")))
876
+ const dir = path3.join(this.skillsDir, name);
877
+ if (!fs3.existsSync(path3.join(dir, "SKILL.md")))
693
878
  return text(`\uC124\uCE58\uB41C \uC2A4\uD0AC\uC774 \uC544\uB2D9\uB2C8\uB2E4: ${name}`, true);
694
- fs2.rmSync(dir, { recursive: true, force: true });
879
+ fs3.rmSync(dir, { recursive: true, force: true });
695
880
  this.log(`\uC2A4\uD0AC \uC9C0\uC6C0: ${name}`);
696
881
  this.opts.onSkillsChanged?.();
697
882
  return text(`\uC9C0\uC6E0\uC2B5\uB2C8\uB2E4: ${name}`);
@@ -710,15 +895,15 @@ ${this.skillIndexText()}`,
710
895
  const depth = Math.min(num(a.depth, 1), 4);
711
896
  const lines = [];
712
897
  const walk = (d, lvl) => {
713
- for (const n of fs2.readdirSync(d, { withFileTypes: true }).sort((x, y) => x.name.localeCompare(y.name))) {
898
+ for (const n of fs3.readdirSync(d, { withFileTypes: true }).sort((x, y) => x.name.localeCompare(y.name))) {
714
899
  if (n.name === "node_modules" || n.name === ".git" || n.name === "__pycache__")
715
900
  continue;
716
- const p = path2.join(d, n.name);
717
- const rel = path2.relative(this.dir, p);
901
+ const p = path3.join(d, n.name);
902
+ const rel = path3.relative(this.dir, p);
718
903
  if (n.isDirectory()) {
719
904
  lines.push(`${rel}/`);
720
905
  if (lvl < depth) walk(p, lvl + 1);
721
- } else lines.push(`${rel} ${fs2.statSync(p).size}B`);
906
+ } else lines.push(`${rel} ${fs3.statSync(p).size}B`);
722
907
  if (lines.length > 2e3) return;
723
908
  }
724
909
  };
@@ -740,7 +925,7 @@ ${this.skillIndexText()}`,
740
925
  annotations: ro,
741
926
  run: async (a) => {
742
927
  const p = this.inDir(str(a.path));
743
- const all = fs2.readFileSync(p, "utf-8").split("{{SKILL_DIR}}").join(this.skillDirOf(p) ?? "{{SKILL_DIR}}");
928
+ const all = fs3.readFileSync(p, "utf-8").split("{{SKILL_DIR}}").join(this.skillDirOf(p) ?? "{{SKILL_DIR}}");
744
929
  const off = Math.max(0, num(a.offset, 0));
745
930
  const part = all.slice(off, off + MAX_READ);
746
931
  const more = off + MAX_READ < all.length ? `
@@ -759,8 +944,8 @@ ${this.skillIndexText()}`,
759
944
  },
760
945
  run: async (a) => {
761
946
  const p = this.inDir(str(a.path));
762
- fs2.mkdirSync(path2.dirname(p), { recursive: true });
763
- fs2.writeFileSync(p, str(a.content));
947
+ fs3.mkdirSync(path3.dirname(p), { recursive: true });
948
+ fs3.writeFileSync(p, str(a.content));
764
949
  return text(`\uC37C\uC2B5\uB2C8\uB2E4: ${p} (${Buffer.byteLength(str(a.content))}B)`);
765
950
  }
766
951
  },
@@ -812,7 +997,7 @@ ${this.skillIndexText()}`,
812
997
  return text(
813
998
  JSON.stringify(
814
999
  {
815
- config: path2.join(this.dir, LOCAL_CONFIG_FILE),
1000
+ config: path3.join(this.dir, LOCAL_CONFIG_FILE),
816
1001
  servers: this.hub.status()
817
1002
  },
818
1003
  null,
@@ -853,7 +1038,7 @@ ${this.skillIndexText()}`,
853
1038
  "\uADF8\uB9BC \uD30C\uC77C(png, jpg, webp, gif)\uB9CC \uBCFC \uC218 \uC788\uC2B5\uB2C8\uB2E4",
854
1039
  true
855
1040
  );
856
- const buf = fs2.readFileSync(p);
1041
+ const buf = fs3.readFileSync(p);
857
1042
  if (buf.length > MAX_IMAGE)
858
1043
  return text(
859
1044
  `\uADF8\uB9BC\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${buf.length}B). \uB354 \uC791\uAC8C \uB80C\uB354\uD574 \uC8FC\uC138\uC694`,
@@ -883,8 +1068,8 @@ ${this.skillIndexText()}`,
883
1068
  const r = await fetch(url, { redirect: "follow" });
884
1069
  if (!r.ok) return text(`\uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: HTTP ${r.status}`, true);
885
1070
  const buf = Buffer.from(await r.arrayBuffer());
886
- fs2.mkdirSync(path2.dirname(p), { recursive: true });
887
- fs2.writeFileSync(p, buf);
1071
+ fs3.mkdirSync(path3.dirname(p), { recursive: true });
1072
+ fs3.writeFileSync(p, buf);
888
1073
  return text(`\uBC1B\uC558\uC2B5\uB2C8\uB2E4: ${p} (${buf.length}B)`);
889
1074
  }
890
1075
  },
@@ -965,8 +1150,8 @@ ${this.skillIndexText()}`,
965
1150
  },
966
1151
  annotations: ro,
967
1152
  run: async (a) => {
968
- const tmp = path2.join(
969
- os.tmpdir(),
1153
+ const tmp = path3.join(
1154
+ os2.tmpdir(),
970
1155
  `cb_blender_shot_${process.pid}_${Date.now()}.png`
971
1156
  );
972
1157
  const r = await this.blenderCall("get_viewport_screenshot", {
@@ -975,31 +1160,31 @@ ${this.skillIndexText()}`,
975
1160
  format: "png"
976
1161
  });
977
1162
  if (r.isError) return r;
978
- if (!fs2.existsSync(tmp))
1163
+ if (!fs3.existsSync(tmp))
979
1164
  return text("Blender \uAC00 \uD654\uBA74\uC744 \uC800\uC7A5\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4", true);
980
- const data = fs2.readFileSync(tmp).toString("base64");
981
- fs2.rmSync(tmp, { force: true });
1165
+ const data = fs3.readFileSync(tmp).toString("base64");
1166
+ fs3.rmSync(tmp, { force: true });
982
1167
  return { content: [{ type: "image", data, mimeType: "image/png" }] };
983
1168
  }
984
1169
  }
985
1170
  ];
986
1171
  }
987
1172
  skillDirOf(p) {
988
- const rel = path2.relative(this.skillsDir, p);
989
- if (rel.startsWith("..") || path2.isAbsolute(rel)) return null;
990
- return path2.join(this.skillsDir, rel.split(path2.sep)[0]);
1173
+ const rel = path3.relative(this.skillsDir, p);
1174
+ if (rel.startsWith("..") || path3.isAbsolute(rel)) return null;
1175
+ return path3.join(this.skillsDir, rel.split(path3.sep)[0]);
991
1176
  }
992
1177
  /** 설치된 스킬 (skills/<이름>/SKILL.md 의 머리말 name, description). */
993
1178
  listSkills() {
994
- if (!fs2.existsSync(this.skillsDir)) return [];
1179
+ if (!fs3.existsSync(this.skillsDir)) return [];
995
1180
  const out = [];
996
- for (const d of fs2.readdirSync(this.skillsDir, { withFileTypes: true })) {
1181
+ for (const d of fs3.readdirSync(this.skillsDir, { withFileTypes: true })) {
997
1182
  if (!d.isDirectory()) continue;
998
- const dir = path2.join(this.skillsDir, d.name);
999
- const md = path2.join(dir, "SKILL.md");
1000
- if (!fs2.existsSync(md)) continue;
1183
+ const dir = path3.join(this.skillsDir, d.name);
1184
+ const md = path3.join(dir, "SKILL.md");
1185
+ if (!fs3.existsSync(md)) continue;
1001
1186
  const head = /^---\r?\n([\s\S]*?)\r?\n---/.exec(
1002
- fs2.readFileSync(md, "utf-8")
1187
+ fs3.readFileSync(md, "utf-8")
1003
1188
  );
1004
1189
  const field = (k) => {
1005
1190
  if (!head) return "";
@@ -1047,8 +1232,8 @@ ${this.skillIndexText()}`,
1047
1232
  */
1048
1233
  async installSkills(source, update2 = false) {
1049
1234
  const src0 = source.trim();
1050
- const localPath = path2.resolve(src0.replace(/^~(?=$|[\\/])/, os.homedir()));
1051
- if (/^[.~/\\]|^[A-Za-z]:[\\/]/.test(src0) && fs2.existsSync(localPath)) {
1235
+ const localPath = path3.resolve(src0.replace(/^~(?=$|[\\/])/, os2.homedir()));
1236
+ if (/^[.~/\\]|^[A-Za-z]:[\\/]/.test(src0) && fs3.existsSync(localPath)) {
1052
1237
  return this.copySkills(localPath, `${localPath}`, update2);
1053
1238
  }
1054
1239
  let s = src0.replace(/^https:\/\/github\.com\//, "").replace(/\.git$/, "");
@@ -1081,17 +1266,17 @@ ${this.skillIndexText()}`,
1081
1266
  throw new Error(
1082
1267
  `GitHub \uC5D0\uC11C \uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: HTTP ${r.status} (${owner}/${repo}@${ref})`
1083
1268
  );
1084
- const tmp = fs2.mkdtempSync(path2.join(os.tmpdir(), "cb_skill_"));
1269
+ const tmp = fs3.mkdtempSync(path3.join(os2.tmpdir(), "cb_skill_"));
1085
1270
  try {
1086
- fs2.writeFileSync(
1087
- path2.join(tmp, "src.tgz"),
1271
+ fs3.writeFileSync(
1272
+ path3.join(tmp, "src.tgz"),
1088
1273
  Buffer.from(await r.arrayBuffer())
1089
1274
  );
1090
1275
  const x = await this.exec(`"${tarBin}" -xzf src.tgz`, tmp, 120);
1091
1276
  if (x.code !== 0) throw new Error(`\uC555\uCD95\uC744 \uD480\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${x.out}`);
1092
- const top = fs2.readdirSync(tmp).find((n) => n !== "src.tgz");
1093
- const root = top ? path2.join(tmp, top, ...sub.split("/").filter(Boolean)) : "";
1094
- if (!root || !fs2.existsSync(root))
1277
+ const top = fs3.readdirSync(tmp).find((n) => n !== "src.tgz");
1278
+ const root = top ? path3.join(tmp, top, ...sub.split("/").filter(Boolean)) : "";
1279
+ if (!root || !fs3.existsSync(root))
1095
1280
  throw new Error(`\uADF8 \uACBD\uB85C\uAC00 \uC800\uC7A5\uC18C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${sub || "(\uB9E8 \uC704)"}`);
1096
1281
  return this.copySkills(
1097
1282
  root,
@@ -1099,20 +1284,20 @@ ${this.skillIndexText()}`,
1099
1284
  update2
1100
1285
  );
1101
1286
  } finally {
1102
- fs2.rmSync(tmp, { recursive: true, force: true });
1287
+ fs3.rmSync(tmp, { recursive: true, force: true });
1103
1288
  }
1104
1289
  }
1105
1290
  copySkills(root, origin, update2) {
1106
1291
  const found = [];
1107
1292
  const walk = (d, depth) => {
1108
- if (fs2.existsSync(path2.join(d, "SKILL.md"))) {
1293
+ if (fs3.existsSync(path3.join(d, "SKILL.md"))) {
1109
1294
  found.push(d);
1110
1295
  return;
1111
1296
  }
1112
1297
  if (depth >= 4) return;
1113
- for (const n of fs2.readdirSync(d, { withFileTypes: true }))
1298
+ for (const n of fs3.readdirSync(d, { withFileTypes: true }))
1114
1299
  if (n.isDirectory() && !n.name.startsWith(".") && n.name !== "node_modules")
1115
- walk(path2.join(d, n.name), depth + 1);
1300
+ walk(path3.join(d, n.name), depth + 1);
1116
1301
  };
1117
1302
  walk(root, 0);
1118
1303
  if (!found.length)
@@ -1120,17 +1305,17 @@ ${this.skillIndexText()}`,
1120
1305
  const installed = [];
1121
1306
  const skipped = [];
1122
1307
  for (const dir of found) {
1123
- const name = path2.basename(dir);
1124
- const dest = path2.join(this.skillsDir, name);
1125
- if (fs2.existsSync(path2.join(dest, "SKILL.md")) && !update2) {
1308
+ const name = path3.basename(dir);
1309
+ const dest = path3.join(this.skillsDir, name);
1310
+ if (fs3.existsSync(path3.join(dest, "SKILL.md")) && !update2) {
1126
1311
  skipped.push(name);
1127
1312
  continue;
1128
1313
  }
1129
- fs2.rmSync(dest, { recursive: true, force: true });
1130
- fs2.cpSync(dir, dest, { recursive: true });
1131
- const rel = path2.relative(root, dir).split(path2.sep).join("/");
1132
- fs2.writeFileSync(
1133
- path2.join(dest, ".source"),
1314
+ fs3.rmSync(dest, { recursive: true, force: true });
1315
+ fs3.cpSync(dir, dest, { recursive: true });
1316
+ const rel = path3.relative(root, dir).split(path3.sep).join("/");
1317
+ fs3.writeFileSync(
1318
+ path3.join(dest, ".source"),
1134
1319
  `${origin}${rel ? ` (${rel})` : ""}
1135
1320
  `
1136
1321
  );
@@ -1145,15 +1330,15 @@ ${this.skillIndexText()}`,
1145
1330
  async updateSkills() {
1146
1331
  const sources = /* @__PURE__ */ new Set();
1147
1332
  for (const k of this.listSkills()) {
1148
- const f = path2.join(k.dir, ".source");
1149
- if (!fs2.existsSync(f)) continue;
1150
- const line = fs2.readFileSync(f, "utf-8").trim();
1333
+ const f = path3.join(k.dir, ".source");
1334
+ if (!fs3.existsSync(f)) continue;
1335
+ const line = fs3.readFileSync(f, "utf-8").trim();
1151
1336
  const origin = line.replace(/ \(.*\)$/, "");
1152
1337
  const rel = /\((.*)\)$/.exec(line)?.[1];
1153
1338
  const [base, ref] = origin.split("@");
1154
1339
  if (ref && /^[0-9a-f]{40}$/.test(ref)) continue;
1155
1340
  sources.add(
1156
- rel && !path2.isAbsolute(base) ? `${base}/${rel}@${ref ?? "HEAD"}` : origin
1341
+ rel && !path3.isAbsolute(base) ? `${base}/${rel}@${ref ?? "HEAD"}` : origin
1157
1342
  );
1158
1343
  }
1159
1344
  const done = [];
@@ -1165,7 +1350,7 @@ ${this.skillIndexText()}`,
1165
1350
  try {
1166
1351
  const r = await this.installSkills(source, update2);
1167
1352
  const names = [...r.installed, ...r.skipped];
1168
- const dirs = names.map((n) => path2.join(this.skillsDir, n));
1353
+ const dirs = names.map((n) => path3.join(this.skillsDir, n));
1169
1354
  return text(
1170
1355
  `${r.installed.length ? `\uC124\uCE58: ${r.installed.join(", ")}` : ""}${r.skipped.length ? `${r.installed.length ? "\n" : ""}\uC774\uBBF8 \uC788\uC74C(update=true \uBA74 \uB2E4\uC2DC \uBC1B\uC74C): ${r.skipped.join(", ")}` : ""}
1171
1356
 
@@ -1178,10 +1363,10 @@ ${this.skillIndexText()}`,
1178
1363
  describeSkill(dest, head) {
1179
1364
  const files = [];
1180
1365
  const walk = (d) => {
1181
- for (const n of fs2.readdirSync(d, { withFileTypes: true })) {
1182
- const p = path2.join(d, n.name);
1366
+ for (const n of fs3.readdirSync(d, { withFileTypes: true })) {
1367
+ const p = path3.join(d, n.name);
1183
1368
  if (n.isDirectory()) walk(p);
1184
- else files.push(path2.relative(dest, p));
1369
+ else files.push(path3.relative(dest, p));
1185
1370
  }
1186
1371
  };
1187
1372
  walk(dest);
@@ -1190,7 +1375,7 @@ ${this.skillIndexText()}`,
1190
1375
  f
1191
1376
  )
1192
1377
  );
1193
- const docs = ["SKILL.md", "README.md"].filter((f) => fs2.existsSync(path2.join(dest, f))).map((f) => fs2.readFileSync(path2.join(dest, f), "utf-8")).join("\n");
1378
+ const docs = ["SKILL.md", "README.md"].filter((f) => fs3.existsSync(path3.join(dest, f))).map((f) => fs3.readFileSync(path3.join(dest, f), "utf-8")).join("\n");
1194
1379
  const KNOWN = [
1195
1380
  ["blender", /\bblender\b/i, "blender"],
1196
1381
  ["zbrush", /\bzbrush\b/i, "zbrush"],
@@ -1244,7 +1429,7 @@ ${this.skillIndexText()}`,
1244
1429
  }
1245
1430
  exec(command, cwd, timeoutSec) {
1246
1431
  return new Promise((resolve5) => {
1247
- const child = (0, import_node_child_process2.spawn)(command, {
1432
+ const child = (0, import_node_child_process3.spawn)(command, {
1248
1433
  cwd,
1249
1434
  shell: true,
1250
1435
  env: this.env(),
@@ -1275,13 +1460,13 @@ ${this.skillIndexText()}`,
1275
1460
  async run(command, cwd, timeout, background) {
1276
1461
  if (!command.trim()) return text("command \uAC00 \uBE44\uC5C8\uC2B5\uB2C8\uB2E4", true);
1277
1462
  const dir = this.inDir(cwd || ".");
1278
- fs2.mkdirSync(dir, { recursive: true });
1463
+ fs3.mkdirSync(dir, { recursive: true });
1279
1464
  this.log(
1280
- `\uC2E4\uD589${background ? " (\uBC31\uADF8\uB77C\uC6B4\uB4DC)" : ""}: ${command} [${path2.relative(this.dir, dir) || "."}]`
1465
+ `\uC2E4\uD589${background ? " (\uBC31\uADF8\uB77C\uC6B4\uB4DC)" : ""}: ${command} [${path3.relative(this.dir, dir) || "."}]`
1281
1466
  );
1282
1467
  if (background) {
1283
1468
  const id = `job${++this.jobSeq}`;
1284
- const child = (0, import_node_child_process2.spawn)(command, {
1469
+ const child = (0, import_node_child_process3.spawn)(command, {
1285
1470
  cwd: dir,
1286
1471
  shell: true,
1287
1472
  env: this.env(),
@@ -1407,12 +1592,12 @@ Blender \uC5D0 BlenderMCP \uC560\uB4DC\uC628(github.com/ahujasid/blender-mcp \uC
1407
1592
  }
1408
1593
  async uploadToStorage(p, folder) {
1409
1594
  const abs = this.inDir(p);
1410
- if (!fs2.existsSync(abs)) return text(`\uD30C\uC77C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4: ${p}`, true);
1595
+ if (!fs3.existsSync(abs)) return text(`\uD30C\uC77C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4: ${p}`, true);
1411
1596
  try {
1412
1597
  const url = await uploadFile(this.opts, abs, folder);
1413
- this.log(`\uC62C\uB9BC: ${path2.basename(abs)} \u2192 ${url}`);
1598
+ this.log(`\uC62C\uB9BC: ${path3.basename(abs)} \u2192 ${url}`);
1414
1599
  return text(
1415
- JSON.stringify({ uploaded: path2.basename(abs), url }, null, 2)
1600
+ JSON.stringify({ uploaded: path3.basename(abs), url }, null, 2)
1416
1601
  );
1417
1602
  } catch (e) {
1418
1603
  return text(e instanceof Error ? e.message : String(e), true);
@@ -1427,7 +1612,7 @@ Blender \uC5D0 BlenderMCP \uC560\uB4DC\uC628(github.com/ahujasid/blender-mcp \uC
1427
1612
  parts.push({
1428
1613
  type: "image_url",
1429
1614
  image_url: {
1430
- url: `data:${mime};base64,${fs2.readFileSync(abs).toString("base64")}`
1615
+ url: `data:${mime};base64,${fs3.readFileSync(abs).toString("base64")}`
1431
1616
  }
1432
1617
  });
1433
1618
  }
@@ -1466,8 +1651,8 @@ Blender \uC5D0 BlenderMCP \uC560\uB4DC\uC628(github.com/ahujasid/blender-mcp \uC
1466
1651
  );
1467
1652
  const src = str(images[0].url);
1468
1653
  const buf = src.startsWith("data:") ? Buffer.from(src.split(",", 2)[1], "base64") : Buffer.from(await (await fetch(src)).arrayBuffer());
1469
- fs2.mkdirSync(path2.dirname(out), { recursive: true });
1470
- fs2.writeFileSync(out, buf);
1654
+ fs3.mkdirSync(path3.dirname(out), { recursive: true });
1655
+ fs3.writeFileSync(out, buf);
1471
1656
  return text(
1472
1657
  `\uC800\uC7A5\uD588\uC2B5\uB2C8\uB2E4: ${out} (${buf.length}B). view_image \uB85C \uD655\uC778\uD558\uC138\uC694.`
1473
1658
  );
@@ -1580,7 +1765,7 @@ function killTree(pid) {
1580
1765
  if (!pid) return;
1581
1766
  try {
1582
1767
  if (process.platform === "win32")
1583
- (0, import_node_child_process2.spawn)("taskkill", ["/pid", String(pid), "/T", "/F"], {
1768
+ (0, import_node_child_process3.spawn)("taskkill", ["/pid", String(pid), "/T", "/F"], {
1584
1769
  windowsHide: true
1585
1770
  });
1586
1771
  else process.kill(pid, "SIGTERM");
@@ -1596,18 +1781,18 @@ function setUploader(fn) {
1596
1781
 
1597
1782
  // src/local-command.ts
1598
1783
  var LOCAL_SERVER_NAME = "\uB0B4 \uCEF4\uD4E8\uD130 (\uB85C\uCEEC \uC2E4\uD589\uAE30)";
1599
- var STATE_PATH = path3.join(os2.homedir(), ".connectbase", "local-runner.json");
1784
+ var STATE_PATH = path4.join(os3.homedir(), ".connectbase", "local-runner.json");
1600
1785
  function loadState() {
1601
1786
  try {
1602
- const s = JSON.parse(fs3.readFileSync(STATE_PATH, "utf-8"));
1787
+ const s = JSON.parse(fs4.readFileSync(STATE_PATH, "utf-8"));
1603
1788
  return { apps: s.apps ?? {}, token: s.token };
1604
1789
  } catch {
1605
1790
  return { apps: {} };
1606
1791
  }
1607
1792
  }
1608
1793
  function saveState(s) {
1609
- fs3.mkdirSync(path3.dirname(STATE_PATH), { recursive: true });
1610
- fs3.writeFileSync(STATE_PATH, `${JSON.stringify(s, null, 2)}
1794
+ fs4.mkdirSync(path4.dirname(STATE_PATH), { recursive: true });
1795
+ fs4.writeFileSync(STATE_PATH, `${JSON.stringify(s, null, 2)}
1611
1796
  `, {
1612
1797
  mode: 384
1613
1798
  });
@@ -1776,8 +1961,8 @@ function makeUploader(mcpUrl, getSt, save) {
1776
1961
  }
1777
1962
  save();
1778
1963
  }
1779
- const buf = fs3.readFileSync(abs);
1780
- const name = path3.basename(abs);
1964
+ const buf = fs4.readFileSync(abs);
1965
+ const name = path4.basename(abs);
1781
1966
  const mime = {
1782
1967
  ".glb": "model/gltf-binary",
1783
1968
  ".gltf": "model/gltf+json",
@@ -1789,7 +1974,7 @@ function makeUploader(mcpUrl, getSt, save) {
1789
1974
  ".fbx": "application/octet-stream",
1790
1975
  ".obj": "text/plain",
1791
1976
  ".json": "application/json"
1792
- }[path3.extname(name).toLowerCase()] ?? "application/octet-stream";
1977
+ }[path4.extname(name).toLowerCase()] ?? "application/octet-stream";
1793
1978
  const base = `${o.baseUrl}/v1/public/storages/files/${st.storageId}`;
1794
1979
  const presign = () => fetch(
1795
1980
  `${base}/presigned-url/path/${encodeURIComponent(folder)}/${encodeURIComponent(name)}`,
@@ -1837,8 +2022,8 @@ function makeUploader(mcpUrl, getSt, save) {
1837
2022
  };
1838
2023
  }
1839
2024
  async function runLocal(config, opts, startTunnel2, out) {
1840
- const dir = path3.resolve(
1841
- opts.dir || path3.join(os2.homedir(), "ConnectBaseLocal")
2025
+ const dir = path4.resolve(
2026
+ opts.dir || path4.join(os3.homedir(), "ConnectBaseLocal")
1842
2027
  );
1843
2028
  const port = opts.port || 47800;
1844
2029
  let syncTools = () => {
@@ -1884,7 +2069,7 @@ async function runLocal(config, opts, startTunnel2, out) {
1884
2069
  await runner.startMcp();
1885
2070
  const mcp = runner.hub.status();
1886
2071
  out.info(
1887
- mcp.length ? `\uC774 PC \uC758 MCP ${mcp.length}\uAC1C: ${mcp.map((m) => `${m.name}(${m.ok ? `\uB3C4\uAD6C ${m.tools}\uAC1C` : "\uC5F0\uACB0 \uC2E4\uD328"})`).join(", ")}` : `\uC774 PC \uC758 MCP \uC5C6\uC74C (\uC2A4\uD0AC\uC774 MCP \uB97C \uC4F0\uBA74: --mcp \uC774\uB984="\uBA85\uB839" \uB610\uB294 ${path3.join(dir, LOCAL_CONFIG_FILE)} \uC5D0 mcpServers)`
2072
+ mcp.length ? `\uC774 PC \uC758 MCP ${mcp.length}\uAC1C: ${mcp.map((m) => `${m.name}(${m.ok ? `\uB3C4\uAD6C ${m.tools}\uAC1C` : "\uC5F0\uACB0 \uC2E4\uD328"})`).join(", ")}` : `\uC774 PC \uC758 MCP \uC5C6\uC74C (\uC2A4\uD0AC\uC774 MCP \uB97C \uC4F0\uBA74: --mcp \uC774\uB984="\uBA85\uB839" \uB610\uB294 ${path4.join(dir, LOCAL_CONFIG_FILE)} \uC5D0 mcpServers)`
1888
2073
  );
1889
2074
  await runner.listen();
1890
2075
  const skills = runner.listSkills().map((k) => k.name);
@@ -1958,6 +2143,25 @@ async function runLocal(config, opts, startTunnel2, out) {
1958
2143
  out.info(
1959
2144
  "AI \uAC00 \uC774 \uCEF4\uD4E8\uD130\uC5D0\uC11C \uBA85\uB839\uC744 \uC2E4\uD589\uD560 \uB54C\uB9C8\uB2E4 \uCF58\uC194\uC5D0\uC11C \uD655\uC778\uC744 \uBB3B\uC2B5\uB2C8\uB2E4. \uBB3B\uC9C0 \uC54A\uAC8C \uD558\uB824\uBA74 \uADF8 MCP \uC11C\uBC84\uC758 \uC790\uB3D9 \uC2B9\uC778\uC744 \uCF1C\uC138\uC694."
1960
2145
  );
2146
+ if (opts.autostart) {
2147
+ try {
2148
+ out.success(
2149
+ installAutostart({
2150
+ appId: info2.appId,
2151
+ dir,
2152
+ port,
2153
+ cwd: process.cwd()
2154
+ })
2155
+ );
2156
+ out.info(
2157
+ `\uAE30\uB85D: ${AUTOSTART_LOG} \uB044\uAE30: npx connectbase-client local --autostart-off`
2158
+ );
2159
+ } catch (e) {
2160
+ out.warn(
2161
+ `\uC790\uB3D9 \uC2DC\uC791 \uB4F1\uB85D \uC2E4\uD328: ${e instanceof Error ? e.message : e}`
2162
+ );
2163
+ }
2164
+ }
1961
2165
  } catch (e) {
1962
2166
  saveState(state);
1963
2167
  out.warn(`MCP \uC11C\uBC84 \uB4F1\uB85D \uC2E4\uD328: ${e instanceof Error ? e.message : e}`);
@@ -1971,28 +2175,28 @@ async function runLocal(config, opts, startTunnel2, out) {
1971
2175
  }
1972
2176
 
1973
2177
  // src/tunnel-utils.ts
1974
- var fs4 = __toESM(require("fs"));
1975
- var os3 = __toESM(require("os"));
1976
- var path4 = __toESM(require("path"));
2178
+ var fs5 = __toESM(require("fs"));
2179
+ var os4 = __toESM(require("os"));
2180
+ var path5 = __toESM(require("path"));
1977
2181
  function getTunnelLockDir() {
1978
- const platform2 = os3.platform();
2182
+ const platform2 = os4.platform();
1979
2183
  if (platform2 === "darwin") {
1980
- return path4.join(
1981
- os3.homedir(),
2184
+ return path5.join(
2185
+ os4.homedir(),
1982
2186
  "Library",
1983
2187
  "Application Support",
1984
2188
  "connectbase",
1985
2189
  "tunnel-locks"
1986
2190
  );
1987
2191
  } else if (platform2 === "win32") {
1988
- return path4.join(
1989
- process.env.LOCALAPPDATA || path4.join(os3.homedir(), "AppData", "Local"),
2192
+ return path5.join(
2193
+ process.env.LOCALAPPDATA || path5.join(os4.homedir(), "AppData", "Local"),
1990
2194
  "connectbase",
1991
2195
  "tunnel-locks"
1992
2196
  );
1993
2197
  }
1994
- const stateHome = process.env.XDG_STATE_HOME || path4.join(os3.homedir(), ".local", "state");
1995
- return path4.join(stateHome, "connectbase", "tunnel-locks");
2198
+ const stateHome = process.env.XDG_STATE_HOME || path5.join(os4.homedir(), ".local", "state");
2199
+ return path5.join(stateHome, "connectbase", "tunnel-locks");
1996
2200
  }
1997
2201
  function isProcessAlive(pid) {
1998
2202
  try {
@@ -2002,23 +2206,28 @@ function isProcessAlive(pid) {
2002
2206
  return e.code === "EPERM";
2003
2207
  }
2004
2208
  }
2209
+ function startedBeforeBoot(startedAt, now = Date.now(), uptimeSec = os4.uptime()) {
2210
+ const t = Date.parse(startedAt);
2211
+ if (Number.isNaN(t)) return false;
2212
+ return t < now - uptimeSec * 1e3;
2213
+ }
2005
2214
  function acquireTunnelLock(appID, port, force, version) {
2006
2215
  const lockDir = getTunnelLockDir();
2007
- fs4.mkdirSync(lockDir, { recursive: true });
2008
- const lockPath = path4.join(lockDir, `${appID}-${port}.lock`);
2216
+ fs5.mkdirSync(lockDir, { recursive: true });
2217
+ const lockPath = path5.join(lockDir, `${appID}-${port}.lock`);
2009
2218
  const lockData = {
2010
2219
  pid: process.pid,
2011
2220
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
2012
2221
  appID,
2013
2222
  port,
2014
- host: os3.hostname(),
2223
+ host: os4.hostname(),
2015
2224
  version
2016
2225
  };
2017
2226
  if (!force) {
2018
2227
  try {
2019
- const fd = fs4.openSync(lockPath, "wx");
2020
- fs4.writeSync(fd, JSON.stringify(lockData, null, 2));
2021
- fs4.closeSync(fd);
2228
+ const fd = fs5.openSync(lockPath, "wx");
2229
+ fs5.writeSync(fd, JSON.stringify(lockData, null, 2));
2230
+ fs5.closeSync(fd);
2022
2231
  return lockPath;
2023
2232
  } catch (e) {
2024
2233
  if (e.code !== "EEXIST") {
@@ -2027,20 +2236,20 @@ function acquireTunnelLock(appID, port, force, version) {
2027
2236
  }
2028
2237
  try {
2029
2238
  const existing = JSON.parse(
2030
- fs4.readFileSync(lockPath, "utf-8")
2239
+ fs5.readFileSync(lockPath, "utf-8")
2031
2240
  );
2032
- if (isProcessAlive(existing.pid)) {
2241
+ if (isProcessAlive(existing.pid) && !startedBeforeBoot(existing.startedAt)) {
2033
2242
  return `LOCKED:${existing.pid}:${existing.startedAt}:${existing.host}`;
2034
2243
  }
2035
2244
  } catch {
2036
2245
  }
2037
2246
  }
2038
- fs4.writeFileSync(lockPath, JSON.stringify(lockData, null, 2));
2247
+ fs5.writeFileSync(lockPath, JSON.stringify(lockData, null, 2));
2039
2248
  return lockPath;
2040
2249
  }
2041
2250
  function releaseTunnelLock(lockPath) {
2042
2251
  try {
2043
- fs4.unlinkSync(lockPath);
2252
+ fs5.unlinkSync(lockPath);
2044
2253
  } catch {
2045
2254
  }
2046
2255
  }
@@ -2071,7 +2280,7 @@ function handleTunnelError(msg, appId, localPort) {
2071
2280
  }
2072
2281
 
2073
2282
  // src/cli.ts
2074
- var VERSION = "6.28.0" ? "6.28.0" : getPackageVersion();
2283
+ var VERSION = "6.30.0" ? "6.30.0" : getPackageVersion();
2075
2284
  var DEFAULT_BASE_URL = "https://api.connectbase.world";
2076
2285
  var colors = {
2077
2286
  reset: "\x1B[0m",
@@ -2210,23 +2419,23 @@ var MIME_BY_EXT = {
2210
2419
  ".safetensors": "application/octet-stream"
2211
2420
  };
2212
2421
  function guessMimeType(filePath) {
2213
- if (ALLOWED_EXTENSIONLESS_FILES.has(path5.basename(filePath))) {
2422
+ if (ALLOWED_EXTENSIONLESS_FILES.has(path6.basename(filePath))) {
2214
2423
  return "text/plain; charset=utf-8";
2215
2424
  }
2216
- return MIME_BY_EXT[path5.extname(filePath).toLowerCase()] || "application/octet-stream";
2425
+ return MIME_BY_EXT[path6.extname(filePath).toLowerCase()] || "application/octet-stream";
2217
2426
  }
2218
2427
  function isAllowedDeployExt(filePath) {
2219
- if (ALLOWED_EXTENSIONLESS_FILES.has(path5.basename(filePath))) {
2428
+ if (ALLOWED_EXTENSIONLESS_FILES.has(path6.basename(filePath))) {
2220
2429
  return true;
2221
2430
  }
2222
- return ALLOWED_EXTENSIONS.has(path5.extname(filePath).toLowerCase());
2431
+ return ALLOWED_EXTENSIONS.has(path6.extname(filePath).toLowerCase());
2223
2432
  }
2224
2433
  function isBinaryDeployExt(filePath) {
2225
- return BINARY_EXTENSIONS.has(path5.extname(filePath).toLowerCase());
2434
+ return BINARY_EXTENSIONS.has(path6.extname(filePath).toLowerCase());
2226
2435
  }
2227
2436
  function isExtensionlessDataFile(filePath) {
2228
- const base = path5.basename(filePath);
2229
- return path5.extname(base) === "" && !ALLOWED_EXTENSIONLESS_FILES.has(base);
2437
+ const base = path6.basename(filePath);
2438
+ return path6.extname(base) === "" && !ALLOWED_EXTENSIONLESS_FILES.has(base);
2230
2439
  }
2231
2440
  var WEB_FILE_MAX_STORED_BYTES = 6 * 1024 * 1024 - 64 * 1024;
2232
2441
  var DEPLOY_REQUEST_BUDGET_BYTES = 96 * 1024 * 1024;
@@ -2312,10 +2521,10 @@ function loadConfig() {
2312
2521
  baseUrl: envBaseUrl || DEFAULT_BASE_URL,
2313
2522
  baseUrlFromRepo: false
2314
2523
  };
2315
- const rcPath = path5.join(process.cwd(), ".connectbaserc");
2316
- if (fs5.existsSync(rcPath)) {
2524
+ const rcPath = path6.join(process.cwd(), ".connectbaserc");
2525
+ if (fs6.existsSync(rcPath)) {
2317
2526
  try {
2318
- const rcContent = JSON.parse(fs5.readFileSync(rcPath, "utf-8"));
2527
+ const rcContent = JSON.parse(fs6.readFileSync(rcPath, "utf-8"));
2319
2528
  if (rcContent.publicKey) config.publicKey = rcContent.publicKey;
2320
2529
  if (rcContent.secretKey) config.secretKey = rcContent.secretKey;
2321
2530
  if (rcContent.storageId) config.storageId = rcContent.storageId;
@@ -2340,16 +2549,16 @@ function collectDeployFiles(dir, options = {}) {
2340
2549
  }
2341
2550
  function collectFiles(dir, baseDir, skipped, options) {
2342
2551
  const files = [];
2343
- const entries = fs5.readdirSync(dir, { withFileTypes: true });
2552
+ const entries = fs6.readdirSync(dir, { withFileTypes: true });
2344
2553
  for (const entry of entries) {
2345
- const fullPath = path5.join(dir, entry.name);
2346
- const relativePath = path5.relative(baseDir, fullPath);
2554
+ const fullPath = path6.join(dir, entry.name);
2555
+ const relativePath = path6.relative(baseDir, fullPath);
2347
2556
  if (entry.isDirectory()) {
2348
2557
  if (!entry.name.startsWith(".")) {
2349
2558
  files.push(...collectFiles(fullPath, baseDir, skipped, options));
2350
2559
  }
2351
2560
  } else if (entry.isFile()) {
2352
- const ext = path5.extname(entry.name).toLowerCase();
2561
+ const ext = path6.extname(entry.name).toLowerCase();
2353
2562
  if (entry.name.startsWith(".")) {
2354
2563
  continue;
2355
2564
  }
@@ -2361,9 +2570,9 @@ function collectFiles(dir, baseDir, skipped, options) {
2361
2570
  const isBinary = extensionlessData || BINARY_EXTENSIONS.has(ext);
2362
2571
  let content;
2363
2572
  if (isBinary) {
2364
- content = fs5.readFileSync(fullPath).toString("base64");
2573
+ content = fs6.readFileSync(fullPath).toString("base64");
2365
2574
  } else {
2366
- content = fs5.readFileSync(fullPath, "utf-8");
2575
+ content = fs6.readFileSync(fullPath, "utf-8");
2367
2576
  }
2368
2577
  const normalized = normalizeRelativePath(relativePath);
2369
2578
  files.push({
@@ -2389,7 +2598,7 @@ function formatSkippedFilesReport(skipped, limit = SKIPPED_FILES_LIST_LIMIT) {
2389
2598
  }
2390
2599
  const byExt = /* @__PURE__ */ new Map();
2391
2600
  for (const p of skipped) {
2392
- const ext = path5.extname(p).toLowerCase() || "(\uD655\uC7A5\uC790 \uC5C6\uC74C)";
2601
+ const ext = path6.extname(p).toLowerCase() || "(\uD655\uC7A5\uC790 \uC5C6\uC74C)";
2393
2602
  byExt.set(ext, (byExt.get(ext) ?? 0) + 1);
2394
2603
  }
2395
2604
  const extSummary = [...byExt.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([ext, n]) => `${ext} ${n}\uAC1C`).join(", ");
@@ -2716,27 +2925,27 @@ function computeDeployTimeout(totalBytes, override) {
2716
2925
  return Math.max(DEPLOY_TIMEOUT_MIN_MS, DEPLOY_TIMEOUT_BASE_MS + sizeBased);
2717
2926
  }
2718
2927
  async function deploy(directory, config, isDev = false, deployOpts = {}) {
2719
- const dir = path5.resolve(directory);
2720
- if (!fs5.existsSync(dir)) {
2928
+ const dir = path6.resolve(directory);
2929
+ if (!fs6.existsSync(dir)) {
2721
2930
  error(`\uB514\uB809\uD1A0\uB9AC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${dir}`);
2722
2931
  process.exit(1);
2723
2932
  }
2724
- const pkgPath = path5.join(process.cwd(), "package.json");
2725
- if (fs5.existsSync(pkgPath)) {
2933
+ const pkgPath = path6.join(process.cwd(), "package.json");
2934
+ if (fs6.existsSync(pkgPath)) {
2726
2935
  try {
2727
- const pkg = JSON.parse(fs5.readFileSync(pkgPath, "utf-8"));
2936
+ const pkg = JSON.parse(fs6.readFileSync(pkgPath, "utf-8"));
2728
2937
  const pm = packageManagerCommands(detectPackageManager(process.cwd()));
2729
2938
  const inside = runningInsidePackageScript(pkg.scripts ?? {});
2730
2939
  for (const line of buildFirstHint(pkg, pm, inside)) warn(line);
2731
2940
  } catch {
2732
2941
  }
2733
2942
  }
2734
- if (!fs5.statSync(dir).isDirectory()) {
2943
+ if (!fs6.statSync(dir).isDirectory()) {
2735
2944
  error(`${dir}\uB294 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC544\uB2D9\uB2C8\uB2E4`);
2736
2945
  process.exit(1);
2737
2946
  }
2738
- const indexPath = path5.join(dir, "index.html");
2739
- if (!fs5.existsSync(indexPath)) {
2947
+ const indexPath = path6.join(dir, "index.html");
2948
+ if (!fs6.existsSync(indexPath)) {
2740
2949
  error("index.html \uD30C\uC77C\uC774 \uD544\uC694\uD569\uB2C8\uB2E4");
2741
2950
  process.exit(1);
2742
2951
  }
@@ -3197,7 +3406,7 @@ function openBrowser(url) {
3197
3406
  function browserAuthStartBody() {
3198
3407
  return {
3199
3408
  flow: "user_code",
3200
- hostname: os4.hostname(),
3409
+ hostname: os5.hostname(),
3201
3410
  os: `${process.platform} ${process.arch}`,
3202
3411
  cli_version: VERSION
3203
3412
  };
@@ -3348,11 +3557,11 @@ ${colors.dim}\uC778\uC99D \uBC29\uC2DD\uC744 \uC120\uD0DD\uD558\uC138\uC694:${co
3348
3557
  return entered;
3349
3558
  }
3350
3559
  function saveSecretKeyToRc(secretKey, dir = process.cwd()) {
3351
- const rcPath = path5.join(dir, ".connectbaserc");
3560
+ const rcPath = path6.join(dir, ".connectbaserc");
3352
3561
  let rcData = {};
3353
- if (fs5.existsSync(rcPath)) {
3562
+ if (fs6.existsSync(rcPath)) {
3354
3563
  try {
3355
- rcData = JSON.parse(fs5.readFileSync(rcPath, "utf-8"));
3564
+ rcData = JSON.parse(fs6.readFileSync(rcPath, "utf-8"));
3356
3565
  } catch {
3357
3566
  }
3358
3567
  }
@@ -3390,11 +3599,11 @@ ${colors.cyan}Connect Base \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654${colors.r
3390
3599
  );
3391
3600
  process.exit(1);
3392
3601
  }
3393
- const rcPath = path5.join(cwd, ".connectbaserc");
3602
+ const rcPath = path6.join(cwd, ".connectbaserc");
3394
3603
  let existingRc = {};
3395
- if (fs5.existsSync(rcPath)) {
3604
+ if (fs6.existsSync(rcPath)) {
3396
3605
  try {
3397
- existingRc = JSON.parse(fs5.readFileSync(rcPath, "utf-8"));
3606
+ existingRc = JSON.parse(fs6.readFileSync(rcPath, "utf-8"));
3398
3607
  } catch {
3399
3608
  }
3400
3609
  if (nonInteractive) {
@@ -3437,7 +3646,7 @@ ${colors.cyan}Connect Base \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654${colors.r
3437
3646
  }
3438
3647
  let appId = "";
3439
3648
  let publicKey = "";
3440
- const projectName = path5.basename(cwd);
3649
+ const projectName = path6.basename(cwd);
3441
3650
  const reuseKeyIfSameApp = (selectedAppId) => {
3442
3651
  if (existingRc.appId === selectedAppId && existingRc.publicKey?.startsWith("cb_pk_")) {
3443
3652
  publicKey = existingRc.publicKey;
@@ -3712,17 +3921,17 @@ ${colors.dim}Claude Code\uC5D0\uC11C MCP\uAC00 \uC790\uB3D9 \uC5F0\uACB0\uB429\u
3712
3921
  `);
3713
3922
  }
3714
3923
  function detectBuildDir() {
3715
- if (fs5.existsSync(path5.join(process.cwd(), "dist"))) return "./dist";
3716
- if (fs5.existsSync(path5.join(process.cwd(), "build"))) return "./build";
3717
- if (fs5.existsSync(path5.join(process.cwd(), "out"))) return "./out";
3718
- const nextConfig = ["next.config.js", "next.config.mjs", "next.config.ts"].map((f) => path5.join(process.cwd(), f)).find((f) => fs5.existsSync(f));
3719
- if (nextConfig || fs5.existsSync(path5.join(process.cwd(), ".next"))) {
3924
+ if (fs6.existsSync(path6.join(process.cwd(), "dist"))) return "./dist";
3925
+ if (fs6.existsSync(path6.join(process.cwd(), "build"))) return "./build";
3926
+ if (fs6.existsSync(path6.join(process.cwd(), "out"))) return "./out";
3927
+ const nextConfig = ["next.config.js", "next.config.mjs", "next.config.ts"].map((f) => path6.join(process.cwd(), f)).find((f) => fs6.existsSync(f));
3928
+ if (nextConfig || fs6.existsSync(path6.join(process.cwd(), ".next"))) {
3720
3929
  if (nextConfig) {
3721
3930
  try {
3722
- const src = fs5.readFileSync(nextConfig, "utf-8");
3931
+ const src = fs6.readFileSync(nextConfig, "utf-8");
3723
3932
  if (!/output\s*:\s*['"]export['"]/.test(src)) {
3724
3933
  warn(
3725
- `Next.js \uAC10\uC9C0: \uC815\uC801 \uBC30\uD3EC\uD558\uB824\uBA74 ${path5.basename(nextConfig)}\uC5D0 output: 'export' \uC124\uC815\uC774 \uD544\uC694\uD569\uB2C8\uB2E4`
3934
+ `Next.js \uAC10\uC9C0: \uC815\uC801 \uBC30\uD3EC\uD558\uB824\uBA74 ${path6.basename(nextConfig)}\uC5D0 output: 'export' \uC124\uC815\uC774 \uD544\uC694\uD569\uB2C8\uB2E4`
3726
3935
  );
3727
3936
  }
3728
3937
  } catch {
@@ -3730,25 +3939,25 @@ function detectBuildDir() {
3730
3939
  }
3731
3940
  return "./out";
3732
3941
  }
3733
- if (fs5.existsSync(path5.join(process.cwd(), "vite.config.ts")) || fs5.existsSync(path5.join(process.cwd(), "vite.config.js")))
3942
+ if (fs6.existsSync(path6.join(process.cwd(), "vite.config.ts")) || fs6.existsSync(path6.join(process.cwd(), "vite.config.js")))
3734
3943
  return "./dist";
3735
3944
  return "./dist";
3736
3945
  }
3737
3946
  function writeSecretFile(filePath, content) {
3738
3947
  try {
3739
- if (fs5.existsSync(filePath)) fs5.chmodSync(filePath, 384);
3948
+ if (fs6.existsSync(filePath)) fs6.chmodSync(filePath, 384);
3740
3949
  } catch {
3741
3950
  }
3742
- fs5.writeFileSync(filePath, content, { mode: 384 });
3951
+ fs6.writeFileSync(filePath, content, { mode: 384 });
3743
3952
  }
3744
3953
  function addToGitignore(entry, basePath) {
3745
3954
  const dir = basePath || process.cwd();
3746
- const gitignorePath = path5.join(dir, ".gitignore");
3747
- if (fs5.existsSync(gitignorePath)) {
3748
- const content = fs5.readFileSync(gitignorePath, "utf-8");
3955
+ const gitignorePath = path6.join(dir, ".gitignore");
3956
+ if (fs6.existsSync(gitignorePath)) {
3957
+ const content = fs6.readFileSync(gitignorePath, "utf-8");
3749
3958
  const lines = content.split(/\r?\n/).map((l) => l.trim());
3750
3959
  if (!lines.includes(entry)) {
3751
- fs5.appendFileSync(gitignorePath, `
3960
+ fs6.appendFileSync(gitignorePath, `
3752
3961
  # Connect Base
3753
3962
  ${entry}
3754
3963
  `);
@@ -3757,7 +3966,7 @@ ${entry}
3757
3966
  info(`.gitignore\uC5D0 \uC774\uBBF8 ${entry}\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4`);
3758
3967
  }
3759
3968
  } else {
3760
- fs5.writeFileSync(gitignorePath, `# Connect Base
3969
+ fs6.writeFileSync(gitignorePath, `# Connect Base
3761
3970
  ${entry}
3762
3971
  `);
3763
3972
  success(".gitignore \uC0DD\uC131 \uC644\uB8CC");
@@ -3788,8 +3997,8 @@ function ancestorCommandLines(maxDepth = 8) {
3788
3997
  let ppid = 0;
3789
3998
  try {
3790
3999
  if (process.platform === "linux") {
3791
- cmd = fs5.readFileSync(`/proc/${pid}/cmdline`).toString("utf8").replace(/\0/g, " ").trim();
3792
- const stat = fs5.readFileSync(`/proc/${pid}/stat`, "utf8");
4000
+ cmd = fs6.readFileSync(`/proc/${pid}/cmdline`).toString("utf8").replace(/\0/g, " ").trim();
4001
+ const stat = fs6.readFileSync(`/proc/${pid}/stat`, "utf8");
3793
4002
  ppid = parseInt(
3794
4003
  stat.slice(stat.lastIndexOf(")") + 2).split(" ")[1],
3795
4004
  10
@@ -3833,7 +4042,7 @@ function buildFirstHint(pkg, pm, insideScript) {
3833
4042
  function detectPackageManager(startDir = process.cwd()) {
3834
4043
  try {
3835
4044
  const pkg = JSON.parse(
3836
- fs5.readFileSync(path5.join(startDir, "package.json"), "utf-8")
4045
+ fs6.readFileSync(path6.join(startDir, "package.json"), "utf-8")
3837
4046
  );
3838
4047
  const declared = typeof pkg.packageManager === "string" ? pkg.packageManager.split("@")[0] : "";
3839
4048
  if (declared === "npm" || declared === "pnpm" || declared === "yarn" || declared === "bun") {
@@ -3849,13 +4058,13 @@ function detectPackageManager(startDir = process.cwd()) {
3849
4058
  ["package-lock.json", "npm"],
3850
4059
  ["npm-shrinkwrap.json", "npm"]
3851
4060
  ];
3852
- let dir = path5.resolve(startDir);
4061
+ let dir = path6.resolve(startDir);
3853
4062
  for (; ; ) {
3854
4063
  for (const [file, pm] of lockfiles) {
3855
- if (fs5.existsSync(path5.join(dir, file))) return pm;
4064
+ if (fs6.existsSync(path6.join(dir, file))) return pm;
3856
4065
  }
3857
- if (fs5.existsSync(path5.join(dir, ".git"))) break;
3858
- const parent = path5.dirname(dir);
4066
+ if (fs6.existsSync(path6.join(dir, ".git"))) break;
4067
+ const parent = path6.dirname(dir);
3859
4068
  if (parent === dir) break;
3860
4069
  dir = parent;
3861
4070
  }
@@ -3869,13 +4078,13 @@ function packageManagerCommands(pm) {
3869
4078
  };
3870
4079
  }
3871
4080
  function addDeployScript(deployDir, pm) {
3872
- const pkgPath = path5.join(process.cwd(), "package.json");
3873
- if (!fs5.existsSync(pkgPath)) {
4081
+ const pkgPath = path6.join(process.cwd(), "package.json");
4082
+ if (!fs6.existsSync(pkgPath)) {
3874
4083
  warn("package.json\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC5B4 deploy \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uCD94\uAC00\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4");
3875
4084
  return { needsInstall: false };
3876
4085
  }
3877
4086
  try {
3878
- const pkg = JSON.parse(fs5.readFileSync(pkgPath, "utf-8"));
4087
+ const pkg = JSON.parse(fs6.readFileSync(pkgPath, "utf-8"));
3879
4088
  if (!pkg.scripts) pkg.scripts = {};
3880
4089
  const declared = (name) => Boolean(pkg.dependencies?.[name] || pkg.devDependencies?.[name]);
3881
4090
  let needsInstall = false;
@@ -3893,7 +4102,7 @@ function addDeployScript(deployDir, pm) {
3893
4102
  pkg.scripts.deploy = pkg.scripts.build ? `${pm.run("build")} && ${deployCmd}` : deployCmd;
3894
4103
  success("package.json\uC5D0 deploy \uC2A4\uD06C\uB9BD\uD2B8 \uCD94\uAC00 \uC644\uB8CC");
3895
4104
  }
3896
- fs5.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
4105
+ fs6.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
3897
4106
  `);
3898
4107
  if (needsInstall) {
3899
4108
  success(
@@ -3924,32 +4133,32 @@ function detectMonorepo(gitRoot) {
3924
4133
  root: gitRoot,
3925
4134
  isSubPackage: false
3926
4135
  };
3927
- if (fs5.existsSync(path5.join(gitRoot, "pnpm-workspace.yaml"))) {
4136
+ if (fs6.existsSync(path6.join(gitRoot, "pnpm-workspace.yaml"))) {
3928
4137
  result.type = "pnpm";
3929
- } else if (fs5.existsSync(path5.join(gitRoot, "turbo.json"))) {
4138
+ } else if (fs6.existsSync(path6.join(gitRoot, "turbo.json"))) {
3930
4139
  result.type = "turborepo";
3931
- } else if (fs5.existsSync(path5.join(gitRoot, "nx.json"))) {
4140
+ } else if (fs6.existsSync(path6.join(gitRoot, "nx.json"))) {
3932
4141
  result.type = "nx";
3933
- } else if (fs5.existsSync(path5.join(gitRoot, "lerna.json"))) {
4142
+ } else if (fs6.existsSync(path6.join(gitRoot, "lerna.json"))) {
3934
4143
  result.type = "lerna";
3935
4144
  } else {
3936
- const rootPkgPath = path5.join(gitRoot, "package.json");
3937
- if (fs5.existsSync(rootPkgPath)) {
4145
+ const rootPkgPath = path6.join(gitRoot, "package.json");
4146
+ if (fs6.existsSync(rootPkgPath)) {
3938
4147
  try {
3939
- const pkg = JSON.parse(fs5.readFileSync(rootPkgPath, "utf-8"));
4148
+ const pkg = JSON.parse(fs6.readFileSync(rootPkgPath, "utf-8"));
3940
4149
  if (pkg.workspaces) {
3941
- result.type = fs5.existsSync(path5.join(gitRoot, "yarn.lock")) ? "yarn" : "npm";
4150
+ result.type = fs6.existsSync(path6.join(gitRoot, "yarn.lock")) ? "yarn" : "npm";
3942
4151
  }
3943
4152
  } catch {
3944
4153
  }
3945
4154
  }
3946
4155
  }
3947
4156
  if (result.type !== "none" && cwd !== gitRoot) {
3948
- const cwdPkgPath = path5.join(cwd, "package.json");
3949
- if (fs5.existsSync(cwdPkgPath)) {
4157
+ const cwdPkgPath = path6.join(cwd, "package.json");
4158
+ if (fs6.existsSync(cwdPkgPath)) {
3950
4159
  result.isSubPackage = true;
3951
4160
  try {
3952
- const pkg = JSON.parse(fs5.readFileSync(cwdPkgPath, "utf-8"));
4161
+ const pkg = JSON.parse(fs6.readFileSync(cwdPkgPath, "utf-8"));
3953
4162
  result.subPackageName = pkg.name;
3954
4163
  } catch {
3955
4164
  }
@@ -3961,7 +4170,7 @@ var DOCS_MANIFEST_FILE = ".connectbase-manifest.json";
3961
4170
  function readDocsManifest(docsDir) {
3962
4171
  try {
3963
4172
  const parsed = JSON.parse(
3964
- fs5.readFileSync(path5.join(docsDir, DOCS_MANIFEST_FILE), "utf-8")
4173
+ fs6.readFileSync(path6.join(docsDir, DOCS_MANIFEST_FILE), "utf-8")
3965
4174
  );
3966
4175
  if (parsed && Array.isArray(parsed.files)) return parsed;
3967
4176
  } catch {
@@ -4012,27 +4221,27 @@ var LEGACY_DOC_FILES = [
4012
4221
  "sdk-oauth-integration.md"
4013
4222
  ];
4014
4223
  async function downloadDocs(baseDir, opts = {}) {
4015
- const quiet = opts.quiet === true;
4224
+ const quiet2 = opts.quiet === true;
4016
4225
  const baseUrl = opts.baseUrl || DEFAULT_BASE_URL;
4017
4226
  if (!baseDir) {
4018
4227
  baseDir = getProjectRoot();
4019
4228
  }
4020
4229
  const gitRoot = getGitRoot() || baseDir;
4021
4230
  const monorepo = detectMonorepo(gitRoot);
4022
- if (!quiet && monorepo.type !== "none") {
4231
+ if (!quiet2 && monorepo.type !== "none") {
4023
4232
  info(`\uBAA8\uB178\uB808\uD3EC \uAC10\uC9C0: ${monorepo.type} (\uB8E8\uD2B8: ${gitRoot})`);
4024
4233
  if (monorepo.isSubPackage) {
4025
4234
  info(
4026
- `\uD604\uC7AC \uC11C\uBE0C \uD328\uD0A4\uC9C0: ${monorepo.subPackageName || path5.basename(process.cwd())}`
4235
+ `\uD604\uC7AC \uC11C\uBE0C \uD328\uD0A4\uC9C0: ${monorepo.subPackageName || path6.basename(process.cwd())}`
4027
4236
  );
4028
4237
  }
4029
4238
  }
4030
- const docsDir = path5.join(gitRoot, ".claude", "docs");
4031
- const rootClaudeMd = path5.join(gitRoot, "CLAUDE.md");
4032
- if (!fs5.existsSync(docsDir)) {
4033
- fs5.mkdirSync(docsDir, { recursive: true });
4239
+ const docsDir = path6.join(gitRoot, ".claude", "docs");
4240
+ const rootClaudeMd = path6.join(gitRoot, "CLAUDE.md");
4241
+ if (!fs6.existsSync(docsDir)) {
4242
+ fs6.mkdirSync(docsDir, { recursive: true });
4034
4243
  }
4035
- if (!quiet) info("SDK \uAC1C\uBC1C \uAC00\uC774\uB4DC \uB2E4\uC6B4\uB85C\uB4DC \uC911...");
4244
+ if (!quiet2) info("SDK \uAC1C\uBC1C \uAC00\uC774\uB4DC \uB2E4\uC6B4\uB85C\uB4DC \uC911...");
4036
4245
  try {
4037
4246
  const res = await makeRequest(
4038
4247
  `${baseUrl}/v1/storages/webs/claude-md?template=rules&format=sections`,
@@ -4047,23 +4256,23 @@ async function downloadDocs(baseDir, opts = {}) {
4047
4256
  const hasher = crypto.createHash("sha256");
4048
4257
  const newFiles = [];
4049
4258
  for (const section of sections) {
4050
- const safeName = path5.basename(section.filename);
4259
+ const safeName = path6.basename(section.filename);
4051
4260
  newFiles.push(safeName);
4052
4261
  hasher.update(safeName).update("\0").update(section.content).update("\0");
4053
4262
  }
4054
4263
  const contentHash = hasher.digest("hex");
4055
4264
  const prevManifest = readDocsManifest(docsDir);
4056
4265
  const allPresent = newFiles.every(
4057
- (f) => fs5.existsSync(path5.join(docsDir, f))
4266
+ (f) => fs6.existsSync(path6.join(docsDir, f))
4058
4267
  );
4059
4268
  if (prevManifest && prevManifest.contentHash === contentHash && allPresent) {
4060
- if (!quiet) success("SDK \uBB38\uC11C\uAC00 \uC774\uBBF8 \uCD5C\uC2E0\uC785\uB2C8\uB2E4");
4061
- updateRootClaudeMd(rootClaudeMd, quiet);
4269
+ if (!quiet2) success("SDK \uBB38\uC11C\uAC00 \uC774\uBBF8 \uCD5C\uC2E0\uC785\uB2C8\uB2E4");
4270
+ updateRootClaudeMd(rootClaudeMd, quiet2);
4062
4271
  if (monorepo.isSubPackage) {
4063
4272
  createSubPackageClaudeMd(
4064
- path5.join(process.cwd(), "CLAUDE.md"),
4273
+ path6.join(process.cwd(), "CLAUDE.md"),
4065
4274
  gitRoot,
4066
- quiet
4275
+ quiet2
4067
4276
  );
4068
4277
  }
4069
4278
  return "unchanged";
@@ -4072,17 +4281,17 @@ async function downloadDocs(baseDir, opts = {}) {
4072
4281
 
4073
4282
  `;
4074
4283
  for (const section of sections) {
4075
- const safeName = path5.basename(section.filename);
4076
- fs5.writeFileSync(path5.join(docsDir, safeName), stamp + section.content);
4284
+ const safeName = path6.basename(section.filename);
4285
+ fs6.writeFileSync(path6.join(docsDir, safeName), stamp + section.content);
4077
4286
  }
4078
- const staleCandidates = prevManifest ? prevManifest.files.map((f) => path5.basename(f)) : LEGACY_DOC_FILES;
4287
+ const staleCandidates = prevManifest ? prevManifest.files.map((f) => path6.basename(f)) : LEGACY_DOC_FILES;
4079
4288
  for (const old of staleCandidates) {
4080
4289
  if (newFiles.includes(old)) continue;
4081
- const oldPath = path5.join(docsDir, old);
4082
- if (fs5.existsSync(oldPath)) {
4290
+ const oldPath = path6.join(docsDir, old);
4291
+ if (fs6.existsSync(oldPath)) {
4083
4292
  try {
4084
- fs5.unlinkSync(oldPath);
4085
- if (!quiet) info(`\uC2A4\uD14C\uC77C \uBB38\uC11C \uC0AD\uC81C: ${old}`);
4293
+ fs6.unlinkSync(oldPath);
4294
+ if (!quiet2) info(`\uC2A4\uD14C\uC77C \uBB38\uC11C \uC0AD\uC81C: ${old}`);
4086
4295
  } catch {
4087
4296
  }
4088
4297
  }
@@ -4093,30 +4302,30 @@ async function downloadDocs(baseDir, opts = {}) {
4093
4302
  contentHash,
4094
4303
  files: newFiles
4095
4304
  };
4096
- fs5.writeFileSync(
4097
- path5.join(docsDir, DOCS_MANIFEST_FILE),
4305
+ fs6.writeFileSync(
4306
+ path6.join(docsDir, DOCS_MANIFEST_FILE),
4098
4307
  `${JSON.stringify(manifest, null, 2)}
4099
4308
  `
4100
4309
  );
4101
- if (!quiet)
4310
+ if (!quiet2)
4102
4311
  success(
4103
4312
  `${gitRoot}/.claude/docs/ \uC5D0 ${sections.length}\uAC1C \uBB38\uC11C \uC800\uC7A5 \uC644\uB8CC`
4104
4313
  );
4105
- updateRootClaudeMd(rootClaudeMd, quiet);
4314
+ updateRootClaudeMd(rootClaudeMd, quiet2);
4106
4315
  if (monorepo.isSubPackage) {
4107
4316
  createSubPackageClaudeMd(
4108
- path5.join(process.cwd(), "CLAUDE.md"),
4317
+ path6.join(process.cwd(), "CLAUDE.md"),
4109
4318
  gitRoot,
4110
- quiet
4319
+ quiet2
4111
4320
  );
4112
4321
  }
4113
- if (!quiet)
4322
+ if (!quiet2)
4114
4323
  log(
4115
4324
  `${colors.dim}\u203B SDK \uBB38\uC11C\uB294 MCP search_sdk_docs\uB85C \uAC80\uC0C9\uD558\uC138\uC694${colors.reset}`
4116
4325
  );
4117
4326
  return "updated";
4118
4327
  } catch {
4119
- if (quiet) return "failed";
4328
+ if (quiet2) return "failed";
4120
4329
  warn("SDK \uAC00\uC774\uB4DC \uB2E4\uC6B4\uB85C\uB4DC \uC2E4\uD328, \uAE30\uBCF8 \uBB38\uC11C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4");
4121
4330
  const fallbackContent = `# ConnectBase \uD504\uB85C\uC81D\uD2B8
4122
4331
 
@@ -4124,17 +4333,17 @@ async function downloadDocs(baseDir, opts = {}) {
4124
4333
 
4125
4334
  \uC0C1\uC138 \uAD6C\uD604\uBC95\uC740 MCP \`search_sdk_docs\` \uB3C4\uAD6C\uB85C \uAC80\uC0C9\uD558\uC138\uC694.
4126
4335
  `;
4127
- fs5.writeFileSync(path5.join(docsDir, "project-rules.md"), fallbackContent);
4336
+ fs6.writeFileSync(path6.join(docsDir, "project-rules.md"), fallbackContent);
4128
4337
  updateRootClaudeMd(rootClaudeMd);
4129
4338
  if (monorepo.isSubPackage) {
4130
- const subClaudeMd = path5.join(process.cwd(), "CLAUDE.md");
4339
+ const subClaudeMd = path6.join(process.cwd(), "CLAUDE.md");
4131
4340
  createSubPackageClaudeMd(subClaudeMd, gitRoot);
4132
4341
  }
4133
4342
  success(`.claude/docs/ \uC0DD\uC131 \uC644\uB8CC (\uAE30\uBCF8)`);
4134
4343
  return "failed";
4135
4344
  }
4136
4345
  }
4137
- function updateRootClaudeMd(claudeMdPath, quiet = false) {
4346
+ function updateRootClaudeMd(claudeMdPath, quiet2 = false) {
4138
4347
  const startMarker = "<!-- CONNECTBASE_START -->";
4139
4348
  const endMarker = "<!-- CONNECTBASE_END -->";
4140
4349
  const sdkBlock = `${startMarker}
@@ -4150,8 +4359,8 @@ function updateRootClaudeMd(claudeMdPath, quiet = false) {
4150
4359
  2. \uCF54\uB4DC\uB97C \uC791\uC131\uD558\uAE30 \uC804 \`search_sdk_docs("\uD0A4\uC6CC\uB4DC")\`\uB85C SDK \uAD6C\uD604 \uBC29\uBC95\uC744 \uAC80\uC0C9\uD558\uACE0, \uAC80\uC0C9 \uACB0\uACFC\uC758 \uCF54\uB4DC \uD328\uD134\uC744 \uADF8\uB300\uB85C \uB530\uB974\uC138\uC694
4151
4360
  3. \`search_sdk_docs\` \uB3C4\uAD6C\uAC00 \uBCF4\uC774\uC9C0 \uC54A\uC73C\uBA74 MCP\uAC00 \uC5F0\uACB0\uB418\uC9C0 \uC54A\uC740 \uC0C1\uD0DC\uC785\uB2C8\uB2E4 \u2014 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \`npx connectbase-client mcp\` \uC2E4\uD589\uC744 \uC548\uB0B4\uD558\uC138\uC694 (Secret Key \uD544\uC694)
4152
4361
  ${endMarker}`;
4153
- if (fs5.existsSync(claudeMdPath)) {
4154
- let content = fs5.readFileSync(claudeMdPath, "utf-8");
4362
+ if (fs6.existsSync(claudeMdPath)) {
4363
+ let content = fs6.readFileSync(claudeMdPath, "utf-8");
4155
4364
  const startIdx = content.indexOf(startMarker);
4156
4365
  const endIdx = content.indexOf(endMarker);
4157
4366
  if (startIdx !== -1 && endIdx !== -1) {
@@ -4161,20 +4370,20 @@ ${endMarker}`;
4161
4370
 
4162
4371
  ${content.trimStart()}`;
4163
4372
  }
4164
- fs5.writeFileSync(claudeMdPath, content);
4165
- if (!quiet) info("CLAUDE.md\uC5D0 ConnectBase \uCC38\uC870 \uC5C5\uB370\uC774\uD2B8 \uC644\uB8CC");
4373
+ fs6.writeFileSync(claudeMdPath, content);
4374
+ if (!quiet2) info("CLAUDE.md\uC5D0 ConnectBase \uCC38\uC870 \uC5C5\uB370\uC774\uD2B8 \uC644\uB8CC");
4166
4375
  } else {
4167
- fs5.writeFileSync(claudeMdPath, `# \uD504\uB85C\uC81D\uD2B8
4376
+ fs6.writeFileSync(claudeMdPath, `# \uD504\uB85C\uC81D\uD2B8
4168
4377
 
4169
4378
  ${sdkBlock}
4170
4379
  `);
4171
- if (!quiet) success("CLAUDE.md \uC0DD\uC131 \uC644\uB8CC");
4380
+ if (!quiet2) success("CLAUDE.md \uC0DD\uC131 \uC644\uB8CC");
4172
4381
  }
4173
4382
  }
4174
- function createSubPackageClaudeMd(subClaudeMdPath, gitRoot, quiet = false) {
4383
+ function createSubPackageClaudeMd(subClaudeMdPath, gitRoot, quiet2 = false) {
4175
4384
  const startMarker = "<!-- CONNECTBASE_SUB_START -->";
4176
4385
  const endMarker = "<!-- CONNECTBASE_SUB_END -->";
4177
- const relPath = path5.relative(path5.dirname(subClaudeMdPath), gitRoot);
4386
+ const relPath = path6.relative(path6.dirname(subClaudeMdPath), gitRoot);
4178
4387
  const subBlock = `${startMarker}
4179
4388
  ## ConnectBase SDK
4180
4389
 
@@ -4186,8 +4395,8 @@ function createSubPackageClaudeMd(subClaudeMdPath, gitRoot, quiet = false) {
4186
4395
  2. \uCF54\uB4DC\uB97C \uC791\uC131\uD558\uAE30 \uC804 \`search_sdk_docs("\uD0A4\uC6CC\uB4DC")\`\uB85C SDK \uAD6C\uD604 \uBC29\uBC95\uC744 \uAC80\uC0C9\uD558\uC138\uC694
4187
4396
  3. \`search_sdk_docs\` \uB3C4\uAD6C\uAC00 \uBCF4\uC774\uC9C0 \uC54A\uC73C\uBA74 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \`npx connectbase-client mcp\` \uC2E4\uD589\uC744 \uC548\uB0B4\uD558\uC138\uC694
4188
4397
  ${endMarker}`;
4189
- if (fs5.existsSync(subClaudeMdPath)) {
4190
- let content = fs5.readFileSync(subClaudeMdPath, "utf-8");
4398
+ if (fs6.existsSync(subClaudeMdPath)) {
4399
+ let content = fs6.readFileSync(subClaudeMdPath, "utf-8");
4191
4400
  const startIdx = content.indexOf(startMarker);
4192
4401
  const endIdx = content.indexOf(endMarker);
4193
4402
  if (startIdx !== -1 && endIdx !== -1) {
@@ -4200,17 +4409,17 @@ ${subBlock}
4200
4409
  } else {
4201
4410
  return;
4202
4411
  }
4203
- fs5.writeFileSync(subClaudeMdPath, content);
4412
+ fs6.writeFileSync(subClaudeMdPath, content);
4204
4413
  } else {
4205
- fs5.writeFileSync(
4414
+ fs6.writeFileSync(
4206
4415
  subClaudeMdPath,
4207
- `# ${path5.basename(path5.dirname(subClaudeMdPath))}
4416
+ `# ${path6.basename(path6.dirname(subClaudeMdPath))}
4208
4417
 
4209
4418
  ${subBlock}
4210
4419
  `
4211
4420
  );
4212
4421
  }
4213
- if (!quiet) success(`\uC11C\uBE0C \uD328\uD0A4\uC9C0 CLAUDE.md \uC0DD\uC131 \uC644\uB8CC: ${subClaudeMdPath}`);
4422
+ if (!quiet2) success(`\uC11C\uBE0C \uD328\uD0A4\uC9C0 CLAUDE.md \uC0DD\uC131 \uC644\uB8CC: ${subClaudeMdPath}`);
4214
4423
  }
4215
4424
  async function setupMcp(secretKey, baseUrl = DEFAULT_BASE_URL) {
4216
4425
  const gitRoot = getGitRoot();
@@ -4222,7 +4431,7 @@ async function setupMcp(secretKey, baseUrl = DEFAULT_BASE_URL) {
4222
4431
  info(`MCP \uC124\uC815\uC740 \uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8(${root})\uC5D0 \uC0DD\uC131\uB429\uB2C8\uB2E4`);
4223
4432
  }
4224
4433
  }
4225
- const mcpConfigPath = path5.join(root, ".mcp.json");
4434
+ const mcpConfigPath = path6.join(root, ".mcp.json");
4226
4435
  if (secretKey) {
4227
4436
  const check = await fetchAppsWithSecretKey(baseUrl, secretKey).catch(
4228
4437
  () => null
@@ -4257,17 +4466,17 @@ async function setupMcp(secretKey, baseUrl = DEFAULT_BASE_URL) {
4257
4466
  }
4258
4467
  };
4259
4468
  let mcpConfig = { mcpServers: {} };
4260
- if (fs5.existsSync(mcpConfigPath)) {
4469
+ if (fs6.existsSync(mcpConfigPath)) {
4261
4470
  try {
4262
- mcpConfig = JSON.parse(fs5.readFileSync(mcpConfigPath, "utf-8"));
4471
+ mcpConfig = JSON.parse(fs6.readFileSync(mcpConfigPath, "utf-8"));
4263
4472
  if (!mcpConfig.mcpServers || typeof mcpConfig.mcpServers !== "object") {
4264
4473
  mcpConfig.mcpServers = {};
4265
4474
  }
4266
4475
  } catch {
4267
4476
  const backupPath = `${mcpConfigPath}.backup`;
4268
- fs5.copyFileSync(mcpConfigPath, backupPath);
4477
+ fs6.copyFileSync(mcpConfigPath, backupPath);
4269
4478
  try {
4270
- fs5.chmodSync(backupPath, 384);
4479
+ fs6.chmodSync(backupPath, 384);
4271
4480
  } catch {
4272
4481
  }
4273
4482
  warn(`.mcp.json \uD30C\uC2F1 \uC2E4\uD328, \uBC31\uC5C5 \uC0DD\uC131: ${backupPath}`);
@@ -4328,14 +4537,14 @@ function findSubPackagesWithConfig(gitRoot) {
4328
4537
  const results = [];
4329
4538
  const candidates = ["apps", "packages", "projects", "services", "libs"];
4330
4539
  for (const candidate of candidates) {
4331
- const dir = path5.join(gitRoot, candidate);
4332
- if (!fs5.existsSync(dir)) continue;
4540
+ const dir = path6.join(gitRoot, candidate);
4541
+ if (!fs6.existsSync(dir)) continue;
4333
4542
  try {
4334
- const entries = fs5.readdirSync(dir, { withFileTypes: true });
4543
+ const entries = fs6.readdirSync(dir, { withFileTypes: true });
4335
4544
  for (const entry of entries) {
4336
4545
  if (!entry.isDirectory() || entry.name.startsWith(".")) continue;
4337
- const subDir = path5.join(dir, entry.name);
4338
- if (fs5.existsSync(path5.join(subDir, ".connectbaserc"))) {
4546
+ const subDir = path6.join(dir, entry.name);
4547
+ if (fs6.existsSync(path6.join(subDir, ".connectbaserc"))) {
4339
4548
  results.push(subDir);
4340
4549
  }
4341
4550
  }
@@ -4343,13 +4552,13 @@ function findSubPackagesWithConfig(gitRoot) {
4343
4552
  }
4344
4553
  }
4345
4554
  try {
4346
- const entries = fs5.readdirSync(gitRoot, { withFileTypes: true });
4555
+ const entries = fs6.readdirSync(gitRoot, { withFileTypes: true });
4347
4556
  for (const entry of entries) {
4348
4557
  if (!entry.isDirectory() || entry.name.startsWith(".") || candidates.includes(entry.name))
4349
4558
  continue;
4350
4559
  if (entry.name === "node_modules") continue;
4351
- const subDir = path5.join(gitRoot, entry.name);
4352
- if (fs5.existsSync(path5.join(subDir, ".connectbaserc")) && !results.includes(subDir)) {
4560
+ const subDir = path6.join(gitRoot, entry.name);
4561
+ if (fs6.existsSync(path6.join(subDir, ".connectbaserc")) && !results.includes(subDir)) {
4353
4562
  results.push(subDir);
4354
4563
  }
4355
4564
  }
@@ -4393,7 +4602,7 @@ ${colors.cyan}ConnectBase Update${colors.reset}
4393
4602
  info(`ConnectBase\uB97C \uC0AC\uC6A9\uD558\uB294 \uC11C\uBE0C \uD328\uD0A4\uC9C0 ${subPackages.length}\uAC1C \uBC1C\uACAC:`);
4394
4603
  for (const sp of subPackages) {
4395
4604
  log(
4396
- ` ${colors.dim}\u2022 ${path5.relative(projectRoot, sp)}${colors.reset}`
4605
+ ` ${colors.dim}\u2022 ${path6.relative(projectRoot, sp)}${colors.reset}`
4397
4606
  );
4398
4607
  }
4399
4608
  }
@@ -4405,14 +4614,14 @@ ${colors.cyan}ConnectBase Update${colors.reset}
4405
4614
  }
4406
4615
  if (!opts.skipMcp) {
4407
4616
  log("");
4408
- const mcpConfigPath = path5.join(projectRoot, ".mcp.json");
4409
- if (fs5.existsSync(mcpConfigPath)) {
4617
+ const mcpConfigPath = path6.join(projectRoot, ".mcp.json");
4618
+ if (fs6.existsSync(mcpConfigPath)) {
4410
4619
  let secretKey = config.secretKey;
4411
4620
  if (!secretKey) {
4412
- const rootRcPath = path5.join(projectRoot, ".connectbaserc");
4413
- if (fs5.existsSync(rootRcPath)) {
4621
+ const rootRcPath = path6.join(projectRoot, ".connectbaserc");
4622
+ if (fs6.existsSync(rootRcPath)) {
4414
4623
  try {
4415
- const rc = JSON.parse(fs5.readFileSync(rootRcPath, "utf-8"));
4624
+ const rc = JSON.parse(fs6.readFileSync(rootRcPath, "utf-8"));
4416
4625
  secretKey = rc.secretKey;
4417
4626
  } catch {
4418
4627
  }
@@ -4423,7 +4632,7 @@ ${colors.cyan}ConnectBase Update${colors.reset}
4423
4632
  for (const sp of subPackages) {
4424
4633
  try {
4425
4634
  const rc = JSON.parse(
4426
- fs5.readFileSync(path5.join(sp, ".connectbaserc"), "utf-8")
4635
+ fs6.readFileSync(path6.join(sp, ".connectbaserc"), "utf-8")
4427
4636
  );
4428
4637
  if (rc.secretKey) {
4429
4638
  secretKey = rc.secretKey;
@@ -4435,7 +4644,7 @@ ${colors.cyan}ConnectBase Update${colors.reset}
4435
4644
  }
4436
4645
  if (secretKey) {
4437
4646
  try {
4438
- const mcpConfig = JSON.parse(fs5.readFileSync(mcpConfigPath, "utf-8"));
4647
+ const mcpConfig = JSON.parse(fs6.readFileSync(mcpConfigPath, "utf-8"));
4439
4648
  const servers = mcpConfig.mcpServers || {};
4440
4649
  if (servers["connect-base"]) {
4441
4650
  servers["connect-base"] = {
@@ -4474,15 +4683,15 @@ ${colors.green}\uC5C5\uB370\uC774\uD2B8 \uC644\uB8CC!${colors.reset}
4474
4683
  `);
4475
4684
  }
4476
4685
  function setupMonorepoRoot(projectRoot, monorepo) {
4477
- const rootPkgPath = path5.join(projectRoot, "package.json");
4478
- if (!fs5.existsSync(rootPkgPath)) {
4686
+ const rootPkgPath = path6.join(projectRoot, "package.json");
4687
+ if (!fs6.existsSync(rootPkgPath)) {
4479
4688
  warn(
4480
4689
  "\uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8\uC5D0 package.json\uC774 \uC5C6\uC5B4 \uD3B8\uC758 \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uCD94\uAC00\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4"
4481
4690
  );
4482
4691
  return;
4483
4692
  }
4484
4693
  try {
4485
- const pkg = JSON.parse(fs5.readFileSync(rootPkgPath, "utf-8"));
4694
+ const pkg = JSON.parse(fs6.readFileSync(rootPkgPath, "utf-8"));
4486
4695
  if (!pkg.scripts) pkg.scripts = {};
4487
4696
  let changed = false;
4488
4697
  if (!pkg.scripts["cb:update"]) {
@@ -4498,7 +4707,7 @@ function setupMonorepoRoot(projectRoot, monorepo) {
4498
4707
  changed = true;
4499
4708
  }
4500
4709
  if (changed) {
4501
- fs5.writeFileSync(rootPkgPath, `${JSON.stringify(pkg, null, 2)}
4710
+ fs6.writeFileSync(rootPkgPath, `${JSON.stringify(pkg, null, 2)}
4502
4711
  `);
4503
4712
  success("\uBAA8\uB178\uB808\uD3EC \uB8E8\uD2B8\uC5D0 \uD3B8\uC758 \uC2A4\uD06C\uB9BD\uD2B8 \uCD94\uAC00 \uC644\uB8CC");
4504
4713
  log(` ${colors.dim}\uC0AC\uC6A9\uBC95:${colors.reset}`);
@@ -4903,7 +5112,7 @@ ${colors.blue}?${colors.reset} \uC571 \uC120\uD0DD (\uBC88\uD638): `
4903
5112
  success(`\uC120\uD0DD\uB428: ${apps[num2 - 1].name}`);
4904
5113
  return { appId: apps[num2 - 1].id };
4905
5114
  }
4906
- const projectName = path5.basename(process.cwd());
5115
+ const projectName = path6.basename(process.cwd());
4907
5116
  const appName = await prompt(
4908
5117
  `${colors.blue}?${colors.reset} \uC571 \uC774\uB984 (${projectName}): `
4909
5118
  ) || projectName;
@@ -4986,11 +5195,11 @@ async function startTunnel(port, config, tunnelOpts) {
4986
5195
  info("Secret Key\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. \uBE0C\uB77C\uC6B0\uC800 \uB85C\uADF8\uC778\uC73C\uB85C \uBC1C\uAE09\uD569\uB2C8\uB2E4...");
4987
5196
  try {
4988
5197
  const sk = await browserAuthFlow();
4989
- const rcPath2 = path5.join(process.cwd(), ".connectbaserc");
5198
+ const rcPath2 = path6.join(process.cwd(), ".connectbaserc");
4990
5199
  let rcData = {};
4991
- if (fs5.existsSync(rcPath2)) {
5200
+ if (fs6.existsSync(rcPath2)) {
4992
5201
  try {
4993
- rcData = JSON.parse(fs5.readFileSync(rcPath2, "utf-8"));
5202
+ rcData = JSON.parse(fs6.readFileSync(rcPath2, "utf-8"));
4994
5203
  } catch {
4995
5204
  }
4996
5205
  }
@@ -5009,11 +5218,11 @@ async function startTunnel(port, config, tunnelOpts) {
5009
5218
  } else {
5010
5219
  config.secretKey = tunnelKey;
5011
5220
  }
5012
- const rcPath = path5.join(process.cwd(), ".connectbaserc");
5221
+ const rcPath = path6.join(process.cwd(), ".connectbaserc");
5013
5222
  let savedAppId = tunnelOpts?.appId || "";
5014
5223
  if (!savedAppId) {
5015
5224
  try {
5016
- const rc = JSON.parse(fs5.readFileSync(rcPath, "utf-8"));
5225
+ const rc = JSON.parse(fs6.readFileSync(rcPath, "utf-8"));
5017
5226
  if (rc.tunnelAppId) savedAppId = rc.tunnelAppId;
5018
5227
  } catch {
5019
5228
  }
@@ -5021,9 +5230,9 @@ async function startTunnel(port, config, tunnelOpts) {
5021
5230
  const { appId } = await resolveApp(tunnelKey, config.baseUrl, savedAppId);
5022
5231
  try {
5023
5232
  let rcData = {};
5024
- if (fs5.existsSync(rcPath)) {
5233
+ if (fs6.existsSync(rcPath)) {
5025
5234
  try {
5026
- rcData = JSON.parse(fs5.readFileSync(rcPath, "utf-8"));
5235
+ rcData = JSON.parse(fs6.readFileSync(rcPath, "utf-8"));
5027
5236
  } catch {
5028
5237
  }
5029
5238
  }
@@ -5785,6 +5994,7 @@ ${colors.yellow}\uBA85\uB839\uC5B4:${colors.reset}
5785
5994
  --mcp <\uC774\uB984>="<\uBA85\uB839>" | <\uC774\uB984>=<http \uC8FC\uC18C> \uC2A4\uD0AC\uC774 \uC4F0\uB294 PC \uC758 MCP \uC11C\uBC84 \uCD94\uAC00 (\uC5EC\uB7EC \uBC88 \uAC00\uB2A5,
5786
5995
  \uC791\uC5C5 \uD3F4\uB354\uC758 connectbase-local.json mcpServers \uC5D0 \uC800\uC7A5. Claude Desktop \uACFC \uAC19\uC740 \uD615\uC2DD)
5787
5996
  --update \uC124\uCE58\uB41C \uC2A4\uD0AC \uB2E4\uC2DC \uBC1B\uAE30 --dir <\uD3F4\uB354> \uC791\uC5C5 \uD3F4\uB354 (\uAE30\uBCF8 ~/ConnectBaseLocal)
5997
+ --autostart \uCEF4\uD4E8\uD130\uB97C \uCF1C\uBA74 \uC800\uC808\uB85C \uCF1C\uC9C0\uAC8C \uB4F1\uB85D (\uAEBC\uC9C0\uBA74 \uB2E4\uC2DC \uCF2C) --autostart-off \uB4F1\uB85D \uC9C0\uC6B0\uAE30
5788
5998
  \uC608: npx connectbase-client local --add yorusd1/yoruskills
5789
5999
 
5790
6000
  ${colors.yellow}\uCF54\uB4DC \uBD84\uC11D (MCP \uD1B5\uD574 \uC0AC\uC6A9):${colors.reset}
@@ -5928,8 +6138,8 @@ async function enforceBaseUrlPolicy(baseUrl, opts) {
5928
6138
  process.exit(1);
5929
6139
  }
5930
6140
  function isOutsideProject(dir, root) {
5931
- const relative3 = path5.relative(path5.resolve(root), path5.resolve(root, dir));
5932
- return relative3 === ".." || relative3.startsWith(`..${path5.sep}`) || path5.isAbsolute(relative3);
6141
+ const relative3 = path6.relative(path6.resolve(root), path6.resolve(root, dir));
6142
+ return relative3 === ".." || relative3.startsWith(`..${path6.sep}`) || path6.isAbsolute(relative3);
5933
6143
  }
5934
6144
  function parseArgs(args) {
5935
6145
  const result = {
@@ -5969,6 +6179,10 @@ function parseArgs(args) {
5969
6179
  result.options.add = result.options.add ? `${result.options.add},${args[++i]}` : args[++i];
5970
6180
  } else if (arg === "--update") {
5971
6181
  result.options.update = "true";
6182
+ } else if (arg === "--autostart") {
6183
+ result.options.autostart = "true";
6184
+ } else if (arg === "--autostart-off") {
6185
+ result.options.autostartOff = "true";
5972
6186
  } else if (arg === "--mcp") {
5973
6187
  result.options.mcp = result.options.mcp ? `${result.options.mcp}\0${args[++i]}` : args[++i];
5974
6188
  } else if (arg === "--force") {
@@ -6085,8 +6299,8 @@ async function main() {
6085
6299
  if (parsed.options.skipDocs !== "true") {
6086
6300
  try {
6087
6301
  const docsRoot = getGitRoot() || getProjectRoot();
6088
- if (fs5.existsSync(
6089
- path5.join(docsRoot, ".claude", "docs", DOCS_MANIFEST_FILE)
6302
+ if (fs6.existsSync(
6303
+ path6.join(docsRoot, ".claude", "docs", DOCS_MANIFEST_FILE)
6090
6304
  )) {
6091
6305
  const refreshed = await downloadDocs(docsRoot, {
6092
6306
  quiet: true,
@@ -6118,6 +6332,10 @@ async function main() {
6118
6332
  await listReleases(config);
6119
6333
  }
6120
6334
  } else if (parsed.command === "local") {
6335
+ if (parsed.options.autostartOff === "true") {
6336
+ success(removeAutostart());
6337
+ process.exit(0);
6338
+ }
6121
6339
  const port = parsed.options.port ? parseInt(parsed.options.port, 10) : 47800;
6122
6340
  if (Number.isNaN(port) || port < 1 || port > 65535) {
6123
6341
  error("\uC720\uD6A8\uD55C \uD3EC\uD2B8 \uBC88\uD638\uB97C \uC785\uB825\uD558\uC138\uC694 (1-65535)");
@@ -6132,7 +6350,8 @@ async function main() {
6132
6350
  force: parsed.options.force === "true",
6133
6351
  add: parsed.options.add,
6134
6352
  update: parsed.options.update === "true",
6135
- mcp: parsed.options.mcp
6353
+ mcp: parsed.options.mcp,
6354
+ autostart: parsed.options.autostart === "true"
6136
6355
  },
6137
6356
  (p, c, o) => startTunnel(p, c, o),
6138
6357
  { info, success, warn }