MCPcopy
hub / github.com/Doorman11991/smallcode / shouldInjectGitContext

Function shouldInjectGitContext

src/session/git_context.js:11–22  ·  view source on GitHub ↗

* Detect if the user's message implies they want context about recent changes.

(message)

Source from the content-addressed store, hash-verified

9 * Detect if the user's message implies they want context about recent changes.
10 */
11function shouldInjectGitContext(message) {
12 const triggers = [
13 /\b(fix|debug|broken|failing|error|bug)\b.*\b(test|spec|check)\b/i,
14 /\bwhat('s| is| did).*chang/i,
15 /\brecent (change|commit|edit|update)/i,
16 /\bfix (the|this|my)\b/i,
17 /\bwhy (is|does|did).*fail/i,
18 /\brevert\b/i,
19 /\blast (change|commit|edit)/i,
20 ];
21 return triggers.some(re => re.test(message));
22}
23
24/**
25 * Get recent git diff context (staged + unstaged changes).

Callers 1

runAgentLoopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected