You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Your Lightweight Local AI Code Review Assistant**
10
+
11
+
Code Gate is an intelligent code review tool seamlessly integrated into your Git workflow. When you run `git commit`, it automatically analyzes staged code changes, utilizing local LLMs (Ollama) or cloud AI services to provide instant feedback on code quality, security suggestions, and optimization plans.
12
+
13
+
## ✨ Features
14
+
15
+
-**🔒 Privacy First**: Native support for Ollama local models.
16
+
-**☁️ Multi-Model Support**: Seamlessly integrates with DeepSeek, OpenAI, Anthropic, Aliyun Qwen, Doubao, and more.
17
+
-**🌍 Multi-Language**: Built-in support for English, Chinese (Simplified & Traditional), Japanese, Korean, German, and French.
18
+
-**⚡️ High Performance**: Intelligent concurrent processing for faster reviews across multiple files.
prompt:'as a senior code reviewer, please review the code changes and provide feedback on security, performance, code style, and test coverage. Highlight any issues or areas for improvement, and offer concrete suggestions with code examples if possible.',
71
109
output: {
72
-
dir: '.review-logs'
73
-
}
74
-
}
75
-
```
110
+
dir:'.review-logs'
111
+
},
112
+
}
113
+
```
114
+
115
+
### API Key Configuration
116
+
117
+
Choose the appropriate configuration scheme based on your project needs. Taking deepseek as an example.
118
+
For security, avoid hardcoding API Keys in the config file.
119
+
120
+
**Option A: Config File**
121
+
122
+
Set in `.code-gate.js`:
123
+
124
+
```javascript
125
+
exportdefault {
126
+
providerOptions: {
127
+
deepseek: {
128
+
// ...other config
129
+
apiKey:'your-deepseek-api-key'
130
+
}
131
+
}
132
+
}
133
+
```
134
+
135
+
**Option B: Git Hook Injection**
136
+
137
+
Export temporarily in `.githooks/pre-commit` or `.husky/pre-commit`:
- `concurrencyFiles`: 并发审查的文件数量(建议云端 API 设置 4-8,本地模型设置 1)
102
-
- `request`: 高级请求配置(见下表“高级配置”)
103
-
104
-
| Provider | 可配置参数 |
157
+
|`provider`|`string`|`'ollama'`| AI Provider. Supports `ollama`, `deepseek`, `openai`, `anthropic`, `aliyun`, `volcengine`, `zhipu`, etc. |
158
+
|`providerOptions`|`object`|`{}`| Specific configurations for each Provider (see table below) |
159
+
|`fileTypes`|`string[]`|`[]`| List of file extensions to review (whitelist). Reviews all files if empty or undefined. |
160
+
|`exclude`|`string[]`|`['**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml']`| List of files or directories to ignore (blacklist), supports glob patterns (e.g., `node_modules/**`). Higher priority than `fileTypes`. |
161
+
|`ui.openBrowser`|`boolean`|`true`| Auto-open browser for report preview |
162
+
|`ui.port`|`number`|`5175`| Preview server port |
163
+
|`limits.maxDiffLines`|`number`|`10000`| Max diff lines per review. Exceeding may cause incomplete review or excessive token usage. |
164
+
|`limits.maxFiles`|`number`|`100`| Max number of files to review |
0 commit comments