MCPcopy Index your code
hub / github.com/codeaashu/claude-code / isClaudeConfigFilePath

Function isClaudeConfigFilePath

src/utils/permissions/filesystem.ts:225–242  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

223
224// Always ask when Claude Code tries to edit its own config files
225function isClaudeConfigFilePath(filePath: string): boolean {
226 if (isClaudeSettingsPath(filePath)) {
227 return true
228 }
229
230 // Check if file is within .claude/commands or .claude/agents directories
231 // using proper path segment validation (not string matching with includes())
232 // pathInWorkingPath now handles case-insensitive comparison to prevent bypasses
233 const commandsDir = join(getOriginalCwd(), '.claude', 'commands')
234 const agentsDir = join(getOriginalCwd(), '.claude', 'agents')
235 const skillsDir = join(getOriginalCwd(), '.claude', 'skills')
236
237 return (
238 pathInWorkingPath(filePath, commandsDir) ||
239 pathInWorkingPath(filePath, agentsDir) ||
240 pathInWorkingPath(filePath, skillsDir)
241 )
242}
243
244// Check if file is the plan file for the current session
245function isSessionPlanFile(absolutePath: string): boolean {

Callers 1

Calls 3

isClaudeSettingsPathFunction · 0.85
getOriginalCwdFunction · 0.85
pathInWorkingPathFunction · 0.85

Tested by

no test coverage detected