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

Function extractRedirectionNodes

src/utils/bash/ParsedCommand.ts:131–149  ·  view source on GitHub ↗
(rootNode: Node)

Source from the content-addressed store, hash-verified

129}
130
131function extractRedirectionNodes(rootNode: Node): RedirectionNode[] {
132 const redirections: RedirectionNode[] = []
133 visitNodes(rootNode, node => {
134 if (node.type === 'file_redirect') {
135 const children = node.children
136 const op = children.find(c => c.type === '>' || c.type === '>>')
137 const target = children.find(c => c.type === 'word')
138 if (op && target) {
139 redirections.push({
140 startIndex: node.startIndex,
141 endIndex: node.endIndex,
142 target: target.text,
143 operator: op.type as '>' | '>>',
144 })
145 }
146 }
147 })
148 return redirections
149}
150
151class TreeSitterParsedCommand implements IParsedCommand {
152 readonly originalCommand: string

Callers 1

Calls 2

visitNodesFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected