managedPath.ts
utils/settings/managedPath.ts
No strong subsystem tag
35
Lines
1095
Bytes
2
Exports
3
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with general runtime concerns. It contains 35 lines, 3 detected imports, and 2 detected exports.
Important relationships
Detected exports
getManagedFilePathgetManagedSettingsDropInDir
Keywords
memoizepathdirectoryprocessfilesmanaged-settingsjoingetplatformplatformgetmanagedfilepath
Detected imports
lodash-es/memoize.jspath../platform.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
import memoize from 'lodash-es/memoize.js'
import { join } from 'path'
import { getPlatform } from '../platform.js'
/**
* Get the path to the managed settings directory based on the current platform.
*/
export const getManagedFilePath = memoize(function (): string {
// Allow override for testing/demos (Ant-only, eliminated from external builds)
if (
process.env.USER_TYPE === 'ant' &&
process.env.CLAUDE_CODE_MANAGED_SETTINGS_PATH
) {
return process.env.CLAUDE_CODE_MANAGED_SETTINGS_PATH
}
switch (getPlatform()) {
case 'macos':
return '/Library/Application Support/ClaudeCode'
case 'windows':
return 'C:\\Program Files\\ClaudeCode'
default:
return '/etc/claude-code'
}
})
/**
* Get the path to the managed-settings.d/ drop-in directory.
* managed-settings.json is merged first (base), then files in this directory
* are merged alphabetically on top (drop-ins override base, later files win).
*/
export const getManagedSettingsDropInDir = memoize(function (): string {
return join(getManagedFilePath(), 'managed-settings.d')
})