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

Function scanBashResultForGitOps

src/utils/collapseReadSearch.ts:555–579  ·  view source on GitHub ↗

* Scan a bash tool result for commit SHAs and PR URLs and push them into the * group accumulator. Called only for results whose tool_use_id was recorded * in bashCommands (non-search/read bash).

(
  msg: CollapsibleMessage,
  group: GroupAccumulator,
)

Source from the content-addressed store, hash-verified

553 * in bashCommands (non-search/read bash).
554 */
555function scanBashResultForGitOps(
556 msg: CollapsibleMessage,
557 group: GroupAccumulator,
558): void {
559 if (msg.type !== 'user') return
560 const out = msg.toolUseResult as
561 | { stdout?: string; stderr?: string }
562 | undefined
563 if (!out?.stdout && !out?.stderr) return
564 // git push writes the ref update to stderr — scan both streams.
565 const combined = (out.stdout ?? '') + '\n' + (out.stderr ?? '')
566 for (const c of msg.message.content) {
567 if (c.type !== 'tool_result') continue
568 const command = group.bashCommands?.get(c.tool_use_id)
569 if (!command) continue
570 const { commit, push, branch, pr } = detectGitOperation(command, combined)
571 if (commit) group.commits?.push(commit)
572 if (push) group.pushes?.push(push)
573 if (branch) group.branches?.push(branch)
574 if (pr) group.prs?.push(pr)
575 if (commit || push || branch || pr) {
576 group.gitOpBashCount = (group.gitOpBashCount ?? 0) + 1
577 }
578 }
579}
580
581type GroupAccumulator = {
582 messages: CollapsibleMessage[]

Callers 1

collapseReadSearchGroupsFunction · 0.85

Calls 3

detectGitOperationFunction · 0.85
getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected