ccstatusline-zh 2.2.18 → 2.2.20

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.
@@ -1355,7 +1355,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
1355
1355
  exports.useTransition = function() {
1356
1356
  return resolveDispatcher().useTransition();
1357
1357
  };
1358
- exports.version = "19.2.6";
1358
+ exports.version = "19.2.7";
1359
1359
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1360
1360
  })();
1361
1361
  });
@@ -9713,7 +9713,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
9713
9713
  offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
9714
9714
  offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden;
9715
9715
  commitReconciliationEffects(finishedWork);
9716
- if (flags & 8192 && (root = finishedWork.stateNode, root._visibility = hoistableRoot ? root._visibility & -2 : root._visibility | 1, hoistableRoot && (current2 === null || wasHidden || offscreenSubtreeIsHidden || offscreenSubtreeWasHidden || recursivelyTraverseDisappearLayoutEffects(finishedWork)), supportsMutation))
9716
+ if (flags & 8192 && (root = finishedWork.stateNode, root._visibility = hoistableRoot ? root._visibility & -2 : root._visibility | 1, hoistableRoot && (current2 === null || wasHidden || offscreenSubtreeIsHidden || offscreenSubtreeWasHidden || recursivelyTraverseDisappearLayoutEffects(finishedWork)), supportsMutation)) {
9717
9717
  a:
9718
9718
  if (current2 = null, supportsMutation)
9719
9719
  for (root = finishedWork;; ) {
@@ -9753,6 +9753,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
9753
9753
  root.sibling.return = root.return;
9754
9754
  root = root.sibling;
9755
9755
  }
9756
+ }
9756
9757
  flags & 4 && (flags = finishedWork.updateQueue, flags !== null && (current2 = flags.retryQueue, current2 !== null && (flags.retryQueue = null, attachSuspenseRetryListeners(finishedWork, current2))));
9757
9758
  break;
9758
9759
  case 19:
@@ -18054,7 +18055,7 @@ var require_backend = __commonJS((exports, module) => {
18054
18055
  987: (module2, __unused_webpack_exports, __webpack_require__2) => {
18055
18056
  if (true) {
18056
18057
  module2.exports = __webpack_require__2(786);
18057
- } else {}
18058
+ }
18058
18059
  },
18059
18060
  126: (__unused_webpack_module, exports2, __webpack_require__2) => {
18060
18061
  var process4 = __webpack_require__2(169);
@@ -18504,7 +18505,7 @@ var require_backend = __commonJS((exports, module) => {
18504
18505
  189: (module2, __unused_webpack_exports, __webpack_require__2) => {
18505
18506
  if (true) {
18506
18507
  module2.exports = __webpack_require__2(126);
18507
- } else {}
18508
+ }
18508
18509
  },
18509
18510
  206: function(module2, exports2, __webpack_require__2) {
18510
18511
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
@@ -18519,7 +18520,7 @@ var require_backend = __commonJS((exports, module) => {
18519
18520
  (function(root, factory) {
18520
18521
  if (true) {
18521
18522
  __WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__2(430)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports2, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module2.exports = __WEBPACK_AMD_DEFINE_RESULT__);
18522
- } else {}
18523
+ }
18523
18524
  })(this, function ErrorStackParser(StackFrame) {
18524
18525
  var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
18525
18526
  var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
@@ -19215,7 +19216,7 @@ var require_backend = __commonJS((exports, module) => {
19215
19216
  (function(root, factory) {
19216
19217
  if (true) {
19217
19218
  __WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports2, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module2.exports = __WEBPACK_AMD_DEFINE_RESULT__);
19218
- } else {}
19219
+ }
19219
19220
  })(this, function() {
19220
19221
  function _isNumber(n) {
19221
19222
  return !isNaN(parseFloat(n)) && isFinite(n);
@@ -24589,7 +24590,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24589
24590
  var suffix = "";
24590
24591
  if (true) {
24591
24592
  suffix = " (<anonymous>)";
24592
- } else {}
24593
+ }
24593
24594
  return `
24594
24595
  ` + prefix + name + suffix;
24595
24596
  }
@@ -27318,7 +27319,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
27318
27319
  hasChanges = true;
27319
27320
  updateMostRecentlyInspectedElementIfNecessary(devtoolsInstance.id);
27320
27321
  }
27321
- } else {}
27322
+ }
27322
27323
  }
27323
27324
  } catch (err) {
27324
27325
  _iterator2.e(err);
@@ -29097,7 +29098,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29097
29098
  if (contentFiber === null) {
29098
29099
  throw new Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");
29099
29100
  }
29100
- } else {}
29101
+ }
29101
29102
  var _isTimedOut = fiber.memoizedState !== null;
29102
29103
  if (!_isTimedOut) {
29103
29104
  newSuspenseNode.rects = measureInstance(newInstance);
@@ -29131,7 +29132,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29131
29132
  if (_contentFiber === null) {
29132
29133
  throw new Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");
29133
29134
  }
29134
- } else {}
29135
+ }
29135
29136
  var suspenseState = fiber.memoizedState;
29136
29137
  var _isTimedOut3 = suspenseState !== null;
29137
29138
  if (!_isTimedOut3) {
@@ -29231,7 +29232,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29231
29232
  trackThrownPromisesFromRetryCache(newSuspenseNode, fiber.stateNode);
29232
29233
  mountSuspenseChildrenRecursively(_contentFiber2, traceNearestHostComponentUpdate, stashedSuspenseParent, stashedSuspensePrevious, stashedSuspenseRemaining);
29233
29234
  shouldPopSuspenseNode = false;
29234
- } else {}
29235
+ }
29235
29236
  } else {
29236
29237
  if (fiber.child !== null) {
29237
29238
  mountChildrenRecursively(fiber.child, traceNearestHostComponentUpdate);
@@ -29817,7 +29818,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29817
29818
  shouldPopSuspenseNode = false;
29818
29819
  } else if (previousHydrated && !nextHydrated) {
29819
29820
  throw new Error("Encountered a dehydrated Suspense boundary that was previously hydrated.");
29820
- } else {}
29821
+ }
29821
29822
  } else {
29822
29823
  if (nextFiber.child !== prevFiber.child) {
29823
29824
  updateFlags |= updateChildrenRecursively(nextFiber.child, prevFiber.child, traceNearestHostComponentUpdate);
@@ -29863,8 +29864,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29863
29864
  recordResetChildren(fiberInstance);
29864
29865
  }
29865
29866
  updateFlags &= ~ShouldResetChildren;
29866
- } else {}
29867
- } else {}
29867
+ }
29868
+ }
29868
29869
  if ((updateFlags & ShouldResetSuspenseChildren) !== NoUpdate) {
29869
29870
  if (fiberInstance !== null && fiberInstance.kind === FIBER_INSTANCE) {
29870
29871
  var _suspenseNode3 = fiberInstance.suspenseNode;
@@ -29872,7 +29873,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29872
29873
  recordResetSuspenseChildren(_suspenseNode3);
29873
29874
  updateFlags &= ~ShouldResetSuspenseChildren;
29874
29875
  }
29875
- } else {}
29876
+ }
29876
29877
  }
29877
29878
  if ((updateFlags & ShouldResetParentSuspenseChildren) !== NoUpdate) {
29878
29879
  if (fiberInstance !== null && fiberInstance.kind === FIBER_INSTANCE) {
@@ -29881,7 +29882,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29881
29882
  updateFlags &= ~ShouldResetParentSuspenseChildren;
29882
29883
  updateFlags |= ShouldResetSuspenseChildren;
29883
29884
  }
29884
- } else {}
29885
+ }
29885
29886
  }
29886
29887
  return updateFlags;
29887
29888
  } finally {
@@ -32945,7 +32946,7 @@ The error thrown in the component is:
32945
32946
  rendererInterface = renderer_attach(hook, id, renderer, global2, shouldStartProfilingNow, profilingSettings);
32946
32947
  } else if (renderer.ComponentTree) {
32947
32948
  rendererInterface = legacy_renderer_attach(hook, id, renderer, global2);
32948
- } else {}
32949
+ }
32949
32950
  }
32950
32951
  return rendererInterface;
32951
32952
  }
