ccstatusline 2.2.18 → 2.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/ccstatusline.js +678 -342
- package/package.json +1 -1
package/dist/ccstatusline.js
CHANGED
|
@@ -53062,6 +53062,7 @@ var init_Settings = __esm(() => {
|
|
|
53062
53062
|
overrideBackgroundColor: exports_external.string().optional(),
|
|
53063
53063
|
overrideForegroundColor: exports_external.string().optional(),
|
|
53064
53064
|
globalBold: exports_external.boolean().default(false),
|
|
53065
|
+
gitCacheTtlSeconds: exports_external.number().min(0).max(60).default(5),
|
|
53065
53066
|
minimalistMode: exports_external.boolean().default(false),
|
|
53066
53067
|
powerline: PowerlineConfigSchema.default({
|
|
53067
53068
|
enabled: false,
|
|
@@ -53519,6 +53520,175 @@ class OutputStyleWidget {
|
|
|
53519
53520
|
|
|
53520
53521
|
// src/utils/git.ts
|
|
53521
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
|
+
}
|
|
53522
53692
|
function resolveGitCwd(context) {
|
|
53523
53693
|
const candidates = [
|
|
53524
53694
|
context.data?.cwd,
|
|
@@ -53539,22 +53709,37 @@ function runGit(command, context) {
|
|
|
53539
53709
|
function runGitArgs(args, context, cacheCommand) {
|
|
53540
53710
|
const cwd2 = resolveGitCwd(context);
|
|
53541
53711
|
const cacheToken = cacheCommand ?? args.join("\x00");
|
|
53542
|
-
const
|
|
53543
|
-
|
|
53544
|
-
|
|
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;
|
|
53545
53725
|
}
|
|
53546
|
-
const gitArgs = ["--no-optional-locks", ...args];
|
|
53547
53726
|
try {
|
|
53548
|
-
const output = execFileSync("git",
|
|
53727
|
+
const output = execFileSync("git", args, {
|
|
53549
53728
|
encoding: "utf8",
|
|
53550
53729
|
stdio: ["pipe", "pipe", "ignore"],
|
|
53730
|
+
env: { ...process.env, GIT_OPTIONAL_LOCKS: "0" },
|
|
53731
|
+
windowsHide: true,
|
|
53551
53732
|
...cwd2 ? { cwd: cwd2 } : {}
|
|
53552
53733
|
}).trimEnd();
|
|
53553
53734
|
const result2 = output.length > 0 ? output : null;
|
|
53554
|
-
|
|
53735
|
+
const entry = createCacheEntry(result2, metadata, now2);
|
|
53736
|
+
gitCommandCache.set(memoryCacheKey, entry);
|
|
53737
|
+
writePersistentCacheEntry(metadata, persistentCacheKey, cwd2, entry);
|
|
53555
53738
|
return result2;
|
|
53556
53739
|
} catch {
|
|
53557
|
-
|
|
53740
|
+
const entry = createCacheEntry(null, metadata, now2);
|
|
53741
|
+
gitCommandCache.set(memoryCacheKey, entry);
|
|
53742
|
+
writePersistentCacheEntry(metadata, persistentCacheKey, cwd2, entry);
|
|
53558
53743
|
return null;
|
|
53559
53744
|
}
|
|
53560
53745
|
}
|
|
@@ -53660,13 +53845,13 @@ function getGitConflictCount(context) {
|
|
|
53660
53845
|
`).map((line) => {
|
|
53661
53846
|
const parts = line.split(/\s+/).slice(3);
|
|
53662
53847
|
return parts.join(" ");
|
|
53663
|
-
}).filter((
|
|
53848
|
+
}).filter((path2) => path2.length > 0));
|
|
53664
53849
|
return files.size;
|
|
53665
53850
|
}
|
|
53666
53851
|
function getGitShortSha(context) {
|
|
53667
53852
|
return runGit("rev-parse --short HEAD", context);
|
|
53668
53853
|
}
|
|
53669
|
-
var gitCommandCache;
|
|
53854
|
+
var DEFAULT_GIT_CACHE_TTL_SECONDS = 5, GIT_CACHE_SCHEMA_VERSION = 1, gitCommandCache;
|
|
53670
53855
|
var init_git = __esm(() => {
|
|
53671
53856
|
gitCommandCache = new Map;
|
|
53672
53857
|
});
|
|
@@ -53784,8 +53969,8 @@ function renderOsc8Link(url2, text) {
|
|
|
53784
53969
|
function encodeGitRefForUrlPath(ref) {
|
|
53785
53970
|
return ref.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
53786
53971
|
}
|
|
53787
|
-
function encodeFilePathForUri(
|
|
53788
|
-
return
|
|
53972
|
+
function encodeFilePathForUri(path2) {
|
|
53973
|
+
return path2.replace(/\\/g, "/").split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
53789
53974
|
}
|
|
53790
53975
|
function buildIdeFileUrl(filePath, ideLinkMode) {
|
|
53791
53976
|
const normalizedPath = filePath.replace(/\\/g, "/");
|
|
@@ -53934,7 +54119,7 @@ class GitBranchWidget {
|
|
|
53934
54119
|
return displayText;
|
|
53935
54120
|
}
|
|
53936
54121
|
getGitBranch(context) {
|
|
53937
|
-
return runGit("
|
|
54122
|
+
return runGit("symbolic-ref --short HEAD", context);
|
|
53938
54123
|
}
|
|
53939
54124
|
getCustomKeybinds() {
|
|
53940
54125
|
return [
|
|
@@ -54440,19 +54625,19 @@ var init_GitRootDir = __esm(() => {
|
|
|
54440
54625
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
54441
54626
|
import {
|
|
54442
54627
|
existsSync as existsSync2,
|
|
54443
|
-
mkdirSync,
|
|
54444
|
-
readFileSync as
|
|
54445
|
-
statSync,
|
|
54446
|
-
writeFileSync
|
|
54628
|
+
mkdirSync as mkdirSync2,
|
|
54629
|
+
readFileSync as readFileSync3,
|
|
54630
|
+
statSync as statSync2,
|
|
54631
|
+
writeFileSync as writeFileSync2
|
|
54447
54632
|
} from "fs";
|
|
54448
|
-
import { createHash } from "node:crypto";
|
|
54449
|
-
import
|
|
54450
|
-
import
|
|
54451
|
-
function
|
|
54452
|
-
return
|
|
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");
|
|
54453
54638
|
}
|
|
54454
54639
|
function getGitReviewCacheDir(deps) {
|
|
54455
|
-
return
|
|
54640
|
+
return path2.join(getCacheDir2(deps), "git-review");
|
|
54456
54641
|
}
|
|
54457
54642
|
function runGitForCache(args, cwd2, deps) {
|
|
54458
54643
|
try {
|
|
@@ -54460,14 +54645,15 @@ function runGitForCache(args, cwd2, deps) {
|
|
|
54460
54645
|
encoding: "utf8",
|
|
54461
54646
|
stdio: ["pipe", "pipe", "ignore"],
|
|
54462
54647
|
cwd: cwd2,
|
|
54463
|
-
timeout: CLI_TIMEOUT
|
|
54648
|
+
timeout: CLI_TIMEOUT,
|
|
54649
|
+
windowsHide: true
|
|
54464
54650
|
}).trim();
|
|
54465
54651
|
} catch {
|
|
54466
54652
|
return "";
|
|
54467
54653
|
}
|
|
54468
54654
|
}
|
|
54469
54655
|
function getCurrentBranch(cwd2, deps) {
|
|
54470
|
-
const branch = runGitForCache(["
|
|
54656
|
+
const branch = runGitForCache(["symbolic-ref", "--short", "HEAD"], cwd2, deps);
|
|
54471
54657
|
return branch.length > 0 ? branch : null;
|
|
54472
54658
|
}
|
|
54473
54659
|
function getCacheRef(cwd2, deps) {
|
|
@@ -54481,9 +54667,9 @@ function getCacheRef(cwd2, deps) {
|
|
|
54481
54667
|
}
|
|
54482
54668
|
return "unknown";
|
|
54483
54669
|
}
|
|
54484
|
-
function
|
|
54485
|
-
const hash2 =
|
|
54486
|
-
return
|
|
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`);
|
|
54487
54673
|
}
|
|
54488
54674
|
function readCache(cachePath, deps) {
|
|
54489
54675
|
try {
|
|
@@ -54563,7 +54749,8 @@ function isCliAvailable(cli, deps) {
|
|
|
54563
54749
|
try {
|
|
54564
54750
|
deps.execFileSync(cli, ["--version"], {
|
|
54565
54751
|
stdio: ["pipe", "pipe", "ignore"],
|
|
54566
|
-
timeout: CLI_TIMEOUT
|
|
54752
|
+
timeout: CLI_TIMEOUT,
|
|
54753
|
+
windowsHide: true
|
|
54567
54754
|
});
|
|
54568
54755
|
return true;
|
|
54569
54756
|
} catch {
|
|
@@ -54574,7 +54761,8 @@ function isCliAuthedForHost(cli, host, deps) {
|
|
|
54574
54761
|
try {
|
|
54575
54762
|
deps.execFileSync(cli, ["auth", "status", "--hostname", host], {
|
|
54576
54763
|
stdio: ["pipe", "pipe", "ignore"],
|
|
54577
|
-
timeout: CLI_TIMEOUT
|
|
54764
|
+
timeout: CLI_TIMEOUT,
|
|
54765
|
+
windowsHide: true
|
|
54578
54766
|
});
|
|
54579
54767
|
return true;
|
|
54580
54768
|
} catch {
|
|
@@ -54606,7 +54794,8 @@ function fetchFromGh(cwd2, repoRef, deps) {
|
|
|
54606
54794
|
encoding: "utf8",
|
|
54607
54795
|
stdio: ["pipe", "pipe", "ignore"],
|
|
54608
54796
|
cwd: cwd2,
|
|
54609
|
-
timeout: CLI_TIMEOUT
|
|
54797
|
+
timeout: CLI_TIMEOUT,
|
|
54798
|
+
windowsHide: true
|
|
54610
54799
|
}).trim();
|
|
54611
54800
|
if (output.length === 0) {
|
|
54612
54801
|
return null;
|
|
@@ -54638,7 +54827,8 @@ function fetchFromGlab(cwd2, repoRef, deps) {
|
|
|
54638
54827
|
encoding: "utf8",
|
|
54639
54828
|
stdio: ["pipe", "pipe", "ignore"],
|
|
54640
54829
|
cwd: cwd2,
|
|
54641
|
-
timeout: CLI_TIMEOUT
|
|
54830
|
+
timeout: CLI_TIMEOUT,
|
|
54831
|
+
windowsHide: true
|
|
54642
54832
|
}).trim();
|
|
54643
54833
|
if (output.length === 0) {
|
|
54644
54834
|
return null;
|
|
@@ -54670,7 +54860,7 @@ function fetchFromProvider(provider, cwd2, repoRef, deps) {
|
|
|
54670
54860
|
return null;
|
|
54671
54861
|
}
|
|
54672
54862
|
function fetchGitReviewData(cwd2, deps = DEFAULT_GIT_REVIEW_CACHE_DEPS) {
|
|
54673
|
-
const cachePath =
|
|
54863
|
+
const cachePath = getCachePath2(cwd2, getCacheRef(cwd2, deps), deps);
|
|
54674
54864
|
const cached2 = readCache(cachePath, deps);
|
|
54675
54865
|
if (cached2 !== "miss") {
|
|
54676
54866
|
return cached2;
|
|
@@ -54716,11 +54906,11 @@ var init_git_review_cache = __esm(() => {
|
|
|
54716
54906
|
DEFAULT_GIT_REVIEW_CACHE_DEPS = {
|
|
54717
54907
|
execFileSync: execFileSync2,
|
|
54718
54908
|
existsSync: existsSync2,
|
|
54719
|
-
mkdirSync,
|
|
54720
|
-
readFileSync:
|
|
54721
|
-
statSync,
|
|
54722
|
-
writeFileSync,
|
|
54723
|
-
getHomedir:
|
|
54909
|
+
mkdirSync: mkdirSync2,
|
|
54910
|
+
readFileSync: readFileSync3,
|
|
54911
|
+
statSync: statSync2,
|
|
54912
|
+
writeFileSync: writeFileSync2,
|
|
54913
|
+
getHomedir: os4.homedir,
|
|
54724
54914
|
now: Date.now
|
|
54725
54915
|
};
|
|
54726
54916
|
});
|
|
@@ -56715,20 +56905,20 @@ var init_context_percentage = () => {};
|
|
|
56715
56905
|
|
|
56716
56906
|
// src/utils/terminal.ts
|
|
56717
56907
|
import { execSync } from "child_process";
|
|
56718
|
-
import * as
|
|
56719
|
-
import * as
|
|
56908
|
+
import * as fs3 from "fs";
|
|
56909
|
+
import * as path3 from "path";
|
|
56720
56910
|
function getPackageVersion() {
|
|
56721
56911
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
56722
56912
|
return PACKAGE_VERSION;
|
|
56723
56913
|
}
|
|
56724
56914
|
const possiblePaths = [
|
|
56725
|
-
|
|
56726
|
-
|
|
56915
|
+
path3.join(__dirname, "..", "..", "package.json"),
|
|
56916
|
+
path3.join(__dirname, "..", "package.json")
|
|
56727
56917
|
];
|
|
56728
56918
|
for (const packageJsonPath of possiblePaths) {
|
|
56729
56919
|
try {
|
|
56730
|
-
if (
|
|
56731
|
-
const packageJson = JSON.parse(
|
|
56920
|
+
if (fs3.existsSync(packageJsonPath)) {
|
|
56921
|
+
const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf-8"));
|
|
56732
56922
|
return packageJson.version ?? "";
|
|
56733
56923
|
}
|
|
56734
56924
|
} catch {}
|
|
@@ -56736,6 +56926,13 @@ function getPackageVersion() {
|
|
|
56736
56926
|
return "";
|
|
56737
56927
|
}
|
|
56738
56928
|
function probeTerminalWidth() {
|
|
56929
|
+
const overrideRaw = process.env.CCSTATUSLINE_WIDTH;
|
|
56930
|
+
if (overrideRaw) {
|
|
56931
|
+
const override = parsePositiveInteger(overrideRaw);
|
|
56932
|
+
if (override !== null) {
|
|
56933
|
+
return override;
|
|
56934
|
+
}
|
|
56935
|
+
}
|
|
56739
56936
|
if (process.platform === "win32") {
|
|
56740
56937
|
return null;
|
|
56741
56938
|
}
|
|
@@ -56758,7 +56955,8 @@ function probeTerminalWidth() {
|
|
|
56758
56955
|
try {
|
|
56759
56956
|
const width = execSync("tput cols 2>/dev/null", {
|
|
56760
56957
|
encoding: "utf8",
|
|
56761
|
-
stdio: ["pipe", "pipe", "ignore"]
|
|
56958
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
56959
|
+
windowsHide: true
|
|
56762
56960
|
}).trim();
|
|
56763
56961
|
return parsePositiveInteger(width);
|
|
56764
56962
|
} catch {}
|
|
@@ -56776,7 +56974,8 @@ function getParentProcessId(pid) {
|
|
|
56776
56974
|
const parentPidOutput = execSync(`ps -o ppid= -p ${pid}`, {
|
|
56777
56975
|
encoding: "utf8",
|
|
56778
56976
|
stdio: ["pipe", "pipe", "ignore"],
|
|
56779
|
-
shell: "/bin/sh"
|
|
56977
|
+
shell: "/bin/sh",
|
|
56978
|
+
windowsHide: true
|
|
56780
56979
|
}).trim();
|
|
56781
56980
|
return parsePositiveInteger(parentPidOutput);
|
|
56782
56981
|
} catch {
|
|
@@ -56788,7 +56987,8 @@ function getTTYForProcess(pid) {
|
|
|
56788
56987
|
const tty2 = execSync(`ps -o tty= -p ${pid}`, {
|
|
56789
56988
|
encoding: "utf8",
|
|
56790
56989
|
stdio: ["pipe", "pipe", "ignore"],
|
|
56791
|
-
shell: "/bin/sh"
|
|
56990
|
+
shell: "/bin/sh",
|
|
56991
|
+
windowsHide: true
|
|
56792
56992
|
}).replace(/\s+/g, "");
|
|
56793
56993
|
if (!tty2 || tty2 === "??" || tty2 === "?") {
|
|
56794
56994
|
return null;
|
|
@@ -56810,7 +57010,8 @@ function getWidthForTTY(tty2) {
|
|
|
56810
57010
|
const width = execSync(`${cmd} 2>/dev/null | awk '{print $2}'`, {
|
|
56811
57011
|
encoding: "utf8",
|
|
56812
57012
|
stdio: ["pipe", "pipe", "ignore"],
|
|
56813
|
-
shell: "/bin/sh"
|
|
57013
|
+
shell: "/bin/sh",
|
|
57014
|
+
windowsHide: true
|
|
56814
57015
|
}).trim();
|
|
56815
57016
|
const parsed = parsePositiveInteger(width);
|
|
56816
57017
|
if (parsed !== null) {
|
|
@@ -56826,7 +57027,7 @@ function getTerminalWidth() {
|
|
|
56826
57027
|
function canDetectTerminalWidth() {
|
|
56827
57028
|
return probeTerminalWidth() !== null;
|
|
56828
57029
|
}
|
|
56829
|
-
var __dirname = "/home/runner/work/ccstatusline/ccstatusline/src/utils", PACKAGE_VERSION = "2.2.
|
|
57030
|
+
var __dirname = "/home/runner/work/ccstatusline/ccstatusline/src/utils", PACKAGE_VERSION = "2.2.19";
|
|
56830
57031
|
var init_terminal = () => {};
|
|
56831
57032
|
|
|
56832
57033
|
// src/utils/renderer.ts
|
|
@@ -58915,7 +59116,8 @@ class CustomCommandWidget {
|
|
|
58915
59116
|
input: jsonInput,
|
|
58916
59117
|
timeout,
|
|
58917
59118
|
stdio: ["pipe", "pipe", "ignore"],
|
|
58918
|
-
env: process.env
|
|
59119
|
+
env: process.env,
|
|
59120
|
+
windowsHide: true
|
|
58919
59121
|
}).trim();
|
|
58920
59122
|
if (!item.preserveColors) {
|
|
58921
59123
|
output = getVisibleText(output);
|
|
@@ -59582,7 +59784,7 @@ var require_has_flag = __commonJS((exports, module) => {
|
|
|
59582
59784
|
|
|
59583
59785
|
// node_modules/supports-color/index.js
|
|
59584
59786
|
var require_supports_color = __commonJS((exports, module) => {
|
|
59585
|
-
var
|
|
59787
|
+
var os5 = __require("os");
|
|
59586
59788
|
var tty2 = __require("tty");
|
|
59587
59789
|
var hasFlag2 = require_has_flag();
|
|
59588
59790
|
var { env: env3 } = process;
|
|
@@ -59639,7 +59841,7 @@ var require_supports_color = __commonJS((exports, module) => {
|
|
|
59639
59841
|
return min2;
|
|
59640
59842
|
}
|
|
59641
59843
|
if (process.platform === "win32") {
|
|
59642
|
-
const osRelease =
|
|
59844
|
+
const osRelease = os5.release().split(".");
|
|
59643
59845
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
59644
59846
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
59645
59847
|
}
|
|
@@ -59987,7 +60189,7 @@ var init_dist4 = __esm(() => {
|
|
|
59987
60189
|
|
|
59988
60190
|
// node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
59989
60191
|
function parseProxyResponse(socket) {
|
|
59990
|
-
return new Promise((
|
|
60192
|
+
return new Promise((resolve2, reject2) => {
|
|
59991
60193
|
let buffersLength = 0;
|
|
59992
60194
|
const buffers = [];
|
|
59993
60195
|
function read() {
|
|
@@ -60056,7 +60258,7 @@ function parseProxyResponse(socket) {
|
|
|
60056
60258
|
}
|
|
60057
60259
|
debug("got proxy server response: %o %o", firstLine, headers);
|
|
60058
60260
|
cleanup();
|
|
60059
|
-
|
|
60261
|
+
resolve2({
|
|
60060
60262
|
connect: {
|
|
60061
60263
|
statusCode,
|
|
60062
60264
|
statusText,
|
|
@@ -60196,10 +60398,10 @@ var init_usage_types = __esm(() => {
|
|
|
60196
60398
|
|
|
60197
60399
|
// src/utils/usage-fetch.ts
|
|
60198
60400
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
60199
|
-
import * as
|
|
60401
|
+
import * as fs4 from "fs";
|
|
60200
60402
|
import * as https from "https";
|
|
60201
|
-
import * as
|
|
60202
|
-
import * as
|
|
60403
|
+
import * as os5 from "os";
|
|
60404
|
+
import * as path4 from "path";
|
|
60203
60405
|
function getUsageApiBucketUtilization(bucket) {
|
|
60204
60406
|
return bucket === null ? 0 : bucket?.utilization ?? undefined;
|
|
60205
60407
|
}
|
|
@@ -60258,8 +60460,8 @@ function parseUsageApiResponse(rawJson) {
|
|
|
60258
60460
|
};
|
|
60259
60461
|
}
|
|
60260
60462
|
function ensureCacheDirExists() {
|
|
60261
|
-
if (!
|
|
60262
|
-
|
|
60463
|
+
if (!fs4.existsSync(CACHE_DIR)) {
|
|
60464
|
+
fs4.mkdirSync(CACHE_DIR, { recursive: true });
|
|
60263
60465
|
}
|
|
60264
60466
|
}
|
|
60265
60467
|
function setCachedUsageError(error51, now2, maxAge = LOCK_MAX_AGE) {
|
|
@@ -60361,7 +60563,7 @@ function parseMacKeychainCredentialCandidates(rawDump, servicePrefix = MACOS_USA
|
|
|
60361
60563
|
}
|
|
60362
60564
|
function readMacKeychainSecret(service) {
|
|
60363
60565
|
try {
|
|
60364
|
-
return execFileSync3("security", ["find-generic-password", "-s", service, "-w"], { encoding: "utf8", stdio: ["pipe", "pipe", "ignore"] }).trim();
|
|
60566
|
+
return execFileSync3("security", ["find-generic-password", "-s", service, "-w"], { encoding: "utf8", stdio: ["pipe", "pipe", "ignore"], windowsHide: true }).trim();
|
|
60365
60567
|
} catch {
|
|
60366
60568
|
return null;
|
|
60367
60569
|
}
|
|
@@ -60375,7 +60577,8 @@ function listMacKeychainCredentialCandidates() {
|
|
|
60375
60577
|
const rawDump = execFileSync3("security", ["dump-keychain"], {
|
|
60376
60578
|
encoding: "utf8",
|
|
60377
60579
|
maxBuffer: MACOS_SECURITY_DUMP_MAX_BUFFER,
|
|
60378
|
-
stdio: ["pipe", "pipe", "ignore"]
|
|
60580
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
60581
|
+
windowsHide: true
|
|
60379
60582
|
});
|
|
60380
60583
|
return parseMacKeychainCredentialCandidates(rawDump);
|
|
60381
60584
|
} catch {
|
|
@@ -60394,8 +60597,8 @@ function readUsageTokenFromMacKeychainCandidates() {
|
|
|
60394
60597
|
}
|
|
60395
60598
|
function readUsageTokenFromCredentialsFile() {
|
|
60396
60599
|
try {
|
|
60397
|
-
const credFile =
|
|
60398
|
-
return parseUsageAccessToken(
|
|
60600
|
+
const credFile = path4.join(getClaudeConfigDir(), ".credentials.json");
|
|
60601
|
+
return parseUsageAccessToken(fs4.readFileSync(credFile, "utf8"));
|
|
60399
60602
|
} catch {
|
|
60400
60603
|
return null;
|
|
60401
60604
|
}
|
|
@@ -60408,7 +60611,7 @@ function getUsageToken() {
|
|
|
60408
60611
|
}
|
|
60409
60612
|
function readStaleUsageCache() {
|
|
60410
60613
|
try {
|
|
60411
|
-
return parseCachedUsageData(
|
|
60614
|
+
return parseCachedUsageData(fs4.readFileSync(CACHE_FILE, "utf8"));
|
|
60412
60615
|
} catch {
|
|
60413
60616
|
return null;
|
|
60414
60617
|
}
|
|
@@ -60416,13 +60619,13 @@ function readStaleUsageCache() {
|
|
|
60416
60619
|
function writeUsageLock(blockedUntil, error51) {
|
|
60417
60620
|
try {
|
|
60418
60621
|
ensureCacheDirExists();
|
|
60419
|
-
|
|
60622
|
+
fs4.writeFileSync(LOCK_FILE, JSON.stringify({ blockedUntil, error: error51 }));
|
|
60420
60623
|
} catch {}
|
|
60421
60624
|
}
|
|
60422
60625
|
function readActiveUsageLock(now2) {
|
|
60423
60626
|
let hasValidJsonLock = false;
|
|
60424
60627
|
try {
|
|
60425
|
-
const parsed = parseJsonWithSchema(
|
|
60628
|
+
const parsed = parseJsonWithSchema(fs4.readFileSync(LOCK_FILE, "utf8"), UsageLockSchema);
|
|
60426
60629
|
if (parsed) {
|
|
60427
60630
|
hasValidJsonLock = true;
|
|
60428
60631
|
if (parsed.blockedUntil > now2) {
|
|
@@ -60438,7 +60641,7 @@ function readActiveUsageLock(now2) {
|
|
|
60438
60641
|
return null;
|
|
60439
60642
|
}
|
|
60440
60643
|
try {
|
|
60441
|
-
const lockStat =
|
|
60644
|
+
const lockStat = fs4.statSync(LOCK_FILE);
|
|
60442
60645
|
const lockMtime = Math.floor(lockStat.mtimeMs / 1000);
|
|
60443
60646
|
const blockedUntil = lockMtime + LOCK_MAX_AGE;
|
|
60444
60647
|
if (blockedUntil > now2) {
|
|
@@ -60493,14 +60696,14 @@ function getUsageApiRequestOptions(token) {
|
|
|
60493
60696
|
}
|
|
60494
60697
|
}
|
|
60495
60698
|
async function fetchFromUsageApi(token) {
|
|
60496
|
-
return new Promise((
|
|
60699
|
+
return new Promise((resolve2) => {
|
|
60497
60700
|
let settled = false;
|
|
60498
60701
|
const finish = (value) => {
|
|
60499
60702
|
if (settled) {
|
|
60500
60703
|
return;
|
|
60501
60704
|
}
|
|
60502
60705
|
settled = true;
|
|
60503
|
-
|
|
60706
|
+
resolve2(value);
|
|
60504
60707
|
};
|
|
60505
60708
|
const requestOptions = getUsageApiRequestOptions(token);
|
|
60506
60709
|
if (!requestOptions) {
|
|
@@ -60551,10 +60754,10 @@ async function fetchUsageData(options = {}) {
|
|
|
60551
60754
|
}
|
|
60552
60755
|
}
|
|
60553
60756
|
try {
|
|
60554
|
-
const stat =
|
|
60757
|
+
const stat = fs4.statSync(CACHE_FILE);
|
|
60555
60758
|
const fileAge = now2 - Math.floor(stat.mtimeMs / 1000);
|
|
60556
60759
|
if (fileAge < CACHE_MAX_AGE) {
|
|
60557
|
-
const fileData = parseCachedUsageData(
|
|
60760
|
+
const fileData = parseCachedUsageData(fs4.readFileSync(CACHE_FILE, "utf8"));
|
|
60558
60761
|
if (fileData && !fileData.error && hasRequiredUsageFields(fileData, requiredFields)) {
|
|
60559
60762
|
return cacheUsageData(fileData, now2);
|
|
60560
60763
|
}
|
|
@@ -60589,7 +60792,7 @@ async function fetchUsageData(options = {}) {
|
|
|
60589
60792
|
}
|
|
60590
60793
|
try {
|
|
60591
60794
|
ensureCacheDirExists();
|
|
60592
|
-
|
|
60795
|
+
fs4.writeFileSync(CACHE_FILE, JSON.stringify(usageData));
|
|
60593
60796
|
} catch {}
|
|
60594
60797
|
return cacheUsageData(usageData, now2);
|
|
60595
60798
|
} catch {
|
|
@@ -60603,9 +60806,9 @@ var init_usage_fetch = __esm(async () => {
|
|
|
60603
60806
|
init_zod();
|
|
60604
60807
|
init_usage_types();
|
|
60605
60808
|
await init_claude_settings();
|
|
60606
|
-
CACHE_DIR =
|
|
60607
|
-
CACHE_FILE =
|
|
60608
|
-
LOCK_FILE =
|
|
60809
|
+
CACHE_DIR = path4.join(os5.homedir(), ".cache", "ccstatusline");
|
|
60810
|
+
CACHE_FILE = path4.join(CACHE_DIR, "usage.json");
|
|
60811
|
+
LOCK_FILE = path4.join(CACHE_DIR, "usage.lock");
|
|
60609
60812
|
MACOS_SECURITY_DUMP_MAX_BUFFER = 8 * 1024 * 1024;
|
|
60610
60813
|
EXTRA_USAGE_DETAIL_FIELDS = new Set([
|
|
60611
60814
|
"extraUsageLimit",
|
|
@@ -60654,31 +60857,31 @@ var init_usage_fetch = __esm(async () => {
|
|
|
60654
60857
|
|
|
60655
60858
|
// node_modules/fdir/dist/index.mjs
|
|
60656
60859
|
import { createRequire as createRequire2 } from "module";
|
|
60657
|
-
import { basename, dirname, normalize, relative, resolve, sep } from "path";
|
|
60860
|
+
import { basename, dirname as dirname2, normalize, relative, resolve as resolve2, sep } from "path";
|
|
60658
60861
|
import * as nativeFs from "fs";
|
|
60659
|
-
function cleanPath(
|
|
60660
|
-
let normalized = normalize(
|
|
60862
|
+
function cleanPath(path5) {
|
|
60863
|
+
let normalized = normalize(path5);
|
|
60661
60864
|
if (normalized.length > 1 && normalized[normalized.length - 1] === sep)
|
|
60662
60865
|
normalized = normalized.substring(0, normalized.length - 1);
|
|
60663
60866
|
return normalized;
|
|
60664
60867
|
}
|
|
60665
|
-
function convertSlashes(
|
|
60666
|
-
return
|
|
60868
|
+
function convertSlashes(path5, separator) {
|
|
60869
|
+
return path5.replace(SLASHES_REGEX, separator);
|
|
60667
60870
|
}
|
|
60668
|
-
function isRootDirectory(
|
|
60669
|
-
return
|
|
60871
|
+
function isRootDirectory(path5) {
|
|
60872
|
+
return path5 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path5);
|
|
60670
60873
|
}
|
|
60671
|
-
function normalizePath(
|
|
60874
|
+
function normalizePath(path5, options) {
|
|
60672
60875
|
const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
|
|
60673
|
-
const pathNeedsCleaning = process.platform === "win32" &&
|
|
60876
|
+
const pathNeedsCleaning = process.platform === "win32" && path5.includes("/") || path5.startsWith(".");
|
|
60674
60877
|
if (resolvePaths)
|
|
60675
|
-
|
|
60878
|
+
path5 = resolve2(path5);
|
|
60676
60879
|
if (normalizePath$1 || pathNeedsCleaning)
|
|
60677
|
-
|
|
60678
|
-
if (
|
|
60880
|
+
path5 = cleanPath(path5);
|
|
60881
|
+
if (path5 === ".")
|
|
60679
60882
|
return "";
|
|
60680
|
-
const needsSeperator =
|
|
60681
|
-
return convertSlashes(needsSeperator ?
|
|
60883
|
+
const needsSeperator = path5[path5.length - 1] !== pathSeparator;
|
|
60884
|
+
return convertSlashes(needsSeperator ? path5 + pathSeparator : path5, pathSeparator);
|
|
60682
60885
|
}
|
|
60683
60886
|
function joinPathWithBasePath(filename, directoryPath) {
|
|
60684
60887
|
return directoryPath + filename;
|
|
@@ -60744,10 +60947,10 @@ function build$2(options, isSynchronous) {
|
|
|
60744
60947
|
return null;
|
|
60745
60948
|
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
60746
60949
|
}
|
|
60747
|
-
function isRecursive(
|
|
60950
|
+
function isRecursive(path5, resolved, state) {
|
|
60748
60951
|
if (state.options.useRealPaths)
|
|
60749
60952
|
return isRecursiveUsingRealPaths(resolved, state);
|
|
60750
|
-
let parent =
|
|
60953
|
+
let parent = dirname2(path5);
|
|
60751
60954
|
let depth = 1;
|
|
60752
60955
|
while (parent !== state.root && depth < 2) {
|
|
60753
60956
|
const resolvedPath = state.symlinks.get(parent);
|
|
@@ -60755,9 +60958,9 @@ function isRecursive(path4, resolved, state) {
|
|
|
60755
60958
|
if (isSameRoot)
|
|
60756
60959
|
depth++;
|
|
60757
60960
|
else
|
|
60758
|
-
parent =
|
|
60961
|
+
parent = dirname2(parent);
|
|
60759
60962
|
}
|
|
60760
|
-
state.symlinks.set(
|
|
60963
|
+
state.symlinks.set(path5, resolved);
|
|
60761
60964
|
return depth > 1;
|
|
60762
60965
|
}
|
|
60763
60966
|
function isRecursiveUsingRealPaths(resolved, state) {
|
|
@@ -60803,9 +61006,9 @@ function sync(root, options) {
|
|
|
60803
61006
|
var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (directoryPath, paths) => {
|
|
60804
61007
|
paths.push(directoryPath || ".");
|
|
60805
61008
|
}, pushDirectoryFilter = (directoryPath, paths, filters) => {
|
|
60806
|
-
const
|
|
60807
|
-
if (filters.every((filter2) => filter2(
|
|
60808
|
-
paths.push(
|
|
61009
|
+
const path5 = directoryPath || ".";
|
|
61010
|
+
if (filters.every((filter2) => filter2(path5, true)))
|
|
61011
|
+
paths.push(path5);
|
|
60809
61012
|
}, empty$2 = () => {}, pushFileFilterAndCount = (filename, _paths, counts, filters) => {
|
|
60810
61013
|
if (filters.every((filter2) => filter2(filename, false)))
|
|
60811
61014
|
counts.files++;
|
|
@@ -60826,28 +61029,28 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
|
|
|
60826
61029
|
files,
|
|
60827
61030
|
dir: directory
|
|
60828
61031
|
});
|
|
60829
|
-
}, empty = () => {}, resolveSymlinksAsync = function(
|
|
60830
|
-
const { queue, fs:
|
|
61032
|
+
}, empty = () => {}, resolveSymlinksAsync = function(path5, state, callback$1) {
|
|
61033
|
+
const { queue, fs: fs5, options: { suppressErrors } } = state;
|
|
60831
61034
|
queue.enqueue();
|
|
60832
|
-
|
|
61035
|
+
fs5.realpath(path5, (error51, resolvedPath) => {
|
|
60833
61036
|
if (error51)
|
|
60834
61037
|
return queue.dequeue(suppressErrors ? null : error51, state);
|
|
60835
|
-
|
|
61038
|
+
fs5.stat(resolvedPath, (error$1, stat) => {
|
|
60836
61039
|
if (error$1)
|
|
60837
61040
|
return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
60838
|
-
if (stat.isDirectory() && isRecursive(
|
|
61041
|
+
if (stat.isDirectory() && isRecursive(path5, resolvedPath, state))
|
|
60839
61042
|
return queue.dequeue(null, state);
|
|
60840
61043
|
callback$1(stat, resolvedPath);
|
|
60841
61044
|
queue.dequeue(null, state);
|
|
60842
61045
|
});
|
|
60843
61046
|
});
|
|
60844
|
-
}, resolveSymlinks = function(
|
|
60845
|
-
const { queue, fs:
|
|
61047
|
+
}, resolveSymlinks = function(path5, state, callback$1) {
|
|
61048
|
+
const { queue, fs: fs5, options: { suppressErrors } } = state;
|
|
60846
61049
|
queue.enqueue();
|
|
60847
61050
|
try {
|
|
60848
|
-
const resolvedPath =
|
|
60849
|
-
const stat =
|
|
60850
|
-
if (stat.isDirectory() && isRecursive(
|
|
61051
|
+
const resolvedPath = fs5.realpathSync(path5);
|
|
61052
|
+
const stat = fs5.statSync(resolvedPath);
|
|
61053
|
+
if (stat.isDirectory() && isRecursive(path5, resolvedPath, state))
|
|
60851
61054
|
return;
|
|
60852
61055
|
callback$1(stat, resolvedPath);
|
|
60853
61056
|
} catch (e) {
|
|
@@ -60878,22 +61081,22 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
|
|
|
60878
61081
|
state.queue.enqueue();
|
|
60879
61082
|
if (currentDepth < 0)
|
|
60880
61083
|
return state.queue.dequeue(null, state);
|
|
60881
|
-
const { fs:
|
|
61084
|
+
const { fs: fs5 } = state;
|
|
60882
61085
|
state.visited.push(crawlPath);
|
|
60883
61086
|
state.counts.directories++;
|
|
60884
|
-
|
|
61087
|
+
fs5.readdir(crawlPath || ".", readdirOpts, (error51, entries = []) => {
|
|
60885
61088
|
callback$1(entries, directoryPath, currentDepth);
|
|
60886
61089
|
state.queue.dequeue(state.options.suppressErrors ? null : error51, state);
|
|
60887
61090
|
});
|
|
60888
61091
|
}, walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
60889
|
-
const { fs:
|
|
61092
|
+
const { fs: fs5 } = state;
|
|
60890
61093
|
if (currentDepth < 0)
|
|
60891
61094
|
return;
|
|
60892
61095
|
state.visited.push(crawlPath);
|
|
60893
61096
|
state.counts.directories++;
|
|
60894
61097
|
let entries = [];
|
|
60895
61098
|
try {
|
|
60896
|
-
entries =
|
|
61099
|
+
entries = fs5.readdirSync(crawlPath || ".", readdirOpts);
|
|
60897
61100
|
} catch (e) {
|
|
60898
61101
|
if (!state.options.suppressErrors)
|
|
60899
61102
|
throw e;
|
|
@@ -60992,23 +61195,23 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
|
|
|
60992
61195
|
const filename = this.joinPath(entry.name, directoryPath);
|
|
60993
61196
|
this.pushFile(filename, files, this.state.counts, filters);
|
|
60994
61197
|
} else if (entry.isDirectory()) {
|
|
60995
|
-
let
|
|
60996
|
-
if (exclude && exclude(entry.name,
|
|
61198
|
+
let path5 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
61199
|
+
if (exclude && exclude(entry.name, path5))
|
|
60997
61200
|
continue;
|
|
60998
|
-
this.pushDirectory(
|
|
60999
|
-
this.walkDirectory(this.state,
|
|
61201
|
+
this.pushDirectory(path5, paths, filters);
|
|
61202
|
+
this.walkDirectory(this.state, path5, path5, depth - 1, this.walk);
|
|
61000
61203
|
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
61001
|
-
let
|
|
61002
|
-
this.resolveSymlink(
|
|
61204
|
+
let path5 = joinPathWithBasePath(entry.name, directoryPath);
|
|
61205
|
+
this.resolveSymlink(path5, this.state, (stat, resolvedPath) => {
|
|
61003
61206
|
if (stat.isDirectory()) {
|
|
61004
61207
|
resolvedPath = normalizePath(resolvedPath, this.state.options);
|
|
61005
|
-
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath :
|
|
61208
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path5 + pathSeparator))
|
|
61006
61209
|
return;
|
|
61007
|
-
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath :
|
|
61210
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path5 + pathSeparator, depth - 1, this.walk);
|
|
61008
61211
|
} else {
|
|
61009
|
-
resolvedPath = useRealPaths ? resolvedPath :
|
|
61212
|
+
resolvedPath = useRealPaths ? resolvedPath : path5;
|
|
61010
61213
|
const filename = basename(resolvedPath);
|
|
61011
|
-
const directoryPath$1 = normalizePath(
|
|
61214
|
+
const directoryPath$1 = normalizePath(dirname2(resolvedPath), this.state.options);
|
|
61012
61215
|
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
61013
61216
|
this.pushFile(resolvedPath, files, this.state.counts, filters);
|
|
61014
61217
|
}
|
|
@@ -61142,7 +61345,7 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
|
|
|
61142
61345
|
isMatch2 = globFn(patterns, ...options);
|
|
61143
61346
|
this.globCache[patterns.join("\x00")] = isMatch2;
|
|
61144
61347
|
}
|
|
61145
|
-
this.options.filters.push((
|
|
61348
|
+
this.options.filters.push((path5) => isMatch2(path5));
|
|
61146
61349
|
return this;
|
|
61147
61350
|
}
|
|
61148
61351
|
};
|
|
@@ -61355,8 +61558,8 @@ var require_utils = __commonJS((exports) => {
|
|
|
61355
61558
|
}
|
|
61356
61559
|
return output;
|
|
61357
61560
|
};
|
|
61358
|
-
exports.basename = (
|
|
61359
|
-
const segs =
|
|
61561
|
+
exports.basename = (path5, { windows } = {}) => {
|
|
61562
|
+
const segs = path5.split(windows ? /[\\/]/ : "/");
|
|
61360
61563
|
const last2 = segs[segs.length - 1];
|
|
61361
61564
|
if (last2 === "") {
|
|
61362
61565
|
return segs[segs.length - 2];
|
|
@@ -62837,8 +63040,8 @@ var require_picomatch2 = __commonJS((exports, module) => {
|
|
|
62837
63040
|
});
|
|
62838
63041
|
|
|
62839
63042
|
// node_modules/tinyglobby/dist/index.mjs
|
|
62840
|
-
import { readdir, readdirSync, realpath, realpathSync, stat, statSync as
|
|
62841
|
-
import { isAbsolute, posix, resolve as
|
|
63043
|
+
import { readdir, readdirSync, realpath, realpathSync, stat, statSync as statSync4 } from "fs";
|
|
63044
|
+
import { isAbsolute, posix, resolve as resolve3 } from "path";
|
|
62842
63045
|
import { fileURLToPath } from "url";
|
|
62843
63046
|
function getPartialMatcher(patterns, options = {}) {
|
|
62844
63047
|
const patternsCount = patterns.length;
|
|
@@ -62910,10 +63113,10 @@ function buildRelative(cwd2, root) {
|
|
|
62910
63113
|
return p[p.length - 1] === "/" && result2 !== "" ? `${result2}/` : result2 || ".";
|
|
62911
63114
|
};
|
|
62912
63115
|
}
|
|
62913
|
-
function splitPattern(
|
|
63116
|
+
function splitPattern(path5) {
|
|
62914
63117
|
var _result$parts;
|
|
62915
|
-
const result2 = import_picomatch.default.scan(
|
|
62916
|
-
return ((_result$parts = result2.parts) === null || _result$parts === undefined ? undefined : _result$parts.length) ? result2.parts : [
|
|
63118
|
+
const result2 = import_picomatch.default.scan(path5, splitPatternOptions);
|
|
63119
|
+
return ((_result$parts = result2.parts) === null || _result$parts === undefined ? undefined : _result$parts.length) ? result2.parts : [path5];
|
|
62917
63120
|
}
|
|
62918
63121
|
function isDynamicPattern(pattern, options) {
|
|
62919
63122
|
if ((options === null || options === undefined ? undefined : options.caseSensitiveMatch) === false)
|
|
@@ -63029,14 +63232,14 @@ function buildCrawler(options, patterns) {
|
|
|
63029
63232
|
maxDepth = Math.round(options.deep - props.depthOffset);
|
|
63030
63233
|
const crawler = new Builder({
|
|
63031
63234
|
filters: [debug3 ? (p, isDirectory) => {
|
|
63032
|
-
const
|
|
63033
|
-
const matches2 = matcher(
|
|
63235
|
+
const path5 = format(p, isDirectory);
|
|
63236
|
+
const matches2 = matcher(path5) && !ignore(path5);
|
|
63034
63237
|
if (matches2)
|
|
63035
|
-
log(`matched ${
|
|
63238
|
+
log(`matched ${path5}`);
|
|
63036
63239
|
return matches2;
|
|
63037
63240
|
} : (p, isDirectory) => {
|
|
63038
|
-
const
|
|
63039
|
-
return matcher(
|
|
63241
|
+
const path5 = format(p, isDirectory);
|
|
63242
|
+
return matcher(path5) && !ignore(path5);
|
|
63040
63243
|
}],
|
|
63041
63244
|
exclude: debug3 ? (_, p) => {
|
|
63042
63245
|
const skipped = excludePredicate(_, p);
|
|
@@ -63073,7 +63276,7 @@ function getOptions2(options) {
|
|
|
63073
63276
|
...defaultOptions,
|
|
63074
63277
|
...options
|
|
63075
63278
|
};
|
|
63076
|
-
opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) :
|
|
63279
|
+
opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve3(opts.cwd)).replace(BACKSLASHES, "/");
|
|
63077
63280
|
opts.ignore = ensureStringArray(opts.ignore);
|
|
63078
63281
|
opts.fs && (opts.fs = {
|
|
63079
63282
|
readdir: opts.fs.readdir || readdir,
|
|
@@ -63081,7 +63284,7 @@ function getOptions2(options) {
|
|
|
63081
63284
|
realpath: opts.fs.realpath || realpath,
|
|
63082
63285
|
realpathSync: opts.fs.realpathSync || realpathSync,
|
|
63083
63286
|
stat: opts.fs.stat || stat,
|
|
63084
|
-
statSync: opts.fs.statSync ||
|
|
63287
|
+
statSync: opts.fs.statSync || statSync4
|
|
63085
63288
|
});
|
|
63086
63289
|
if (opts.debug)
|
|
63087
63290
|
log("globbing with options:", opts);
|
|
@@ -63100,7 +63303,7 @@ function globSync(globInput, options) {
|
|
|
63100
63303
|
const [crawler, relative2] = getCrawler(globInput, options);
|
|
63101
63304
|
return crawler ? formatPaths(crawler.sync(), relative2) : [];
|
|
63102
63305
|
}
|
|
63103
|
-
var import_picomatch, isReadonlyArray, BACKSLASHES, isWin, ONLY_PARENT_DIRECTORIES, WIN32_ROOT_DIR, isRoot, splitPatternOptions, POSIX_UNESCAPED_GLOB_SYMBOLS, WIN32_UNESCAPED_GLOB_SYMBOLS, escapePosixPath = (
|
|
63306
|
+
var import_picomatch, isReadonlyArray, BACKSLASHES, 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;
|
|
63104
63307
|
var init_dist7 = __esm(() => {
|
|
63105
63308
|
init_dist6();
|
|
63106
63309
|
import_picomatch = __toESM(require_picomatch2(), 1);
|
|
@@ -63127,7 +63330,7 @@ var init_dist7 = __esm(() => {
|
|
|
63127
63330
|
});
|
|
63128
63331
|
|
|
63129
63332
|
// src/utils/jsonl-lines.ts
|
|
63130
|
-
import * as
|
|
63333
|
+
import * as fs5 from "fs";
|
|
63131
63334
|
import { promisify } from "util";
|
|
63132
63335
|
function splitJsonlContent(content) {
|
|
63133
63336
|
return content.trim().split(`
|
|
@@ -63138,7 +63341,7 @@ async function readJsonlLines(filePath) {
|
|
|
63138
63341
|
return splitJsonlContent(content);
|
|
63139
63342
|
}
|
|
63140
63343
|
function readJsonlLinesSync(filePath) {
|
|
63141
|
-
const content =
|
|
63344
|
+
const content = readFileSync7(filePath, "utf-8");
|
|
63142
63345
|
return splitJsonlContent(content);
|
|
63143
63346
|
}
|
|
63144
63347
|
function parseJsonlLine(line) {
|
|
@@ -63148,15 +63351,15 @@ function parseJsonlLine(line) {
|
|
|
63148
63351
|
return null;
|
|
63149
63352
|
}
|
|
63150
63353
|
}
|
|
63151
|
-
var readFile2,
|
|
63354
|
+
var readFile2, readFileSync7;
|
|
63152
63355
|
var init_jsonl_lines = __esm(() => {
|
|
63153
|
-
readFile2 = promisify(
|
|
63154
|
-
|
|
63356
|
+
readFile2 = promisify(fs5.readFile);
|
|
63357
|
+
readFileSync7 = fs5.readFileSync;
|
|
63155
63358
|
});
|
|
63156
63359
|
|
|
63157
63360
|
// src/utils/jsonl-blocks.ts
|
|
63158
|
-
import * as
|
|
63159
|
-
import
|
|
63361
|
+
import * as fs6 from "fs";
|
|
63362
|
+
import path5 from "node:path";
|
|
63160
63363
|
function getBlockMetrics() {
|
|
63161
63364
|
const claudeDir = getClaudeConfigDir();
|
|
63162
63365
|
if (!claudeDir)
|
|
@@ -63170,7 +63373,7 @@ function getBlockMetrics() {
|
|
|
63170
63373
|
function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
|
|
63171
63374
|
const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
|
|
63172
63375
|
const now2 = new Date;
|
|
63173
|
-
const pattern =
|
|
63376
|
+
const pattern = path5.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
|
|
63174
63377
|
const files = globSync([pattern], {
|
|
63175
63378
|
absolute: true,
|
|
63176
63379
|
cwd: rootDir
|
|
@@ -63178,7 +63381,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
|
|
|
63178
63381
|
if (files.length === 0)
|
|
63179
63382
|
return null;
|
|
63180
63383
|
const filesWithStats = files.map((file2) => {
|
|
63181
|
-
const stats =
|
|
63384
|
+
const stats = statSync6(file2);
|
|
63182
63385
|
return { file: file2, mtime: stats.mtime };
|
|
63183
63386
|
});
|
|
63184
63387
|
filesWithStats.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
|
|
@@ -63296,26 +63499,26 @@ function floorToHour(timestamp) {
|
|
|
63296
63499
|
floored.setUTCMinutes(0, 0, 0);
|
|
63297
63500
|
return floored;
|
|
63298
63501
|
}
|
|
63299
|
-
var
|
|
63502
|
+
var statSync6;
|
|
63300
63503
|
var init_jsonl_blocks = __esm(async () => {
|
|
63301
63504
|
init_dist7();
|
|
63302
63505
|
init_jsonl_lines();
|
|
63303
63506
|
await init_claude_settings();
|
|
63304
|
-
|
|
63507
|
+
statSync6 = fs6.statSync;
|
|
63305
63508
|
});
|
|
63306
63509
|
|
|
63307
63510
|
// src/utils/jsonl-cache.ts
|
|
63308
|
-
import * as
|
|
63309
|
-
import { createHash as
|
|
63310
|
-
import
|
|
63311
|
-
import
|
|
63511
|
+
import * as fs7 from "fs";
|
|
63512
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
63513
|
+
import os6 from "node:os";
|
|
63514
|
+
import path6 from "node:path";
|
|
63312
63515
|
function normalizeConfigDir(configDir) {
|
|
63313
|
-
return
|
|
63516
|
+
return path6.resolve(configDir);
|
|
63314
63517
|
}
|
|
63315
63518
|
function getBlockCachePath(configDir = getClaudeConfigDir()) {
|
|
63316
63519
|
const normalizedConfigDir = normalizeConfigDir(configDir);
|
|
63317
|
-
const configHash =
|
|
63318
|
-
return
|
|
63520
|
+
const configHash = createHash3("sha256").update(normalizedConfigDir).digest("hex").slice(0, 16);
|
|
63521
|
+
return path6.join(os6.homedir(), ".cache", "ccstatusline", `block-cache-${configHash}.json`);
|
|
63319
63522
|
}
|
|
63320
63523
|
function readBlockCache(expectedConfigDir) {
|
|
63321
63524
|
try {
|
|
@@ -63324,7 +63527,7 @@ function readBlockCache(expectedConfigDir) {
|
|
|
63324
63527
|
if (!existsSync6(cachePath)) {
|
|
63325
63528
|
return null;
|
|
63326
63529
|
}
|
|
63327
|
-
const content =
|
|
63530
|
+
const content = readFileSync9(cachePath, "utf-8");
|
|
63328
63531
|
const cache3 = JSON.parse(content);
|
|
63329
63532
|
if (typeof cache3.startTime !== "string") {
|
|
63330
63533
|
return null;
|
|
@@ -63350,15 +63553,15 @@ function writeBlockCache(startTime, configDir = getClaudeConfigDir()) {
|
|
|
63350
63553
|
try {
|
|
63351
63554
|
const normalizedConfigDir = normalizeConfigDir(configDir);
|
|
63352
63555
|
const cachePath = getBlockCachePath(normalizedConfigDir);
|
|
63353
|
-
const cacheDir =
|
|
63556
|
+
const cacheDir = path6.dirname(cachePath);
|
|
63354
63557
|
if (!existsSync6(cacheDir)) {
|
|
63355
|
-
|
|
63558
|
+
mkdirSync5(cacheDir, { recursive: true });
|
|
63356
63559
|
}
|
|
63357
63560
|
const cache3 = {
|
|
63358
63561
|
startTime: startTime.toISOString(),
|
|
63359
63562
|
configDir: normalizedConfigDir
|
|
63360
63563
|
};
|
|
63361
|
-
|
|
63564
|
+
writeFileSync5(cachePath, JSON.stringify(cache3), "utf-8");
|
|
63362
63565
|
} catch {}
|
|
63363
63566
|
}
|
|
63364
63567
|
function getCachedBlockMetrics(sessionDurationHours = 5) {
|
|
@@ -63381,21 +63584,21 @@ function getCachedBlockMetrics(sessionDurationHours = 5) {
|
|
|
63381
63584
|
}
|
|
63382
63585
|
return metrics;
|
|
63383
63586
|
}
|
|
63384
|
-
var
|
|
63587
|
+
var readFileSync9, writeFileSync5, mkdirSync5, existsSync6;
|
|
63385
63588
|
var init_jsonl_cache = __esm(async () => {
|
|
63386
63589
|
await __promiseAll([
|
|
63387
63590
|
init_claude_settings(),
|
|
63388
63591
|
init_jsonl_blocks()
|
|
63389
63592
|
]);
|
|
63390
|
-
|
|
63391
|
-
|
|
63392
|
-
|
|
63393
|
-
existsSync6 =
|
|
63593
|
+
readFileSync9 = fs7.readFileSync;
|
|
63594
|
+
writeFileSync5 = fs7.writeFileSync;
|
|
63595
|
+
mkdirSync5 = fs7.mkdirSync;
|
|
63596
|
+
existsSync6 = fs7.existsSync;
|
|
63394
63597
|
});
|
|
63395
63598
|
|
|
63396
63599
|
// src/utils/jsonl-metrics.ts
|
|
63397
|
-
import * as
|
|
63398
|
-
import
|
|
63600
|
+
import * as fs8 from "fs";
|
|
63601
|
+
import path7 from "node:path";
|
|
63399
63602
|
function collectAgentIds(value, agentIds) {
|
|
63400
63603
|
if (!value || typeof value !== "object") {
|
|
63401
63604
|
return;
|
|
@@ -63427,7 +63630,7 @@ function getReferencedSubagentIds(lines) {
|
|
|
63427
63630
|
}
|
|
63428
63631
|
async function getSessionDuration(transcriptPath) {
|
|
63429
63632
|
try {
|
|
63430
|
-
if (!
|
|
63633
|
+
if (!fs8.existsSync(transcriptPath)) {
|
|
63431
63634
|
return null;
|
|
63432
63635
|
}
|
|
63433
63636
|
const lines = await readJsonlLines(transcriptPath);
|
|
@@ -63477,7 +63680,7 @@ async function getSessionDuration(transcriptPath) {
|
|
|
63477
63680
|
}
|
|
63478
63681
|
async function getTokenMetrics(transcriptPath) {
|
|
63479
63682
|
try {
|
|
63480
|
-
if (!
|
|
63683
|
+
if (!fs8.existsSync(transcriptPath)) {
|
|
63481
63684
|
return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
|
|
63482
63685
|
}
|
|
63483
63686
|
const lines = await readJsonlLines(transcriptPath);
|
|
@@ -63691,20 +63894,20 @@ function getSubagentTranscriptPaths(transcriptPath, referencedAgentIds) {
|
|
|
63691
63894
|
if (referencedAgentIds.size === 0) {
|
|
63692
63895
|
return [];
|
|
63693
63896
|
}
|
|
63694
|
-
const transcriptDir =
|
|
63695
|
-
const transcriptStem =
|
|
63897
|
+
const transcriptDir = path7.dirname(transcriptPath);
|
|
63898
|
+
const transcriptStem = path7.parse(transcriptPath).name;
|
|
63696
63899
|
const candidateDirs = [
|
|
63697
|
-
|
|
63698
|
-
|
|
63900
|
+
path7.join(transcriptDir, "subagents"),
|
|
63901
|
+
path7.join(transcriptDir, transcriptStem, "subagents")
|
|
63699
63902
|
];
|
|
63700
63903
|
const seenPaths = new Set;
|
|
63701
63904
|
const matchedPaths = [];
|
|
63702
63905
|
for (const subagentsDir of candidateDirs) {
|
|
63703
|
-
if (!
|
|
63906
|
+
if (!fs8.existsSync(subagentsDir)) {
|
|
63704
63907
|
continue;
|
|
63705
63908
|
}
|
|
63706
63909
|
try {
|
|
63707
|
-
const dirEntries =
|
|
63910
|
+
const dirEntries = fs8.readdirSync(subagentsDir, { withFileTypes: true });
|
|
63708
63911
|
for (const entry of dirEntries) {
|
|
63709
63912
|
if (!entry.isFile()) {
|
|
63710
63913
|
continue;
|
|
@@ -63716,7 +63919,7 @@ function getSubagentTranscriptPaths(transcriptPath, referencedAgentIds) {
|
|
|
63716
63919
|
if (!referencedAgentIds.has(match[1])) {
|
|
63717
63920
|
continue;
|
|
63718
63921
|
}
|
|
63719
|
-
const fullPath =
|
|
63922
|
+
const fullPath = path7.join(subagentsDir, entry.name);
|
|
63720
63923
|
if (seenPaths.has(fullPath)) {
|
|
63721
63924
|
continue;
|
|
63722
63925
|
}
|
|
@@ -63733,7 +63936,7 @@ async function getSpeedMetricsCollection(transcriptPath, options = {}) {
|
|
|
63733
63936
|
const normalizedWindows = Array.from(new Set((options.windowSeconds ?? []).map((window2) => normalizeWindowSeconds(window2)).filter((window2) => window2 !== null)));
|
|
63734
63937
|
const emptyWindowedMetrics = buildEmptyWindowedMetrics(normalizedWindows);
|
|
63735
63938
|
try {
|
|
63736
|
-
if (!
|
|
63939
|
+
if (!fs8.existsSync(transcriptPath)) {
|
|
63737
63940
|
return {
|
|
63738
63941
|
sessionAverage: createEmptySpeedMetrics(),
|
|
63739
63942
|
windowed: emptyWindowedMetrics
|
|
@@ -64148,7 +64351,7 @@ var init_BlockTimer = __esm(async () => {
|
|
|
64148
64351
|
});
|
|
64149
64352
|
|
|
64150
64353
|
// src/widgets/CurrentWorkingDir.tsx
|
|
64151
|
-
import * as
|
|
64354
|
+
import * as os7 from "node:os";
|
|
64152
64355
|
|
|
64153
64356
|
class CurrentWorkingDirWidget {
|
|
64154
64357
|
getDefaultColor() {
|
|
@@ -64293,27 +64496,27 @@ class CurrentWorkingDirWidget {
|
|
|
64293
64496
|
supportsColors(item) {
|
|
64294
64497
|
return true;
|
|
64295
64498
|
}
|
|
64296
|
-
abbreviateHomeDir(
|
|
64297
|
-
const homeDir =
|
|
64298
|
-
if (
|
|
64499
|
+
abbreviateHomeDir(path8) {
|
|
64500
|
+
const homeDir = os7.homedir();
|
|
64501
|
+
if (path8 === homeDir) {
|
|
64299
64502
|
return "~";
|
|
64300
64503
|
}
|
|
64301
|
-
if (
|
|
64302
|
-
const boundaryChar =
|
|
64504
|
+
if (path8.startsWith(homeDir)) {
|
|
64505
|
+
const boundaryChar = path8[homeDir.length];
|
|
64303
64506
|
if (boundaryChar !== "/" && boundaryChar !== "\\") {
|
|
64304
|
-
return
|
|
64507
|
+
return path8;
|
|
64305
64508
|
}
|
|
64306
|
-
return "~" +
|
|
64509
|
+
return "~" + path8.slice(homeDir.length);
|
|
64307
64510
|
}
|
|
64308
|
-
return
|
|
64511
|
+
return path8;
|
|
64309
64512
|
}
|
|
64310
|
-
abbreviatePath(
|
|
64311
|
-
const homeDir =
|
|
64312
|
-
const useBackslash =
|
|
64513
|
+
abbreviatePath(path8) {
|
|
64514
|
+
const homeDir = os7.homedir();
|
|
64515
|
+
const useBackslash = path8.includes("\\") && !path8.includes("/");
|
|
64313
64516
|
const sep2 = useBackslash ? "\\" : "/";
|
|
64314
|
-
let normalizedPath =
|
|
64315
|
-
if (
|
|
64316
|
-
normalizedPath = "~" +
|
|
64517
|
+
let normalizedPath = path8;
|
|
64518
|
+
if (path8.startsWith(homeDir)) {
|
|
64519
|
+
normalizedPath = "~" + path8.slice(homeDir.length);
|
|
64317
64520
|
}
|
|
64318
64521
|
const parts = normalizedPath.split(/[\\/]+/).filter((part) => part !== "");
|
|
64319
64522
|
const abbreviated = parts.map((part, index) => {
|
|
@@ -64445,6 +64648,7 @@ function runJjArgs(args, context, allowEmpty = false) {
|
|
|
64445
64648
|
const output = execFileSync4("jj", args, {
|
|
64446
64649
|
encoding: "utf8",
|
|
64447
64650
|
stdio: ["pipe", "pipe", "ignore"],
|
|
64651
|
+
windowsHide: true,
|
|
64448
64652
|
...cwd2 ? { cwd: cwd2 } : {}
|
|
64449
64653
|
}).trimEnd();
|
|
64450
64654
|
return allowEmpty || output.length > 0 ? output : null;
|
|
@@ -65082,7 +65286,7 @@ var init_JjRevision = __esm(() => {
|
|
|
65082
65286
|
});
|
|
65083
65287
|
|
|
65084
65288
|
// src/widgets/ClaudeAccountEmail.ts
|
|
65085
|
-
import * as
|
|
65289
|
+
import * as fs9 from "fs";
|
|
65086
65290
|
|
|
65087
65291
|
class ClaudeAccountEmailWidget {
|
|
65088
65292
|
getDefaultColor() {
|
|
@@ -65105,7 +65309,7 @@ class ClaudeAccountEmailWidget {
|
|
|
65105
65309
|
return item.rawValue ? "you@example.com" : "Account: you@example.com";
|
|
65106
65310
|
}
|
|
65107
65311
|
try {
|
|
65108
|
-
const content =
|
|
65312
|
+
const content = fs9.readFileSync(getClaudeJsonPath(), "utf-8");
|
|
65109
65313
|
const data = JSON.parse(content);
|
|
65110
65314
|
const email3 = data.oauthAccount?.emailAddress;
|
|
65111
65315
|
if (typeof email3 !== "string" || email3.length === 0) {
|
|
@@ -65459,7 +65663,7 @@ var init_TotalSpeed = __esm(async () => {
|
|
|
65459
65663
|
|
|
65460
65664
|
// src/widgets/FreeMemory.ts
|
|
65461
65665
|
import { execSync as execSync3 } from "child_process";
|
|
65462
|
-
import
|
|
65666
|
+
import os8 from "os";
|
|
65463
65667
|
function formatBytes(bytes) {
|
|
65464
65668
|
const GB = 1024 ** 3;
|
|
65465
65669
|
const MB = 1024 ** 2;
|
|
@@ -65474,7 +65678,7 @@ function formatBytes(bytes) {
|
|
|
65474
65678
|
}
|
|
65475
65679
|
function getUsedMemoryMacOS() {
|
|
65476
65680
|
try {
|
|
65477
|
-
const output = execSync3("vm_stat", { encoding: "utf8" });
|
|
65681
|
+
const output = execSync3("vm_stat", { encoding: "utf8", windowsHide: true });
|
|
65478
65682
|
const lines = output.split(`
|
|
65479
65683
|
`);
|
|
65480
65684
|
const firstLine = lines[0];
|
|
@@ -65523,12 +65727,12 @@ class FreeMemoryWidget {
|
|
|
65523
65727
|
if (context.isPreview) {
|
|
65524
65728
|
return item.rawValue ? "12.4G/16.0G" : "Mem: 12.4G/16.0G";
|
|
65525
65729
|
}
|
|
65526
|
-
const total =
|
|
65730
|
+
const total = os8.totalmem();
|
|
65527
65731
|
let used;
|
|
65528
|
-
if (
|
|
65529
|
-
used = getUsedMemoryMacOS() ?? total -
|
|
65732
|
+
if (os8.platform() === "darwin") {
|
|
65733
|
+
used = getUsedMemoryMacOS() ?? total - os8.freemem();
|
|
65530
65734
|
} else {
|
|
65531
|
-
used = total -
|
|
65735
|
+
used = total - os8.freemem();
|
|
65532
65736
|
}
|
|
65533
65737
|
const value = `${formatBytes(used)}/${formatBytes(total)}`;
|
|
65534
65738
|
return item.rawValue ? value : `Mem: ${value}`;
|
|
@@ -65543,7 +65747,7 @@ class FreeMemoryWidget {
|
|
|
65543
65747
|
var init_FreeMemory = () => {};
|
|
65544
65748
|
|
|
65545
65749
|
// src/widgets/SessionName.ts
|
|
65546
|
-
import * as
|
|
65750
|
+
import * as fs10 from "fs";
|
|
65547
65751
|
|
|
65548
65752
|
class SessionNameWidget {
|
|
65549
65753
|
getDefaultColor() {
|
|
@@ -65570,7 +65774,7 @@ class SessionNameWidget {
|
|
|
65570
65774
|
return null;
|
|
65571
65775
|
}
|
|
65572
65776
|
try {
|
|
65573
|
-
const content =
|
|
65777
|
+
const content = fs10.readFileSync(transcriptPath, "utf-8");
|
|
65574
65778
|
const lines = content.split(`
|
|
65575
65779
|
`);
|
|
65576
65780
|
for (let i = lines.length - 1;i >= 0; i--) {
|
|
@@ -68383,11 +68587,11 @@ var init_hooks = __esm(async () => {
|
|
|
68383
68587
|
});
|
|
68384
68588
|
|
|
68385
68589
|
// src/utils/config.ts
|
|
68386
|
-
import * as
|
|
68387
|
-
import * as
|
|
68388
|
-
import * as
|
|
68590
|
+
import * as fs11 from "fs";
|
|
68591
|
+
import * as os9 from "os";
|
|
68592
|
+
import * as path8 from "path";
|
|
68389
68593
|
function initConfigPath(filePath) {
|
|
68390
|
-
settingsPath = filePath ?
|
|
68594
|
+
settingsPath = filePath ? path8.resolve(filePath) : DEFAULT_SETTINGS_PATH;
|
|
68391
68595
|
}
|
|
68392
68596
|
function getConfigPath() {
|
|
68393
68597
|
return settingsPath;
|
|
@@ -68396,13 +68600,13 @@ function isCustomConfigPath() {
|
|
|
68396
68600
|
return settingsPath !== DEFAULT_SETTINGS_PATH;
|
|
68397
68601
|
}
|
|
68398
68602
|
function getSettingsPaths() {
|
|
68399
|
-
const configDir =
|
|
68400
|
-
const parsedPath =
|
|
68603
|
+
const configDir = path8.dirname(settingsPath);
|
|
68604
|
+
const parsedPath = path8.parse(settingsPath);
|
|
68401
68605
|
const backupBaseName = parsedPath.ext ? `${parsedPath.name}.bak` : `${parsedPath.base}.bak`;
|
|
68402
68606
|
return {
|
|
68403
68607
|
configDir,
|
|
68404
68608
|
settingsPath,
|
|
68405
|
-
settingsBackupPath:
|
|
68609
|
+
settingsBackupPath: path8.join(configDir, backupBaseName)
|
|
68406
68610
|
};
|
|
68407
68611
|
}
|
|
68408
68612
|
async function writeSettingsJson(settings, paths) {
|
|
@@ -68411,7 +68615,7 @@ async function writeSettingsJson(settings, paths) {
|
|
|
68411
68615
|
}
|
|
68412
68616
|
async function backupBadSettings(paths) {
|
|
68413
68617
|
try {
|
|
68414
|
-
if (
|
|
68618
|
+
if (fs11.existsSync(paths.settingsPath)) {
|
|
68415
68619
|
const content = await readFile3(paths.settingsPath, "utf-8");
|
|
68416
68620
|
await writeFile(paths.settingsBackupPath, content, "utf-8");
|
|
68417
68621
|
console.error(`Bad settings backed up to ${paths.settingsBackupPath}`);
|
|
@@ -68441,7 +68645,7 @@ async function recoverWithDefaults(paths) {
|
|
|
68441
68645
|
async function loadSettings() {
|
|
68442
68646
|
const paths = getSettingsPaths();
|
|
68443
68647
|
try {
|
|
68444
|
-
if (!
|
|
68648
|
+
if (!fs11.existsSync(paths.settingsPath))
|
|
68445
68649
|
return await writeDefaultSettings(paths);
|
|
68446
68650
|
const content = await readFile3(paths.settingsPath, "utf-8");
|
|
68447
68651
|
let rawData;
|
|
@@ -68492,7 +68696,7 @@ async function saveSettings(settings) {
|
|
|
68492
68696
|
}
|
|
68493
68697
|
async function saveInstallationMetadata(metadata) {
|
|
68494
68698
|
const paths = getSettingsPaths();
|
|
68495
|
-
if (!metadata && !
|
|
68699
|
+
if (!metadata && !fs11.existsSync(paths.settingsPath)) {
|
|
68496
68700
|
return;
|
|
68497
68701
|
}
|
|
68498
68702
|
const settings = await loadSettings();
|
|
@@ -68512,18 +68716,18 @@ var init_config = __esm(async () => {
|
|
|
68512
68716
|
init_Settings();
|
|
68513
68717
|
init_migrations();
|
|
68514
68718
|
await init_widgets2();
|
|
68515
|
-
readFile3 =
|
|
68516
|
-
writeFile =
|
|
68517
|
-
mkdir =
|
|
68518
|
-
DEFAULT_SETTINGS_PATH =
|
|
68719
|
+
readFile3 = fs11.promises.readFile;
|
|
68720
|
+
writeFile = fs11.promises.writeFile;
|
|
68721
|
+
mkdir = fs11.promises.mkdir;
|
|
68722
|
+
DEFAULT_SETTINGS_PATH = path8.join(os9.homedir(), ".config", "ccstatusline", "settings.json");
|
|
68519
68723
|
settingsPath = DEFAULT_SETTINGS_PATH;
|
|
68520
68724
|
});
|
|
68521
68725
|
|
|
68522
68726
|
// src/utils/claude-settings.ts
|
|
68523
68727
|
import { execSync as execSync4 } from "child_process";
|
|
68524
|
-
import * as
|
|
68525
|
-
import * as
|
|
68526
|
-
import * as
|
|
68728
|
+
import * as fs12 from "fs";
|
|
68729
|
+
import * as os10 from "os";
|
|
68730
|
+
import * as path9 from "path";
|
|
68527
68731
|
function isKnownCommand(command) {
|
|
68528
68732
|
const prefixes = [CCSTATUSLINE_COMMANDS.AUTO_NPX, CCSTATUSLINE_COMMANDS.AUTO_BUNX, CCSTATUSLINE_COMMANDS.GLOBAL];
|
|
68529
68733
|
return prefixes.some((prefix) => command === prefix || command.startsWith(`${prefix} --config `)) || /(?:^|[\s"'\\/])ccstatusline\.ts(?=$|[\s"'])/.test(command);
|
|
@@ -68547,9 +68751,9 @@ function getClaudeConfigDir() {
|
|
|
68547
68751
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
68548
68752
|
if (envConfigDir) {
|
|
68549
68753
|
try {
|
|
68550
|
-
const resolvedPath =
|
|
68551
|
-
if (
|
|
68552
|
-
const stats =
|
|
68754
|
+
const resolvedPath = path9.resolve(envConfigDir);
|
|
68755
|
+
if (fs12.existsSync(resolvedPath)) {
|
|
68756
|
+
const stats = fs12.statSync(resolvedPath);
|
|
68553
68757
|
if (stats.isDirectory()) {
|
|
68554
68758
|
return resolvedPath;
|
|
68555
68759
|
}
|
|
@@ -68558,24 +68762,24 @@ function getClaudeConfigDir() {
|
|
|
68558
68762
|
}
|
|
68559
68763
|
} catch {}
|
|
68560
68764
|
}
|
|
68561
|
-
return
|
|
68765
|
+
return path9.join(os10.homedir(), ".claude");
|
|
68562
68766
|
}
|
|
68563
68767
|
function getClaudeJsonPath() {
|
|
68564
68768
|
const configDir = getClaudeConfigDir();
|
|
68565
68769
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
68566
|
-
if (envConfigDir && configDir ===
|
|
68567
|
-
return
|
|
68770
|
+
if (envConfigDir && configDir === path9.resolve(envConfigDir)) {
|
|
68771
|
+
return path9.join(configDir, ".claude.json");
|
|
68568
68772
|
}
|
|
68569
|
-
return
|
|
68773
|
+
return path9.join(path9.dirname(configDir), ".claude.json");
|
|
68570
68774
|
}
|
|
68571
68775
|
function getClaudeSettingsPath() {
|
|
68572
|
-
return
|
|
68776
|
+
return path9.join(getClaudeConfigDir(), "settings.json");
|
|
68573
68777
|
}
|
|
68574
68778
|
async function backupClaudeSettings(suffix = ".bak") {
|
|
68575
68779
|
const settingsPath2 = getClaudeSettingsPath();
|
|
68576
68780
|
const backupPath = settingsPath2 + suffix;
|
|
68577
68781
|
try {
|
|
68578
|
-
if (
|
|
68782
|
+
if (fs12.existsSync(settingsPath2)) {
|
|
68579
68783
|
const content = await readFile4(settingsPath2, "utf-8");
|
|
68580
68784
|
await writeFile2(backupPath, content, "utf-8");
|
|
68581
68785
|
return backupPath;
|
|
@@ -68588,11 +68792,11 @@ async function backupClaudeSettings(suffix = ".bak") {
|
|
|
68588
68792
|
function loadClaudeSettingsSync(options = {}) {
|
|
68589
68793
|
const { logErrors = true } = options;
|
|
68590
68794
|
const settingsPath2 = getClaudeSettingsPath();
|
|
68591
|
-
if (!
|
|
68795
|
+
if (!fs12.existsSync(settingsPath2)) {
|
|
68592
68796
|
return {};
|
|
68593
68797
|
}
|
|
68594
68798
|
try {
|
|
68595
|
-
const content =
|
|
68799
|
+
const content = fs12.readFileSync(settingsPath2, "utf-8");
|
|
68596
68800
|
return JSON.parse(content);
|
|
68597
68801
|
} catch (error51) {
|
|
68598
68802
|
if (logErrors) {
|
|
@@ -68604,7 +68808,7 @@ function loadClaudeSettingsSync(options = {}) {
|
|
|
68604
68808
|
async function loadClaudeSettings(options = {}) {
|
|
68605
68809
|
const { logErrors = true } = options;
|
|
68606
68810
|
const settingsPath2 = getClaudeSettingsPath();
|
|
68607
|
-
if (!
|
|
68811
|
+
if (!fs12.existsSync(settingsPath2)) {
|
|
68608
68812
|
return {};
|
|
68609
68813
|
}
|
|
68610
68814
|
try {
|
|
@@ -68619,7 +68823,7 @@ async function loadClaudeSettings(options = {}) {
|
|
|
68619
68823
|
}
|
|
68620
68824
|
async function saveClaudeSettings(settings) {
|
|
68621
68825
|
const settingsPath2 = getClaudeSettingsPath();
|
|
68622
|
-
const dir =
|
|
68826
|
+
const dir = path9.dirname(settingsPath2);
|
|
68623
68827
|
await backupClaudeSettings();
|
|
68624
68828
|
await mkdir2(dir, { recursive: true });
|
|
68625
68829
|
await writeFile2(settingsPath2, JSON.stringify(settings, null, 2), "utf-8");
|
|
@@ -68637,7 +68841,7 @@ async function isInstalled() {
|
|
|
68637
68841
|
function isExecutableAvailable(executable) {
|
|
68638
68842
|
try {
|
|
68639
68843
|
const command = process.platform === "win32" ? `where ${executable}` : `which ${executable}`;
|
|
68640
|
-
execSync4(command, { stdio: "ignore" });
|
|
68844
|
+
execSync4(command, { stdio: "ignore", windowsHide: true });
|
|
68641
68845
|
return true;
|
|
68642
68846
|
} catch {
|
|
68643
68847
|
return false;
|
|
@@ -68665,7 +68869,12 @@ function getPackageCommandAvailability() {
|
|
|
68665
68869
|
}
|
|
68666
68870
|
function getClaudeCodeVersion() {
|
|
68667
68871
|
try {
|
|
68668
|
-
const output = execSync4("claude --version", {
|
|
68872
|
+
const output = execSync4("claude --version", {
|
|
68873
|
+
encoding: "utf-8",
|
|
68874
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
68875
|
+
timeout: 5000,
|
|
68876
|
+
windowsHide: true
|
|
68877
|
+
}).trim();
|
|
68669
68878
|
const match = /^(\d+\.\d+\.\d+)/.exec(output);
|
|
68670
68879
|
return match?.[1] ?? null;
|
|
68671
68880
|
} catch {
|
|
@@ -68752,7 +68961,7 @@ function classifyInstallation(command, metadata) {
|
|
|
68752
68961
|
}
|
|
68753
68962
|
async function loadSavedSettingsForHookSync() {
|
|
68754
68963
|
const configPath = getConfigPath();
|
|
68755
|
-
if (!
|
|
68964
|
+
if (!fs12.existsSync(configPath)) {
|
|
68756
68965
|
return null;
|
|
68757
68966
|
}
|
|
68758
68967
|
try {
|
|
@@ -68853,19 +69062,19 @@ async function setRefreshInterval(interval) {
|
|
|
68853
69062
|
}
|
|
68854
69063
|
function getVoiceConfigCandidatePathsByPriority(cwd2) {
|
|
68855
69064
|
const userDir = getClaudeConfigDir();
|
|
68856
|
-
const projectDir =
|
|
69065
|
+
const projectDir = path9.join(cwd2, ".claude");
|
|
68857
69066
|
const candidates = [
|
|
68858
|
-
|
|
68859
|
-
|
|
68860
|
-
|
|
68861
|
-
|
|
69067
|
+
path9.join(projectDir, "settings.local.json"),
|
|
69068
|
+
path9.join(projectDir, "settings.json"),
|
|
69069
|
+
path9.join(userDir, "settings.local.json"),
|
|
69070
|
+
path9.join(userDir, "settings.json")
|
|
68862
69071
|
];
|
|
68863
69072
|
return Array.from(new Set(candidates));
|
|
68864
69073
|
}
|
|
68865
69074
|
function tryReadVoiceLayer(filePath) {
|
|
68866
69075
|
let content;
|
|
68867
69076
|
try {
|
|
68868
|
-
content =
|
|
69077
|
+
content = fs12.readFileSync(filePath, "utf-8");
|
|
68869
69078
|
} catch (error51) {
|
|
68870
69079
|
const isMissing = error51.code === "ENOENT";
|
|
68871
69080
|
return { fileExisted: !isMissing, enabled: undefined };
|
|
@@ -68900,9 +69109,9 @@ var init_claude_settings = __esm(async () => {
|
|
|
68900
69109
|
init_zod();
|
|
68901
69110
|
init_Settings();
|
|
68902
69111
|
await init_config();
|
|
68903
|
-
readFile4 =
|
|
68904
|
-
writeFile2 =
|
|
68905
|
-
mkdir2 =
|
|
69112
|
+
readFile4 = fs12.promises.readFile;
|
|
69113
|
+
writeFile2 = fs12.promises.writeFile;
|
|
69114
|
+
mkdir2 = fs12.promises.mkdir;
|
|
68906
69115
|
CCSTATUSLINE_COMMANDS = {
|
|
68907
69116
|
AUTO_NPX: "npx -y ccstatusline@latest",
|
|
68908
69117
|
AUTO_BUNX: "bunx -y ccstatusline@latest",
|
|
@@ -69504,7 +69713,7 @@ await init_config();
|
|
|
69504
69713
|
|
|
69505
69714
|
// src/utils/global-command-resolution.ts
|
|
69506
69715
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
69507
|
-
import * as
|
|
69716
|
+
import * as path10 from "path";
|
|
69508
69717
|
|
|
69509
69718
|
// src/utils/package-manager-executable.ts
|
|
69510
69719
|
function getPackageManagerExecutable(packageManager, platform2 = process.platform) {
|
|
@@ -69531,11 +69740,19 @@ function isTransientBunxStatusLinePath(filePath) {
|
|
|
69531
69740
|
return /(?:^|\/)bunx-[^/]*ccstatusline@[^/]+\/node_modules\/\.bin\/ccstatusline(?:\.(?:cmd|ps1))?$/i.test(normalized);
|
|
69532
69741
|
}
|
|
69533
69742
|
function getPersistentCommandResolutionPaths(paths) {
|
|
69534
|
-
return paths.filter((
|
|
69743
|
+
return paths.filter((path11) => !isTransientBunxStatusLinePath(path11));
|
|
69535
69744
|
}
|
|
69536
69745
|
function getCommandResolutionPaths(command, { platform: platform2 = process.platform } = {}) {
|
|
69537
69746
|
try {
|
|
69538
|
-
const output = platform2 === "win32" ? execFileSync5("where", [command], {
|
|
69747
|
+
const output = platform2 === "win32" ? execFileSync5("where", [command], {
|
|
69748
|
+
encoding: "utf-8",
|
|
69749
|
+
timeout: COMMAND_LOOKUP_TIMEOUT_MS,
|
|
69750
|
+
windowsHide: true
|
|
69751
|
+
}) : execFileSync5("which", ["-a", command], {
|
|
69752
|
+
encoding: "utf-8",
|
|
69753
|
+
timeout: COMMAND_LOOKUP_TIMEOUT_MS,
|
|
69754
|
+
windowsHide: true
|
|
69755
|
+
});
|
|
69539
69756
|
return splitCommandOutput(output);
|
|
69540
69757
|
} catch {
|
|
69541
69758
|
return [];
|
|
@@ -69545,12 +69762,13 @@ function getNpmGlobalBinDir(platform2) {
|
|
|
69545
69762
|
try {
|
|
69546
69763
|
const prefix = execFileSync5(getPackageManagerExecutable("npm", platform2), ["prefix", "-g"], {
|
|
69547
69764
|
encoding: "utf-8",
|
|
69548
|
-
timeout: COMMAND_LOOKUP_TIMEOUT_MS
|
|
69765
|
+
timeout: COMMAND_LOOKUP_TIMEOUT_MS,
|
|
69766
|
+
windowsHide: true
|
|
69549
69767
|
}).trim();
|
|
69550
69768
|
if (!prefix) {
|
|
69551
69769
|
return null;
|
|
69552
69770
|
}
|
|
69553
|
-
return platform2 === "win32" || /^[a-z]:[\\/]/i.test(prefix) ? prefix :
|
|
69771
|
+
return platform2 === "win32" || /^[a-z]:[\\/]/i.test(prefix) ? prefix : path10.join(prefix, "bin");
|
|
69554
69772
|
} catch {
|
|
69555
69773
|
return null;
|
|
69556
69774
|
}
|
|
@@ -69559,7 +69777,8 @@ function getBunGlobalBinDir() {
|
|
|
69559
69777
|
try {
|
|
69560
69778
|
const binDir = execFileSync5("bun", ["pm", "bin", "-g"], {
|
|
69561
69779
|
encoding: "utf-8",
|
|
69562
|
-
timeout: COMMAND_LOOKUP_TIMEOUT_MS
|
|
69780
|
+
timeout: COMMAND_LOOKUP_TIMEOUT_MS,
|
|
69781
|
+
windowsHide: true
|
|
69563
69782
|
}).trim();
|
|
69564
69783
|
return binDir || null;
|
|
69565
69784
|
} catch {
|
|
@@ -69653,7 +69872,7 @@ import {
|
|
|
69653
69872
|
execFile,
|
|
69654
69873
|
execFileSync as execFileSync6
|
|
69655
69874
|
} from "child_process";
|
|
69656
|
-
import * as
|
|
69875
|
+
import * as fs13 from "fs";
|
|
69657
69876
|
var GLOBAL_PACKAGE_TIMEOUT_MS = 120000;
|
|
69658
69877
|
var VERSION_LOOKUP_TIMEOUT_MS = 5000;
|
|
69659
69878
|
var WINDOWS_SHIM_EXTENSIONS = [
|
|
@@ -69702,7 +69921,7 @@ function getBinaryPathCandidates(binDir, platform2) {
|
|
|
69702
69921
|
return extensions.map((extension) => appendPathSegment(binDir, `ccstatusline${extension}`));
|
|
69703
69922
|
}
|
|
69704
69923
|
function hasBinaryOnDisk(binDir, platform2) {
|
|
69705
|
-
return getBinaryPathCandidates(binDir, platform2).some((candidate) => getFilesystemPathVariants(candidate).some((variant) =>
|
|
69924
|
+
return getBinaryPathCandidates(binDir, platform2).some((candidate) => getFilesystemPathVariants(candidate).some((variant) => fs13.existsSync(variant)));
|
|
69706
69925
|
}
|
|
69707
69926
|
function hasResolvedBinaryInDir(resolvedPaths, binDir) {
|
|
69708
69927
|
return resolvedPaths.some((resolvedPath) => isPathInsideDir(resolvedPath, binDir));
|
|
@@ -69735,10 +69954,10 @@ function formatPathList2(paths) {
|
|
|
69735
69954
|
function readPackageVersion(packageJsonPath) {
|
|
69736
69955
|
for (const variant of getFilesystemPathVariants(packageJsonPath)) {
|
|
69737
69956
|
try {
|
|
69738
|
-
if (!
|
|
69957
|
+
if (!fs13.existsSync(variant)) {
|
|
69739
69958
|
continue;
|
|
69740
69959
|
}
|
|
69741
|
-
const packageJson = JSON.parse(
|
|
69960
|
+
const packageJson = JSON.parse(fs13.readFileSync(variant, "utf-8"));
|
|
69742
69961
|
return typeof packageJson.version === "string" ? packageJson.version : null;
|
|
69743
69962
|
} catch {
|
|
69744
69963
|
return null;
|
|
@@ -69750,7 +69969,8 @@ function getNpmGlobalPackageVersion(platform2) {
|
|
|
69750
69969
|
try {
|
|
69751
69970
|
const rootDir = execFileSync6(getPackageManagerExecutable("npm", platform2), ["root", "-g"], {
|
|
69752
69971
|
encoding: "utf-8",
|
|
69753
|
-
timeout: VERSION_LOOKUP_TIMEOUT_MS
|
|
69972
|
+
timeout: VERSION_LOOKUP_TIMEOUT_MS,
|
|
69973
|
+
windowsHide: true
|
|
69754
69974
|
}).trim();
|
|
69755
69975
|
return rootDir ? readPackageVersion(appendPathSegment(appendPathSegment(rootDir, "ccstatusline"), "package.json")) : null;
|
|
69756
69976
|
} catch {
|
|
@@ -69856,20 +70076,20 @@ function inspectGlobalPackageInstallations({
|
|
|
69856
70076
|
function runGlobalPackageUninstall(packageManager, { platform: platform2 = process.platform } = {}) {
|
|
69857
70077
|
const executable = getPackageManagerExecutable(packageManager, platform2);
|
|
69858
70078
|
const args = packageManager === "npm" ? ["uninstall", "-g", "ccstatusline"] : ["remove", "-g", "ccstatusline"];
|
|
69859
|
-
return new Promise((
|
|
69860
|
-
execFile(executable, args, { timeout: GLOBAL_PACKAGE_TIMEOUT_MS }, (error51) => {
|
|
70079
|
+
return new Promise((resolve6, reject2) => {
|
|
70080
|
+
execFile(executable, args, { timeout: GLOBAL_PACKAGE_TIMEOUT_MS, windowsHide: true }, (error51) => {
|
|
69861
70081
|
if (error51) {
|
|
69862
70082
|
reject2(error51 instanceof Error ? error51 : new Error("Global uninstall command failed"));
|
|
69863
70083
|
return;
|
|
69864
70084
|
}
|
|
69865
|
-
|
|
70085
|
+
resolve6();
|
|
69866
70086
|
});
|
|
69867
70087
|
});
|
|
69868
70088
|
}
|
|
69869
70089
|
|
|
69870
70090
|
// src/utils/open-url.ts
|
|
69871
70091
|
import { spawnSync } from "child_process";
|
|
69872
|
-
import * as
|
|
70092
|
+
import * as os11 from "os";
|
|
69873
70093
|
function runOpenCommand(command, args) {
|
|
69874
70094
|
const result2 = spawnSync(command, args, {
|
|
69875
70095
|
stdio: "ignore",
|
|
@@ -69928,7 +70148,7 @@ function openExternalUrl(url2) {
|
|
|
69928
70148
|
error: "Only http(s) URLs are supported"
|
|
69929
70149
|
};
|
|
69930
70150
|
}
|
|
69931
|
-
const platform3 =
|
|
70151
|
+
const platform3 = os11.platform();
|
|
69932
70152
|
const plans = PLATFORM_OPEN_PLANS[platform3];
|
|
69933
70153
|
if (!plans) {
|
|
69934
70154
|
return {
|
|
@@ -69956,9 +70176,9 @@ function openExternalUrl(url2) {
|
|
|
69956
70176
|
|
|
69957
70177
|
// src/utils/powerline.ts
|
|
69958
70178
|
import { execSync as execSync5 } from "child_process";
|
|
69959
|
-
import * as
|
|
69960
|
-
import * as
|
|
69961
|
-
import * as
|
|
70179
|
+
import * as fs14 from "fs";
|
|
70180
|
+
import * as os12 from "os";
|
|
70181
|
+
import * as path11 from "path";
|
|
69962
70182
|
var fontsInstalledThisSession = false;
|
|
69963
70183
|
function checkPowerlineFonts() {
|
|
69964
70184
|
if (process.env.DEBUG_FONT_INSTALL === "1" && !fontsInstalledThisSession) {
|
|
@@ -69974,24 +70194,24 @@ function checkPowerlineFonts() {
|
|
|
69974
70194
|
leftArrow: "",
|
|
69975
70195
|
leftThinArrow: ""
|
|
69976
70196
|
};
|
|
69977
|
-
const platform4 =
|
|
70197
|
+
const platform4 = os12.platform();
|
|
69978
70198
|
let fontPaths = [];
|
|
69979
70199
|
if (platform4 === "darwin") {
|
|
69980
70200
|
fontPaths = [
|
|
69981
|
-
|
|
70201
|
+
path11.join(os12.homedir(), "Library", "Fonts"),
|
|
69982
70202
|
"/Library/Fonts",
|
|
69983
70203
|
"/System/Library/Fonts"
|
|
69984
70204
|
];
|
|
69985
70205
|
} else if (platform4 === "linux") {
|
|
69986
70206
|
fontPaths = [
|
|
69987
|
-
|
|
69988
|
-
|
|
70207
|
+
path11.join(os12.homedir(), ".local", "share", "fonts"),
|
|
70208
|
+
path11.join(os12.homedir(), ".fonts"),
|
|
69989
70209
|
"/usr/share/fonts",
|
|
69990
70210
|
"/usr/local/share/fonts"
|
|
69991
70211
|
];
|
|
69992
70212
|
} else if (platform4 === "win32") {
|
|
69993
70213
|
fontPaths = [
|
|
69994
|
-
|
|
70214
|
+
path11.join(os12.homedir(), "AppData", "Local", "Microsoft", "Windows", "Fonts"),
|
|
69995
70215
|
"C:\\Windows\\Fonts"
|
|
69996
70216
|
];
|
|
69997
70217
|
}
|
|
@@ -70007,9 +70227,9 @@ function checkPowerlineFonts() {
|
|
|
70007
70227
|
/fira.*code.*nerd/i
|
|
70008
70228
|
];
|
|
70009
70229
|
for (const fontPath of fontPaths) {
|
|
70010
|
-
if (
|
|
70230
|
+
if (fs14.existsSync(fontPath)) {
|
|
70011
70231
|
try {
|
|
70012
|
-
const files =
|
|
70232
|
+
const files = fs14.readdirSync(fontPath);
|
|
70013
70233
|
for (const file2 of files) {
|
|
70014
70234
|
for (const pattern of powerlineFontPatterns) {
|
|
70015
70235
|
if (pattern.test(file2)) {
|
|
@@ -70044,13 +70264,16 @@ async function checkPowerlineFontsAsync() {
|
|
|
70044
70264
|
if (quickCheck.installed) {
|
|
70045
70265
|
return quickCheck;
|
|
70046
70266
|
}
|
|
70047
|
-
const platform4 =
|
|
70267
|
+
const platform4 = os12.platform();
|
|
70048
70268
|
if (platform4 === "linux" || platform4 === "darwin") {
|
|
70049
70269
|
try {
|
|
70050
70270
|
const { exec: exec2 } = await import("child_process");
|
|
70051
70271
|
const { promisify: promisify2 } = await import("util");
|
|
70052
70272
|
const execAsync = promisify2(exec2);
|
|
70053
|
-
const { stdout } = await execAsync("fc-list 2>/dev/null | grep -i powerline", {
|
|
70273
|
+
const { stdout } = await execAsync("fc-list 2>/dev/null | grep -i powerline", {
|
|
70274
|
+
encoding: "utf8",
|
|
70275
|
+
windowsHide: true
|
|
70276
|
+
});
|
|
70054
70277
|
if (stdout.trim()) {
|
|
70055
70278
|
return {
|
|
70056
70279
|
installed: true,
|
|
@@ -70067,46 +70290,49 @@ async function checkPowerlineFontsAsync() {
|
|
|
70067
70290
|
async function installPowerlineFonts() {
|
|
70068
70291
|
await Promise.resolve();
|
|
70069
70292
|
try {
|
|
70070
|
-
const platform4 =
|
|
70293
|
+
const platform4 = os12.platform();
|
|
70071
70294
|
let fontDir;
|
|
70072
70295
|
if (platform4 === "darwin") {
|
|
70073
|
-
fontDir =
|
|
70296
|
+
fontDir = path11.join(os12.homedir(), "Library", "Fonts");
|
|
70074
70297
|
} else if (platform4 === "linux") {
|
|
70075
|
-
fontDir =
|
|
70298
|
+
fontDir = path11.join(os12.homedir(), ".local", "share", "fonts");
|
|
70076
70299
|
} else if (platform4 === "win32") {
|
|
70077
|
-
fontDir =
|
|
70300
|
+
fontDir = path11.join(os12.homedir(), "AppData", "Local", "Microsoft", "Windows", "Fonts");
|
|
70078
70301
|
} else {
|
|
70079
70302
|
return {
|
|
70080
70303
|
success: false,
|
|
70081
70304
|
message: "Unsupported platform for font installation"
|
|
70082
70305
|
};
|
|
70083
70306
|
}
|
|
70084
|
-
if (!
|
|
70085
|
-
|
|
70307
|
+
if (!fs14.existsSync(fontDir)) {
|
|
70308
|
+
fs14.mkdirSync(fontDir, { recursive: true });
|
|
70086
70309
|
}
|
|
70087
|
-
const tempDir =
|
|
70310
|
+
const tempDir = path11.join(os12.tmpdir(), `ccstatusline-powerline-fonts-${Date.now()}`);
|
|
70088
70311
|
try {
|
|
70089
|
-
if (
|
|
70090
|
-
|
|
70312
|
+
if (fs14.existsSync(tempDir)) {
|
|
70313
|
+
fs14.rmSync(tempDir, { recursive: true, force: true });
|
|
70091
70314
|
}
|
|
70092
70315
|
execSync5(`git clone --depth=1 https://github.com/powerline/fonts.git "${tempDir}"`, {
|
|
70093
70316
|
stdio: "pipe",
|
|
70094
|
-
encoding: "utf8"
|
|
70317
|
+
encoding: "utf8",
|
|
70318
|
+
windowsHide: true
|
|
70095
70319
|
});
|
|
70096
70320
|
if (platform4 === "darwin" || platform4 === "linux") {
|
|
70097
|
-
const installScript =
|
|
70098
|
-
if (
|
|
70099
|
-
|
|
70321
|
+
const installScript = path11.join(tempDir, "install.sh");
|
|
70322
|
+
if (fs14.existsSync(installScript)) {
|
|
70323
|
+
fs14.chmodSync(installScript, 493);
|
|
70100
70324
|
execSync5(`cd "${tempDir}" && ./install.sh`, {
|
|
70101
70325
|
stdio: "pipe",
|
|
70102
70326
|
encoding: "utf8",
|
|
70103
|
-
shell: "/bin/bash"
|
|
70327
|
+
shell: "/bin/bash",
|
|
70328
|
+
windowsHide: true
|
|
70104
70329
|
});
|
|
70105
70330
|
if (platform4 === "linux") {
|
|
70106
70331
|
try {
|
|
70107
70332
|
execSync5("fc-cache -f -v", {
|
|
70108
70333
|
stdio: "pipe",
|
|
70109
|
-
encoding: "utf8"
|
|
70334
|
+
encoding: "utf8",
|
|
70335
|
+
windowsHide: true
|
|
70110
70336
|
});
|
|
70111
70337
|
} catch {}
|
|
70112
70338
|
}
|
|
@@ -70122,10 +70348,10 @@ async function installPowerlineFonts() {
|
|
|
70122
70348
|
}
|
|
70123
70349
|
} else {
|
|
70124
70350
|
let findFontFiles = function(dir) {
|
|
70125
|
-
const files =
|
|
70351
|
+
const files = fs14.readdirSync(dir);
|
|
70126
70352
|
for (const file2 of files) {
|
|
70127
|
-
const filePath =
|
|
70128
|
-
const stat2 =
|
|
70353
|
+
const filePath = path11.join(dir, file2);
|
|
70354
|
+
const stat2 = fs14.statSync(filePath);
|
|
70129
70355
|
if (stat2.isDirectory() && !file2.startsWith(".")) {
|
|
70130
70356
|
findFontFiles(filePath);
|
|
70131
70357
|
} else if (file2.endsWith(".ttf") || file2.endsWith(".otf")) {
|
|
@@ -70139,10 +70365,10 @@ async function installPowerlineFonts() {
|
|
|
70139
70365
|
findFontFiles(tempDir);
|
|
70140
70366
|
let installedCount = 0;
|
|
70141
70367
|
for (const fontFile of fontFiles) {
|
|
70142
|
-
const fileName =
|
|
70143
|
-
const destPath =
|
|
70368
|
+
const fileName = path11.basename(fontFile);
|
|
70369
|
+
const destPath = path11.join(fontDir, fileName);
|
|
70144
70370
|
try {
|
|
70145
|
-
|
|
70371
|
+
fs14.copyFileSync(fontFile, destPath);
|
|
70146
70372
|
installedCount++;
|
|
70147
70373
|
} catch {}
|
|
70148
70374
|
}
|
|
@@ -70160,9 +70386,9 @@ async function installPowerlineFonts() {
|
|
|
70160
70386
|
message: "Platform-specific installation not implemented"
|
|
70161
70387
|
};
|
|
70162
70388
|
} finally {
|
|
70163
|
-
if (
|
|
70389
|
+
if (fs14.existsSync(tempDir)) {
|
|
70164
70390
|
try {
|
|
70165
|
-
|
|
70391
|
+
fs14.rmSync(tempDir, { recursive: true, force: true });
|
|
70166
70392
|
} catch {}
|
|
70167
70393
|
}
|
|
70168
70394
|
}
|
|
@@ -70328,7 +70554,7 @@ async function checkForUpdates({
|
|
|
70328
70554
|
}
|
|
70329
70555
|
}
|
|
70330
70556
|
function fetchLatestNpmVersion(timeoutMs = DEFAULT_REGISTRY_TIMEOUT_MS) {
|
|
70331
|
-
return new Promise((
|
|
70557
|
+
return new Promise((resolve6, reject2) => {
|
|
70332
70558
|
const request3 = https2.request(NPM_REGISTRY_LATEST_URL, {
|
|
70333
70559
|
headers: {
|
|
70334
70560
|
Accept: "application/json",
|
|
@@ -70352,7 +70578,7 @@ function fetchLatestNpmVersion(timeoutMs = DEFAULT_REGISTRY_TIMEOUT_MS) {
|
|
|
70352
70578
|
reject2(new Error("npm registry response did not include a version"));
|
|
70353
70579
|
return;
|
|
70354
70580
|
}
|
|
70355
|
-
|
|
70581
|
+
resolve6(parsed.version);
|
|
70356
70582
|
} catch (error51) {
|
|
70357
70583
|
reject2(error51 instanceof Error ? error51 : new Error(String(error51)));
|
|
70358
70584
|
}
|
|
@@ -70368,13 +70594,13 @@ function fetchLatestNpmVersion(timeoutMs = DEFAULT_REGISTRY_TIMEOUT_MS) {
|
|
|
70368
70594
|
function runGlobalPackageInstall(packageManager, version2, { platform: platform4 = process.platform } = {}) {
|
|
70369
70595
|
const executable = getPackageManagerExecutable(packageManager, platform4);
|
|
70370
70596
|
const args = packageManager === "npm" ? ["install", "-g", `ccstatusline@${version2}`] : ["add", "-g", `ccstatusline@${version2}`];
|
|
70371
|
-
return new Promise((
|
|
70372
|
-
execFile2(executable, args, { timeout: GLOBAL_UPDATE_TIMEOUT_MS }, (error51) => {
|
|
70597
|
+
return new Promise((resolve6, reject2) => {
|
|
70598
|
+
execFile2(executable, args, { timeout: GLOBAL_UPDATE_TIMEOUT_MS, windowsHide: true }, (error51) => {
|
|
70373
70599
|
if (error51) {
|
|
70374
70600
|
reject2(error51 instanceof Error ? error51 : new Error("Global update command failed"));
|
|
70375
70601
|
return;
|
|
70376
70602
|
}
|
|
70377
|
-
|
|
70603
|
+
resolve6();
|
|
70378
70604
|
});
|
|
70379
70605
|
});
|
|
70380
70606
|
}
|
|
@@ -72009,19 +72235,19 @@ var import_react41 = __toESM(require_react(), 1);
|
|
|
72009
72235
|
var jsx_dev_runtime14 = __toESM(require_jsx_dev_runtime(), 1);
|
|
72010
72236
|
var AUTO_UPDATE_DESCRIPTION = "Runs `@latest` through npx/bunx. Stays current automatically, with a small startup cost when the package runner checks or resolves the package. Because it follows the latest published package, pinned install is available if you prefer explicit updates.";
|
|
72011
72237
|
function getPinnedDescription(currentVersion) {
|
|
72012
|
-
return `Installs \`ccstatusline@${currentVersion}\` globally and Claude Code runs \`ccstatusline\`. Fast
|
|
72238
|
+
return `Installs \`ccstatusline@${currentVersion}\` globally and Claude Code runs \`ccstatusline\`. Fast on each render because Claude Code runs the installed ccstatusline binary directly. The version changes only when you update the global install.`;
|
|
72013
72239
|
}
|
|
72014
72240
|
function getStyleItems(currentVersion) {
|
|
72015
72241
|
return [
|
|
72016
|
-
{
|
|
72017
|
-
label: "Auto-update",
|
|
72018
|
-
value: "auto-update",
|
|
72019
|
-
description: AUTO_UPDATE_DESCRIPTION
|
|
72020
|
-
},
|
|
72021
72242
|
{
|
|
72022
72243
|
label: "Pinned global install",
|
|
72023
72244
|
value: "pinned",
|
|
72024
72245
|
description: getPinnedDescription(currentVersion)
|
|
72246
|
+
},
|
|
72247
|
+
{
|
|
72248
|
+
label: "Auto-update",
|
|
72249
|
+
value: "auto-update",
|
|
72250
|
+
description: AUTO_UPDATE_DESCRIPTION
|
|
72025
72251
|
}
|
|
72026
72252
|
];
|
|
72027
72253
|
}
|
|
@@ -72091,7 +72317,7 @@ var InstallMenu = ({
|
|
|
72091
72317
|
initialPackageSelection = 0
|
|
72092
72318
|
}) => {
|
|
72093
72319
|
const [step, setStep] = import_react41.useState("style");
|
|
72094
|
-
const [updateStyle, setUpdateStyle] = import_react41.useState("
|
|
72320
|
+
const [updateStyle, setUpdateStyle] = import_react41.useState("pinned");
|
|
72095
72321
|
use_input_default((_, key) => {
|
|
72096
72322
|
if (key.escape) {
|
|
72097
72323
|
if (step === "manager") {
|
|
@@ -73715,7 +73941,7 @@ var UninstallMenu = ({
|
|
|
73715
73941
|
// src/tui/components/PowerlineSetup.tsx
|
|
73716
73942
|
await init_build2();
|
|
73717
73943
|
var import_react46 = __toESM(require_react(), 1);
|
|
73718
|
-
import * as
|
|
73944
|
+
import * as os13 from "os";
|
|
73719
73945
|
|
|
73720
73946
|
// src/utils/powerline-settings.ts
|
|
73721
73947
|
init_colors();
|
|
@@ -74480,7 +74706,7 @@ var PowerlineSetup = ({
|
|
|
74480
74706
|
}, undefined, false, undefined, this)
|
|
74481
74707
|
]
|
|
74482
74708
|
}, undefined, true, undefined, this),
|
|
74483
|
-
|
|
74709
|
+
os13.platform() === "darwin" && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
|
|
74484
74710
|
children: [
|
|
74485
74711
|
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
74486
74712
|
dimColor: true,
|
|
@@ -74496,7 +74722,7 @@ var PowerlineSetup = ({
|
|
|
74496
74722
|
}, undefined, false, undefined, this)
|
|
74497
74723
|
]
|
|
74498
74724
|
}, undefined, true, undefined, this),
|
|
74499
|
-
|
|
74725
|
+
os13.platform() === "linux" && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
|
|
74500
74726
|
children: [
|
|
74501
74727
|
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
74502
74728
|
dimColor: true,
|
|
@@ -74512,7 +74738,7 @@ var PowerlineSetup = ({
|
|
|
74512
74738
|
}, undefined, false, undefined, this)
|
|
74513
74739
|
]
|
|
74514
74740
|
}, undefined, true, undefined, this),
|
|
74515
|
-
|
|
74741
|
+
os13.platform() === "win32" && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
|
|
74516
74742
|
children: [
|
|
74517
74743
|
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
74518
74744
|
dimColor: true,
|
|
@@ -74789,7 +75015,10 @@ function getRefreshIntervalSublabel(interval, supported) {
|
|
|
74789
75015
|
}
|
|
74790
75016
|
return `(${interval}s)`;
|
|
74791
75017
|
}
|
|
74792
|
-
function
|
|
75018
|
+
function getGitCacheTtlSublabel(ttlSeconds) {
|
|
75019
|
+
return ttlSeconds === 0 ? "(mtime only)" : `(${ttlSeconds}s)`;
|
|
75020
|
+
}
|
|
75021
|
+
function buildConfigureStatusLineItems(refreshInterval, supportsRefreshInterval, gitCacheTtlSeconds) {
|
|
74793
75022
|
return [
|
|
74794
75023
|
{
|
|
74795
75024
|
label: "\uD83D\uDD04 Refresh Interval",
|
|
@@ -74797,6 +75026,13 @@ function buildConfigureStatusLineItems(refreshInterval, supportsRefreshInterval)
|
|
|
74797
75026
|
value: "refreshInterval",
|
|
74798
75027
|
disabled: !supportsRefreshInterval,
|
|
74799
75028
|
description: supportsRefreshInterval ? "How often Claude Code refreshes the status line by re-running the command. Enter value in seconds (1-60), or leave empty to remove." : "This setting requires Claude Code version 2.1.97 or later. Please update Claude Code to use this feature."
|
|
75029
|
+
},
|
|
75030
|
+
{
|
|
75031
|
+
label: "\uD83E\uDDEE Git Cache TTL",
|
|
75032
|
+
sublabel: getGitCacheTtlSublabel(gitCacheTtlSeconds),
|
|
75033
|
+
value: "gitCacheTtl",
|
|
75034
|
+
description: `How long git widget subprocess output can be reused while .git/HEAD and .git/index are unchanged. Enter 0-60 seconds;
|
|
75035
|
+
0 disables age-based expiry, so cached output is reused until those git metadata mtimes change.`
|
|
74800
75036
|
}
|
|
74801
75037
|
];
|
|
74802
75038
|
}
|
|
@@ -74816,14 +75052,31 @@ function validateRefreshIntervalInput(value) {
|
|
|
74816
75052
|
}
|
|
74817
75053
|
return null;
|
|
74818
75054
|
}
|
|
75055
|
+
function validateGitCacheTtlInput(value) {
|
|
75056
|
+
const parsed = parseInt(value, 10);
|
|
75057
|
+
if (value === "" || isNaN(parsed)) {
|
|
75058
|
+
return "Please enter a valid number";
|
|
75059
|
+
}
|
|
75060
|
+
if (parsed < 0) {
|
|
75061
|
+
return `Minimum Git cache TTL is 0s (you entered ${parsed}s)`;
|
|
75062
|
+
}
|
|
75063
|
+
if (parsed > 60) {
|
|
75064
|
+
return `Maximum Git cache TTL is 60s (you entered ${parsed}s)`;
|
|
75065
|
+
}
|
|
75066
|
+
return null;
|
|
75067
|
+
}
|
|
74819
75068
|
var RefreshIntervalMenu = ({
|
|
74820
75069
|
currentInterval,
|
|
74821
75070
|
supportsRefreshInterval,
|
|
75071
|
+
gitCacheTtlSeconds,
|
|
74822
75072
|
onUpdate,
|
|
75073
|
+
onGitCacheTtlUpdate,
|
|
74823
75074
|
onBack
|
|
74824
75075
|
}) => {
|
|
74825
75076
|
const [editingRefreshInterval, setEditingRefreshInterval] = import_react47.useState(false);
|
|
75077
|
+
const [editingGitCacheTtl, setEditingGitCacheTtl] = import_react47.useState(false);
|
|
74826
75078
|
const [refreshInput, setRefreshInput] = import_react47.useState(() => getRefreshInputValue(currentInterval));
|
|
75079
|
+
const [gitCacheTtlInput, setGitCacheTtlInput] = import_react47.useState(() => String(gitCacheTtlSeconds));
|
|
74827
75080
|
const [validationError, setValidationError] = import_react47.useState(null);
|
|
74828
75081
|
use_input_default((input, key) => {
|
|
74829
75082
|
if (editingRefreshInterval) {
|
|
@@ -74859,6 +75112,33 @@ var RefreshIntervalMenu = ({
|
|
|
74859
75112
|
}
|
|
74860
75113
|
return;
|
|
74861
75114
|
}
|
|
75115
|
+
if (editingGitCacheTtl) {
|
|
75116
|
+
if (key.return) {
|
|
75117
|
+
const error51 = validateGitCacheTtlInput(gitCacheTtlInput);
|
|
75118
|
+
if (error51) {
|
|
75119
|
+
setValidationError(error51);
|
|
75120
|
+
} else {
|
|
75121
|
+
const value = parseInt(gitCacheTtlInput, 10);
|
|
75122
|
+
onGitCacheTtlUpdate(value);
|
|
75123
|
+
setEditingGitCacheTtl(false);
|
|
75124
|
+
setValidationError(null);
|
|
75125
|
+
}
|
|
75126
|
+
} else if (key.escape) {
|
|
75127
|
+
setGitCacheTtlInput(String(gitCacheTtlSeconds));
|
|
75128
|
+
setEditingGitCacheTtl(false);
|
|
75129
|
+
setValidationError(null);
|
|
75130
|
+
} else if (key.backspace) {
|
|
75131
|
+
setGitCacheTtlInput(gitCacheTtlInput.slice(0, -1));
|
|
75132
|
+
setValidationError(null);
|
|
75133
|
+
} else if (key.delete) {} else if (shouldInsertInput(input, key) && /\d/.test(input)) {
|
|
75134
|
+
const newValue = gitCacheTtlInput + input;
|
|
75135
|
+
if (newValue.length <= 2) {
|
|
75136
|
+
setGitCacheTtlInput(newValue);
|
|
75137
|
+
setValidationError(null);
|
|
75138
|
+
}
|
|
75139
|
+
}
|
|
75140
|
+
return;
|
|
75141
|
+
}
|
|
74862
75142
|
if (key.escape) {
|
|
74863
75143
|
onBack();
|
|
74864
75144
|
}
|
|
@@ -74894,16 +75174,53 @@ var RefreshIntervalMenu = ({
|
|
|
74894
75174
|
children: "Press Enter to confirm, ESC to cancel. Leave empty to remove."
|
|
74895
75175
|
}, undefined, false, undefined, this)
|
|
74896
75176
|
]
|
|
75177
|
+
}, undefined, true, undefined, this) : editingGitCacheTtl ? /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Box_default, {
|
|
75178
|
+
marginTop: 1,
|
|
75179
|
+
flexDirection: "column",
|
|
75180
|
+
children: [
|
|
75181
|
+
/* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
|
|
75182
|
+
children: [
|
|
75183
|
+
"Enter Git cache TTL in seconds (0-60):",
|
|
75184
|
+
" ",
|
|
75185
|
+
gitCacheTtlInput,
|
|
75186
|
+
gitCacheTtlInput.length > 0 ? "s" : ""
|
|
75187
|
+
]
|
|
75188
|
+
}, undefined, true, undefined, this),
|
|
75189
|
+
/* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
|
|
75190
|
+
children: " "
|
|
75191
|
+
}, undefined, false, undefined, this),
|
|
75192
|
+
/* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
|
|
75193
|
+
dimColor: true,
|
|
75194
|
+
wrap: "wrap",
|
|
75195
|
+
children: "This affects how quickly git widgets notice unstaged and untracked working-tree changes."
|
|
75196
|
+
}, undefined, false, undefined, this),
|
|
75197
|
+
validationError ? /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
|
|
75198
|
+
color: "red",
|
|
75199
|
+
children: validationError
|
|
75200
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
|
|
75201
|
+
dimColor: true,
|
|
75202
|
+
children: "0 disables age-based expiry; cache validity uses .git/HEAD and .git/index mtimes only."
|
|
75203
|
+
}, undefined, false, undefined, this),
|
|
75204
|
+
/* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
|
|
75205
|
+
dimColor: true,
|
|
75206
|
+
children: "Press Enter to confirm, ESC to cancel."
|
|
75207
|
+
}, undefined, false, undefined, this)
|
|
75208
|
+
]
|
|
74897
75209
|
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(List, {
|
|
74898
75210
|
marginTop: 1,
|
|
74899
|
-
items: buildConfigureStatusLineItems(currentInterval, supportsRefreshInterval),
|
|
75211
|
+
items: buildConfigureStatusLineItems(currentInterval, supportsRefreshInterval, gitCacheTtlSeconds),
|
|
74900
75212
|
onSelect: (value) => {
|
|
74901
75213
|
if (value === "back") {
|
|
74902
75214
|
onBack();
|
|
74903
75215
|
return;
|
|
74904
75216
|
}
|
|
74905
|
-
|
|
74906
|
-
|
|
75217
|
+
if (value === "refreshInterval") {
|
|
75218
|
+
setRefreshInput(getRefreshInputValue(currentInterval));
|
|
75219
|
+
setEditingRefreshInterval(true);
|
|
75220
|
+
return;
|
|
75221
|
+
}
|
|
75222
|
+
setGitCacheTtlInput(String(gitCacheTtlSeconds));
|
|
75223
|
+
setEditingGitCacheTtl(true);
|
|
74907
75224
|
},
|
|
74908
75225
|
showBackButton: true
|
|
74909
75226
|
}, undefined, false, undefined, this)
|
|
@@ -74954,6 +75271,7 @@ var renderSingleLine = (widgets, terminalWidth, settings, lineIndex, globalSepar
|
|
|
74954
75271
|
terminalWidth,
|
|
74955
75272
|
isPreview: true,
|
|
74956
75273
|
minimalist: settings.minimalistMode,
|
|
75274
|
+
gitCacheTtlSeconds: settings.gitCacheTtlSeconds,
|
|
74957
75275
|
lineIndex,
|
|
74958
75276
|
globalSeparatorIndex,
|
|
74959
75277
|
globalPowerlineThemeIndex
|
|
@@ -74970,7 +75288,12 @@ var StatusLinePreview = ({ lines, terminalWidth, settings, onTruncationChange })
|
|
|
74970
75288
|
const { renderedLines, anyTruncated } = import_react48.default.useMemo(() => {
|
|
74971
75289
|
if (!settings)
|
|
74972
75290
|
return { renderedLines: [], anyTruncated: false };
|
|
74973
|
-
const preRenderedLines = preRenderAllWidgets(lines, settings, {
|
|
75291
|
+
const preRenderedLines = preRenderAllWidgets(lines, settings, {
|
|
75292
|
+
terminalWidth,
|
|
75293
|
+
isPreview: true,
|
|
75294
|
+
minimalist: settings.minimalistMode,
|
|
75295
|
+
gitCacheTtlSeconds: settings.gitCacheTtlSeconds
|
|
75296
|
+
});
|
|
74974
75297
|
const preCalculatedMaxWidths = calculateMaxWidthsFromPreRendered(preRenderedLines, settings);
|
|
74975
75298
|
let globalSeparatorIndex = 0;
|
|
74976
75299
|
let globalPowerlineThemeIndex = 0;
|
|
@@ -76504,6 +76827,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
76504
76827
|
screen === "refreshInterval" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(RefreshIntervalMenu, {
|
|
76505
76828
|
currentInterval: currentRefreshInterval,
|
|
76506
76829
|
supportsRefreshInterval,
|
|
76830
|
+
gitCacheTtlSeconds: settings.gitCacheTtlSeconds,
|
|
76507
76831
|
onUpdate: (interval) => {
|
|
76508
76832
|
const previous = currentRefreshInterval;
|
|
76509
76833
|
setCurrentRefreshInterval(interval);
|
|
@@ -76521,6 +76845,17 @@ ${GITHUB_REPO_URL}`,
|
|
|
76521
76845
|
});
|
|
76522
76846
|
setScreen("main");
|
|
76523
76847
|
},
|
|
76848
|
+
onGitCacheTtlUpdate: (ttlSeconds) => {
|
|
76849
|
+
setSettings({
|
|
76850
|
+
...settings,
|
|
76851
|
+
gitCacheTtlSeconds: ttlSeconds
|
|
76852
|
+
});
|
|
76853
|
+
setFlashMessage({
|
|
76854
|
+
text: "✓ Git cache TTL updated",
|
|
76855
|
+
color: "green"
|
|
76856
|
+
});
|
|
76857
|
+
setScreen("main");
|
|
76858
|
+
},
|
|
76524
76859
|
onBack: () => {
|
|
76525
76860
|
setScreen("main");
|
|
76526
76861
|
}
|
|
@@ -76643,9 +76978,9 @@ init_colors();
|
|
|
76643
76978
|
// src/utils/compaction.ts
|
|
76644
76979
|
init_zod();
|
|
76645
76980
|
import * as crypto from "crypto";
|
|
76646
|
-
import * as
|
|
76647
|
-
import * as
|
|
76648
|
-
import * as
|
|
76981
|
+
import * as fs15 from "fs";
|
|
76982
|
+
import * as os14 from "os";
|
|
76983
|
+
import * as path12 from "path";
|
|
76649
76984
|
var DEFAULT_DROP_THRESHOLD = 2;
|
|
76650
76985
|
var FRESH_PREV_CTX_PCT = -1;
|
|
76651
76986
|
var MAX_CACHE_FILE_BYTES = 4096;
|
|
@@ -76689,8 +77024,8 @@ function detectCompaction(currentCtxPct, state, options = DEFAULT_DROP_THRESHOLD
|
|
|
76689
77024
|
...currentWindowSize !== null ? { prevWindowSize: currentWindowSize } : {}
|
|
76690
77025
|
};
|
|
76691
77026
|
}
|
|
76692
|
-
function
|
|
76693
|
-
return
|
|
77027
|
+
function getCacheDir3() {
|
|
77028
|
+
return path12.join(os14.homedir(), ".cache", "ccstatusline", "compaction");
|
|
76694
77029
|
}
|
|
76695
77030
|
function sanitizeSessionId(sessionId) {
|
|
76696
77031
|
const sanitized = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -76700,18 +77035,18 @@ function sanitizeSessionId(sessionId) {
|
|
|
76700
77035
|
return sanitized;
|
|
76701
77036
|
}
|
|
76702
77037
|
function getStatePath(sessionId) {
|
|
76703
|
-
return
|
|
77038
|
+
return path12.join(getCacheDir3(), `compaction-${sanitizeSessionId(sessionId)}.json`);
|
|
76704
77039
|
}
|
|
76705
77040
|
function loadCompactionState(sessionId) {
|
|
76706
77041
|
const statePath = getStatePath(sessionId);
|
|
76707
77042
|
let fd = null;
|
|
76708
77043
|
try {
|
|
76709
|
-
fd =
|
|
76710
|
-
const stats =
|
|
77044
|
+
fd = fs15.openSync(statePath, fs15.constants.O_RDONLY | fs15.constants.O_NOFOLLOW);
|
|
77045
|
+
const stats = fs15.fstatSync(fd);
|
|
76711
77046
|
if (!stats.isFile() || stats.size > MAX_CACHE_FILE_BYTES) {
|
|
76712
77047
|
return FRESH;
|
|
76713
77048
|
}
|
|
76714
|
-
const raw = JSON.parse(
|
|
77049
|
+
const raw = JSON.parse(fs15.readFileSync(fd, "utf-8"));
|
|
76715
77050
|
const result2 = CompactionStateSchema.safeParse(raw);
|
|
76716
77051
|
return result2.success ? result2.data : FRESH;
|
|
76717
77052
|
} catch {
|
|
@@ -76719,7 +77054,7 @@ function loadCompactionState(sessionId) {
|
|
|
76719
77054
|
} finally {
|
|
76720
77055
|
if (fd !== null) {
|
|
76721
77056
|
try {
|
|
76722
|
-
|
|
77057
|
+
fs15.closeSync(fd);
|
|
76723
77058
|
} catch {}
|
|
76724
77059
|
}
|
|
76725
77060
|
}
|
|
@@ -76727,20 +77062,20 @@ function loadCompactionState(sessionId) {
|
|
|
76727
77062
|
function saveCompactionState(sessionId, state) {
|
|
76728
77063
|
let tmpPath = null;
|
|
76729
77064
|
try {
|
|
76730
|
-
const dir =
|
|
76731
|
-
if (!
|
|
76732
|
-
|
|
77065
|
+
const dir = getCacheDir3();
|
|
77066
|
+
if (!fs15.existsSync(dir)) {
|
|
77067
|
+
fs15.mkdirSync(dir, { recursive: true });
|
|
76733
77068
|
}
|
|
76734
77069
|
const targetPath = getStatePath(sessionId);
|
|
76735
77070
|
tmpPath = `${targetPath}.tmp.${process.pid}.${crypto.randomBytes(4).toString("hex")}`;
|
|
76736
|
-
|
|
77071
|
+
fs15.writeFileSync(tmpPath, JSON.stringify(state) + `
|
|
76737
77072
|
`);
|
|
76738
|
-
|
|
77073
|
+
fs15.renameSync(tmpPath, targetPath);
|
|
76739
77074
|
tmpPath = null;
|
|
76740
77075
|
} catch {
|
|
76741
77076
|
if (tmpPath !== null) {
|
|
76742
77077
|
try {
|
|
76743
|
-
|
|
77078
|
+
fs15.unlinkSync(tmpPath);
|
|
76744
77079
|
} catch {}
|
|
76745
77080
|
}
|
|
76746
77081
|
}
|
|
@@ -76751,27 +77086,27 @@ init_context_percentage();
|
|
|
76751
77086
|
await init_config();
|
|
76752
77087
|
|
|
76753
77088
|
// src/utils/hook-handler.ts
|
|
76754
|
-
import * as
|
|
76755
|
-
import * as
|
|
77089
|
+
import * as fs17 from "fs";
|
|
77090
|
+
import * as path14 from "path";
|
|
76756
77091
|
|
|
76757
77092
|
// src/utils/skills.ts
|
|
76758
|
-
import * as
|
|
76759
|
-
import * as
|
|
76760
|
-
import * as
|
|
77093
|
+
import * as fs16 from "fs";
|
|
77094
|
+
import * as os15 from "os";
|
|
77095
|
+
import * as path13 from "path";
|
|
76761
77096
|
var EMPTY = { totalInvocations: 0, uniqueSkills: [], lastSkill: null };
|
|
76762
77097
|
function getSkillsDir() {
|
|
76763
|
-
return
|
|
77098
|
+
return path13.join(os15.homedir(), ".cache", "ccstatusline", "skills");
|
|
76764
77099
|
}
|
|
76765
77100
|
function getSkillsFilePath(sessionId) {
|
|
76766
|
-
return
|
|
77101
|
+
return path13.join(getSkillsDir(), `skills-${sessionId}.jsonl`);
|
|
76767
77102
|
}
|
|
76768
77103
|
function getSkillsMetrics(sessionId) {
|
|
76769
77104
|
const filePath = getSkillsFilePath(sessionId);
|
|
76770
|
-
if (!
|
|
77105
|
+
if (!fs16.existsSync(filePath)) {
|
|
76771
77106
|
return EMPTY;
|
|
76772
77107
|
}
|
|
76773
77108
|
try {
|
|
76774
|
-
const invocations =
|
|
77109
|
+
const invocations = fs16.readFileSync(filePath, "utf-8").trim().split(`
|
|
76775
77110
|
`).filter((line) => line.trim()).map((line) => {
|
|
76776
77111
|
try {
|
|
76777
77112
|
return JSON.parse(line);
|
|
@@ -76825,14 +77160,14 @@ function handleHookInput(input) {
|
|
|
76825
77160
|
return;
|
|
76826
77161
|
}
|
|
76827
77162
|
const filePath = getSkillsFilePath(sessionId);
|
|
76828
|
-
|
|
77163
|
+
fs17.mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
76829
77164
|
const entry = JSON.stringify({
|
|
76830
77165
|
timestamp: new Date().toISOString(),
|
|
76831
77166
|
session_id: sessionId,
|
|
76832
77167
|
skill: skillName,
|
|
76833
77168
|
source: data.hook_event_name
|
|
76834
77169
|
});
|
|
76835
|
-
|
|
77170
|
+
fs17.appendFileSync(filePath, entry + `
|
|
76836
77171
|
`);
|
|
76837
77172
|
} catch {}
|
|
76838
77173
|
}
|
|
@@ -77032,7 +77367,7 @@ async function ensureWindowsUtf8CodePage() {
|
|
|
77032
77367
|
}
|
|
77033
77368
|
try {
|
|
77034
77369
|
const { execFileSync: execFileSync7 } = await import("child_process");
|
|
77035
|
-
execFileSync7("chcp.com", ["65001"], { stdio: "ignore" });
|
|
77370
|
+
execFileSync7("chcp.com", ["65001"], { stdio: "ignore", windowsHide: true });
|
|
77036
77371
|
} catch {}
|
|
77037
77372
|
}
|
|
77038
77373
|
async function renderMultipleLines(data) {
|
|
@@ -77098,7 +77433,8 @@ async function renderMultipleLines(data) {
|
|
|
77098
77433
|
skillsMetrics,
|
|
77099
77434
|
compactionData: hasCompactionWidget ? { count: compactionCount } : null,
|
|
77100
77435
|
isPreview: false,
|
|
77101
|
-
minimalist: settings.minimalistMode
|
|
77436
|
+
minimalist: settings.minimalistMode,
|
|
77437
|
+
gitCacheTtlSeconds: settings.gitCacheTtlSeconds
|
|
77102
77438
|
};
|
|
77103
77439
|
const preRenderedLines = preRenderAllWidgets(lines, settings, context);
|
|
77104
77440
|
const preCalculatedMaxWidths = calculateMaxWidthsFromPreRendered(preRenderedLines, settings);
|