Author: UncleSam
Project open source address: github.com/unclesam-ly/git-air
01. The cause of the incident: AI wrote code for a while, so review the crematorium
Nowadays, programmers basically cannot do without AI assistance (Cursor, Copilot, various large model plug-ins) when writing code.
Hundreds of lines of code can be generated in a few seconds, and the development speed is indeed fast.
** But I don't know if you have found a pain point that is getting headaches: **
- ** The code written by AI "looks perfect"**: The typesetting is neat, the annotations are beautiful, and the grammar is flawless, making it easy for people to create blind trust;
- ** When I ask the AI that generates "is there a Bug", it will only sell and boast. **: In the same conversation context, the AI that generates the code often has strong "thinking inertia" and "narcissistic illusions". You ask it "Is this written correctly?", it confidently replies with a high probability,"The code is completely correct and the logic is very strong!";
- ** It is extremely difficult for the human eye to discover those hidden dark pits **: For example, in a hidden `if err != Mutex Leak was missed when nil 'return' in advance, a lack of 'recover' within the coroutine, frequent creation of unclosed connections in the circulation body... these problems are easily missed when scanned with the naked eye.
This falls into an embarrassing endless loop: **AI is responsible for mass-producing code, and human programmers are responsible for wiping up the mess when online crashes in the middle of the night. **
I was thinking: ** Can I have an independent, cold, and completely stripped of the chat context of a "third-party censor" who would use a magnifying glass to strictly criticize me before preparing to submit locally? **
So I spent the afternoon writing this lightweight command-line toy in Go--** git-air **.
02. What's this little toy for?
Simply put, it's like a senior architect colleague sitting next to your workstation with a slightly sarcastic mouth but a very poisonous look.
It doesn't care at all whether you wrote it hand-written or AI-generated, and is not disturbed by any conversation context. After you finish changing the code at the terminal, type one line directly on the command line:
bash
git air
It will automatically grab the code differences you just changed ('git diff '), scan it from the strictest perspective, and spit out the review opinions word by word on the terminal:
text
[git-air] Code review... (Engine: gemini / gemini-3.7-flash)
─────────────────────────────────────────────────────────────────
####Change Overview
Added Redis caching logic to the user login interface.
####Detailed review opinions
- [BLOCKER] internal/service/user.go:45 -Fatal flaw: SQL strings are directly spliced in the loop, which poses an obvious risk of SQL injection and does not perform parameter verification.
//Repair code
db.Where("username = ? ", inputName).First(&user)
- [WARNING] internal/service/user.go:82 -Potential hidden danger: After querying Redis fails, the error is ignored directly. When cache breaks down, all traffic will be pushed to the database.
- [WARNING] internal/service/user.go:103 -Resource leakage: The code generated by the AI does not call defer unlock() in the early return branch, posing a concurrent deadlock hazard.
####Review conclusion
- Conclusion: [REJECT]
- Rating: 60 / 100
─────────────────────────────────────────────────────────────────
There is no hypocritical courtesy, no "overall writing is awesome", ** If there are bugs, say bugs, and directly provide code patches before and after modifications **.
Use the magnifying glass of AI to review the code generated by AI-this is called "defeating magic with magic".
03. What are its interesting characteristics?
Although it is just a small toy with a few hundred lines of Go code, although the sparrow is small, it has everything:
1. Light as air (extremely fast single binary)
Written purely in Go, there are no complex background daemons, and there is no need to install Docker. After installing it with 'go install', it will be an independent gadget. Typing the command is as easy as typing 'git status'.
2. Don't waste your Token (intelligent noise reduction)
Normally,'git diff' often brings out a lot of disgusting files, such as tens of thousands of lines of 'go.sum','package-lock.json', and automatically generated '*.pb.go'.
'git-air' will automatically filter out these spam lock files and send only the real handwritten core code to the AI, saving money and time.
3. All large models on the market can be used
You can use any model you want. It has the official addresses of almost all large models at home and abroad preset, and you can cut it with one command:
- Want to be fast and cheap: Use Google Gemini**;
- Want to see deep logical reasoning: use DeepSeek;
- Afraid of spreading the code to the external network: Use the local ** Olama **(100% offline privacy review, you can run even if the network is disconnected);
- There are also Claude-3.7, Grok, Tongyi Qwen, Intelligent Spectrum GLM, Kimi, OpenAI, use whichever you want.
4. Team rules (. airrules)
You throw a file called . airrules in the root directory of the project and write down your team's iron rules (such as: "No naked writing of SQL","All concurrency must pass Context").
AI will use your exclusive family rules to block the code during review, which is especially suitable for unifying the code style for the team.
04. How to play?
As long as you have a Go environment locally, there are two steps:
###Step 1: Install
bash
go install github.com/unclesam-ly/git-air@latest
###Step 2: Configure a Key
For example, using Gemini (recommended, fast speed):
bash
git air config set --provider gemini --key "Your API_KEY"
Or use DeepSeek:
bash
git air config set --provider deepseek --key "Your KEY" --model deepseek-chat
###Step 3: Run directly!
Feel free to enter any of your Git project directories:
bash
#Review the currently modified code
git air
#or review the Commit that was just submitted
git air HEAD~1
#Or just review a document
git air internal/service/chat.go
Even if you type 'git air hook install', it will automatically become Git's submission interception access control, and you will be reminded directly on the terminal when you submit a high-risk code.
05. conclusion
I wrote this thing not to engage in some grand "enterprise digital revolution", but purely to allow myself to have a calm and objective "gatekeeper", write less low-level bugs, and add less meaningless classes while enjoying the efficiency of AI writing code.
By the way, he also drew a cute mascot Logo for it: a Go gopher wearing flying goggles, a small cloak, and holding a magnifying glass to find bugs.
The code is completely open source on GitHub, with only a few hundred lines of Go code in total, and the architecture is very clean. If you are also a heavy user of the command line, you are welcome to use it as a toy to play with. Click Star or propose a PR to change it together!
**GitHub Warehouse **:https://github.com/unclesam-ly/git-air


Comments & Discussions