99 makeClaudeCapabilitiesCacheKey ,
1010 makeClaudeContinuationGroupKey ,
1111 makeClaudeEnvironment ,
12+ resolveClaudeConfigDir ,
1213 resolveClaudeHomePath ,
1314} from "./ClaudeHome.ts" ;
1415
@@ -17,35 +18,57 @@ it.layer(NodeServices.layer)("ClaudeHome", (it) => {
1718 it . effect ( "uses the process home when no Claude home override is configured" , ( ) =>
1819 Effect . gen ( function * ( ) {
1920 const path = yield * Path . Path ;
20- const resolved = path . resolve ( NodeOS . homedir ( ) ) ;
21+ const resolvedHome = path . resolve ( NodeOS . homedir ( ) ) ;
22+ const defaultConfigDir = path . join ( resolvedHome , ".claude" ) ;
2123
22- expect ( yield * resolveClaudeHomePath ( { homePath : "" } ) ) . toBe ( resolved ) ;
24+ expect ( yield * resolveClaudeHomePath ( { homePath : "" } ) ) . toBe ( resolvedHome ) ;
25+ expect ( yield * resolveClaudeConfigDir ( { homePath : "" } ) ) . toBe ( defaultConfigDir ) ;
2326 expect ( yield * makeClaudeEnvironment ( { homePath : "" } ) ) . toBe ( process . env ) ;
2427 } ) ,
2528 ) ;
2629
27- it . effect ( "resolves configured Claude HOME and stamps continuation/cache keys with it " , ( ) =>
30+ it . effect ( "preserves legacy HOME layouts under $HOME/.claude for CLAUDE_CONFIG_DIR " , ( ) =>
2831 Effect . gen ( function * ( ) {
2932 const path = yield * Path . Path ;
3033 const homePath = "~/.claude-work" ;
31- const resolved = path . resolve ( NodeOS . homedir ( ) , ".claude-work" ) ;
34+ const resolvedHome = path . resolve ( NodeOS . homedir ( ) , ".claude-work" ) ;
35+ const configDir = path . join ( resolvedHome , ".claude" ) ;
3236
33- expect ( yield * resolveClaudeHomePath ( { homePath } ) ) . toBe ( resolved ) ;
34- expect ( ( yield * makeClaudeEnvironment ( { homePath } ) ) . CLAUDE_CONFIG_DIR ) . toBe ( resolved ) ;
35- expect ( yield * makeClaudeContinuationGroupKey ( { homePath } ) ) . toBe ( `claude:home:${ resolved } ` ) ;
37+ expect ( yield * resolveClaudeHomePath ( { homePath } ) ) . toBe ( resolvedHome ) ;
38+ expect ( yield * resolveClaudeConfigDir ( { homePath } ) ) . toBe ( configDir ) ;
39+ expect ( ( yield * makeClaudeEnvironment ( { homePath } ) ) . CLAUDE_CONFIG_DIR ) . toBe ( configDir ) ;
40+ expect ( yield * makeClaudeContinuationGroupKey ( { homePath } ) ) . toBe ( `claude:home:${ configDir } ` ) ;
3641 expect ( yield * makeClaudeCapabilitiesCacheKey ( { binaryPath : "claude" , homePath } ) ) . toBe (
37- `claude\0${ resolved } ` ,
42+ `claude\0${ configDir } ` ,
3843 ) ;
3944 } ) ,
4045 ) ;
4146
42- it . effect ( "keeps continuation compatible across instances with the same Claude HOME " , ( ) =>
47+ it . effect ( "treats paths that already end with .claude as the config dir " , ( ) =>
4348 Effect . gen ( function * ( ) {
4449 const path = yield * Path . Path ;
45- const resolved = path . resolve ( NodeOS . homedir ( ) ) ;
50+ const homePath = "~/.claude" ;
51+ const configDir = path . resolve ( NodeOS . homedir ( ) , ".claude" ) ;
52+
53+ expect ( yield * resolveClaudeConfigDir ( { homePath } ) ) . toBe ( configDir ) ;
54+ expect ( ( yield * makeClaudeEnvironment ( { homePath } ) ) . CLAUDE_CONFIG_DIR ) . toBe ( configDir ) ;
55+ expect ( yield * makeClaudeContinuationGroupKey ( { homePath } ) ) . toBe ( `claude:home:${ configDir } ` ) ;
56+ } ) ,
57+ ) ;
58+
59+ it . effect ( "keys continuation by the effective default config directory" , ( ) =>
60+ Effect . gen ( function * ( ) {
61+ const path = yield * Path . Path ;
62+ const defaultConfigDir = path . resolve ( path . join ( NodeOS . homedir ( ) , ".claude" ) ) ;
4663
4764 expect ( yield * makeClaudeContinuationGroupKey ( { homePath : "" } ) ) . toBe (
48- `claude:home:${ resolved } ` ,
65+ `claude:home:${ defaultConfigDir } ` ,
66+ ) ;
67+ expect ( yield * makeClaudeContinuationGroupKey ( { homePath : "~/.claude" } ) ) . toBe (
68+ `claude:home:${ defaultConfigDir } ` ,
69+ ) ;
70+ expect ( yield * makeClaudeContinuationGroupKey ( { homePath : "~" } ) ) . toBe (
71+ `claude:home:${ defaultConfigDir } ` ,
4972 ) ;
5073 } ) ,
5174 ) ;
0 commit comments