fleetlens 1.0.21 → 1.0.22
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/app/apps/web/.next/BUILD_ID +1 -1
- package/app/apps/web/.next/build-manifest.json +3 -3
- package/app/apps/web/.next/prerender-manifest.json +3 -3
- package/app/apps/web/.next/server/app/_global-error.html +1 -1
- package/app/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/agent/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/day/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/print/[key]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/team/onboarding/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/team/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__02.51sr._.js +1 -1
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__0~s0tk_._.js +1 -1
- package/app/apps/web/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_02bw8.n.js +2 -2
- package/app/apps/web/.next/server/chunks/packages_parser_dist_06d9se1._.js +1 -1
- package/app/apps/web/.next/server/chunks/packages_parser_dist_10ihc3~._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/_0k8yioi._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0n7_p1d._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0nb5_-s._.js +1 -1
- package/app/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/app/apps/web/.next/server/middleware-manifest.json +5 -5
- package/app/apps/web/.next/server/pages/500.html +1 -1
- package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/app/apps/web/.next/static/chunks/01fefgk-.q81a.js +1 -0
- package/app/apps/web/lib/changelog-data.generated.ts +1 -1
- package/app/apps/web/lib/daemon-lifecycle.ts +4 -1
- package/app/apps/web/package.json +1 -1
- package/app/apps/web/tsconfig.tsbuildinfo +1 -1
- package/dist/daemon-worker.js +247 -129
- package/dist/index.js +272 -187
- package/menubar/Fleetlens.app/Contents/Info.plist +2 -2
- package/menubar/Fleetlens.app/Contents/MacOS/FleetlensMenubar +0 -0
- package/package.json +1 -1
- package/app/apps/web/.next/static/chunks/14ruxwyt5vafr.js +0 -1
- /package/app/apps/web/.next/static/{B0Vmce2iQGyg0ry_GHkYR → UJkphLIl9vX9iyMWQpanr}/_buildManifest.js +0 -0
- /package/app/apps/web/.next/static/{B0Vmce2iQGyg0ry_GHkYR → UJkphLIl9vX9iyMWQpanr}/_clientMiddlewareManifest.js +0 -0
- /package/app/apps/web/.next/static/{B0Vmce2iQGyg0ry_GHkYR → UJkphLIl9vX9iyMWQpanr}/_ssgManifest.js +0 -0
package/dist/index.js
CHANGED
|
@@ -70,6 +70,12 @@ function removePid(filePath) {
|
|
|
70
70
|
} catch {
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
function spawnedPid(child, bin) {
|
|
74
|
+
child.once("error", () => {
|
|
75
|
+
});
|
|
76
|
+
if (child.pid === void 0) throw new Error(`could not launch ${bin}`);
|
|
77
|
+
return child.pid;
|
|
78
|
+
}
|
|
73
79
|
var init_pid = __esm({
|
|
74
80
|
"src/pid.ts"() {
|
|
75
81
|
"use strict";
|
|
@@ -1610,11 +1616,11 @@ function defaultBranch(commonDir) {
|
|
|
1610
1616
|
}
|
|
1611
1617
|
return void 0;
|
|
1612
1618
|
}
|
|
1613
|
-
function readGitFolder(
|
|
1614
|
-
if (!existsSync(
|
|
1619
|
+
function readGitFolder(path13) {
|
|
1620
|
+
if (!existsSync(path13))
|
|
1615
1621
|
return { exists: false, isWorktree: false };
|
|
1616
1622
|
try {
|
|
1617
|
-
const git = nearestDotGit(realpathOrSelf(
|
|
1623
|
+
const git = nearestDotGit(realpathOrSelf(path13));
|
|
1618
1624
|
if (!git)
|
|
1619
1625
|
return { exists: true, isWorktree: false };
|
|
1620
1626
|
const projectRoot = projectRootFromCommonDir(git.commonDir);
|
|
@@ -5868,6 +5874,47 @@ var init_grok = __esm({
|
|
|
5868
5874
|
}
|
|
5869
5875
|
});
|
|
5870
5876
|
|
|
5877
|
+
// ../parser/dist/node-bin.js
|
|
5878
|
+
import { existsSync as existsSync2, readdirSync } from "node:fs";
|
|
5879
|
+
import os8 from "node:os";
|
|
5880
|
+
import path8 from "node:path";
|
|
5881
|
+
function newestFirst(a, b) {
|
|
5882
|
+
const pa = a.slice(1).split(".").map(Number);
|
|
5883
|
+
const pb = b.slice(1).split(".").map(Number);
|
|
5884
|
+
for (let i = 0; i < 3; i++) {
|
|
5885
|
+
const d = (pb[i] ?? 0) - (pa[i] ?? 0);
|
|
5886
|
+
if (d !== 0)
|
|
5887
|
+
return d;
|
|
5888
|
+
}
|
|
5889
|
+
return 0;
|
|
5890
|
+
}
|
|
5891
|
+
function resolveNodeBin(opts = {}) {
|
|
5892
|
+
const execPath = opts.execPath ?? process.execPath;
|
|
5893
|
+
const exists = opts.exists ?? existsSync2;
|
|
5894
|
+
if (exists(execPath))
|
|
5895
|
+
return execPath;
|
|
5896
|
+
const env = opts.env ?? process.env;
|
|
5897
|
+
const bin = process.platform === "win32" ? "node.exe" : "node";
|
|
5898
|
+
const candidates = (env.PATH ?? "").split(path8.delimiter).filter(Boolean).map((dir) => path8.join(dir, bin));
|
|
5899
|
+
const nvmVersions = path8.join(env.NVM_DIR || path8.join(os8.homedir(), ".nvm"), "versions", "node");
|
|
5900
|
+
const major = `v${process.versions.node.split(".")[0]}.`;
|
|
5901
|
+
let installed = [];
|
|
5902
|
+
try {
|
|
5903
|
+
installed = (opts.listDir ?? ((dir) => readdirSync(dir)))(nvmVersions);
|
|
5904
|
+
} catch {
|
|
5905
|
+
}
|
|
5906
|
+
for (const version of installed.filter((v) => v.startsWith(major)).sort(newestFirst)) {
|
|
5907
|
+
candidates.push(path8.join(nvmVersions, version, "bin", bin));
|
|
5908
|
+
}
|
|
5909
|
+
candidates.push("/opt/homebrew/bin/node", "/usr/local/bin/node");
|
|
5910
|
+
return candidates.find((c) => exists(c)) ?? execPath;
|
|
5911
|
+
}
|
|
5912
|
+
var init_node_bin = __esm({
|
|
5913
|
+
"../parser/dist/node-bin.js"() {
|
|
5914
|
+
"use strict";
|
|
5915
|
+
}
|
|
5916
|
+
});
|
|
5917
|
+
|
|
5871
5918
|
// ../parser/dist/team-config.js
|
|
5872
5919
|
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, unlinkSync as unlinkSync2, mkdirSync as mkdirSync2, renameSync } from "node:fs";
|
|
5873
5920
|
import { join as join2 } from "node:path";
|
|
@@ -5984,20 +6031,21 @@ __export(fs_exports, {
|
|
|
5984
6031
|
readJsonlFileSync: () => readJsonlFileSync,
|
|
5985
6032
|
readTeamConfig: () => readTeamConfig,
|
|
5986
6033
|
resolveDefaultGrokRoot: () => resolveDefaultGrokRoot,
|
|
6034
|
+
resolveNodeBin: () => resolveNodeBin,
|
|
5987
6035
|
resolveProjectIdentity: () => resolveProjectIdentity,
|
|
5988
6036
|
sessionIdFromFileName: () => sessionIdFromFileName,
|
|
5989
6037
|
shouldSyncProject: () => shouldSyncProject,
|
|
5990
6038
|
walkJsonlFiles: () => walkJsonlFiles,
|
|
5991
6039
|
writeTeamConfig: () => writeTeamConfig
|
|
5992
6040
|
});
|
|
5993
|
-
import { promises as fs9, existsSync as
|
|
5994
|
-
import
|
|
5995
|
-
import
|
|
6041
|
+
import { promises as fs9, existsSync as existsSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3, appendFileSync, mkdirSync as mkdirSync3 } from "node:fs";
|
|
6042
|
+
import os9 from "node:os";
|
|
6043
|
+
import path9 from "node:path";
|
|
5996
6044
|
function cclensHome() {
|
|
5997
|
-
return process.env.CCLENS_HOME ||
|
|
6045
|
+
return process.env.CCLENS_HOME || path9.join(os9.homedir(), ".cclens");
|
|
5998
6046
|
}
|
|
5999
6047
|
function cclensPath(...parts) {
|
|
6000
|
-
return
|
|
6048
|
+
return path9.join(cclensHome(), ...parts);
|
|
6001
6049
|
}
|
|
6002
6050
|
function cacheStats() {
|
|
6003
6051
|
return claudeCodeCacheStats();
|
|
@@ -6040,12 +6088,12 @@ function usageLogPath() {
|
|
|
6040
6088
|
}
|
|
6041
6089
|
function appendUsageSnapshot(snapshot) {
|
|
6042
6090
|
const p = usageLogPath();
|
|
6043
|
-
mkdirSync3(
|
|
6091
|
+
mkdirSync3(path9.dirname(p), { recursive: true });
|
|
6044
6092
|
appendFileSync(p, JSON.stringify(snapshot) + "\n", "utf8");
|
|
6045
6093
|
}
|
|
6046
6094
|
function pruneUsageAgent(agent) {
|
|
6047
6095
|
const p = usageLogPath();
|
|
6048
|
-
if (!
|
|
6096
|
+
if (!existsSync3(p))
|
|
6049
6097
|
return;
|
|
6050
6098
|
const kept = readFileSync4(p, "utf8").split("\n").filter((line) => {
|
|
6051
6099
|
if (!line.trim())
|
|
@@ -6056,7 +6104,7 @@ function pruneUsageAgent(agent) {
|
|
|
6056
6104
|
return true;
|
|
6057
6105
|
}
|
|
6058
6106
|
});
|
|
6059
|
-
mkdirSync3(
|
|
6107
|
+
mkdirSync3(path9.dirname(p), { recursive: true });
|
|
6060
6108
|
writeFileSync3(p, kept.join("\n") + (kept.length ? "\n" : ""), "utf8");
|
|
6061
6109
|
}
|
|
6062
6110
|
async function loadUsageByDay(start2, end) {
|
|
@@ -6288,6 +6336,7 @@ var init_fs = __esm({
|
|
|
6288
6336
|
init_claude_code();
|
|
6289
6337
|
init_jsonl_read();
|
|
6290
6338
|
init_git_project();
|
|
6339
|
+
init_node_bin();
|
|
6291
6340
|
init_codex();
|
|
6292
6341
|
init_copilot();
|
|
6293
6342
|
init_gemini();
|
|
@@ -6384,7 +6433,7 @@ __export(server_exports, {
|
|
|
6384
6433
|
import { spawn } from "node:child_process";
|
|
6385
6434
|
import { join as join3, dirname as dirname3 } from "node:path";
|
|
6386
6435
|
import { fileURLToPath } from "node:url";
|
|
6387
|
-
import { existsSync as
|
|
6436
|
+
import { existsSync as existsSync4, realpathSync as realpathSync2, readFileSync as readFileSync5 } from "node:fs";
|
|
6388
6437
|
import { homedir as homedir2 } from "node:os";
|
|
6389
6438
|
function appDir() {
|
|
6390
6439
|
const here = dirname3(fileURLToPath(import.meta.url));
|
|
@@ -6402,9 +6451,9 @@ function onDiskVersion() {
|
|
|
6402
6451
|
try {
|
|
6403
6452
|
const here = dirname3(fileURLToPath(import.meta.url));
|
|
6404
6453
|
const pkg = JSON.parse(readFileSync5(join3(here, "..", "package.json"), "utf8"));
|
|
6405
|
-
return pkg.version ?? "1.0.
|
|
6454
|
+
return pkg.version ?? "1.0.22";
|
|
6406
6455
|
} catch {
|
|
6407
|
-
return "1.0.
|
|
6456
|
+
return "1.0.22";
|
|
6408
6457
|
}
|
|
6409
6458
|
}
|
|
6410
6459
|
function getServerStatus() {
|
|
@@ -6416,7 +6465,7 @@ function getServerStatus() {
|
|
|
6416
6465
|
return { running: false };
|
|
6417
6466
|
}
|
|
6418
6467
|
function isServerStale(status2) {
|
|
6419
|
-
return status2.running === true && status2.version !== "1.0.
|
|
6468
|
+
return status2.running === true && status2.version !== "1.0.22";
|
|
6420
6469
|
}
|
|
6421
6470
|
async function ensureCurrentServer(opts = {}) {
|
|
6422
6471
|
const status2 = getServerStatus();
|
|
@@ -6450,7 +6499,7 @@ async function ensureCurrentServer(opts = {}) {
|
|
|
6450
6499
|
async function startServer(opts = {}) {
|
|
6451
6500
|
const port = opts.port ?? (parseInt(process.env.CCLENS_PORT ?? "", 10) || DEFAULT_PORT);
|
|
6452
6501
|
const serverJs = join3(appDir(), "server.js");
|
|
6453
|
-
if (!
|
|
6502
|
+
if (!existsSync4(serverJs)) {
|
|
6454
6503
|
throw new Error(`Server not found at ${serverJs}. Reinstall with: npm install -g fleetlens`);
|
|
6455
6504
|
}
|
|
6456
6505
|
const portInUse = await checkPort(port);
|
|
@@ -6458,7 +6507,8 @@ async function startServer(opts = {}) {
|
|
|
6458
6507
|
throw new Error(`Port ${port} is in use. Use --port to specify a different port.`);
|
|
6459
6508
|
}
|
|
6460
6509
|
const dataDir = join3(homedir2(), ".claude", "projects");
|
|
6461
|
-
const
|
|
6510
|
+
const node = resolveNodeBin();
|
|
6511
|
+
const child = spawn(node, [serverJs], {
|
|
6462
6512
|
detached: true,
|
|
6463
6513
|
stdio: "ignore",
|
|
6464
6514
|
env: {
|
|
@@ -6472,7 +6522,7 @@ async function startServer(opts = {}) {
|
|
|
6472
6522
|
cwd: appDir()
|
|
6473
6523
|
});
|
|
6474
6524
|
child.unref();
|
|
6475
|
-
const pid = child
|
|
6525
|
+
const pid = spawnedPid(child, node);
|
|
6476
6526
|
writePid(PID_FILE, pid, port, onDiskVersion());
|
|
6477
6527
|
await waitForHealth(`http://localhost:${port}`, 3e4);
|
|
6478
6528
|
return { pid, port };
|
|
@@ -6570,7 +6620,7 @@ import {
|
|
|
6570
6620
|
mkdirSync as mkdirSync4,
|
|
6571
6621
|
readFileSync as readFileSync6,
|
|
6572
6622
|
writeFileSync as writeFileSync4,
|
|
6573
|
-
existsSync as
|
|
6623
|
+
existsSync as existsSync5,
|
|
6574
6624
|
openSync as openSync2,
|
|
6575
6625
|
readSync as readSync2,
|
|
6576
6626
|
fstatSync,
|
|
@@ -6582,7 +6632,7 @@ function appendSnapshot(filePath, snapshot) {
|
|
|
6582
6632
|
appendFileSync2(filePath, JSON.stringify(snapshot) + "\n", "utf8");
|
|
6583
6633
|
}
|
|
6584
6634
|
function readSnapshots(filePath) {
|
|
6585
|
-
if (!
|
|
6635
|
+
if (!existsSync5(filePath)) return [];
|
|
6586
6636
|
const content = readFileSync6(filePath, "utf8");
|
|
6587
6637
|
const snapshots = [];
|
|
6588
6638
|
for (const line of content.split("\n")) {
|
|
@@ -6599,7 +6649,7 @@ function latestSnapshot(filePath) {
|
|
|
6599
6649
|
return all.length > 0 ? all[all.length - 1] : null;
|
|
6600
6650
|
}
|
|
6601
6651
|
function pruneAgent(filePath, agent) {
|
|
6602
|
-
if (!
|
|
6652
|
+
if (!existsSync5(filePath)) return;
|
|
6603
6653
|
const kept = readFileSync6(filePath, "utf8").split("\n").filter((line) => {
|
|
6604
6654
|
if (!line.trim()) return false;
|
|
6605
6655
|
try {
|
|
@@ -6620,7 +6670,7 @@ function latestClaudeCodeSnapshot(filePath) {
|
|
|
6620
6670
|
return null;
|
|
6621
6671
|
}
|
|
6622
6672
|
function latestSnapshotsByAgent(filePath, opts = {}) {
|
|
6623
|
-
if (!
|
|
6673
|
+
if (!existsSync5(filePath)) return {};
|
|
6624
6674
|
const tailBytes = opts.tailBytes ?? 262144;
|
|
6625
6675
|
const raw = readTail(filePath, tailBytes);
|
|
6626
6676
|
const byAgent = {};
|
|
@@ -6680,7 +6730,7 @@ __export(daemon_exports, {
|
|
|
6680
6730
|
import { spawn as spawn2 } from "node:child_process";
|
|
6681
6731
|
import { join as join4, dirname as dirname5 } from "node:path";
|
|
6682
6732
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
6683
|
-
import { existsSync as
|
|
6733
|
+
import { existsSync as existsSync6, statSync as statSync3, readFileSync as readFileSync7, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
|
|
6684
6734
|
function startDaemonSilent() {
|
|
6685
6735
|
cleanStalePid(DAEMON_PID, DAEMON_MARKERS);
|
|
6686
6736
|
const existing = readPid(DAEMON_PID);
|
|
@@ -6688,7 +6738,7 @@ function startDaemonSilent() {
|
|
|
6688
6738
|
return { started: false, pid: existing.pid, alreadyRunning: true };
|
|
6689
6739
|
}
|
|
6690
6740
|
const script = workerPath();
|
|
6691
|
-
if (!
|
|
6741
|
+
if (!existsSync6(script)) {
|
|
6692
6742
|
return {
|
|
6693
6743
|
started: false,
|
|
6694
6744
|
pid: null,
|
|
@@ -6701,7 +6751,8 @@ function startDaemonSilent() {
|
|
|
6701
6751
|
logFd = openSync3(DAEMON_LOG, "a");
|
|
6702
6752
|
} catch {
|
|
6703
6753
|
}
|
|
6704
|
-
const
|
|
6754
|
+
const node = resolveNodeBin();
|
|
6755
|
+
const child = spawn2(node, [script], {
|
|
6705
6756
|
detached: true,
|
|
6706
6757
|
stdio: ["ignore", "ignore", logFd]
|
|
6707
6758
|
});
|
|
@@ -6712,7 +6763,12 @@ function startDaemonSilent() {
|
|
|
6712
6763
|
} catch {
|
|
6713
6764
|
}
|
|
6714
6765
|
}
|
|
6715
|
-
|
|
6766
|
+
let pid;
|
|
6767
|
+
try {
|
|
6768
|
+
pid = spawnedPid(child, node);
|
|
6769
|
+
} catch (err) {
|
|
6770
|
+
return { started: false, pid: null, alreadyRunning: false, error: err.message };
|
|
6771
|
+
}
|
|
6716
6772
|
writePid(DAEMON_PID, pid);
|
|
6717
6773
|
return { started: true, pid, alreadyRunning: false };
|
|
6718
6774
|
}
|
|
@@ -6733,7 +6789,7 @@ function getDaemonStatusInfo() {
|
|
|
6733
6789
|
const running = entry !== null && isProcessAlive(entry.pid, DAEMON_MARKERS);
|
|
6734
6790
|
const latest = latestSnapshot(USAGE_LOG);
|
|
6735
6791
|
const lastSnapshotAgeMs = latest ? Date.now() - new Date(latest.captured_at).getTime() : null;
|
|
6736
|
-
const usageLogSize =
|
|
6792
|
+
const usageLogSize = existsSync6(USAGE_LOG) ? statSync3(USAGE_LOG).size : null;
|
|
6737
6793
|
return {
|
|
6738
6794
|
running,
|
|
6739
6795
|
pid: running ? entry.pid : null,
|
|
@@ -6809,7 +6865,7 @@ function daemonStatus() {
|
|
|
6809
6865
|
}
|
|
6810
6866
|
}
|
|
6811
6867
|
function daemonLogs() {
|
|
6812
|
-
if (!
|
|
6868
|
+
if (!existsSync6(DAEMON_LOG)) {
|
|
6813
6869
|
console.log("No daemon logs yet.");
|
|
6814
6870
|
return;
|
|
6815
6871
|
}
|
|
@@ -6833,7 +6889,7 @@ var init_daemon = __esm({
|
|
|
6833
6889
|
|
|
6834
6890
|
// src/updater.ts
|
|
6835
6891
|
import { execSync, spawnSync } from "node:child_process";
|
|
6836
|
-
import { existsSync as
|
|
6892
|
+
import { existsSync as existsSync7, readFileSync as readFileSync8, realpathSync as realpathSync3 } from "node:fs";
|
|
6837
6893
|
import { dirname as dirname6, join as join5 } from "node:path";
|
|
6838
6894
|
function shouldUpdate(local, remote) {
|
|
6839
6895
|
const l = local.split(".").map(Number);
|
|
@@ -6943,9 +6999,9 @@ Installed: ${PACKAGE_NAME}@${verify.installedVersion} at ${verify.installedPath
|
|
|
6943
6999
|
console.warn(
|
|
6944
7000
|
` \u2022 reinstall in the correct Node env: 'npm install -g ${PACKAGE_NAME}@latest'`
|
|
6945
7001
|
);
|
|
6946
|
-
} else if (verify.installedVersion !== "1.0.
|
|
7002
|
+
} else if (verify.installedVersion !== "1.0.22") {
|
|
6947
7003
|
console.log(
|
|
6948
|
-
` \u2192 This process is still running ${"1.0.
|
|
7004
|
+
` \u2192 This process is still running ${"1.0.22"}. Next invocation will use ${verify.installedVersion}.`
|
|
6949
7005
|
);
|
|
6950
7006
|
}
|
|
6951
7007
|
}
|
|
@@ -6964,7 +7020,7 @@ function reExec() {
|
|
|
6964
7020
|
let script = process.argv[1] ?? "";
|
|
6965
7021
|
if (verify.ok) {
|
|
6966
7022
|
const candidate = join5(verify.installedPath, "dist", "index.js");
|
|
6967
|
-
if (
|
|
7023
|
+
if (existsSync7(candidate)) script = candidate;
|
|
6968
7024
|
}
|
|
6969
7025
|
const result = spawnSync(process.argv[0], [script, ...process.argv.slice(2)], {
|
|
6970
7026
|
stdio: "inherit",
|
|
@@ -6980,14 +7036,14 @@ async function getUpdateAvailability() {
|
|
|
6980
7036
|
if (isDevMode()) return null;
|
|
6981
7037
|
const latest = await fetchLatestVersion();
|
|
6982
7038
|
if (latest === null) return {
|
|
6983
|
-
current: "1.0.
|
|
7039
|
+
current: "1.0.22",
|
|
6984
7040
|
latest: null,
|
|
6985
7041
|
updateAvailable: false
|
|
6986
7042
|
};
|
|
6987
7043
|
return {
|
|
6988
|
-
current: "1.0.
|
|
7044
|
+
current: "1.0.22",
|
|
6989
7045
|
latest,
|
|
6990
|
-
updateAvailable: shouldUpdate("1.0.
|
|
7046
|
+
updateAvailable: shouldUpdate("1.0.22", latest)
|
|
6991
7047
|
};
|
|
6992
7048
|
}
|
|
6993
7049
|
async function checkForUpdate() {
|
|
@@ -7077,7 +7133,7 @@ async function restartServices(state) {
|
|
|
7077
7133
|
}
|
|
7078
7134
|
async function forceUpdate() {
|
|
7079
7135
|
const latest = await fetchLatestVersion();
|
|
7080
|
-
const current = "1.0.
|
|
7136
|
+
const current = "1.0.22";
|
|
7081
7137
|
if (latest === null) {
|
|
7082
7138
|
console.error("Could not reach npm registry. Check your network.");
|
|
7083
7139
|
process.exit(1);
|
|
@@ -7122,14 +7178,16 @@ __export(autostart_exports, {
|
|
|
7122
7178
|
dismissPrompt: () => dismissPrompt,
|
|
7123
7179
|
ensureTeamAutostart: () => ensureTeamAutostart,
|
|
7124
7180
|
hasOptedOut: () => hasOptedOut,
|
|
7181
|
+
healAutostartNodePath: () => healAutostartNodePath,
|
|
7125
7182
|
installAutostart: () => installAutostart,
|
|
7126
7183
|
isAutostartInstalled: () => isAutostartInstalled,
|
|
7127
7184
|
isPromptDismissed: () => isPromptDismissed,
|
|
7128
7185
|
isStalePlistContent: () => isStalePlistContent,
|
|
7129
7186
|
maybePromptAutostart: () => maybePromptAutostart,
|
|
7187
|
+
plistNodePath: () => plistNodePath,
|
|
7130
7188
|
recordOptOut: () => recordOptOut
|
|
7131
7189
|
});
|
|
7132
|
-
import { existsSync as
|
|
7190
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5, rmSync, readFileSync as readFileSync9, realpathSync as realpathSync4 } from "node:fs";
|
|
7133
7191
|
import { homedir as homedir3 } from "node:os";
|
|
7134
7192
|
import { join as join6, dirname as dirname7 } from "node:path";
|
|
7135
7193
|
import { execFile } from "node:child_process";
|
|
@@ -7142,7 +7200,7 @@ function isMac() {
|
|
|
7142
7200
|
return process.platform === "darwin";
|
|
7143
7201
|
}
|
|
7144
7202
|
function isAutostartInstalled() {
|
|
7145
|
-
return isMac() &&
|
|
7203
|
+
return isMac() && existsSync8(plistPath());
|
|
7146
7204
|
}
|
|
7147
7205
|
function isStalePlistContent(content) {
|
|
7148
7206
|
return content.includes("<string>daemon</string>");
|
|
@@ -7154,6 +7212,21 @@ function installedPlistIsStale() {
|
|
|
7154
7212
|
return false;
|
|
7155
7213
|
}
|
|
7156
7214
|
}
|
|
7215
|
+
function plistNodePath(content) {
|
|
7216
|
+
return content.match(/<key>ProgramArguments<\/key>\s*<array>\s*<string>([^<]+)<\/string>/)?.[1] ?? null;
|
|
7217
|
+
}
|
|
7218
|
+
function healAutostartNodePath(nodeBin = resolveNodeBin()) {
|
|
7219
|
+
if (!isAutostartInstalled()) return null;
|
|
7220
|
+
try {
|
|
7221
|
+
const content = readFileSync9(plistPath(), "utf8");
|
|
7222
|
+
const from = plistNodePath(content);
|
|
7223
|
+
if (!from || existsSync8(from) || !existsSync8(nodeBin)) return null;
|
|
7224
|
+
writeFileSync5(plistPath(), content.replace(`<string>${from}</string>`, `<string>${nodeBin}</string>`), "utf8");
|
|
7225
|
+
return { from, to: nodeBin };
|
|
7226
|
+
} catch {
|
|
7227
|
+
return null;
|
|
7228
|
+
}
|
|
7229
|
+
}
|
|
7157
7230
|
function resolveScriptPath() {
|
|
7158
7231
|
const argv1 = process.argv[1] ?? "";
|
|
7159
7232
|
try {
|
|
@@ -7196,7 +7269,7 @@ async function installAutostart() {
|
|
|
7196
7269
|
console.log(NON_MAC_MSG);
|
|
7197
7270
|
return false;
|
|
7198
7271
|
}
|
|
7199
|
-
const nodePath =
|
|
7272
|
+
const nodePath = resolveNodeBin();
|
|
7200
7273
|
const scriptPath = resolveScriptPath();
|
|
7201
7274
|
const logPath = cclensPath("daemon-autostart.log");
|
|
7202
7275
|
const p = plistPath();
|
|
@@ -7210,7 +7283,7 @@ async function installAutostart() {
|
|
|
7210
7283
|
console.log(` LaunchAgent: ${p}`);
|
|
7211
7284
|
console.log(` Runs: ${nodePath} ${scriptPath} start`);
|
|
7212
7285
|
console.log(
|
|
7213
|
-
" Note: the Node path above is baked in. If
|
|
7286
|
+
" Note: the Node path above is baked in. If an upgrade (e.g. via nvm) removes that Node, the running daemon repoints it."
|
|
7214
7287
|
);
|
|
7215
7288
|
return true;
|
|
7216
7289
|
}
|
|
@@ -7221,7 +7294,7 @@ async function uninstallAutostart() {
|
|
|
7221
7294
|
}
|
|
7222
7295
|
const p = plistPath();
|
|
7223
7296
|
recordOptOut();
|
|
7224
|
-
if (!
|
|
7297
|
+
if (!existsSync8(p)) {
|
|
7225
7298
|
console.log("Autostart is not installed \u2014 nothing to remove. Noted your opt-out; team join won't enable it.");
|
|
7226
7299
|
return;
|
|
7227
7300
|
}
|
|
@@ -7254,7 +7327,7 @@ async function statusAutostart() {
|
|
|
7254
7327
|
return;
|
|
7255
7328
|
}
|
|
7256
7329
|
const p = plistPath();
|
|
7257
|
-
const present =
|
|
7330
|
+
const present = existsSync8(p);
|
|
7258
7331
|
let loaded = false;
|
|
7259
7332
|
try {
|
|
7260
7333
|
const { stdout } = await execFileAsync("launchctl", ["list"]);
|
|
@@ -7498,7 +7571,7 @@ async function status() {
|
|
|
7498
7571
|
}
|
|
7499
7572
|
if (isServerStale(server)) {
|
|
7500
7573
|
console.log(
|
|
7501
|
-
` \u26A0 serving stale ${ver} (CLI is ${"1.0.
|
|
7574
|
+
` \u26A0 serving stale ${ver} (CLI is ${"1.0.22"}) \u2014 run 'fleetlens start' to restart on the current version`
|
|
7502
7575
|
);
|
|
7503
7576
|
}
|
|
7504
7577
|
} else {
|
|
@@ -7537,7 +7610,7 @@ async function web(args2) {
|
|
|
7537
7610
|
const open = args2.includes("--open");
|
|
7538
7611
|
const positional = args2.filter((a) => !a.startsWith("--"));
|
|
7539
7612
|
const rawPath = positional[0] ?? "";
|
|
7540
|
-
const
|
|
7613
|
+
const path13 = rawPath.startsWith("/") ? rawPath : rawPath ? `/${rawPath}` : "";
|
|
7541
7614
|
let result;
|
|
7542
7615
|
try {
|
|
7543
7616
|
result = await ensureCurrentServer({});
|
|
@@ -7545,7 +7618,7 @@ async function web(args2) {
|
|
|
7545
7618
|
console.error(`Failed to start: ${err.message}`);
|
|
7546
7619
|
process.exit(1);
|
|
7547
7620
|
}
|
|
7548
|
-
const url = `http://localhost:${result.port}${
|
|
7621
|
+
const url = `http://localhost:${result.port}${path13}`;
|
|
7549
7622
|
if (result.restarted) {
|
|
7550
7623
|
console.log(`fleetlens restarted on http://localhost:${result.port} (PID ${result.pid}) \u2014 replaced stale ${result.previousVersion ?? "unknown"} server`);
|
|
7551
7624
|
}
|
|
@@ -8094,9 +8167,9 @@ function readFromMacKeychain(service) {
|
|
|
8094
8167
|
return null;
|
|
8095
8168
|
}
|
|
8096
8169
|
}
|
|
8097
|
-
function readCredentialsFile(
|
|
8170
|
+
function readCredentialsFile(path13) {
|
|
8098
8171
|
try {
|
|
8099
|
-
return extractCredentials(readFileSync10(
|
|
8172
|
+
return extractCredentials(readFileSync10(path13, "utf8"));
|
|
8100
8173
|
} catch {
|
|
8101
8174
|
return null;
|
|
8102
8175
|
}
|
|
@@ -8106,8 +8179,8 @@ function readFromCredentialsFile() {
|
|
|
8106
8179
|
join7(homedir4(), ".claude", ".credentials.json"),
|
|
8107
8180
|
join7(homedir4(), ".config", "claude", "credentials.json")
|
|
8108
8181
|
];
|
|
8109
|
-
for (const
|
|
8110
|
-
const creds = readCredentialsFile(
|
|
8182
|
+
for (const path13 of candidates) {
|
|
8183
|
+
const creds = readCredentialsFile(path13);
|
|
8111
8184
|
if (creds) return creds;
|
|
8112
8185
|
}
|
|
8113
8186
|
return null;
|
|
@@ -8138,7 +8211,7 @@ var init_token = __esm({
|
|
|
8138
8211
|
|
|
8139
8212
|
// src/usage/accounts.ts
|
|
8140
8213
|
import { createHash } from "node:crypto";
|
|
8141
|
-
import { existsSync as
|
|
8214
|
+
import { existsSync as existsSync9, readdirSync as readdirSync2, readFileSync as readFileSync11, statSync as statSync4 } from "node:fs";
|
|
8142
8215
|
import { homedir as homedir5, platform as platform2 } from "node:os";
|
|
8143
8216
|
import { basename as basename2, join as join8, resolve as resolve2 } from "node:path";
|
|
8144
8217
|
function defaultClaudeHome(homeDir = homedir5()) {
|
|
@@ -8173,7 +8246,7 @@ function looksLikeClaudeHome(dir) {
|
|
|
8173
8246
|
} catch {
|
|
8174
8247
|
return false;
|
|
8175
8248
|
}
|
|
8176
|
-
return CLAUDE_HOME_MARKERS.some((name) =>
|
|
8249
|
+
return CLAUDE_HOME_MARKERS.some((name) => existsSync9(join8(dir, name)));
|
|
8177
8250
|
}
|
|
8178
8251
|
function discoverClaudeConfigDirs(opts = {}) {
|
|
8179
8252
|
const homeDir = opts.homeDir ?? homedir5();
|
|
@@ -8188,7 +8261,7 @@ function discoverClaudeConfigDirs(opts = {}) {
|
|
|
8188
8261
|
};
|
|
8189
8262
|
add(join8(homeDir, ".claude"));
|
|
8190
8263
|
try {
|
|
8191
|
-
for (const name of
|
|
8264
|
+
for (const name of readdirSync2(homeDir)) {
|
|
8192
8265
|
if (!name.startsWith(".claude-")) continue;
|
|
8193
8266
|
add(join8(homeDir, name));
|
|
8194
8267
|
}
|
|
@@ -8201,12 +8274,12 @@ function discoverClaudeConfigDirs(opts = {}) {
|
|
|
8201
8274
|
function readAccountCredentials(configDir, opts = {}) {
|
|
8202
8275
|
const homeDir = opts.homeDir ?? homedir5();
|
|
8203
8276
|
const nowMs = opts.nowMs ?? Date.now();
|
|
8204
|
-
const
|
|
8277
|
+
const os13 = opts.platform ?? platform2();
|
|
8205
8278
|
const keychainRead = opts.readKeychain ?? readFromMacKeychain;
|
|
8206
8279
|
const usableOnly = opts.usableOnly !== false;
|
|
8207
8280
|
const fileCreds = readCredentialsFile(join8(configDir, ".credentials.json"));
|
|
8208
8281
|
let keychainCreds = null;
|
|
8209
|
-
if (
|
|
8282
|
+
if (os13 === "darwin") {
|
|
8210
8283
|
keychainCreds = keychainRead(keychainServiceForConfigDir(configDir, homeDir));
|
|
8211
8284
|
}
|
|
8212
8285
|
const extraFile = resolve2(configDir) === defaultClaudeHome(homeDir) ? readCredentialsFile(join8(homeDir, ".config", "claude", "credentials.json")) : null;
|
|
@@ -8388,18 +8461,18 @@ var init_api = __esm({
|
|
|
8388
8461
|
});
|
|
8389
8462
|
|
|
8390
8463
|
// src/usage/grok.ts
|
|
8391
|
-
import { existsSync as
|
|
8392
|
-
import
|
|
8393
|
-
import
|
|
8464
|
+
import { existsSync as existsSync10, readFileSync as readFileSync12 } from "node:fs";
|
|
8465
|
+
import os10 from "node:os";
|
|
8466
|
+
import path10 from "node:path";
|
|
8394
8467
|
function grokHome() {
|
|
8395
|
-
return process.env.GROK_HOME ||
|
|
8468
|
+
return process.env.GROK_HOME || path10.join(os10.homedir(), ".grok");
|
|
8396
8469
|
}
|
|
8397
8470
|
function authPath() {
|
|
8398
|
-
return
|
|
8471
|
+
return path10.join(grokHome(), "auth.json");
|
|
8399
8472
|
}
|
|
8400
8473
|
function loadAuthEntry() {
|
|
8401
8474
|
const p = authPath();
|
|
8402
|
-
if (!
|
|
8475
|
+
if (!existsSync10(p)) {
|
|
8403
8476
|
throw new GrokApiError("Grok not logged in. Run `grok login`.", "no_auth");
|
|
8404
8477
|
}
|
|
8405
8478
|
let raw;
|
|
@@ -8607,23 +8680,23 @@ var init_grok2 = __esm({
|
|
|
8607
8680
|
|
|
8608
8681
|
// src/usage/codex.ts
|
|
8609
8682
|
import {
|
|
8610
|
-
existsSync as
|
|
8683
|
+
existsSync as existsSync11,
|
|
8611
8684
|
readFileSync as readFileSync13,
|
|
8612
8685
|
writeFileSync as writeFileSync6
|
|
8613
8686
|
} from "node:fs";
|
|
8614
|
-
import
|
|
8615
|
-
import
|
|
8687
|
+
import os11 from "node:os";
|
|
8688
|
+
import path11 from "node:path";
|
|
8616
8689
|
function codexHome() {
|
|
8617
8690
|
const env = process.env.CODEX_HOME?.trim();
|
|
8618
8691
|
if (env) return env;
|
|
8619
|
-
return
|
|
8692
|
+
return path11.join(os11.homedir(), ".codex");
|
|
8620
8693
|
}
|
|
8621
8694
|
function authPath2() {
|
|
8622
|
-
return
|
|
8695
|
+
return path11.join(codexHome(), "auth.json");
|
|
8623
8696
|
}
|
|
8624
8697
|
function loadAuth() {
|
|
8625
8698
|
const p = authPath2();
|
|
8626
|
-
if (!
|
|
8699
|
+
if (!existsSync11(p)) {
|
|
8627
8700
|
throw new CodexApiError(
|
|
8628
8701
|
"Codex not logged in. Run `codex` to authenticate.",
|
|
8629
8702
|
"no_auth"
|
|
@@ -8893,7 +8966,7 @@ var init_codex2 = __esm({
|
|
|
8893
8966
|
|
|
8894
8967
|
// src/usage/copilot.ts
|
|
8895
8968
|
import { spawn as spawn3 } from "node:child_process";
|
|
8896
|
-
import { existsSync as
|
|
8969
|
+
import { existsSync as existsSync12 } from "node:fs";
|
|
8897
8970
|
import { dirname as dirname8, join as join9 } from "node:path";
|
|
8898
8971
|
function recordOf2(value) {
|
|
8899
8972
|
return typeof value === "object" && value !== null ? value : void 0;
|
|
@@ -8968,7 +9041,7 @@ function resolveCopilotCliPath() {
|
|
|
8968
9041
|
const configured = process.env.COPILOT_CLI_PATH?.trim();
|
|
8969
9042
|
if (configured) return configured;
|
|
8970
9043
|
const sibling = join9(dirname8(process.execPath), process.platform === "win32" ? "copilot.cmd" : "copilot");
|
|
8971
|
-
return
|
|
9044
|
+
return existsSync12(sibling) ? sibling : process.platform === "win32" ? "copilot.cmd" : "copilot";
|
|
8972
9045
|
}
|
|
8973
9046
|
async function requestQuota(child) {
|
|
8974
9047
|
const decoder = new ContentLengthDecoder();
|
|
@@ -9100,11 +9173,11 @@ var init_copilot2 = __esm({
|
|
|
9100
9173
|
});
|
|
9101
9174
|
|
|
9102
9175
|
// src/usage/zai.ts
|
|
9103
|
-
import { existsSync as
|
|
9176
|
+
import { existsSync as existsSync13, readFileSync as readFileSync14 } from "node:fs";
|
|
9104
9177
|
function resolveApiKey() {
|
|
9105
9178
|
try {
|
|
9106
9179
|
const p = cclensPath("credentials.json");
|
|
9107
|
-
if (
|
|
9180
|
+
if (existsSync13(p)) {
|
|
9108
9181
|
const store = JSON.parse(readFileSync14(p, "utf8"));
|
|
9109
9182
|
return store.zai?.apiKey ?? null;
|
|
9110
9183
|
}
|
|
@@ -9210,18 +9283,18 @@ var init_zai = __esm({
|
|
|
9210
9283
|
});
|
|
9211
9284
|
|
|
9212
9285
|
// src/usage/command-code.ts
|
|
9213
|
-
import { existsSync as
|
|
9214
|
-
import
|
|
9215
|
-
import
|
|
9286
|
+
import { existsSync as existsSync14, readFileSync as readFileSync15 } from "node:fs";
|
|
9287
|
+
import os12 from "node:os";
|
|
9288
|
+
import path12 from "node:path";
|
|
9216
9289
|
function commandCodeHome() {
|
|
9217
|
-
return process.env.COMMANDCODE_HOME ||
|
|
9290
|
+
return process.env.COMMANDCODE_HOME || path12.join(os12.homedir(), ".commandcode");
|
|
9218
9291
|
}
|
|
9219
9292
|
function authPath3() {
|
|
9220
|
-
return
|
|
9293
|
+
return path12.join(commandCodeHome(), "auth.json");
|
|
9221
9294
|
}
|
|
9222
9295
|
function loadCommandCodeApiKey() {
|
|
9223
9296
|
const p = authPath3();
|
|
9224
|
-
if (!
|
|
9297
|
+
if (!existsSync14(p)) {
|
|
9225
9298
|
throw new CommandCodeApiError("Command Code not logged in. Run `cmd login`.", "no_auth");
|
|
9226
9299
|
}
|
|
9227
9300
|
let raw;
|
|
@@ -9458,14 +9531,14 @@ var init_command_code = __esm({
|
|
|
9458
9531
|
});
|
|
9459
9532
|
|
|
9460
9533
|
// src/usage/kaihk.ts
|
|
9461
|
-
import { existsSync as
|
|
9534
|
+
import { existsSync as existsSync15, readFileSync as readFileSync16 } from "node:fs";
|
|
9462
9535
|
import { homedir as homedir6 } from "node:os";
|
|
9463
9536
|
import { join as join10 } from "node:path";
|
|
9464
9537
|
function opencodeConfigPath() {
|
|
9465
9538
|
return process.env.OPENCODE_CONFIG ?? join10(homedir6(), ".config", "opencode", "opencode.json");
|
|
9466
9539
|
}
|
|
9467
9540
|
function discoverKaihkProviders(configPath = opencodeConfigPath()) {
|
|
9468
|
-
if (!
|
|
9541
|
+
if (!existsSync15(configPath)) return [];
|
|
9469
9542
|
let parsed;
|
|
9470
9543
|
try {
|
|
9471
9544
|
parsed = JSON.parse(readFileSync16(configPath, "utf8"));
|
|
@@ -11807,11 +11880,11 @@ var init_dist2 = __esm({
|
|
|
11807
11880
|
});
|
|
11808
11881
|
|
|
11809
11882
|
// ../entries/dist/digest-fs.js
|
|
11810
|
-
import { readFileSync as readFileSync17, readdirSync as
|
|
11883
|
+
import { readFileSync as readFileSync17, readdirSync as readdirSync3, writeFileSync as writeFileSync7, renameSync as renameSync2, chmodSync, mkdirSync as mkdirSync6, existsSync as existsSync16 } from "node:fs";
|
|
11811
11884
|
import { dirname as dirname9, join as join11 } from "node:path";
|
|
11812
|
-
function parseDigestFile(
|
|
11885
|
+
function parseDigestFile(path13, expectedVersion) {
|
|
11813
11886
|
try {
|
|
11814
|
-
const parsed = JSON.parse(readFileSync17(
|
|
11887
|
+
const parsed = JSON.parse(readFileSync17(path13, "utf8"));
|
|
11815
11888
|
if (!parsed || typeof parsed !== "object")
|
|
11816
11889
|
return null;
|
|
11817
11890
|
if (parsed.version !== expectedVersion)
|
|
@@ -11830,11 +11903,11 @@ function digestsDir() {
|
|
|
11830
11903
|
digestsDirCached = envOverride ?? cclensPath("digests");
|
|
11831
11904
|
return digestsDirCached;
|
|
11832
11905
|
}
|
|
11833
|
-
function __setDigestsDirForTest(
|
|
11834
|
-
digestsDirCached =
|
|
11835
|
-
mkdirSync6(join11(
|
|
11836
|
-
mkdirSync6(join11(
|
|
11837
|
-
mkdirSync6(join11(
|
|
11906
|
+
function __setDigestsDirForTest(path13) {
|
|
11907
|
+
digestsDirCached = path13;
|
|
11908
|
+
mkdirSync6(join11(path13, "day"), { recursive: true });
|
|
11909
|
+
mkdirSync6(join11(path13, "week"), { recursive: true });
|
|
11910
|
+
mkdirSync6(join11(path13, "month"), { recursive: true });
|
|
11838
11911
|
}
|
|
11839
11912
|
function dayDigestPath(date) {
|
|
11840
11913
|
return join11(digestsDir(), "day", `${date}.json`);
|
|
@@ -11860,7 +11933,7 @@ function writeDayDigest(digest2) {
|
|
|
11860
11933
|
}
|
|
11861
11934
|
function readDayDigest(date) {
|
|
11862
11935
|
const p = dayDigestPath(date);
|
|
11863
|
-
if (!
|
|
11936
|
+
if (!existsSync16(p))
|
|
11864
11937
|
return null;
|
|
11865
11938
|
return parseDigestFile(p, CURRENT_DAY_DIGEST_SCHEMA_VERSION);
|
|
11866
11939
|
}
|
|
@@ -11896,15 +11969,15 @@ function writeWeekDigest(digest2) {
|
|
|
11896
11969
|
}
|
|
11897
11970
|
function readWeekDigest(monday) {
|
|
11898
11971
|
const p = weekDigestPath(monday);
|
|
11899
|
-
if (!
|
|
11972
|
+
if (!existsSync16(p))
|
|
11900
11973
|
return null;
|
|
11901
11974
|
return parseDigestFile(p, CURRENT_WEEK_DIGEST_SCHEMA_VERSION);
|
|
11902
11975
|
}
|
|
11903
11976
|
function listWeekDigestKeys() {
|
|
11904
11977
|
const dir = join11(digestsDir(), "week");
|
|
11905
|
-
if (!
|
|
11978
|
+
if (!existsSync16(dir))
|
|
11906
11979
|
return [];
|
|
11907
|
-
return
|
|
11980
|
+
return readdirSync3(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length)).filter((k) => /^\d{4}-\d{2}-\d{2}$/.test(k));
|
|
11908
11981
|
}
|
|
11909
11982
|
function getCurrentWeekDigestFromCache(monday, nowMs) {
|
|
11910
11983
|
if (!currentWeekCache)
|
|
@@ -11933,15 +12006,15 @@ function writeMonthDigest(digest2) {
|
|
|
11933
12006
|
}
|
|
11934
12007
|
function readMonthDigest(yearMonth) {
|
|
11935
12008
|
const p = monthDigestPath(yearMonth);
|
|
11936
|
-
if (!
|
|
12009
|
+
if (!existsSync16(p))
|
|
11937
12010
|
return null;
|
|
11938
12011
|
return parseDigestFile(p, CURRENT_MONTH_DIGEST_SCHEMA_VERSION);
|
|
11939
12012
|
}
|
|
11940
12013
|
function listMonthDigestKeys() {
|
|
11941
12014
|
const dir = join11(digestsDir(), "month");
|
|
11942
|
-
if (!
|
|
12015
|
+
if (!existsSync16(dir))
|
|
11943
12016
|
return [];
|
|
11944
|
-
return
|
|
12017
|
+
return readdirSync3(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length)).filter((k) => /^\d{4}-\d{2}$/.test(k));
|
|
11945
12018
|
}
|
|
11946
12019
|
function getCurrentMonthDigestFromCache(yearMonth, nowMs) {
|
|
11947
12020
|
if (!currentMonthCache)
|
|
@@ -12001,7 +12074,7 @@ __export(fs_exports2, {
|
|
|
12001
12074
|
writeMonthDigest: () => writeMonthDigest,
|
|
12002
12075
|
writeWeekDigest: () => writeWeekDigest
|
|
12003
12076
|
});
|
|
12004
|
-
import { readFileSync as readFileSync18, readdirSync as
|
|
12077
|
+
import { readFileSync as readFileSync18, readdirSync as readdirSync4, writeFileSync as writeFileSync8, mkdirSync as mkdirSync7, renameSync as renameSync3, existsSync as existsSync17 } from "node:fs";
|
|
12005
12078
|
import { randomBytes } from "node:crypto";
|
|
12006
12079
|
import { join as join12 } from "node:path";
|
|
12007
12080
|
function entriesDir() {
|
|
@@ -12011,9 +12084,9 @@ function entriesDir() {
|
|
|
12011
12084
|
entriesDirCached = envOverride ?? cclensPath("entries");
|
|
12012
12085
|
return entriesDirCached;
|
|
12013
12086
|
}
|
|
12014
|
-
function __setEntriesDirForTest(
|
|
12015
|
-
entriesDirCached =
|
|
12016
|
-
mkdirSync7(
|
|
12087
|
+
function __setEntriesDirForTest(path13) {
|
|
12088
|
+
entriesDirCached = path13;
|
|
12089
|
+
mkdirSync7(path13, { recursive: true });
|
|
12017
12090
|
}
|
|
12018
12091
|
function pathFor(sessionId, localDay2) {
|
|
12019
12092
|
return join12(entriesDir(), `${entryKey(sessionId, localDay2)}.json`);
|
|
@@ -12060,19 +12133,19 @@ function writeEntryPreservingEnrichment(fresh) {
|
|
|
12060
12133
|
}
|
|
12061
12134
|
function readEntry(sessionId, localDay2) {
|
|
12062
12135
|
const p = pathFor(sessionId, localDay2);
|
|
12063
|
-
if (!
|
|
12136
|
+
if (!existsSync17(p))
|
|
12064
12137
|
return null;
|
|
12065
12138
|
const raw = readFileSync18(p, "utf8");
|
|
12066
12139
|
return JSON.parse(raw);
|
|
12067
12140
|
}
|
|
12068
12141
|
function entryExists(sessionId, localDay2) {
|
|
12069
|
-
return
|
|
12142
|
+
return existsSync17(pathFor(sessionId, localDay2));
|
|
12070
12143
|
}
|
|
12071
12144
|
function listEntryKeys() {
|
|
12072
12145
|
const dir = entriesDir();
|
|
12073
|
-
if (!
|
|
12146
|
+
if (!existsSync17(dir))
|
|
12074
12147
|
return [];
|
|
12075
|
-
return
|
|
12148
|
+
return readdirSync4(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length));
|
|
12076
12149
|
}
|
|
12077
12150
|
function listEntriesForDay(localDay2) {
|
|
12078
12151
|
const out = [];
|
|
@@ -12541,8 +12614,8 @@ var init_parseUtil = __esm({
|
|
|
12541
12614
|
init_errors();
|
|
12542
12615
|
init_en();
|
|
12543
12616
|
makeIssue = (params) => {
|
|
12544
|
-
const { data, path:
|
|
12545
|
-
const fullPath = [...
|
|
12617
|
+
const { data, path: path13, errorMaps, issueData } = params;
|
|
12618
|
+
const fullPath = [...path13, ...issueData.path || []];
|
|
12546
12619
|
const fullIssue = {
|
|
12547
12620
|
...issueData,
|
|
12548
12621
|
path: fullPath
|
|
@@ -12850,11 +12923,11 @@ var init_types3 = __esm({
|
|
|
12850
12923
|
init_parseUtil();
|
|
12851
12924
|
init_util();
|
|
12852
12925
|
ParseInputLazyPath = class {
|
|
12853
|
-
constructor(parent, value,
|
|
12926
|
+
constructor(parent, value, path13, key) {
|
|
12854
12927
|
this._cachedPath = [];
|
|
12855
12928
|
this.parent = parent;
|
|
12856
12929
|
this.data = value;
|
|
12857
|
-
this._path =
|
|
12930
|
+
this._path = path13;
|
|
12858
12931
|
this._key = key;
|
|
12859
12932
|
}
|
|
12860
12933
|
get path() {
|
|
@@ -16338,14 +16411,14 @@ RESPOND WITH ONLY VALID JSON (no prose, no code fence):
|
|
|
16338
16411
|
});
|
|
16339
16412
|
|
|
16340
16413
|
// ../entries/dist/claude-bin.js
|
|
16341
|
-
import { existsSync as
|
|
16414
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
16342
16415
|
import { join as join13, dirname as dirname10, delimiter } from "node:path";
|
|
16343
16416
|
import { homedir as homedir7 } from "node:os";
|
|
16344
16417
|
function resolveClaudeBin(opts = {}) {
|
|
16345
16418
|
const env = opts.env ?? process.env;
|
|
16346
16419
|
const home = opts.home ?? homedir7();
|
|
16347
16420
|
const execPath = opts.execPath ?? process.execPath;
|
|
16348
|
-
const exists = opts.exists ??
|
|
16421
|
+
const exists = opts.exists ?? existsSync18;
|
|
16349
16422
|
for (const dir of (env.PATH ?? "").split(delimiter)) {
|
|
16350
16423
|
if (!dir)
|
|
16351
16424
|
continue;
|
|
@@ -16386,7 +16459,7 @@ var init_claude_bin = __esm({
|
|
|
16386
16459
|
});
|
|
16387
16460
|
|
|
16388
16461
|
// ../entries/dist/tmux-runner.js
|
|
16389
|
-
import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, existsSync as
|
|
16462
|
+
import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, existsSync as existsSync19, readdirSync as readdirSync5, realpathSync as realpathSync5, readFileSync as readFileSync19, unlinkSync as unlinkSync3, renameSync as renameSync4 } from "node:fs";
|
|
16390
16463
|
import { join as join14 } from "node:path";
|
|
16391
16464
|
import { homedir as homedir8 } from "node:os";
|
|
16392
16465
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
@@ -16405,7 +16478,7 @@ function tmuxRunnerAvailable() {
|
|
|
16405
16478
|
}
|
|
16406
16479
|
function runtimeCwd() {
|
|
16407
16480
|
const dir = join14(homedir8(), ".cclens", "runtime");
|
|
16408
|
-
if (!
|
|
16481
|
+
if (!existsSync19(dir))
|
|
16409
16482
|
mkdirSync8(dir, { recursive: true });
|
|
16410
16483
|
return realpathSync5(dir);
|
|
16411
16484
|
}
|
|
@@ -16541,7 +16614,7 @@ function snapshotAllTranscripts() {
|
|
|
16541
16614
|
const root = PROJECTS_ROOT();
|
|
16542
16615
|
let subs;
|
|
16543
16616
|
try {
|
|
16544
|
-
subs =
|
|
16617
|
+
subs = readdirSync5(root);
|
|
16545
16618
|
} catch {
|
|
16546
16619
|
return out;
|
|
16547
16620
|
}
|
|
@@ -16549,7 +16622,7 @@ function snapshotAllTranscripts() {
|
|
|
16549
16622
|
const dir = join14(root, sub);
|
|
16550
16623
|
let files;
|
|
16551
16624
|
try {
|
|
16552
|
-
files =
|
|
16625
|
+
files = readdirSync5(dir);
|
|
16553
16626
|
} catch {
|
|
16554
16627
|
continue;
|
|
16555
16628
|
}
|
|
@@ -16560,10 +16633,10 @@ function snapshotAllTranscripts() {
|
|
|
16560
16633
|
}
|
|
16561
16634
|
return out;
|
|
16562
16635
|
}
|
|
16563
|
-
function readJsonlCwd(
|
|
16636
|
+
function readJsonlCwd(path13, maxLines = 8) {
|
|
16564
16637
|
let raw;
|
|
16565
16638
|
try {
|
|
16566
|
-
raw = readFileSync19(
|
|
16639
|
+
raw = readFileSync19(path13, "utf8");
|
|
16567
16640
|
} catch {
|
|
16568
16641
|
return void 0;
|
|
16569
16642
|
}
|
|
@@ -16591,7 +16664,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
|
|
|
16591
16664
|
const root = PROJECTS_ROOT();
|
|
16592
16665
|
let subs;
|
|
16593
16666
|
try {
|
|
16594
|
-
subs =
|
|
16667
|
+
subs = readdirSync5(root);
|
|
16595
16668
|
} catch {
|
|
16596
16669
|
subs = [];
|
|
16597
16670
|
}
|
|
@@ -16599,7 +16672,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
|
|
|
16599
16672
|
const dir = join14(root, sub);
|
|
16600
16673
|
let files;
|
|
16601
16674
|
try {
|
|
16602
|
-
files =
|
|
16675
|
+
files = readdirSync5(dir);
|
|
16603
16676
|
} catch {
|
|
16604
16677
|
continue;
|
|
16605
16678
|
}
|
|
@@ -16617,10 +16690,10 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
|
|
|
16617
16690
|
}
|
|
16618
16691
|
throw new TmuxRunError(`timeout waiting for claude to create the session transcript (cwd: ${targetCwd})`);
|
|
16619
16692
|
}
|
|
16620
|
-
function parseTranscript2(
|
|
16693
|
+
function parseTranscript2(path13, defaultModel) {
|
|
16621
16694
|
let raw;
|
|
16622
16695
|
try {
|
|
16623
|
-
raw = readFileSync19(
|
|
16696
|
+
raw = readFileSync19(path13, "utf8");
|
|
16624
16697
|
} catch {
|
|
16625
16698
|
return { assembled: "", inputTokens: 0, outputTokens: 0, modelUsed: defaultModel, done: false };
|
|
16626
16699
|
}
|
|
@@ -16715,11 +16788,11 @@ var init_tmux_runner = __esm({
|
|
|
16715
16788
|
|
|
16716
16789
|
// ../entries/dist/llm-runner.js
|
|
16717
16790
|
import { spawn as spawn4 } from "node:child_process";
|
|
16718
|
-
import { mkdirSync as mkdirSync9, appendFileSync as appendFileSync3, writeFileSync as writeFileSync10, existsSync as
|
|
16791
|
+
import { mkdirSync as mkdirSync9, appendFileSync as appendFileSync3, writeFileSync as writeFileSync10, existsSync as existsSync20 } from "node:fs";
|
|
16719
16792
|
import { join as join15 } from "node:path";
|
|
16720
16793
|
import { randomUUID } from "node:crypto";
|
|
16721
16794
|
function ensureRunsDir() {
|
|
16722
|
-
if (!
|
|
16795
|
+
if (!existsSync20(RUNS_DIR)) {
|
|
16723
16796
|
try {
|
|
16724
16797
|
mkdirSync9(RUNS_DIR, { recursive: true });
|
|
16725
16798
|
} catch {
|
|
@@ -16750,15 +16823,15 @@ function newRunId(kind) {
|
|
|
16750
16823
|
function tracePath(runId) {
|
|
16751
16824
|
return join15(RUNS_DIR, `${runId}.jsonl`);
|
|
16752
16825
|
}
|
|
16753
|
-
function safeAppend(
|
|
16826
|
+
function safeAppend(path13, line) {
|
|
16754
16827
|
try {
|
|
16755
|
-
appendFileSync3(
|
|
16828
|
+
appendFileSync3(path13, line);
|
|
16756
16829
|
} catch {
|
|
16757
16830
|
}
|
|
16758
16831
|
}
|
|
16759
|
-
function safeWrite(
|
|
16832
|
+
function safeWrite(path13, line) {
|
|
16760
16833
|
try {
|
|
16761
|
-
writeFileSync10(
|
|
16834
|
+
writeFileSync10(path13, line);
|
|
16762
16835
|
} catch {
|
|
16763
16836
|
}
|
|
16764
16837
|
}
|
|
@@ -17172,7 +17245,7 @@ var init_enrich2 = __esm({
|
|
|
17172
17245
|
});
|
|
17173
17246
|
|
|
17174
17247
|
// ../entries/dist/budget.js
|
|
17175
|
-
import { appendFileSync as appendFileSync4, readFileSync as readFileSync20, existsSync as
|
|
17248
|
+
import { appendFileSync as appendFileSync4, readFileSync as readFileSync20, existsSync as existsSync21, mkdirSync as mkdirSync10 } from "node:fs";
|
|
17176
17249
|
import { dirname as dirname11 } from "node:path";
|
|
17177
17250
|
function spendPath() {
|
|
17178
17251
|
if (spendPathCached)
|
|
@@ -17180,8 +17253,8 @@ function spendPath() {
|
|
|
17180
17253
|
spendPathCached = cclensPath("llm-spend.jsonl");
|
|
17181
17254
|
return spendPathCached;
|
|
17182
17255
|
}
|
|
17183
|
-
function __setSpendPathForTest(
|
|
17184
|
-
spendPathCached =
|
|
17256
|
+
function __setSpendPathForTest(path13) {
|
|
17257
|
+
spendPathCached = path13;
|
|
17185
17258
|
}
|
|
17186
17259
|
function appendSpend(record) {
|
|
17187
17260
|
const p = spendPath();
|
|
@@ -17190,7 +17263,7 @@ function appendSpend(record) {
|
|
|
17190
17263
|
}
|
|
17191
17264
|
function monthToDateSpend(now = /* @__PURE__ */ new Date()) {
|
|
17192
17265
|
const p = spendPath();
|
|
17193
|
-
if (!
|
|
17266
|
+
if (!existsSync21(p))
|
|
17194
17267
|
return 0;
|
|
17195
17268
|
const year = now.getUTCFullYear();
|
|
17196
17269
|
const month2 = now.getUTCMonth();
|
|
@@ -17224,15 +17297,15 @@ var init_budget = __esm({
|
|
|
17224
17297
|
});
|
|
17225
17298
|
|
|
17226
17299
|
// ../entries/dist/pipeline-lock.js
|
|
17227
|
-
import { writeFileSync as writeFileSync11, unlinkSync as unlinkSync4, existsSync as
|
|
17300
|
+
import { writeFileSync as writeFileSync11, unlinkSync as unlinkSync4, existsSync as existsSync22, readFileSync as readFileSync21, statSync as statSync5 } from "node:fs";
|
|
17228
17301
|
function lockPath() {
|
|
17229
17302
|
if (lockPathCached)
|
|
17230
17303
|
return lockPathCached;
|
|
17231
17304
|
lockPathCached = cclensPath("llm-interactive.lock");
|
|
17232
17305
|
return lockPathCached;
|
|
17233
17306
|
}
|
|
17234
|
-
function __setInteractiveLockPathForTest(
|
|
17235
|
-
lockPathCached =
|
|
17307
|
+
function __setInteractiveLockPathForTest(path13) {
|
|
17308
|
+
lockPathCached = path13;
|
|
17236
17309
|
}
|
|
17237
17310
|
function touchLock() {
|
|
17238
17311
|
writeFileSync11(lockPath(), String(process.pid), "utf8");
|
|
@@ -17269,7 +17342,7 @@ function pidAlive(pid) {
|
|
|
17269
17342
|
}
|
|
17270
17343
|
function interactiveLockFresh(nowMs) {
|
|
17271
17344
|
const p = lockPath();
|
|
17272
|
-
if (!
|
|
17345
|
+
if (!existsSync22(p))
|
|
17273
17346
|
return false;
|
|
17274
17347
|
try {
|
|
17275
17348
|
const mtime = statSync5(p).mtimeMs;
|
|
@@ -17381,7 +17454,7 @@ var init_queue = __esm({
|
|
|
17381
17454
|
});
|
|
17382
17455
|
|
|
17383
17456
|
// ../entries/dist/settings.js
|
|
17384
|
-
import { readFileSync as readFileSync22, writeFileSync as writeFileSync12, renameSync as renameSync5, chmodSync as chmodSync2, mkdirSync as mkdirSync11, existsSync as
|
|
17457
|
+
import { readFileSync as readFileSync22, writeFileSync as writeFileSync12, renameSync as renameSync5, chmodSync as chmodSync2, mkdirSync as mkdirSync11, existsSync as existsSync23 } from "node:fs";
|
|
17385
17458
|
import { dirname as dirname12 } from "node:path";
|
|
17386
17459
|
function settingsPath() {
|
|
17387
17460
|
if (settingsPathCached)
|
|
@@ -17389,8 +17462,8 @@ function settingsPath() {
|
|
|
17389
17462
|
settingsPathCached = cclensPath("settings.json");
|
|
17390
17463
|
return settingsPathCached;
|
|
17391
17464
|
}
|
|
17392
|
-
function __setSettingsPathForTest(
|
|
17393
|
-
settingsPathCached =
|
|
17465
|
+
function __setSettingsPathForTest(path13) {
|
|
17466
|
+
settingsPathCached = path13;
|
|
17394
17467
|
}
|
|
17395
17468
|
function toDisk(s) {
|
|
17396
17469
|
return {
|
|
@@ -17417,7 +17490,7 @@ function fromDisk(d) {
|
|
|
17417
17490
|
}
|
|
17418
17491
|
function readSettings() {
|
|
17419
17492
|
const p = settingsPath();
|
|
17420
|
-
if (!
|
|
17493
|
+
if (!existsSync23(p))
|
|
17421
17494
|
return DEFAULT_SETTINGS;
|
|
17422
17495
|
try {
|
|
17423
17496
|
const raw = readFileSync22(p, "utf8");
|
|
@@ -20610,7 +20683,7 @@ var init_digest_month_pipeline = __esm({
|
|
|
20610
20683
|
});
|
|
20611
20684
|
|
|
20612
20685
|
// ../entries/dist/credentials.js
|
|
20613
|
-
import { writeFileSync as writeFileSync13, readFileSync as readFileSync23, renameSync as renameSync6, chmodSync as chmodSync3, mkdirSync as mkdirSync12, existsSync as
|
|
20686
|
+
import { writeFileSync as writeFileSync13, readFileSync as readFileSync23, renameSync as renameSync6, chmodSync as chmodSync3, mkdirSync as mkdirSync12, existsSync as existsSync24, unlinkSync as unlinkSync5 } from "node:fs";
|
|
20614
20687
|
import { dirname as dirname13 } from "node:path";
|
|
20615
20688
|
async function fetchZaiUsage2(candidate) {
|
|
20616
20689
|
const key = candidate.trim();
|
|
@@ -20681,7 +20754,7 @@ function credentialsPath() {
|
|
|
20681
20754
|
}
|
|
20682
20755
|
function readCredentials() {
|
|
20683
20756
|
const p = credentialsPath();
|
|
20684
|
-
if (!
|
|
20757
|
+
if (!existsSync24(p))
|
|
20685
20758
|
return {};
|
|
20686
20759
|
try {
|
|
20687
20760
|
const raw = readFileSync23(p, "utf8");
|
|
@@ -21316,9 +21389,10 @@ var init_digest = __esm({
|
|
|
21316
21389
|
// src/commands/menubar.ts
|
|
21317
21390
|
var menubar_exports = {};
|
|
21318
21391
|
__export(menubar_exports, {
|
|
21392
|
+
healCliLaunchFile: () => healCliLaunchFile,
|
|
21319
21393
|
menubar: () => menubar
|
|
21320
21394
|
});
|
|
21321
|
-
import { existsSync as
|
|
21395
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync13, cpSync, rmSync as rmSync2, readdirSync as readdirSync6, writeFileSync as writeFileSync14, realpathSync as realpathSync6, readFileSync as readFileSync24 } from "node:fs";
|
|
21322
21396
|
import { homedir as homedir9 } from "node:os";
|
|
21323
21397
|
import { join as join16, dirname as dirname14 } from "node:path";
|
|
21324
21398
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
@@ -21343,12 +21417,23 @@ function writeCliLaunchFile() {
|
|
|
21343
21417
|
try {
|
|
21344
21418
|
writeFileSync14(
|
|
21345
21419
|
cclensPath("cli-launch.json"),
|
|
21346
|
-
JSON.stringify({ node:
|
|
21420
|
+
JSON.stringify({ node: resolveNodeBin(), script: resolveScriptPath2() }),
|
|
21347
21421
|
"utf8"
|
|
21348
21422
|
);
|
|
21349
21423
|
} catch {
|
|
21350
21424
|
}
|
|
21351
21425
|
}
|
|
21426
|
+
function healCliLaunchFile(nodeBin = resolveNodeBin()) {
|
|
21427
|
+
try {
|
|
21428
|
+
const file = cclensPath("cli-launch.json");
|
|
21429
|
+
const launch = JSON.parse(readFileSync24(file, "utf8"));
|
|
21430
|
+
if (!launch.node || existsSync25(launch.node) || !existsSync25(nodeBin)) return null;
|
|
21431
|
+
writeFileSync14(file, JSON.stringify({ ...launch, node: nodeBin }), "utf8");
|
|
21432
|
+
return { from: launch.node, to: nodeBin };
|
|
21433
|
+
} catch {
|
|
21434
|
+
return null;
|
|
21435
|
+
}
|
|
21436
|
+
}
|
|
21352
21437
|
function installedAppPath() {
|
|
21353
21438
|
return join16(homedir9(), "Applications", APP_BUNDLE);
|
|
21354
21439
|
}
|
|
@@ -21363,8 +21448,8 @@ async function isRunning() {
|
|
|
21363
21448
|
return false;
|
|
21364
21449
|
}
|
|
21365
21450
|
}
|
|
21366
|
-
async function launchApp(
|
|
21367
|
-
await execFileAsync2("open", ["-a",
|
|
21451
|
+
async function launchApp(path13) {
|
|
21452
|
+
await execFileAsync2("open", ["-a", path13]);
|
|
21368
21453
|
}
|
|
21369
21454
|
async function quitApp() {
|
|
21370
21455
|
await execFileAsync2("osascript", ["-e", `tell application "${BUNDLE_EXEC}" to quit`]).catch(
|
|
@@ -21392,7 +21477,7 @@ async function installMenubar(opts) {
|
|
|
21392
21477
|
return;
|
|
21393
21478
|
}
|
|
21394
21479
|
const src = bundledAppPath();
|
|
21395
|
-
if (!
|
|
21480
|
+
if (!existsSync25(src)) {
|
|
21396
21481
|
console.error(
|
|
21397
21482
|
`Bundled widget not found at ${src}.
|
|
21398
21483
|
This install was probably built without the menubar artifact. Run \`bash apps/menubar/build-app.sh && cp -R apps/menubar/dist/Fleetlens.app packages/cli/menubar/\` and rebuild.`
|
|
@@ -21438,7 +21523,7 @@ async function uninstallMenubar() {
|
|
|
21438
21523
|
await new Promise((r) => setTimeout(r, 300));
|
|
21439
21524
|
}
|
|
21440
21525
|
const dest = installedAppPath();
|
|
21441
|
-
if (
|
|
21526
|
+
if (existsSync25(dest)) {
|
|
21442
21527
|
rmSync2(dest, { recursive: true, force: true });
|
|
21443
21528
|
console.log(`Removed ${dest}`);
|
|
21444
21529
|
} else {
|
|
@@ -21453,7 +21538,7 @@ async function openMenubar() {
|
|
|
21453
21538
|
return;
|
|
21454
21539
|
}
|
|
21455
21540
|
const dest = installedAppPath();
|
|
21456
|
-
if (!
|
|
21541
|
+
if (!existsSync25(dest)) {
|
|
21457
21542
|
console.log("Widget not installed yet. Run `fleetlens menubar install` first.");
|
|
21458
21543
|
return;
|
|
21459
21544
|
}
|
|
@@ -21470,15 +21555,15 @@ async function statusMenubar() {
|
|
|
21470
21555
|
return;
|
|
21471
21556
|
}
|
|
21472
21557
|
const dest = installedAppPath();
|
|
21473
|
-
const installed =
|
|
21558
|
+
const installed = existsSync25(dest);
|
|
21474
21559
|
const running = await isRunning();
|
|
21475
|
-
const bundled =
|
|
21560
|
+
const bundled = existsSync25(bundledAppPath());
|
|
21476
21561
|
console.log(`Menu bar widget: ${installed ? "installed" : "not installed"}${installed ? ` (${dest})` : ""}`);
|
|
21477
21562
|
console.log(`Running: ${running ? "yes" : "no"}`);
|
|
21478
21563
|
console.log(`Bundled in CLI: ${bundled ? "yes" : "no \u2014 this build ships without the widget"}`);
|
|
21479
21564
|
if (installed) {
|
|
21480
21565
|
try {
|
|
21481
|
-
const apps =
|
|
21566
|
+
const apps = readdirSync6(join16(homedir9(), "Applications"));
|
|
21482
21567
|
const ours = apps.find((a) => a === APP_BUNDLE);
|
|
21483
21568
|
console.log(`App bundle: ${ours ? "present in ~/Applications" : "missing"}`);
|
|
21484
21569
|
} catch {
|
|
@@ -21839,7 +21924,7 @@ function buildIngestPayload(inputs) {
|
|
|
21839
21924
|
return {
|
|
21840
21925
|
ingestId: randomUUID2(),
|
|
21841
21926
|
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
21842
|
-
cliVersion: "1.0.
|
|
21927
|
+
cliVersion: "1.0.22",
|
|
21843
21928
|
...richRollup || inputs.enrichedExtras || inputs.artifactSignals ? { schemaVersion: RICH_ROLLUP_SCHEMA_VERSION } : {},
|
|
21844
21929
|
...inputs.rollup ? { dailyRollup: inputs.rollup } : {},
|
|
21845
21930
|
...richRollup ? { richRollup } : {},
|
|
@@ -21881,7 +21966,7 @@ var init_push = __esm({
|
|
|
21881
21966
|
});
|
|
21882
21967
|
|
|
21883
21968
|
// src/team/git-remote.ts
|
|
21884
|
-
import { existsSync as
|
|
21969
|
+
import { existsSync as existsSync26, readFileSync as readFileSync25, statSync as statSync7 } from "node:fs";
|
|
21885
21970
|
import { dirname as dirname16, isAbsolute as isAbsolute2, join as join17, resolve as resolve3 } from "node:path";
|
|
21886
21971
|
function parseGithubRemote(url) {
|
|
21887
21972
|
const m = url.trim().match(GITHUB_URL_RE);
|
|
@@ -21906,12 +21991,12 @@ function gitConfigPathFor(dir) {
|
|
|
21906
21991
|
const st = statSync7(dotGit, { throwIfNoEntry: false });
|
|
21907
21992
|
if (!st) return null;
|
|
21908
21993
|
if (st.isDirectory()) return join17(dotGit, "config");
|
|
21909
|
-
const m =
|
|
21994
|
+
const m = readFileSync25(dotGit, "utf8").match(/^gitdir:\s*(.+)\s*$/m);
|
|
21910
21995
|
if (!m) return null;
|
|
21911
21996
|
const gd = isAbsolute2(m[1]) ? m[1] : resolve3(dir, m[1]);
|
|
21912
21997
|
const commondirFile = join17(gd, "commondir");
|
|
21913
|
-
if (
|
|
21914
|
-
const common =
|
|
21998
|
+
if (existsSync26(commondirFile)) {
|
|
21999
|
+
const common = readFileSync25(commondirFile, "utf8").trim();
|
|
21915
22000
|
return join17(isAbsolute2(common) ? common : resolve3(gd, common), "config");
|
|
21916
22001
|
}
|
|
21917
22002
|
return join17(gd, "config");
|
|
@@ -21926,8 +22011,8 @@ function createRepoResolver() {
|
|
|
21926
22011
|
try {
|
|
21927
22012
|
for (let d = dir; ; d = dirname16(d)) {
|
|
21928
22013
|
const config = gitConfigPathFor(d);
|
|
21929
|
-
if (config &&
|
|
21930
|
-
const url = originUrl2(
|
|
22014
|
+
if (config && existsSync26(config)) {
|
|
22015
|
+
const url = originUrl2(readFileSync25(config, "utf8"));
|
|
21931
22016
|
repo = url ? parseGithubRemote(url) : null;
|
|
21932
22017
|
break;
|
|
21933
22018
|
}
|
|
@@ -21949,7 +22034,7 @@ var init_git_remote = __esm({
|
|
|
21949
22034
|
});
|
|
21950
22035
|
|
|
21951
22036
|
// src/team/queue.ts
|
|
21952
|
-
import { readFileSync as
|
|
22037
|
+
import { readFileSync as readFileSync26, writeFileSync as writeFileSync15, appendFileSync as appendFileSync5, statSync as statSync8, mkdirSync as mkdirSync14 } from "node:fs";
|
|
21953
22038
|
import { dirname as dirname17 } from "node:path";
|
|
21954
22039
|
function enqueuePayload(payload, queuePath = QUEUE_PATH) {
|
|
21955
22040
|
mkdirSync14(dirname17(queuePath), { recursive: true });
|
|
@@ -21966,7 +22051,7 @@ function enqueuePayload(payload, queuePath = QUEUE_PATH) {
|
|
|
21966
22051
|
function dequeuePayloads(queuePath = QUEUE_PATH) {
|
|
21967
22052
|
let lines;
|
|
21968
22053
|
try {
|
|
21969
|
-
lines =
|
|
22054
|
+
lines = readFileSync26(queuePath, "utf8").trim().split("\n").filter(Boolean);
|
|
21970
22055
|
} catch {
|
|
21971
22056
|
return [];
|
|
21972
22057
|
}
|
|
@@ -21987,7 +22072,7 @@ function dequeuePayloads(queuePath = QUEUE_PATH) {
|
|
|
21987
22072
|
function pruneOldest(queuePath) {
|
|
21988
22073
|
let lines;
|
|
21989
22074
|
try {
|
|
21990
|
-
lines =
|
|
22075
|
+
lines = readFileSync26(queuePath, "utf8").trim().split("\n").filter(Boolean);
|
|
21991
22076
|
} catch {
|
|
21992
22077
|
return;
|
|
21993
22078
|
}
|
|
@@ -22006,7 +22091,7 @@ var init_queue2 = __esm({
|
|
|
22006
22091
|
});
|
|
22007
22092
|
|
|
22008
22093
|
// src/usage/profile.ts
|
|
22009
|
-
import { existsSync as
|
|
22094
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync15, readFileSync as readFileSync27, writeFileSync as writeFileSync16 } from "node:fs";
|
|
22010
22095
|
import { dirname as dirname18 } from "node:path";
|
|
22011
22096
|
function mapRateLimitTier(rateLimitTier) {
|
|
22012
22097
|
switch (rateLimitTier) {
|
|
@@ -22047,9 +22132,9 @@ async function fetchProfile(nowMs = Date.now()) {
|
|
|
22047
22132
|
};
|
|
22048
22133
|
}
|
|
22049
22134
|
function readCachedProfile(cachePath) {
|
|
22050
|
-
if (!
|
|
22135
|
+
if (!existsSync27(cachePath)) return null;
|
|
22051
22136
|
try {
|
|
22052
|
-
const raw = JSON.parse(
|
|
22137
|
+
const raw = JSON.parse(readFileSync27(cachePath, "utf8"));
|
|
22053
22138
|
if (typeof raw.fetchedAtMs !== "number" || !raw.profile) return null;
|
|
22054
22139
|
return raw;
|
|
22055
22140
|
} catch {
|
|
@@ -22238,11 +22323,11 @@ var init_backfill = __esm({
|
|
|
22238
22323
|
});
|
|
22239
22324
|
|
|
22240
22325
|
// src/team/sync-log.ts
|
|
22241
|
-
import { readFileSync as
|
|
22326
|
+
import { readFileSync as readFileSync28 } from "node:fs";
|
|
22242
22327
|
function readPendingSyncLog(watermark) {
|
|
22243
22328
|
let raw;
|
|
22244
22329
|
try {
|
|
22245
|
-
raw =
|
|
22330
|
+
raw = readFileSync28(cclensPath("daemon.log"), "utf8");
|
|
22246
22331
|
} catch {
|
|
22247
22332
|
return { lines: [] };
|
|
22248
22333
|
}
|
|
@@ -22306,7 +22391,7 @@ __export(file_probe_exports, {
|
|
|
22306
22391
|
probeArtifactSignals: () => probeArtifactSignals
|
|
22307
22392
|
});
|
|
22308
22393
|
import { createHash as createHash2 } from "node:crypto";
|
|
22309
|
-
import { existsSync as
|
|
22394
|
+
import { existsSync as existsSync28, readdirSync as readdirSync7, statSync as statSync9 } from "node:fs";
|
|
22310
22395
|
import { homedir as homedir10 } from "node:os";
|
|
22311
22396
|
import { join as join19, relative, resolve as resolve4, sep } from "node:path";
|
|
22312
22397
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
@@ -22316,19 +22401,19 @@ function pathHash(relPath) {
|
|
|
22316
22401
|
function defaultScanRoots(extraRoots = []) {
|
|
22317
22402
|
const roots = [];
|
|
22318
22403
|
const home = join19(homedir10(), ".claude");
|
|
22319
|
-
if (
|
|
22404
|
+
if (existsSync28(home)) roots.push({ root: home, label: "user" });
|
|
22320
22405
|
for (const e of extraRoots) {
|
|
22321
22406
|
const r = resolve4(e, ".claude");
|
|
22322
|
-
if (
|
|
22407
|
+
if (existsSync28(r) && r !== home) roots.push({ root: r, label: "project" });
|
|
22323
22408
|
}
|
|
22324
22409
|
return roots;
|
|
22325
22410
|
}
|
|
22326
22411
|
function listMarkdownFiles(dir) {
|
|
22327
|
-
if (!
|
|
22412
|
+
if (!existsSync28(dir)) return [];
|
|
22328
22413
|
const out = [];
|
|
22329
22414
|
let entries2;
|
|
22330
22415
|
try {
|
|
22331
|
-
entries2 =
|
|
22416
|
+
entries2 = readdirSync7(dir);
|
|
22332
22417
|
} catch {
|
|
22333
22418
|
return [];
|
|
22334
22419
|
}
|
|
@@ -22394,7 +22479,7 @@ function scanAuthored(roots, subdir, day2) {
|
|
|
22394
22479
|
const out = [];
|
|
22395
22480
|
for (const r of roots) {
|
|
22396
22481
|
const dir = join19(r.root, subdir);
|
|
22397
|
-
if (!
|
|
22482
|
+
if (!existsSync28(dir)) continue;
|
|
22398
22483
|
for (const f of listMarkdownFiles(dir)) {
|
|
22399
22484
|
const firstSeen = firstSeenDateOf(f);
|
|
22400
22485
|
if (firstSeen !== day2) continue;
|
|
@@ -22408,7 +22493,7 @@ function scanEdited(roots, day2) {
|
|
|
22408
22493
|
const out = [];
|
|
22409
22494
|
for (const r of roots) {
|
|
22410
22495
|
const dir = join19(r.root, "skills");
|
|
22411
|
-
if (!
|
|
22496
|
+
if (!existsSync28(dir)) continue;
|
|
22412
22497
|
for (const f of listMarkdownFiles(dir)) {
|
|
22413
22498
|
const firstSeen = firstSeenDateOf(f);
|
|
22414
22499
|
if (firstSeen === day2) continue;
|
|
@@ -22431,10 +22516,10 @@ function claudemdLineDelta(extraRoots, authorEmail, day2) {
|
|
|
22431
22516
|
const candidates = [];
|
|
22432
22517
|
for (const e of extraRoots) {
|
|
22433
22518
|
const f = resolve4(e, "CLAUDE.md");
|
|
22434
|
-
if (
|
|
22519
|
+
if (existsSync28(f)) candidates.push(f);
|
|
22435
22520
|
}
|
|
22436
22521
|
const homeClaudeMd = join19(homedir10(), "CLAUDE.md");
|
|
22437
|
-
if (
|
|
22522
|
+
if (existsSync28(homeClaudeMd)) candidates.push(homeClaudeMd);
|
|
22438
22523
|
for (const file of candidates) {
|
|
22439
22524
|
try {
|
|
22440
22525
|
const out = execFileSync3(
|
|
@@ -23324,11 +23409,11 @@ var logs_exports = {};
|
|
|
23324
23409
|
__export(logs_exports, {
|
|
23325
23410
|
teamLogs: () => teamLogs
|
|
23326
23411
|
});
|
|
23327
|
-
import { readFileSync as
|
|
23412
|
+
import { readFileSync as readFileSync29 } from "node:fs";
|
|
23328
23413
|
async function teamLogs() {
|
|
23329
23414
|
const logPath = cclensPath("daemon.log");
|
|
23330
23415
|
try {
|
|
23331
|
-
const lines =
|
|
23416
|
+
const lines = readFileSync29(logPath, "utf8").trim().split("\n");
|
|
23332
23417
|
const teamLines = lines.filter((l) => l.includes("[sync] ") || l.includes("team "));
|
|
23333
23418
|
if (teamLines.length === 0) {
|
|
23334
23419
|
console.log("No team-related log entries found.");
|
|
@@ -23456,7 +23541,7 @@ __export(runs_exports, {
|
|
|
23456
23541
|
runs: () => runs
|
|
23457
23542
|
});
|
|
23458
23543
|
import { execSync as execSync2 } from "node:child_process";
|
|
23459
|
-
import { existsSync as
|
|
23544
|
+
import { existsSync as existsSync29, readFileSync as readFileSync30, readdirSync as readdirSync8, statSync as statSync10 } from "node:fs";
|
|
23460
23545
|
import { join as join20 } from "node:path";
|
|
23461
23546
|
async function runs(args2) {
|
|
23462
23547
|
const json = args2.includes("--json");
|
|
@@ -23541,8 +23626,8 @@ function listActiveRuns() {
|
|
|
23541
23626
|
return runs2.sort((a, b) => a.elapsed_s - b.elapsed_s);
|
|
23542
23627
|
}
|
|
23543
23628
|
function readSpend(sinceMs) {
|
|
23544
|
-
if (!
|
|
23545
|
-
const lines =
|
|
23629
|
+
if (!existsSync29(SPEND_PATH)) return [];
|
|
23630
|
+
const lines = readFileSync30(SPEND_PATH, "utf-8").split("\n").filter((l) => l.trim());
|
|
23546
23631
|
const out = [];
|
|
23547
23632
|
for (const line of lines) {
|
|
23548
23633
|
try {
|
|
@@ -23663,23 +23748,23 @@ function ageLabel(ms) {
|
|
|
23663
23748
|
return `${Math.floor(ms / 864e5)}d`;
|
|
23664
23749
|
}
|
|
23665
23750
|
function listTraceFiles() {
|
|
23666
|
-
if (!
|
|
23667
|
-
const entries2 =
|
|
23751
|
+
if (!existsSync29(RUNS_DIR2)) return [];
|
|
23752
|
+
const entries2 = readdirSync8(RUNS_DIR2).filter((f) => f.endsWith(".jsonl"));
|
|
23668
23753
|
return entries2.map((f) => {
|
|
23669
|
-
const
|
|
23670
|
-
const st = statSync10(
|
|
23671
|
-
return { runId: f.replace(/\.jsonl$/, ""), path:
|
|
23754
|
+
const path13 = join20(RUNS_DIR2, f);
|
|
23755
|
+
const st = statSync10(path13);
|
|
23756
|
+
return { runId: f.replace(/\.jsonl$/, ""), path: path13, mtimeMs: st.mtimeMs };
|
|
23672
23757
|
}).sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
23673
23758
|
}
|
|
23674
23759
|
function resolveRunId(arg) {
|
|
23675
|
-
if (!
|
|
23760
|
+
if (!existsSync29(RUNS_DIR2)) return null;
|
|
23676
23761
|
if (arg === "latest") {
|
|
23677
23762
|
const all2 = listTraceFiles();
|
|
23678
23763
|
if (all2.length === 0) return null;
|
|
23679
23764
|
return { runId: all2[0].runId, path: all2[0].path };
|
|
23680
23765
|
}
|
|
23681
23766
|
const exact = join20(RUNS_DIR2, `${arg}.jsonl`);
|
|
23682
|
-
if (
|
|
23767
|
+
if (existsSync29(exact)) return { runId: arg, path: exact };
|
|
23683
23768
|
const all = listTraceFiles();
|
|
23684
23769
|
const matches = all.filter((r) => r.runId.includes(arg));
|
|
23685
23770
|
if (matches.length === 1) return { runId: matches[0].runId, path: matches[0].path };
|
|
@@ -23690,8 +23775,8 @@ function resolveRunId(arg) {
|
|
|
23690
23775
|
}
|
|
23691
23776
|
return null;
|
|
23692
23777
|
}
|
|
23693
|
-
function readTrace(
|
|
23694
|
-
return
|
|
23778
|
+
function readTrace(path13) {
|
|
23779
|
+
return readFileSync30(path13, "utf-8").split("\n").filter((l) => l.trim()).map((l) => {
|
|
23695
23780
|
try {
|
|
23696
23781
|
return JSON.parse(l);
|
|
23697
23782
|
} catch {
|
|
@@ -23703,7 +23788,7 @@ async function inspect(arg, follow, json) {
|
|
|
23703
23788
|
const r = resolveRunId(arg);
|
|
23704
23789
|
if (!r) {
|
|
23705
23790
|
console.error(`run not found: ${arg}`);
|
|
23706
|
-
if (
|
|
23791
|
+
if (existsSync29(RUNS_DIR2)) {
|
|
23707
23792
|
const all = listTraceFiles().slice(0, 5);
|
|
23708
23793
|
if (all.length > 0) {
|
|
23709
23794
|
console.error(`
|
|
@@ -23883,7 +23968,7 @@ async function main() {
|
|
|
23883
23968
|
case "version":
|
|
23884
23969
|
case "--version":
|
|
23885
23970
|
case "-v":
|
|
23886
|
-
console.log(`fleetlens ${"1.0.
|
|
23971
|
+
console.log(`fleetlens ${"1.0.22"}`);
|
|
23887
23972
|
break;
|
|
23888
23973
|
case "help":
|
|
23889
23974
|
case "--help":
|