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 +22 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2959,7 +2959,8 @@ async function aggregateUsage(days, model = "claude-sonnet-4-6") {
|
|
|
2959
2959
|
readCount: s.readCount
|
|
2960
2960
|
}));
|
|
2961
2961
|
const totalCost = calcCost2(totalInput, totalOutput, totalCacheCreation, totalCacheRead, model);
|
|
2962
|
-
const
|
|
2962
|
+
const totalContext = totalInput + totalCacheRead;
|
|
2963
|
+
const cacheHitRate = totalContext > 0 ? Math.round(totalCacheRead / totalContext * 100) : 0;
|
|
2963
2964
|
const byDay = [...bucketMap.values()].sort((a, b) => a.date.localeCompare(b.date));
|
|
2964
2965
|
const uniqueSessions = new Set(sessionFiles.map((f) => f.sessionId)).size;
|
|
2965
2966
|
const dailyAvgCostUsd = days > 0 ? totalCost / days : 0;
|
|
@@ -3586,12 +3587,26 @@ async function findGitDeletedMentions(content, projectRoot) {
|
|
|
3586
3587
|
return [];
|
|
3587
3588
|
}
|
|
3588
3589
|
if (deletedFiles.size === 0) return [];
|
|
3590
|
+
const deletedTerms = [];
|
|
3591
|
+
for (const deleted of deletedFiles) {
|
|
3592
|
+
const stem = path24.basename(deleted, path24.extname(deleted));
|
|
3593
|
+
const basenameWithExt = path24.basename(deleted);
|
|
3594
|
+
if (stem.length < 4) continue;
|
|
3595
|
+
deletedTerms.push({ basename: basenameWithExt, fullPath: deleted });
|
|
3596
|
+
}
|
|
3597
|
+
if (deletedTerms.length === 0) return [];
|
|
3589
3598
|
const lines = content.split("\n");
|
|
3590
3599
|
for (let i = 0; i < lines.length; i++) {
|
|
3591
3600
|
const line = lines[i];
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3601
|
+
const lineLower = line.toLowerCase();
|
|
3602
|
+
for (const { basename: basename10, fullPath } of deletedTerms) {
|
|
3603
|
+
const matchesFullPath = lineLower.includes(fullPath.toLowerCase());
|
|
3604
|
+
const basenameLower = basename10.toLowerCase();
|
|
3605
|
+
const idx = lineLower.indexOf(basenameLower);
|
|
3606
|
+
const matchesBasename = idx !== -1 && // Check left boundary: start of string, space, slash, quote, backtick, or `@`
|
|
3607
|
+
(idx === 0 || /[\s/`'"@(]/.test(line[idx - 1])) && // Check right boundary: end of string, space, punctuation, or extension dot
|
|
3608
|
+
(idx + basenameLower.length >= line.length || /[\s/`'",.):@]/.test(line[idx + basenameLower.length]));
|
|
3609
|
+
if (matchesFullPath || matchesBasename) {
|
|
3595
3610
|
issues.push({
|
|
3596
3611
|
type: "git-deleted",
|
|
3597
3612
|
line: i + 1,
|
|
@@ -4361,7 +4376,8 @@ async function buildTeamExport(days, model, anonymize) {
|
|
|
4361
4376
|
);
|
|
4362
4377
|
const topWasteFiles = aggregateStats(fileEvents).slice(0, 10).map((s) => ({ filePath: s.filePath, readCount: s.readCount }));
|
|
4363
4378
|
const totalCostUsd = calcCost3(totalInput, totalOutput, 0, totalCacheRead, model);
|
|
4364
|
-
const
|
|
4379
|
+
const totalContext = totalInput + totalCacheRead;
|
|
4380
|
+
const cacheHitRate = totalContext > 0 ? Math.round(totalCacheRead / totalContext * 100) : 0;
|
|
4365
4381
|
const uniqueSessions = new Set(sessionFiles.map((f) => f.sessionId)).size;
|
|
4366
4382
|
const developer = {
|
|
4367
4383
|
identity: getDeveloperIdentity(),
|
|
@@ -4716,7 +4732,7 @@ async function revertCommand(options) {
|
|
|
4716
4732
|
}
|
|
4717
4733
|
|
|
4718
4734
|
// src/index.ts
|
|
4719
|
-
var VERSION = "1.1.
|
|
4735
|
+
var VERSION = "1.1.4";
|
|
4720
4736
|
var DESCRIPTION = "Reduce Claude Code token usage by up to 80%. Context analyzer, auto-optimizer, live dashboard, and smart MCP tools.";
|
|
4721
4737
|
var program = new Command();
|
|
4722
4738
|
program.name("claudectx").description(DESCRIPTION).version(VERSION);
|