grokkit/cmd/client.go
Greg Gauthier 99ef10b16b
Some checks failed
CI / Test (push) Successful in 34s
CI / Lint (push) Failing after 19s
CI / Build (push) Successful in 20s
refactor(cmd): extract run funcs and add injectable deps for testability
- Introduce newGrokClient and gitRun vars to allow mocking in tests.
- Refactor commit, commitmsg, history, prdescribe, and review cmds into separate run funcs.
- Update docs, lint, and review to use newGrokClient.
- Add comprehensive unit tests in run_test.go covering happy paths, errors, and edge cases.
- Expand grok client tests with SSE server mocks for Stream* methods.
2026-03-02 20:47:16 +00:00

17 lines
409 B
Go

package cmd
import (
"gmgauthier.com/grokkit/internal/git"
"gmgauthier.com/grokkit/internal/grok"
)
// newGrokClient is the factory for the AI client.
// Tests replace this to inject a mock without making real API calls.
var newGrokClient = func() grok.AIClient {
return grok.NewClient()
}
// gitRun is the git command runner.
// Tests replace this to inject controlled git output.
var gitRun = git.Run