cc-claw 0.12.6 → 0.12.7

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.
Files changed (2) hide show
  1. package/dist/cli.js +45 -41
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -72,7 +72,7 @@ var VERSION;
72
72
  var init_version = __esm({
73
73
  "src/version.ts"() {
74
74
  "use strict";
75
- VERSION = true ? "0.12.6" : (() => {
75
+ VERSION = true ? "0.12.7" : (() => {
76
76
  try {
77
77
  return JSON.parse(readFileSync(join2(process.cwd(), "package.json"), "utf-8")).version ?? "unknown";
78
78
  } catch {
@@ -3489,7 +3489,7 @@ var init_claude = __esm({
3489
3489
  });
3490
3490
 
3491
3491
  // src/backends/gemini.ts
3492
- import { existsSync as existsSync3 } from "fs";
3492
+ import { existsSync as existsSync3, mkdirSync } from "fs";
3493
3493
  import { execSync as execSync2 } from "child_process";
3494
3494
  import { join as join5 } from "path";
3495
3495
  function stripThinkingContent(text) {
@@ -3665,6 +3665,10 @@ var init_gemini = __esm({
3665
3665
  if (!slot) return { env, slot: null };
3666
3666
  if (slot.slotType === "api_key" && slot.apiKey) {
3667
3667
  env.GEMINI_API_KEY = slot.apiKey;
3668
+ const isolatedHome = join5(CC_CLAW_HOME, "gemini-slots", `apikey-${slot.id}`);
3669
+ if (!existsSync3(isolatedHome)) mkdirSync(isolatedHome, { recursive: true });
3670
+ env.GEMINI_CLI_HOME = isolatedHome;
3671
+ delete env.GOOGLE_API_KEY;
3668
3672
  } else if (slot.slotType === "oauth" && slot.configHome) {
3669
3673
  env.GEMINI_CLI_HOME = slot.configHome;
3670
3674
  delete env.GEMINI_API_KEY;
@@ -4520,7 +4524,7 @@ If the user asks *how* to do something with CC-Claw, use this expertise to sugge
4520
4524
  import {
4521
4525
  existsSync as existsSync7,
4522
4526
  writeFileSync,
4523
- mkdirSync,
4527
+ mkdirSync as mkdirSync2,
4524
4528
  readFileSync as readFileSync2,
4525
4529
  statSync as statSync2,
4526
4530
  copyFileSync,
@@ -4544,11 +4548,11 @@ function migrateFile(legacyPath, newPath, label2) {
4544
4548
  }
4545
4549
  function bootstrapWorkspaceFiles() {
4546
4550
  if (!existsSync7(IDENTITY_PATH)) {
4547
- mkdirSync(IDENTITY_PATH, { recursive: true });
4551
+ mkdirSync2(IDENTITY_PATH, { recursive: true });
4548
4552
  log("[bootstrap] Created identity/ directory");
4549
4553
  }
4550
4554
  if (!existsSync7(WORKSPACE_PATH)) {
4551
- mkdirSync(WORKSPACE_PATH, { recursive: true });
4555
+ mkdirSync2(WORKSPACE_PATH, { recursive: true });
4552
4556
  }
4553
4557
  migrateFile(LEGACY_SOUL_PATH, SOUL_PATH, "SOUL.md");
4554
4558
  migrateFile(LEGACY_USER_PATH, USER_PATH, "USER.md");
@@ -4575,11 +4579,11 @@ function bootstrapWorkspaceFiles() {
4575
4579
  log(`[bootstrap] Created default USER.md (timezone: ${tz})`);
4576
4580
  }
4577
4581
  if (!existsSync7(CONTEXT_DIR)) {
4578
- mkdirSync(CONTEXT_DIR, { recursive: true });
4582
+ mkdirSync2(CONTEXT_DIR, { recursive: true });
4579
4583
  log("[bootstrap] Created context/ directory");
4580
4584
  }
4581
4585
  if (!existsSync7(MEDIA_PATH)) {
4582
- mkdirSync(MEDIA_PATH, { recursive: true });
4586
+ mkdirSync2(MEDIA_PATH, { recursive: true });
4583
4587
  log("[bootstrap] Created media/ directory");
4584
4588
  }
4585
4589
  const expertisePath = join6(CONTEXT_DIR, "cc-claw-expertise.md");
@@ -5670,7 +5674,7 @@ var init_propagate = __esm({
5670
5674
  });
5671
5675
 
5672
5676
  // src/agents/mcp-config.ts
5673
- import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, existsSync as existsSync9, readdirSync as readdirSync3, unlinkSync as unlinkSync3 } from "fs";
5677
+ import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync2, existsSync as existsSync9, readdirSync as readdirSync3, unlinkSync as unlinkSync3 } from "fs";
5674
5678
  import { join as join8, dirname } from "path";
5675
5679
  import { fileURLToPath } from "url";
5676
5680
  function generateOrchestratorMcpConfig(opts) {
@@ -5692,7 +5696,7 @@ function generateOrchestratorMcpConfig(opts) {
5692
5696
  };
5693
5697
  }
5694
5698
  function writeMcpConfigFile(config2) {
5695
- mkdirSync2(MCP_CONFIG_DIR, { recursive: true, mode: 448 });
5699
+ mkdirSync3(MCP_CONFIG_DIR, { recursive: true, mode: 448 });
5696
5700
  const jsonConfig = {
5697
5701
  mcpServers: {
5698
5702
  [config2.name]: {
@@ -5835,7 +5839,7 @@ var init_loader2 = __esm({
5835
5839
  });
5836
5840
 
5837
5841
  // src/agents/agent-log.ts
5838
- import { writeFileSync as writeFileSync3, readdirSync as readdirSync5, statSync as statSync3, unlinkSync as unlinkSync4, mkdirSync as mkdirSync3 } from "fs";
5842
+ import { writeFileSync as writeFileSync3, readdirSync as readdirSync5, statSync as statSync3, unlinkSync as unlinkSync4, mkdirSync as mkdirSync4 } from "fs";
5839
5843
  import { join as join10 } from "path";
5840
5844
  function truncate(text, maxBytes) {
5841
5845
  if (Buffer.byteLength(text, "utf-8") <= maxBytes) return text;
@@ -5875,7 +5879,7 @@ function writeAgentLog(data) {
5875
5879
  ""
5876
5880
  ];
5877
5881
  try {
5878
- mkdirSync3(AGENTS_PATH, { recursive: true });
5882
+ mkdirSync4(AGENTS_PATH, { recursive: true });
5879
5883
  writeFileSync3(logPath, lines.join("\n"), "utf-8");
5880
5884
  } catch (err) {
5881
5885
  log(`[agent-log] Failed to write log for ${data.agentId}: ${err}`);
@@ -5884,7 +5888,7 @@ function writeAgentLog(data) {
5884
5888
  }
5885
5889
  function pruneAgentLogs() {
5886
5890
  try {
5887
- mkdirSync3(AGENTS_PATH, { recursive: true });
5891
+ mkdirSync4(AGENTS_PATH, { recursive: true });
5888
5892
  const files = readdirSync5(AGENTS_PATH).filter((f) => f.endsWith(".log")).map((f) => {
5889
5893
  const fullPath = join10(AGENTS_PATH, f);
5890
5894
  const stat2 = statSync3(fullPath);
@@ -7510,7 +7514,7 @@ __export(apply_exports, {
7510
7514
  isTargetAllowed: () => isTargetAllowed,
7511
7515
  rollbackInsight: () => rollbackInsight
7512
7516
  });
7513
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync4, existsSync as existsSync12, mkdirSync as mkdirSync4, readdirSync as readdirSync7, unlinkSync as unlinkSync5 } from "fs";
7517
+ import { readFileSync as readFileSync7, writeFileSync as writeFileSync4, existsSync as existsSync12, mkdirSync as mkdirSync5, readdirSync as readdirSync7, unlinkSync as unlinkSync5 } from "fs";
7514
7518
  import { join as join12, dirname as dirname2 } from "path";
7515
7519
  function isTargetAllowed(relativePath) {
7516
7520
  if (relativePath.includes("..")) return false;
@@ -7625,7 +7629,7 @@ async function applyInsight(insightId) {
7625
7629
  try {
7626
7630
  const parentDir = dirname2(absolutePath);
7627
7631
  if (!existsSync12(parentDir)) {
7628
- mkdirSync4(parentDir, { recursive: true });
7632
+ mkdirSync5(parentDir, { recursive: true });
7629
7633
  }
7630
7634
  if (original) {
7631
7635
  writeFileSync4(backupPath, original, "utf-8");
@@ -7783,7 +7787,7 @@ __export(server_exports, {
7783
7787
  });
7784
7788
  import { createServer } from "http";
7785
7789
  import { randomBytes } from "crypto";
7786
- import { writeFileSync as writeFileSync5, mkdirSync as mkdirSync5, existsSync as existsSync13 } from "fs";
7790
+ import { writeFileSync as writeFileSync5, mkdirSync as mkdirSync6, existsSync as existsSync13 } from "fs";
7787
7791
  function createSubAgentToken(agentId) {
7788
7792
  const token = `sub:${agentId.slice(0, 8)}:${randomBytes(16).toString("hex")}`;
7789
7793
  subAgentTokens.set(token, agentId);
@@ -8619,7 +8623,7 @@ data: ${JSON.stringify(data)}
8619
8623
  });
8620
8624
  server.listen(PORT, "127.0.0.1");
8621
8625
  try {
8622
- mkdirSync5(DATA_PATH, { recursive: true });
8626
+ mkdirSync6(DATA_PATH, { recursive: true });
8623
8627
  const tokenPath = `${DATA_PATH}/api-token`;
8624
8628
  writeFileSync5(tokenPath, DASHBOARD_TOKEN, { mode: 384 });
8625
8629
  } catch (err) {
@@ -10847,7 +10851,7 @@ var init_classify = __esm({
10847
10851
  });
10848
10852
 
10849
10853
  // src/media/image-gen.ts
10850
- import { mkdirSync as mkdirSync6, existsSync as existsSync17 } from "fs";
10854
+ import { mkdirSync as mkdirSync7, existsSync as existsSync17 } from "fs";
10851
10855
  import { writeFile as writeFile2 } from "fs/promises";
10852
10856
  import { join as join17 } from "path";
10853
10857
  async function generateImage(prompt) {
@@ -10897,7 +10901,7 @@ async function generateImage(prompt) {
10897
10901
  throw new Error(textResponse ?? "Gemini did not generate an image. The prompt may have been filtered.");
10898
10902
  }
10899
10903
  if (!existsSync17(IMAGE_OUTPUT_DIR)) {
10900
- mkdirSync6(IMAGE_OUTPUT_DIR, { recursive: true });
10904
+ mkdirSync7(IMAGE_OUTPUT_DIR, { recursive: true });
10901
10905
  }
10902
10906
  const ext = mimeType.includes("jpeg") || mimeType.includes("jpg") ? "jpg" : "png";
10903
10907
  const filename = `img_${Date.now()}.${ext}`;
@@ -17472,7 +17476,7 @@ var init_wrap_backend = __esm({
17472
17476
  });
17473
17477
 
17474
17478
  // src/agents/runners/config-loader.ts
17475
- import { readFileSync as readFileSync10, readdirSync as readdirSync8, existsSync as existsSync19, mkdirSync as mkdirSync7, watchFile, unwatchFile } from "fs";
17479
+ import { readFileSync as readFileSync10, readdirSync as readdirSync8, existsSync as existsSync19, mkdirSync as mkdirSync8, watchFile, unwatchFile } from "fs";
17476
17480
  import { join as join20 } from "path";
17477
17481
  import { execFileSync } from "child_process";
17478
17482
  function resolveExecutable(config2) {
@@ -17623,7 +17627,7 @@ function loadRunnerConfig(filePath) {
17623
17627
  }
17624
17628
  function loadAllRunnerConfigs() {
17625
17629
  if (!existsSync19(RUNNERS_PATH)) {
17626
- mkdirSync7(RUNNERS_PATH, { recursive: true });
17630
+ mkdirSync8(RUNNERS_PATH, { recursive: true });
17627
17631
  return [];
17628
17632
  }
17629
17633
  const files = readdirSync8(RUNNERS_PATH).filter((f) => f.endsWith(".json"));
@@ -18664,7 +18668,7 @@ __export(ai_skill_exports, {
18664
18668
  generateAiSkill: () => generateAiSkill,
18665
18669
  installAiSkill: () => installAiSkill
18666
18670
  });
18667
- import { existsSync as existsSync21, writeFileSync as writeFileSync7, mkdirSync as mkdirSync8 } from "fs";
18671
+ import { existsSync as existsSync21, writeFileSync as writeFileSync7, mkdirSync as mkdirSync9 } from "fs";
18668
18672
  import { join as join22 } from "path";
18669
18673
  import { homedir as homedir7 } from "os";
18670
18674
  function generateAiSkill() {
@@ -19069,7 +19073,7 @@ function installAiSkill() {
19069
19073
  const skillDir = join22(dir, "cc-claw-cli");
19070
19074
  const skillPath = join22(skillDir, "SKILL.md");
19071
19075
  try {
19072
- mkdirSync8(skillDir, { recursive: true });
19076
+ mkdirSync9(skillDir, { recursive: true });
19073
19077
  writeFileSync7(skillPath, skill, "utf-8");
19074
19078
  installed.push(skillPath);
19075
19079
  } catch {
@@ -19100,7 +19104,7 @@ var index_exports = {};
19100
19104
  __export(index_exports, {
19101
19105
  main: () => main
19102
19106
  });
19103
- import { mkdirSync as mkdirSync9, existsSync as existsSync22, renameSync, statSync as statSync5, readFileSync as readFileSync12 } from "fs";
19107
+ import { mkdirSync as mkdirSync10, existsSync as existsSync22, renameSync, statSync as statSync5, readFileSync as readFileSync12 } from "fs";
19104
19108
  import { join as join23 } from "path";
19105
19109
  import dotenv from "dotenv";
19106
19110
  function migrateLayout() {
@@ -19248,10 +19252,10 @@ async function main() {
19248
19252
  bootstrapSkills().catch((err) => error("[cc-claw] Skill bootstrap failed:", err));
19249
19253
  try {
19250
19254
  const { generateAiSkill: generateAiSkill2 } = await Promise.resolve().then(() => (init_ai_skill(), ai_skill_exports));
19251
- const { writeFileSync: writeFileSync12, mkdirSync: mkdirSync15 } = await import("fs");
19255
+ const { writeFileSync: writeFileSync12, mkdirSync: mkdirSync16 } = await import("fs");
19252
19256
  const { join: join28 } = await import("path");
19253
19257
  const skillDir = join28(SKILLS_PATH, "cc-claw-cli");
19254
- mkdirSync15(skillDir, { recursive: true });
19258
+ mkdirSync16(skillDir, { recursive: true });
19255
19259
  writeFileSync12(join28(skillDir, "SKILL.md"), generateAiSkill2(), "utf-8");
19256
19260
  log("[cc-claw] AI skill updated");
19257
19261
  } catch {
@@ -19323,7 +19327,7 @@ var init_index = __esm({
19323
19327
  init_bootstrap2();
19324
19328
  init_health3();
19325
19329
  for (const dir of [CC_CLAW_HOME, DATA_PATH, LOGS_PATH, SKILLS_PATH, RUNNERS_PATH, AGENTS_PATH]) {
19326
- if (!existsSync22(dir)) mkdirSync9(dir, { recursive: true });
19330
+ if (!existsSync22(dir)) mkdirSync10(dir, { recursive: true });
19327
19331
  }
19328
19332
  migrateLayout();
19329
19333
  if (existsSync22(ENV_PATH)) {
@@ -19447,7 +19451,7 @@ __export(service_exports, {
19447
19451
  serviceStatus: () => serviceStatus,
19448
19452
  uninstallService: () => uninstallService
19449
19453
  });
19450
- import { existsSync as existsSync24, mkdirSync as mkdirSync10, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6 } from "fs";
19454
+ import { existsSync as existsSync24, mkdirSync as mkdirSync11, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6 } from "fs";
19451
19455
  import { execFileSync as execFileSync2, execSync as execSync7 } from "child_process";
19452
19456
  import { homedir as homedir8, platform } from "os";
19453
19457
  import { join as join24, dirname as dirname4 } from "path";
@@ -19522,8 +19526,8 @@ function generatePlist() {
19522
19526
  }
19523
19527
  function installMacOS() {
19524
19528
  const agentsDir = dirname4(PLIST_PATH);
19525
- if (!existsSync24(agentsDir)) mkdirSync10(agentsDir, { recursive: true });
19526
- if (!existsSync24(LOGS_PATH)) mkdirSync10(LOGS_PATH, { recursive: true });
19529
+ if (!existsSync24(agentsDir)) mkdirSync11(agentsDir, { recursive: true });
19530
+ if (!existsSync24(LOGS_PATH)) mkdirSync11(LOGS_PATH, { recursive: true });
19527
19531
  if (existsSync24(PLIST_PATH)) {
19528
19532
  try {
19529
19533
  execFileSync2("launchctl", ["unload", PLIST_PATH]);
@@ -19610,8 +19614,8 @@ WantedBy=default.target
19610
19614
  `;
19611
19615
  }
19612
19616
  function installLinux() {
19613
- if (!existsSync24(SYSTEMD_DIR)) mkdirSync10(SYSTEMD_DIR, { recursive: true });
19614
- if (!existsSync24(LOGS_PATH)) mkdirSync10(LOGS_PATH, { recursive: true });
19617
+ if (!existsSync24(SYSTEMD_DIR)) mkdirSync11(SYSTEMD_DIR, { recursive: true });
19618
+ if (!existsSync24(LOGS_PATH)) mkdirSync11(LOGS_PATH, { recursive: true });
19615
19619
  writeFileSync8(UNIT_PATH, generateUnit());
19616
19620
  console.log(` Installed: ${UNIT_PATH}`);
19617
19621
  execFileSync2("systemctl", ["--user", "daemon-reload"]);
@@ -20299,7 +20303,7 @@ __export(gemini_exports, {
20299
20303
  geminiReorder: () => geminiReorder,
20300
20304
  geminiRotation: () => geminiRotation
20301
20305
  });
20302
- import { existsSync as existsSync28, mkdirSync as mkdirSync11, writeFileSync as writeFileSync9, readFileSync as readFileSync17, chmodSync } from "fs";
20306
+ import { existsSync as existsSync28, mkdirSync as mkdirSync12, writeFileSync as writeFileSync9, readFileSync as readFileSync17, chmodSync } from "fs";
20303
20307
  import { join as join25 } from "path";
20304
20308
  import { createInterface as createInterface5 } from "readline";
20305
20309
  function requireDb() {
@@ -20413,12 +20417,12 @@ async function geminiAddKey(globalOpts, opts) {
20413
20417
  async function geminiAddAccount(globalOpts, opts) {
20414
20418
  await requireWriteDb();
20415
20419
  const slotsDir = join25(CC_CLAW_HOME, "gemini-slots");
20416
- if (!existsSync28(slotsDir)) mkdirSync11(slotsDir, { recursive: true });
20420
+ if (!existsSync28(slotsDir)) mkdirSync12(slotsDir, { recursive: true });
20417
20421
  const { addGeminiSlot: addGeminiSlot2 } = await Promise.resolve().then(() => (init_store5(), store_exports5));
20418
20422
  const tempId = Date.now();
20419
20423
  const slotDir = join25(slotsDir, `slot-${tempId}`);
20420
- mkdirSync11(slotDir, { recursive: true, mode: 448 });
20421
- mkdirSync11(join25(slotDir, ".gemini"), { recursive: true });
20424
+ mkdirSync12(slotDir, { recursive: true, mode: 448 });
20425
+ mkdirSync12(join25(slotDir, ".gemini"), { recursive: true });
20422
20426
  writeFileSync9(join25(slotDir, ".gemini", "settings.json"), JSON.stringify({
20423
20427
  security: { auth: { selectedType: "oauth-personal" } }
20424
20428
  }, null, 2));
@@ -21262,7 +21266,7 @@ __export(db_exports, {
21262
21266
  dbPath: () => dbPath,
21263
21267
  dbStats: () => dbStats
21264
21268
  });
21265
- import { existsSync as existsSync34, statSync as statSync8, copyFileSync as copyFileSync2, mkdirSync as mkdirSync12 } from "fs";
21269
+ import { existsSync as existsSync34, statSync as statSync8, copyFileSync as copyFileSync2, mkdirSync as mkdirSync13 } from "fs";
21266
21270
  import { dirname as dirname5 } from "path";
21267
21271
  async function dbStats(globalOpts) {
21268
21272
  if (!existsSync34(DB_PATH)) {
@@ -21313,7 +21317,7 @@ async function dbBackup(globalOpts, destPath) {
21313
21317
  }
21314
21318
  const dest = destPath ?? `${DB_PATH}.backup-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`;
21315
21319
  try {
21316
- mkdirSync12(dirname5(dest), { recursive: true });
21320
+ mkdirSync13(dirname5(dest), { recursive: true });
21317
21321
  copyFileSync2(DB_PATH, dest);
21318
21322
  const walPath = DB_PATH + "-wal";
21319
21323
  if (existsSync34(walPath)) copyFileSync2(walPath, dest + "-wal");
@@ -22564,7 +22568,7 @@ var completion_exports = {};
22564
22568
  __export(completion_exports, {
22565
22569
  completionCommand: () => completionCommand
22566
22570
  });
22567
- import { writeFileSync as writeFileSync10, mkdirSync as mkdirSync13 } from "fs";
22571
+ import { writeFileSync as writeFileSync10, mkdirSync as mkdirSync14 } from "fs";
22568
22572
  import { join as join26 } from "path";
22569
22573
  import { homedir as homedir9 } from "os";
22570
22574
  async function completionCommand(opts) {
@@ -22582,7 +22586,7 @@ async function completionCommand(opts) {
22582
22586
  }
22583
22587
  if (opts.install) {
22584
22588
  const dir = join26(homedir9(), ".config", "cc-claw", "completions");
22585
- mkdirSync13(dir, { recursive: true });
22589
+ mkdirSync14(dir, { recursive: true });
22586
22590
  const filename = shell === "zsh" ? "_cc-claw" : shell === "fish" ? "cc-claw.fish" : "cc-claw.bash";
22587
22591
  const filepath = join26(dir, filename);
22588
22592
  writeFileSync10(filepath, script, "utf-8");
@@ -23173,7 +23177,7 @@ var init_evolve = __esm({
23173
23177
 
23174
23178
  // src/setup.ts
23175
23179
  var setup_exports = {};
23176
- import { existsSync as existsSync46, writeFileSync as writeFileSync11, readFileSync as readFileSync20, copyFileSync as copyFileSync3, mkdirSync as mkdirSync14, statSync as statSync9 } from "fs";
23180
+ import { existsSync as existsSync46, writeFileSync as writeFileSync11, readFileSync as readFileSync20, copyFileSync as copyFileSync3, mkdirSync as mkdirSync15, statSync as statSync9 } from "fs";
23177
23181
  import { execFileSync as execFileSync4 } from "child_process";
23178
23182
  import { createInterface as createInterface7 } from "readline";
23179
23183
  import { join as join27 } from "path";
@@ -23251,7 +23255,7 @@ async function setup() {
23251
23255
  }
23252
23256
  console.log("");
23253
23257
  for (const dir of [CC_CLAW_HOME, DATA_PATH, LOGS_PATH, SKILLS_PATH, RUNNERS_PATH, AGENTS_PATH]) {
23254
- if (!existsSync46(dir)) mkdirSync14(dir, { recursive: true });
23258
+ if (!existsSync46(dir)) mkdirSync15(dir, { recursive: true });
23255
23259
  }
23256
23260
  const env = {};
23257
23261
  const envSource = existsSync46(ENV_PATH) ? ENV_PATH : existsSync46(".env") ? ".env" : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-claw",
3
- "version": "0.12.6",
3
+ "version": "0.12.7",
4
4
  "description": "CC-Claw: Personal AI assistant on Telegram — multi-backend (Claude, Gemini, Codex, Cursor), sub-agent orchestration, MCP management",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",