rebrand better-clawd and ship initial npm-ready release
This commit is contained in:
@@ -1,16 +1,35 @@
|
||||
import memoize from 'lodash-es/memoize.js'
|
||||
import { existsSync } from 'fs'
|
||||
import { homedir } from 'os'
|
||||
import { join } from 'path'
|
||||
import {
|
||||
getConfiguredProductConfigDir,
|
||||
LEGACY_PRODUCT_CONFIG_DIRNAME,
|
||||
PRODUCT_CONFIG_DIRNAME,
|
||||
} from '../constants/product.js'
|
||||
|
||||
// Memoized: 150+ callers, many on hot paths. Keyed off CLAUDE_CONFIG_DIR so
|
||||
// tests that change the env var get a fresh value without explicit cache.clear.
|
||||
export const getClaudeConfigHomeDir = memoize(
|
||||
(): string => {
|
||||
return (
|
||||
process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), '.claude')
|
||||
).normalize('NFC')
|
||||
const configuredDir = getConfiguredProductConfigDir()
|
||||
if (configuredDir) {
|
||||
return configuredDir.normalize('NFC')
|
||||
}
|
||||
|
||||
const betterClawdDir = join(homedir(), PRODUCT_CONFIG_DIRNAME)
|
||||
const legacyClaudeDir = join(homedir(), LEGACY_PRODUCT_CONFIG_DIRNAME)
|
||||
|
||||
if (existsSync(betterClawdDir)) {
|
||||
return betterClawdDir.normalize('NFC')
|
||||
}
|
||||
if (existsSync(legacyClaudeDir)) {
|
||||
return legacyClaudeDir.normalize('NFC')
|
||||
}
|
||||
|
||||
return betterClawdDir.normalize('NFC')
|
||||
},
|
||||
() => process.env.CLAUDE_CONFIG_DIR,
|
||||
() => getConfiguredProductConfigDir(),
|
||||
)
|
||||
|
||||
export function getTeamsDir(): string {
|
||||
|
||||
Reference in New Issue
Block a user