fleetlens 1.0.13 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/app/apps/web/.next/BUILD_ID +1 -1
  2. package/app/apps/web/.next/build-manifest.json +3 -3
  3. package/app/apps/web/.next/prerender-manifest.json +3 -3
  4. package/app/apps/web/.next/server/app/_global-error.html +1 -1
  5. package/app/apps/web/.next/server/app/_global-error.rsc +1 -1
  6. package/app/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/app/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/app/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/app/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/app/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/app/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/app/apps/web/.next/server/app/agent/page_client-reference-manifest.js +1 -1
  13. package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  14. package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
  15. package/app/apps/web/.next/server/app/day/page_client-reference-manifest.js +1 -1
  16. package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
  17. package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
  18. package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
  19. package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
  20. package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  21. package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
  22. package/app/apps/web/.next/server/app/print/[key]/page_client-reference-manifest.js +1 -1
  23. package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  24. package/app/apps/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  25. package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  26. package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  27. package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  28. package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  29. package/app/apps/web/.next/server/app/team/onboarding/page_client-reference-manifest.js +1 -1
  30. package/app/apps/web/.next/server/app/team/page_client-reference-manifest.js +1 -1
  31. package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
  32. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02.51sr._.js +1 -1
  33. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0zyh554._.js +1 -1
  34. package/app/apps/web/.next/server/chunks/packages_parser_dist_06d9se1._.js +1 -1
  35. package/app/apps/web/.next/server/chunks/packages_parser_dist_10ihc3~._.js +1 -1
  36. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0s~wd1k._.js +1 -1
  37. package/app/apps/web/.next/server/chunks/ssr/_0k8yioi._.js +1 -1
  38. package/app/apps/web/.next/server/chunks/ssr/apps_web_0epqfet._.js +1 -1
  39. package/app/apps/web/.next/server/chunks/ssr/apps_web_components_0x014hn._.js +1 -1
  40. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0n7_p1d._.js +1 -1
  41. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0nb5_-s._.js +1 -1
  42. package/app/apps/web/.next/server/chunks/ssr/packages_parser_dist_0mx_509._.js +1 -1
  43. package/app/apps/web/.next/server/middleware-build-manifest.js +3 -3
  44. package/app/apps/web/.next/server/middleware-manifest.json +5 -5
  45. package/app/apps/web/.next/server/pages/500.html +1 -1
  46. package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
  47. package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
  48. package/app/apps/web/.next/static/chunks/00_9zw_tjem-o.js +14 -0
  49. package/app/apps/web/.next/static/chunks/{0r~~~j3kmv7s_.js → 08os0c_3cdpqn.js} +1 -1
  50. package/app/apps/web/.next/static/chunks/0f9bdjq4n1ykp.js +1 -0
  51. package/app/apps/web/app/usage/page.tsx +264 -1
  52. package/app/apps/web/lib/changelog-data.generated.ts +1 -1
  53. package/app/apps/web/lib/usage-data.ts +1 -1
  54. package/app/apps/web/lib/usage-display.test.ts +15 -0
  55. package/app/apps/web/lib/usage-display.ts +22 -3
  56. package/app/apps/web/package.json +1 -1
  57. package/app/apps/web/tsconfig.tsbuildinfo +1 -1
  58. package/dist/daemon-worker.js +358 -92
  59. package/dist/index.js +564 -155
  60. package/menubar/Fleetlens.app/Contents/Info.plist +2 -2
  61. package/menubar/Fleetlens.app/Contents/MacOS/FleetlensMenubar +0 -0
  62. package/menubar/Fleetlens.app/Contents/Resources/command-code.svg +4 -0
  63. package/menubar/Fleetlens.app/Contents/_CodeSignature/CodeResources +11 -0
  64. package/package.json +1 -1
  65. package/app/apps/web/.next/static/chunks/0lcq6isl3n79m.js +0 -1
  66. package/app/apps/web/.next/static/chunks/0livk1wjx5m4o.js +0 -14
  67. /package/app/apps/web/.next/static/{h9pB-Efqh5oayfi0_lGfY → FOCI6RnIt_wZ2j2ZEqW5_}/_buildManifest.js +0 -0
  68. /package/app/apps/web/.next/static/{h9pB-Efqh5oayfi0_lGfY → FOCI6RnIt_wZ2j2ZEqW5_}/_clientMiddlewareManifest.js +0 -0
  69. /package/app/apps/web/.next/static/{h9pB-Efqh5oayfi0_lGfY → FOCI6RnIt_wZ2j2ZEqW5_}/_ssgManifest.js +0 -0
