Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): usage counts every configured provider profile #6596

Closedbwmp(GitHub profile, opens in a new tab)wants to merge 8 commits intomain fromrefs/pull/6596/headopened View on GitHub

Showing 5 changed files with 28 additions and 27 deletions (loading 3).

x
0 of 5 viewed, 5 left
25 additions and 3 deletionsapps/server/src/provider/Drivers/ClaudeHome.tsModified
View file
@@ -6,12 +6,34 @@
​
import { expandHomePath } from "../../pathExpansion.ts";
​
-export const resolveClaudeHomePath = Effect.fn("resolveClaudeHomePath")(function* (
+export interface ClaudeHome {
+ readonly path: string;
+ /**
+ * False when the path was defaulted to the OS home because no home was
+ * configured. The two cases resolve to the same path for a user who points a
+ * profile at their OS home, but they mean different things: a configured
+ * home *is* the config dir, while the default install keeps its config in
+ * `.claude` below the OS home.
+ */
+ readonly configured: boolean;
+}
+​
+export const resolveClaudeHome = Effect.fn("resolveClaudeHome")(function* (
config: Pick<ClaudeSettings, "homePath">,
-): Effect.fn.Return<string, never, Path.Path> {
+): Effect.fn.Return<ClaudeHome, never, Path.Path> {
const path = yield* Path.Path;
const homePath = config.homePath.trim();
- return path.resolve(homePath.length > 0 ? expandHomePath(homePath) : NodeOS.homedir());
+ const configured = homePath.length > 0;
+ return {
+ path: path.resolve(configured ? expandHomePath(homePath) : NodeOS.homedir()),
+ configured,
+ };
+});