MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / parseForSecurity

Function parseForSecurity

src/utils/bash/ast.ts:382–393  ·  view source on GitHub ↗
(
  cmd: string,
)

Source from the content-addressed store, hash-verified

380 * loaded — caller should fall back to conservative behavior.
381 */
382export async function parseForSecurity(
383 cmd: string,
384): Promise<ParseForSecurityResult> {
385 // parseCommandRaw('') returns null (falsy check), so short-circuit here.
386 // Don't use .trim() — it strips Unicode whitespace (\u00a0 etc.) which the
387 // pre-checks in parseForSecurityFromAst need to see and reject.
388 if (cmd === '') return { kind: 'simple', commands: [] }
389 const root = await parseCommandRaw(cmd)
390 return root === null
391 ? { kind: 'parse-unavailable' }
392 : parseForSecurityFromAst(cmd, root)
393}
394
395/**
396 * Same as parseForSecurity but takes a pre-parsed AST root so callers that

Callers 1

preparePermissionMatcherFunction · 0.85

Calls 2

parseCommandRawFunction · 0.85
parseForSecurityFromAstFunction · 0.85

Tested by

no test coverage detected