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

Function checkPermissionMode

src/tools/BashTool/modeValidation.ts:72–109  ·  view source on GitHub ↗
(
  input: z.infer<typeof BashTool.inputSchema>,
  toolPermissionContext: ToolPermissionContext,
)

Source from the content-addressed store, hash-verified

70 * - 'passthrough' if no mode-specific handling applies
71 */
72export function checkPermissionMode(
73 input: z.infer<typeof BashTool.inputSchema>,
74 toolPermissionContext: ToolPermissionContext,
75): PermissionResult {
76 // Skip if in bypass mode (handled elsewhere)
77 if (toolPermissionContext.mode === 'bypassPermissions') {
78 return {
79 behavior: 'passthrough',
80 message: 'Bypass mode is handled in main permission flow',
81 }
82 }
83
84 // Skip if in dontAsk mode (handled in main permission flow)
85 if (toolPermissionContext.mode === 'dontAsk') {
86 return {
87 behavior: 'passthrough',
88 message: 'DontAsk mode is handled in main permission flow',
89 }
90 }
91
92 const commands = splitCommand_DEPRECATED(input.command)
93
94 // Check each subcommand
95 for (const cmd of commands) {
96 const result = validateCommandForMode(cmd, toolPermissionContext)
97
98 // If any command triggers mode-specific behavior, return that result
99 if (result.behavior !== 'passthrough') {
100 return result
101 }
102 }
103
104 // No mode-specific handling needed
105 return {
106 behavior: 'passthrough',
107 message: 'No mode-specific validation required',
108 }
109}
110
111export function getAutoAllowedCommands(
112 mode: ToolPermissionContext['mode'],

Callers 1

bashToolCheckPermissionFunction · 0.70

Calls 2

splitCommand_DEPRECATEDFunction · 0.85
validateCommandForModeFunction · 0.85

Tested by

no test coverage detected