claudectx 1.1.3 → 1.1.4

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/dist/index.js CHANGED
@@ -2977,7 +2977,8 @@ async function aggregateUsage(days, model = "claude-sonnet-4-6") {
2977
2977
  readCount: s.readCount
2978
2978
  }));
2979
2979
  const totalCost = calcCost2(totalInput, totalOutput, totalCacheCreation, totalCacheRead, model);
2980
- const cacheHitRate = totalInput > 0 ? Math.round(totalCacheRead / totalInput * 100) : 0;
2980
+ const totalContext = totalInput + totalCacheRead;
2981
+ const cacheHitRate = totalContext > 0 ? Math.round(totalCacheRead / totalContext * 100) : 0;
2981
2982
  const byDay = [...bucketMap.values()].sort((a, b) => a.date.localeCompare(b.date));
2982
2983
  const uniqueSessions = new Set(sessionFiles.map((f) => f.sessionId)).size;
2983
2984
  const dailyAvgCostUsd = days > 0 ? totalCost / days : 0;
@@ -3604,12 +3605,26 @@ async function findGitDeletedMentions(content, projectRoot) {
3604
3605
  return [];
3605
3606
  }
3606
3607
  if (deletedFiles.size === 0) return [];
3608
+ const deletedTerms = [];
3609
+ for (const deleted of deletedFiles) {
3610
+ const stem = path23.basename(deleted, path23.extname(deleted));
3611
+ const basenameWithExt = path23.basename(deleted);
3612
+ if (stem.length < 4) continue;
3613
+ deletedTerms.push({ basename: basenameWithExt, fullPath: deleted });
3614
+ }
3615
+ if (deletedTerms.length === 0) return [];
3607
3616
  const lines = content.split("\n");
3608
3617
  for (let i = 0; i < lines.length; i++) {
3609
3618
  const line = lines[i];
3610
- for (const deleted of deletedFiles) {
3611
- const basename10 = path23.basename(deleted);
3612
- if (line.includes(basename10) || line.includes(deleted)) {
3619
+ const lineLower = line.toLowerCase();
3620
+ for (const { basename: basename10, fullPath } of deletedTerms) {
3621
+ const matchesFullPath = lineLower.includes(fullPath.toLowerCase());
3622
+ const basenameLower = basename10.toLowerCase();
3623
+ const idx = lineLower.indexOf(basenameLower);
3624
+ const matchesBasename = idx !== -1 && // Check left boundary: start of string, space, slash, quote, backtick, or `@`
3625
+ (idx === 0 || /[\s/`'"@(]/.test(line[idx - 1])) && // Check right boundary: end of string, space, punctuation, or extension dot
3626
+ (idx + basenameLower.length >= line.length || /[\s/`'",.):@]/.test(line[idx + basenameLower.length]));
3627
+ if (matchesFullPath || matchesBasename) {
3613
3628
  issues.push({
3614
3629
  type: "git-deleted",
3615
3630
  line: i + 1,
@@ -4379,7 +4394,8 @@ async function buildTeamExport(days, model, anonymize) {
4379
4394
  );
4380
4395
  const topWasteFiles = aggregateStats(fileEvents).slice(0, 10).map((s) => ({ filePath: s.filePath, readCount: s.readCount }));
4381
4396
  const totalCostUsd = calcCost3(totalInput, totalOutput, 0, totalCacheRead, model);
4382
- const cacheHitRate = totalInput > 0 ? Math.round(totalCacheRead / totalInput * 100) : 0;
4397
+ const totalContext = totalInput + totalCacheRead;
4398
+ const cacheHitRate = totalContext > 0 ? Math.round(totalCacheRead / totalContext * 100) : 0;
4383
4399
  const uniqueSessions = new Set(sessionFiles.map((f) => f.sessionId)).size;
4384
4400
  const developer = {
4385
4401
  identity: getDeveloperIdentity(),
@@ -4734,7 +4750,7 @@ async function revertCommand(options) {
4734
4750
  }
4735
4751
 
4736
4752
  // src/index.ts
4737
- var VERSION = "1.1.3";
4753
+ var VERSION = "1.1.4";
4738
4754
  var DESCRIPTION = "Reduce Claude Code token usage by up to 80%. Context analyzer, auto-optimizer, live dashboard, and smart MCP tools.";
4739
4755
  var program = new import_commander.Command();
4740
4756
  program.name("claudectx").description(DESCRIPTION).version(VERSION);