package/dist/index.js CHANGED
@@ -675,7 +675,7 @@ function getAgentMetadata(kind) {
675
675
  function isAgentKind(s) {
676
676
  return typeof s === "string" && KNOWN_AGENT_KINDS.has(s);
677
677
  }
678
- var CLAUDE_CODE_METADATA, CODEX_METADATA, COPILOT_METADATA, GEMINI_METADATA, ANTIGRAVITY_METADATA, COWORK_METADATA, ZAI_METADATA, GROK_METADATA, agentMetadata, KNOWN_AGENT_KINDS;
678
+ var CLAUDE_CODE_METADATA, CODEX_METADATA, COPILOT_METADATA, GEMINI_METADATA, ANTIGRAVITY_METADATA, COWORK_METADATA, ZAI_METADATA, GROK_METADATA, COMMAND_CODE_METADATA, agentMetadata, KNOWN_AGENT_KINDS;
679
679
  var init_agent_metadata = __esm({
680
680
  "../parser/dist/agent-metadata.js"() {
681
681
  "use strict";
@@ -736,6 +736,14 @@ var init_agent_metadata = __esm({
736
736
  accentColor: "rgb(100, 116, 139)",
737
737
  iconChar: "\u25C8"
738
738
  };
739
+ COMMAND_CODE_METADATA = {
740
+ kind: "command-code",
741
+ displayName: "Command Code",
742
+ shortLabel: "Cmd",
743
+ // Lime — distinct from Codex teal and Claude terracotta.
744
+ accentColor: "rgb(132, 204, 22)",
745
+ iconChar: ">"
746
+ };
739
747
  agentMetadata = [
740
748
  CLAUDE_CODE_METADATA,
741
749
  CODEX_METADATA,
@@ -744,7 +752,8 @@ var init_agent_metadata = __esm({
744
752
  ANTIGRAVITY_METADATA,
745
753
  COWORK_METADATA,
746
754
  ZAI_METADATA,
747
- GROK_METADATA
755
+ GROK_METADATA,
756
+ COMMAND_CODE_METADATA
748
757
  ];
749
758
  KNOWN_AGENT_KINDS = new Set(agentMetadata.map((m) => m.kind));
750
759
  }
@@ -1601,11 +1610,11 @@ function defaultBranch(commonDir) {
1601
1610
  }
1602
1611
  return void 0;
1603
1612
  }
1604
- function readGitFolder(path11) {
1605
- if (!existsSync(path11))
1613
+ function readGitFolder(path12) {
1614
+ if (!existsSync(path12))
1606
1615
  return { exists: false, isWorktree: false };
1607
1616
  try {
1608
- const git = nearestDotGit(realpathOrSelf(path11));
1617
+ const git = nearestDotGit(realpathOrSelf(path12));
1609
1618
  if (!git)
1610
1619
  return { exists: true, isWorktree: false };
1611
1620
  const projectRoot = projectRootFromCommonDir(git.commonDir);
@@ -6298,9 +6307,9 @@ function onDiskVersion() {
6298
6307
  try {
6299
6308
  const here = dirname3(fileURLToPath(import.meta.url));
6300
6309
  const pkg = JSON.parse(readFileSync5(join3(here, "..", "package.json"), "utf8"));
6301
- return pkg.version ?? "1.0.13";
6310
+ return pkg.version ?? "1.0.14";
6302
6311
  } catch {
6303
- return "1.0.13";
6312
+ return "1.0.14";
6304
6313
  }
6305
6314
  }
6306
6315
  function getServerStatus() {
@@ -6312,7 +6321,7 @@ function getServerStatus() {
6312
6321
  return { running: false };
6313
6322
  }
6314
6323
  function isServerStale(status2) {
6315
- return status2.running === true && status2.version !== "1.0.13";
6324
+ return status2.running === true && status2.version !== "1.0.14";
6316
6325
  }
6317
6326
  async function ensureCurrentServer(opts = {}) {
6318
6327
  const status2 = getServerStatus();
@@ -6828,9 +6837,9 @@ Installed: ${PACKAGE_NAME}@${verify.installedVersion} at ${verify.installedPath
6828
6837
  console.warn(
6829
6838
  ` \u2022 reinstall in the correct Node env: 'npm install -g ${PACKAGE_NAME}@latest'`
6830
6839
  );
6831
- } else if (verify.installedVersion !== "1.0.13") {
6840
+ } else if (verify.installedVersion !== "1.0.14") {
6832
6841
  console.log(
6833
- ` \u2192 This process is still running ${"1.0.13"}. Next invocation will use ${verify.installedVersion}.`
6842
+ ` \u2192 This process is still running ${"1.0.14"}. Next invocation will use ${verify.installedVersion}.`
6834
6843
  );
6835
6844
  }
6836
6845
  }
@@ -6865,14 +6874,14 @@ async function getUpdateAvailability() {
6865
6874
  if (isDevMode()) return null;
6866
6875
  const latest = await fetchLatestVersion();
6867
6876
  if (latest === null) return {
6868
- current: "1.0.13",
6877
+ current: "1.0.14",
6869
6878
  latest: null,
6870
6879
  updateAvailable: false
6871
6880
  };
6872
6881
  return {
6873
- current: "1.0.13",
6882
+ current: "1.0.14",
6874
6883
  latest,
6875
- updateAvailable: shouldUpdate("1.0.13", latest)
6884
+ updateAvailable: shouldUpdate("1.0.14", latest)
6876
6885
  };
6877
6886
  }
6878
6887
  async function checkForUpdate() {
@@ -6962,7 +6971,7 @@ async function restartServices(state) {
6962
6971
  }
6963
6972
  async function forceUpdate() {
6964
6973
  const latest = await fetchLatestVersion();
6965
- const current = "1.0.13";
6974
+ const current = "1.0.14";
6966
6975
  if (latest === null) {
6967
6976
  console.error("Could not reach npm registry. Check your network.");
6968
6977
  process.exit(1);
@@ -7383,7 +7392,7 @@ async function status() {
7383
7392
  }
7384
7393
  if (isServerStale(server)) {
7385
7394
  console.log(
7386
- ` \u26A0 serving stale ${ver} (CLI is ${"1.0.13"}) \u2014 run 'fleetlens start' to restart on the current version`
7395
+ ` \u26A0 serving stale ${ver} (CLI is ${"1.0.14"}) \u2014 run 'fleetlens start' to restart on the current version`
7387
7396
  );
7388
7397
  }
7389
7398
  } else {
@@ -7422,7 +7431,7 @@ async function web(args2) {
7422
7431
  const open = args2.includes("--open");
7423
7432
  const positional = args2.filter((a) => !a.startsWith("--"));
7424
7433
  const rawPath = positional[0] ?? "";
7425
- const path11 = rawPath.startsWith("/") ? rawPath : rawPath ? `/${rawPath}` : "";
7434
+ const path12 = rawPath.startsWith("/") ? rawPath : rawPath ? `/${rawPath}` : "";
7426
7435
  let result;
7427
7436
  try {
7428
7437
  result = await ensureCurrentServer({});
@@ -7430,7 +7439,7 @@ async function web(args2) {
7430
7439
  console.error(`Failed to start: ${err.message}`);
7431
7440
  process.exit(1);
7432
7441
  }
7433
- const url = `http://localhost:${result.port}${path11}`;
7442
+ const url = `http://localhost:${result.port}${path12}`;
7434
7443
  if (result.restarted) {
7435
7444
  console.log(`fleetlens restarted on http://localhost:${result.port} (PID ${result.pid}) \u2014 replaced stale ${result.previousVersion ?? "unknown"} server`);
7436
7445
  }
@@ -7874,6 +7883,7 @@ __export(dist_exports, {
7874
7883
  ANTIGRAVITY_METADATA: () => ANTIGRAVITY_METADATA,
7875
7884
  CLAUDE_CODE_METADATA: () => CLAUDE_CODE_METADATA,
7876
7885
  CODEX_METADATA: () => CODEX_METADATA,
7886
+ COMMAND_CODE_METADATA: () => COMMAND_CODE_METADATA,
7877
7887
  COPILOT_METADATA: () => COPILOT_METADATA,
7878
7888
  COWORK_METADATA: () => COWORK_METADATA,
7879
7889
  GEMINI_METADATA: () => GEMINI_METADATA,
@@ -7983,9 +7993,9 @@ function readFromCredentialsFile() {
7983
7993
  join7(homedir4(), ".claude", ".credentials.json"),
7984
7994
  join7(homedir4(), ".config", "claude", "credentials.json")
7985
7995
  ];
7986
- for (const path11 of candidates) {
7996
+ for (const path12 of candidates) {
7987
7997
  try {
7988
- const blob = readFileSync10(path11, "utf8");
7998
+ const blob = readFileSync10(path12, "utf8");
7989
7999
  const creds = extractCredentials(blob);
7990
8000
  if (creds) return creds;
7991
8001
  } catch {
@@ -8929,6 +8939,332 @@ var init_zai = __esm({
8929
8939
  }
8930
8940
  });
8931
8941
 
8942
+ // src/usage/command-code.ts
8943
+ import { existsSync as existsSync12, readFileSync as readFileSync14 } from "node:fs";
8944
+ import os11 from "node:os";
8945
+ import path11 from "node:path";
8946
+ function commandCodeHome() {
8947
+ return process.env.COMMANDCODE_HOME || path11.join(os11.homedir(), ".commandcode");
8948
+ }
8949
+ function authPath3() {
8950
+ return path11.join(commandCodeHome(), "auth.json");
8951
+ }
8952
+ function loadCommandCodeApiKey() {
8953
+ const p = authPath3();
8954
+ if (!existsSync12(p)) {
8955
+ throw new CommandCodeApiError("Command Code not logged in. Run `cmd login`.", "no_auth");
8956
+ }
8957
+ let raw;
8958
+ try {
8959
+ raw = JSON.parse(readFileSync14(p, "utf8"));
8960
+ } catch {
8961
+ throw new CommandCodeApiError("Command Code auth.json is unreadable. Run `cmd login`.", "no_auth");
8962
+ }
8963
+ const key = typeof raw.apiKey === "string" ? raw.apiKey.trim() : "";
8964
+ if (!key) {
8965
+ throw new CommandCodeApiError("Command Code auth has no API key. Run `cmd login`.", "no_auth");
8966
+ }
8967
+ return key;
8968
+ }
8969
+ function apiBase() {
8970
+ const custom2 = process.env.COMMANDCODE_API_URL?.trim();
8971
+ return custom2 && custom2.length > 0 ? custom2.replace(/\/$/, "") : DEFAULT_API_BASE;
8972
+ }
8973
+ function authHeaders3(key) {
8974
+ return {
8975
+ Authorization: `Bearer ${key}`,
8976
+ Accept: "application/json",
8977
+ "User-Agent": "fleetlens"
8978
+ };
8979
+ }
8980
+ function normalizePlanKey(planId) {
8981
+ return planId.trim().toLowerCase().replace(/_/g, "-");
8982
+ }
8983
+ function matchPlanKey(planId) {
8984
+ const key = normalizePlanKey(planId);
8985
+ if (PLAN_NAMES[key] || PLAN_CREDITS[key] !== void 0) return key;
8986
+ return Object.keys(PLAN_NAMES).sort((a, b) => b.length - a.length).find((p) => key.startsWith(p)) ?? null;
8987
+ }
8988
+ function planLabelFromId(planId) {
8989
+ if (typeof planId !== "string" || !planId.trim()) return null;
8990
+ const key = matchPlanKey(planId);
8991
+ return key ? PLAN_NAMES[key] ?? planId.trim() : planId.trim();
8992
+ }
8993
+ function planMonthlyCredits(planId) {
8994
+ if (typeof planId !== "string" || !planId.trim()) return null;
8995
+ const key = matchPlanKey(planId);
8996
+ if (!key) return null;
8997
+ const n = PLAN_CREDITS[key];
8998
+ return typeof n === "number" ? n : null;
8999
+ }
9000
+ function asCredit(raw) {
9001
+ if (typeof raw !== "number" || !Number.isFinite(raw)) return null;
9002
+ return raw;
9003
+ }
9004
+ function roundCredits(n) {
9005
+ return Math.round(n * 100) / 100;
9006
+ }
9007
+ function isoFromUnknown(raw) {
9008
+ if (typeof raw !== "string" || !raw.trim()) return null;
9009
+ const ms = Date.parse(raw);
9010
+ return Number.isFinite(ms) ? new Date(ms).toISOString() : null;
9011
+ }
9012
+ function parseCommandCodeCredits(body) {
9013
+ if (!body || typeof body !== "object") {
9014
+ throw new CommandCodeApiError("Command Code credits response missing body", "parse");
9015
+ }
9016
+ const credits = body.credits;
9017
+ if (!credits || typeof credits !== "object") {
9018
+ throw new CommandCodeApiError("Command Code credits response missing credits", "parse");
9019
+ }
9020
+ const c = credits;
9021
+ return {
9022
+ remaining: asCredit(c.monthlyCredits),
9023
+ purchased: asCredit(c.purchasedCredits) ?? 0,
9024
+ free: asCredit(c.freeCredits) ?? 0,
9025
+ planId: typeof c.planId === "string" && c.planId.trim() ? c.planId.trim() : null
9026
+ };
9027
+ }
9028
+ function parseCommandCodeWindow(raw) {
9029
+ if (!raw || typeof raw !== "object") {
9030
+ return { utilization: null, resets_at: null };
9031
+ }
9032
+ const w = raw;
9033
+ const used = Number(w.used);
9034
+ const cap = Number(w.cap);
9035
+ let utilization = null;
9036
+ if (Number.isFinite(used) && Number.isFinite(cap) && cap > 0) {
9037
+ utilization = Math.min(100, Math.max(0, used / cap * 100));
9038
+ }
9039
+ let resets_at = null;
9040
+ const resetAt = Number(w.resetAt);
9041
+ if (Number.isFinite(resetAt) && resetAt > 0) {
9042
+ const iso = new Date(resetAt).toISOString();
9043
+ if (!Number.isNaN(Date.parse(iso))) resets_at = iso;
9044
+ }
9045
+ return { utilization, resets_at };
9046
+ }
9047
+ function parseCommandCodeWindows(body) {
9048
+ const empty = { utilization: null, resets_at: null };
9049
+ if (!body || typeof body !== "object") return { five_hour: empty, seven_day: empty };
9050
+ const limits = body.windowLimits;
9051
+ if (!limits || typeof limits !== "object") return { five_hour: empty, seven_day: empty };
9052
+ const l = limits;
9053
+ return {
9054
+ five_hour: parseCommandCodeWindow(l.fiveHour),
9055
+ seven_day: parseCommandCodeWindow(l.weekly)
9056
+ };
9057
+ }
9058
+ function parseCommandCodeSubscription(body) {
9059
+ if (!body || typeof body !== "object") {
9060
+ return { plan_type: null, planId: null, currentPeriodEnd: null };
9061
+ }
9062
+ const data = body.data;
9063
+ const planId = typeof data?.planId === "string" && data.planId.trim() ? data.planId.trim() : null;
9064
+ return {
9065
+ plan_type: planLabelFromId(planId),
9066
+ planId,
9067
+ currentPeriodEnd: isoFromUnknown(data?.currentPeriodEnd)
9068
+ };
9069
+ }
9070
+ function parseCommandCodeMonthly(opts) {
9071
+ const planId = opts.subscription.planId ?? opts.credits.planId;
9072
+ const limit = planMonthlyCredits(planId);
9073
+ const remaining = opts.credits.remaining;
9074
+ let used = null;
9075
+ let utilization = null;
9076
+ if (limit != null && limit > 0 && remaining != null) {
9077
+ used = roundCredits(Math.max(0, limit - remaining));
9078
+ utilization = Math.min(100, Math.max(0, used / limit * 100));
9079
+ }
9080
+ return {
9081
+ monthly: {
9082
+ utilization,
9083
+ resets_at: opts.subscription.currentPeriodEnd
9084
+ },
9085
+ monthly_quota: {
9086
+ used,
9087
+ limit,
9088
+ remaining: remaining == null ? null : roundCredits(Math.max(0, remaining)),
9089
+ unit: "credits",
9090
+ unlimited: false
9091
+ },
9092
+ plan_type: opts.subscription.plan_type ?? planLabelFromId(planId)
9093
+ };
9094
+ }
9095
+ async function fetchJson2(url, key) {
9096
+ let res;
9097
+ try {
9098
+ res = await fetch(url, { headers: authHeaders3(key) });
9099
+ } catch (err) {
9100
+ throw new CommandCodeApiError(
9101
+ `Network error reaching Command Code billing: ${err.message}`,
9102
+ "network"
9103
+ );
9104
+ }
9105
+ let body = null;
9106
+ try {
9107
+ body = await res.json();
9108
+ } catch {
9109
+ }
9110
+ return { status: res.status, body };
9111
+ }
9112
+ async function fetchCommandCodeUsage() {
9113
+ const key = loadCommandCodeApiKey();
9114
+ const base = apiBase();
9115
+ const creditsRes = await fetchJson2(`${base}${CREDITS_PATH}`, key);
9116
+ if (creditsRes.status === 401 || creditsRes.status === 403) {
9117
+ throw new CommandCodeApiError(
9118
+ `Command Code credits returned HTTP ${creditsRes.status}`,
9119
+ "no_auth"
9120
+ );
9121
+ }
9122
+ if (creditsRes.status < 200 || creditsRes.status >= 300) {
9123
+ throw new CommandCodeApiError(
9124
+ `Command Code credits returned HTTP ${creditsRes.status}`,
9125
+ "http"
9126
+ );
9127
+ }
9128
+ const credits = parseCommandCodeCredits(creditsRes.body);
9129
+ const windows = parseCommandCodeWindows(creditsRes.body);
9130
+ let subscription = parseCommandCodeSubscription(null);
9131
+ try {
9132
+ const subRes = await fetchJson2(`${base}${SUBSCRIPTIONS_PATH}`, key);
9133
+ if (subRes.status >= 200 && subRes.status < 300) {
9134
+ subscription = parseCommandCodeSubscription(subRes.body);
9135
+ }
9136
+ } catch {
9137
+ }
9138
+ const monthly = parseCommandCodeMonthly({ credits, subscription });
9139
+ return {
9140
+ captured_at: (/* @__PURE__ */ new Date()).toISOString(),
9141
+ agent: "command-code",
9142
+ five_hour: windows.five_hour,
9143
+ seven_day: windows.seven_day,
9144
+ monthly: monthly.monthly,
9145
+ monthly_quota: monthly.monthly_quota,
9146
+ seven_day_opus: null,
9147
+ seven_day_sonnet: null,
9148
+ seven_day_oauth_apps: null,
9149
+ seven_day_cowork: null,
9150
+ extra_usage: null,
9151
+ plan_type: monthly.plan_type
9152
+ };
9153
+ }
9154
+ var DEFAULT_API_BASE, CREDITS_PATH, SUBSCRIPTIONS_PATH, PLAN_NAMES, PLAN_CREDITS, CommandCodeApiError;
9155
+ var init_command_code = __esm({
9156
+ "src/usage/command-code.ts"() {
9157
+ "use strict";
9158
+ DEFAULT_API_BASE = "https://api.commandcode.ai";
9159
+ CREDITS_PATH = "/alpha/billing/credits";
9160
+ SUBSCRIPTIONS_PATH = "/alpha/billing/subscriptions";
9161
+ PLAN_NAMES = {
9162
+ "individual-go": "Go",
9163
+ "individual-goat": "GOAT",
9164
+ "individual-pro": "Pro",
9165
+ "individual-pro-v1": "Pro",
9166
+ "individual-provider": "Provider",
9167
+ "individual-max": "Max",
9168
+ "individual-ultra": "Ultra",
9169
+ "teams-pro": "Teams Pro"
9170
+ };
9171
+ PLAN_CREDITS = {
9172
+ "individual-go": 10,
9173
+ "individual-goat": 70,
9174
+ "individual-pro": 30,
9175
+ "individual-pro-v1": 80,
9176
+ "individual-provider": 15,
9177
+ "individual-max": 150,
9178
+ "individual-ultra": 300,
9179
+ "teams-pro": 40
9180
+ };
9181
+ CommandCodeApiError = class extends Error {
9182
+ constructor(message, code) {
9183
+ super(message);
9184
+ this.code = code;
9185
+ }
9186
+ };
9187
+ }
9188
+ });
9189
+
9190
+ // src/usage/pace.ts
9191
+ function round1(n) {
9192
+ return Math.round(n * 10) / 10;
9193
+ }
9194
+ function paceVerdict(deltaPp) {
9195
+ if (deltaPp < -PACE_BAND_PP) return "fast";
9196
+ if (deltaPp > PACE_BAND_PP) return "slow";
9197
+ return "on_track";
9198
+ }
9199
+ function monthlyWindowMs(resetsAt) {
9200
+ const start2 = addUtcMonths(resetsAt, -1);
9201
+ return Math.max(HOUR_MS2, resetsAt.getTime() - start2.getTime());
9202
+ }
9203
+ function addUtcMonths(date, months) {
9204
+ const y = date.getUTCFullYear();
9205
+ const m = date.getUTCMonth() + months;
9206
+ const targetMonth = (m % 12 + 12) % 12;
9207
+ const targetYear = y + Math.floor(m / 12);
9208
+ const day2 = date.getUTCDate();
9209
+ const lastDay = new Date(Date.UTC(targetYear, targetMonth + 1, 0)).getUTCDate();
9210
+ return new Date(
9211
+ Date.UTC(
9212
+ targetYear,
9213
+ targetMonth,
9214
+ Math.min(day2, lastDay),
9215
+ date.getUTCHours(),
9216
+ date.getUTCMinutes(),
9217
+ date.getUTCSeconds(),
9218
+ date.getUTCMilliseconds()
9219
+ )
9220
+ );
9221
+ }
9222
+ function windowPace(opts) {
9223
+ const { usedPct, resetsAtMs, windowMs } = opts;
9224
+ if (!Number.isFinite(usedPct) || !Number.isFinite(resetsAtMs) || !Number.isFinite(windowMs) || windowMs <= 0) {
9225
+ return null;
9226
+ }
9227
+ const nowMs = opts.nowMs ?? Date.now();
9228
+ const startMs = resetsAtMs - windowMs;
9229
+ const elapsedPct = Math.max(0, Math.min(100, (nowMs - startMs) / windowMs * 100));
9230
+ const used = Math.max(0, Math.min(100, usedPct));
9231
+ const deltaPp = round1(elapsedPct - used);
9232
+ return {
9233
+ used_pct: round1(used),
9234
+ elapsed_pct: round1(elapsedPct),
9235
+ delta_pp: deltaPp,
9236
+ verdict: paceVerdict(deltaPp)
9237
+ };
9238
+ }
9239
+ function paceForWindow(window, kind, nowMs) {
9240
+ if (!window || window.utilization === null || !window.resets_at) return null;
9241
+ const resetsAtMs = Date.parse(window.resets_at);
9242
+ if (!Number.isFinite(resetsAtMs)) return null;
9243
+ const windowMs = kind === "monthly" ? monthlyWindowMs(new Date(resetsAtMs)) : SEVEN_DAYS_MS;
9244
+ return windowPace({
9245
+ usedPct: window.utilization,
9246
+ resetsAtMs,
9247
+ windowMs,
9248
+ nowMs
9249
+ });
9250
+ }
9251
+ function paceForSnapshot(snapshot, nowMs) {
9252
+ const seven_day = paceForWindow(snapshot.seven_day, "seven_day", nowMs) ?? void 0;
9253
+ const monthly = paceForWindow(snapshot.monthly, "monthly", nowMs) ?? void 0;
9254
+ if (!seven_day && !monthly) return void 0;
9255
+ return { ...seven_day ? { seven_day } : {}, ...monthly ? { monthly } : {} };
9256
+ }
9257
+ var PACE_BAND_PP, SEVEN_DAYS_MS, HOUR_MS2, PACE_LEGEND;
9258
+ var init_pace = __esm({
9259
+ "src/usage/pace.ts"() {
9260
+ "use strict";
9261
+ PACE_BAND_PP = 15;
9262
+ SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
9263
+ HOUR_MS2 = 60 * 60 * 1e3;
9264
+ PACE_LEGEND = "pace.delta_pp=elapsed_pct-used_pct of 7d/30d (+slow quota-expires / -fast may-exhaust; |delta_pp|<=15 on_track)";
9265
+ }
9266
+ });
9267
+
8932
9268
  // src/usage/format.ts
8933
9269
  function barWidthFor(columns, labelWidth) {
8934
9270
  return Math.max(4, columns - labelWidth - 12);
@@ -9003,10 +9339,15 @@ function formatAgentBlock(kind, snapshot, layout) {
9003
9339
  const plan = snapshot.plan_type && layout.mode !== "narrow" ? ` ${DIM}${snapshot.plan_type}${RESET}` : "";
9004
9340
  lines.push(` ${BOLD}${title}${RESET}${plan}`);
9005
9341
  let renderedMeter = false;
9006
- for (const [label, window] of agentWindows(kind, snapshot, layout.shortLabels)) {
9007
- if (!window || window.utilization === null) continue;
9342
+ for (const meter of agentWindows(kind, snapshot, layout.shortLabels)) {
9343
+ if (!meter.window || meter.window.utilization === null) continue;
9008
9344
  renderedMeter = true;
9009
- lines.push(...formatMeterRow(label, window.utilization, window.resets_at, layout));
9345
+ const pace = meter.paceKind ? paceForWindow(meter.window, meter.paceKind) : null;
9346
+ lines.push(
9347
+ ...formatMeterRow(meter.label, meter.window.utilization, meter.window.resets_at, layout, {
9348
+ pace
9349
+ })
9350
+ );
9010
9351
  }
9011
9352
  if ((kind === "claude-code" || !kind) && snapshot.extra_usage?.is_enabled) {
9012
9353
  renderedMeter = true;
@@ -9030,9 +9371,9 @@ function formatAgentBlock(kind, snapshot, layout) {
9030
9371
  lines.push(...formatMeterRow(label, used, null, layout, { wholePct: true }));
9031
9372
  }
9032
9373
  }
9033
- if (kind === "copilot" && snapshot.monthly_quota) {
9374
+ if ((kind === "copilot" || kind === "command-code") && snapshot.monthly_quota) {
9034
9375
  const q = snapshot.monthly_quota;
9035
- const unit = q.unit === "premium-requests" ? "premium requests" : "AI credits";
9376
+ const unit = q.unit === "premium-requests" ? "premium requests" : q.unit === "credits" ? "credits" : "AI credits";
9036
9377
  const pad2 = layout.mode === "narrow" ? 2 : layout.labelWidth + 2;
9037
9378
  if (q.unlimited) {
9038
9379
  renderedMeter = true;
@@ -9061,19 +9402,40 @@ function formatAgentBlock(kind, snapshot, layout) {
9061
9402
  function formatMeterRow(label, utilization, resetsAt, layout, opts = {}) {
9062
9403
  const pctStr = opts.wholePct ? `${utilization.toFixed(0)}%`.padStart(5) : `${utilization.toFixed(1)}%`.padStart(6);
9063
9404
  const labelStr = label.padEnd(layout.labelWidth);
9405
+ const pace = opts.pace ?? null;
9064
9406
  if (layout.mode === "narrow" && layout.barWidth <= 0) {
9065
9407
  const reset = resetsAt ? ` ${DIM}r${formatRelativeShort(resetsAt)}${RESET}` : "";
9066
- return [` ${labelStr}${BOLD}${pctStr}${RESET}${reset}`];
9408
+ const paceBit = pace ? ` ${paceColor(pace.verdict)}${formatPace(pace, layout)}${RESET}` : "";
9409
+ return [` ${labelStr}${BOLD}${pctStr}${RESET}${reset}${paceBit}`];
9067
9410
  }
9068
9411
  const bar = renderBar(utilization, layout.barWidth);
9069
9412
  const lines = [` ${labelStr}${bar} ${BOLD}${pctStr}${RESET} `];
9070
9413
  if (resetsAt) {
9414
+ const paceBit = pace ? `${DIM} \xB7 ${RESET}${paceColor(pace.verdict)}${formatPace(pace, layout)}${RESET}` : "";
9071
9415
  lines.push(
9072
- ` ${" ".repeat(layout.labelWidth)}${DIM}resets ${formatRelative(resetsAt)}${RESET}`
9416
+ ` ${" ".repeat(layout.labelWidth)}${DIM}resets ${formatRelative(resetsAt)}${RESET}${paceBit}`
9073
9417
  );
9074
9418
  }
9075
9419
  return lines;
9076
9420
  }
9421
+ function paceColor(verdict) {
9422
+ if (verdict === "fast") return RED;
9423
+ if (verdict === "slow") return YELLOW;
9424
+ return GREEN;
9425
+ }
9426
+ function formatPace(pace, layout) {
9427
+ const n = Math.round(pace.delta_pp);
9428
+ const signed = n > 0 ? `+${n}pp` : `${n}pp`;
9429
+ if (layout.mode === "narrow") {
9430
+ if (pace.verdict === "slow") return `slow${n > 0 ? `+${n}` : String(n)}`;
9431
+ if (pace.verdict === "fast") return `fast${n > 0 ? `+${n}` : String(n)}`;
9432
+ return `ok${n > 0 ? `+${n}` : String(n)}`;
9433
+ }
9434
+ const vsEven = layout.mode === "wide" ? " vs even" : "";
9435
+ if (pace.verdict === "slow") return `slow ${signed}${vsEven}`;
9436
+ if (pace.verdict === "fast") return `fast ${signed}${vsEven}`;
9437
+ return `on track ${signed}${vsEven}`;
9438
+ }
9077
9439
  function agentWindows(kind, snapshot, shortLabels) {
9078
9440
  const L = shortLabels ? { five: "5h", seven: "7d", monthly: "mo", opus: "opus", sonnet: "son", oauth: "oath", cowork: "cowk" } : {
9079
9441
  five: "5 hour",
@@ -9085,30 +9447,41 @@ function agentWindows(kind, snapshot, shortLabels) {
9085
9447
  cowork: "7 day (Cowork)"
9086
9448
  };
9087
9449
  if (kind === "copilot") {
9088
- return [[L.monthly, snapshot.monthly]];
9450
+ return [{ label: L.monthly, window: snapshot.monthly, paceKind: "monthly" }];
9451
+ }
9452
+ if (kind === "command-code") {
9453
+ return [
9454
+ { label: L.five, window: snapshot.five_hour },
9455
+ {
9456
+ label: shortLabels ? "wk" : "weekly",
9457
+ window: snapshot.seven_day,
9458
+ paceKind: "seven_day"
9459
+ },
9460
+ { label: L.monthly, window: snapshot.monthly, paceKind: "monthly" }
9461
+ ];
9089
9462
  }
9090
9463
  if (kind === "grok") {
9091
- return [[L.seven, snapshot.seven_day]];
9464
+ return [{ label: L.seven, window: snapshot.seven_day, paceKind: "seven_day" }];
9092
9465
  }
9093
9466
  if (kind === "codex" && snapshot.five_hour?.utilization == null) {
9094
- return [[L.seven, snapshot.seven_day]];
9467
+ return [{ label: L.seven, window: snapshot.seven_day, paceKind: "seven_day" }];
9095
9468
  }
9096
9469
  const rows = [
9097
- [L.five, snapshot.five_hour],
9098
- [L.seven, snapshot.seven_day]
9470
+ { label: L.five, window: snapshot.five_hour },
9471
+ { label: L.seven, window: snapshot.seven_day, paceKind: "seven_day" }
9099
9472
  ];
9100
9473
  if (kind === "claude-code" || !snapshot.agent) {
9101
9474
  if (snapshot.seven_day_opus?.utilization != null) {
9102
- rows.push([L.opus, snapshot.seven_day_opus]);
9475
+ rows.push({ label: L.opus, window: snapshot.seven_day_opus, paceKind: "seven_day" });
9103
9476
  }
9104
9477
  if (snapshot.seven_day_sonnet?.utilization != null) {
9105
- rows.push([L.sonnet, snapshot.seven_day_sonnet]);
9478
+ rows.push({ label: L.sonnet, window: snapshot.seven_day_sonnet, paceKind: "seven_day" });
9106
9479
  }
9107
9480
  if (snapshot.seven_day_oauth_apps?.utilization != null) {
9108
- rows.push([L.oauth, snapshot.seven_day_oauth_apps]);
9481
+ rows.push({ label: L.oauth, window: snapshot.seven_day_oauth_apps, paceKind: "seven_day" });
9109
9482
  }
9110
9483
  if (snapshot.seven_day_cowork?.utilization != null) {
9111
- rows.push([L.cowork, snapshot.seven_day_cowork]);
9484
+ rows.push({ label: L.cowork, window: snapshot.seven_day_cowork, paceKind: "seven_day" });
9112
9485
  }
9113
9486
  }
9114
9487
  return rows;
@@ -9179,6 +9552,7 @@ var init_format = __esm({
9179
9552
  "src/usage/format.ts"() {
9180
9553
  "use strict";
9181
9554
  init_dist();
9555
+ init_pace();
9182
9556
  DIM = "\x1B[2m";
9183
9557
  BOLD = "\x1B[1m";
9184
9558
  RESET = "\x1B[0m";
@@ -9186,7 +9560,7 @@ var init_format = __esm({
9186
9560
  YELLOW = "\x1B[33m";
9187
9561
  RED = "\x1B[31m";
9188
9562
  EIGHTHS = ["", "\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589"];
9189
- AGENT_PRIORITY = ["claude-code", "codex", "copilot", "zai", "grok"];
9563
+ AGENT_PRIORITY = ["claude-code", "codex", "copilot", "zai", "grok", "command-code"];
9190
9564
  }
9191
9565
  });
9192
9566
 
@@ -9493,6 +9867,14 @@ async function saveAuxiliarySnapshots() {
9493
9867
  console.warn(`zai usage: ${err.message}`);
9494
9868
  }
9495
9869
  }
9870
+ try {
9871
+ appendSnapshot(USAGE_LOG2, await fetchCommandCodeUsage());
9872
+ saved += 1;
9873
+ } catch (err) {
9874
+ if (!(err instanceof CommandCodeApiError) || err.code !== "no_auth") {
9875
+ console.warn(`command-code usage: ${err.message}`);
9876
+ }
9877
+ }
9496
9878
  return saved;
9497
9879
  }
9498
9880
  function parseAgentFilter(args2) {
@@ -9506,7 +9888,10 @@ function parseAgentFilter(args2) {
9506
9888
  copilot: "copilot",
9507
9889
  zai: "zai",
9508
9890
  "z.ai": "zai",
9509
- grok: "grok"
9891
+ grok: "grok",
9892
+ "command-code": "command-code",
9893
+ commandcode: "command-code",
9894
+ cmd: "command-code"
9510
9895
  };
9511
9896
  return aliases[kind] ?? kind;
9512
9897
  }
@@ -9537,12 +9922,14 @@ async function collectSnapshots(opts) {
9537
9922
  }
9538
9923
  return { byAgent, saved };
9539
9924
  }
9540
- function usageJsonPayload(byAgent) {
9925
+ function usageJsonPayload(byAgent, opts) {
9541
9926
  const keys = Object.keys(byAgent).sort(compareAgentKeys);
9542
9927
  return {
9928
+ legend: PACE_LEGEND,
9543
9929
  agents: keys.map((k) => {
9544
9930
  const s = byAgent[k];
9545
- return { ...s, agent: s.agent ?? k };
9931
+ const pace = paceForSnapshot(s, opts?.nowMs);
9932
+ return { ...s, agent: s.agent ?? k, ...pace ? { pace } : {} };
9546
9933
  })
9547
9934
  };
9548
9935
  }
@@ -9575,15 +9962,16 @@ function omitNulls(value) {
9575
9962
  return value;
9576
9963
  }
9577
9964
  function shortAgentId(agent) {
9578
- return agent === "claude-code" ? "claude" : agent;
9965
+ if (agent === "claude-code") return "claude";
9966
+ if (agent === "command-code") return "cmd";
9967
+ return agent;
9579
9968
  }
9580
9969
  function shortIso(iso) {
9581
9970
  const m = iso.match(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})/);
9582
9971
  return m ? m[1] : iso.slice(0, 16);
9583
9972
  }
9584
- function usageCompactText(byAgent) {
9585
- const agents = usageJsonPayload(byAgent).agents;
9586
- const cell = (v) => v === null || v === void 0 ? "-" : String(v);
9973
+ function usageCompactText(byAgent, opts) {
9974
+ const agents = usageJsonPayload(byAgent, opts).agents;
9587
9975
  const rows = agents.map((a) => {
9588
9976
  const id = shortAgentId(a.agent);
9589
9977
  const fh = a.five_hour?.utilization;
@@ -9591,14 +9979,33 @@ function usageCompactText(byAgent) {
9591
9979
  const mo = a.monthly?.utilization;
9592
9980
  const plan = (a.plan_type ?? "-").replace(/\s+/g, "_");
9593
9981
  const at = a.captured_at ? shortIso(a.captured_at) : "-";
9594
- return `${id},${cell(fh)},${cell(sd)},${cell(mo)},${plan},${at}`;
9982
+ return [
9983
+ id,
9984
+ cellPct(fh),
9985
+ cellPct(sd),
9986
+ cellPct(mo),
9987
+ cellPace(a.pace?.seven_day),
9988
+ cellPace(a.pace?.monthly),
9989
+ plan,
9990
+ at
9991
+ ].join(",");
9595
9992
  });
9596
- const legend = "# % of plan quota used \u2191busier | 5h/7d/mo windows | -=n/a";
9993
+ const legend = "# % of plan quota used \u2191busier | 5h/7d/mo | 7d_pace/mo_pace=elapsed%-used% (+slow/-fast; |15|=on_track) | -=n/a";
9597
9994
  return `${legend}
9598
- agents[${rows.length}]{agent,5h,7d,mo,plan,sampled}:
9995
+ agents[${rows.length}]{agent,5h,7d,mo,7d_pace,mo_pace,plan,sampled}:
9599
9996
  ${rows.join("\n")}
9600
9997
  `;
9601
9998
  }
9999
+ function cellPct(v) {
10000
+ if (v === null || v === void 0) return "-";
10001
+ const r = Math.round(v * 10) / 10;
10002
+ return Number.isInteger(r) ? String(r) : r.toFixed(1);
10003
+ }
10004
+ function cellPace(p) {
10005
+ if (!p) return "-";
10006
+ const n = Math.round(p.delta_pp);
10007
+ return n > 0 ? `+${n}` : String(n);
10008
+ }
9602
10009
  function emitJson(payload) {
9603
10010
  process.stdout.write(JSON.stringify(omitNulls(payload)) + "\n");
9604
10011
  }
@@ -9623,7 +10030,7 @@ Usage:
9623
10030
 
9624
10031
  --compact Ultra-dense columnar text (recommended for agents / LLM context)
9625
10032
  --json Machine JSON (minified, nulls stripped; exclusive with --watch/--compact)
9626
- --agent / -a Filter to one provider (claude | codex | copilot | zai | grok)
10033
+ --agent / -a Filter to one provider (claude | codex | copilot | zai | grok | cmd)
9627
10034
 
9628
10035
  Watch options:
9629
10036
  --interval N Redraw every N seconds (default 2; reads ~/.cclens/usage.jsonl)
@@ -9644,7 +10051,7 @@ stays fresh without hammering provider APIs.`);
9644
10051
  const machineMode = json ? "json" : compact ? "compact" : "text";
9645
10052
  const agentFilter = parseAgentFilter(args2);
9646
10053
  if (agentFilter && !isAgentKind(agentFilter)) {
9647
- const msg = `unknown agent "${agentFilter}". Use claude, codex, copilot, zai, or grok.`;
10054
+ const msg = `unknown agent "${agentFilter}". Use claude, codex, copilot, zai, grok, or cmd.`;
9648
10055
  emitMachineError(machineMode, msg);
9649
10056
  process.exitCode = 1;
9650
10057
  return;
@@ -9790,10 +10197,12 @@ var init_usage = __esm({
9790
10197
  init_codex2();
9791
10198
  init_copilot2();
9792
10199
  init_zai();
10200
+ init_command_code();
9793
10201
  init_format();
10202
+ init_pace();
9794
10203
  init_storage();
9795
10204
  USAGE_LOG2 = cclensPath("usage.jsonl");
9796
- JSON_AGENT_ORDER = ["claude-code", "codex", "copilot", "zai", "grok"];
10205
+ JSON_AGENT_ORDER = ["claude-code", "codex", "copilot", "zai", "grok", "command-code"];
9797
10206
  }
9798
10207
  });
9799
10208
 
@@ -10643,11 +11052,11 @@ var init_dist2 = __esm({
10643
11052
  });
10644
11053
 
10645
11054
  // ../entries/dist/digest-fs.js
10646
- import { readFileSync as readFileSync14, readdirSync, writeFileSync as writeFileSync7, renameSync as renameSync2, chmodSync, mkdirSync as mkdirSync6, existsSync as existsSync12 } from "node:fs";
11055
+ import { readFileSync as readFileSync15, readdirSync, writeFileSync as writeFileSync7, renameSync as renameSync2, chmodSync, mkdirSync as mkdirSync6, existsSync as existsSync13 } from "node:fs";
10647
11056
  import { dirname as dirname9, join as join9 } from "node:path";
10648
- function parseDigestFile(path11, expectedVersion) {
11057
+ function parseDigestFile(path12, expectedVersion) {
10649
11058
  try {
10650
- const parsed = JSON.parse(readFileSync14(path11, "utf8"));
11059
+ const parsed = JSON.parse(readFileSync15(path12, "utf8"));
10651
11060
  if (!parsed || typeof parsed !== "object")
10652
11061
  return null;
10653
11062
  if (parsed.version !== expectedVersion)
@@ -10666,11 +11075,11 @@ function digestsDir() {
10666
11075
  digestsDirCached = envOverride ?? cclensPath("digests");
10667
11076
  return digestsDirCached;
10668
11077
  }
10669
- function __setDigestsDirForTest(path11) {
10670
- digestsDirCached = path11;
10671
- mkdirSync6(join9(path11, "day"), { recursive: true });
10672
- mkdirSync6(join9(path11, "week"), { recursive: true });
10673
- mkdirSync6(join9(path11, "month"), { recursive: true });
11078
+ function __setDigestsDirForTest(path12) {
11079
+ digestsDirCached = path12;
11080
+ mkdirSync6(join9(path12, "day"), { recursive: true });
11081
+ mkdirSync6(join9(path12, "week"), { recursive: true });
11082
+ mkdirSync6(join9(path12, "month"), { recursive: true });
10674
11083
  }
10675
11084
  function dayDigestPath(date) {
10676
11085
  return join9(digestsDir(), "day", `${date}.json`);
@@ -10696,7 +11105,7 @@ function writeDayDigest(digest2) {
10696
11105
  }
10697
11106
  function readDayDigest(date) {
10698
11107
  const p = dayDigestPath(date);
10699
- if (!existsSync12(p))
11108
+ if (!existsSync13(p))
10700
11109
  return null;
10701
11110
  return parseDigestFile(p, CURRENT_DAY_DIGEST_SCHEMA_VERSION);
10702
11111
  }
@@ -10732,13 +11141,13 @@ function writeWeekDigest(digest2) {
10732
11141
  }
10733
11142
  function readWeekDigest(monday) {
10734
11143
  const p = weekDigestPath(monday);
10735
- if (!existsSync12(p))
11144
+ if (!existsSync13(p))
10736
11145
  return null;
10737
11146
  return parseDigestFile(p, CURRENT_WEEK_DIGEST_SCHEMA_VERSION);
10738
11147
  }
10739
11148
  function listWeekDigestKeys() {
10740
11149
  const dir = join9(digestsDir(), "week");
10741
- if (!existsSync12(dir))
11150
+ if (!existsSync13(dir))
10742
11151
  return [];
10743
11152
  return readdirSync(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length)).filter((k) => /^\d{4}-\d{2}-\d{2}$/.test(k));
10744
11153
  }
@@ -10769,13 +11178,13 @@ function writeMonthDigest(digest2) {
10769
11178
  }
10770
11179
  function readMonthDigest(yearMonth) {
10771
11180
  const p = monthDigestPath(yearMonth);
10772
- if (!existsSync12(p))
11181
+ if (!existsSync13(p))
10773
11182
  return null;
10774
11183
  return parseDigestFile(p, CURRENT_MONTH_DIGEST_SCHEMA_VERSION);
10775
11184
  }
10776
11185
  function listMonthDigestKeys() {
10777
11186
  const dir = join9(digestsDir(), "month");
10778
- if (!existsSync12(dir))
11187
+ if (!existsSync13(dir))
10779
11188
  return [];
10780
11189
  return readdirSync(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length)).filter((k) => /^\d{4}-\d{2}$/.test(k));
10781
11190
  }
@@ -10837,7 +11246,7 @@ __export(fs_exports2, {
10837
11246
  writeMonthDigest: () => writeMonthDigest,
10838
11247
  writeWeekDigest: () => writeWeekDigest
10839
11248
  });
10840
- import { readFileSync as readFileSync15, readdirSync as readdirSync2, writeFileSync as writeFileSync8, mkdirSync as mkdirSync7, renameSync as renameSync3, existsSync as existsSync13 } from "node:fs";
11249
+ import { readFileSync as readFileSync16, readdirSync as readdirSync2, writeFileSync as writeFileSync8, mkdirSync as mkdirSync7, renameSync as renameSync3, existsSync as existsSync14 } from "node:fs";
10841
11250
  import { randomBytes } from "node:crypto";
10842
11251
  import { join as join10 } from "node:path";
10843
11252
  function entriesDir() {
@@ -10847,9 +11256,9 @@ function entriesDir() {
10847
11256
  entriesDirCached = envOverride ?? cclensPath("entries");
10848
11257
  return entriesDirCached;
10849
11258
  }
10850
- function __setEntriesDirForTest(path11) {
10851
- entriesDirCached = path11;
10852
- mkdirSync7(path11, { recursive: true });
11259
+ function __setEntriesDirForTest(path12) {
11260
+ entriesDirCached = path12;
11261
+ mkdirSync7(path12, { recursive: true });
10853
11262
  }
10854
11263
  function pathFor(sessionId, localDay2) {
10855
11264
  return join10(entriesDir(), `${entryKey(sessionId, localDay2)}.json`);
@@ -10896,17 +11305,17 @@ function writeEntryPreservingEnrichment(fresh) {
10896
11305
  }
10897
11306
  function readEntry(sessionId, localDay2) {
10898
11307
  const p = pathFor(sessionId, localDay2);
10899
- if (!existsSync13(p))
11308
+ if (!existsSync14(p))
10900
11309
  return null;
10901
- const raw = readFileSync15(p, "utf8");
11310
+ const raw = readFileSync16(p, "utf8");
10902
11311
  return JSON.parse(raw);
10903
11312
  }
10904
11313
  function entryExists(sessionId, localDay2) {
10905
- return existsSync13(pathFor(sessionId, localDay2));
11314
+ return existsSync14(pathFor(sessionId, localDay2));
10906
11315
  }
10907
11316
  function listEntryKeys() {
10908
11317
  const dir = entriesDir();
10909
- if (!existsSync13(dir))
11318
+ if (!existsSync14(dir))
10910
11319
  return [];
10911
11320
  return readdirSync2(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length));
10912
11321
  }
@@ -11377,8 +11786,8 @@ var init_parseUtil = __esm({
11377
11786
  init_errors();
11378
11787
  init_en();
11379
11788
  makeIssue = (params) => {
11380
- const { data, path: path11, errorMaps, issueData } = params;
11381
- const fullPath = [...path11, ...issueData.path || []];
11789
+ const { data, path: path12, errorMaps, issueData } = params;
11790
+ const fullPath = [...path12, ...issueData.path || []];
11382
11791
  const fullIssue = {
11383
11792
  ...issueData,
11384
11793
  path: fullPath
@@ -11686,11 +12095,11 @@ var init_types3 = __esm({
11686
12095
  init_parseUtil();
11687
12096
  init_util();
11688
12097
  ParseInputLazyPath = class {
11689
- constructor(parent, value, path11, key) {
12098
+ constructor(parent, value, path12, key) {
11690
12099
  this._cachedPath = [];
11691
12100
  this.parent = parent;
11692
12101
  this.data = value;
11693
- this._path = path11;
12102
+ this._path = path12;
11694
12103
  this._key = key;
11695
12104
  }
11696
12105
  get path() {
@@ -15174,14 +15583,14 @@ RESPOND WITH ONLY VALID JSON (no prose, no code fence):
15174
15583
  });
15175
15584
 
15176
15585
  // ../entries/dist/claude-bin.js
15177
- import { existsSync as existsSync14 } from "node:fs";
15586
+ import { existsSync as existsSync15 } from "node:fs";
15178
15587
  import { join as join11, dirname as dirname10, delimiter } from "node:path";
15179
15588
  import { homedir as homedir5 } from "node:os";
15180
15589
  function resolveClaudeBin(opts = {}) {
15181
15590
  const env = opts.env ?? process.env;
15182
15591
  const home = opts.home ?? homedir5();
15183
15592
  const execPath = opts.execPath ?? process.execPath;
15184
- const exists = opts.exists ?? existsSync14;
15593
+ const exists = opts.exists ?? existsSync15;
15185
15594
  for (const dir of (env.PATH ?? "").split(delimiter)) {
15186
15595
  if (!dir)
15187
15596
  continue;
@@ -15222,7 +15631,7 @@ var init_claude_bin = __esm({
15222
15631
  });
15223
15632
 
15224
15633
  // ../entries/dist/tmux-runner.js
15225
- import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, existsSync as existsSync15, readdirSync as readdirSync3, realpathSync as realpathSync5, readFileSync as readFileSync16, unlinkSync as unlinkSync3, renameSync as renameSync4 } from "node:fs";
15634
+ import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, existsSync as existsSync16, readdirSync as readdirSync3, realpathSync as realpathSync5, readFileSync as readFileSync17, unlinkSync as unlinkSync3, renameSync as renameSync4 } from "node:fs";
15226
15635
  import { join as join12 } from "node:path";
15227
15636
  import { homedir as homedir6 } from "node:os";
15228
15637
  import { spawnSync as spawnSync2 } from "node:child_process";
@@ -15241,7 +15650,7 @@ function tmuxRunnerAvailable() {
15241
15650
  }
15242
15651
  function runtimeCwd() {
15243
15652
  const dir = join12(homedir6(), ".cclens", "runtime");
15244
- if (!existsSync15(dir))
15653
+ if (!existsSync16(dir))
15245
15654
  mkdirSync8(dir, { recursive: true });
15246
15655
  return realpathSync5(dir);
15247
15656
  }
@@ -15249,7 +15658,7 @@ function ensureRuntimeCwdTrusted(cwd) {
15249
15658
  const cfgPath = join12(homedir6(), ".claude.json");
15250
15659
  let cfg;
15251
15660
  try {
15252
- cfg = JSON.parse(readFileSync16(cfgPath, "utf8"));
15661
+ cfg = JSON.parse(readFileSync17(cfgPath, "utf8"));
15253
15662
  } catch {
15254
15663
  return;
15255
15664
  }
@@ -15396,10 +15805,10 @@ function snapshotAllTranscripts() {
15396
15805
  }
15397
15806
  return out;
15398
15807
  }
15399
- function readJsonlCwd(path11, maxLines = 8) {
15808
+ function readJsonlCwd(path12, maxLines = 8) {
15400
15809
  let raw;
15401
15810
  try {
15402
- raw = readFileSync16(path11, "utf8");
15811
+ raw = readFileSync17(path12, "utf8");
15403
15812
  } catch {
15404
15813
  return void 0;
15405
15814
  }
@@ -15453,10 +15862,10 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
15453
15862
  }
15454
15863
  throw new TmuxRunError(`timeout waiting for claude to create the session transcript (cwd: ${targetCwd})`);
15455
15864
  }
15456
- function parseTranscript2(path11, defaultModel) {
15865
+ function parseTranscript2(path12, defaultModel) {
15457
15866
  let raw;
15458
15867
  try {
15459
- raw = readFileSync16(path11, "utf8");
15868
+ raw = readFileSync17(path12, "utf8");
15460
15869
  } catch {
15461
15870
  return { assembled: "", inputTokens: 0, outputTokens: 0, modelUsed: defaultModel, done: false };
15462
15871
  }
@@ -15551,11 +15960,11 @@ var init_tmux_runner = __esm({
15551
15960
 
15552
15961
  // ../entries/dist/llm-runner.js
15553
15962
  import { spawn as spawn4 } from "node:child_process";
15554
- import { mkdirSync as mkdirSync9, appendFileSync as appendFileSync3, writeFileSync as writeFileSync10, existsSync as existsSync16 } from "node:fs";
15963
+ import { mkdirSync as mkdirSync9, appendFileSync as appendFileSync3, writeFileSync as writeFileSync10, existsSync as existsSync17 } from "node:fs";
15555
15964
  import { join as join13 } from "node:path";
15556
15965
  import { randomUUID } from "node:crypto";
15557
15966
  function ensureRunsDir() {
15558
- if (!existsSync16(RUNS_DIR)) {
15967
+ if (!existsSync17(RUNS_DIR)) {
15559
15968
  try {
15560
15969
  mkdirSync9(RUNS_DIR, { recursive: true });
15561
15970
  } catch {
@@ -15586,15 +15995,15 @@ function newRunId(kind) {
15586
15995
  function tracePath(runId) {
15587
15996
  return join13(RUNS_DIR, `${runId}.jsonl`);
15588
15997
  }
15589
- function safeAppend(path11, line) {
15998
+ function safeAppend(path12, line) {
15590
15999
  try {
15591
- appendFileSync3(path11, line);
16000
+ appendFileSync3(path12, line);
15592
16001
  } catch {
15593
16002
  }
15594
16003
  }
15595
- function safeWrite(path11, line) {
16004
+ function safeWrite(path12, line) {
15596
16005
  try {
15597
- writeFileSync10(path11, line);
16006
+ writeFileSync10(path12, line);
15598
16007
  } catch {
15599
16008
  }
15600
16009
  }
@@ -16008,7 +16417,7 @@ var init_enrich2 = __esm({
16008
16417
  });
16009
16418
 
16010
16419
  // ../entries/dist/budget.js
16011
- import { appendFileSync as appendFileSync4, readFileSync as readFileSync17, existsSync as existsSync17, mkdirSync as mkdirSync10 } from "node:fs";
16420
+ import { appendFileSync as appendFileSync4, readFileSync as readFileSync18, existsSync as existsSync18, mkdirSync as mkdirSync10 } from "node:fs";
16012
16421
  import { dirname as dirname11 } from "node:path";
16013
16422
  function spendPath() {
16014
16423
  if (spendPathCached)
@@ -16016,8 +16425,8 @@ function spendPath() {
16016
16425
  spendPathCached = cclensPath("llm-spend.jsonl");
16017
16426
  return spendPathCached;
16018
16427
  }
16019
- function __setSpendPathForTest(path11) {
16020
- spendPathCached = path11;
16428
+ function __setSpendPathForTest(path12) {
16429
+ spendPathCached = path12;
16021
16430
  }
16022
16431
  function appendSpend(record) {
16023
16432
  const p = spendPath();
@@ -16026,12 +16435,12 @@ function appendSpend(record) {
16026
16435
  }
16027
16436
  function monthToDateSpend(now = /* @__PURE__ */ new Date()) {
16028
16437
  const p = spendPath();
16029
- if (!existsSync17(p))
16438
+ if (!existsSync18(p))
16030
16439
  return 0;
16031
16440
  const year = now.getUTCFullYear();
16032
16441
  const month2 = now.getUTCMonth();
16033
16442
  let total = 0;
16034
- const raw = readFileSync17(p, "utf8");
16443
+ const raw = readFileSync18(p, "utf8");
16035
16444
  for (const line of raw.split("\n")) {
16036
16445
  if (!line)
16037
16446
  continue;
@@ -16060,15 +16469,15 @@ var init_budget = __esm({
16060
16469
  });
16061
16470
 
16062
16471
  // ../entries/dist/pipeline-lock.js
16063
- import { writeFileSync as writeFileSync11, unlinkSync as unlinkSync4, existsSync as existsSync18, readFileSync as readFileSync18, statSync as statSync3 } from "node:fs";
16472
+ import { writeFileSync as writeFileSync11, unlinkSync as unlinkSync4, existsSync as existsSync19, readFileSync as readFileSync19, statSync as statSync3 } from "node:fs";
16064
16473
  function lockPath() {
16065
16474
  if (lockPathCached)
16066
16475
  return lockPathCached;
16067
16476
  lockPathCached = cclensPath("llm-interactive.lock");
16068
16477
  return lockPathCached;
16069
16478
  }
16070
- function __setInteractiveLockPathForTest(path11) {
16071
- lockPathCached = path11;
16479
+ function __setInteractiveLockPathForTest(path12) {
16480
+ lockPathCached = path12;
16072
16481
  }
16073
16482
  function touchLock() {
16074
16483
  writeFileSync11(lockPath(), String(process.pid), "utf8");
@@ -16105,13 +16514,13 @@ function pidAlive(pid) {
16105
16514
  }
16106
16515
  function interactiveLockFresh(nowMs) {
16107
16516
  const p = lockPath();
16108
- if (!existsSync18(p))
16517
+ if (!existsSync19(p))
16109
16518
  return false;
16110
16519
  try {
16111
16520
  const mtime = statSync3(p).mtimeMs;
16112
16521
  if (nowMs - mtime > STALE_MS)
16113
16522
  return false;
16114
- const pid = Number(readFileSync18(p, "utf8").trim());
16523
+ const pid = Number(readFileSync19(p, "utf8").trim());
16115
16524
  if (!Number.isFinite(pid) || pid <= 0)
16116
16525
  return false;
16117
16526
  if (!pidAlive(pid))
@@ -16217,7 +16626,7 @@ var init_queue = __esm({
16217
16626
  });
16218
16627
 
16219
16628
  // ../entries/dist/settings.js
16220
- import { readFileSync as readFileSync19, writeFileSync as writeFileSync12, renameSync as renameSync5, chmodSync as chmodSync2, mkdirSync as mkdirSync11, existsSync as existsSync19 } from "node:fs";
16629
+ import { readFileSync as readFileSync20, writeFileSync as writeFileSync12, renameSync as renameSync5, chmodSync as chmodSync2, mkdirSync as mkdirSync11, existsSync as existsSync20 } from "node:fs";
16221
16630
  import { dirname as dirname12 } from "node:path";
16222
16631
  function settingsPath() {
16223
16632
  if (settingsPathCached)
@@ -16225,8 +16634,8 @@ function settingsPath() {
16225
16634
  settingsPathCached = cclensPath("settings.json");
16226
16635
  return settingsPathCached;
16227
16636
  }
16228
- function __setSettingsPathForTest(path11) {
16229
- settingsPathCached = path11;
16637
+ function __setSettingsPathForTest(path12) {
16638
+ settingsPathCached = path12;
16230
16639
  }
16231
16640
  function toDisk(s) {
16232
16641
  return {
@@ -16253,10 +16662,10 @@ function fromDisk(d) {
16253
16662
  }
16254
16663
  function readSettings() {
16255
16664
  const p = settingsPath();
16256
- if (!existsSync19(p))
16665
+ if (!existsSync20(p))
16257
16666
  return DEFAULT_SETTINGS;
16258
16667
  try {
16259
- const raw = readFileSync19(p, "utf8");
16668
+ const raw = readFileSync20(p, "utf8");
16260
16669
  return fromDisk(JSON.parse(raw));
16261
16670
  } catch {
16262
16671
  return DEFAULT_SETTINGS;
@@ -19446,7 +19855,7 @@ var init_digest_month_pipeline = __esm({
19446
19855
  });
19447
19856
 
19448
19857
  // ../entries/dist/credentials.js
19449
- import { writeFileSync as writeFileSync13, readFileSync as readFileSync20, renameSync as renameSync6, chmodSync as chmodSync3, mkdirSync as mkdirSync12, existsSync as existsSync20, unlinkSync as unlinkSync5 } from "node:fs";
19858
+ import { writeFileSync as writeFileSync13, readFileSync as readFileSync21, renameSync as renameSync6, chmodSync as chmodSync3, mkdirSync as mkdirSync12, existsSync as existsSync21, unlinkSync as unlinkSync5 } from "node:fs";
19450
19859
  import { dirname as dirname13 } from "node:path";
19451
19860
  async function fetchZaiUsage2(candidate) {
19452
19861
  const key = candidate.trim();
@@ -19517,10 +19926,10 @@ function credentialsPath() {
19517
19926
  }
19518
19927
  function readCredentials() {
19519
19928
  const p = credentialsPath();
19520
- if (!existsSync20(p))
19929
+ if (!existsSync21(p))
19521
19930
  return {};
19522
19931
  try {
19523
- const raw = readFileSync20(p, "utf8");
19932
+ const raw = readFileSync21(p, "utf8");
19524
19933
  return JSON.parse(raw);
19525
19934
  } catch {
19526
19935
  return {};
@@ -20154,7 +20563,7 @@ var menubar_exports = {};
20154
20563
  __export(menubar_exports, {
20155
20564
  menubar: () => menubar
20156
20565
  });
20157
- import { existsSync as existsSync21, mkdirSync as mkdirSync13, cpSync, rmSync as rmSync2, readdirSync as readdirSync4, writeFileSync as writeFileSync14, realpathSync as realpathSync6 } from "node:fs";
20566
+ import { existsSync as existsSync22, mkdirSync as mkdirSync13, cpSync, rmSync as rmSync2, readdirSync as readdirSync4, writeFileSync as writeFileSync14, realpathSync as realpathSync6 } from "node:fs";
20158
20567
  import { homedir as homedir7 } from "node:os";
20159
20568
  import { join as join14, dirname as dirname14 } from "node:path";
20160
20569
  import { fileURLToPath as fileURLToPath3 } from "node:url";
@@ -20199,8 +20608,8 @@ async function isRunning() {
20199
20608
  return false;
20200
20609
  }
20201
20610
  }
20202
- async function launchApp(path11) {
20203
- await execFileAsync2("open", ["-a", path11]);
20611
+ async function launchApp(path12) {
20612
+ await execFileAsync2("open", ["-a", path12]);
20204
20613
  }
20205
20614
  async function quitApp() {
20206
20615
  await execFileAsync2("osascript", ["-e", `tell application "${BUNDLE_EXEC}" to quit`]).catch(
@@ -20228,7 +20637,7 @@ async function installMenubar(opts) {
20228
20637
  return;
20229
20638
  }
20230
20639
  const src = bundledAppPath();
20231
- if (!existsSync21(src)) {
20640
+ if (!existsSync22(src)) {
20232
20641
  console.error(
20233
20642
  `Bundled widget not found at ${src}.
20234
20643
  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.`
@@ -20274,7 +20683,7 @@ async function uninstallMenubar() {
20274
20683
  await new Promise((r) => setTimeout(r, 300));
20275
20684
  }
20276
20685
  const dest = installedAppPath();
20277
- if (existsSync21(dest)) {
20686
+ if (existsSync22(dest)) {
20278
20687
  rmSync2(dest, { recursive: true, force: true });
20279
20688
  console.log(`Removed ${dest}`);
20280
20689
  } else {
@@ -20289,7 +20698,7 @@ async function openMenubar() {
20289
20698
  return;
20290
20699
  }
20291
20700
  const dest = installedAppPath();
20292
- if (!existsSync21(dest)) {
20701
+ if (!existsSync22(dest)) {
20293
20702
  console.log("Widget not installed yet. Run `fleetlens menubar install` first.");
20294
20703
  return;
20295
20704
  }
@@ -20306,9 +20715,9 @@ async function statusMenubar() {
20306
20715
  return;
20307
20716
  }
20308
20717
  const dest = installedAppPath();
20309
- const installed = existsSync21(dest);
20718
+ const installed = existsSync22(dest);
20310
20719
  const running = await isRunning();
20311
- const bundled = existsSync21(bundledAppPath());
20720
+ const bundled = existsSync22(bundledAppPath());
20312
20721
  console.log(`Menu bar widget: ${installed ? "installed" : "not installed"}${installed ? ` (${dest})` : ""}`);
20313
20722
  console.log(`Running: ${running ? "yes" : "no"}`);
20314
20723
  console.log(`Bundled in CLI: ${bundled ? "yes" : "no \u2014 this build ships without the widget"}`);
@@ -20399,7 +20808,7 @@ var init_config = __esm({
20399
20808
  });
20400
20809
 
20401
20810
  // src/perception/build-entries.ts
20402
- import { statSync as statSync4, readFileSync as readFileSync21 } from "node:fs";
20811
+ import { statSync as statSync4, readFileSync as readFileSync22 } from "node:fs";
20403
20812
  import { basename as basename2, dirname as dirname15 } from "node:path";
20404
20813
  function decodeProjectDirName(projectDir) {
20405
20814
  if (projectDir.startsWith("-")) {
@@ -20409,7 +20818,7 @@ function decodeProjectDirName(projectDir) {
20409
20818
  }
20410
20819
  function buildEntriesForFile(filePath) {
20411
20820
  const stat = statSync4(filePath);
20412
- const raw = readFileSync21(filePath, "utf8");
20821
+ const raw = readFileSync22(filePath, "utf8");
20413
20822
  const rawLines = raw.split("\n").filter(Boolean).map((l) => {
20414
20823
  try {
20415
20824
  return JSON.parse(l);
@@ -20678,7 +21087,7 @@ function buildIngestPayload(inputs) {
20678
21087
  return {
20679
21088
  ingestId: randomUUID2(),
20680
21089
  observedAt: (/* @__PURE__ */ new Date()).toISOString(),
20681
- cliVersion: "1.0.13",
21090
+ cliVersion: "1.0.14",
20682
21091
  ...richRollup || inputs.enrichedExtras || inputs.artifactSignals ? { schemaVersion: RICH_ROLLUP_SCHEMA_VERSION } : {},
20683
21092
  ...inputs.rollup ? { dailyRollup: inputs.rollup } : {},
20684
21093
  ...richRollup ? { richRollup } : {},
@@ -20720,7 +21129,7 @@ var init_push = __esm({
20720
21129
  });
20721
21130
 
20722
21131
  // src/team/git-remote.ts
20723
- import { existsSync as existsSync22, readFileSync as readFileSync22, statSync as statSync5 } from "node:fs";
21132
+ import { existsSync as existsSync23, readFileSync as readFileSync23, statSync as statSync5 } from "node:fs";
20724
21133
  import { dirname as dirname16, isAbsolute as isAbsolute2, join as join15, resolve as resolve2 } from "node:path";
20725
21134
  function parseGithubRemote(url) {
20726
21135
  const m = url.trim().match(GITHUB_URL_RE);
@@ -20745,12 +21154,12 @@ function gitConfigPathFor(dir) {
20745
21154
  const st = statSync5(dotGit, { throwIfNoEntry: false });
20746
21155
  if (!st) return null;
20747
21156
  if (st.isDirectory()) return join15(dotGit, "config");
20748
- const m = readFileSync22(dotGit, "utf8").match(/^gitdir:\s*(.+)\s*$/m);
21157
+ const m = readFileSync23(dotGit, "utf8").match(/^gitdir:\s*(.+)\s*$/m);
20749
21158
  if (!m) return null;
20750
21159
  const gd = isAbsolute2(m[1]) ? m[1] : resolve2(dir, m[1]);
20751
21160
  const commondirFile = join15(gd, "commondir");
20752
- if (existsSync22(commondirFile)) {
20753
- const common = readFileSync22(commondirFile, "utf8").trim();
21161
+ if (existsSync23(commondirFile)) {
21162
+ const common = readFileSync23(commondirFile, "utf8").trim();
20754
21163
  return join15(isAbsolute2(common) ? common : resolve2(gd, common), "config");
20755
21164
  }
20756
21165
  return join15(gd, "config");
@@ -20765,8 +21174,8 @@ function createRepoResolver() {
20765
21174
  try {
20766
21175
  for (let d = dir; ; d = dirname16(d)) {
20767
21176
  const config = gitConfigPathFor(d);
20768
- if (config && existsSync22(config)) {
20769
- const url = originUrl2(readFileSync22(config, "utf8"));
21177
+ if (config && existsSync23(config)) {
21178
+ const url = originUrl2(readFileSync23(config, "utf8"));
20770
21179
  repo = url ? parseGithubRemote(url) : null;
20771
21180
  break;
20772
21181
  }
@@ -20788,7 +21197,7 @@ var init_git_remote = __esm({
20788
21197
  });
20789
21198
 
20790
21199
  // src/team/queue.ts
20791
- import { readFileSync as readFileSync23, writeFileSync as writeFileSync15, appendFileSync as appendFileSync5, statSync as statSync6, mkdirSync as mkdirSync14 } from "node:fs";
21200
+ import { readFileSync as readFileSync24, writeFileSync as writeFileSync15, appendFileSync as appendFileSync5, statSync as statSync6, mkdirSync as mkdirSync14 } from "node:fs";
20792
21201
  import { dirname as dirname17 } from "node:path";
20793
21202
  function enqueuePayload(payload, queuePath = QUEUE_PATH) {
20794
21203
  mkdirSync14(dirname17(queuePath), { recursive: true });
@@ -20805,7 +21214,7 @@ function enqueuePayload(payload, queuePath = QUEUE_PATH) {
20805
21214
  function dequeuePayloads(queuePath = QUEUE_PATH) {
20806
21215
  let lines;
20807
21216
  try {
20808
- lines = readFileSync23(queuePath, "utf8").trim().split("\n").filter(Boolean);
21217
+ lines = readFileSync24(queuePath, "utf8").trim().split("\n").filter(Boolean);
20809
21218
  } catch {
20810
21219
  return [];
20811
21220
  }
@@ -20826,7 +21235,7 @@ function dequeuePayloads(queuePath = QUEUE_PATH) {
20826
21235
  function pruneOldest(queuePath) {
20827
21236
  let lines;
20828
21237
  try {
20829
- lines = readFileSync23(queuePath, "utf8").trim().split("\n").filter(Boolean);
21238
+ lines = readFileSync24(queuePath, "utf8").trim().split("\n").filter(Boolean);
20830
21239
  } catch {
20831
21240
  return;
20832
21241
  }
@@ -20845,7 +21254,7 @@ var init_queue2 = __esm({
20845
21254
  });
20846
21255
 
20847
21256
  // src/usage/profile.ts
20848
- import { existsSync as existsSync23, mkdirSync as mkdirSync15, readFileSync as readFileSync24, writeFileSync as writeFileSync16 } from "node:fs";
21257
+ import { existsSync as existsSync24, mkdirSync as mkdirSync15, readFileSync as readFileSync25, writeFileSync as writeFileSync16 } from "node:fs";
20849
21258
  import { dirname as dirname18 } from "node:path";
20850
21259
  function mapRateLimitTier(rateLimitTier) {
20851
21260
  switch (rateLimitTier) {
@@ -20886,9 +21295,9 @@ async function fetchProfile(nowMs = Date.now()) {
20886
21295
  };
20887
21296
  }
20888
21297
  function readCachedProfile(cachePath) {
20889
- if (!existsSync23(cachePath)) return null;
21298
+ if (!existsSync24(cachePath)) return null;
20890
21299
  try {
20891
- const raw = JSON.parse(readFileSync24(cachePath, "utf8"));
21300
+ const raw = JSON.parse(readFileSync25(cachePath, "utf8"));
20892
21301
  if (typeof raw.fetchedAtMs !== "number" || !raw.profile) return null;
20893
21302
  return raw;
20894
21303
  } catch {
@@ -21077,11 +21486,11 @@ var init_backfill = __esm({
21077
21486
  });
21078
21487
 
21079
21488
  // src/team/sync-log.ts
21080
- import { readFileSync as readFileSync25 } from "node:fs";
21489
+ import { readFileSync as readFileSync26 } from "node:fs";
21081
21490
  function readPendingSyncLog(watermark) {
21082
21491
  let raw;
21083
21492
  try {
21084
- raw = readFileSync25(cclensPath("daemon.log"), "utf8");
21493
+ raw = readFileSync26(cclensPath("daemon.log"), "utf8");
21085
21494
  } catch {
21086
21495
  return { lines: [] };
21087
21496
  }
@@ -21145,7 +21554,7 @@ __export(file_probe_exports, {
21145
21554
  probeArtifactSignals: () => probeArtifactSignals
21146
21555
  });
21147
21556
  import { createHash } from "node:crypto";
21148
- import { existsSync as existsSync24, readdirSync as readdirSync5, statSync as statSync7 } from "node:fs";
21557
+ import { existsSync as existsSync25, readdirSync as readdirSync5, statSync as statSync7 } from "node:fs";
21149
21558
  import { homedir as homedir8 } from "node:os";
21150
21559
  import { join as join17, relative, resolve as resolve3, sep } from "node:path";
21151
21560
  import { execFileSync as execFileSync3 } from "node:child_process";
@@ -21155,15 +21564,15 @@ function pathHash(relPath) {
21155
21564
  function defaultScanRoots(extraRoots = []) {
21156
21565
  const roots = [];
21157
21566
  const home = join17(homedir8(), ".claude");
21158
- if (existsSync24(home)) roots.push({ root: home, label: "user" });
21567
+ if (existsSync25(home)) roots.push({ root: home, label: "user" });
21159
21568
  for (const e of extraRoots) {
21160
21569
  const r = resolve3(e, ".claude");
21161
- if (existsSync24(r) && r !== home) roots.push({ root: r, label: "project" });
21570
+ if (existsSync25(r) && r !== home) roots.push({ root: r, label: "project" });
21162
21571
  }
21163
21572
  return roots;
21164
21573
  }
21165
21574
  function listMarkdownFiles(dir) {
21166
- if (!existsSync24(dir)) return [];
21575
+ if (!existsSync25(dir)) return [];
21167
21576
  const out = [];
21168
21577
  let entries2;
21169
21578
  try {
@@ -21233,7 +21642,7 @@ function scanAuthored(roots, subdir, day2) {
21233
21642
  const out = [];
21234
21643
  for (const r of roots) {
21235
21644
  const dir = join17(r.root, subdir);
21236
- if (!existsSync24(dir)) continue;
21645
+ if (!existsSync25(dir)) continue;
21237
21646
  for (const f of listMarkdownFiles(dir)) {
21238
21647
  const firstSeen = firstSeenDateOf(f);
21239
21648
  if (firstSeen !== day2) continue;
@@ -21247,7 +21656,7 @@ function scanEdited(roots, day2) {
21247
21656
  const out = [];
21248
21657
  for (const r of roots) {
21249
21658
  const dir = join17(r.root, "skills");
21250
- if (!existsSync24(dir)) continue;
21659
+ if (!existsSync25(dir)) continue;
21251
21660
  for (const f of listMarkdownFiles(dir)) {
21252
21661
  const firstSeen = firstSeenDateOf(f);
21253
21662
  if (firstSeen === day2) continue;
@@ -21270,10 +21679,10 @@ function claudemdLineDelta(extraRoots, authorEmail, day2) {
21270
21679
  const candidates = [];
21271
21680
  for (const e of extraRoots) {
21272
21681
  const f = resolve3(e, "CLAUDE.md");
21273
- if (existsSync24(f)) candidates.push(f);
21682
+ if (existsSync25(f)) candidates.push(f);
21274
21683
  }
21275
21684
  const homeClaudeMd = join17(homedir8(), "CLAUDE.md");
21276
- if (existsSync24(homeClaudeMd)) candidates.push(homeClaudeMd);
21685
+ if (existsSync25(homeClaudeMd)) candidates.push(homeClaudeMd);
21277
21686
  for (const file of candidates) {
21278
21687
  try {
21279
21688
  const out = execFileSync3(
@@ -22163,11 +22572,11 @@ var logs_exports = {};
22163
22572
  __export(logs_exports, {
22164
22573
  teamLogs: () => teamLogs
22165
22574
  });
22166
- import { readFileSync as readFileSync26 } from "node:fs";
22575
+ import { readFileSync as readFileSync27 } from "node:fs";
22167
22576
  async function teamLogs() {
22168
22577
  const logPath = cclensPath("daemon.log");
22169
22578
  try {
22170
- const lines = readFileSync26(logPath, "utf8").trim().split("\n");
22579
+ const lines = readFileSync27(logPath, "utf8").trim().split("\n");
22171
22580
  const teamLines = lines.filter((l) => l.includes("[sync] ") || l.includes("team "));
22172
22581
  if (teamLines.length === 0) {
22173
22582
  console.log("No team-related log entries found.");
@@ -22295,7 +22704,7 @@ __export(runs_exports, {
22295
22704
  runs: () => runs
22296
22705
  });
22297
22706
  import { execSync as execSync2 } from "node:child_process";
22298
- import { existsSync as existsSync25, readFileSync as readFileSync27, readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
22707
+ import { existsSync as existsSync26, readFileSync as readFileSync28, readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
22299
22708
  import { join as join18 } from "node:path";
22300
22709
  async function runs(args2) {
22301
22710
  const json = args2.includes("--json");
@@ -22380,8 +22789,8 @@ function listActiveRuns() {
22380
22789
  return runs2.sort((a, b) => a.elapsed_s - b.elapsed_s);
22381
22790
  }
22382
22791
  function readSpend(sinceMs) {
22383
- if (!existsSync25(SPEND_PATH)) return [];
22384
- const lines = readFileSync27(SPEND_PATH, "utf-8").split("\n").filter((l) => l.trim());
22792
+ if (!existsSync26(SPEND_PATH)) return [];
22793
+ const lines = readFileSync28(SPEND_PATH, "utf-8").split("\n").filter((l) => l.trim());
22385
22794
  const out = [];
22386
22795
  for (const line of lines) {
22387
22796
  try {
@@ -22502,23 +22911,23 @@ function ageLabel(ms) {
22502
22911
  return `${Math.floor(ms / 864e5)}d`;
22503
22912
  }
22504
22913
  function listTraceFiles() {
22505
- if (!existsSync25(RUNS_DIR2)) return [];
22914
+ if (!existsSync26(RUNS_DIR2)) return [];
22506
22915
  const entries2 = readdirSync6(RUNS_DIR2).filter((f) => f.endsWith(".jsonl"));
22507
22916
  return entries2.map((f) => {
22508
- const path11 = join18(RUNS_DIR2, f);
22509
- const st = statSync8(path11);
22510
- return { runId: f.replace(/\.jsonl$/, ""), path: path11, mtimeMs: st.mtimeMs };
22917
+ const path12 = join18(RUNS_DIR2, f);
22918
+ const st = statSync8(path12);
22919
+ return { runId: f.replace(/\.jsonl$/, ""), path: path12, mtimeMs: st.mtimeMs };
22511
22920
  }).sort((a, b) => b.mtimeMs - a.mtimeMs);
22512
22921
  }
22513
22922
  function resolveRunId(arg) {
22514
- if (!existsSync25(RUNS_DIR2)) return null;
22923
+ if (!existsSync26(RUNS_DIR2)) return null;
22515
22924
  if (arg === "latest") {
22516
22925
  const all2 = listTraceFiles();
22517
22926
  if (all2.length === 0) return null;
22518
22927
  return { runId: all2[0].runId, path: all2[0].path };
22519
22928
  }
22520
22929
  const exact = join18(RUNS_DIR2, `${arg}.jsonl`);
22521
- if (existsSync25(exact)) return { runId: arg, path: exact };
22930
+ if (existsSync26(exact)) return { runId: arg, path: exact };
22522
22931
  const all = listTraceFiles();
22523
22932
  const matches = all.filter((r) => r.runId.includes(arg));
22524
22933
  if (matches.length === 1) return { runId: matches[0].runId, path: matches[0].path };
@@ -22529,8 +22938,8 @@ function resolveRunId(arg) {
22529
22938
  }
22530
22939
  return null;
22531
22940
  }
22532
- function readTrace(path11) {
22533
- return readFileSync27(path11, "utf-8").split("\n").filter((l) => l.trim()).map((l) => {
22941
+ function readTrace(path12) {
22942
+ return readFileSync28(path12, "utf-8").split("\n").filter((l) => l.trim()).map((l) => {
22534
22943
  try {
22535
22944
  return JSON.parse(l);
22536
22945
  } catch {
@@ -22542,7 +22951,7 @@ async function inspect(arg, follow, json) {
22542
22951
  const r = resolveRunId(arg);
22543
22952
  if (!r) {
22544
22953
  console.error(`run not found: ${arg}`);
22545
- if (existsSync25(RUNS_DIR2)) {
22954
+ if (existsSync26(RUNS_DIR2)) {
22546
22955
  const all = listTraceFiles().slice(0, 5);
22547
22956
  if (all.length > 0) {
22548
22957
  console.error(`
@@ -22722,7 +23131,7 @@ async function main() {
22722
23131
  case "version":
22723
23132
  case "--version":
22724
23133
  case "-v":
22725
- console.log(`fleetlens ${"1.0.13"}`);
23134
+ console.log(`fleetlens ${"1.0.14"}`);
22726
23135
  break;
22727
23136
  case "help":
22728
23137
  case "--help":