cc-claw 0.22.6 → 0.22.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 +165 -95
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -33,7 +33,7 @@ var VERSION;
33
33
  var init_version = __esm({
34
34
  "src/version.ts"() {
35
35
  "use strict";
36
- VERSION = true ? "0.22.6" : (() => {
36
+ VERSION = true ? "0.22.7" : (() => {
37
37
  try {
38
38
  return JSON.parse(readFileSync(join(process.cwd(), "package.json"), "utf-8")).version ?? "unknown";
39
39
  } catch {
@@ -4317,10 +4317,80 @@ var init_resolve_executable = __esm({
4317
4317
  });
4318
4318
 
4319
4319
  // src/backends/claude.ts
4320
- import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
4321
- import { spawnSync as spawnSync2 } from "child_process";
4320
+ import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync } from "fs";
4321
+ import { execFileSync, spawnSync as spawnSync2 } from "child_process";
4322
4322
  import { join as join4 } from "path";
4323
- var ADAPTIVE_MODELS, ClaudeAdapter;
4323
+ function readOAuthCredentials(credsPath) {
4324
+ try {
4325
+ if (!existsSync3(credsPath)) return null;
4326
+ const creds = JSON.parse(readFileSync2(credsPath, "utf-8"));
4327
+ return creds?.claudeAiOauth ?? null;
4328
+ } catch {
4329
+ return null;
4330
+ }
4331
+ }
4332
+ function refreshOAuthToken(credsPath, refreshToken) {
4333
+ const lastAttempt = lastRefreshAttempt.get(credsPath) ?? 0;
4334
+ if (Date.now() - lastAttempt < REFRESH_COOLDOWN_MS) {
4335
+ return null;
4336
+ }
4337
+ lastRefreshAttempt.set(credsPath, Date.now());
4338
+ try {
4339
+ const payload = JSON.stringify({
4340
+ grant_type: "refresh_token",
4341
+ refresh_token: refreshToken,
4342
+ client_id: OAUTH_CLIENT_ID
4343
+ });
4344
+ const result = execFileSync("curl", [
4345
+ "-s",
4346
+ "-X",
4347
+ "POST",
4348
+ OAUTH_TOKEN_ENDPOINT,
4349
+ "-H",
4350
+ "Content-Type: application/json",
4351
+ "-d",
4352
+ payload,
4353
+ "--max-time",
4354
+ "10"
4355
+ ], { encoding: "utf-8", timeout: 15e3 });
4356
+ const response = JSON.parse(result);
4357
+ if (!response.access_token) {
4358
+ warn(`[claude-oauth] Refresh failed: ${JSON.stringify(response.error ?? response)}`);
4359
+ return null;
4360
+ }
4361
+ const creds = JSON.parse(readFileSync2(credsPath, "utf-8"));
4362
+ creds.claudeAiOauth.accessToken = response.access_token;
4363
+ if (response.refresh_token) {
4364
+ creds.claudeAiOauth.refreshToken = response.refresh_token;
4365
+ }
4366
+ if (response.expires_in) {
4367
+ creds.claudeAiOauth.expiresAt = Date.now() + response.expires_in * 1e3;
4368
+ }
4369
+ writeFileSync(credsPath, JSON.stringify(creds, null, 2), "utf-8");
4370
+ log(`[claude-oauth] Token refreshed for ${credsPath} (expires in ${Math.round((response.expires_in ?? 0) / 3600)}h)`);
4371
+ return response.access_token;
4372
+ } catch (err) {
4373
+ warn(`[claude-oauth] Refresh failed: ${err instanceof Error ? err.message : err}`);
4374
+ return null;
4375
+ }
4376
+ }
4377
+ function getValidOAuthToken(configHome) {
4378
+ const credsPath = join4(configHome, ".claude", ".credentials.json");
4379
+ const oauth = readOAuthCredentials(credsPath);
4380
+ if (!oauth) return null;
4381
+ const { accessToken, refreshToken, expiresAt } = oauth;
4382
+ if (!accessToken) return null;
4383
+ if (refreshToken && expiresAt) {
4384
+ const remaining = expiresAt - Date.now();
4385
+ if (remaining < REFRESH_THRESHOLD_MS) {
4386
+ log(`[claude-oauth] Token ${remaining > 0 ? `expires in ${Math.round(remaining / 6e4)}m` : "expired"} \u2014 refreshing`);
4387
+ const fresh = refreshOAuthToken(credsPath, refreshToken);
4388
+ if (fresh) return fresh;
4389
+ }
4390
+ }
4391
+ return accessToken;
4392
+ }
4393
+ var OAUTH_TOKEN_ENDPOINT, OAUTH_CLIENT_ID, REFRESH_THRESHOLD_MS, REFRESH_COOLDOWN_MS, lastRefreshAttempt, ADAPTIVE_MODELS, ClaudeAdapter;
4324
4394
  var init_claude = __esm({
4325
4395
  "src/backends/claude.ts"() {
4326
4396
  "use strict";
@@ -4329,6 +4399,11 @@ var init_claude = __esm({
4329
4399
  init_resolve_executable();
4330
4400
  init_paths();
4331
4401
  init_log();
4402
+ OAUTH_TOKEN_ENDPOINT = "https://console.anthropic.com/v1/oauth/token";
4403
+ OAUTH_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
4404
+ REFRESH_THRESHOLD_MS = 60 * 60 * 1e3;
4405
+ REFRESH_COOLDOWN_MS = 5 * 60 * 1e3;
4406
+ lastRefreshAttempt = /* @__PURE__ */ new Map();
4332
4407
  ADAPTIVE_MODELS = /* @__PURE__ */ new Set(["claude-opus-4-6", "claude-sonnet-4-6", "claude-opus-4-6[1m]", "claude-sonnet-4-6[1m]"]);
4333
4408
  ClaudeAdapter = class {
4334
4409
  id = "claude";
@@ -4443,13 +4518,8 @@ var init_claude = __esm({
4443
4518
  } else if (slot.slotType === "oauth" && slot.configHome) {
4444
4519
  env.HOME = slot.configHome;
4445
4520
  delete env.ANTHROPIC_API_KEY;
4446
- try {
4447
- const credsPath = join4(slot.configHome, ".claude", ".credentials.json");
4448
- const creds = JSON.parse(readFileSync2(credsPath, "utf-8"));
4449
- const token = creds?.claudeAiOauth?.accessToken;
4450
- if (token) env.CLAUDE_CODE_OAUTH_TOKEN = token;
4451
- } catch {
4452
- }
4521
+ const token = getValidOAuthToken(slot.configHome);
4522
+ if (token) env.CLAUDE_CODE_OAUTH_TOKEN = token;
4453
4523
  }
4454
4524
  return env;
4455
4525
  }
@@ -7624,7 +7694,7 @@ __export(init_exports, {
7624
7694
  });
7625
7695
  import {
7626
7696
  existsSync as existsSync8,
7627
- writeFileSync,
7697
+ writeFileSync as writeFileSync2,
7628
7698
  mkdirSync as mkdirSync3,
7629
7699
  readFileSync as readFileSync4,
7630
7700
  copyFileSync as copyFileSync2,
@@ -7665,7 +7735,7 @@ function bootstrapWorkspaceFiles() {
7665
7735
  log("[bootstrap] Removed legacy workspace/GEMINI.md (replaced by identity/CC-CLAW.md)");
7666
7736
  }
7667
7737
  if (!existsSync8(SOUL_PATH)) {
7668
- writeFileSync(SOUL_PATH, DEFAULT_SOUL, "utf-8");
7738
+ writeFileSync2(SOUL_PATH, DEFAULT_SOUL, "utf-8");
7669
7739
  log("[bootstrap] Created default SOUL.md");
7670
7740
  }
7671
7741
  if (!existsSync8(USER_PATH)) {
@@ -7675,7 +7745,7 @@ function bootstrapWorkspaceFiles() {
7675
7745
  } catch {
7676
7746
  }
7677
7747
  const userContent = DEFAULT_USER.replace("- **Timezone**: UTC", `- **Timezone**: ${tz}`);
7678
- writeFileSync(USER_PATH, userContent, "utf-8");
7748
+ writeFileSync2(USER_PATH, userContent, "utf-8");
7679
7749
  log(`[bootstrap] Created default USER.md (timezone: ${tz})`);
7680
7750
  }
7681
7751
  if (!existsSync8(CONTEXT_DIR)) {
@@ -7688,7 +7758,7 @@ function bootstrapWorkspaceFiles() {
7688
7758
  }
7689
7759
  const expertisePath = join8(CONTEXT_DIR, "cc-claw-expertise.md");
7690
7760
  if (!existsSync8(expertisePath)) {
7691
- writeFileSync(expertisePath, DEFAULT_EXPERTISE, "utf-8");
7761
+ writeFileSync2(expertisePath, DEFAULT_EXPERTISE, "utf-8");
7692
7762
  log("[bootstrap] Created default context/cc-claw-expertise.md");
7693
7763
  }
7694
7764
  const IGNORE_CONTENT = [
@@ -7704,12 +7774,12 @@ function bootstrapWorkspaceFiles() {
7704
7774
  ].join("\n");
7705
7775
  const gitignorePath = join8(WORKSPACE_PATH, ".gitignore");
7706
7776
  if (!existsSync8(gitignorePath)) {
7707
- writeFileSync(gitignorePath, IGNORE_CONTENT, "utf-8");
7777
+ writeFileSync2(gitignorePath, IGNORE_CONTENT, "utf-8");
7708
7778
  log("[bootstrap] Created .gitignore (workspace allowlist)");
7709
7779
  }
7710
7780
  const geminiignorePath = join8(WORKSPACE_PATH, ".geminiignore");
7711
7781
  if (!existsSync8(geminiignorePath)) {
7712
- writeFileSync(geminiignorePath, IGNORE_CONTENT, "utf-8");
7782
+ writeFileSync2(geminiignorePath, IGNORE_CONTENT, "utf-8");
7713
7783
  log("[bootstrap] Created .geminiignore (workspace allowlist)");
7714
7784
  }
7715
7785
  syncNativeCliFiles();
@@ -7737,11 +7807,11 @@ function syncNativeCliFiles() {
7737
7807
  const geminiContent = buildGeminiTemplate(soul, user);
7738
7808
  const codexContent = buildCodexTemplate(soul, user);
7739
7809
  const cursorContent = buildCursorTemplate(soul, user);
7740
- writeFileSync(join8(IDENTITY_PATH, "CC-CLAW-claude.md"), claudeContent, "utf-8");
7741
- writeFileSync(join8(WORKSPACE_PATH, "GEMINI.md"), geminiContent, "utf-8");
7742
- writeFileSync(join8(IDENTITY_PATH, "CC-CLAW-codex.md"), codexContent, "utf-8");
7743
- writeFileSync(join8(WORKSPACE_PATH, "AGENTS.md"), codexContent, "utf-8");
7744
- writeFileSync(join8(IDENTITY_PATH, "CC-CLAW-cursor.md"), cursorContent, "utf-8");
7810
+ writeFileSync2(join8(IDENTITY_PATH, "CC-CLAW-claude.md"), claudeContent, "utf-8");
7811
+ writeFileSync2(join8(WORKSPACE_PATH, "GEMINI.md"), geminiContent, "utf-8");
7812
+ writeFileSync2(join8(IDENTITY_PATH, "CC-CLAW-codex.md"), codexContent, "utf-8");
7813
+ writeFileSync2(join8(WORKSPACE_PATH, "AGENTS.md"), codexContent, "utf-8");
7814
+ writeFileSync2(join8(IDENTITY_PATH, "CC-CLAW-cursor.md"), cursorContent, "utf-8");
7745
7815
  const fallbackContent = [
7746
7816
  "# CC-Claw System Instructions",
7747
7817
  "",
@@ -7759,11 +7829,11 @@ function syncNativeCliFiles() {
7759
7829
  user,
7760
7830
  ""
7761
7831
  ].join("\n");
7762
- writeFileSync(join8(IDENTITY_PATH, "CC-CLAW.md"), fallbackContent, "utf-8");
7832
+ writeFileSync2(join8(IDENTITY_PATH, "CC-CLAW.md"), fallbackContent, "utf-8");
7763
7833
  const claudeTaskContent = buildClaudeTaskTemplate();
7764
7834
  const codexTaskContent = buildCodexTaskTemplate();
7765
- writeFileSync(join8(IDENTITY_PATH, "CC-CLAW-claude-task.md"), claudeTaskContent, "utf-8");
7766
- writeFileSync(join8(IDENTITY_PATH, "CC-CLAW-codex-task.md"), codexTaskContent, "utf-8");
7835
+ writeFileSync2(join8(IDENTITY_PATH, "CC-CLAW-claude-task.md"), claudeTaskContent, "utf-8");
7836
+ writeFileSync2(join8(IDENTITY_PATH, "CC-CLAW-codex-task.md"), codexTaskContent, "utf-8");
7767
7837
  log("[bootstrap] Synced identity files: CC-CLAW-claude.md, GEMINI.md, CC-CLAW-codex.md, CC-CLAW-cursor.md, CC-CLAW.md (fallback), CC-CLAW-claude-task.md, CC-CLAW-codex-task.md");
7768
7838
  }
7769
7839
  var SOUL_PATH, USER_PATH, CONTEXT_DIR, LEGACY_SOUL_PATH, LEGACY_USER_PATH, LEGACY_CLAUDE_MD, LEGACY_GEMINI_MD;
@@ -8643,7 +8713,7 @@ var init_quota = __esm({
8643
8713
 
8644
8714
  // src/dashboard/middleware.ts
8645
8715
  import { randomBytes } from "crypto";
8646
- import { writeFileSync as writeFileSync2, mkdirSync as mkdirSync4 } from "fs";
8716
+ import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync4 } from "fs";
8647
8717
  function getDashboardToken() {
8648
8718
  return DASHBOARD_TOKEN;
8649
8719
  }
@@ -8651,7 +8721,7 @@ function persistToken() {
8651
8721
  try {
8652
8722
  mkdirSync4(DATA_PATH, { recursive: true });
8653
8723
  const tokenPath = `${DATA_PATH}/api-token`;
8654
- writeFileSync2(tokenPath, DASHBOARD_TOKEN, { mode: 384 });
8724
+ writeFileSync3(tokenPath, DASHBOARD_TOKEN, { mode: 384 });
8655
8725
  } catch (err) {
8656
8726
  log(`[api] Warning: could not write api-token file: ${errorMessage(err)}`);
8657
8727
  }
@@ -9948,7 +10018,7 @@ var init_cost = __esm({
9948
10018
 
9949
10019
  // src/mcps/propagate.ts
9950
10020
  import { execFile } from "child_process";
9951
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync3, existsSync as existsSync11 } from "fs";
10021
+ import { readFileSync as readFileSync7, writeFileSync as writeFileSync4, existsSync as existsSync11 } from "fs";
9952
10022
  import { promisify } from "util";
9953
10023
  import { homedir as homedir4 } from "os";
9954
10024
  import { join as join12 } from "path";
@@ -10041,7 +10111,7 @@ function injectMcpToCursorConfig(config2) {
10041
10111
  if (config2.env) entry.env = config2.env;
10042
10112
  servers[config2.name] = entry;
10043
10113
  existing.mcpServers = servers;
10044
- writeFileSync3(configPath, JSON.stringify(existing, null, 2) + "\n", "utf-8");
10114
+ writeFileSync4(configPath, JSON.stringify(existing, null, 2) + "\n", "utf-8");
10045
10115
  log(`[mcp] Wrote ${config2.name} to ${configPath}`);
10046
10116
  return true;
10047
10117
  }
@@ -10107,7 +10177,7 @@ var init_propagate = __esm({
10107
10177
  });
10108
10178
 
10109
10179
  // src/agents/mcp-config.ts
10110
- import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync4, existsSync as existsSync12, readdirSync as readdirSync4, unlinkSync as unlinkSync3 } from "fs";
10180
+ import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync5, existsSync as existsSync12, readdirSync as readdirSync4, unlinkSync as unlinkSync3 } from "fs";
10111
10181
  import { join as join13, dirname as dirname2 } from "path";
10112
10182
  import { fileURLToPath } from "url";
10113
10183
  function generateOrchestratorMcpConfig(opts) {
@@ -10145,7 +10215,7 @@ function writeMcpConfigFile(config2) {
10145
10215
  if (!existsSync12(MCP_CONFIG_DIR)) {
10146
10216
  mkdirSync5(MCP_CONFIG_DIR, { recursive: true, mode: 448 });
10147
10217
  }
10148
- writeFileSync4(configPath, configJson, { mode: 384 });
10218
+ writeFileSync5(configPath, configJson, { mode: 384 });
10149
10219
  lastWrittenConfig.set(configPath, configJson);
10150
10220
  }
10151
10221
  return configPath;
@@ -10280,7 +10350,7 @@ var init_loader2 = __esm({
10280
10350
  });
10281
10351
 
10282
10352
  // src/agents/agent-log.ts
10283
- import { writeFileSync as writeFileSync5, readdirSync as readdirSync6, statSync as statSync3, unlinkSync as unlinkSync4, mkdirSync as mkdirSync6 } from "fs";
10353
+ import { writeFileSync as writeFileSync6, readdirSync as readdirSync6, statSync as statSync3, unlinkSync as unlinkSync4, mkdirSync as mkdirSync6 } from "fs";
10284
10354
  import { join as join15 } from "path";
10285
10355
  function truncate(text, maxBytes) {
10286
10356
  if (Buffer.byteLength(text, "utf-8") <= maxBytes) return text;
@@ -10321,7 +10391,7 @@ function writeAgentLog(data) {
10321
10391
  ];
10322
10392
  try {
10323
10393
  mkdirSync6(AGENTS_PATH, { recursive: true });
10324
- writeFileSync5(logPath, lines.join("\n"), "utf-8");
10394
+ writeFileSync6(logPath, lines.join("\n"), "utf-8");
10325
10395
  } catch (err) {
10326
10396
  log(`[agent-log] Failed to write log for ${data.agentId}: ${err}`);
10327
10397
  }
@@ -13244,7 +13314,7 @@ __export(apply_exports, {
13244
13314
  isTargetAllowed: () => isTargetAllowed,
13245
13315
  rollbackInsight: () => rollbackInsight
13246
13316
  });
13247
- import { readFileSync as readFileSync10, writeFileSync as writeFileSync6, existsSync as existsSync16, mkdirSync as mkdirSync7, readdirSync as readdirSync8, unlinkSync as unlinkSync5 } from "fs";
13317
+ import { readFileSync as readFileSync10, writeFileSync as writeFileSync7, existsSync as existsSync16, mkdirSync as mkdirSync7, readdirSync as readdirSync8, unlinkSync as unlinkSync5 } from "fs";
13248
13318
  import { join as join17, dirname as dirname3 } from "path";
13249
13319
  function isTargetAllowed(relativePath) {
13250
13320
  if (relativePath.includes("..")) return false;
@@ -13362,7 +13432,7 @@ async function applyInsight(insightId) {
13362
13432
  mkdirSync7(parentDir, { recursive: true });
13363
13433
  }
13364
13434
  if (original) {
13365
- writeFileSync6(backupPath, original, "utf-8");
13435
+ writeFileSync7(backupPath, original, "utf-8");
13366
13436
  pruneBackups(absolutePath);
13367
13437
  }
13368
13438
  let newContent;
@@ -13390,7 +13460,7 @@ async function applyInsight(insightId) {
13390
13460
  } else {
13391
13461
  newContent = applyDiff(original, insight.proposedDiff, insight.proposedAction);
13392
13462
  }
13393
- writeFileSync6(absolutePath, newContent, "utf-8");
13463
+ writeFileSync7(absolutePath, newContent, "utf-8");
13394
13464
  const rollbackData = JSON.stringify({ original, backupPath, appliedAt: (/* @__PURE__ */ new Date()).toISOString() });
13395
13465
  updateInsightRollback(db3, insightId, rollbackData);
13396
13466
  updateInsightStatus(db3, insightId, "applied");
@@ -13418,7 +13488,7 @@ async function applyInsight(insightId) {
13418
13488
  warn(`[reflection/apply] Failed to apply insight #${insightId}: ${msg}`);
13419
13489
  try {
13420
13490
  if (original) {
13421
- writeFileSync6(absolutePath, original, "utf-8");
13491
+ writeFileSync7(absolutePath, original, "utf-8");
13422
13492
  }
13423
13493
  } catch {
13424
13494
  }
@@ -13448,7 +13518,7 @@ async function rollbackInsight(insightId) {
13448
13518
  }
13449
13519
  const absolutePath = join17(CC_CLAW_HOME, insight.targetFile);
13450
13520
  try {
13451
- writeFileSync6(absolutePath, rollback.original, "utf-8");
13521
+ writeFileSync7(absolutePath, rollback.original, "utf-8");
13452
13522
  updateInsightStatus(db3, insightId, "rolled_back");
13453
13523
  syncNativeCliFiles();
13454
13524
  const chatId = insight.chatId ?? "global";
@@ -16048,7 +16118,7 @@ var init_telegram_throttle = __esm({
16048
16118
 
16049
16119
  // src/health/checks.ts
16050
16120
  import { existsSync as existsSync18, statSync as statSync5, readFileSync as readFileSync11 } from "fs";
16051
- import { execFileSync, execSync as execSync3 } from "child_process";
16121
+ import { execFileSync as execFileSync2, execSync as execSync3 } from "child_process";
16052
16122
  function getRecentErrors() {
16053
16123
  if (!existsSync18(ERROR_LOG_PATH)) return null;
16054
16124
  const logContent = readFileSync11(ERROR_LOG_PATH, "utf-8");
@@ -16128,7 +16198,7 @@ function checkBackendCLIs() {
16128
16198
  let installed = 0;
16129
16199
  for (const [label2, binary] of Object.entries(CLI_BINARIES)) {
16130
16200
  try {
16131
- const path = execFileSync("which", [binary], { encoding: "utf-8", timeout: 5e3 }).trim();
16201
+ const path = execFileSync2("which", [binary], { encoding: "utf-8", timeout: 5e3 }).trim();
16132
16202
  if (path) {
16133
16203
  checks.push({ name: `${label2} CLI`, status: "ok", message: path });
16134
16204
  installed++;
@@ -16483,7 +16553,7 @@ var init_heartbeat2 = __esm({
16483
16553
  });
16484
16554
 
16485
16555
  // src/bootstrap/profile.ts
16486
- import { readFileSync as readFileSync13, writeFileSync as writeFileSync7, existsSync as existsSync20 } from "fs";
16556
+ import { readFileSync as readFileSync13, writeFileSync as writeFileSync8, existsSync as existsSync20 } from "fs";
16487
16557
  import { join as join20 } from "path";
16488
16558
  function hasActiveProfile(chatId) {
16489
16559
  return activeProfiles.has(chatId);
@@ -16587,7 +16657,7 @@ async function finalizeProfile(chatId, state, channel) {
16587
16657
  "<!-- Add any additional preferences below this line -->",
16588
16658
  ""
16589
16659
  ].join("\n");
16590
- writeFileSync7(USER_PATH2, content, "utf-8");
16660
+ writeFileSync8(USER_PATH2, content, "utf-8");
16591
16661
  activeProfiles.delete(chatId);
16592
16662
  log(`[profile] User profile saved for chat ${chatId}`);
16593
16663
  await channel.sendText(
@@ -16620,7 +16690,7 @@ function appendToUserProfile(key, value) {
16620
16690
  const updated = content.trimEnd() + `
16621
16691
  ${line}
16622
16692
  `;
16623
- writeFileSync7(USER_PATH2, updated, "utf-8");
16693
+ writeFileSync8(USER_PATH2, updated, "utf-8");
16624
16694
  log(`[profile] Appended preference: ${key}=${value}`);
16625
16695
  }
16626
16696
  var USER_PATH2, activeProfiles;
@@ -18626,7 +18696,7 @@ var init_gate = __esm({
18626
18696
 
18627
18697
  // src/voice/stt.ts
18628
18698
  import crypto from "crypto";
18629
- import { execFile as execFile2, execFileSync as execFileSync2 } from "child_process";
18699
+ import { execFile as execFile2, execFileSync as execFileSync3 } from "child_process";
18630
18700
  import { readFile as readFile3, unlink as unlink2, mkdir as mkdir2, writeFile } from "fs/promises";
18631
18701
  import { existsSync as existsSync22 } from "fs";
18632
18702
  import { join as join22 } from "path";
@@ -18635,7 +18705,7 @@ function ensureFfmpeg() {
18635
18705
  if (ffmpegAvailable === true) return;
18636
18706
  if (ffmpegAvailable === false) throw new Error("ffmpeg is required for voice replies. Install it: brew install ffmpeg (macOS) or apt install ffmpeg (Linux)");
18637
18707
  try {
18638
- execFileSync2("ffmpeg", ["-version"], { stdio: "ignore" });
18708
+ execFileSync3("ffmpeg", ["-version"], { stdio: "ignore" });
18639
18709
  ffmpegAvailable = true;
18640
18710
  } catch {
18641
18711
  ffmpegAvailable = false;
@@ -18702,11 +18772,11 @@ function setSttModel(chatId, model2) {
18702
18772
  function isWhisperCliAvailable() {
18703
18773
  if (whisperCliAvailableCache !== null) return whisperCliAvailableCache;
18704
18774
  try {
18705
- execFileSync2("whisper-cli", ["--help"], { stdio: "ignore" });
18775
+ execFileSync3("whisper-cli", ["--help"], { stdio: "ignore" });
18706
18776
  whisperCliAvailableCache = true;
18707
18777
  } catch {
18708
18778
  try {
18709
- execFileSync2("whisper", ["--help"], { stdio: "ignore" });
18779
+ execFileSync3("whisper", ["--help"], { stdio: "ignore" });
18710
18780
  whisperCliAvailableCache = true;
18711
18781
  } catch {
18712
18782
  whisperCliAvailableCache = false;
@@ -18716,12 +18786,12 @@ function isWhisperCliAvailable() {
18716
18786
  }
18717
18787
  function getWhisperBin() {
18718
18788
  try {
18719
- execFileSync2("whisper-cli", ["--help"], { stdio: "ignore" });
18789
+ execFileSync3("whisper-cli", ["--help"], { stdio: "ignore" });
18720
18790
  return "whisper-cli";
18721
18791
  } catch {
18722
18792
  }
18723
18793
  try {
18724
- execFileSync2("whisper", ["--help"], { stdio: "ignore" });
18794
+ execFileSync3("whisper", ["--help"], { stdio: "ignore" });
18725
18795
  return "whisper";
18726
18796
  } catch {
18727
18797
  }
@@ -22515,7 +22585,7 @@ __export(optimize_exports, {
22515
22585
  handleOptimizeCallback: () => handleOptimizeCallback,
22516
22586
  handleOptimizeCommand: () => handleOptimizeCommand
22517
22587
  });
22518
- import { readFileSync as readFileSync17, writeFileSync as writeFileSync8, existsSync as existsSync28, readdirSync as readdirSync13, unlinkSync as unlinkSync7 } from "fs";
22588
+ import { readFileSync as readFileSync17, writeFileSync as writeFileSync9, existsSync as existsSync28, readdirSync as readdirSync13, unlinkSync as unlinkSync7 } from "fs";
22519
22589
  import { join as join29, dirname as dirname4 } from "path";
22520
22590
  import { homedir as homedir8 } from "os";
22521
22591
  async function handleOptimizeCommand(chatId, channel, _args) {
@@ -22794,7 +22864,7 @@ async function applyFinding(chatId, channel, index) {
22794
22864
  }
22795
22865
  const original = readFileSync17(targetPath, "utf-8");
22796
22866
  const backupPath = targetPath + `.bak.${Date.now()}`;
22797
- writeFileSync8(backupPath, original, "utf-8");
22867
+ writeFileSync9(backupPath, original, "utf-8");
22798
22868
  pruneBackups2(targetPath);
22799
22869
  let newContent;
22800
22870
  try {
@@ -22824,7 +22894,7 @@ async function applyFinding(chatId, channel, index) {
22824
22894
  await showFinding(chatId, channel, index + 1);
22825
22895
  return;
22826
22896
  }
22827
- writeFileSync8(targetPath, newContent, "utf-8");
22897
+ writeFileSync9(targetPath, newContent, "utf-8");
22828
22898
  session2.applied.push(index);
22829
22899
  if (targetPath.includes("identity/")) {
22830
22900
  try {
@@ -27265,13 +27335,13 @@ ${formatValidationReport2(validation)}` : "\n\n\u2705 Quality checks passed.";
27265
27335
  return;
27266
27336
  }
27267
27337
  try {
27268
- const { readFileSync: readFileSync33, writeFileSync: writeFileSync15 } = await import("fs");
27338
+ const { readFileSync: readFileSync33, writeFileSync: writeFileSync16 } = await import("fs");
27269
27339
  const { updateFrontmatter: updateFrontmatter2, ensureThreeTierFrontmatter: ensureThreeTierFrontmatter2 } = await Promise.resolve().then(() => (init_frontmatter(), frontmatter_exports));
27270
27340
  const { invalidateSkillCache: invalidateSkillCache2 } = await Promise.resolve().then(() => (init_discover(), discover_exports));
27271
27341
  const raw = readFileSync33(skill.filePath, "utf-8");
27272
27342
  let updated = ensureThreeTierFrontmatter2(raw, { name: skillName, source: "cc-claw" });
27273
27343
  updated = updateFrontmatter2(updated, { status: "approved" });
27274
- writeFileSync15(skill.filePath, updated, "utf-8");
27344
+ writeFileSync16(skill.filePath, updated, "utf-8");
27275
27345
  invalidateSkillCache2();
27276
27346
  await channel.sendText(chatId, `\u2705 "${skillName}" approved.`, { parseMode: "plain" });
27277
27347
  const refreshedSkills = await discoverAllSkills();
@@ -27318,7 +27388,7 @@ ${formatValidationReport2(validation)}` : "\n\n\u2705 Quality checks passed.";
27318
27388
  return;
27319
27389
  }
27320
27390
  try {
27321
- const { readFileSync: readFileSync33, writeFileSync: writeFileSync15 } = await import("fs");
27391
+ const { readFileSync: readFileSync33, writeFileSync: writeFileSync16 } = await import("fs");
27322
27392
  const { updateFrontmatter: updateFrontmatter2, ensureThreeTierFrontmatter: ensureThreeTierFrontmatter2 } = await Promise.resolve().then(() => (init_frontmatter(), frontmatter_exports));
27323
27393
  const { invalidateSkillCache: invalidateSkillCache2 } = await Promise.resolve().then(() => (init_discover(), discover_exports));
27324
27394
  let approvedCount = 0;
@@ -27328,7 +27398,7 @@ ${formatValidationReport2(validation)}` : "\n\n\u2705 Quality checks passed.";
27328
27398
  const raw = readFileSync33(skill.filePath, "utf-8");
27329
27399
  let updated = ensureThreeTierFrontmatter2(raw, { name: skill.name, source: "cc-claw" });
27330
27400
  updated = updateFrontmatter2(updated, { status: "approved" });
27331
- writeFileSync15(skill.filePath, updated, "utf-8");
27401
+ writeFileSync16(skill.filePath, updated, "utf-8");
27332
27402
  approvedCount++;
27333
27403
  } catch (e) {
27334
27404
  issues.push(`${skill.name}: ${e.message}`);
@@ -29086,11 +29156,11 @@ var init_wrap_backend = __esm({
29086
29156
  // src/agents/runners/config-loader.ts
29087
29157
  import { readFileSync as readFileSync18, readdirSync as readdirSync14, existsSync as existsSync29, mkdirSync as mkdirSync10, watchFile, unwatchFile } from "fs";
29088
29158
  import { join as join32 } from "path";
29089
- import { execFileSync as execFileSync3 } from "child_process";
29159
+ import { execFileSync as execFileSync4 } from "child_process";
29090
29160
  function resolveExecutable2(config2) {
29091
29161
  if (existsSync29(config2.executable)) return config2.executable;
29092
29162
  try {
29093
- return execFileSync3("which", [config2.executable], { encoding: "utf-8" }).trim();
29163
+ return execFileSync4("which", [config2.executable], { encoding: "utf-8" }).trim();
29094
29164
  } catch {
29095
29165
  }
29096
29166
  for (const fallback of config2.executableFallbacks ?? []) {
@@ -30563,7 +30633,7 @@ var init_telegram2 = __esm({
30563
30633
  });
30564
30634
 
30565
30635
  // src/skills/bootstrap.ts
30566
- import { existsSync as existsSync30, readFileSync as readFileSync19, writeFileSync as writeFileSync9, copyFileSync as copyFileSync3, readdirSync as readdirSync15 } from "fs";
30636
+ import { existsSync as existsSync30, readFileSync as readFileSync19, writeFileSync as writeFileSync10, copyFileSync as copyFileSync3, readdirSync as readdirSync15 } from "fs";
30567
30637
  import { readdir as readdir6, readFile as readFile8, writeFile as writeFile6, copyFile } from "fs/promises";
30568
30638
  import { join as join33, dirname as dirname5 } from "path";
30569
30639
  import { fileURLToPath as fileURLToPath2 } from "url";
@@ -30688,7 +30758,7 @@ function migrateSkillsToThreeTier() {
30688
30758
  copyFileSync3(skillPath, backupPath);
30689
30759
  let updated = ensureThreeTierFrontmatter(raw, { name: dirName, source: "cc-claw" });
30690
30760
  updated = updateFrontmatter(updated, { status: "approved" });
30691
- writeFileSync9(skillPath, updated, "utf-8");
30761
+ writeFileSync10(skillPath, updated, "utf-8");
30692
30762
  migrated++;
30693
30763
  log(`[skills] Migrated "${dirName}" to three-tier format (backed up to ${backupPath})`);
30694
30764
  } catch (err) {
@@ -30697,7 +30767,7 @@ function migrateSkillsToThreeTier() {
30697
30767
  }
30698
30768
  }
30699
30769
  try {
30700
- writeFileSync9(markerPath, [
30770
+ writeFileSync10(markerPath, [
30701
30771
  `# Three-tier skill migration completed`,
30702
30772
  `# Date: ${(/* @__PURE__ */ new Date()).toISOString()}`,
30703
30773
  `# Migrated: ${migrated}, Skipped: ${skipped}, Failed: ${failed}`,
@@ -30839,7 +30909,7 @@ __export(ai_skill_exports, {
30839
30909
  generateAiSkill: () => generateAiSkill,
30840
30910
  installAiSkill: () => installAiSkill
30841
30911
  });
30842
- import { existsSync as existsSync31, writeFileSync as writeFileSync10, mkdirSync as mkdirSync11 } from "fs";
30912
+ import { existsSync as existsSync31, writeFileSync as writeFileSync11, mkdirSync as mkdirSync11 } from "fs";
30843
30913
  import { join as join34 } from "path";
30844
30914
  import { homedir as homedir9 } from "os";
30845
30915
  function generateAiSkill() {
@@ -31291,7 +31361,7 @@ function installAiSkill() {
31291
31361
  const skillPath = join34(skillDir, "SKILL.md");
31292
31362
  try {
31293
31363
  mkdirSync11(skillDir, { recursive: true });
31294
- writeFileSync10(skillPath, skill, "utf-8");
31364
+ writeFileSync11(skillPath, skill, "utf-8");
31295
31365
  installed.push(skillPath);
31296
31366
  } catch {
31297
31367
  failed.push(skillPath);
@@ -31511,11 +31581,11 @@ async function main() {
31511
31581
  bootstrapSkills().catch((err) => error("[cc-claw] Skill bootstrap failed:", err));
31512
31582
  try {
31513
31583
  const { generateAiSkill: generateAiSkill2 } = await Promise.resolve().then(() => (init_ai_skill(), ai_skill_exports));
31514
- const { writeFileSync: writeFileSync15, mkdirSync: mkdirSync19 } = await import("fs");
31584
+ const { writeFileSync: writeFileSync16, mkdirSync: mkdirSync19 } = await import("fs");
31515
31585
  const { join: join41 } = await import("path");
31516
31586
  const skillDir = join41(SKILLS_PATH, "cc-claw-cli");
31517
31587
  mkdirSync19(skillDir, { recursive: true });
31518
- writeFileSync15(join41(skillDir, "SKILL.md"), generateAiSkill2(), "utf-8");
31588
+ writeFileSync16(join41(skillDir, "SKILL.md"), generateAiSkill2(), "utf-8");
31519
31589
  log("[cc-claw] AI skill updated");
31520
31590
  } catch {
31521
31591
  }
@@ -31743,8 +31813,8 @@ __export(service_exports2, {
31743
31813
  serviceStatus: () => serviceStatus,
31744
31814
  uninstallService: () => uninstallService
31745
31815
  });
31746
- import { existsSync as existsSync34, mkdirSync as mkdirSync13, writeFileSync as writeFileSync11, unlinkSync as unlinkSync8 } from "fs";
31747
- import { execFileSync as execFileSync4, execSync as execSync5 } from "child_process";
31816
+ import { existsSync as existsSync34, mkdirSync as mkdirSync13, writeFileSync as writeFileSync12, unlinkSync as unlinkSync8 } from "fs";
31817
+ import { execFileSync as execFileSync5, execSync as execSync5 } from "child_process";
31748
31818
  import { homedir as homedir10, platform } from "os";
31749
31819
  import { join as join36, dirname as dirname6 } from "path";
31750
31820
  function xmlEscape(s) {
@@ -31752,7 +31822,7 @@ function xmlEscape(s) {
31752
31822
  }
31753
31823
  function resolveExecutable3(name) {
31754
31824
  try {
31755
- return execFileSync4("which", [name], { encoding: "utf-8" }).trim();
31825
+ return execFileSync5("which", [name], { encoding: "utf-8" }).trim();
31756
31826
  } catch {
31757
31827
  const fallback = process.argv[1];
31758
31828
  if (fallback && existsSync34(fallback)) return fallback;
@@ -31834,13 +31904,13 @@ function installMacOS() {
31834
31904
  if (!existsSync34(LOGS_PATH)) mkdirSync13(LOGS_PATH, { recursive: true });
31835
31905
  if (existsSync34(PLIST_PATH)) {
31836
31906
  try {
31837
- execFileSync4("launchctl", ["unload", PLIST_PATH]);
31907
+ execFileSync5("launchctl", ["unload", PLIST_PATH]);
31838
31908
  } catch {
31839
31909
  }
31840
31910
  }
31841
- writeFileSync11(PLIST_PATH, generatePlist());
31911
+ writeFileSync12(PLIST_PATH, generatePlist());
31842
31912
  console.log(` Installed: ${PLIST_PATH}`);
31843
- execFileSync4("launchctl", ["load", PLIST_PATH]);
31913
+ execFileSync5("launchctl", ["load", PLIST_PATH]);
31844
31914
  console.log(" Service loaded and starting.");
31845
31915
  }
31846
31916
  function uninstallMacOS() {
@@ -31849,7 +31919,7 @@ function uninstallMacOS() {
31849
31919
  return;
31850
31920
  }
31851
31921
  try {
31852
- execFileSync4("launchctl", ["unload", PLIST_PATH]);
31922
+ execFileSync5("launchctl", ["unload", PLIST_PATH]);
31853
31923
  } catch {
31854
31924
  }
31855
31925
  unlinkSync8(PLIST_PATH);
@@ -31875,7 +31945,7 @@ async function getUptimeFromDaemon() {
31875
31945
  }
31876
31946
  function statusMacOS() {
31877
31947
  try {
31878
- const out = execFileSync4("launchctl", ["list"], { encoding: "utf-8" });
31948
+ const out = execFileSync5("launchctl", ["list"], { encoding: "utf-8" });
31879
31949
  const line = out.split("\n").find((l) => l.includes("cc-claw"));
31880
31950
  if (line) {
31881
31951
  const parts = line.trim().split(/\s+/);
@@ -31921,11 +31991,11 @@ WantedBy=default.target
31921
31991
  function installLinux() {
31922
31992
  if (!existsSync34(SYSTEMD_DIR)) mkdirSync13(SYSTEMD_DIR, { recursive: true });
31923
31993
  if (!existsSync34(LOGS_PATH)) mkdirSync13(LOGS_PATH, { recursive: true });
31924
- writeFileSync11(UNIT_PATH, generateUnit());
31994
+ writeFileSync12(UNIT_PATH, generateUnit());
31925
31995
  console.log(` Installed: ${UNIT_PATH}`);
31926
- execFileSync4("systemctl", ["--user", "daemon-reload"]);
31927
- execFileSync4("systemctl", ["--user", "enable", "cc-claw"]);
31928
- execFileSync4("systemctl", ["--user", "start", "cc-claw"]);
31996
+ execFileSync5("systemctl", ["--user", "daemon-reload"]);
31997
+ execFileSync5("systemctl", ["--user", "enable", "cc-claw"]);
31998
+ execFileSync5("systemctl", ["--user", "start", "cc-claw"]);
31929
31999
  console.log(" Service enabled and started.");
31930
32000
  }
31931
32001
  function uninstallLinux() {
@@ -31934,15 +32004,15 @@ function uninstallLinux() {
31934
32004
  return;
31935
32005
  }
31936
32006
  try {
31937
- execFileSync4("systemctl", ["--user", "stop", "cc-claw"]);
32007
+ execFileSync5("systemctl", ["--user", "stop", "cc-claw"]);
31938
32008
  } catch {
31939
32009
  }
31940
32010
  try {
31941
- execFileSync4("systemctl", ["--user", "disable", "cc-claw"]);
32011
+ execFileSync5("systemctl", ["--user", "disable", "cc-claw"]);
31942
32012
  } catch {
31943
32013
  }
31944
32014
  unlinkSync8(UNIT_PATH);
31945
- execFileSync4("systemctl", ["--user", "daemon-reload"]);
32015
+ execFileSync5("systemctl", ["--user", "daemon-reload"]);
31946
32016
  console.log(" Service uninstalled.");
31947
32017
  }
31948
32018
  function statusLinux() {
@@ -32335,7 +32405,7 @@ __export(doctor_exports, {
32335
32405
  doctorErrors: () => doctorErrors
32336
32406
  });
32337
32407
  import { existsSync as existsSync36, accessSync, constants } from "fs";
32338
- import { execFileSync as execFileSync5 } from "child_process";
32408
+ import { execFileSync as execFileSync6 } from "child_process";
32339
32409
  async function doctorCommand(globalOpts, localOpts) {
32340
32410
  const checks = [];
32341
32411
  const dbChecks = checkDatabase();
@@ -32402,7 +32472,7 @@ async function doctorCommand(globalOpts, localOpts) {
32402
32472
  checks.push({ name: "Daemon", status: "warning", message: "could not probe" });
32403
32473
  }
32404
32474
  try {
32405
- const latest = execFileSync5("npm", ["view", "cc-claw", "version"], { encoding: "utf-8", timeout: 1e4 }).trim();
32475
+ const latest = execFileSync6("npm", ["view", "cc-claw", "version"], { encoding: "utf-8", timeout: 1e4 }).trim();
32406
32476
  if (latest && latest !== VERSION) {
32407
32477
  checks.push({ name: "Update available", status: "warning", message: `v${latest} available (current: v${VERSION})`, fix: "npm install -g cc-claw@latest" });
32408
32478
  }
@@ -32477,8 +32547,8 @@ async function doctorCommand(globalOpts, localOpts) {
32477
32547
  );
32478
32548
  if (errorChecks.length > 0 && existsSync36(ERROR_LOG_PATH)) {
32479
32549
  try {
32480
- const { writeFileSync: writeFileSync15 } = await import("fs");
32481
- writeFileSync15(ERROR_LOG_PATH, "");
32550
+ const { writeFileSync: writeFileSync16 } = await import("fs");
32551
+ writeFileSync16(ERROR_LOG_PATH, "");
32482
32552
  for (const c of errorChecks) {
32483
32553
  c.status = "ok";
32484
32554
  c.message = "cleared (log truncated)";
@@ -32760,7 +32830,7 @@ __export(gemini_exports, {
32760
32830
  geminiReorder: () => geminiReorder,
32761
32831
  geminiRotation: () => geminiRotation
32762
32832
  });
32763
- import { existsSync as existsSync39, mkdirSync as mkdirSync14, writeFileSync as writeFileSync12, readFileSync as readFileSync28, chmodSync } from "fs";
32833
+ import { existsSync as existsSync39, mkdirSync as mkdirSync14, writeFileSync as writeFileSync13, readFileSync as readFileSync28, chmodSync } from "fs";
32764
32834
  import { join as join37 } from "path";
32765
32835
  import { createInterface as createInterface8 } from "readline";
32766
32836
  function requireDb() {
@@ -32880,7 +32950,7 @@ async function geminiAddAccount(globalOpts, opts) {
32880
32950
  const slotDir = join37(slotsDir, `slot-${tempId}`);
32881
32951
  mkdirSync14(slotDir, { recursive: true, mode: 448 });
32882
32952
  mkdirSync14(join37(slotDir, ".gemini"), { recursive: true });
32883
- writeFileSync12(join37(slotDir, ".gemini", "settings.json"), JSON.stringify({
32953
+ writeFileSync13(join37(slotDir, ".gemini", "settings.json"), JSON.stringify({
32884
32954
  security: { auth: { selectedType: "oauth-personal" } }
32885
32955
  }, null, 2));
32886
32956
  console.log("");
@@ -33020,7 +33090,7 @@ async function geminiRelogin(globalOpts, idOrLabel) {
33020
33090
  const settingsPath = join37(slot.configHome, ".gemini", "settings.json");
33021
33091
  if (!existsSync39(settingsPath)) {
33022
33092
  mkdirSync14(join37(slot.configHome, ".gemini"), { recursive: true });
33023
- writeFileSync12(settingsPath, JSON.stringify({
33093
+ writeFileSync13(settingsPath, JSON.stringify({
33024
33094
  security: { auth: { selectedType: "oauth-personal" } }
33025
33095
  }, null, 2));
33026
33096
  }
@@ -36215,7 +36285,7 @@ var completion_exports = {};
36215
36285
  __export(completion_exports, {
36216
36286
  completionCommand: () => completionCommand
36217
36287
  });
36218
- import { writeFileSync as writeFileSync13, mkdirSync as mkdirSync17 } from "fs";
36288
+ import { writeFileSync as writeFileSync14, mkdirSync as mkdirSync17 } from "fs";
36219
36289
  import { join as join39 } from "path";
36220
36290
  import { homedir as homedir11 } from "os";
36221
36291
  async function completionCommand(opts) {
@@ -36236,7 +36306,7 @@ async function completionCommand(opts) {
36236
36306
  mkdirSync17(dir, { recursive: true });
36237
36307
  const filename = shell === "zsh" ? "_cc-claw" : shell === "fish" ? "cc-claw.fish" : "cc-claw.bash";
36238
36308
  const filepath = join39(dir, filename);
36239
- writeFileSync13(filepath, script, "utf-8");
36309
+ writeFileSync14(filepath, script, "utf-8");
36240
36310
  console.log(`\u2713 Completion script written to ${filepath}
36241
36311
  `);
36242
36312
  if (shell === "zsh") {
@@ -36884,8 +36954,8 @@ var init_optimize2 = __esm({
36884
36954
 
36885
36955
  // src/setup.ts
36886
36956
  var setup_exports = {};
36887
- import { existsSync as existsSync61, writeFileSync as writeFileSync14, readFileSync as readFileSync32, copyFileSync as copyFileSync5, mkdirSync as mkdirSync18, statSync as statSync11 } from "fs";
36888
- import { execFileSync as execFileSync6 } from "child_process";
36957
+ import { existsSync as existsSync61, writeFileSync as writeFileSync15, readFileSync as readFileSync32, copyFileSync as copyFileSync5, mkdirSync as mkdirSync18, statSync as statSync11 } from "fs";
36958
+ import { execFileSync as execFileSync7 } from "child_process";
36889
36959
  import { createInterface as createInterface11 } from "readline";
36890
36960
  import { join as join40 } from "path";
36891
36961
  function divider2() {
@@ -36949,7 +37019,7 @@ async function setup() {
36949
37019
  let foundAnyBackend = false;
36950
37020
  for (const bk of backends) {
36951
37021
  try {
36952
- const path = execFileSync6("which", [bk.cmd], { encoding: "utf-8" }).trim();
37022
+ const path = execFileSync7("which", [bk.cmd], { encoding: "utf-8" }).trim();
36953
37023
  console.log(green(` ${bk.name} CLI found: ${path}`));
36954
37024
  foundAnyBackend = true;
36955
37025
  } catch {
@@ -37223,7 +37293,7 @@ async function setup() {
37223
37293
  envLines.push("", "# Video Analysis", `GEMINI_API_KEY=${env.GEMINI_API_KEY}`);
37224
37294
  }
37225
37295
  const envContent = envLines.join("\n") + "\n";
37226
- writeFileSync14(ENV_PATH, envContent, { mode: 384 });
37296
+ writeFileSync15(ENV_PATH, envContent, { mode: 384 });
37227
37297
  console.log(green(` Config saved to ${ENV_PATH} (permissions: owner-only)`));
37228
37298
  header(6, TOTAL_STEPS, "Run on Startup (Daemon)");
37229
37299
  console.log(" CC-Claw can run automatically in the background, starting");
@@ -37901,8 +37971,8 @@ async function run(argv = process.argv) {
37901
37971
  if (argv.includes("--version") || argv.includes("-V")) {
37902
37972
  console.log(VERSION);
37903
37973
  try {
37904
- const { execFileSync: execFileSync7 } = await import("child_process");
37905
- const latest = execFileSync7("npm", ["view", "cc-claw", "version"], { encoding: "utf-8", timeout: 1e4 }).trim();
37974
+ const { execFileSync: execFileSync8 } = await import("child_process");
37975
+ const latest = execFileSync8("npm", ["view", "cc-claw", "version"], { encoding: "utf-8", timeout: 1e4 }).trim();
37906
37976
  if (latest && latest !== VERSION) {
37907
37977
  console.log(`
37908
37978
  Update available: v${latest} (current: v${VERSION})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-claw",
3
- "version": "0.22.6",
3
+ "version": "0.22.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",