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

Function hasActualOperatorNodes

src/utils/bash/treeSitterAnalysis.ts:421–443  ·  view source on GitHub ↗
(rootNode: unknown)

Source from the content-addressed store, hash-verified

419 * there are no compound operators and hasBackslashEscapedOperator() can be skipped.
420 */
421export function hasActualOperatorNodes(rootNode: unknown): boolean {
422 const n = rootNode as TreeSitterNode
423
424 function walk(node: TreeSitterNode): boolean {
425 // Check for operator types that indicate compound commands
426 if (node.type === ';' || node.type === '&&' || node.type === '||') {
427 // Verify this is a child of a list or program, not inside a command
428 return true
429 }
430
431 if (node.type === 'list') {
432 // A list node means there are compound operators
433 return true
434 }
435
436 for (const child of node.children) {
437 if (child && walk(child)) return true
438 }
439 return false
440 }
441
442 return walk(n)
443}
444
445/**
446 * Extract dangerous pattern information from the AST.

Callers 1

analyzeCommandFunction · 0.85

Calls 1

walkFunction · 0.70

Tested by

no test coverage detected