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

Function parseForSecurity

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

Source from the content-addressed store, hash-verified

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