@@ -49536,7 +49537,7 @@ function finalize(ctx, schema) {
49536
49537
  result2.$schema = "http://json-schema.org/draft-07/schema#";
49537
49538
  } else if (ctx.target === "draft-04") {
49538
49539
  result2.$schema = "http://json-schema.org/draft-04/schema#";
49539
- } else if (ctx.target === "openapi-3.0") {} else {}
49540
+ } else if (ctx.target === "openapi-3.0") {}
49540
49541
  if (ctx.external?.uri) {
49541
49542
  const id = ctx.external.registry.get(schema)?.id;
49542
49543
  if (!id)
@@ -49797,7 +49798,7 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
49797
49798
  if (val === undefined) {
49798
49799
  if (ctx.unrepresentable === "throw") {
49799
49800
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
49800
- } else {}
49801
+ }
49801
49802
  } else if (typeof val === "bigint") {
49802
49803
  if (ctx.unrepresentable === "throw") {
49803
49804
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -53061,6 +53062,7 @@ var init_Settings = __esm(() => {
53061
53062
  overrideBackgroundColor: exports_external.string().optional(),
53062
53063
  overrideForegroundColor: exports_external.string().optional(),
53063
53064
  globalBold: exports_external.boolean().default(false),
53065
+ gitCacheTtlSeconds: exports_external.number().min(0).max(60).default(5),
53064
53066
  minimalistMode: exports_external.boolean().default(false),
53065
53067
  powerline: PowerlineConfigSchema.default({
53066
53068
  enabled: false,
@@ -53518,6 +53520,175 @@ class OutputStyleWidget {
53518
53520
 
53519
53521
  // src/utils/git.ts
53520
53522
  import { execFileSync } from "child_process";
53523
+ import { createHash } from "node:crypto";
53524
+ import * as fs2 from "node:fs";
53525
+ import * as os3 from "node:os";
53526
+ import * as path from "node:path";
53527
+ function getCacheDir() {
53528
+ return path.join(os3.homedir(), ".cache", "ccstatusline");
53529
+ }
53530
+ function getCachePath(gitDir) {
53531
+ const repoHash = createHash("sha256").update(gitDir).digest("hex").slice(0, 16);
53532
+ return path.join(getCacheDir(), "git-cache", `git-${repoHash}.json`);
53533
+ }
53534
+ function getMtimeMs(filePath) {
53535
+ try {
53536
+ return fs2.statSync(filePath).mtimeMs;
53537
+ } catch {
53538
+ return null;
53539
+ }
53540
+ }
53541
+ function normalizeDirectory(candidate) {
53542
+ try {
53543
+ const resolved = path.resolve(candidate);
53544
+ const stats = fs2.statSync(resolved);
53545
+ return stats.isDirectory() ? resolved : path.dirname(resolved);
53546
+ } catch {
53547
+ return null;
53548
+ }
53549
+ }
53550
+ function readGitDirFile(gitFilePath) {
53551
+ try {
53552
+ const content = fs2.readFileSync(gitFilePath, "utf-8").trim();
53553
+ const match = /^gitdir:\s*(.+)$/i.exec(content);
53554
+ if (!match?.[1]) {
53555
+ return null;
53556
+ }
53557
+ return path.resolve(path.dirname(gitFilePath), match[1]);
53558
+ } catch {
53559
+ return null;
53560
+ }
53561
+ }
53562
+ function discoverGitDir(startDir) {
53563
+ let current = startDir;
53564
+ for (;; ) {
53565
+ const gitPath = path.join(current, ".git");
53566
+ try {
53567
+ const stats = fs2.statSync(gitPath);
53568
+ if (stats.isDirectory()) {
53569
+ return gitPath;
53570
+ }
53571
+ if (stats.isFile()) {
53572
+ return readGitDirFile(gitPath);
53573
+ }
53574
+ } catch {}
53575
+ const parent = path.dirname(current);
53576
+ if (parent === current) {
53577
+ return null;
53578
+ }
53579
+ current = parent;
53580
+ }
53581
+ }
53582
+ function getGitRepoMetadata(cwd2) {
53583
+ if (!cwd2) {
53584
+ return null;
53585
+ }
53586
+ const startDir = normalizeDirectory(cwd2);
53587
+ if (!startDir) {
53588
+ return null;
53589
+ }
53590
+ const gitDir = discoverGitDir(startDir);
53591
+ if (!gitDir) {
53592
+ return null;
53593
+ }
53594
+ return {
53595
+ cachePath: getCachePath(gitDir),
53596
+ headMtimeMs: getMtimeMs(path.join(gitDir, "HEAD")),
53597
+ indexMtimeMs: getMtimeMs(path.join(gitDir, "index"))
53598
+ };
53599
+ }
53600
+ function getGitCacheTtlMs(context) {
53601
+ const ttlSeconds = context.gitCacheTtlSeconds;
53602
+ if (typeof ttlSeconds !== "number" || !Number.isFinite(ttlSeconds)) {
53603
+ return DEFAULT_GIT_CACHE_TTL_SECONDS * 1000;
53604
+ }
53605
+ return Math.min(60, Math.max(0, ttlSeconds)) * 1000;
53606
+ }
53607
+ function isCacheEntry(value) {
53608
+ if (typeof value !== "object" || value === null) {
53609
+ return false;
53610
+ }
53611
+ const entry = value;
53612
+ return (typeof entry.output === "string" || entry.output === null) && typeof entry.createdAt === "number" && (typeof entry.headMtimeMs === "number" || entry.headMtimeMs === null) && (typeof entry.indexMtimeMs === "number" || entry.indexMtimeMs === null);
53613
+ }
53614
+ function isCacheEntryFresh(entry, metadata, ttlMs, now2) {
53615
+ if (metadata) {
53616
+ if (entry.headMtimeMs !== metadata.headMtimeMs || entry.indexMtimeMs !== metadata.indexMtimeMs) {
53617
+ return false;
53618
+ }
53619
+ }
53620
+ return ttlMs === 0 || now2 - entry.createdAt <= ttlMs;
53621
+ }
53622
+ function readPersistentCache(cachePath) {
53623
+ try {
53624
+ const parsed = JSON.parse(fs2.readFileSync(cachePath, "utf-8"));
53625
+ if (typeof parsed !== "object" || parsed === null) {
53626
+ return null;
53627
+ }
53628
+ const data = parsed;
53629
+ if (data.version !== GIT_CACHE_SCHEMA_VERSION || typeof data.cwd !== "string" && data.cwd !== null || typeof data.entries !== "object" || data.entries === null) {
53630
+ return null;
53631
+ }
53632
+ const entries = {};
53633
+ for (const [key, value] of Object.entries(data.entries)) {
53634
+ if (isCacheEntry(value)) {
53635
+ entries[key] = value;
53636
+ }
53637
+ }
53638
+ return {
53639
+ version: GIT_CACHE_SCHEMA_VERSION,
53640
+ cwd: data.cwd,
53641
+ entries
53642
+ };
53643
+ } catch {
53644
+ return null;
53645
+ }
53646
+ }
53647
+ function writePersistentCache(cachePath, cache3) {
53648
+ try {
53649
+ const cacheDir = path.dirname(cachePath);
53650
+ fs2.mkdirSync(cacheDir, { recursive: true });
53651
+ const tempPath = `${cachePath}.${process.pid}.${Date.now()}.tmp`;
53652
+ fs2.writeFileSync(tempPath, JSON.stringify(cache3), "utf-8");
53653
+ fs2.renameSync(tempPath, cachePath);
53654
+ } catch {}
53655
+ }
53656
+ function readPersistentCacheEntry(metadata, cacheKey, cwd2, ttlMs, now2) {
53657
+ if (!metadata) {
53658
+ return null;
53659
+ }
53660
+ const cache3 = readPersistentCache(metadata.cachePath);
53661
+ if (cache3?.cwd !== (cwd2 ?? null)) {
53662
+ return null;
53663
+ }
53664
+ const entry = cache3.entries[cacheKey];
53665
+ if (!entry || !isCacheEntryFresh(entry, metadata, ttlMs, now2)) {
53666
+ return null;
53667
+ }
53668
+ return entry;
53669
+ }
53670
+ function writePersistentCacheEntry(metadata, cacheKey, cwd2, entry) {
53671
+ if (!metadata) {
53672
+ return;
53673
+ }
53674
+ const cacheCwd = cwd2 ?? null;
53675
+ const existingCache = readPersistentCache(metadata.cachePath);
53676
+ const cache3 = existingCache?.cwd === cacheCwd ? existingCache : {
53677
+ version: GIT_CACHE_SCHEMA_VERSION,
53678
+ cwd: cacheCwd,
53679
+ entries: {}
53680
+ };
53681
+ cache3.entries[cacheKey] = entry;
53682
+ writePersistentCache(metadata.cachePath, cache3);
53683
+ }
53684
+ function createCacheEntry(output, metadata, now2) {
53685
+ return {
53686
+ output,
53687
+ createdAt: now2,
53688
+ headMtimeMs: metadata?.headMtimeMs ?? null,
53689
+ indexMtimeMs: metadata?.indexMtimeMs ?? null
53690
+ };
53691
+ }
53521
53692
  function resolveGitCwd(context) {
53522
53693
  const candidates = [
53523
53694
  context.data?.cwd,
@@ -53538,22 +53709,37 @@ function runGit(command, context) {
53538
53709
  function runGitArgs(args, context, cacheCommand) {
53539
53710
  const cwd2 = resolveGitCwd(context);
53540
53711
  const cacheToken = cacheCommand ?? args.join("\x00");
53541
- const cacheKey = `${cacheToken}|${cwd2 ?? ""}`;
53542
- if (gitCommandCache.has(cacheKey)) {
53543
- return gitCommandCache.get(cacheKey) ?? null;
53712
+ const memoryCacheKey = `${cacheToken}|${cwd2 ?? ""}`;
53713
+ const persistentCacheKey = cacheToken;
53714
+ const metadata = getGitRepoMetadata(cwd2);
53715
+ const ttlMs = getGitCacheTtlMs(context);
53716
+ const now2 = Date.now();
53717
+ const memoryEntry = gitCommandCache.get(memoryCacheKey);
53718
+ if (memoryEntry && isCacheEntryFresh(memoryEntry, metadata, ttlMs, now2)) {
53719
+ return memoryEntry.output;
53720
+ }
53721
+ const persistentEntry = readPersistentCacheEntry(metadata, persistentCacheKey, cwd2, ttlMs, now2);
53722
+ if (persistentEntry) {
53723
+ gitCommandCache.set(memoryCacheKey, persistentEntry);
53724
+ return persistentEntry.output;
53544
53725
  }
53545
53726
  try {
53546
53727
  const output = execFileSync("git", args, {
53547
53728
  encoding: "utf8",
53548
53729
  stdio: ["pipe", "pipe", "ignore"],
53549
53730
  env: { ...process.env, GIT_OPTIONAL_LOCKS: "0" },
53731
+ windowsHide: true,
53550
53732
  ...cwd2 ? { cwd: cwd2 } : {}
53551
53733
  }).trimEnd();
53552
53734
  const result2 = output.length > 0 ? output : null;
53553
- gitCommandCache.set(cacheKey, result2);
53735
+ const entry = createCacheEntry(result2, metadata, now2);
53736
+ gitCommandCache.set(memoryCacheKey, entry);
53737
+ writePersistentCacheEntry(metadata, persistentCacheKey, cwd2, entry);
53554
53738
  return result2;
53555
53739
  } catch {
53556
- gitCommandCache.set(cacheKey, null);
53740
+ const entry = createCacheEntry(null, metadata, now2);
53741
+ gitCommandCache.set(memoryCacheKey, entry);
53742
+ writePersistentCacheEntry(metadata, persistentCacheKey, cwd2, entry);
53557
53743
  return null;
53558
53744
  }
53559
53745
  }
@@ -53659,13 +53845,13 @@ function getGitConflictCount(context) {
53659
53845
  `).map((line) => {
53660
53846
  const parts = line.split(/\s+/).slice(3);
53661
53847
  return parts.join(" ");
53662
- }).filter((path) => path.length > 0));
53848
+ }).filter((path2) => path2.length > 0));
53663
53849
  return files.size;
53664
53850
  }
53665
53851
  function getGitShortSha(context) {
53666
53852
  return runGit("rev-parse --short HEAD", context);
53667
53853
  }
53668
- var gitCommandCache;
53854
+ var DEFAULT_GIT_CACHE_TTL_SECONDS = 5, GIT_CACHE_SCHEMA_VERSION = 1, gitCommandCache;
53669
53855
  var init_git = __esm(() => {
53670
53856
  gitCommandCache = new Map;
53671
53857
  });
@@ -53783,8 +53969,8 @@ function renderOsc8Link(url2, text) {
53783
53969
  function encodeGitRefForUrlPath(ref) {
53784
53970
  return ref.split("/").map((segment) => encodeURIComponent(segment)).join("/");
53785
53971
  }
53786
- function encodeFilePathForUri(path) {
53787
- return path.replace(/\\/g, "/").split("/").map((segment) => encodeURIComponent(segment)).join("/");
53972
+ function encodeFilePathForUri(path2) {
53973
+ return path2.replace(/\\/g, "/").split("/").map((segment) => encodeURIComponent(segment)).join("/");
53788
53974
  }
53789
53975
  function buildIdeFileUrl(filePath, ideLinkMode) {
53790
53976
  const normalizedPath = filePath.replace(/\\/g, "/");
@@ -54439,19 +54625,19 @@ var init_GitRootDir = __esm(() => {
54439
54625
  import { execFileSync as execFileSync2 } from "child_process";
54440
54626
  import {
54441
54627
  existsSync as existsSync2,
54442
- mkdirSync,
54443
- readFileSync as readFileSync2,
54444
- statSync,
54445
- writeFileSync
54628
+ mkdirSync as mkdirSync2,
54629
+ readFileSync as readFileSync3,
54630
+ statSync as statSync2,
54631
+ writeFileSync as writeFileSync2
54446
54632
  } from "fs";
54447
- import { createHash } from "node:crypto";
54448
- import os3 from "node:os";
54449
- import path from "node:path";
54450
- function getCacheDir(deps) {
54451
- return path.join(deps.getHomedir(), ".cache", "ccstatusline");
54633
+ import { createHash as createHash2 } from "node:crypto";
54634
+ import os4 from "node:os";
54635
+ import path2 from "node:path";
54636
+ function getCacheDir2(deps) {
54637
+ return path2.join(deps.getHomedir(), ".cache", "ccstatusline");
54452
54638
  }
54453
54639
  function getGitReviewCacheDir(deps) {
54454
- return path.join(getCacheDir(deps), "git-review");
54640
+ return path2.join(getCacheDir2(deps), "git-review");
54455
54641
  }
54456
54642
  function runGitForCache(args, cwd2, deps) {
54457
54643
  try {
@@ -54459,7 +54645,8 @@ function runGitForCache(args, cwd2, deps) {
54459
54645
  encoding: "utf8",
54460
54646
  stdio: ["pipe", "pipe", "ignore"],
54461
54647
  cwd: cwd2,
54462
- timeout: CLI_TIMEOUT
54648
+ timeout: CLI_TIMEOUT,
54649
+ windowsHide: true
54463
54650
  }).trim();
54464
54651
  } catch {
54465
54652
  return "";
@@ -54480,9 +54667,9 @@ function getCacheRef(cwd2, deps) {
54480
54667
  }
54481
54668
  return "unknown";
54482
54669
  }
54483
- function getCachePath(cwd2, ref, deps) {
54484
- const hash2 = createHash("sha256").update(cwd2).update("\x00").update(ref).digest("hex").slice(0, 16);
54485
- return path.join(getGitReviewCacheDir(deps), `git-review-${hash2}.json`);
54670
+ function getCachePath2(cwd2, ref, deps) {
54671
+ const hash2 = createHash2("sha256").update(cwd2).update("\x00").update(ref).digest("hex").slice(0, 16);
54672
+ return path2.join(getGitReviewCacheDir(deps), `git-review-${hash2}.json`);
54486
54673
  }
54487
54674
  function readCache(cachePath, deps) {
54488
54675
  try {
@@ -54519,35 +54706,70 @@ function getOriginUrl(cwd2, deps) {
54519
54706
  const url2 = runGitForCache(["remote", "get-url", "--", "origin"], cwd2, deps);
54520
54707
  return url2.length > 0 ? url2 : null;
54521
54708
  }
54709
+ function isSshRemoteUrl(url2) {
54710
+ const trimmed = url2.trim().toLowerCase();
54711
+ return trimmed.startsWith("ssh://") || !trimmed.includes("://");
54712
+ }
54713
+ function resolveSshHostAlias(host, deps) {
54714
+ try {
54715
+ const output = deps.execFileSync("ssh", ["-G", host], {
54716
+ encoding: "utf8",
54717
+ stdio: ["pipe", "pipe", "ignore"],
54718
+ timeout: CLI_TIMEOUT,
54719
+ windowsHide: true
54720
+ }).trim();
54721
+ for (const line of output.split(/\r?\n/)) {
54722
+ const match = /^hostname\s+(.+)$/i.exec(line.trim());
54723
+ if (match?.[1]) {
54724
+ return match[1].toLowerCase();
54725
+ }
54726
+ }
54727
+ } catch {}
54728
+ return host.toLowerCase();
54729
+ }
54730
+ function getNamedForgeProvider(host) {
54731
+ if (host.includes("github")) {
54732
+ return "gh";
54733
+ }
54734
+ if (host.includes("gitlab")) {
54735
+ return "glab";
54736
+ }
54737
+ return null;
54738
+ }
54739
+ function getEffectiveRemoteHost(url2, host, deps) {
54740
+ const normalizedHost = host.toLowerCase();
54741
+ if (!isSshRemoteUrl(url2) || getNamedForgeProvider(normalizedHost)) {
54742
+ return normalizedHost;
54743
+ }
54744
+ return resolveSshHostAlias(normalizedHost, deps);
54745
+ }
54522
54746
  function getOriginHost(cwd2, deps) {
54523
54747
  const url2 = getOriginUrl(cwd2, deps);
54524
54748
  if (!url2) {
54525
54749
  return null;
54526
54750
  }
54527
54751
  const parsed = parseRemoteUrl(url2);
54528
- return parsed ? parsed.host.toLowerCase() : null;
54752
+ return parsed ? getEffectiveRemoteHost(url2, parsed.host, deps) : null;
54529
54753
  }
54530
- function toHttpsRepoRef(url2) {
54754
+ function toHttpsRepoRef(url2, deps) {
54531
54755
  const parsed = parseRemoteUrl(url2);
54532
54756
  if (!parsed) {
54533
54757
  return null;
54534
54758
  }
54535
- return `https://${parsed.host}/${parsed.owner}/${parsed.repo}`;
54759
+ return `https://${getEffectiveRemoteHost(url2, parsed.host, deps)}/${parsed.owner}/${parsed.repo}`;
54536
54760
  }
54537
54761
  function getOriginRepoRef(cwd2, deps) {
54538
54762
  const url2 = getOriginUrl(cwd2, deps);
54539
- return url2 ? toHttpsRepoRef(url2) : null;
54763
+ return url2 ? toHttpsRepoRef(url2, deps) : null;
54540
54764
  }
54541
54765
  function getProviderCandidates(cwd2, deps) {
54542
54766
  const host = getOriginHost(cwd2, deps);
54543
54767
  if (!host) {
54544
54768
  return ["gh", "glab"];
54545
54769
  }
54546
- if (host.includes("github")) {
54547
- return ["gh"];
54548
- }
54549
- if (host.includes("gitlab")) {
54550
- return ["glab"];
54770
+ const namedForgeProvider = getNamedForgeProvider(host);
54771
+ if (namedForgeProvider) {
54772
+ return [namedForgeProvider];
54551
54773
  }
54552
54774
  const authed = [];
54553
54775
  if (isCliAuthedForHost("glab", host, deps)) {
@@ -54562,7 +54784,8 @@ function isCliAvailable(cli, deps) {
54562
54784
  try {
54563
54785
  deps.execFileSync(cli, ["--version"], {
54564
54786
  stdio: ["pipe", "pipe", "ignore"],
54565
- timeout: CLI_TIMEOUT
54787
+ timeout: CLI_TIMEOUT,
54788
+ windowsHide: true
54566
54789
  });
54567
54790
  return true;
54568
54791
  } catch {
@@ -54573,7 +54796,8 @@ function isCliAuthedForHost(cli, host, deps) {
54573
54796
  try {
54574
54797
  deps.execFileSync(cli, ["auth", "status", "--hostname", host], {
54575
54798
  stdio: ["pipe", "pipe", "ignore"],
54576
- timeout: CLI_TIMEOUT
54799
+ timeout: CLI_TIMEOUT,
54800
+ windowsHide: true
54577
54801
  });
54578
54802
  return true;
54579
54803
  } catch {
@@ -54605,7 +54829,8 @@ function fetchFromGh(cwd2, repoRef, deps) {
54605
54829
  encoding: "utf8",
54606
54830
  stdio: ["pipe", "pipe", "ignore"],
54607
54831
  cwd: cwd2,
54608
- timeout: CLI_TIMEOUT
54832
+ timeout: CLI_TIMEOUT,
54833
+ windowsHide: true
54609
54834
  }).trim();
54610
54835
  if (output.length === 0) {
54611
54836
  return null;
@@ -54637,7 +54862,8 @@ function fetchFromGlab(cwd2, repoRef, deps) {
54637
54862
  encoding: "utf8",
54638
54863
  stdio: ["pipe", "pipe", "ignore"],
54639
54864
  cwd: cwd2,
54640
- timeout: CLI_TIMEOUT
54865
+ timeout: CLI_TIMEOUT,
54866
+ windowsHide: true
54641
54867
  }).trim();
54642
54868
  if (output.length === 0) {
54643
54869
  return null;
@@ -54669,7 +54895,7 @@ function fetchFromProvider(provider, cwd2, repoRef, deps) {
54669
54895
  return null;
54670
54896
  }
54671
54897
  function fetchGitReviewData(cwd2, deps = DEFAULT_GIT_REVIEW_CACHE_DEPS) {
54672
- const cachePath = getCachePath(cwd2, getCacheRef(cwd2, deps), deps);
54898
+ const cachePath = getCachePath2(cwd2, getCacheRef(cwd2, deps), deps);
54673
54899
  const cached2 = readCache(cachePath, deps);
54674
54900
  if (cached2 !== "miss") {
54675
54901
  return cached2;
@@ -54715,11 +54941,11 @@ var init_git_review_cache = __esm(() => {
54715
54941
  DEFAULT_GIT_REVIEW_CACHE_DEPS = {
54716
54942
  execFileSync: execFileSync2,
54717
54943
  existsSync: existsSync2,
54718
- mkdirSync,
54719
- readFileSync: readFileSync2,
54720
- statSync,
54721
- writeFileSync,
54722
- getHomedir: os3.homedir,
54944
+ mkdirSync: mkdirSync2,
54945
+ readFileSync: readFileSync3,
54946
+ statSync: statSync2,
54947
+ writeFileSync: writeFileSync2,
54948
+ getHomedir: os4.homedir,
54723
54949
  now: Date.now
54724
54950
  };
54725
54951
  });
@@ -55908,6 +56134,278 @@ function getContextWindowSize(data) {
55908
56134
  return getContextWindowMetrics(data).windowSize;
55909
56135
  }
55910
56136
 
56137
+ // src/utils/gradient.ts
56138
+ function isGradientSpec(value) {
56139
+ return value?.startsWith(GRADIENT_PREFIX) ?? false;
56140
+ }
56141
+ function parseGradientSpec(value) {
56142
+ if (!value?.startsWith(GRADIENT_PREFIX)) {
56143
+ return null;
56144
+ }
56145
+ const body = value.slice(GRADIENT_PREFIX.length).trim();
56146
+ if (!body) {
56147
+ return null;
56148
+ }
56149
+ const preset = GRADIENT_PRESETS[body.toLowerCase()];
56150
+ const rawStops = preset ?? body.split(body.includes(",") ? "," : "-");
56151
+ const stops = rawStops.map((stop) => stop.trim()).filter((stop) => stop.length > 0).map(resolveStopToRgb).filter((rgb) => rgb !== null);
56152
+ return stops.length >= 2 ? stops : null;
56153
+ }
56154
+ function hexToRgb(hex3) {
56155
+ if (!HEX_PATTERN.test(hex3)) {
56156
+ return null;
56157
+ }
56158
+ return {
56159
+ r: parseInt(hex3.slice(0, 2), 16),
56160
+ g: parseInt(hex3.slice(2, 4), 16),
56161
+ b: parseInt(hex3.slice(4, 6), 16)
56162
+ };
56163
+ }
56164
+ function resolveStopToRgb(stop) {
56165
+ if (stop.startsWith("hex:")) {
56166
+ return hexToRgb(stop.slice(4));
56167
+ }
56168
+ if (stop.startsWith("#")) {
56169
+ return hexToRgb(stop.slice(1));
56170
+ }
56171
+ return hexToRgb(stop);
56172
+ }
56173
+ function srgbToLinear(channel) {
56174
+ const normalized = channel / 255;
56175
+ return normalized <= 0.04045 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
56176
+ }
56177
+ function linearToSrgb(channel) {
56178
+ const value = channel <= 0.0031308 ? 12.92 * channel : 1.055 * channel ** (1 / 2.4) - 0.055;
56179
+ return Math.round(Math.min(1, Math.max(0, value)) * 255);
56180
+ }
56181
+ function rgbToOklab(rgb) {
56182
+ const lr = srgbToLinear(rgb.r);
56183
+ const lg = srgbToLinear(rgb.g);
56184
+ const lb = srgbToLinear(rgb.b);
56185
+ const l = 0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb;
56186
+ const m = 0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb;
56187
+ const s = 0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb;
56188
+ const lCbrt = Math.cbrt(l);
56189
+ const mCbrt = Math.cbrt(m);
56190
+ const sCbrt = Math.cbrt(s);
56191
+ return {
56192
+ L: 0.2104542553 * lCbrt + 0.793617785 * mCbrt - 0.0040720468 * sCbrt,
56193
+ a: 1.9779984951 * lCbrt - 2.428592205 * mCbrt + 0.4505937099 * sCbrt,
56194
+ b: 0.0259040371 * lCbrt + 0.7827717662 * mCbrt - 0.808675766 * sCbrt
56195
+ };
56196
+ }
56197
+ function oklabToRgb(lab) {
56198
+ const lCbrt = lab.L + 0.3963377774 * lab.a + 0.2158037573 * lab.b;
56199
+ const mCbrt = lab.L - 0.1055613458 * lab.a - 0.0638541728 * lab.b;
56200
+ const sCbrt = lab.L - 0.0894841775 * lab.a - 1.291485548 * lab.b;
56201
+ const l = lCbrt ** 3;
56202
+ const m = mCbrt ** 3;
56203
+ const s = sCbrt ** 3;
56204
+ return {
56205
+ r: linearToSrgb(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
56206
+ g: linearToSrgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
56207
+ b: linearToSrgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s)
56208
+ };
56209
+ }
56210
+ function sampleGradient(stops, t) {
56211
+ const first = stops[0];
56212
+ if (first === undefined) {
56213
+ return { r: 0, g: 0, b: 0 };
56214
+ }
56215
+ if (stops.length === 1) {
56216
+ return first;
56217
+ }
56218
+ const clamped = Math.min(1, Math.max(0, t));
56219
+ const scaled = clamped * (stops.length - 1);
56220
+ const lowerIndex = Math.min(stops.length - 2, Math.floor(scaled));
56221
+ const lower = stops[lowerIndex];
56222
+ const upper = stops[lowerIndex + 1];
56223
+ if (lower === undefined || upper === undefined) {
56224
+ return first;
56225
+ }
56226
+ const fraction = scaled - lowerIndex;
56227
+ const labLower = rgbToOklab(lower);
56228
+ const labUpper = rgbToOklab(upper);
56229
+ return oklabToRgb({
56230
+ L: labLower.L + (labUpper.L - labLower.L) * fraction,
56231
+ a: labLower.a + (labUpper.a - labLower.a) * fraction,
56232
+ b: labLower.b + (labUpper.b - labLower.b) * fraction
56233
+ });
56234
+ }
56235
+ function rgbToAnsi256(rgb) {
56236
+ if (rgb.r === rgb.g && rgb.g === rgb.b) {
56237
+ if (rgb.r < 8) {
56238
+ return 16;
56239
+ }
56240
+ if (rgb.r > 248) {
56241
+ return 231;
56242
+ }
56243
+ return Math.round((rgb.r - 8) / 247 * 24) + 232;
56244
+ }
56245
+ return 16 + 36 * Math.round(rgb.r / 255 * 5) + 6 * Math.round(rgb.g / 255 * 5) + Math.round(rgb.b / 255 * 5);
56246
+ }
56247
+ function gradientCodeAt(stops, t, colorLevel) {
56248
+ const rgb = sampleGradient(stops, t);
56249
+ if (colorLevel === "truecolor") {
56250
+ return `\x1B[38;2;${rgb.r};${rgb.g};${rgb.b}m`;
56251
+ }
56252
+ return `\x1B[38;5;${rgbToAnsi256(rgb)}m`;
56253
+ }
56254
+ function isCsiFinalByte(codePoint) {
56255
+ return codePoint >= 64 && codePoint <= 126;
56256
+ }
56257
+ function consumeCsi(input, start, bodyStart) {
56258
+ let index = bodyStart;
56259
+ while (index < input.length) {
56260
+ const codePoint = input.charCodeAt(index);
56261
+ if (isCsiFinalByte(codePoint)) {
56262
+ const end = index + 1;
56263
+ return {
56264
+ nextIndex: end,
56265
+ sequence: input.slice(start, end)
56266
+ };
56267
+ }
56268
+ index++;
56269
+ }
56270
+ return {
56271
+ nextIndex: input.length,
56272
+ sequence: input.slice(start)
56273
+ };
56274
+ }
56275
+ function consumeOsc(input, start, bodyStart) {
56276
+ let index = bodyStart;
56277
+ while (index < input.length) {
56278
+ const current = input[index];
56279
+ if (!current) {
56280
+ break;
56281
+ }
56282
+ if (current === BEL2 || current === ST) {
56283
+ const end = index + 1;
56284
+ return {
56285
+ nextIndex: end,
56286
+ sequence: input.slice(start, end)
56287
+ };
56288
+ }
56289
+ if (current === ESC2 && input[index + 1] === "\\") {
56290
+ const end = index + 2;
56291
+ return {
56292
+ nextIndex: end,
56293
+ sequence: input.slice(start, end)
56294
+ };
56295
+ }
56296
+ index++;
56297
+ }
56298
+ return {
56299
+ nextIndex: input.length,
56300
+ sequence: input.slice(start)
56301
+ };
56302
+ }
56303
+ function consumeEscapeSequence(input, index) {
56304
+ const current = input[index];
56305
+ if (!current) {
56306
+ return null;
56307
+ }
56308
+ if (current === ESC2) {
56309
+ const next = input[index + 1];
56310
+ if (next === "[") {
56311
+ return consumeCsi(input, index, index + 2);
56312
+ }
56313
+ if (next === "]") {
56314
+ return consumeOsc(input, index, index + 2);
56315
+ }
56316
+ if (next) {
56317
+ return {
56318
+ nextIndex: index + 2,
56319
+ sequence: input.slice(index, index + 2)
56320
+ };
56321
+ }
56322
+ return {
56323
+ nextIndex: input.length,
56324
+ sequence: current
56325
+ };
56326
+ }
56327
+ if (current === C1_CSI) {
56328
+ return consumeCsi(input, index, index + 1);
56329
+ }
56330
+ if (current === C1_OSC) {
56331
+ return consumeOsc(input, index, index + 1);
56332
+ }
56333
+ return null;
56334
+ }
56335
+ function applyGradientToText(text, stops, colorLevel) {
56336
+ if (colorLevel === "ansi16" || text.length === 0) {
56337
+ return text;
56338
+ }
56339
+ let visibleCount = 0;
56340
+ let scanIndex = 0;
56341
+ while (scanIndex < text.length) {
56342
+ const escape3 = consumeEscapeSequence(text, scanIndex);
56343
+ if (escape3) {
56344
+ scanIndex = escape3.nextIndex;
56345
+ continue;
56346
+ }
56347
+ const codePoint = text.codePointAt(scanIndex);
56348
+ if (codePoint === undefined) {
56349
+ break;
56350
+ }
56351
+ const ch = String.fromCodePoint(codePoint);
56352
+ if (!WHITESPACE.test(ch)) {
56353
+ visibleCount++;
56354
+ }
56355
+ scanIndex += ch.length;
56356
+ }
56357
+ if (visibleCount === 0) {
56358
+ return text;
56359
+ }
56360
+ const denominator = Math.max(1, visibleCount - 1);
56361
+ let result2 = "";
56362
+ let index = 0;
56363
+ let textIndex = 0;
56364
+ while (textIndex < text.length) {
56365
+ const escape3 = consumeEscapeSequence(text, textIndex);
56366
+ if (escape3) {
56367
+ result2 += escape3.sequence;
56368
+ textIndex = escape3.nextIndex;
56369
+ continue;
56370
+ }
56371
+ const codePoint = text.codePointAt(textIndex);
56372
+ if (codePoint === undefined) {
56373
+ break;
56374
+ }
56375
+ const ch = String.fromCodePoint(codePoint);
56376
+ if (WHITESPACE.test(ch)) {
56377
+ result2 += ch;
56378
+ textIndex += ch.length;
56379
+ continue;
56380
+ }
56381
+ result2 += gradientCodeAt(stops, index / denominator, colorLevel) + ch;
56382
+ index++;
56383
+ textIndex += ch.length;
56384
+ }
56385
+ return result2;
56386
+ }
56387
+ var GRADIENT_PREFIX = "gradient:", HEX_PATTERN, ESC2 = "\x1B", BEL2 = "\x07", C1_CSI = "›", C1_OSC = "", ST = "œ", GRADIENT_PRESETS, GRADIENT_PRESET_NAMES, WHITESPACE;
56388
+ var init_gradient = __esm(() => {
56389
+ HEX_PATTERN = /^[0-9A-Fa-f]{6}$/;
56390
+ GRADIENT_PRESETS = {
56391
+ atlas: ["#feac5e", "#c779d0", "#4bc0c8"],
56392
+ cristal: ["#bdfff3", "#4ac29a"],
56393
+ teen: ["#77a1d3", "#79cbca", "#e684ae"],
56394
+ mind: ["#473b7b", "#3584a7", "#30d2be"],
56395
+ morning: ["#ff5f6d", "#ffc371"],
56396
+ vice: ["#5ee7df", "#b490ca"],
56397
+ passion: ["#f43b47", "#453a94"],
56398
+ fruit: ["#ff4e50", "#f9d423"],
56399
+ instagram: ["#833ab4", "#fd1d1d", "#fcb045"],
56400
+ retro: ["#3f51b1", "#5a55ae", "#7b5fac", "#8f6aae", "#a86aa4", "#cc6b8e", "#f18271", "#f3a469", "#f7c978"],
56401
+ summer: ["#fdbb2d", "#22c1c3"],
56402
+ rainbow: ["#ff0000", "#ffff00", "#00ff00", "#00ffff", "#0000ff", "#ff00ff", "#ff0000"],
56403
+ pastel: ["#aee9d8", "#cdeeb0", "#f6f0a8", "#f7c8a8", "#f3aecb", "#c3b6f0", "#aee9d8"]
56404
+ };
56405
+ GRADIENT_PRESET_NAMES = Object.keys(GRADIENT_PRESETS);
56406
+ WHITESPACE = /\s/;
56407
+ });
56408
+
55911
56409
  // src/utils/ansi.ts
55912
56410
  function createUnicodePropertyRegex(pattern) {
55913
56411
  try {
@@ -56026,14 +56524,14 @@ function getTextDisplayWidth(text) {
56026
56524
  }
56027
56525
  return width;
56028
56526
  }
56029
- function isCsiFinalByte(codePoint) {
56527
+ function isCsiFinalByte2(codePoint) {
56030
56528
  return codePoint >= 64 && codePoint <= 126;
56031
56529
  }
56032
56530
  function parseCsi(input, start, bodyStart) {
56033
56531
  let index = bodyStart;
56034
56532
  while (index < input.length) {
56035
56533
  const codePoint = input.charCodeAt(index);
56036
- if (isCsiFinalByte(codePoint)) {
56534
+ if (isCsiFinalByte2(codePoint)) {
56037
56535
  const end = index + 1;
56038
56536
  return {
56039
56537
  nextIndex: end,
@@ -56065,7 +56563,7 @@ function parseOsc(input, start, bodyStart) {
56065
56563
  if (!current) {
56066
56564
  break;
56067
56565
  }
56068
- if (current === BEL2) {
56566
+ if (current === BEL3) {
56069
56567
  const end = index + 1;
56070
56568
  const body = input.slice(bodyStart, index);
56071
56569
  return {
@@ -56075,7 +56573,7 @@ function parseOsc(input, start, bodyStart) {
56075
56573
  osc8Terminator: "bel"
56076
56574
  };
56077
56575
  }
56078
- if (current === ST) {
56576
+ if (current === ST2) {
56079
56577
  const end = index + 1;
56080
56578
  const body = input.slice(bodyStart, index);
56081
56579
  return {
@@ -56085,7 +56583,7 @@ function parseOsc(input, start, bodyStart) {
56085
56583
  osc8Terminator: "st"
56086
56584
  };
56087
56585
  }
56088
- if (current === ESC2 && input[index + 1] === "\\") {
56586
+ if (current === ESC3 && input[index + 1] === "\\") {
56089
56587
  const end = index + 2;
56090
56588
  const body = input.slice(bodyStart, index);
56091
56589
  return {
@@ -56107,7 +56605,7 @@ function parseEscapeSequence(input, index) {
56107
56605
  if (!current) {
56108
56606
  return null;
56109
56607
  }
56110
- if (current === ESC2) {
56608
+ if (current === ESC3) {
56111
56609
  const next = input[index + 1];
56112
56610
  if (next === "[") {
56113
56611
  return parseCsi(input, index, index + 2);
@@ -56126,19 +56624,19 @@ function parseEscapeSequence(input, index) {
56126
56624
  sequence: current
56127
56625
  };
56128
56626
  }
56129
- if (current === C1_CSI) {
56627
+ if (current === C1_CSI2) {
56130
56628
  return parseCsi(input, index, index + 1);
56131
56629
  }
56132
- if (current === C1_OSC) {
56630
+ if (current === C1_OSC2) {
56133
56631
  return parseOsc(input, index, index + 1);
56134
56632
  }
56135
56633
  return null;
56136
56634
  }
56137
56635
  function getOsc8CloseSequence(terminator) {
56138
56636
  if (terminator === "bel") {
56139
- return `${ESC2}]8;;${BEL2}`;
56637
+ return `${ESC3}]8;;${BEL3}`;
56140
56638
  }
56141
- return `${ESC2}]8;;${ESC2}\\`;
56639
+ return `${ESC3}]8;;${ESC3}\\`;
56142
56640
  }
56143
56641
  function stripSgrCodes(text) {
56144
56642
  return text.replace(SGR_REGEX, "");
@@ -56149,7 +56647,7 @@ function stripOscCodes(text) {
56149
56647
  while (index < text.length) {
56150
56648
  const escape3 = parseEscapeSequence(text, index);
56151
56649
  if (escape3) {
56152
- const isOsc = escape3.sequence.startsWith(`${ESC2}]`) || escape3.sequence.startsWith(C1_OSC);
56650
+ const isOsc = escape3.sequence.startsWith(`${ESC3}]`) || escape3.sequence.startsWith(C1_OSC2);
56153
56651
  if (!isOsc) {
56154
56652
  result2 += escape3.sequence;
56155
56653
  }
@@ -56249,9 +56747,56 @@ function truncateStyledText(text, maxWidth, options = {}) {
56249
56747
  }
56250
56748
  return output + ellipsis;
56251
56749
  }
56252
- var ESC2 = "\x1B", BEL2 = "\x07", C1_CSI = "›", C1_OSC = "", ST = "œ", ZERO_WIDTH_JOINER = 8205, COMBINING_ENCLOSING_KEYCAP = 8419, VARIATION_SELECTOR_START = 65024, VARIATION_SELECTOR_END = 65039, VARIATION_SELECTOR_SUPPLEMENT_START = 917760, VARIATION_SELECTOR_SUPPLEMENT_END = 917999, REGIONAL_INDICATOR_START = 127462, REGIONAL_INDICATOR_END = 127487, SGR_REGEX, EXTENDED_PICTOGRAPHIC_REGEX, EMOJI_PRESENTATION_REGEX, EMOJI_MODIFIER_REGEX, COMBINING_MARK_REGEX;
56750
+ function applyLineGradientSegment(text, stops, colorLevel, startColumn, totalWidth) {
56751
+ const visibleWidth = getVisibleWidth(text);
56752
+ if (stops.length === 0 || colorLevel === "ansi16") {
56753
+ return {
56754
+ text,
56755
+ nextColumn: startColumn + visibleWidth
56756
+ };
56757
+ }
56758
+ if (totalWidth <= 1) {
56759
+ return {
56760
+ text,
56761
+ nextColumn: startColumn + visibleWidth
56762
+ };
56763
+ }
56764
+ const denominator = totalWidth - 1;
56765
+ let output = "";
56766
+ let column = startColumn;
56767
+ let index = 0;
56768
+ while (index < text.length) {
56769
+ const escape3 = parseEscapeSequence(text, index);
56770
+ if (escape3) {
56771
+ output += escape3.sequence;
56772
+ index = escape3.nextIndex;
56773
+ continue;
56774
+ }
56775
+ const cluster = consumeDisplayCluster(text, index);
56776
+ if (!cluster) {
56777
+ break;
56778
+ }
56779
+ output += gradientCodeAt(stops, column / denominator, colorLevel) + cluster.text;
56780
+ column += getClusterWidth(cluster.text);
56781
+ index = cluster.nextIndex;
56782
+ }
56783
+ return {
56784
+ text: output,
56785
+ nextColumn: column
56786
+ };
56787
+ }
56788
+ function applyLineGradient(text, stops, colorLevel) {
56789
+ const totalWidth = getVisibleWidth(text);
56790
+ const result2 = applyLineGradientSegment(text, stops, colorLevel, 0, totalWidth);
56791
+ if (result2.text === text) {
56792
+ return text;
56793
+ }
56794
+ return `${result2.text}\x1B[39m`;
56795
+ }
56796
+ var ESC3 = "\x1B", BEL3 = "\x07", C1_CSI2 = "›", C1_OSC2 = "", ST2 = "œ", ZERO_WIDTH_JOINER = 8205, COMBINING_ENCLOSING_KEYCAP = 8419, VARIATION_SELECTOR_START = 65024, VARIATION_SELECTOR_END = 65039, VARIATION_SELECTOR_SUPPLEMENT_START = 917760, VARIATION_SELECTOR_SUPPLEMENT_END = 917999, REGIONAL_INDICATOR_START = 127462, REGIONAL_INDICATOR_END = 127487, SGR_REGEX, EXTENDED_PICTOGRAPHIC_REGEX, EMOJI_PRESENTATION_REGEX, EMOJI_MODIFIER_REGEX, COMBINING_MARK_REGEX;
56253
56797
  var init_ansi = __esm(() => {
56254
56798
  init_string_width();
56799
+ init_gradient();
56255
56800
  SGR_REGEX = /\x1b\[[0-9;]*m/g;
56256
56801
  EXTENDED_PICTOGRAPHIC_REGEX = createUnicodePropertyRegex("\\p{Extended_Pictographic}");
56257
56802
  EMOJI_PRESENTATION_REGEX = createUnicodePropertyRegex("\\p{Emoji_Presentation}");
@@ -56363,6 +56908,10 @@ function applyColors(text, foregroundColor, backgroundColor, bold, colorLevel =
56363
56908
  }
56364
56909
  }
56365
56910
  if (foregroundColor) {
56911
+ const gradientStops = parseGradientSpec(foregroundColor);
56912
+ if (gradientStops && colorLevel !== "ansi16") {
56913
+ return prefix + applyGradientToText(text, gradientStops, colorLevel) + "\x1B[39m" + suffix;
56914
+ }
56366
56915
  const fgCode = getColorAnsiCode(foregroundColor, colorLevel, false);
56367
56916
  if (fgCode) {
56368
56917
  prefix += fgCode;
@@ -56374,6 +56923,20 @@ function applyColors(text, foregroundColor, backgroundColor, bold, colorLevel =
56374
56923
  function getColorAnsiCode(colorName, colorLevel = "ansi16", isBackground = false) {
56375
56924
  if (!colorName)
56376
56925
  return "";
56926
+ if (isGradientSpec(colorName)) {
56927
+ const stops = parseGradientSpec(colorName);
56928
+ const first = stops?.[0];
56929
+ if (!first)
56930
+ return "";
56931
+ if (colorLevel === "ansi16") {
56932
+ return "";
56933
+ }
56934
+ if (colorLevel === "ansi256") {
56935
+ const code = rgbToAnsi256(first);
56936
+ return isBackground ? `\x1B[48;5;${code}m` : `\x1B[38;5;${code}m`;
56937
+ }
56938
+ return isBackground ? `\x1B[48;2;${first.r};${first.g};${first.b}m` : `\x1B[38;2;${first.r};${first.g};${first.b}m`;
56939
+ }
56377
56940
  if (colorName.startsWith("ansi256:")) {
56378
56941
  const code = parseInt(colorName.substring(8), 10);
56379
56942
  if (!isNaN(code) && code >= 0 && code <= 255) {
@@ -56443,6 +57006,7 @@ function getDefaultPowerlineTheme() {
56443
57006
  var COLOR_MAP, POWERLINE_THEMES;
56444
57007
  var init_colors = __esm(() => {
56445
57008
  init_source();
57009
+ init_gradient();
56446
57010
  COLOR_MAP = createColorMap();
56447
57011
  POWERLINE_THEMES = {
56448
57012
  custom: {
@@ -56714,20 +57278,20 @@ var init_context_percentage = () => {};
56714
57278
 
56715
57279
  // src/utils/terminal.ts
56716
57280
  import { execSync } from "child_process";
56717
- import * as fs2 from "fs";
56718
- import * as path2 from "path";
57281
+ import * as fs3 from "fs";
57282
+ import * as path3 from "path";
56719
57283
  function getPackageVersion() {
56720
57284
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
56721
57285
  return PACKAGE_VERSION;
56722
57286
  }
56723
57287
  const possiblePaths = [
56724
- path2.join(__dirname, "..", "..", "package.json"),
56725
- path2.join(__dirname, "..", "package.json")
57288
+ path3.join(__dirname, "..", "..", "package.json"),
57289
+ path3.join(__dirname, "..", "package.json")
56726
57290
  ];
56727
57291
  for (const packageJsonPath of possiblePaths) {
56728
57292
  try {
56729
- if (fs2.existsSync(packageJsonPath)) {
56730
- const packageJson = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
57293
+ if (fs3.existsSync(packageJsonPath)) {
57294
+ const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf-8"));
56731
57295
  return packageJson.version ?? "";
56732
57296
  }
56733
57297
  } catch {}
@@ -56735,6 +57299,13 @@ function getPackageVersion() {
56735
57299
  return "";
56736
57300
  }
56737
57301
  function probeTerminalWidth() {
57302
+ const overrideRaw = process.env.CCSTATUSLINE_WIDTH;
57303
+ if (overrideRaw) {
57304
+ const override = parsePositiveInteger(overrideRaw);
57305
+ if (override !== null) {
57306
+ return override;
57307
+ }
57308
+ }
56738
57309
  if (process.platform === "win32") {
56739
57310
  return null;
56740
57311
  }
@@ -56757,7 +57328,8 @@ function probeTerminalWidth() {
56757
57328
  try {
56758
57329
  const width = execSync("tput cols 2>/dev/null", {
56759
57330
  encoding: "utf8",
56760
- stdio: ["pipe", "pipe", "ignore"]
57331
+ stdio: ["pipe", "pipe", "ignore"],
57332
+ windowsHide: true
56761
57333
  }).trim();
56762
57334
  return parsePositiveInteger(width);
56763
57335
  } catch {}
@@ -56775,7 +57347,8 @@ function getParentProcessId(pid) {
56775
57347
  const parentPidOutput = execSync(`ps -o ppid= -p ${pid}`, {
56776
57348
  encoding: "utf8",
56777
57349
  stdio: ["pipe", "pipe", "ignore"],
56778
- shell: "/bin/sh"
57350
+ shell: "/bin/sh",
57351
+ windowsHide: true
56779
57352
  }).trim();
56780
57353
  return parsePositiveInteger(parentPidOutput);
56781
57354
  } catch {
@@ -56787,7 +57360,8 @@ function getTTYForProcess(pid) {
56787
57360
  const tty2 = execSync(`ps -o tty= -p ${pid}`, {
56788
57361
  encoding: "utf8",
56789
57362
  stdio: ["pipe", "pipe", "ignore"],
56790
- shell: "/bin/sh"
57363
+ shell: "/bin/sh",
57364
+ windowsHide: true
56791
57365
  }).replace(/\s+/g, "");
56792
57366
  if (!tty2 || tty2 === "??" || tty2 === "?") {
56793
57367
  return null;
@@ -56809,7 +57383,8 @@ function getWidthForTTY(tty2) {
56809
57383
  const width = execSync(`${cmd} 2>/dev/null | awk '{print $2}'`, {
56810
57384
  encoding: "utf8",
56811
57385
  stdio: ["pipe", "pipe", "ignore"],
56812
- shell: "/bin/sh"
57386
+ shell: "/bin/sh",
57387
+ windowsHide: true
56813
57388
  }).trim();
56814
57389
  const parsed = parsePositiveInteger(width);
56815
57390
  if (parsed !== null) {
@@ -56825,7 +57400,7 @@ function getTerminalWidth() {
56825
57400
  function canDetectTerminalWidth() {
56826
57401
  return probeTerminalWidth() !== null;
56827
57402
  }
56828
- var __dirname = "/Users/bytedance/Documents/code/ai/ccstatusline-zh/src/utils", PACKAGE_VERSION = "2.2.18";
57403
+ var __dirname = "/home/runner/work/ccstatusline-zh/ccstatusline-zh/src/utils", PACKAGE_VERSION = "2.2.20";
56829
57404
  var init_terminal = () => {};
56830
57405
 
56831
57406
  // src/utils/renderer.ts
@@ -56836,6 +57411,10 @@ function formatTokens(count) {
56836
57411
  return `${(count / 1000).toFixed(1)}k`;
56837
57412
  return count.toString();
56838
57413
  }
57414
+ function maybeApplyForegroundGradient(line, settings, colorLevel) {
57415
+ const stops = parseGradientSpec(settings.overrideForegroundColor);
57416
+ return stops ? applyLineGradient(line, stops, colorLevel) : line;
57417
+ }
56839
57418
  function resolveEffectiveTerminalWidth(detectedWidth, settings, context) {
56840
57419
  if (!detectedWidth) {
56841
57420
  return null;
@@ -56888,6 +57467,7 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
56888
57467
  }
56889
57468
  }
56890
57469
  const colorLevel = getColorLevelString(settings.colorLevel);
57470
+ const overrideForegroundGradientStops = parseGradientSpec(settings.overrideForegroundColor);
56891
57471
  const filteredWidgets = widgets.filter((widget) => widget.type !== "separator" && widget.type !== "flex-separator");
56892
57472
  if (filteredWidgets.length === 0)
56893
57473
  return "";
@@ -56944,7 +57524,7 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
56944
57524
  widgetColorIndex++;
56945
57525
  }
56946
57526
  }
56947
- if (settings.overrideForegroundColor && settings.overrideForegroundColor !== "none") {
57527
+ if (settings.overrideForegroundColor && settings.overrideForegroundColor !== "none" && !isGradientSpec(settings.overrideForegroundColor)) {
56948
57528
  fgColor = settings.overrideForegroundColor;
56949
57529
  }
56950
57530
  widgetElements.push({
@@ -56991,6 +57571,11 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
56991
57571
  }
56992
57572
  }
56993
57573
  }
57574
+ const powerlineGradientWidth = overrideForegroundGradientStops && colorLevel !== "ansi16" ? widgetElements.reduce((sum2, element) => {
57575
+ const isPreserveColors = element.widget.type === "custom-command" && element.widget.preserveColors;
57576
+ return isPreserveColors ? sum2 : sum2 + getVisibleWidth(element.content);
57577
+ }, 0) : 0;
57578
+ let powerlineGradientColumn = 0;
56994
57579
  let result2 = "";
56995
57580
  if (startCap && widgetElements.length > 0) {
56996
57581
  const firstWidget = widgetElements[0];
@@ -57014,13 +57599,20 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
57014
57599
  if (shouldBold && !isPreserveColors) {
57015
57600
  widgetContent += "\x1B[1m";
57016
57601
  }
57017
- if (widget.fgColor && !isPreserveColors) {
57602
+ const textGradientStops = !isPreserveColors && powerlineGradientWidth > 1 ? overrideForegroundGradientStops : null;
57603
+ if (widget.fgColor && !isPreserveColors && !textGradientStops) {
57018
57604
  widgetContent += getColorAnsiCode(widget.fgColor, colorLevel, false);
57019
57605
  }
57020
57606
  if (widget.bgColor) {
57021
57607
  widgetContent += getColorAnsiCode(widget.bgColor, colorLevel, true);
57022
57608
  }
57023
- widgetContent += widget.content;
57609
+ if (textGradientStops) {
57610
+ const gradientResult = applyLineGradientSegment(widget.content, textGradientStops, colorLevel, powerlineGradientColumn, powerlineGradientWidth);
57611
+ widgetContent += gradientResult.text;
57612
+ powerlineGradientColumn = gradientResult.nextColumn;
57613
+ } else {
57614
+ widgetContent += widget.content;
57615
+ }
57024
57616
  if (isPreserveColors) {
57025
57617
  widgetContent += "\x1B[0m";
57026
57618
  } else {
@@ -57197,7 +57789,7 @@ function calculateMaxWidthsFromPreRendered(preRenderedLines, settings) {
57197
57789
  }
57198
57790
  function renderStatusLineWithInfo(widgets, settings, context, preRenderedWidgets, preCalculatedMaxWidths) {
57199
57791
  const line = renderStatusLine(widgets, settings, context, preRenderedWidgets, preCalculatedMaxWidths);
57200
- const wasTruncated = line.includes("...");
57792
+ const wasTruncated = getVisibleText(line).includes("...");
57201
57793
  return { line, wasTruncated };
57202
57794
  }
57203
57795
  function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCalculatedMaxWidths) {
@@ -57208,8 +57800,13 @@ function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCal
57208
57800
  return renderPowerlineStatusLine(widgets, settings, context, context.lineIndex ?? 0, context.globalSeparatorIndex ?? 0, context.globalPowerlineThemeIndex ?? 0, preRenderedWidgets, preCalculatedMaxWidths);
57209
57801
  const applyColorsWithOverride = (text, foregroundColor, backgroundColor, bold) => {
57210
57802
  let fgColor = foregroundColor;
57211
- if (settings.overrideForegroundColor && settings.overrideForegroundColor !== "none") {
57212
- fgColor = settings.overrideForegroundColor;
57803
+ const fgOverride = settings.overrideForegroundColor;
57804
+ if (fgOverride && fgOverride !== "none") {
57805
+ if (!isGradientSpec(fgOverride)) {
57806
+ fgColor = fgOverride;
57807
+ } else if (colorLevel !== "ansi16") {
57808
+ fgColor = undefined;
57809
+ }
57213
57810
  }
57214
57811
  let bgColor = backgroundColor;
57215
57812
  if (settings.overrideBackgroundColor && settings.overrideBackgroundColor !== "none") {
@@ -57398,6 +57995,7 @@ function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCal
57398
57995
  statusLine = truncateStyledText(statusLine, maxWidth, { ellipsis: true });
57399
57996
  }
57400
57997
  }
57998
+ statusLine = maybeApplyForegroundGradient(statusLine, settings, colorLevel);
57401
57999
  return statusLine;
57402
58000
  }
57403
58001
  var init_renderer2 = __esm(async () => {
@@ -57406,6 +58004,7 @@ var init_renderer2 = __esm(async () => {
57406
58004
  init_ansi();
57407
58005
  init_colors();
57408
58006
  init_context_percentage();
58007
+ init_gradient();
57409
58008
  init_terminal();
57410
58009
  await init_widgets2();
57411
58010
  });
@@ -57436,13 +58035,13 @@ class TokensInputWidget {
57436
58035
  if (context.isPreview) {
57437
58036
  return formatRawOrLabeledValue(item, "输入: ", "15.2k");
57438
58037
  }
58038
+ if (context.tokenMetrics) {
58039
+ return formatRawOrLabeledValue(item, "输入: ", formatTokens(context.tokenMetrics.inputTokens));
58040
+ }
57439
58041
  const inputTotalTokens = getContextWindowInputTotalTokens(context.data);
57440
58042
  if (inputTotalTokens !== null) {
57441
58043
  return formatRawOrLabeledValue(item, "输入: ", formatTokens(inputTotalTokens));
57442
58044
  }
57443
- if (context.tokenMetrics) {
57444
- return formatRawOrLabeledValue(item, "输入: ", formatTokens(context.tokenMetrics.inputTokens));
57445
- }
57446
58045
  return null;
57447
58046
  }
57448
58047
  supportsRawValue() {
@@ -57477,13 +58076,13 @@ class TokensOutputWidget {
57477
58076
  if (context.isPreview) {
57478
58077
  return formatRawOrLabeledValue(item, "输出: ", "3.4k");
57479
58078
  }
58079
+ if (context.tokenMetrics) {
58080
+ return formatRawOrLabeledValue(item, "输出: ", formatTokens(context.tokenMetrics.outputTokens));
58081
+ }
57480
58082
  const outputTotalTokens = getContextWindowOutputTotalTokens(context.data);
57481
58083
  if (outputTotalTokens !== null) {
57482
58084
  return formatRawOrLabeledValue(item, "输出: ", formatTokens(outputTotalTokens));
57483
58085
  }
57484
- if (context.tokenMetrics) {
57485
- return formatRawOrLabeledValue(item, "输出: ", formatTokens(context.tokenMetrics.outputTokens));
57486
- }
57487
58086
  return null;
57488
58087
  }
57489
58088
  supportsRawValue() {
@@ -57903,6 +58502,12 @@ function toggleUsageDateMode(item) {
57903
58502
  function toggleUsageHourFormat(item) {
57904
58503
  return toggleMetadataFlag(item, "hour12");
57905
58504
  }
58505
+ function isUsageWeekdayEnabled(item) {
58506
+ return isMetadataFlagEnabled(item, "weekday");
58507
+ }
58508
+ function toggleUsageWeekday(item) {
58509
+ return toggleMetadataFlag(item, "weekday");
58510
+ }
57906
58511
  function getUsageDisplayModifierText(item, options = {}) {
57907
58512
  const mode = getUsageDisplayMode(item);
57908
58513
  const modifiers = [];
@@ -57989,6 +58594,9 @@ function getUsageTimerCustomKeybinds(item, options = {}) {
57989
58594
  if (options.includeHourFormat) {
57990
58595
  keybinds.push(HOUR_FORMAT_TOGGLE_KEYBIND);
57991
58596
  }
58597
+ if (options.includeWeekday) {
58598
+ keybinds.push(WEEKDAY_TOGGLE_KEYBIND);
58599
+ }
57992
58600
  if (options.includeTimezone) {
57993
58601
  keybinds.push(TIMEZONE_KEYBIND);
57994
58602
  }
@@ -57998,7 +58606,7 @@ function getUsageTimerCustomKeybinds(item, options = {}) {
57998
58606
  }
57999
58607
  return keybinds;
58000
58608
  }
58001
- var SLIDER_WIDTH = 10, PROGRESS_TOGGLE_KEYBIND, INVERT_TOGGLE_KEYBIND, COMPACT_TOGGLE_KEYBIND, CURSOR_TOGGLE_KEYBIND, DATE_TOGGLE_KEYBIND, HOUR_FORMAT_TOGGLE_KEYBIND, TIMEZONE_KEYBIND, LOCALE_KEYBIND;
58609
+ var SLIDER_WIDTH = 10, PROGRESS_TOGGLE_KEYBIND, INVERT_TOGGLE_KEYBIND, COMPACT_TOGGLE_KEYBIND, CURSOR_TOGGLE_KEYBIND, DATE_TOGGLE_KEYBIND, HOUR_FORMAT_TOGGLE_KEYBIND, WEEKDAY_TOGGLE_KEYBIND, TIMEZONE_KEYBIND, LOCALE_KEYBIND;
58002
58610
  var init_usage_display = __esm(() => {
58003
58611
  init_locales2();
58004
58612
  PROGRESS_TOGGLE_KEYBIND = { key: "p", label: "(p)进度条切换", action: "toggle-progress" };
@@ -58007,6 +58615,7 @@ var init_usage_display = __esm(() => {
58007
58615
  CURSOR_TOGGLE_KEYBIND = { key: "t", label: "(t)时间游标", action: "toggle-cursor" };
58008
58616
  DATE_TOGGLE_KEYBIND = { key: "t", label: "(t)时间戳", action: "toggle-date" };
58009
58617
  HOUR_FORMAT_TOGGLE_KEYBIND = { key: "h", label: "12/24 小时(h)", action: "toggle-hour-format" };
58618
+ WEEKDAY_TOGGLE_KEYBIND = { key: "w", label: "(w)星期", action: "toggle-weekday" };
58010
58619
  TIMEZONE_KEYBIND = { key: "z", label: "时区(z)", action: "edit-timezone" };
58011
58620
  LOCALE_KEYBIND = { key: "l", label: "(l)地区", action: "edit-locale" };
58012
58621
  });
@@ -58912,7 +59521,8 @@ class CustomCommandWidget {
58912
59521
  input: jsonInput,
58913
59522
  timeout,
58914
59523
  stdio: ["pipe", "pipe", "ignore"],
58915
- env: process.env
59524
+ env: process.env,
59525
+ windowsHide: true
58916
59526
  }).trim();
58917
59527
  if (!item.preserveColors) {
58918
59528
  output = getVisibleText(output);
@@ -59579,7 +60189,7 @@ var require_has_flag = __commonJS((exports, module) => {
59579
60189
 
59580
60190
  // node_modules/supports-color/index.js
59581
60191
  var require_supports_color = __commonJS((exports, module) => {
59582
- var os4 = __require("os");
60192
+ var os5 = __require("os");
59583
60193
  var tty2 = __require("tty");
59584
60194
  var hasFlag2 = require_has_flag();
59585
60195
  var { env: env3 } = process;
@@ -59636,7 +60246,7 @@ var require_supports_color = __commonJS((exports, module) => {
59636
60246
  return min2;
59637
60247
  }
59638
60248
  if (process.platform === "win32") {
59639
- const osRelease = os4.release().split(".");
60249
+ const osRelease = os5.release().split(".");
59640
60250
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
59641
60251
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
59642
60252
  }
@@ -59984,7 +60594,7 @@ var init_dist4 = __esm(() => {
59984
60594
 
59985
60595
  // node_modules/https-proxy-agent/dist/parse-proxy-response.js
59986
60596
  function parseProxyResponse(socket) {
59987
- return new Promise((resolve, reject2) => {
60597
+ return new Promise((resolve2, reject2) => {
59988
60598
  let buffersLength = 0;
59989
60599
  const buffers = [];
59990
60600
  function read() {
@@ -60053,7 +60663,7 @@ function parseProxyResponse(socket) {
60053
60663
  }
60054
60664
  debug("got proxy server response: %o %o", firstLine, headers);
60055
60665
  cleanup();
60056
- resolve({
60666
+ resolve2({
60057
60667
  connect: {
60058
60668
  statusCode,
60059
60669
  statusText,
@@ -60193,10 +60803,10 @@ var init_usage_types = __esm(() => {
60193
60803
 
60194
60804
  // src/utils/usage-fetch.ts
60195
60805
  import { execFileSync as execFileSync3 } from "child_process";
60196
- import * as fs3 from "fs";
60806
+ import * as fs4 from "fs";
60197
60807
  import * as https from "https";
60198
- import * as os4 from "os";
60199
- import * as path3 from "path";
60808
+ import * as os5 from "os";
60809
+ import * as path4 from "path";
60200
60810
  function getUsageApiBucketUtilization(bucket) {
60201
60811
  return bucket === null ? 0 : bucket?.utilization ?? undefined;
60202
60812
  }
@@ -60255,8 +60865,8 @@ function parseUsageApiResponse(rawJson) {
60255
60865
  };
60256
60866
  }
60257
60867
  function ensureCacheDirExists() {
60258
- if (!fs3.existsSync(CACHE_DIR)) {
60259
- fs3.mkdirSync(CACHE_DIR, { recursive: true });
60868
+ if (!fs4.existsSync(CACHE_DIR)) {
60869
+ fs4.mkdirSync(CACHE_DIR, { recursive: true });
60260
60870
  }
60261
60871
  }
60262
60872
  function setCachedUsageError(error51, now2, maxAge = LOCK_MAX_AGE) {
@@ -60276,7 +60886,7 @@ function hasRequiredUsageField(data, field) {
60276
60886
  if (data[field] !== undefined) {
60277
60887
  return true;
60278
60888
  }
60279
- return data.extraUsageEnabled === false && EXTRA_USAGE_DETAIL_FIELDS.has(field);
60889
+ return data.extraUsageEnabled !== undefined && EXTRA_USAGE_DETAIL_FIELDS.has(field);
60280
60890
  }
60281
60891
  function hasRequiredUsageFields(data, requiredFields = []) {
60282
60892
  return requiredFields.every((field) => hasRequiredUsageField(data, field));
@@ -60358,7 +60968,7 @@ function parseMacKeychainCredentialCandidates(rawDump, servicePrefix = MACOS_USA
60358
60968
  }
60359
60969
  function readMacKeychainSecret(service) {
60360
60970
  try {
60361
- return execFileSync3("security", ["find-generic-password", "-s", service, "-w"], { encoding: "utf8", stdio: ["pipe", "pipe", "ignore"] }).trim();
60971
+ return execFileSync3("security", ["find-generic-password", "-s", service, "-w"], { encoding: "utf8", stdio: ["pipe", "pipe", "ignore"], windowsHide: true }).trim();
60362
60972
  } catch {
60363
60973
  return null;
60364
60974
  }
@@ -60372,7 +60982,8 @@ function listMacKeychainCredentialCandidates() {
60372
60982
  const rawDump = execFileSync3("security", ["dump-keychain"], {
60373
60983
  encoding: "utf8",
60374
60984
  maxBuffer: MACOS_SECURITY_DUMP_MAX_BUFFER,
60375
- stdio: ["pipe", "pipe", "ignore"]
60985
+ stdio: ["pipe", "pipe", "ignore"],
60986
+ windowsHide: true
60376
60987
  });
60377
60988
  return parseMacKeychainCredentialCandidates(rawDump);
60378
60989
  } catch {
@@ -60391,8 +61002,8 @@ function readUsageTokenFromMacKeychainCandidates() {
60391
61002
  }
60392
61003
  function readUsageTokenFromCredentialsFile() {
60393
61004
  try {
60394
- const credFile = path3.join(getClaudeConfigDir(), ".credentials.json");
60395
- return parseUsageAccessToken(fs3.readFileSync(credFile, "utf8"));
61005
+ const credFile = path4.join(getClaudeConfigDir(), ".credentials.json");
61006
+ return parseUsageAccessToken(fs4.readFileSync(credFile, "utf8"));
60396
61007
  } catch {
60397
61008
  return null;
60398
61009
  }
@@ -60405,7 +61016,7 @@ function getUsageToken() {
60405
61016
  }
60406
61017
  function readStaleUsageCache() {
60407
61018
  try {
60408
- return parseCachedUsageData(fs3.readFileSync(CACHE_FILE, "utf8"));
61019
+ return parseCachedUsageData(fs4.readFileSync(CACHE_FILE, "utf8"));
60409
61020
  } catch {
60410
61021
  return null;
60411
61022
  }
@@ -60413,13 +61024,13 @@ function readStaleUsageCache() {
60413
61024
  function writeUsageLock(blockedUntil, error51) {
60414
61025
  try {
60415
61026
  ensureCacheDirExists();
60416
- fs3.writeFileSync(LOCK_FILE, JSON.stringify({ blockedUntil, error: error51 }));
61027
+ fs4.writeFileSync(LOCK_FILE, JSON.stringify({ blockedUntil, error: error51 }));
60417
61028
  } catch {}
60418
61029
  }
60419
61030
  function readActiveUsageLock(now2) {
60420
61031
  let hasValidJsonLock = false;
60421
61032
  try {
60422
- const parsed = parseJsonWithSchema(fs3.readFileSync(LOCK_FILE, "utf8"), UsageLockSchema);
61033
+ const parsed = parseJsonWithSchema(fs4.readFileSync(LOCK_FILE, "utf8"), UsageLockSchema);
60423
61034
  if (parsed) {
60424
61035
  hasValidJsonLock = true;
60425
61036
  if (parsed.blockedUntil > now2) {
@@ -60435,7 +61046,7 @@ function readActiveUsageLock(now2) {
60435
61046
  return null;
60436
61047
  }
60437
61048
  try {
60438
- const lockStat = fs3.statSync(LOCK_FILE);
61049
+ const lockStat = fs4.statSync(LOCK_FILE);
60439
61050
  const lockMtime = Math.floor(lockStat.mtimeMs / 1000);
60440
61051
  const blockedUntil = lockMtime + LOCK_MAX_AGE;
60441
61052
  if (blockedUntil > now2) {
@@ -60490,14 +61101,14 @@ function getUsageApiRequestOptions(token) {
60490
61101
  }
60491
61102
  }
60492
61103
  async function fetchFromUsageApi(token) {
60493
- return new Promise((resolve) => {
61104
+ return new Promise((resolve2) => {
60494
61105
  let settled = false;
60495
61106
  const finish = (value) => {
60496
61107
  if (settled) {
60497
61108
  return;
60498
61109
  }
60499
61110
  settled = true;
60500
- resolve(value);
61111
+ resolve2(value);
60501
61112
  };
60502
61113
  const requestOptions = getUsageApiRequestOptions(token);
60503
61114
  if (!requestOptions) {
@@ -60548,10 +61159,10 @@ async function fetchUsageData(options = {}) {
60548
61159
  }
60549
61160
  }
60550
61161
  try {
60551
- const stat = fs3.statSync(CACHE_FILE);
61162
+ const stat = fs4.statSync(CACHE_FILE);
60552
61163
  const fileAge = now2 - Math.floor(stat.mtimeMs / 1000);
60553
61164
  if (fileAge < CACHE_MAX_AGE) {
60554
- const fileData = parseCachedUsageData(fs3.readFileSync(CACHE_FILE, "utf8"));
61165
+ const fileData = parseCachedUsageData(fs4.readFileSync(CACHE_FILE, "utf8"));
60555
61166
  if (fileData && !fileData.error && hasRequiredUsageFields(fileData, requiredFields)) {
60556
61167
  return cacheUsageData(fileData, now2);
60557
61168
  }
@@ -60586,7 +61197,7 @@ async function fetchUsageData(options = {}) {
60586
61197
  }
60587
61198
  try {
60588
61199
  ensureCacheDirExists();
60589
- fs3.writeFileSync(CACHE_FILE, JSON.stringify(usageData));
61200
+ fs4.writeFileSync(CACHE_FILE, JSON.stringify(usageData));
60590
61201
  } catch {}
60591
61202
  return cacheUsageData(usageData, now2);
60592
61203
  } catch {
@@ -60600,9 +61211,9 @@ var init_usage_fetch = __esm(async () => {
60600
61211
  init_zod();
60601
61212
  init_usage_types();
60602
61213
  await init_claude_settings();
60603
- CACHE_DIR = path3.join(os4.homedir(), ".cache", "ccstatusline");
60604
- CACHE_FILE = path3.join(CACHE_DIR, "usage.json");
60605
- LOCK_FILE = path3.join(CACHE_DIR, "usage.lock");
61214
+ CACHE_DIR = path4.join(os5.homedir(), ".cache", "ccstatusline");
61215
+ CACHE_FILE = path4.join(CACHE_DIR, "usage.json");
61216
+ LOCK_FILE = path4.join(CACHE_DIR, "usage.lock");
60606
61217
  MACOS_SECURITY_DUMP_MAX_BUFFER = 8 * 1024 * 1024;
60607
61218
  EXTRA_USAGE_DETAIL_FIELDS = new Set([
60608
61219
  "extraUsageLimit",
@@ -60651,31 +61262,31 @@ var init_usage_fetch = __esm(async () => {
60651
61262
 
60652
61263
  // node_modules/fdir/dist/index.mjs
60653
61264
  import { createRequire as createRequire2 } from "module";
60654
- import { basename, dirname, normalize, relative, resolve, sep } from "path";
61265
+ import { basename, dirname as dirname2, normalize, relative, resolve as resolve2, sep } from "path";
60655
61266
  import * as nativeFs from "fs";
60656
- function cleanPath(path4) {
60657
- let normalized = normalize(path4);
61267
+ function cleanPath(path5) {
61268
+ let normalized = normalize(path5);
60658
61269
  if (normalized.length > 1 && normalized[normalized.length - 1] === sep)
60659
61270
  normalized = normalized.substring(0, normalized.length - 1);
60660
61271
  return normalized;
60661
61272
  }
60662
- function convertSlashes(path4, separator) {
60663
- return path4.replace(SLASHES_REGEX, separator);
61273
+ function convertSlashes(path5, separator) {
61274
+ return path5.replace(SLASHES_REGEX, separator);
60664
61275
  }
60665
- function isRootDirectory(path4) {
60666
- return path4 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path4);
61276
+ function isRootDirectory(path5) {
61277
+ return path5 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path5);
60667
61278
  }
60668
- function normalizePath(path4, options) {
61279
+ function normalizePath(path5, options) {
60669
61280
  const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
60670
- const pathNeedsCleaning = process.platform === "win32" && path4.includes("/") || path4.startsWith(".");
61281
+ const pathNeedsCleaning = process.platform === "win32" && path5.includes("/") || path5.startsWith(".");
60671
61282
  if (resolvePaths)
60672
- path4 = resolve(path4);
61283
+ path5 = resolve2(path5);
60673
61284
  if (normalizePath$1 || pathNeedsCleaning)
60674
- path4 = cleanPath(path4);
60675
- if (path4 === ".")
61285
+ path5 = cleanPath(path5);
61286
+ if (path5 === ".")
60676
61287
  return "";
60677
- const needsSeperator = path4[path4.length - 1] !== pathSeparator;
60678
- return convertSlashes(needsSeperator ? path4 + pathSeparator : path4, pathSeparator);
61288
+ const needsSeperator = path5[path5.length - 1] !== pathSeparator;
61289
+ return convertSlashes(needsSeperator ? path5 + pathSeparator : path5, pathSeparator);
60679
61290
  }
60680
61291
  function joinPathWithBasePath(filename, directoryPath) {
60681
61292
  return directoryPath + filename;
@@ -60741,10 +61352,10 @@ function build$2(options, isSynchronous) {
60741
61352
  return null;
60742
61353
  return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
60743
61354
  }
60744
- function isRecursive(path4, resolved, state) {
61355
+ function isRecursive(path5, resolved, state) {
60745
61356
  if (state.options.useRealPaths)
60746
61357
  return isRecursiveUsingRealPaths(resolved, state);
60747
- let parent = dirname(path4);
61358
+ let parent = dirname2(path5);
60748
61359
  let depth = 1;
60749
61360
  while (parent !== state.root && depth < 2) {
60750
61361
  const resolvedPath = state.symlinks.get(parent);
@@ -60752,9 +61363,9 @@ function isRecursive(path4, resolved, state) {
60752
61363
  if (isSameRoot)
60753
61364
  depth++;
60754
61365
  else
60755
- parent = dirname(parent);
61366
+ parent = dirname2(parent);
60756
61367
  }
60757
- state.symlinks.set(path4, resolved);
61368
+ state.symlinks.set(path5, resolved);
60758
61369
  return depth > 1;
60759
61370
  }
60760
61371
  function isRecursiveUsingRealPaths(resolved, state) {
@@ -60800,9 +61411,9 @@ function sync(root, options) {
60800
61411
  var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (directoryPath, paths) => {
60801
61412
  paths.push(directoryPath || ".");
60802
61413
  }, pushDirectoryFilter = (directoryPath, paths, filters) => {
60803
- const path4 = directoryPath || ".";
60804
- if (filters.every((filter2) => filter2(path4, true)))
60805
- paths.push(path4);
61414
+ const path5 = directoryPath || ".";
61415
+ if (filters.every((filter2) => filter2(path5, true)))
61416
+ paths.push(path5);
60806
61417
  }, empty$2 = () => {}, pushFileFilterAndCount = (filename, _paths, counts, filters) => {
60807
61418
  if (filters.every((filter2) => filter2(filename, false)))
60808
61419
  counts.files++;
@@ -60823,28 +61434,28 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
60823
61434
  files,
60824
61435
  dir: directory
60825
61436
  });
60826
- }, empty = () => {}, resolveSymlinksAsync = function(path4, state, callback$1) {
60827
- const { queue, fs: fs4, options: { suppressErrors } } = state;
61437
+ }, empty = () => {}, resolveSymlinksAsync = function(path5, state, callback$1) {
61438
+ const { queue, fs: fs5, options: { suppressErrors } } = state;
60828
61439
  queue.enqueue();
60829
- fs4.realpath(path4, (error51, resolvedPath) => {
61440
+ fs5.realpath(path5, (error51, resolvedPath) => {
60830
61441
  if (error51)
60831
61442
  return queue.dequeue(suppressErrors ? null : error51, state);
60832
- fs4.stat(resolvedPath, (error$1, stat) => {
61443
+ fs5.stat(resolvedPath, (error$1, stat) => {
60833
61444
  if (error$1)
60834
61445
  return queue.dequeue(suppressErrors ? null : error$1, state);
60835
- if (stat.isDirectory() && isRecursive(path4, resolvedPath, state))
61446
+ if (stat.isDirectory() && isRecursive(path5, resolvedPath, state))
60836
61447
  return queue.dequeue(null, state);
60837
61448
  callback$1(stat, resolvedPath);
60838
61449
  queue.dequeue(null, state);
60839
61450
  });
60840
61451
  });
60841
- }, resolveSymlinks = function(path4, state, callback$1) {
60842
- const { queue, fs: fs4, options: { suppressErrors } } = state;
61452
+ }, resolveSymlinks = function(path5, state, callback$1) {
61453
+ const { queue, fs: fs5, options: { suppressErrors } } = state;
60843
61454
  queue.enqueue();
60844
61455
  try {
60845
- const resolvedPath = fs4.realpathSync(path4);
60846
- const stat = fs4.statSync(resolvedPath);
60847
- if (stat.isDirectory() && isRecursive(path4, resolvedPath, state))
61456
+ const resolvedPath = fs5.realpathSync(path5);
61457
+ const stat = fs5.statSync(resolvedPath);
61458
+ if (stat.isDirectory() && isRecursive(path5, resolvedPath, state))
60848
61459
  return;
60849
61460
  callback$1(stat, resolvedPath);
60850
61461
  } catch (e) {
@@ -60875,22 +61486,22 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
60875
61486
  state.queue.enqueue();
60876
61487
  if (currentDepth < 0)
60877
61488
  return state.queue.dequeue(null, state);
60878
- const { fs: fs4 } = state;
61489
+ const { fs: fs5 } = state;
60879
61490
  state.visited.push(crawlPath);
60880
61491
  state.counts.directories++;
60881
- fs4.readdir(crawlPath || ".", readdirOpts, (error51, entries = []) => {
61492
+ fs5.readdir(crawlPath || ".", readdirOpts, (error51, entries = []) => {
60882
61493
  callback$1(entries, directoryPath, currentDepth);
60883
61494
  state.queue.dequeue(state.options.suppressErrors ? null : error51, state);
60884
61495
  });
60885
61496
  }, walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
60886
- const { fs: fs4 } = state;
61497
+ const { fs: fs5 } = state;
60887
61498
  if (currentDepth < 0)
60888
61499
  return;
60889
61500
  state.visited.push(crawlPath);
60890
61501
  state.counts.directories++;
60891
61502
  let entries = [];
60892
61503
  try {
60893
- entries = fs4.readdirSync(crawlPath || ".", readdirOpts);
61504
+ entries = fs5.readdirSync(crawlPath || ".", readdirOpts);
60894
61505
  } catch (e) {
60895
61506
  if (!state.options.suppressErrors)
60896
61507
  throw e;
@@ -60989,23 +61600,23 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
60989
61600
  const filename = this.joinPath(entry.name, directoryPath);
60990
61601
  this.pushFile(filename, files, this.state.counts, filters);
60991
61602
  } else if (entry.isDirectory()) {
60992
- let path4 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
60993
- if (exclude && exclude(entry.name, path4))
61603
+ let path5 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
61604
+ if (exclude && exclude(entry.name, path5))
60994
61605
  continue;
60995
- this.pushDirectory(path4, paths, filters);
60996
- this.walkDirectory(this.state, path4, path4, depth - 1, this.walk);
61606
+ this.pushDirectory(path5, paths, filters);
61607
+ this.walkDirectory(this.state, path5, path5, depth - 1, this.walk);
60997
61608
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
60998
- let path4 = joinPathWithBasePath(entry.name, directoryPath);
60999
- this.resolveSymlink(path4, this.state, (stat, resolvedPath) => {
61609
+ let path5 = joinPathWithBasePath(entry.name, directoryPath);
61610
+ this.resolveSymlink(path5, this.state, (stat, resolvedPath) => {
61000
61611
  if (stat.isDirectory()) {
61001
61612
  resolvedPath = normalizePath(resolvedPath, this.state.options);
61002
- if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path4 + pathSeparator))
61613
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path5 + pathSeparator))
61003
61614
  return;
61004
- this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path4 + pathSeparator, depth - 1, this.walk);
61615
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path5 + pathSeparator, depth - 1, this.walk);
61005
61616
  } else {
61006
- resolvedPath = useRealPaths ? resolvedPath : path4;
61617
+ resolvedPath = useRealPaths ? resolvedPath : path5;
61007
61618
  const filename = basename(resolvedPath);
61008
- const directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);
61619
+ const directoryPath$1 = normalizePath(dirname2(resolvedPath), this.state.options);
61009
61620
  resolvedPath = this.joinPath(filename, directoryPath$1);
61010
61621
  this.pushFile(resolvedPath, files, this.state.counts, filters);
61011
61622
  }
@@ -61139,7 +61750,7 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
61139
61750
  isMatch2 = globFn(patterns, ...options);
61140
61751
  this.globCache[patterns.join("\x00")] = isMatch2;
61141
61752
  }
61142
- this.options.filters.push((path4) => isMatch2(path4));
61753
+ this.options.filters.push((path5) => isMatch2(path5));
61143
61754
  return this;
61144
61755
  }
61145
61756
  };
@@ -61352,8 +61963,8 @@ var require_utils = __commonJS((exports) => {
61352
61963
  }
61353
61964
  return output;
61354
61965
  };
61355
- exports.basename = (path4, { windows } = {}) => {
61356
- const segs = path4.split(windows ? /[\\/]/ : "/");
61966
+ exports.basename = (path5, { windows } = {}) => {
61967
+ const segs = path5.split(windows ? /[\\/]/ : "/");
61357
61968
  const last2 = segs[segs.length - 1];
61358
61969
  if (last2 === "") {
61359
61970
  return segs[segs.length - 2];
@@ -62834,8 +63445,8 @@ var require_picomatch2 = __commonJS((exports, module) => {
62834
63445
  });
62835
63446
 
62836
63447
  // node_modules/tinyglobby/dist/index.mjs
62837
- import { readdir, readdirSync, realpath, realpathSync, stat, statSync as statSync3 } from "fs";
62838
- import { isAbsolute, posix, resolve as resolve2 } from "path";
63448
+ import { readdir, readdirSync, realpath, realpathSync, stat, statSync as statSync4 } from "fs";
63449
+ import { isAbsolute, posix, resolve as resolve3 } from "path";
62839
63450
  import { fileURLToPath } from "url";
62840
63451
  function getPartialMatcher(patterns, options = {}) {
62841
63452
  const patternsCount = patterns.length;
@@ -62907,10 +63518,13 @@ function buildRelative(cwd2, root) {
62907
63518
  return p[p.length - 1] === "/" && result2 !== "" ? `${result2}/` : result2 || ".";
62908
63519
  };
62909
63520
  }
62910
- function splitPattern(path4) {
63521
+ function ensureNonDriveRelativePath(path5) {
63522
+ return path5.replace(DRIVE_RELATIVE_PATH, (match) => `${match}/`);
63523
+ }
63524
+ function splitPattern(path5) {
62911
63525
  var _result$parts;
62912
- const result2 = import_picomatch.default.scan(path4, splitPatternOptions);
62913
- return ((_result$parts = result2.parts) === null || _result$parts === undefined ? undefined : _result$parts.length) ? result2.parts : [path4];
63526
+ const result2 = import_picomatch.default.scan(path5, splitPatternOptions);
63527
+ return ((_result$parts = result2.parts) === null || _result$parts === undefined ? undefined : _result$parts.length) ? result2.parts : [path5];
62914
63528
  }
62915
63529
  function isDynamicPattern(pattern, options) {
62916
63530
  if ((options === null || options === undefined ? undefined : options.caseSensitiveMatch) === false)
@@ -62946,7 +63560,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
62946
63560
  }
62947
63561
  const potentialRoot = posix.join(cwd2, parentDir.slice(i * 3));
62948
63562
  if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
62949
- props.root = potentialRoot;
63563
+ props.root = ensureNonDriveRelativePath(potentialRoot);
62950
63564
  props.depthOffset = -n + i;
62951
63565
  }
62952
63566
  }
@@ -62967,7 +63581,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
62967
63581
  }
62968
63582
  props.depthOffset = newCommonPath.length;
62969
63583
  props.commonPath = newCommonPath;
62970
- props.root = newCommonPath.length > 0 ? posix.join(cwd2, ...newCommonPath) : cwd2;
63584
+ props.root = ensureNonDriveRelativePath(newCommonPath.length > 0 ? posix.join(cwd2, ...newCommonPath) : cwd2);
62971
63585
  }
62972
63586
  return result2;
62973
63587
  }
@@ -63026,14 +63640,14 @@ function buildCrawler(options, patterns) {
63026
63640
  maxDepth = Math.round(options.deep - props.depthOffset);
63027
63641
  const crawler = new Builder({
63028
63642
  filters: [debug3 ? (p, isDirectory) => {
63029
- const path4 = format(p, isDirectory);
63030
- const matches2 = matcher(path4) && !ignore(path4);
63643
+ const path5 = format(p, isDirectory);
63644
+ const matches2 = matcher(path5) && !ignore(path5);
63031
63645
  if (matches2)
63032
- log(`matched ${path4}`);
63646
+ log(`matched ${path5}`);
63033
63647
  return matches2;
63034
63648
  } : (p, isDirectory) => {
63035
- const path4 = format(p, isDirectory);
63036
- return matcher(path4) && !ignore(path4);
63649
+ const path5 = format(p, isDirectory);
63650
+ return matcher(path5) && !ignore(path5);
63037
63651
  }],
63038
63652
  exclude: debug3 ? (_, p) => {
63039
63653
  const skipped = excludePredicate(_, p);
@@ -63066,11 +63680,11 @@ function formatPaths(paths, mapper) {
63066
63680
  return paths;
63067
63681
  }
63068
63682
  function getOptions2(options) {
63069
- const opts = {
63070
- ...defaultOptions,
63071
- ...options
63072
- };
63073
- opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve2(opts.cwd)).replace(BACKSLASHES, "/");
63683
+ const opts = Object.assign({}, options);
63684
+ for (const key in defaultOptions)
63685
+ if (opts[key] === undefined)
63686
+ Object.assign(opts, { [key]: defaultOptions[key] });
63687
+ opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve3(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
63074
63688
  opts.ignore = ensureStringArray(opts.ignore);
63075
63689
  opts.fs && (opts.fs = {
63076
63690
  readdir: opts.fs.readdir || readdir,
@@ -63078,7 +63692,7 @@ function getOptions2(options) {
63078
63692
  realpath: opts.fs.realpath || realpath,
63079
63693
  realpathSync: opts.fs.realpathSync || realpathSync,
63080
63694
  stat: opts.fs.stat || stat,
63081
- statSync: opts.fs.statSync || statSync3
63695
+ statSync: opts.fs.statSync || statSync4
63082
63696
  });
63083
63697
  if (opts.debug)
63084
63698
  log("globbing with options:", opts);
@@ -63097,12 +63711,13 @@ function globSync(globInput, options) {
63097
63711
  const [crawler, relative2] = getCrawler(globInput, options);
63098
63712
  return crawler ? formatPaths(crawler.sync(), relative2) : [];
63099
63713
  }
63100
- var import_picomatch, isReadonlyArray, BACKSLASHES, isWin, ONLY_PARENT_DIRECTORIES, WIN32_ROOT_DIR, isRoot, splitPatternOptions, POSIX_UNESCAPED_GLOB_SYMBOLS, WIN32_UNESCAPED_GLOB_SYMBOLS, escapePosixPath = (path4) => path4.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapeWin32Path = (path4) => path4.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapePath, PARENT_DIRECTORY, ESCAPING_BACKSLASHES, defaultOptions;
63714
+ var import_picomatch, isReadonlyArray, BACKSLASHES, DRIVE_RELATIVE_PATH, isWin, ONLY_PARENT_DIRECTORIES, WIN32_ROOT_DIR, isRoot, splitPatternOptions, POSIX_UNESCAPED_GLOB_SYMBOLS, WIN32_UNESCAPED_GLOB_SYMBOLS, escapePosixPath = (path5) => path5.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapeWin32Path = (path5) => path5.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapePath, PARENT_DIRECTORY, ESCAPING_BACKSLASHES, defaultOptions;
63101
63715
  var init_dist7 = __esm(() => {
63102
63716
  init_dist6();
63103
63717
  import_picomatch = __toESM(require_picomatch2(), 1);
63104
63718
  isReadonlyArray = Array.isArray;
63105
63719
  BACKSLASHES = /\\/g;
63720
+ DRIVE_RELATIVE_PATH = /^[A-Za-z]:$/;
63106
63721
  isWin = process.platform === "win32";
63107
63722
  ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
63108
63723
  WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
@@ -63115,7 +63730,6 @@ var init_dist7 = __esm(() => {
63115
63730
  ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
63116
63731
  defaultOptions = {
63117
63732
  caseSensitiveMatch: true,
63118
- cwd: process.cwd(),
63119
63733
  debug: !!process.env.TINYGLOBBY_DEBUG,
63120
63734
  expandDirectories: true,
63121
63735
  followSymbolicLinks: true,
@@ -63124,7 +63738,7 @@ var init_dist7 = __esm(() => {
63124
63738
  });
63125
63739
 
63126
63740
  // src/utils/jsonl-lines.ts
63127
- import * as fs4 from "fs";
63741
+ import * as fs5 from "fs";
63128
63742
  import { promisify } from "util";
63129
63743
  function splitJsonlContent(content) {
63130
63744
  return content.trim().split(`
@@ -63135,7 +63749,7 @@ async function readJsonlLines(filePath) {
63135
63749
  return splitJsonlContent(content);
63136
63750
  }
63137
63751
  function readJsonlLinesSync(filePath) {
63138
- const content = readFileSync6(filePath, "utf-8");
63752
+ const content = readFileSync7(filePath, "utf-8");
63139
63753
  return splitJsonlContent(content);
63140
63754
  }
63141
63755
  function parseJsonlLine(line) {
@@ -63145,15 +63759,15 @@ function parseJsonlLine(line) {
63145
63759
  return null;
63146
63760
  }
63147
63761
  }
63148
- var readFile2, readFileSync6;
63762
+ var readFile2, readFileSync7;
63149
63763
  var init_jsonl_lines = __esm(() => {
63150
- readFile2 = promisify(fs4.readFile);
63151
- readFileSync6 = fs4.readFileSync;
63764
+ readFile2 = promisify(fs5.readFile);
63765
+ readFileSync7 = fs5.readFileSync;
63152
63766
  });
63153
63767
 
63154
63768
  // src/utils/jsonl-blocks.ts
63155
- import * as fs5 from "fs";
63156
- import path4 from "node:path";
63769
+ import * as fs6 from "fs";
63770
+ import path5 from "node:path";
63157
63771
  function getBlockMetrics() {
63158
63772
  const claudeDir = getClaudeConfigDir();
63159
63773
  if (!claudeDir)
@@ -63167,7 +63781,7 @@ function getBlockMetrics() {
63167
63781
  function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
63168
63782
  const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
63169
63783
  const now2 = new Date;
63170
- const pattern = path4.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
63784
+ const pattern = path5.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
63171
63785
  const files = globSync([pattern], {
63172
63786
  absolute: true,
63173
63787
  cwd: rootDir
@@ -63175,7 +63789,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
63175
63789
  if (files.length === 0)
63176
63790
  return null;
63177
63791
  const filesWithStats = files.map((file2) => {
63178
- const stats = statSync5(file2);
63792
+ const stats = statSync6(file2);
63179
63793
  return { file: file2, mtime: stats.mtime };
63180
63794
  });
63181
63795
  filesWithStats.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
@@ -63293,26 +63907,26 @@ function floorToHour(timestamp) {
63293
63907
  floored.setUTCMinutes(0, 0, 0);
63294
63908
  return floored;
63295
63909
  }
63296
- var statSync5;
63910
+ var statSync6;
63297
63911
  var init_jsonl_blocks = __esm(async () => {
63298
63912
  init_dist7();
63299
63913
  init_jsonl_lines();
63300
63914
  await init_claude_settings();
63301
- statSync5 = fs5.statSync;
63915
+ statSync6 = fs6.statSync;
63302
63916
  });
63303
63917
 
63304
63918
  // src/utils/jsonl-cache.ts
63305
- import * as fs6 from "fs";
63306
- import { createHash as createHash2 } from "node:crypto";
63307
- import os5 from "node:os";
63308
- import path5 from "node:path";
63919
+ import * as fs7 from "fs";
63920
+ import { createHash as createHash3 } from "node:crypto";
63921
+ import os6 from "node:os";
63922
+ import path6 from "node:path";
63309
63923
  function normalizeConfigDir(configDir) {
63310
- return path5.resolve(configDir);
63924
+ return path6.resolve(configDir);
63311
63925
  }
63312
63926
  function getBlockCachePath(configDir = getClaudeConfigDir()) {
63313
63927
  const normalizedConfigDir = normalizeConfigDir(configDir);
63314
- const configHash = createHash2("sha256").update(normalizedConfigDir).digest("hex").slice(0, 16);
63315
- return path5.join(os5.homedir(), ".cache", "ccstatusline", `block-cache-${configHash}.json`);
63928
+ const configHash = createHash3("sha256").update(normalizedConfigDir).digest("hex").slice(0, 16);
63929
+ return path6.join(os6.homedir(), ".cache", "ccstatusline", `block-cache-${configHash}.json`);
63316
63930
  }
63317
63931
  function readBlockCache(expectedConfigDir) {
63318
63932
  try {
@@ -63321,7 +63935,7 @@ function readBlockCache(expectedConfigDir) {
63321
63935
  if (!existsSync6(cachePath)) {
63322
63936
  return null;
63323
63937
  }
63324
- const content = readFileSync8(cachePath, "utf-8");
63938
+ const content = readFileSync9(cachePath, "utf-8");
63325
63939
  const cache3 = JSON.parse(content);
63326
63940
  if (typeof cache3.startTime !== "string") {
63327
63941
  return null;
@@ -63347,15 +63961,15 @@ function writeBlockCache(startTime, configDir = getClaudeConfigDir()) {
63347
63961
  try {
63348
63962
  const normalizedConfigDir = normalizeConfigDir(configDir);
63349
63963
  const cachePath = getBlockCachePath(normalizedConfigDir);
63350
- const cacheDir = path5.dirname(cachePath);
63964
+ const cacheDir = path6.dirname(cachePath);
63351
63965
  if (!existsSync6(cacheDir)) {
63352
- mkdirSync4(cacheDir, { recursive: true });
63966
+ mkdirSync5(cacheDir, { recursive: true });
63353
63967
  }
63354
63968
  const cache3 = {
63355
63969
  startTime: startTime.toISOString(),
63356
63970
  configDir: normalizedConfigDir
63357
63971
  };
63358
- writeFileSync4(cachePath, JSON.stringify(cache3), "utf-8");
63972
+ writeFileSync5(cachePath, JSON.stringify(cache3), "utf-8");
63359
63973
  } catch {}
63360
63974
  }
63361
63975
  function getCachedBlockMetrics(sessionDurationHours = 5) {
@@ -63378,21 +63992,21 @@ function getCachedBlockMetrics(sessionDurationHours = 5) {
63378
63992
  }
63379
63993
  return metrics;
63380
63994
  }
63381
- var readFileSync8, writeFileSync4, mkdirSync4, existsSync6;
63995
+ var readFileSync9, writeFileSync5, mkdirSync5, existsSync6;
63382
63996
  var init_jsonl_cache = __esm(async () => {
63383
63997
  await __promiseAll([
63384
63998
  init_claude_settings(),
63385
63999
  init_jsonl_blocks()
63386
64000
  ]);
63387
- readFileSync8 = fs6.readFileSync;
63388
- writeFileSync4 = fs6.writeFileSync;
63389
- mkdirSync4 = fs6.mkdirSync;
63390
- existsSync6 = fs6.existsSync;
64001
+ readFileSync9 = fs7.readFileSync;
64002
+ writeFileSync5 = fs7.writeFileSync;
64003
+ mkdirSync5 = fs7.mkdirSync;
64004
+ existsSync6 = fs7.existsSync;
63391
64005
  });
63392
64006
 
63393
64007
  // src/utils/jsonl-metrics.ts
63394
- import * as fs7 from "fs";
63395
- import path6 from "node:path";
64008
+ import * as fs8 from "fs";
64009
+ import path7 from "node:path";
63396
64010
  function collectAgentIds(value, agentIds) {
63397
64011
  if (!value || typeof value !== "object") {
63398
64012
  return;
@@ -63424,7 +64038,7 @@ function getReferencedSubagentIds(lines) {
63424
64038
  }
63425
64039
  async function getSessionDuration(transcriptPath) {
63426
64040
  try {
63427
- if (!fs7.existsSync(transcriptPath)) {
64041
+ if (!fs8.existsSync(transcriptPath)) {
63428
64042
  return null;
63429
64043
  }
63430
64044
  const lines = await readJsonlLines(transcriptPath);
@@ -63474,7 +64088,7 @@ async function getSessionDuration(transcriptPath) {
63474
64088
  }
63475
64089
  async function getTokenMetrics(transcriptPath) {
63476
64090
  try {
63477
- if (!fs7.existsSync(transcriptPath)) {
64091
+ if (!fs8.existsSync(transcriptPath)) {
63478
64092
  return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
63479
64093
  }
63480
64094
  const lines = await readJsonlLines(transcriptPath);
@@ -63688,20 +64302,20 @@ function getSubagentTranscriptPaths(transcriptPath, referencedAgentIds) {
63688
64302
  if (referencedAgentIds.size === 0) {
63689
64303
  return [];
63690
64304
  }
63691
- const transcriptDir = path6.dirname(transcriptPath);
63692
- const transcriptStem = path6.parse(transcriptPath).name;
64305
+ const transcriptDir = path7.dirname(transcriptPath);
64306
+ const transcriptStem = path7.parse(transcriptPath).name;
63693
64307
  const candidateDirs = [
63694
- path6.join(transcriptDir, "subagents"),
63695
- path6.join(transcriptDir, transcriptStem, "subagents")
64308
+ path7.join(transcriptDir, "subagents"),
64309
+ path7.join(transcriptDir, transcriptStem, "subagents")
63696
64310
  ];
63697
64311
  const seenPaths = new Set;
63698
64312
  const matchedPaths = [];
63699
64313
  for (const subagentsDir of candidateDirs) {
63700
- if (!fs7.existsSync(subagentsDir)) {
64314
+ if (!fs8.existsSync(subagentsDir)) {
63701
64315
  continue;
63702
64316
  }
63703
64317
  try {
63704
- const dirEntries = fs7.readdirSync(subagentsDir, { withFileTypes: true });
64318
+ const dirEntries = fs8.readdirSync(subagentsDir, { withFileTypes: true });
63705
64319
  for (const entry of dirEntries) {
63706
64320
  if (!entry.isFile()) {
63707
64321
  continue;
@@ -63713,7 +64327,7 @@ function getSubagentTranscriptPaths(transcriptPath, referencedAgentIds) {
63713
64327
  if (!referencedAgentIds.has(match[1])) {
63714
64328
  continue;
63715
64329
  }
63716
- const fullPath = path6.join(subagentsDir, entry.name);
64330
+ const fullPath = path7.join(subagentsDir, entry.name);
63717
64331
  if (seenPaths.has(fullPath)) {
63718
64332
  continue;
63719
64333
  }
@@ -63730,7 +64344,7 @@ async function getSpeedMetricsCollection(transcriptPath, options = {}) {
63730
64344
  const normalizedWindows = Array.from(new Set((options.windowSeconds ?? []).map((window2) => normalizeWindowSeconds(window2)).filter((window2) => window2 !== null)));
63731
64345
  const emptyWindowedMetrics = buildEmptyWindowedMetrics(normalizedWindows);
63732
64346
  try {
63733
- if (!fs7.existsSync(transcriptPath)) {
64347
+ if (!fs8.existsSync(transcriptPath)) {
63734
64348
  return {
63735
64349
  sessionAverage: createEmptySpeedMetrics(),
63736
64350
  windowed: emptyWindowedMetrics
@@ -63929,44 +64543,69 @@ function formatUsageDuration(durationMs, compact2 = false, useDays = true) {
63929
64543
  function pad2(value) {
63930
64544
  return value.toString().padStart(2, "0");
63931
64545
  }
63932
- function formatResetAtUtc(date5, compact2, hour12) {
64546
+ function formatResetAtUtc(date5, compact2, hour12, weekday = false) {
63933
64547
  const year = date5.getUTCFullYear();
63934
64548
  const month = pad2(date5.getUTCMonth() + 1);
63935
64549
  const day = pad2(date5.getUTCDate());
63936
64550
  const hours = pad2(date5.getUTCHours());
63937
64551
  const minutes = pad2(date5.getUTCMinutes());
64552
+ const weekdayName = weekday ? UTC_WEEKDAY_NAMES[date5.getUTCDay()] : "";
63938
64553
  if (hour12) {
63939
64554
  const hour = date5.getUTCHours();
63940
64555
  const displayHour = hour % 12 || 12;
63941
64556
  const period = hour >= 12 ? "PM" : "AM";
64557
+ if (weekday) {
64558
+ return compact2 ? `${weekdayName} ${displayHour}:${minutes} ${period}Z` : `${weekdayName} ${displayHour}:${minutes} ${period} UTC`;
64559
+ }
63942
64560
  return compact2 ? `${month}-${day} ${displayHour}:${minutes} ${period}Z` : `${year}-${month}-${day} ${displayHour}:${minutes} ${period} UTC`;
63943
64561
  }
64562
+ if (weekday) {
64563
+ return compact2 ? `${weekdayName} ${hours}:${minutes}Z` : `${weekdayName} ${hours}:${minutes} UTC`;
64564
+ }
63944
64565
  return compact2 ? `${month}-${day} ${hours}:${minutes}Z` : `${year}-${month}-${day} ${hours}:${minutes} UTC`;
63945
64566
  }
63946
64567
  function normalizeDayPeriod(dayPeriod) {
63947
64568
  return dayPeriod.replace(/\./g, "").toUpperCase();
63948
64569
  }
63949
- function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12) {
64570
+ function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12, weekday = false) {
63950
64571
  try {
63951
- const formatter = new Intl.DateTimeFormat(locale, {
64572
+ const options = {
63952
64573
  timeZone: timezone,
63953
- year: "numeric",
63954
- month: "2-digit",
63955
- day: "2-digit",
63956
64574
  hour: "2-digit",
63957
64575
  minute: "2-digit",
63958
64576
  hour12,
63959
64577
  timeZoneName: "short"
63960
- });
64578
+ };
64579
+ if (weekday) {
64580
+ options.weekday = "short";
64581
+ } else {
64582
+ options.year = "numeric";
64583
+ options.month = "2-digit";
64584
+ options.day = "2-digit";
64585
+ }
64586
+ const formatter = new Intl.DateTimeFormat(locale, options);
63961
64587
  const parts = formatter.formatToParts(date5);
63962
64588
  const get2 = (type) => parts.find((p) => p.type === type)?.value ?? "";
63963
- const year = get2("year");
63964
- const month = get2("month");
63965
- const day = get2("day");
63966
64589
  const hour = get2("hour");
63967
64590
  const minute = get2("minute");
63968
64591
  const dayPeriod = get2("dayPeriod");
63969
64592
  const tzName = get2("timeZoneName");
64593
+ if (weekday) {
64594
+ const weekdayName = get2("weekday");
64595
+ if (!weekdayName || !hour || !minute) {
64596
+ return null;
64597
+ }
64598
+ if (hour12) {
64599
+ const displayHour = hour.startsWith("0") ? hour.slice(1) : hour;
64600
+ const normalizedDayPeriod = dayPeriod ? normalizeDayPeriod(dayPeriod) : "";
64601
+ const time3 = `${displayHour}:${minute}${normalizedDayPeriod ? ` ${normalizedDayPeriod}` : ""}`;
64602
+ return compact2 ? `${weekdayName} ${time3}` : `${weekdayName} ${time3} ${tzName}`;
64603
+ }
64604
+ return compact2 ? `${weekdayName} ${hour}:${minute}` : `${weekdayName} ${hour}:${minute} ${tzName}`;
64605
+ }
64606
+ const year = get2("year");
64607
+ const month = get2("month");
64608
+ const day = get2("day");
63970
64609
  if (!year || !month || !day || !hour || !minute) {
63971
64610
  return null;
63972
64611
  }
@@ -63981,7 +64620,7 @@ function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12) {
63981
64620
  return null;
63982
64621
  }
63983
64622
  }
63984
- function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12, hour12Arg = false) {
64623
+ function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12, hour12Arg = false, weekday = false) {
63985
64624
  if (!resetAt) {
63986
64625
  return null;
63987
64626
  }
@@ -63993,21 +64632,21 @@ function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12,
63993
64632
  const locale = typeof localeOrHour12 === "string" ? localeOrHour12 : undefined;
63994
64633
  const hour12 = typeof localeOrHour12 === "boolean" ? localeOrHour12 : hour12Arg;
63995
64634
  if (!timezone || timezone === "UTC") {
63996
- return formatResetAtUtc(date5, compact2, hour12);
64635
+ return formatResetAtUtc(date5, compact2, hour12, weekday);
63997
64636
  }
63998
64637
  const resolvedTimezone = timezone === "local" ? undefined : timezone;
63999
64638
  const resolvedLocale = locale && locale.length > 0 ? locale : DEFAULT_TZ_LOCALE;
64000
- const localized = formatResetAtInTimezone(date5, compact2, resolvedTimezone, resolvedLocale, hour12);
64639
+ const localized = formatResetAtInTimezone(date5, compact2, resolvedTimezone, resolvedLocale, hour12, weekday);
64001
64640
  if (localized) {
64002
64641
  return localized;
64003
64642
  }
64004
64643
  if (resolvedLocale !== DEFAULT_TZ_LOCALE) {
64005
- const fallback = formatResetAtInTimezone(date5, compact2, resolvedTimezone, DEFAULT_TZ_LOCALE, hour12);
64644
+ const fallback = formatResetAtInTimezone(date5, compact2, resolvedTimezone, DEFAULT_TZ_LOCALE, hour12, weekday);
64006
64645
  if (fallback) {
64007
64646
  return fallback;
64008
64647
  }
64009
64648
  }
64010
- return formatResetAtUtc(date5, compact2, hour12);
64649
+ return formatResetAtUtc(date5, compact2, hour12, weekday);
64011
64650
  }
64012
64651
  function getUsageErrorMessage(error51) {
64013
64652
  switch (error51) {
@@ -64028,10 +64667,11 @@ function makeUsageProgressBar(percent, width = 15) {
64028
64667
  const empty2 = width - filled;
64029
64668
  return "[" + "█".repeat(filled) + "░".repeat(empty2) + "]";
64030
64669
  }
64031
- var DEFAULT_TZ_LOCALE = "en-US";
64670
+ var UTC_WEEKDAY_NAMES, DEFAULT_TZ_LOCALE = "en-US";
64032
64671
  var init_usage_windows = __esm(async () => {
64033
64672
  init_usage_types();
64034
64673
  await init_jsonl();
64674
+ UTC_WEEKDAY_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
64035
64675
  });
64036
64676
 
64037
64677
  // src/utils/usage.ts
@@ -64131,7 +64771,7 @@ var init_BlockTimer = __esm(async () => {
64131
64771
  });
64132
64772
 
64133
64773
  // src/widgets/CurrentWorkingDir.tsx
64134
- import * as os6 from "node:os";
64774
+ import * as os7 from "node:os";
64135
64775
 
64136
64776
  class CurrentWorkingDirWidget {
64137
64777
  getDefaultColor() {
@@ -64276,27 +64916,27 @@ class CurrentWorkingDirWidget {
64276
64916
  supportsColors(item) {
64277
64917
  return true;
64278
64918
  }
64279
- abbreviateHomeDir(path7) {
64280
- const homeDir = os6.homedir();
64281
- if (path7 === homeDir) {
64919
+ abbreviateHomeDir(path8) {
64920
+ const homeDir = os7.homedir();
64921
+ if (path8 === homeDir) {
64282
64922
  return "~";
64283
64923
  }
64284
- if (path7.startsWith(homeDir)) {
64285
- const boundaryChar = path7[homeDir.length];
64924
+ if (path8.startsWith(homeDir)) {
64925
+ const boundaryChar = path8[homeDir.length];
64286
64926
  if (boundaryChar !== "/" && boundaryChar !== "\\") {
64287
- return path7;
64927
+ return path8;
64288
64928
  }
64289
- return "~" + path7.slice(homeDir.length);
64929
+ return "~" + path8.slice(homeDir.length);
64290
64930
  }
64291
- return path7;
64931
+ return path8;
64292
64932
  }
64293
- abbreviatePath(path7) {
64294
- const homeDir = os6.homedir();
64295
- const useBackslash = path7.includes("\\") && !path7.includes("/");
64933
+ abbreviatePath(path8) {
64934
+ const homeDir = os7.homedir();
64935
+ const useBackslash = path8.includes("\\") && !path8.includes("/");
64296
64936
  const sep2 = useBackslash ? "\\" : "/";
64297
- let normalizedPath = path7;
64298
- if (path7.startsWith(homeDir)) {
64299
- normalizedPath = "~" + path7.slice(homeDir.length);
64937
+ let normalizedPath = path8;
64938
+ if (path8.startsWith(homeDir)) {
64939
+ normalizedPath = "~" + path8.slice(homeDir.length);
64300
64940
  }
64301
64941
  const parts = normalizedPath.split(/[\\/]+/).filter((part) => part !== "");
64302
64942
  const abbreviated = parts.map((part, index) => {
@@ -64428,6 +65068,7 @@ function runJjArgs(args, context, allowEmpty = false) {
64428
65068
  const output = execFileSync4("jj", args, {
64429
65069
  encoding: "utf8",
64430
65070
  stdio: ["pipe", "pipe", "ignore"],
65071
+ windowsHide: true,
64431
65072
  ...cwd2 ? { cwd: cwd2 } : {}
64432
65073
  }).trimEnd();
64433
65074
  return allowEmpty || output.length > 0 ? output : null;
@@ -65065,7 +65706,7 @@ var init_JjRevision = __esm(() => {
65065
65706
  });
65066
65707
 
65067
65708
  // src/widgets/ClaudeAccountEmail.ts
65068
- import * as fs8 from "fs";
65709
+ import * as fs9 from "fs";
65069
65710
 
65070
65711
  class ClaudeAccountEmailWidget {
65071
65712
  getDefaultColor() {
@@ -65088,7 +65729,7 @@ class ClaudeAccountEmailWidget {
65088
65729
  return item.rawValue ? "you@example.com" : "账户: you@example.com";
65089
65730
  }
65090
65731
  try {
65091
- const content = fs8.readFileSync(getClaudeJsonPath(), "utf-8");
65732
+ const content = fs9.readFileSync(getClaudeJsonPath(), "utf-8");
65092
65733
  const data = JSON.parse(content);
65093
65734
  const email3 = data.oauthAccount?.emailAddress;
65094
65735
  if (typeof email3 !== "string" || email3.length === 0) {
@@ -65442,7 +66083,7 @@ var init_TotalSpeed = __esm(async () => {
65442
66083
 
65443
66084
  // src/widgets/FreeMemory.ts
65444
66085
  import { execSync as execSync3 } from "child_process";
65445
- import os7 from "os";
66086
+ import os8 from "os";
65446
66087
  function formatBytes(bytes) {
65447
66088
  const GB = 1024 ** 3;
65448
66089
  const MB = 1024 ** 2;
@@ -65457,7 +66098,7 @@ function formatBytes(bytes) {
65457
66098
  }
65458
66099
  function getUsedMemoryMacOS() {
65459
66100
  try {
65460
- const output = execSync3("vm_stat", { encoding: "utf8" });
66101
+ const output = execSync3("vm_stat", { encoding: "utf8", windowsHide: true });
65461
66102
  const lines = output.split(`
65462
66103
  `);
65463
66104
  const firstLine = lines[0];
@@ -65506,12 +66147,12 @@ class FreeMemoryWidget {
65506
66147
  if (context.isPreview) {
65507
66148
  return item.rawValue ? "12.4G/16.0G" : "内存: 12.4G/16.0G";
65508
66149
  }
65509
- const total = os7.totalmem();
66150
+ const total = os8.totalmem();
65510
66151
  let used;
65511
- if (os7.platform() === "darwin") {
65512
- used = getUsedMemoryMacOS() ?? total - os7.freemem();
66152
+ if (os8.platform() === "darwin") {
66153
+ used = getUsedMemoryMacOS() ?? total - os8.freemem();
65513
66154
  } else {
65514
- used = total - os7.freemem();
66155
+ used = total - os8.freemem();
65515
66156
  }
65516
66157
  const value = `${formatBytes(used)}/${formatBytes(total)}`;
65517
66158
  return item.rawValue ? value : `内存: ${value}`;
@@ -65526,7 +66167,7 @@ class FreeMemoryWidget {
65526
66167
  var init_FreeMemory = () => {};
65527
66168
 
65528
66169
  // src/widgets/SessionName.ts
65529
- import * as fs9 from "fs";
66170
+ import * as fs10 from "fs";
65530
66171
 
65531
66172
  class SessionNameWidget {
65532
66173
  getDefaultColor() {
@@ -65553,7 +66194,7 @@ class SessionNameWidget {
65553
66194
  return null;
65554
66195
  }
65555
66196
  try {
65556
- const content = fs9.readFileSync(transcriptPath, "utf-8");
66197
+ const content = fs10.readFileSync(transcriptPath, "utf-8");
65557
66198
  const lines = content.split(`
65558
66199
  `);
65559
66200
  for (let i = lines.length - 1;i >= 0; i--) {
@@ -65878,7 +66519,7 @@ class ExtraUsageUtilizationWidget {
65878
66519
  return getUsageErrorMessage(data.error);
65879
66520
  return null;
65880
66521
  }
65881
- const percent = Math.max(0, Math.min(100, data.extraUsageUtilization * 100));
66522
+ const percent = Math.max(0, Math.min(100, data.extraUsageUtilization));
65882
66523
  const renderedPercent = inverted ? 100 - percent : percent;
65883
66524
  if (isUsageProgressMode(displayMode)) {
65884
66525
  const width = getUsageProgressBarWidth(displayMode);
@@ -65945,7 +66586,8 @@ class ExtraUsageRemainingWidget {
65945
66586
  return null;
65946
66587
  }
65947
66588
  const limitDollars = data.extraUsageLimit / 100;
65948
- const remaining = Math.max(0, limitDollars - data.extraUsageUsed);
66589
+ const usedDollars = data.extraUsageUsed / 100;
66590
+ const remaining = Math.max(0, limitDollars - usedDollars);
65949
66591
  const formatted = `$${remaining.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
65950
66592
  return formatRawOrLabeledValue(item, "超额剩余: ", formatted);
65951
66593
  }
@@ -66899,6 +67541,9 @@ function getWeeklyResetModifierText(item) {
66899
67541
  if (isUsage12HourClock(item)) {
66900
67542
  modifiers.push("12 时制");
66901
67543
  }
67544
+ if (isUsageWeekdayEnabled(item)) {
67545
+ modifiers.push("星期");
67546
+ }
66902
67547
  } else if (isWeeklyResetHoursOnly(item)) {
66903
67548
  modifiers.push("仅小时");
66904
67549
  }
@@ -66949,6 +67594,9 @@ class WeeklyResetTimerWidget {
66949
67594
  if (action === "toggle-hour-format") {
66950
67595
  return toggleUsageHourFormat(item);
66951
67596
  }
67597
+ if (action === "toggle-weekday") {
67598
+ return toggleUsageWeekday(item);
67599
+ }
66952
67600
  if (action === "toggle-hours") {
66953
67601
  return toggleWeeklyResetHoursOnly(item);
66954
67602
  }
@@ -66968,8 +67616,10 @@ class WeeklyResetTimerWidget {
66968
67616
  return formatRawOrLabeledValue(item, "周重置 ", `[${progressBar}] ${previewPercent.toFixed(1)}%`);
66969
67617
  }
66970
67618
  if (dateMode) {
66971
- const resetAt = formatUsageResetAt(WEEKLY_RESET_PREVIEW_AT, compact2, getUsageTimezone(item), getUsageLocale(item), isUsage12HourClock(item));
66972
- return formatRawOrLabeledValue(item, "周重置: ", resetAt ?? (compact2 ? "03-15 08:30Z" : "2026-03-15 08:30 UTC"));
67619
+ const weekday = isUsageWeekdayEnabled(item);
67620
+ const resetAt = formatUsageResetAt(WEEKLY_RESET_PREVIEW_AT, compact2, getUsageTimezone(item), getUsageLocale(item), isUsage12HourClock(item), weekday);
67621
+ const fallback = weekday ? compact2 ? "Sun 08:30Z" : "Sun 08:30 UTC" : compact2 ? "03-15 08:30Z" : "2026-03-15 08:30 UTC";
67622
+ return formatRawOrLabeledValue(item, "周重置: ", resetAt ?? fallback);
66973
67623
  }
66974
67624
  return formatRawOrLabeledValue(item, "周重置: ", formatUsageDuration(WEEKLY_PREVIEW_DURATION_MS, compact2, useDays));
66975
67625
  }
@@ -66991,7 +67641,7 @@ class WeeklyResetTimerWidget {
66991
67641
  if (dateMode) {
66992
67642
  const timezone = getUsageTimezone(item);
66993
67643
  const locale = getUsageLocale(item);
66994
- const resetAt = formatUsageResetAt(usageData.weeklyResetAt, compact2, timezone, locale, isUsage12HourClock(item));
67644
+ const resetAt = formatUsageResetAt(usageData.weeklyResetAt, compact2, timezone, locale, isUsage12HourClock(item), isUsageWeekdayEnabled(item));
66995
67645
  if (resetAt) {
66996
67646
  return formatRawOrLabeledValue(item, "周重置: ", resetAt);
66997
67647
  }
@@ -67003,6 +67653,7 @@ class WeeklyResetTimerWidget {
67003
67653
  const keybinds = getUsageTimerCustomKeybinds(item, {
67004
67654
  includeDate: true,
67005
67655
  includeHourFormat: true,
67656
+ includeWeekday: true,
67006
67657
  includeLocale: true,
67007
67658
  includeTimezone: true
67008
67659
  });
@@ -68001,6 +68652,137 @@ var init_CompactionCounter = __esm(() => {
68001
68652
  FORMATS3 = ["icon-space-number", "text-and-number", "number"];
68002
68653
  });
68003
68654
 
68655
+ // src/widgets/RemoteControlStatus.ts
68656
+ function getFormat4(item) {
68657
+ const f = item.metadata?.format;
68658
+ return FORMATS4.includes(f ?? "") ? f : DEFAULT_FORMAT4;
68659
+ }
68660
+ function setFormat4(item, format) {
68661
+ if (format === DEFAULT_FORMAT4) {
68662
+ const { format: removedFormat, ...restMetadata } = item.metadata ?? {};
68663
+ return {
68664
+ ...item,
68665
+ metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
68666
+ };
68667
+ }
68668
+ return {
68669
+ ...item,
68670
+ metadata: {
68671
+ ...item.metadata ?? {},
68672
+ format
68673
+ }
68674
+ };
68675
+ }
68676
+ function isNerdFontEnabled4(item) {
68677
+ return item.metadata?.[NERD_FONT_METADATA_KEY4] === "true";
68678
+ }
68679
+ function toggleNerdFont4(item) {
68680
+ if (!isNerdFontEnabled4(item)) {
68681
+ return {
68682
+ ...item,
68683
+ metadata: {
68684
+ ...item.metadata ?? {},
68685
+ [NERD_FONT_METADATA_KEY4]: "true"
68686
+ }
68687
+ };
68688
+ }
68689
+ const { [NERD_FONT_METADATA_KEY4]: removedNerdFont, ...restMetadata } = item.metadata ?? {};
68690
+ return {
68691
+ ...item,
68692
+ metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
68693
+ };
68694
+ }
68695
+ function formatStatus2(enabled, format, nerdFont) {
68696
+ const stateText = enabled ? "启用" : "关闭";
68697
+ const stateDot = enabled ? STATE_DOT_ON2 : STATE_DOT_OFF2;
68698
+ const icon = nerdFont ? enabled ? SATELLITE_NERD_FONT : SATELLITE_SLASH_NERD_FONT : SATELLITE_EMOJI;
68699
+ switch (format) {
68700
+ case "icon":
68701
+ return nerdFont ? icon : `${icon} ${stateDot}`;
68702
+ case "icon-text":
68703
+ return `${icon} ${stateText}`;
68704
+ case "text":
68705
+ return stateText;
68706
+ case "word":
68707
+ return `远程 ${stateText}`;
68708
+ case "label-check":
68709
+ return `远程 ${enabled ? CHECK_EMOJI : CROSS_EMOJI}`;
68710
+ case "label-mark":
68711
+ return `远程 ${enabled ? CHECK_MARK : CROSS_MARK}`;
68712
+ }
68713
+ }
68714
+
68715
+ class RemoteControlStatusWidget {
68716
+ getDefaultColor() {
68717
+ return "blue";
68718
+ }
68719
+ getDescription() {
68720
+ return "显示 Claude Code 远程控制是否已连接到当前会话";
68721
+ }
68722
+ getDisplayName() {
68723
+ return "远程控制状态";
68724
+ }
68725
+ getCategory() {
68726
+ return "核心";
68727
+ }
68728
+ getEditorDisplay(item) {
68729
+ const modifiers = [getFormat4(item)];
68730
+ if (isNerdFontEnabled4(item)) {
68731
+ modifiers.push("Nerd 字体");
68732
+ }
68733
+ return {
68734
+ displayText: this.getDisplayName(),
68735
+ modifierText: `(${modifiers.join(", ")})`
68736
+ };
68737
+ }
68738
+ handleEditorAction(action, item) {
68739
+ if (action === CYCLE_FORMAT_ACTION4) {
68740
+ const currentFormat = getFormat4(item);
68741
+ const nextFormat = FORMATS4[(FORMATS4.indexOf(currentFormat) + 1) % FORMATS4.length] ?? DEFAULT_FORMAT4;
68742
+ return setFormat4(item, nextFormat);
68743
+ }
68744
+ if (action === TOGGLE_NERD_FONT_ACTION4) {
68745
+ return toggleNerdFont4(item);
68746
+ }
68747
+ return null;
68748
+ }
68749
+ render(item, context, _settings) {
68750
+ const format = getFormat4(item);
68751
+ const nerdFont = isNerdFontEnabled4(item);
68752
+ if (context.isPreview) {
68753
+ if (item.rawValue) {
68754
+ return "on";
68755
+ }
68756
+ return formatStatus2(true, format, nerdFont);
68757
+ }
68758
+ const status = getRemoteControlStatus(context.data?.session_id);
68759
+ if (status === null) {
68760
+ return null;
68761
+ }
68762
+ if (item.rawValue) {
68763
+ return status.enabled ? "on" : "off";
68764
+ }
68765
+ return formatStatus2(status.enabled, format, nerdFont);
68766
+ }
68767
+ getCustomKeybinds() {
68768
+ return [
68769
+ { key: "f", label: "(f)显示格式", action: CYCLE_FORMAT_ACTION4 },
68770
+ { key: "n", label: "(n)erd 字体", action: TOGGLE_NERD_FONT_ACTION4 }
68771
+ ];
68772
+ }
68773
+ supportsRawValue() {
68774
+ return true;
68775
+ }
68776
+ supportsColors(_item) {
68777
+ return true;
68778
+ }
68779
+ }
68780
+ var SATELLITE_EMOJI = "\uD83D\uDCE1", SATELLITE_NERD_FONT = "", SATELLITE_SLASH_NERD_FONT = "", STATE_DOT_OFF2 = "○", STATE_DOT_ON2 = "◉", FORMATS4, CHECK_EMOJI = "✅", CROSS_EMOJI = "❌", CHECK_MARK = "✓", CROSS_MARK = "✗", DEFAULT_FORMAT4 = "icon", CYCLE_FORMAT_ACTION4 = "cycle-format", TOGGLE_NERD_FONT_ACTION4 = "toggle-nerd-font", NERD_FONT_METADATA_KEY4 = "nerdFont";
68781
+ var init_RemoteControlStatus = __esm(async () => {
68782
+ await init_claude_settings();
68783
+ FORMATS4 = ["icon", "icon-text", "text", "word", "label-check", "label-mark"];
68784
+ });
68785
+
68004
68786
  // src/widgets/index.ts
68005
68787
  var init_widgets = __esm(async () => {
68006
68788
  init_GitBranch();
@@ -68071,7 +68853,8 @@ var init_widgets = __esm(async () => {
68071
68853
  init_ContextBar(),
68072
68854
  init_Link(),
68073
68855
  init_Skills(),
68074
- init_ThinkingEffort()
68856
+ init_ThinkingEffort(),
68857
+ init_RemoteControlStatus()
68075
68858
  ]);
68076
68859
  });
68077
68860
 
@@ -68153,6 +68936,7 @@ var init_widget_manifest = __esm(async () => {
68153
68936
  { type: "thinking-effort", create: () => new ThinkingEffortWidget },
68154
68937
  { type: "vim-mode", create: () => new VimModeWidget },
68155
68938
  { type: "voice-status", create: () => new VoiceStatusWidget },
68939
+ { type: "remote-control-status", create: () => new RemoteControlStatusWidget },
68156
68940
  { type: "worktree-mode", create: () => new GitWorktreeModeWidget },
68157
68941
  { type: "worktree-name", create: () => new GitWorktreeNameWidget },
68158
68942
  { type: "worktree-branch", create: () => new GitWorktreeBranchWidget },
@@ -68337,11 +69121,11 @@ var init_hooks = __esm(async () => {
68337
69121
  });
68338
69122
 
68339
69123
  // src/utils/config.ts
68340
- import * as fs10 from "fs";
68341
- import * as os8 from "os";
68342
- import * as path7 from "path";
69124
+ import * as fs11 from "fs";
69125
+ import * as os9 from "os";
69126
+ import * as path8 from "path";
68343
69127
  function initConfigPath(filePath) {
68344
- settingsPath = filePath ? path7.resolve(filePath) : DEFAULT_SETTINGS_PATH;
69128
+ settingsPath = filePath ? path8.resolve(filePath) : DEFAULT_SETTINGS_PATH;
68345
69129
  }
68346
69130
  function getConfigPath() {
68347
69131
  return settingsPath;
@@ -68350,13 +69134,13 @@ function isCustomConfigPath() {
68350
69134
  return settingsPath !== DEFAULT_SETTINGS_PATH;
68351
69135
  }
68352
69136
  function getSettingsPaths() {
68353
- const configDir = path7.dirname(settingsPath);
68354
- const parsedPath = path7.parse(settingsPath);
69137
+ const configDir = path8.dirname(settingsPath);
69138
+ const parsedPath = path8.parse(settingsPath);
68355
69139
  const backupBaseName = parsedPath.ext ? `${parsedPath.name}.bak` : `${parsedPath.base}.bak`;
68356
69140
  return {
68357
69141
  configDir,
68358
69142
  settingsPath,
68359
- settingsBackupPath: path7.join(configDir, backupBaseName)
69143
+ settingsBackupPath: path8.join(configDir, backupBaseName)
68360
69144
  };
68361
69145
  }
68362
69146
  async function writeSettingsJson(settings, paths) {
@@ -68365,7 +69149,7 @@ async function writeSettingsJson(settings, paths) {
68365
69149
  }
68366
69150
  async function backupBadSettings(paths) {
68367
69151
  try {
68368
- if (fs10.existsSync(paths.settingsPath)) {
69152
+ if (fs11.existsSync(paths.settingsPath)) {
68369
69153
  const content = await readFile3(paths.settingsPath, "utf-8");
68370
69154
  await writeFile(paths.settingsBackupPath, content, "utf-8");
68371
69155
  console.error(`Bad settings backed up to ${paths.settingsBackupPath}`);
@@ -68395,7 +69179,7 @@ async function recoverWithDefaults(paths) {
68395
69179
  async function loadSettings() {
68396
69180
  const paths = getSettingsPaths();
68397
69181
  try {
68398
- if (!fs10.existsSync(paths.settingsPath))
69182
+ if (!fs11.existsSync(paths.settingsPath))
68399
69183
  return await writeDefaultSettings(paths);
68400
69184
  const content = await readFile3(paths.settingsPath, "utf-8");
68401
69185
  let rawData;
@@ -68446,7 +69230,7 @@ async function saveSettings(settings) {
68446
69230
  }
68447
69231
  async function saveInstallationMetadata(metadata) {
68448
69232
  const paths = getSettingsPaths();
68449
- if (!metadata && !fs10.existsSync(paths.settingsPath)) {
69233
+ if (!metadata && !fs11.existsSync(paths.settingsPath)) {
68450
69234
  return;
68451
69235
  }
68452
69236
  const settings = await loadSettings();
@@ -68466,18 +69250,18 @@ var init_config = __esm(async () => {
68466
69250
  init_Settings();
68467
69251
  init_migrations();
68468
69252
  await init_widgets2();
68469
- readFile3 = fs10.promises.readFile;
68470
- writeFile = fs10.promises.writeFile;
68471
- mkdir = fs10.promises.mkdir;
68472
- DEFAULT_SETTINGS_PATH = path7.join(os8.homedir(), ".config", "ccstatusline", "settings.json");
69253
+ readFile3 = fs11.promises.readFile;
69254
+ writeFile = fs11.promises.writeFile;
69255
+ mkdir = fs11.promises.mkdir;
69256
+ DEFAULT_SETTINGS_PATH = path8.join(os9.homedir(), ".config", "ccstatusline", "settings.json");
68473
69257
  settingsPath = DEFAULT_SETTINGS_PATH;
68474
69258
  });
68475
69259
 
68476
69260
  // src/utils/claude-settings.ts
68477
69261
  import { execSync as execSync4 } from "child_process";
68478
- import * as fs11 from "fs";
68479
- import * as os9 from "os";
68480
- import * as path8 from "path";
69262
+ import * as fs12 from "fs";
69263
+ import * as os10 from "os";
69264
+ import * as path9 from "path";
68481
69265
  function isKnownCommand(command) {
68482
69266
  const prefixes = [CCSTATUSLINE_COMMANDS.AUTO_NPX, CCSTATUSLINE_COMMANDS.AUTO_BUNX, CCSTATUSLINE_COMMANDS.GLOBAL];
68483
69267
  return prefixes.some((prefix) => command === prefix || command.startsWith(`${prefix} --config `)) || /(?:^|[\s"'\\/])ccstatusline\.ts(?=$|[\s"'])/.test(command);
@@ -68501,9 +69285,9 @@ function getClaudeConfigDir() {
68501
69285
  const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
68502
69286
  if (envConfigDir) {
68503
69287
  try {
68504
- const resolvedPath = path8.resolve(envConfigDir);
68505
- if (fs11.existsSync(resolvedPath)) {
68506
- const stats = fs11.statSync(resolvedPath);
69288
+ const resolvedPath = path9.resolve(envConfigDir);
69289
+ if (fs12.existsSync(resolvedPath)) {
69290
+ const stats = fs12.statSync(resolvedPath);
68507
69291
  if (stats.isDirectory()) {
68508
69292
  return resolvedPath;
68509
69293
  }
@@ -68512,24 +69296,24 @@ function getClaudeConfigDir() {
68512
69296
  }
68513
69297
  } catch {}
68514
69298
  }
68515
- return path8.join(os9.homedir(), ".claude");
69299
+ return path9.join(os10.homedir(), ".claude");
68516
69300
  }
68517
69301
  function getClaudeJsonPath() {
68518
69302
  const configDir = getClaudeConfigDir();
68519
69303
  const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
68520
- if (envConfigDir && configDir === path8.resolve(envConfigDir)) {
68521
- return path8.join(configDir, ".claude.json");
69304
+ if (envConfigDir && configDir === path9.resolve(envConfigDir)) {
69305
+ return path9.join(configDir, ".claude.json");
68522
69306
  }
68523
- return path8.join(path8.dirname(configDir), ".claude.json");
69307
+ return path9.join(path9.dirname(configDir), ".claude.json");
68524
69308
  }
68525
69309
  function getClaudeSettingsPath() {
68526
- return path8.join(getClaudeConfigDir(), "settings.json");
69310
+ return path9.join(getClaudeConfigDir(), "settings.json");
68527
69311
  }
68528
69312
  async function backupClaudeSettings(suffix = ".bak") {
68529
69313
  const settingsPath2 = getClaudeSettingsPath();
68530
69314
  const backupPath = settingsPath2 + suffix;
68531
69315
  try {
68532
- if (fs11.existsSync(settingsPath2)) {
69316
+ if (fs12.existsSync(settingsPath2)) {
68533
69317
  const content = await readFile4(settingsPath2, "utf-8");
68534
69318
  await writeFile2(backupPath, content, "utf-8");
68535
69319
  return backupPath;
@@ -68542,11 +69326,11 @@ async function backupClaudeSettings(suffix = ".bak") {
68542
69326
  function loadClaudeSettingsSync(options = {}) {
68543
69327
  const { logErrors = true } = options;
68544
69328
  const settingsPath2 = getClaudeSettingsPath();
68545
- if (!fs11.existsSync(settingsPath2)) {
69329
+ if (!fs12.existsSync(settingsPath2)) {
68546
69330
  return {};
68547
69331
  }
68548
69332
  try {
68549
- const content = fs11.readFileSync(settingsPath2, "utf-8");
69333
+ const content = fs12.readFileSync(settingsPath2, "utf-8");
68550
69334
  return JSON.parse(content);
68551
69335
  } catch (error51) {
68552
69336
  if (logErrors) {
@@ -68558,7 +69342,7 @@ function loadClaudeSettingsSync(options = {}) {
68558
69342
  async function loadClaudeSettings(options = {}) {
68559
69343
  const { logErrors = true } = options;
68560
69344
  const settingsPath2 = getClaudeSettingsPath();
68561
- if (!fs11.existsSync(settingsPath2)) {
69345
+ if (!fs12.existsSync(settingsPath2)) {
68562
69346
  return {};
68563
69347
  }
68564
69348
  try {
@@ -68573,7 +69357,7 @@ async function loadClaudeSettings(options = {}) {
68573
69357
  }
68574
69358
  async function saveClaudeSettings(settings) {
68575
69359
  const settingsPath2 = getClaudeSettingsPath();
68576
- const dir = path8.dirname(settingsPath2);
69360
+ const dir = path9.dirname(settingsPath2);
68577
69361
  await backupClaudeSettings();
68578
69362
  await mkdir2(dir, { recursive: true });
68579
69363
  await writeFile2(settingsPath2, JSON.stringify(settings, null, 2), "utf-8");
@@ -68591,7 +69375,7 @@ async function isInstalled() {
68591
69375
  function isExecutableAvailable(executable) {
68592
69376
  try {
68593
69377
  const command = process.platform === "win32" ? `where ${executable}` : `which ${executable}`;
68594
- execSync4(command, { stdio: "ignore" });
69378
+ execSync4(command, { stdio: "ignore", windowsHide: true });
68595
69379
  return true;
68596
69380
  } catch {
68597
69381
  return false;
@@ -68619,7 +69403,12 @@ function getPackageCommandAvailability() {
68619
69403
  }
68620
69404
  function getClaudeCodeVersion() {
68621
69405
  try {
68622
- const output = execSync4("claude --version", { encoding: "utf-8", stdio: ["pipe", "pipe", "ignore"], timeout: 5000 }).trim();
69406
+ const output = execSync4("claude --version", {
69407
+ encoding: "utf-8",
69408
+ stdio: ["pipe", "pipe", "ignore"],
69409
+ timeout: 5000,
69410
+ windowsHide: true
69411
+ }).trim();
68623
69412
  const match = /^(\d+\.\d+\.\d+)/.exec(output);
68624
69413
  return match?.[1] ?? null;
68625
69414
  } catch {
@@ -68706,7 +69495,7 @@ function classifyInstallation(command, metadata) {
68706
69495
  }
68707
69496
  async function loadSavedSettingsForHookSync() {
68708
69497
  const configPath = getConfigPath();
68709
- if (!fs11.existsSync(configPath)) {
69498
+ if (!fs12.existsSync(configPath)) {
68710
69499
  return null;
68711
69500
  }
68712
69501
  try {
@@ -68807,19 +69596,19 @@ async function setRefreshInterval(interval) {
68807
69596
  }
68808
69597
  function getVoiceConfigCandidatePathsByPriority(cwd2) {
68809
69598
  const userDir = getClaudeConfigDir();
68810
- const projectDir = path8.join(cwd2, ".claude");
69599
+ const projectDir = path9.join(cwd2, ".claude");
68811
69600
  const candidates = [
68812
- path8.join(projectDir, "settings.local.json"),
68813
- path8.join(projectDir, "settings.json"),
68814
- path8.join(userDir, "settings.local.json"),
68815
- path8.join(userDir, "settings.json")
69601
+ path9.join(projectDir, "settings.local.json"),
69602
+ path9.join(projectDir, "settings.json"),
69603
+ path9.join(userDir, "settings.local.json"),
69604
+ path9.join(userDir, "settings.json")
68816
69605
  ];
68817
69606
  return Array.from(new Set(candidates));
68818
69607
  }
68819
69608
  function tryReadVoiceLayer(filePath) {
68820
69609
  let content;
68821
69610
  try {
68822
- content = fs11.readFileSync(filePath, "utf-8");
69611
+ content = fs12.readFileSync(filePath, "utf-8");
68823
69612
  } catch (error51) {
68824
69613
  const isMissing = error51.code === "ENOENT";
68825
69614
  return { fileExisted: !isMissing, enabled: undefined };
@@ -68849,14 +69638,50 @@ function getVoiceConfig(cwd2 = process.cwd()) {
68849
69638
  }
68850
69639
  return anyFileExisted ? { enabled: false } : null;
68851
69640
  }
68852
- var readFile4, writeFile2, mkdir2, CCSTATUSLINE_COMMANDS, PINNED_INSTALL_COMMANDS, VoiceConfigSchema;
69641
+ function getRemoteControlStatus(sessionId) {
69642
+ if (!sessionId) {
69643
+ return null;
69644
+ }
69645
+ const sessionsDir = path9.join(getClaudeConfigDir(), "sessions");
69646
+ let entries;
69647
+ try {
69648
+ entries = fs12.readdirSync(sessionsDir);
69649
+ } catch {
69650
+ return null;
69651
+ }
69652
+ for (const entry of entries) {
69653
+ if (!entry.endsWith(".json")) {
69654
+ continue;
69655
+ }
69656
+ let content;
69657
+ try {
69658
+ content = fs12.readFileSync(path9.join(sessionsDir, entry), "utf-8");
69659
+ } catch {
69660
+ continue;
69661
+ }
69662
+ let parsed;
69663
+ try {
69664
+ parsed = JSON.parse(content);
69665
+ } catch {
69666
+ continue;
69667
+ }
69668
+ const result2 = RemoteSessionFileSchema.safeParse(parsed);
69669
+ if (!result2.success || result2.data.sessionId !== sessionId) {
69670
+ continue;
69671
+ }
69672
+ const bridge = result2.data.bridgeSessionId;
69673
+ return { enabled: typeof bridge === "string" && bridge.length > 0 };
69674
+ }
69675
+ return null;
69676
+ }
69677
+ var readFile4, writeFile2, mkdir2, CCSTATUSLINE_COMMANDS, PINNED_INSTALL_COMMANDS, VoiceConfigSchema, RemoteSessionFileSchema;
68853
69678
  var init_claude_settings = __esm(async () => {
68854
69679
  init_zod();
68855
69680
  init_Settings();
68856
69681
  await init_config();
68857
- readFile4 = fs11.promises.readFile;
68858
- writeFile2 = fs11.promises.writeFile;
68859
- mkdir2 = fs11.promises.mkdir;
69682
+ readFile4 = fs12.promises.readFile;
69683
+ writeFile2 = fs12.promises.writeFile;
69684
+ mkdir2 = fs12.promises.mkdir;
68860
69685
  CCSTATUSLINE_COMMANDS = {
68861
69686
  AUTO_NPX: "npx -y ccstatusline-zh@latest",
68862
69687
  AUTO_BUNX: "bunx -y ccstatusline-zh@latest",
@@ -68870,6 +69695,10 @@ var init_claude_settings = __esm(async () => {
68870
69695
  BUN: (version2) => `bun add -g ccstatusline-zh@${version2}`
68871
69696
  };
68872
69697
  VoiceConfigSchema = exports_external.object({ enabled: exports_external.boolean().optional() });
69698
+ RemoteSessionFileSchema = exports_external.object({
69699
+ sessionId: exports_external.string().optional(),
69700
+ bridgeSessionId: exports_external.string().nullable().optional()
69701
+ });
68873
69702
  });
68874
69703
 
68875
69704
  // node_modules/pluralize/pluralize.js
@@ -69458,9 +70287,12 @@ await init_config();
69458
70287
 
69459
70288
  // src/utils/global-command-resolution.ts
69460
70289
  import { execFileSync as execFileSync5 } from "child_process";
69461
- import * as path9 from "path";
70290
+ import * as path10 from "path";
69462
70291
 
69463
70292
  // src/utils/package-manager-executable.ts
70293
+ function getPackageManagerShellOptions(executable, platform2 = process.platform) {
70294
+ return platform2 === "win32" && /\.(?:cmd|bat)$/i.test(executable) ? { shell: true } : {};
70295
+ }
69464
70296
  function getPackageManagerExecutable(packageManager, platform2 = process.platform) {
69465
70297
  return packageManager === "npm" && platform2 === "win32" ? "npm.cmd" : packageManager;
69466
70298
  }
@@ -69485,11 +70317,19 @@ function isTransientBunxStatusLinePath(filePath) {
69485
70317
  return /(?:^|\/)bunx-[^/]*ccstatusline-zh@[^/]+\/node_modules\/\.bin\/ccstatusline-zh(?:\.(?:cmd|ps1))?$/i.test(normalized);
69486
70318
  }
69487
70319
  function getPersistentCommandResolutionPaths(paths) {
69488
- return paths.filter((path10) => !isTransientBunxStatusLinePath(path10));
70320
+ return paths.filter((path11) => !isTransientBunxStatusLinePath(path11));
69489
70321
  }
69490
70322
  function getCommandResolutionPaths(command, { platform: platform2 = process.platform } = {}) {
69491
70323
  try {
69492
- const output = platform2 === "win32" ? execFileSync5("where", [command], { encoding: "utf-8", timeout: COMMAND_LOOKUP_TIMEOUT_MS }) : execFileSync5("which", ["-a", command], { encoding: "utf-8", timeout: COMMAND_LOOKUP_TIMEOUT_MS });
70324
+ const output = platform2 === "win32" ? execFileSync5("where", [command], {
70325
+ encoding: "utf-8",
70326
+ timeout: COMMAND_LOOKUP_TIMEOUT_MS,
70327
+ windowsHide: true
70328
+ }) : execFileSync5("which", ["-a", command], {
70329
+ encoding: "utf-8",
70330
+ timeout: COMMAND_LOOKUP_TIMEOUT_MS,
70331
+ windowsHide: true
70332
+ });
69493
70333
  return splitCommandOutput(output);
69494
70334
  } catch {
69495
70335
  return [];
@@ -69497,14 +70337,17 @@ function getCommandResolutionPaths(command, { platform: platform2 = process.plat
69497
70337
  }
69498
70338
  function getNpmGlobalBinDir(platform2) {
69499
70339
  try {
69500
- const prefix = execFileSync5(getPackageManagerExecutable("npm", platform2), ["prefix", "-g"], {
70340
+ const executable = getPackageManagerExecutable("npm", platform2);
70341
+ const prefix = execFileSync5(executable, ["prefix", "-g"], {
69501
70342
  encoding: "utf-8",
69502
- timeout: COMMAND_LOOKUP_TIMEOUT_MS
70343
+ timeout: COMMAND_LOOKUP_TIMEOUT_MS,
70344
+ windowsHide: true,
70345
+ ...getPackageManagerShellOptions(executable, platform2)
69503
70346
  }).trim();
69504
70347
  if (!prefix) {
69505
70348
  return null;
69506
70349
  }
69507
- return platform2 === "win32" || /^[a-z]:[\\/]/i.test(prefix) ? prefix : path9.join(prefix, "bin");
70350
+ return platform2 === "win32" || /^[a-z]:[\\/]/i.test(prefix) ? prefix : path10.join(prefix, "bin");
69508
70351
  } catch {
69509
70352
  return null;
69510
70353
  }
@@ -69513,7 +70356,8 @@ function getBunGlobalBinDir() {
69513
70356
  try {
69514
70357
  const binDir = execFileSync5("bun", ["pm", "bin", "-g"], {
69515
70358
  encoding: "utf-8",
69516
- timeout: COMMAND_LOOKUP_TIMEOUT_MS
70359
+ timeout: COMMAND_LOOKUP_TIMEOUT_MS,
70360
+ windowsHide: true
69517
70361
  }).trim();
69518
70362
  return binDir || null;
69519
70363
  } catch {
@@ -69607,7 +70451,7 @@ import {
69607
70451
  execFile,
69608
70452
  execFileSync as execFileSync6
69609
70453
  } from "child_process";
69610
- import * as fs12 from "fs";
70454
+ import * as fs13 from "fs";
69611
70455
  var GLOBAL_PACKAGE_TIMEOUT_MS = 120000;
69612
70456
  var VERSION_LOOKUP_TIMEOUT_MS = 5000;
69613
70457
  var WINDOWS_SHIM_EXTENSIONS = [
@@ -69656,7 +70500,7 @@ function getBinaryPathCandidates(binDir, platform2) {
69656
70500
  return extensions.map((extension) => appendPathSegment(binDir, `ccstatusline-zh${extension}`));
69657
70501
  }
69658
70502
  function hasBinaryOnDisk(binDir, platform2) {
69659
- return getBinaryPathCandidates(binDir, platform2).some((candidate) => getFilesystemPathVariants(candidate).some((variant) => fs12.existsSync(variant)));
70503
+ return getBinaryPathCandidates(binDir, platform2).some((candidate) => getFilesystemPathVariants(candidate).some((variant) => fs13.existsSync(variant)));
69660
70504
  }
69661
70505
  function hasResolvedBinaryInDir(resolvedPaths, binDir) {
69662
70506
  return resolvedPaths.some((resolvedPath) => isPathInsideDir(resolvedPath, binDir));
@@ -69689,10 +70533,10 @@ function formatPathList2(paths) {
69689
70533
  function readPackageVersion(packageJsonPath) {
69690
70534
  for (const variant of getFilesystemPathVariants(packageJsonPath)) {
69691
70535
  try {
69692
- if (!fs12.existsSync(variant)) {
70536
+ if (!fs13.existsSync(variant)) {
69693
70537
  continue;
69694
70538
  }
69695
- const packageJson = JSON.parse(fs12.readFileSync(variant, "utf-8"));
70539
+ const packageJson = JSON.parse(fs13.readFileSync(variant, "utf-8"));
69696
70540
  return typeof packageJson.version === "string" ? packageJson.version : null;
69697
70541
  } catch {
69698
70542
  return null;
@@ -69702,9 +70546,12 @@ function readPackageVersion(packageJsonPath) {
69702
70546
  }
69703
70547
  function getNpmGlobalPackageVersion(platform2) {
69704
70548
  try {
69705
- const rootDir = execFileSync6(getPackageManagerExecutable("npm", platform2), ["root", "-g"], {
70549
+ const executable = getPackageManagerExecutable("npm", platform2);
70550
+ const rootDir = execFileSync6(executable, ["root", "-g"], {
69706
70551
  encoding: "utf-8",
69707
- timeout: VERSION_LOOKUP_TIMEOUT_MS
70552
+ timeout: VERSION_LOOKUP_TIMEOUT_MS,
70553
+ windowsHide: true,
70554
+ ...getPackageManagerShellOptions(executable, platform2)
69708
70555
  }).trim();
69709
70556
  return rootDir ? readPackageVersion(appendPathSegment(appendPathSegment(rootDir, "ccstatusline-zh"), "package.json")) : null;
69710
70557
  } catch {
@@ -69810,20 +70657,24 @@ function inspectGlobalPackageInstallations({
69810
70657
  function runGlobalPackageUninstall(packageManager, { platform: platform2 = process.platform } = {}) {
69811
70658
  const executable = getPackageManagerExecutable(packageManager, platform2);
69812
70659
  const args = packageManager === "npm" ? ["uninstall", "-g", "ccstatusline-zh"] : ["remove", "-g", "ccstatusline-zh"];
69813
- return new Promise((resolve5, reject2) => {
69814
- execFile(executable, args, { timeout: GLOBAL_PACKAGE_TIMEOUT_MS }, (error51) => {
70660
+ return new Promise((resolve6, reject2) => {
70661
+ execFile(executable, args, {
70662
+ timeout: GLOBAL_PACKAGE_TIMEOUT_MS,
70663
+ windowsHide: true,
70664
+ ...getPackageManagerShellOptions(executable, platform2)
70665
+ }, (error51) => {
69815
70666
  if (error51) {
69816
70667
  reject2(error51 instanceof Error ? error51 : new Error("全局卸载命令执行失败"));
69817
70668
  return;
69818
70669
  }
69819
- resolve5();
70670
+ resolve6();
69820
70671
  });
69821
70672
  });
69822
70673
  }
69823
70674
 
69824
70675
  // src/utils/open-url.ts
69825
70676
  import { spawnSync } from "child_process";
69826
- import * as os10 from "os";
70677
+ import * as os11 from "os";
69827
70678
  function runOpenCommand(command, args) {
69828
70679
  const result2 = spawnSync(command, args, {
69829
70680
  stdio: "ignore",
@@ -69882,7 +70733,7 @@ function openExternalUrl(url2) {
69882
70733
  error: "Only http(s) URLs are supported"
69883
70734
  };
69884
70735
  }
69885
- const platform3 = os10.platform();
70736
+ const platform3 = os11.platform();
69886
70737
  const plans = PLATFORM_OPEN_PLANS[platform3];
69887
70738
  if (!plans) {
69888
70739
  return {
@@ -69910,9 +70761,9 @@ function openExternalUrl(url2) {
69910
70761
 
69911
70762
  // src/utils/powerline.ts
69912
70763
  import { execSync as execSync5 } from "child_process";
69913
- import * as fs13 from "fs";
69914
- import * as os11 from "os";
69915
- import * as path10 from "path";
70764
+ import * as fs14 from "fs";
70765
+ import * as os12 from "os";
70766
+ import * as path11 from "path";
69916
70767
  var fontsInstalledThisSession = false;
69917
70768
  function checkPowerlineFonts() {
69918
70769
  if (process.env.DEBUG_FONT_INSTALL === "1" && !fontsInstalledThisSession) {
@@ -69928,24 +70779,24 @@ function checkPowerlineFonts() {
69928
70779
  leftArrow: "",
69929
70780
  leftThinArrow: ""
69930
70781
  };
69931
- const platform4 = os11.platform();
70782
+ const platform4 = os12.platform();
69932
70783
  let fontPaths = [];
69933
70784
  if (platform4 === "darwin") {
69934
70785
  fontPaths = [
69935
- path10.join(os11.homedir(), "Library", "Fonts"),
70786
+ path11.join(os12.homedir(), "Library", "Fonts"),
69936
70787
  "/Library/Fonts",
69937
70788
  "/System/Library/Fonts"
69938
70789
  ];
69939
70790
  } else if (platform4 === "linux") {
69940
70791
  fontPaths = [
69941
- path10.join(os11.homedir(), ".local", "share", "fonts"),
69942
- path10.join(os11.homedir(), ".fonts"),
70792
+ path11.join(os12.homedir(), ".local", "share", "fonts"),
70793
+ path11.join(os12.homedir(), ".fonts"),
69943
70794
  "/usr/share/fonts",
69944
70795
  "/usr/local/share/fonts"
69945
70796
  ];
69946
70797
  } else if (platform4 === "win32") {
69947
70798
  fontPaths = [
69948
- path10.join(os11.homedir(), "AppData", "Local", "Microsoft", "Windows", "Fonts"),
70799
+ path11.join(os12.homedir(), "AppData", "Local", "Microsoft", "Windows", "Fonts"),
69949
70800
  "C:\\Windows\\Fonts"
69950
70801
  ];
69951
70802
  }
@@ -69961,9 +70812,9 @@ function checkPowerlineFonts() {
69961
70812
  /fira.*code.*nerd/i
69962
70813
  ];
69963
70814
  for (const fontPath of fontPaths) {
69964
- if (fs13.existsSync(fontPath)) {
70815
+ if (fs14.existsSync(fontPath)) {
69965
70816
  try {
69966
- const files = fs13.readdirSync(fontPath);
70817
+ const files = fs14.readdirSync(fontPath);
69967
70818
  for (const file2 of files) {
69968
70819
  for (const pattern of powerlineFontPatterns) {
69969
70820
  if (pattern.test(file2)) {
@@ -69998,13 +70849,16 @@ async function checkPowerlineFontsAsync() {
69998
70849
  if (quickCheck.installed) {
69999
70850
  return quickCheck;
70000
70851
  }
70001
- const platform4 = os11.platform();
70852
+ const platform4 = os12.platform();
70002
70853
  if (platform4 === "linux" || platform4 === "darwin") {
70003
70854
  try {
70004
70855
  const { exec: exec2 } = await import("child_process");
70005
70856
  const { promisify: promisify2 } = await import("util");
70006
70857
  const execAsync = promisify2(exec2);
70007
- const { stdout } = await execAsync("fc-list 2>/dev/null | grep -i powerline", { encoding: "utf8" });
70858
+ const { stdout } = await execAsync("fc-list 2>/dev/null | grep -i powerline", {
70859
+ encoding: "utf8",
70860
+ windowsHide: true
70861
+ });
70008
70862
  if (stdout.trim()) {
70009
70863
  return {
70010
70864
  installed: true,
@@ -70021,46 +70875,49 @@ async function checkPowerlineFontsAsync() {
70021
70875
  async function installPowerlineFonts() {
70022
70876
  await Promise.resolve();
70023
70877
  try {
70024
- const platform4 = os11.platform();
70878
+ const platform4 = os12.platform();
70025
70879
  let fontDir;
70026
70880
  if (platform4 === "darwin") {
70027
- fontDir = path10.join(os11.homedir(), "Library", "Fonts");
70881
+ fontDir = path11.join(os12.homedir(), "Library", "Fonts");
70028
70882
  } else if (platform4 === "linux") {
70029
- fontDir = path10.join(os11.homedir(), ".local", "share", "fonts");
70883
+ fontDir = path11.join(os12.homedir(), ".local", "share", "fonts");
70030
70884
  } else if (platform4 === "win32") {
70031
- fontDir = path10.join(os11.homedir(), "AppData", "Local", "Microsoft", "Windows", "Fonts");
70885
+ fontDir = path11.join(os12.homedir(), "AppData", "Local", "Microsoft", "Windows", "Fonts");
70032
70886
  } else {
70033
70887
  return {
70034
70888
  success: false,
70035
70889
  message: "Unsupported platform for font installation"
70036
70890
  };
70037
70891
  }
70038
- if (!fs13.existsSync(fontDir)) {
70039
- fs13.mkdirSync(fontDir, { recursive: true });
70892
+ if (!fs14.existsSync(fontDir)) {
70893
+ fs14.mkdirSync(fontDir, { recursive: true });
70040
70894
  }
70041
- const tempDir = path10.join(os11.tmpdir(), `ccstatusline-powerline-fonts-${Date.now()}`);
70895
+ const tempDir = path11.join(os12.tmpdir(), `ccstatusline-powerline-fonts-${Date.now()}`);
70042
70896
  try {
70043
- if (fs13.existsSync(tempDir)) {
70044
- fs13.rmSync(tempDir, { recursive: true, force: true });
70897
+ if (fs14.existsSync(tempDir)) {
70898
+ fs14.rmSync(tempDir, { recursive: true, force: true });
70045
70899
  }
70046
70900
  execSync5(`git clone --depth=1 https://github.com/powerline/fonts.git "${tempDir}"`, {
70047
70901
  stdio: "pipe",
70048
- encoding: "utf8"
70902
+ encoding: "utf8",
70903
+ windowsHide: true
70049
70904
  });
70050
70905
  if (platform4 === "darwin" || platform4 === "linux") {
70051
- const installScript = path10.join(tempDir, "install.sh");
70052
- if (fs13.existsSync(installScript)) {
70053
- fs13.chmodSync(installScript, 493);
70906
+ const installScript = path11.join(tempDir, "install.sh");
70907
+ if (fs14.existsSync(installScript)) {
70908
+ fs14.chmodSync(installScript, 493);
70054
70909
  execSync5(`cd "${tempDir}" && ./install.sh`, {
70055
70910
  stdio: "pipe",
70056
70911
  encoding: "utf8",
70057
- shell: "/bin/bash"
70912
+ shell: "/bin/bash",
70913
+ windowsHide: true
70058
70914
  });
70059
70915
  if (platform4 === "linux") {
70060
70916
  try {
70061
70917
  execSync5("fc-cache -f -v", {
70062
70918
  stdio: "pipe",
70063
- encoding: "utf8"
70919
+ encoding: "utf8",
70920
+ windowsHide: true
70064
70921
  });
70065
70922
  } catch {}
70066
70923
  }
@@ -70076,10 +70933,10 @@ async function installPowerlineFonts() {
70076
70933
  }
70077
70934
  } else {
70078
70935
  let findFontFiles = function(dir) {
70079
- const files = fs13.readdirSync(dir);
70936
+ const files = fs14.readdirSync(dir);
70080
70937
  for (const file2 of files) {
70081
- const filePath = path10.join(dir, file2);
70082
- const stat2 = fs13.statSync(filePath);
70938
+ const filePath = path11.join(dir, file2);
70939
+ const stat2 = fs14.statSync(filePath);
70083
70940
  if (stat2.isDirectory() && !file2.startsWith(".")) {
70084
70941
  findFontFiles(filePath);
70085
70942
  } else if (file2.endsWith(".ttf") || file2.endsWith(".otf")) {
@@ -70093,10 +70950,10 @@ async function installPowerlineFonts() {
70093
70950
  findFontFiles(tempDir);
70094
70951
  let installedCount = 0;
70095
70952
  for (const fontFile of fontFiles) {
70096
- const fileName = path10.basename(fontFile);
70097
- const destPath = path10.join(fontDir, fileName);
70953
+ const fileName = path11.basename(fontFile);
70954
+ const destPath = path11.join(fontDir, fileName);
70098
70955
  try {
70099
- fs13.copyFileSync(fontFile, destPath);
70956
+ fs14.copyFileSync(fontFile, destPath);
70100
70957
  installedCount++;
70101
70958
  } catch {}
70102
70959
  }
@@ -70114,9 +70971,9 @@ async function installPowerlineFonts() {
70114
70971
  message: "Platform-specific installation not implemented"
70115
70972
  };
70116
70973
  } finally {
70117
- if (fs13.existsSync(tempDir)) {
70974
+ if (fs14.existsSync(tempDir)) {
70118
70975
  try {
70119
- fs13.rmSync(tempDir, { recursive: true, force: true });
70976
+ fs14.rmSync(tempDir, { recursive: true, force: true });
70120
70977
  } catch {}
70121
70978
  }
70122
70979
  }
@@ -70282,7 +71139,7 @@ async function checkForUpdates({
70282
71139
  }
70283
71140
  }
70284
71141
  function fetchLatestNpmVersion(timeoutMs = DEFAULT_REGISTRY_TIMEOUT_MS) {
70285
- return new Promise((resolve5, reject2) => {
71142
+ return new Promise((resolve6, reject2) => {
70286
71143
  const request3 = https2.request(NPM_REGISTRY_LATEST_URL, {
70287
71144
  headers: {
70288
71145
  Accept: "application/json",
@@ -70306,7 +71163,7 @@ function fetchLatestNpmVersion(timeoutMs = DEFAULT_REGISTRY_TIMEOUT_MS) {
70306
71163
  reject2(new Error("npm 仓库响应中未包含版本号"));
70307
71164
  return;
70308
71165
  }
70309
- resolve5(parsed.version);
71166
+ resolve6(parsed.version);
70310
71167
  } catch (error51) {
70311
71168
  reject2(error51 instanceof Error ? error51 : new Error(String(error51)));
70312
71169
  }
@@ -70322,13 +71179,17 @@ function fetchLatestNpmVersion(timeoutMs = DEFAULT_REGISTRY_TIMEOUT_MS) {
70322
71179
  function runGlobalPackageInstall(packageManager, version2, { platform: platform4 = process.platform } = {}) {
70323
71180
  const executable = getPackageManagerExecutable(packageManager, platform4);
70324
71181
  const args = packageManager === "npm" ? ["install", "-g", `ccstatusline-zh@${version2}`] : ["add", "-g", `ccstatusline-zh@${version2}`];
70325
- return new Promise((resolve5, reject2) => {
70326
- execFile2(executable, args, { timeout: GLOBAL_UPDATE_TIMEOUT_MS }, (error51) => {
71182
+ return new Promise((resolve6, reject2) => {
71183
+ execFile2(executable, args, {
71184
+ timeout: GLOBAL_UPDATE_TIMEOUT_MS,
71185
+ windowsHide: true,
71186
+ ...getPackageManagerShellOptions(executable, platform4)
71187
+ }, (error51) => {
70327
71188
  if (error51) {
70328
71189
  reject2(error51 instanceof Error ? error51 : new Error("全局更新命令执行失败"));
70329
71190
  return;
70330
71191
  }
70331
- resolve5();
71192
+ resolve6();
70332
71193
  });
70333
71194
  });
70334
71195
  }
@@ -70762,6 +71623,7 @@ var SelectInput_default = SelectInput;
70762
71623
  // src/tui/components/ColorMenu.tsx
70763
71624
  init_ColorLevel();
70764
71625
  init_colors();
71626
+ init_gradient();
70765
71627
  init_input_guards();
70766
71628
  await init_widgets2();
70767
71629
  var import_react39 = __toESM(require_react(), 1);
@@ -71066,6 +71928,11 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71066
71928
  const [ansi256InputMode, setAnsi256InputMode] = import_react39.useState(false);
71067
71929
  const [ansi256Input, setAnsi256Input] = import_react39.useState("");
71068
71930
  const [showClearConfirm, setShowClearConfirm] = import_react39.useState(false);
71931
+ const [gradientMode, setGradientMode] = import_react39.useState(false);
71932
+ const [gradientIndex, setGradientIndex] = import_react39.useState(0);
71933
+ const [gradientCustomStep, setGradientCustomStep] = import_react39.useState(null);
71934
+ const [gradientStartHex, setGradientStartHex] = import_react39.useState("");
71935
+ const [gradientHexInput, setGradientHexInput] = import_react39.useState("");
71069
71936
  const powerlineEnabled = settings.powerline.enabled;
71070
71937
  const colorableWidgets = widgets.filter((widget) => {
71071
71938
  if (widget.type === "separator") {
@@ -71145,6 +72012,62 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71145
72012
  }
71146
72013
  return;
71147
72014
  }
72015
+ if (gradientMode) {
72016
+ const exitGradient = () => {
72017
+ setGradientMode(false);
72018
+ setGradientCustomStep(null);
72019
+ setGradientStartHex("");
72020
+ setGradientHexInput("");
72021
+ };
72022
+ const applyGradientValue = (value) => {
72023
+ const selectedWidget2 = colorableWidgets.find((widget) => widget.id === highlightedItemId);
72024
+ if (selectedWidget2) {
72025
+ onUpdate(setWidgetColor(widgets, selectedWidget2.id, value, false));
72026
+ }
72027
+ exitGradient();
72028
+ };
72029
+ if (gradientCustomStep) {
72030
+ if (key.escape) {
72031
+ setGradientCustomStep(null);
72032
+ setGradientHexInput("");
72033
+ } else if (key.return) {
72034
+ if (gradientHexInput.length === 6) {
72035
+ if (gradientCustomStep === "start") {
72036
+ setGradientStartHex(gradientHexInput);
72037
+ setGradientHexInput("");
72038
+ setGradientCustomStep("end");
72039
+ } else {
72040
+ applyGradientValue(`gradient:${gradientStartHex}-${gradientHexInput}`);
72041
+ }
72042
+ }
72043
+ } else if (key.backspace || key.delete) {
72044
+ setGradientHexInput(gradientHexInput.slice(0, -1));
72045
+ } else if (shouldInsertInput(input, key) && gradientHexInput.length < 6) {
72046
+ const upperInput = input.toUpperCase();
72047
+ if (/^[0-9A-F]$/.test(upperInput)) {
72048
+ setGradientHexInput(gradientHexInput + upperInput);
72049
+ }
72050
+ }
72051
+ return;
72052
+ }
72053
+ const total = GRADIENT_PRESET_NAMES.length + 1;
72054
+ if (key.escape) {
72055
+ exitGradient();
72056
+ } else if (key.upArrow) {
72057
+ setGradientIndex((gradientIndex - 1 + total) % total);
72058
+ } else if (key.downArrow) {
72059
+ setGradientIndex((gradientIndex + 1) % total);
72060
+ } else if (key.return) {
72061
+ if (gradientIndex < GRADIENT_PRESET_NAMES.length) {
72062
+ applyGradientValue(`gradient:${GRADIENT_PRESET_NAMES[gradientIndex]}`);
72063
+ } else {
72064
+ setGradientStartHex("");
72065
+ setGradientHexInput("");
72066
+ setGradientCustomStep("start");
72067
+ }
72068
+ }
72069
+ return;
72070
+ }
71148
72071
  if (input && /^[0-9]$/.test(input)) {
71149
72072
  return;
71150
72073
  }
@@ -71164,6 +72087,14 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71164
72087
  setAnsi256InputMode(true);
71165
72088
  setAnsi256Input("");
71166
72089
  }
72090
+ } else if (input === "g" || input === "G") {
72091
+ if (highlightedItemId && highlightedItemId !== "back" && !editingBackground && settings.colorLevel >= 2) {
72092
+ setGradientMode(true);
72093
+ setGradientIndex(0);
72094
+ setGradientCustomStep(null);
72095
+ setGradientStartHex("");
72096
+ setGradientHexInput("");
72097
+ }
71167
72098
  } else if ((input === "s" || input === "S") && !key.ctrl) {
71168
72099
  if (!settings.powerline.enabled && !settings.defaultSeparator) {
71169
72100
  setShowSeparators(!showSeparators);
@@ -71315,6 +72246,13 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71315
72246
  displayName = `ANSI ${currentColor.substring(8)}`;
71316
72247
  } else if (currentColor.startsWith("hex:")) {
71317
72248
  displayName = `#${currentColor.substring(4)}`;
72249
+ } else if (currentColor.startsWith("gradient:")) {
72250
+ const body = currentColor.substring(9);
72251
+ if (GRADIENT_PRESET_NAMES.includes(body.toLowerCase())) {
72252
+ displayName = `Gradient: ${body.toLowerCase()}`;
72253
+ } else {
72254
+ displayName = `Gradient: ${body}`;
72255
+ }
71318
72256
  } else {
71319
72257
  const colorOption = colorOptions.find((c) => c.value === currentColor);
71320
72258
  displayName = colorOption ? colorOption.name : currentColor;
@@ -71323,6 +72261,94 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71323
72261
  colorDisplay = applyColors(displayName, currentColor, undefined, false, level);
71324
72262
  }
71325
72263
  }
72264
+ if (gradientMode) {
72265
+ const level = getColorLevelString(settings.colorLevel);
72266
+ const widgetName = selectedWidget ? getItemLabel(selectedWidget) : "";
72267
+ if (gradientCustomStep) {
72268
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
72269
+ flexDirection: "column",
72270
+ children: [
72271
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72272
+ bold: true,
72273
+ children: [
72274
+ "Custom Gradient",
72275
+ widgetName ? ` - ${widgetName}` : ""
72276
+ ]
72277
+ }, undefined, true, undefined, this),
72278
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
72279
+ marginTop: 1,
72280
+ flexDirection: "column",
72281
+ children: [
72282
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72283
+ children: gradientCustomStep === "start" ? "Enter START hex color (without #):" : "Enter END hex color (without #):"
72284
+ }, undefined, false, undefined, this),
72285
+ gradientCustomStep === "end" && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72286
+ dimColor: true,
72287
+ children: [
72288
+ "Start: #",
72289
+ gradientStartHex
72290
+ ]
72291
+ }, undefined, true, undefined, this),
72292
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72293
+ children: [
72294
+ "#",
72295
+ gradientHexInput,
72296
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72297
+ dimColor: true,
72298
+ children: gradientHexInput.length < 6 ? "_".repeat(6 - gradientHexInput.length) : ""
72299
+ }, undefined, false, undefined, this)
72300
+ ]
72301
+ }, undefined, true, undefined, this),
72302
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72303
+ children: " "
72304
+ }, undefined, false, undefined, this),
72305
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72306
+ dimColor: true,
72307
+ children: "Press Enter when done, ESC to go back"
72308
+ }, undefined, false, undefined, this)
72309
+ ]
72310
+ }, undefined, true, undefined, this)
72311
+ ]
72312
+ }, undefined, true, undefined, this);
72313
+ }
72314
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
72315
+ flexDirection: "column",
72316
+ children: [
72317
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72318
+ bold: true,
72319
+ children: [
72320
+ "Select Gradient",
72321
+ widgetName ? ` - ${widgetName}` : ""
72322
+ ]
72323
+ }, undefined, true, undefined, this),
72324
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
72325
+ marginTop: 1,
72326
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72327
+ dimColor: true,
72328
+ children: "↑↓ to select, Enter to apply, ESC to cancel"
72329
+ }, undefined, false, undefined, this)
72330
+ }, undefined, false, undefined, this),
72331
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
72332
+ marginTop: 1,
72333
+ flexDirection: "column",
72334
+ children: [
72335
+ GRADIENT_PRESET_NAMES.map((name, idx) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72336
+ children: [
72337
+ idx === gradientIndex ? "▶ " : " ",
72338
+ applyColors(name, `gradient:${name}`, undefined, idx === gradientIndex, level)
72339
+ ]
72340
+ }, name, true, undefined, this)),
72341
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72342
+ children: [
72343
+ gradientIndex === GRADIENT_PRESET_NAMES.length ? "▶ " : " ",
72344
+ "Custom (enter two hex stops)"
72345
+ ]
72346
+ }, "custom", true, undefined, this)
72347
+ ]
72348
+ }, undefined, true, undefined, this)
72349
+ ]
72350
+ }, undefined, true, undefined, this);
72351
+ }
71326
72352
  if (showClearConfirm) {
71327
72353
  return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
71328
72354
  flexDirection: "column",
@@ -71451,6 +72477,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71451
72477
  editingBackground ? "背景色" : "前景色",
71452
72478
  ",(f) 前景/背景切换,(b)加粗,",
71453
72479
  settings.colorLevel === 3 ? " (h)十六进制," : settings.colorLevel === 2 ? " (a)nsi256," : "",
72480
+ !editingBackground && settings.colorLevel >= 2 ? " (g)渐变色," : "",
71454
72481
  " ",
71455
72482
  "(r)重置,(c)清除全部,ESC 返回"
71456
72483
  ]
@@ -71530,7 +72557,9 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71530
72557
  }, undefined, true, undefined, this);
71531
72558
  };
71532
72559
  // src/tui/components/GlobalOverridesMenu.tsx
72560
+ init_ColorLevel();
71533
72561
  init_colors();
72562
+ init_gradient();
71534
72563
  init_input_guards();
71535
72564
  await init_build2();
71536
72565
  var import_react40 = __toESM(require_react(), 1);
@@ -71544,6 +72573,11 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
71544
72573
  const [inheritColors, setInheritColors] = import_react40.useState(settings.inheritSeparatorColors);
71545
72574
  const [globalBold, setGlobalBold] = import_react40.useState(settings.globalBold);
71546
72575
  const [minimalistMode, setMinimalistMode] = import_react40.useState(settings.minimalistMode);
72576
+ const [gradientMode, setGradientMode] = import_react40.useState(false);
72577
+ const [gradientIndex, setGradientIndex] = import_react40.useState(0);
72578
+ const [gradientCustomStep, setGradientCustomStep] = import_react40.useState(null);
72579
+ const [gradientStartHex, setGradientStartHex] = import_react40.useState("");
72580
+ const [gradientHexInput, setGradientHexInput] = import_react40.useState("");
71547
72581
  const isPowerlineEnabled = settings.powerline.enabled;
71548
72582
  const hasManualSeparators = settings.lines.some((line) => line.some((item) => item.type === "separator"));
71549
72583
  const bgColors = ["none", ...COLOR_MAP.filter((c) => c.isBackground).map((c) => c.name)];
@@ -71591,6 +72625,60 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
71591
72625
  }
71592
72626
  } else if (confirmingSeparator) {
71593
72627
  return;
72628
+ } else if (gradientMode) {
72629
+ const exitGradient = () => {
72630
+ setGradientMode(false);
72631
+ setGradientCustomStep(null);
72632
+ setGradientStartHex("");
72633
+ setGradientHexInput("");
72634
+ };
72635
+ const applyGradientValue = (value) => {
72636
+ onUpdate({
72637
+ ...settings,
72638
+ overrideForegroundColor: value
72639
+ });
72640
+ exitGradient();
72641
+ };
72642
+ if (gradientCustomStep) {
72643
+ if (key.escape) {
72644
+ setGradientCustomStep(null);
72645
+ setGradientHexInput("");
72646
+ } else if (key.return) {
72647
+ if (gradientHexInput.length === 6) {
72648
+ if (gradientCustomStep === "start") {
72649
+ setGradientStartHex(gradientHexInput);
72650
+ setGradientHexInput("");
72651
+ setGradientCustomStep("end");
72652
+ } else {
72653
+ applyGradientValue(`gradient:${gradientStartHex}-${gradientHexInput}`);
72654
+ }
72655
+ }
72656
+ } else if (key.backspace || key.delete) {
72657
+ setGradientHexInput(gradientHexInput.slice(0, -1));
72658
+ } else if (shouldInsertInput(input, key) && gradientHexInput.length < 6) {
72659
+ const upperInput = input.toUpperCase();
72660
+ if (/^[0-9A-F]$/.test(upperInput)) {
72661
+ setGradientHexInput(gradientHexInput + upperInput);
72662
+ }
72663
+ }
72664
+ return;
72665
+ }
72666
+ const total = GRADIENT_PRESET_NAMES.length + 1;
72667
+ if (key.escape) {
72668
+ exitGradient();
72669
+ } else if (key.upArrow) {
72670
+ setGradientIndex((gradientIndex - 1 + total) % total);
72671
+ } else if (key.downArrow) {
72672
+ setGradientIndex((gradientIndex + 1) % total);
72673
+ } else if (key.return) {
72674
+ if (gradientIndex < GRADIENT_PRESET_NAMES.length) {
72675
+ applyGradientValue(`gradient:${GRADIENT_PRESET_NAMES[gradientIndex]}`);
72676
+ } else {
72677
+ setGradientStartHex("");
72678
+ setGradientHexInput("");
72679
+ setGradientCustomStep("start");
72680
+ }
72681
+ }
71594
72682
  } else {
71595
72683
  if (key.escape) {
71596
72684
  onBack();
@@ -71645,6 +72733,12 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
71645
72733
  };
71646
72734
  onUpdate(updatedSettings);
71647
72735
  } else if (input === "g" || input === "G") {
72736
+ setGradientMode(true);
72737
+ setGradientIndex(0);
72738
+ setGradientCustomStep(null);
72739
+ setGradientStartHex("");
72740
+ setGradientHexInput("");
72741
+ } else if (input === "x" || input === "X") {
71648
72742
  const updatedSettings = {
71649
72743
  ...settings,
71650
72744
  overrideForegroundColor: undefined
@@ -71653,6 +72747,87 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
71653
72747
  }
71654
72748
  }
71655
72749
  });
72750
+ if (gradientMode) {
72751
+ const level = getColorLevelString(settings.colorLevel);
72752
+ if (gradientCustomStep) {
72753
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
72754
+ flexDirection: "column",
72755
+ children: [
72756
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72757
+ bold: true,
72758
+ children: "Custom Gradient - Override FG Color"
72759
+ }, undefined, false, undefined, this),
72760
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
72761
+ marginTop: 1,
72762
+ flexDirection: "column",
72763
+ children: [
72764
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72765
+ children: gradientCustomStep === "start" ? "Enter START hex color (without #):" : "Enter END hex color (without #):"
72766
+ }, undefined, false, undefined, this),
72767
+ gradientCustomStep === "end" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72768
+ dimColor: true,
72769
+ children: [
72770
+ "Start: #",
72771
+ gradientStartHex
72772
+ ]
72773
+ }, undefined, true, undefined, this),
72774
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72775
+ children: [
72776
+ "#",
72777
+ gradientHexInput,
72778
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72779
+ dimColor: true,
72780
+ children: gradientHexInput.length < 6 ? "_".repeat(6 - gradientHexInput.length) : ""
72781
+ }, undefined, false, undefined, this)
72782
+ ]
72783
+ }, undefined, true, undefined, this),
72784
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72785
+ children: " "
72786
+ }, undefined, false, undefined, this),
72787
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72788
+ dimColor: true,
72789
+ children: "Press Enter when done, ESC to go back"
72790
+ }, undefined, false, undefined, this)
72791
+ ]
72792
+ }, undefined, true, undefined, this)
72793
+ ]
72794
+ }, undefined, true, undefined, this);
72795
+ }
72796
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
72797
+ flexDirection: "column",
72798
+ children: [
72799
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72800
+ bold: true,
72801
+ children: "Select Gradient - Override FG Color"
72802
+ }, undefined, false, undefined, this),
72803
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
72804
+ marginTop: 1,
72805
+ children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72806
+ dimColor: true,
72807
+ children: "↑↓ to select, Enter to apply, ESC to cancel"
72808
+ }, undefined, false, undefined, this)
72809
+ }, undefined, false, undefined, this),
72810
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
72811
+ marginTop: 1,
72812
+ flexDirection: "column",
72813
+ children: [
72814
+ GRADIENT_PRESET_NAMES.map((name, idx) => /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72815
+ children: [
72816
+ idx === gradientIndex ? "▶ " : " ",
72817
+ applyColors(name, `gradient:${name}`, undefined, idx === gradientIndex, level)
72818
+ ]
72819
+ }, name, true, undefined, this)),
72820
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72821
+ children: [
72822
+ gradientIndex === GRADIENT_PRESET_NAMES.length ? "▶ " : " ",
72823
+ "Custom (enter two hex stops)"
72824
+ ]
72825
+ }, "custom", true, undefined, this)
72826
+ ]
72827
+ }, undefined, true, undefined, this)
72828
+ ]
72829
+ }, undefined, true, undefined, this);
72830
+ }
71656
72831
  return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
71657
72832
  flexDirection: "column",
71658
72833
  children: [
@@ -71818,6 +72993,13 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
71818
72993
  color: "gray",
71819
72994
  children: "(none)"
71820
72995
  }, undefined, false, undefined, this);
72996
+ } else if (fgColor.startsWith("gradient:")) {
72997
+ const body = fgColor.substring(9);
72998
+ const displayName = GRADIENT_PRESET_NAMES.includes(body.toLowerCase()) ? `Gradient: ${body.toLowerCase()}` : `Gradient: ${body}`;
72999
+ const level = getColorLevelString(settings.colorLevel);
73000
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
73001
+ children: applyColors(displayName, fgColor, undefined, false, level)
73002
+ }, undefined, false, undefined, this);
71821
73003
  } else {
71822
73004
  const displayName = getColorDisplayName(fgColor);
71823
73005
  const fgChalk = getChalkColor(fgColor, "ansi16", false);
@@ -71829,7 +73011,7 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
71829
73011
  })(),
71830
73012
  /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
71831
73013
  dimColor: true,
71832
- children: " - (f) 切换,(g) 清除"
73014
+ children: " - (f) 切换,(g) 渐变色,(x) 清除"
71833
73015
  }, undefined, false, undefined, this)
71834
73016
  ]
71835
73017
  }, undefined, true, undefined, this),
@@ -71967,15 +73149,15 @@ function getPinnedDescription(currentVersion) {
71967
73149
  }
71968
73150
  function getStyleItems(currentVersion) {
71969
73151
  return [
71970
- {
71971
- label: "自动更新",
71972
- value: "auto-update",
71973
- description: AUTO_UPDATE_DESCRIPTION
71974
- },
71975
73152
  {
71976
73153
  label: "固定全局安装",
71977
73154
  value: "pinned",
71978
73155
  description: getPinnedDescription(currentVersion)
73156
+ },
73157
+ {
73158
+ label: "自动更新",
73159
+ value: "auto-update",
73160
+ description: AUTO_UPDATE_DESCRIPTION
71979
73161
  }
71980
73162
  ];
71981
73163
  }
@@ -72045,7 +73227,7 @@ var InstallMenu = ({
72045
73227
  initialPackageSelection = 0
72046
73228
  }) => {
72047
73229
  const [step, setStep] = import_react41.useState("style");
72048
- const [updateStyle, setUpdateStyle] = import_react41.useState("auto-update");
73230
+ const [updateStyle, setUpdateStyle] = import_react41.useState("pinned");
72049
73231
  use_input_default((_, key) => {
72050
73232
  if (key.escape) {
72051
73233
  if (step === "manager") {
@@ -73670,7 +74852,7 @@ var UninstallMenu = ({
73670
74852
  // src/tui/components/PowerlineSetup.tsx
73671
74853
  await init_build2();
73672
74854
  var import_react46 = __toESM(require_react(), 1);
73673
- import * as os12 from "os";
74855
+ import * as os13 from "os";
73674
74856
 
73675
74857
  // src/utils/powerline-settings.ts
73676
74858
  init_colors();
@@ -74311,6 +75493,8 @@ var PowerlineSetup = ({
74311
75493
  const [confirmingEnable, setConfirmingEnable] = import_react46.useState(false);
74312
75494
  const [confirmingFontInstall, setConfirmingFontInstall] = import_react46.useState(false);
74313
75495
  const hasSeparatorItems = settings.lines.some((line) => line.some((item) => item.type === "separator" || item.type === "flex-separator"));
75496
+ const hasGlobalFgOverride = Boolean(settings.overrideForegroundColor && settings.overrideForegroundColor !== "none");
75497
+ const globalOverrideMessage = hasGlobalFgOverride ? "⚠ 前景色全局覆盖已激活" : null;
74314
75498
  use_input_default((input, key) => {
74315
75499
  if (fontInstallMessage || installingFonts) {
74316
75500
  if (fontInstallMessage && !key.escape) {
@@ -74403,10 +75587,22 @@ var PowerlineSetup = ({
74403
75587
  return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
74404
75588
  flexDirection: "column",
74405
75589
  children: [
74406
- !confirmingFontInstall && !installingFonts && !fontInstallMessage && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
74407
- bold: true,
74408
- children: "Powerline 设置"
74409
- }, undefined, false, undefined, this),
75590
+ !confirmingFontInstall && !installingFonts && !fontInstallMessage && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
75591
+ children: [
75592
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
75593
+ bold: true,
75594
+ children: "Powerline 设置"
75595
+ }, undefined, false, undefined, this),
75596
+ globalOverrideMessage && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
75597
+ color: "yellow",
75598
+ dimColor: true,
75599
+ children: [
75600
+ ". ",
75601
+ globalOverrideMessage
75602
+ ]
75603
+ }, undefined, true, undefined, this)
75604
+ ]
75605
+ }, undefined, true, undefined, this),
74410
75606
  confirmingFontInstall ? /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
74411
75607
  flexDirection: "column",
74412
75608
  children: [
@@ -74438,7 +75634,7 @@ var PowerlineSetup = ({
74438
75634
  }, undefined, false, undefined, this)
74439
75635
  ]
74440
75636
  }, undefined, true, undefined, this),
74441
- os12.platform() === "darwin" && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
75637
+ os13.platform() === "darwin" && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
74442
75638
  children: [
74443
75639
  /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
74444
75640
  dimColor: true,
@@ -74454,7 +75650,7 @@ var PowerlineSetup = ({
74454
75650
  }, undefined, false, undefined, this)
74455
75651
  ]
74456
75652
  }, undefined, true, undefined, this),
74457
- os12.platform() === "linux" && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
75653
+ os13.platform() === "linux" && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
74458
75654
  children: [
74459
75655
  /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
74460
75656
  dimColor: true,
@@ -74470,7 +75666,7 @@ var PowerlineSetup = ({
74470
75666
  }, undefined, false, undefined, this)
74471
75667
  ]
74472
75668
  }, undefined, true, undefined, this),
74473
- os12.platform() === "win32" && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
75669
+ os13.platform() === "win32" && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
74474
75670
  children: [
74475
75671
  /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
74476
75672
  dimColor: true,
@@ -74692,7 +75888,7 @@ var PowerlineSetup = ({
74692
75888
  children: [
74693
75889
  /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
74694
75890
  dimColor: true,
74695
- children: "启用后,全局覆盖将被禁用,并使用 Powerline 分隔符"
75891
+ children: "Powerline 模式使用独立的分隔符系统"
74696
75892
  }, undefined, false, undefined, this),
74697
75893
  /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
74698
75894
  dimColor: true,
@@ -74747,7 +75943,10 @@ function getRefreshIntervalSublabel(interval, supported) {
74747
75943
  }
74748
75944
  return `(${interval} 秒)`;
74749
75945
  }
74750
- function buildConfigureStatusLineItems(refreshInterval, supportsRefreshInterval) {
75946
+ function getGitCacheTtlSublabel(ttlSeconds) {
75947
+ return ttlSeconds === 0 ? "(仅 mtime)" : `(${ttlSeconds} 秒)`;
75948
+ }
75949
+ function buildConfigureStatusLineItems(refreshInterval, supportsRefreshInterval, gitCacheTtlSeconds) {
74751
75950
  return [
74752
75951
  {
74753
75952
  label: "\uD83D\uDD04 刷新间隔",
@@ -74755,6 +75954,13 @@ function buildConfigureStatusLineItems(refreshInterval, supportsRefreshInterval)
74755
75954
  value: "refreshInterval",
74756
75955
  disabled: !supportsRefreshInterval,
74757
75956
  description: supportsRefreshInterval ? "Claude Code 重新运行状态栏命令的频率。输入秒数 (1-60),留空即移除。" : "本设置需要 Claude Code 2.1.97 或更高版本。请升级 Claude Code 后再使用。"
75957
+ },
75958
+ {
75959
+ label: "\uD83E\uDDEE Git 缓存 TTL",
75960
+ sublabel: getGitCacheTtlSublabel(gitCacheTtlSeconds),
75961
+ value: "gitCacheTtl",
75962
+ description: `Git 组件子进程输出在 .git/HEAD 与 .git/index 未变动期间可复用的时长。输入 0-60 秒;
75963
+ 填 0 关闭按时长过期,缓存输出会一直复用,直到这些 git 元数据 mtime 发生变化。`
74758
75964
  }
74759
75965
  ];
74760
75966
  }
@@ -74774,14 +75980,31 @@ function validateRefreshIntervalInput(value) {
74774
75980
  }
74775
75981
  return null;
74776
75982
  }
75983
+ function validateGitCacheTtlInput(value) {
75984
+ const parsed = parseInt(value, 10);
75985
+ if (value === "" || isNaN(parsed)) {
75986
+ return "请输入有效数字";
75987
+ }
75988
+ if (parsed < 0) {
75989
+ return `Git 缓存 TTL 最小为 0 秒(输入了 ${parsed} 秒)`;
75990
+ }
75991
+ if (parsed > 60) {
75992
+ return `Git 缓存 TTL 最大为 60 秒(输入了 ${parsed} 秒)`;
75993
+ }
75994
+ return null;
75995
+ }
74777
75996
  var RefreshIntervalMenu = ({
74778
75997
  currentInterval,
74779
75998
  supportsRefreshInterval,
75999
+ gitCacheTtlSeconds,
74780
76000
  onUpdate,
76001
+ onGitCacheTtlUpdate,
74781
76002
  onBack
74782
76003
  }) => {
74783
76004
  const [editingRefreshInterval, setEditingRefreshInterval] = import_react47.useState(false);
76005
+ const [editingGitCacheTtl, setEditingGitCacheTtl] = import_react47.useState(false);
74784
76006
  const [refreshInput, setRefreshInput] = import_react47.useState(() => getRefreshInputValue(currentInterval));
76007
+ const [gitCacheTtlInput, setGitCacheTtlInput] = import_react47.useState(() => String(gitCacheTtlSeconds));
74785
76008
  const [validationError, setValidationError] = import_react47.useState(null);
74786
76009
  use_input_default((input, key) => {
74787
76010
  if (editingRefreshInterval) {
@@ -74817,6 +76040,33 @@ var RefreshIntervalMenu = ({
74817
76040
  }
74818
76041
  return;
74819
76042
  }
76043
+ if (editingGitCacheTtl) {
76044
+ if (key.return) {
76045
+ const error51 = validateGitCacheTtlInput(gitCacheTtlInput);
76046
+ if (error51) {
76047
+ setValidationError(error51);
76048
+ } else {
76049
+ const value = parseInt(gitCacheTtlInput, 10);
76050
+ onGitCacheTtlUpdate(value);
76051
+ setEditingGitCacheTtl(false);
76052
+ setValidationError(null);
76053
+ }
76054
+ } else if (key.escape) {
76055
+ setGitCacheTtlInput(String(gitCacheTtlSeconds));
76056
+ setEditingGitCacheTtl(false);
76057
+ setValidationError(null);
76058
+ } else if (key.backspace) {
76059
+ setGitCacheTtlInput(gitCacheTtlInput.slice(0, -1));
76060
+ setValidationError(null);
76061
+ } else if (key.delete) {} else if (shouldInsertInput(input, key) && /\d/.test(input)) {
76062
+ const newValue = gitCacheTtlInput + input;
76063
+ if (newValue.length <= 2) {
76064
+ setGitCacheTtlInput(newValue);
76065
+ setValidationError(null);
76066
+ }
76067
+ }
76068
+ return;
76069
+ }
74820
76070
  if (key.escape) {
74821
76071
  onBack();
74822
76072
  }
@@ -74852,16 +76102,53 @@ var RefreshIntervalMenu = ({
74852
76102
  children: "按 Enter 确认,ESC 取消。留空即移除。"
74853
76103
  }, undefined, false, undefined, this)
74854
76104
  ]
76105
+ }, undefined, true, undefined, this) : editingGitCacheTtl ? /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Box_default, {
76106
+ marginTop: 1,
76107
+ flexDirection: "column",
76108
+ children: [
76109
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
76110
+ children: [
76111
+ "输入 Git 缓存 TTL(秒,0-60):",
76112
+ " ",
76113
+ gitCacheTtlInput,
76114
+ gitCacheTtlInput.length > 0 ? " 秒" : ""
76115
+ ]
76116
+ }, undefined, true, undefined, this),
76117
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
76118
+ children: " "
76119
+ }, undefined, false, undefined, this),
76120
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
76121
+ dimColor: true,
76122
+ wrap: "wrap",
76123
+ children: "此设置影响 Git 组件多快能察觉到未暂存和未跟踪的工作区改动。"
76124
+ }, undefined, false, undefined, this),
76125
+ validationError ? /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
76126
+ color: "red",
76127
+ children: validationError
76128
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
76129
+ dimColor: true,
76130
+ children: "填 0 关闭按时长过期;缓存有效性仅依据 .git/HEAD 和 .git/index 的 mtime。"
76131
+ }, undefined, false, undefined, this),
76132
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
76133
+ dimColor: true,
76134
+ children: "按 Enter 确认,ESC 取消。"
76135
+ }, undefined, false, undefined, this)
76136
+ ]
74855
76137
  }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(List, {
74856
76138
  marginTop: 1,
74857
- items: buildConfigureStatusLineItems(currentInterval, supportsRefreshInterval),
76139
+ items: buildConfigureStatusLineItems(currentInterval, supportsRefreshInterval, gitCacheTtlSeconds),
74858
76140
  onSelect: (value) => {
74859
76141
  if (value === "back") {
74860
76142
  onBack();
74861
76143
  return;
74862
76144
  }
74863
- setRefreshInput(getRefreshInputValue(currentInterval));
74864
- setEditingRefreshInterval(true);
76145
+ if (value === "refreshInterval") {
76146
+ setRefreshInput(getRefreshInputValue(currentInterval));
76147
+ setEditingRefreshInterval(true);
76148
+ return;
76149
+ }
76150
+ setGitCacheTtlInput(String(gitCacheTtlSeconds));
76151
+ setEditingGitCacheTtl(true);
74865
76152
  },
74866
76153
  showBackButton: true
74867
76154
  }, undefined, false, undefined, this)
@@ -74912,6 +76199,7 @@ var renderSingleLine = (widgets, terminalWidth, settings, lineIndex, globalSepar
74912
76199
  terminalWidth,
74913
76200
  isPreview: true,
74914
76201
  minimalist: settings.minimalistMode,
76202
+ gitCacheTtlSeconds: settings.gitCacheTtlSeconds,
74915
76203
  lineIndex,
74916
76204
  globalSeparatorIndex,
74917
76205
  globalPowerlineThemeIndex
@@ -74928,7 +76216,12 @@ var StatusLinePreview = ({ lines, terminalWidth, settings, onTruncationChange })
74928
76216
  const { renderedLines, anyTruncated } = import_react48.default.useMemo(() => {
74929
76217
  if (!settings)
74930
76218
  return { renderedLines: [], anyTruncated: false };
74931
- const preRenderedLines = preRenderAllWidgets(lines, settings, { terminalWidth, isPreview: true, minimalist: settings.minimalistMode });
76219
+ const preRenderedLines = preRenderAllWidgets(lines, settings, {
76220
+ terminalWidth,
76221
+ isPreview: true,
76222
+ minimalist: settings.minimalistMode,
76223
+ gitCacheTtlSeconds: settings.gitCacheTtlSeconds
76224
+ });
74932
76225
  const preCalculatedMaxWidths = calculateMaxWidthsFromPreRendered(preRenderedLines, settings);
74933
76226
  let globalSeparatorIndex = 0;
74934
76227
  let globalPowerlineThemeIndex = 0;
@@ -75609,7 +76902,7 @@ function getPinnedMismatchItems(mismatch, canRunPackageManager) {
75609
76902
  value: "update",
75610
76903
  disabled: !canRunPackageManager,
75611
76904
  sublabel: canRunPackageManager ? undefined : `(${mismatch.packageManager} not installed)`,
75612
- description: `Runs ${mismatch.packageManager === "npm" ? `npm install -g ccstatusline@${mismatch.runningVersion}` : `bun add -g ccstatusline@${mismatch.runningVersion}`}`
76905
+ description: `Runs ${mismatch.packageManager === "npm" ? `npm install -g ccstatusline-zh@${mismatch.runningVersion}` : `bun add -g ccstatusline-zh@${mismatch.runningVersion}`}`
75613
76906
  });
75614
76907
  }
75615
76908
  items.push({
@@ -75644,7 +76937,7 @@ var PinnedVersionMismatchScreen = ({
75644
76937
  /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
75645
76938
  color: "yellow",
75646
76939
  children: [
75647
- "Claude Code is pinned to ccstatusline v",
76940
+ "Claude Code is pinned to ccstatusline-zh v",
75648
76941
  mismatch.installedVersion,
75649
76942
  ", but this TUI is v",
75650
76943
  mismatch.runningVersion,
@@ -75688,11 +76981,11 @@ var PinnedVersionMismatchScreen = ({
75688
76981
  }, undefined, true, undefined, this);
75689
76982
  };
75690
76983
  function getGlobalUninstallCommand(packageManager) {
75691
- return packageManager === "npm" ? "npm uninstall -g ccstatusline" : "bun remove -g ccstatusline";
76984
+ return packageManager === "npm" ? "npm uninstall -g ccstatusline-zh" : "bun remove -g ccstatusline-zh";
75692
76985
  }
75693
76986
  function buildUninstallConfirmMessage(selection) {
75694
76987
  if (selection.packageManagers.length === 0) {
75695
- return `This will remove ccstatusline from ${getClaudeSettingsPath()}. Continue?`;
76988
+ return `This will remove ccstatusline-zh from ${getClaudeSettingsPath()}. Continue?`;
75696
76989
  }
75697
76990
  const commands = selection.packageManagers.map((packageManager) => getGlobalUninstallCommand(packageManager)).join(`
75698
76991
  `);
@@ -76462,30 +77755,7 @@ ${GITHUB_REPO_URL}`,
76462
77755
  screen === "refreshInterval" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(RefreshIntervalMenu, {
76463
77756
  currentInterval: currentRefreshInterval,
76464
77757
  supportsRefreshInterval,
76465
- onUpdate: (interval) => {
76466
- const previous = currentRefreshInterval;
76467
- setCurrentRefreshInterval(interval);
76468
- setRefreshInterval(interval).then(() => {
76469
- setFlashMessage({
76470
- text: "✓ Refresh interval updated",
76471
- color: "green"
76472
- });
76473
- }).catch(() => {
76474
- setCurrentRefreshInterval(previous);
76475
- setFlashMessage({
76476
- text: "✗ Failed to save refresh interval",
76477
- color: "red"
76478
- });
76479
- });
76480
- setScreen("main");
76481
- },
76482
- onBack: () => {
76483
- setScreen("main");
76484
- }
76485
- }, undefined, false, undefined, this),
76486
- screen === "refreshInterval" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(RefreshIntervalMenu, {
76487
- currentInterval: currentRefreshInterval,
76488
- supportsRefreshInterval,
77758
+ gitCacheTtlSeconds: settings.gitCacheTtlSeconds,
76489
77759
  onUpdate: (interval) => {
76490
77760
  const previous = currentRefreshInterval;
76491
77761
  setCurrentRefreshInterval(interval);
@@ -76503,27 +77773,14 @@ ${GITHUB_REPO_URL}`,
76503
77773
  });
76504
77774
  setScreen("main");
76505
77775
  },
76506
- onBack: () => {
76507
- setScreen("main");
76508
- }
76509
- }, undefined, false, undefined, this),
76510
- screen === "refreshInterval" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(RefreshIntervalMenu, {
76511
- currentInterval: currentRefreshInterval,
76512
- supportsRefreshInterval,
76513
- onUpdate: (interval) => {
76514
- const previous = currentRefreshInterval;
76515
- setCurrentRefreshInterval(interval);
76516
- setRefreshInterval(interval).then(() => {
76517
- setFlashMessage({
76518
- text: "✓ 刷新间隔已更新",
76519
- color: "green"
76520
- });
76521
- }).catch(() => {
76522
- setCurrentRefreshInterval(previous);
76523
- setFlashMessage({
76524
- text: "✗ 保存刷新间隔失败",
76525
- color: "red"
76526
- });
77776
+ onGitCacheTtlUpdate: (ttlSeconds) => {
77777
+ setSettings({
77778
+ ...settings,
77779
+ gitCacheTtlSeconds: ttlSeconds
77780
+ });
77781
+ setFlashMessage({
77782
+ text: "✓ Git 缓存 TTL 已更新",
77783
+ color: "green"
76527
77784
  });
76528
77785
  setScreen("main");
76529
77786
  },
@@ -76649,10 +77906,11 @@ init_colors();
76649
77906
  // src/utils/compaction.ts
76650
77907
  init_zod();
76651
77908
  import * as crypto from "crypto";
76652
- import * as fs14 from "fs";
76653
- import * as os13 from "os";
76654
- import * as path11 from "path";
77909
+ import * as fs15 from "fs";
77910
+ import * as os14 from "os";
77911
+ import * as path12 from "path";
76655
77912
  var DEFAULT_DROP_THRESHOLD = 2;
77913
+ var MIN_CTX_PCT = 1;
76656
77914
  var FRESH_PREV_CTX_PCT = -1;
76657
77915
  var MAX_CACHE_FILE_BYTES = 4096;
76658
77916
  var SESSION_ID_HASH_HEX_LEN = 32;
@@ -76676,7 +77934,7 @@ function normalizeOptions(options) {
76676
77934
  return { dropThreshold, windowSize: options.windowSize ?? null };
76677
77935
  }
76678
77936
  function detectCompaction(currentCtxPct, state, options = DEFAULT_DROP_THRESHOLD) {
76679
- if (!Number.isFinite(currentCtxPct) || currentCtxPct < 0) {
77937
+ if (!Number.isFinite(currentCtxPct) || currentCtxPct < MIN_CTX_PCT) {
76680
77938
  return state;
76681
77939
  }
76682
77940
  const { dropThreshold, windowSize } = normalizeOptions(options);
@@ -76695,8 +77953,8 @@ function detectCompaction(currentCtxPct, state, options = DEFAULT_DROP_THRESHOLD
76695
77953
  ...currentWindowSize !== null ? { prevWindowSize: currentWindowSize } : {}
76696
77954
  };
76697
77955
  }
76698
- function getCacheDir2() {
76699
- return path11.join(os13.homedir(), ".cache", "ccstatusline", "compaction");
77956
+ function getCacheDir3() {
77957
+ return path12.join(os14.homedir(), ".cache", "ccstatusline", "compaction");
76700
77958
  }
76701
77959
  function sanitizeSessionId(sessionId) {
76702
77960
  const sanitized = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
@@ -76706,18 +77964,18 @@ function sanitizeSessionId(sessionId) {
76706
77964
  return sanitized;
76707
77965
  }
76708
77966
  function getStatePath(sessionId) {
76709
- return path11.join(getCacheDir2(), `compaction-${sanitizeSessionId(sessionId)}.json`);
77967
+ return path12.join(getCacheDir3(), `compaction-${sanitizeSessionId(sessionId)}.json`);
76710
77968
  }
76711
77969
  function loadCompactionState(sessionId) {
76712
77970
  const statePath = getStatePath(sessionId);
76713
77971
  let fd = null;
76714
77972
  try {
76715
- fd = fs14.openSync(statePath, fs14.constants.O_RDONLY | fs14.constants.O_NOFOLLOW);
76716
- const stats = fs14.fstatSync(fd);
77973
+ fd = fs15.openSync(statePath, fs15.constants.O_RDONLY | fs15.constants.O_NOFOLLOW);
77974
+ const stats = fs15.fstatSync(fd);
76717
77975
  if (!stats.isFile() || stats.size > MAX_CACHE_FILE_BYTES) {
76718
77976
  return FRESH;
76719
77977
  }
76720
- const raw = JSON.parse(fs14.readFileSync(fd, "utf-8"));
77978
+ const raw = JSON.parse(fs15.readFileSync(fd, "utf-8"));
76721
77979
  const result2 = CompactionStateSchema.safeParse(raw);
76722
77980
  return result2.success ? result2.data : FRESH;
76723
77981
  } catch {
@@ -76725,7 +77983,7 @@ function loadCompactionState(sessionId) {
76725
77983
  } finally {
76726
77984
  if (fd !== null) {
76727
77985
  try {
76728
- fs14.closeSync(fd);
77986
+ fs15.closeSync(fd);
76729
77987
  } catch {}
76730
77988
  }
76731
77989
  }
@@ -76733,20 +77991,20 @@ function loadCompactionState(sessionId) {
76733
77991
  function saveCompactionState(sessionId, state) {
76734
77992
  let tmpPath = null;
76735
77993
  try {
76736
- const dir = getCacheDir2();
76737
- if (!fs14.existsSync(dir)) {
76738
- fs14.mkdirSync(dir, { recursive: true });
77994
+ const dir = getCacheDir3();
77995
+ if (!fs15.existsSync(dir)) {
77996
+ fs15.mkdirSync(dir, { recursive: true });
76739
77997
  }
76740
77998
  const targetPath = getStatePath(sessionId);
76741
77999
  tmpPath = `${targetPath}.tmp.${process.pid}.${crypto.randomBytes(4).toString("hex")}`;
76742
- fs14.writeFileSync(tmpPath, JSON.stringify(state) + `
78000
+ fs15.writeFileSync(tmpPath, JSON.stringify(state) + `
76743
78001
  `);
76744
- fs14.renameSync(tmpPath, targetPath);
78002
+ fs15.renameSync(tmpPath, targetPath);
76745
78003
  tmpPath = null;
76746
78004
  } catch {
76747
78005
  if (tmpPath !== null) {
76748
78006
  try {
76749
- fs14.unlinkSync(tmpPath);
78007
+ fs15.unlinkSync(tmpPath);
76750
78008
  } catch {}
76751
78009
  }
76752
78010
  }
@@ -76761,23 +78019,23 @@ await __promiseAll([
76761
78019
  await init_renderer2();
76762
78020
 
76763
78021
  // src/utils/skills.ts
76764
- import * as fs15 from "fs";
76765
- import * as os14 from "os";
76766
- import * as path12 from "path";
78022
+ import * as fs16 from "fs";
78023
+ import * as os15 from "os";
78024
+ import * as path13 from "path";
76767
78025
  var EMPTY = { totalInvocations: 0, uniqueSkills: [], lastSkill: null };
76768
78026
  function getSkillsDir() {
76769
- return path12.join(os14.homedir(), ".cache", "ccstatusline", "skills");
78027
+ return path13.join(os15.homedir(), ".cache", "ccstatusline", "skills");
76770
78028
  }
76771
78029
  function getSkillsFilePath(sessionId) {
76772
- return path12.join(getSkillsDir(), `skills-${sessionId}.jsonl`);
78030
+ return path13.join(getSkillsDir(), `skills-${sessionId}.jsonl`);
76773
78031
  }
76774
78032
  function getSkillsMetrics(sessionId) {
76775
78033
  const filePath = getSkillsFilePath(sessionId);
76776
- if (!fs15.existsSync(filePath)) {
78034
+ if (!fs16.existsSync(filePath)) {
76777
78035
  return EMPTY;
76778
78036
  }
76779
78037
  try {
76780
- const invocations = fs15.readFileSync(filePath, "utf-8").trim().split(`
78038
+ const invocations = fs16.readFileSync(filePath, "utf-8").trim().split(`
76781
78039
  `).filter((line) => line.trim()).map((line) => {
76782
78040
  try {
76783
78041
  return JSON.parse(line);
@@ -76998,7 +78256,7 @@ async function ensureWindowsUtf8CodePage() {
76998
78256
  }
76999
78257
  try {
77000
78258
  const { execFileSync: execFileSync7 } = await import("child_process");
77001
- execFileSync7("chcp.com", ["65001"], { stdio: "ignore" });
78259
+ execFileSync7("chcp.com", ["65001"], { stdio: "ignore", windowsHide: true });
77002
78260
  } catch {}
77003
78261
  }
77004
78262
  async function renderMultipleLines(data) {
@@ -77064,7 +78322,8 @@ async function renderMultipleLines(data) {
77064
78322
  skillsMetrics,
77065
78323
  compactionData: hasCompactionWidget ? { count: compactionCount } : null,
77066
78324
  isPreview: false,
77067
- minimalist: settings.minimalistMode
78325
+ minimalist: settings.minimalistMode,
78326
+ gitCacheTtlSeconds: settings.gitCacheTtlSeconds
77068
78327
  };
77069
78328
  const preRenderedLines = preRenderAllWidgets(lines, settings, context);
77070
78329
  const preCalculatedMaxWidths = calculateMaxWidthsFromPreRendered(preRenderedLines, settings);
@@ -77149,16 +78408,16 @@ async function handleHook() {
77149
78408
  return;
77150
78409
  }
77151
78410
  const filePath = getSkillsFilePath(sessionId);
77152
- const fs16 = await import("fs");
77153
- const path13 = await import("path");
77154
- fs16.mkdirSync(path13.dirname(filePath), { recursive: true });
78411
+ const fs17 = await import("fs");
78412
+ const path14 = await import("path");
78413
+ fs17.mkdirSync(path14.dirname(filePath), { recursive: true });
77155
78414
  const entry = JSON.stringify({
77156
78415
  timestamp: new Date().toISOString(),
77157
78416
  session_id: sessionId,
77158
78417
  skill: skillName,
77159
78418
  source: data.hook_event_name
77160
78419
  });
77161
- fs16.appendFileSync(filePath, entry + `
78420
+ fs17.appendFileSync(filePath, entry + `
77162
78421
  `);
77163
78422
  } catch {}
77164
78423
  console.log("{}");