feat: add gitai review command for AI-powered pre-commit code review#28
Merged
feat: add gitai review command for AI-powered pre-commit code review#28
Conversation
…eview Add feature proposal that extends gitai's existing diff analysis and AI provider infrastructure to provide actionable code review feedback before committing. Reuses ~70% of existing code (providers, diff engine, TUI, config) for a natural workflow extension. https://claude.ai/code/session_01UnxEijRJMKmRmR4BJ9QqCQ
Implement a new `review` command that analyzes diffs using AI and returns structured code review findings (critical/warning/info) with line references and concrete fix suggestions. New files: - internal/ai/review.go: ReviewService, Finding, ReviewResult types - internal/ai/review_prompt.md: system prompt for code review - internal/tui/review/review_flow.go: TUI flow with spinner + results viewer - cmd/review.go: Cobra command with --format, --hint flags - Tests for parsing, formatting, and grouping logic Supports interactive TUI mode (default) and JSON output (--format json). https://claude.ai/code/session_01UnxEijRJMKmRmR4BJ9QqCQ
Use t.Skip instead of t.Fatal when tiktoken can't download encoding data, since this test has a network dependency. https://claude.ai/code/session_01UnxEijRJMKmRmR4BJ9QqCQ
Adds a `claudecli` provider that wraps the `claude` CLI binary, allowing users with a Claude Code Max subscription to use gitai without a separate API key. Usage: gitai suggest --provider=claude https://claude.ai/code/session_01UnxEijRJMKmRmR4BJ9QqCQ
- Change DefaultModel from "gemini-3-flash" to "gemini-3-flash-preview"
- Wrap exec.LookPath errors with ErrCommandFailed so tests pass
- Fix test expectation typo ("gemini-3-flash-preview-preview")
https://claude.ai/code/session_01UnxEijRJMKmRmR4BJ9QqCQ
- Replace fmt.Errorf with errors.New for constant error strings (SA1006) - Use stdout.String() instead of string(stdout.Bytes()) (S1030) - Remove nil checks before pointer use to fix SA5011 - Wrap json.MarshalIndent error in review_flow.go (wrapcheck) - Suppress unparam for resolveRelativePaths error return https://claude.ai/code/session_01UnxEijRJMKmRmR4BJ9QqCQ
Document the new AI-powered code review command, including usage examples for targeted files, hints, and output format options. https://claude.ai/code/session_01UnxEijRJMKmRmR4BJ9QqCQ
gitai review command for AI-powered pre-commit code review
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add feature proposal that extends gitai's existing diff analysis and AI
provider infrastructure to provide actionable code review feedback before
committing. Reuses ~70% of existing code (providers, diff engine, TUI,
config) for a natural workflow extension.
https://claude.ai/code/session_01UnxEijRJMKmRmR4BJ9QqCQ