fix: rename .claude.json to .openclaude.json with legacy fallback (#582)
* fix: rename .claude.json to .openclaude.json with legacy fallback Rename the global config file from ~/.claude.json to ~/.openclaude.json, following the same migration pattern as the config directory (~/.claude → ~/.openclaude). - getGlobalClaudeFile() now prefers .openclaude.json; falls back to .claude.json only if the legacy file exists and the new one does not - Add .openclaude.json to filesystem permissions allowlist (keep .claude.json for legacy file protection) - Update all comment/string references from ~/.claude.json to ~/.openclaude.json across 12 files New installs get .openclaude.json from the start. Existing users continue using .claude.json until they rename it (or a future explicit migration). * test: add unit tests for getGlobalClaudeFile migration branches Covers the three cases: - new install (neither file exists) → .openclaude.json - existing user (only legacy .claude.json exists) → .claude.json - migrated user (both files exist) → .openclaude.json --------- Co-authored-by: Zartris <14197299+Zartris@users.noreply.github.com>
This commit is contained in:
@@ -21,8 +21,21 @@ export const getGlobalClaudeFile = memoize((): string => {
|
||||
return join(getClaudeConfigHomeDir(), '.config.json')
|
||||
}
|
||||
|
||||
const filename = `.claude${fileSuffixForOauthConfig()}.json`
|
||||
return join(process.env.CLAUDE_CONFIG_DIR || homedir(), filename)
|
||||
const oauthSuffix = fileSuffixForOauthConfig()
|
||||
const configDir = process.env.CLAUDE_CONFIG_DIR || homedir()
|
||||
|
||||
// Default to .openclaude.json. Fall back to .claude.json only if the new
|
||||
// file doesn't exist yet and the legacy one does (same migration pattern
|
||||
// as resolveClaudeConfigHomeDir for the config directory).
|
||||
const newFilename = `.openclaude${oauthSuffix}.json`
|
||||
const legacyFilename = `.claude${oauthSuffix}.json`
|
||||
if (
|
||||
!getFsImplementation().existsSync(join(configDir, newFilename)) &&
|
||||
getFsImplementation().existsSync(join(configDir, legacyFilename))
|
||||
) {
|
||||
return join(configDir, legacyFilename)
|
||||
}
|
||||
return join(configDir, newFilename)
|
||||
})
|
||||
|
||||
const hasInternetAccess = memoize(async (): Promise<boolean> => {
|
||||
|
||||
Reference in New Issue
Block a user