Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(usage): do not scan ~/projects when Claude transcripts are missing #7177

Closedmaslinedwin(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/7177/headopened View on GitHub

Showing 3 changed files with 137 additions and 5 deletions.

x
0 of 3 viewed, 3 left
18 additions and 5 deletionsapps/server/src/usage/UsageService.tsModified
View file
@@ -38,6 +38,10 @@
import { resolveClaudeHomePath } from "../provider/Drivers/ClaudeHome.ts";
import { resolveCodexHomeLayout } from "../provider/Drivers/CodexHomeLayout.ts";
import { UsageAggregator } from "./usageAggregation.ts";
+import {
+ isClaudeHomeExplicitOverride,
+ resolveClaudeTranscriptDirPath,
+} from "./usageClaudeTranscriptDir.ts";
import { parseRateTable, type RateTable } from "./usagePricing.ts";
import {
listTranscriptFiles,
@@ -185,16 +189,22 @@
});
​
/**
- * Claude's config dir is the home itself when overridden, but a default
- * install nests transcripts under `~/.claude/projects`. Probe both.
+ * Default installs nest transcripts under `~/.claude/projects`. A custom
+ * CLAUDE_CONFIG_DIR uses `<home>/projects` only when that nested path is
+ * absent. Never fall back to `~/projects` for the OS home.
- const resolveClaudeTranscriptDir = (homePath: string) =>
+ const resolveClaudeTranscriptDir = (homePath: string, homeIsExplicitOverride: boolean) =>
Effect.gen(function* () {
const nested = path.join(homePath, ".claude", "projects");
const nestedExists = yield* fileSystem
.exists(nested)
.pipe(Effect.catchCause(() => Effect.succeed(false)));
- return nestedExists ? nested : path.join(homePath, "projects");