Skip to content

Commit 7e78168

Browse files
authored
Merge pull request #153 from sleet0922/main
繁體中文翻譯完成 #152
2 parents c969722 + 0dfa0e1 commit 7e78168

File tree

6 files changed

+750
-10
lines changed

6 files changed

+750
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# fuck-u-code [![English](https://img.shields.io/badge/Docs-English-red?style=flat-square)](README.md) [![中文](https://img.shields.io/badge/文档-简体中文-blue?style=flat-square)](README_ZH.md) [![Русский](https://img.shields.io/badge/Docs-Русский-blue?style=flat-square)](README_RU.md)
1+
# fuck-u-code [![English](https://img.shields.io/badge/Docs-English-red?style=flat-square)](README.md) [![繁體中文](https://img.shields.io/badge/文檔-繁體中文-blue?style=flat-square)](README_ZH-TW.md) [![中文](https://img.shields.io/badge/文档-简体中文-blue?style=flat-square)](README_ZH.md) [![Русский](https://img.shields.io/badge/Docs-Русский-blue?style=flat-square)](README_RU.md)
22

33
> [!Important]
44
> 📢 Remember this command: `fuck-u-code` - let bad code have nowhere to hide!
@@ -59,7 +59,7 @@ fuck-u-code analyze . -e "**/*.test.ts" # Exclude test files
5959
| `--output <file>` | `-o` | Write to file |
6060
| `--exclude <glob>` | `-e` | Additional exclude patterns |
6161
| `--concurrency <n>` | `-c` | Concurrent workers (default 8) |
62-
| `--locale <lang>` | `-l` | Language: en/zh/ru |
62+
| `--locale <lang>` | `-l` | Language: en/zh/ru/zh-tw |
6363

6464
### AI Code Review
6565

README_RU.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# fuck-u-code [![Русский](https://img.shields.io/badge/Docs-Русский-blue?style=flat-square)](README_RU.md) [![English](https://img.shields.io/badge/Docs-English-red?style=flat-square)](README.md) [![中文](https://img.shields.io/badge/文档-简体中文-blue?style=flat-square)](README_ZH.md)
2+
# fuck-u-code [![Русский](https://img.shields.io/badge/Docs-Русский-blue?style=flat-square)](README_RU.md) [![English](https://img.shields.io/badge/Docs-English-red?style=flat-square)](README.md) [![繁體中文](https://img.shields.io/badge/文檔-繁體中文-blue?style=flat-square)](README_ZH-TW.md) [![中文](https://img.shields.io/badge/文档-简体中文-blue?style=flat-square)](README_ZH.md)
33

44
> [!Important]
55
> 📢 Запомните данную команду: `fuck-u-code` - пусть плохому коду негде будет спрятаться!
@@ -60,7 +60,7 @@ fuck-u-code analyze . -e "**/*.test.ts" # Исключить тесты
6060
| `--output <file>` | `-o` | Записать в файл |
6161
| `--exclude <glob>` | `-e` | Дополнительные шаблоны исключения |
6262
| `--concurrency <n>` | `-c` | Параллельные воркеры (по умолчанию 8) |
63-
| `--locale <lang>` | `-l` | Язык: en/zh/ru |
63+
| `--locale <lang>` | `-l` | Язык: en/zh/ru/zh-tw |
6464

6565
### AI-обзор кода
6666

README_ZH-TW.md

Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
# fuck-u-code [![中文](https://img.shields.io/badge/文檔-繁體中文-blue?style=flat-square)](README_ZH-TW.md) [![English](https://img.shields.io/badge/Docs-English-red?style=flat-square)](README.md) [![Русский](https://img.shields.io/badge/Docs-Русский-blue?style=flat-square)](README_RU.md)
2+
3+
> [!Important]
4+
> 📢 記住這個命令:fuck-u-code - 讓程式不再爛到發指!
5+
6+
一款專門揭露屎山程式的品質分析工具,用犀利又搞笑的方式告訴你:**你的程式到底有多爛**
7+
8+
## 特性
9+
10+
* **多語言支援**: Go, JavaScript, TypeScript, Python, Java, C, C++, Rust, C#, Lua, PHP, Ruby, Swift, Shell(14 種語言)
11+
* **整體評分**: 0~100 分,越高程式品質越好
12+
* **糟糕指數**: 單檔案評分,越高越爛
13+
* **七維度檢測**: 複雜度 / 程式量 / 註解率 / 錯誤處理 / 命名 / 重複度 / 結構
14+
* **AST 解析**: 基於 tree-sitter 的精確語法分析
15+
* **AI 程式審查**: 整合 OpenAI 相容 / Anthropic / DeepSeek / Gemini / Ollama
16+
* **多格式輸出**: 終端彩色 / Markdown / JSON / HTML
17+
* **i18n**: 繁體中文 / 英文 / 俄文
18+
* **靈活配置**: `.fuckucoderc.json` 等多種格式,支援專案級和全域配置
19+
20+
> [!Note]
21+
> 程式分析全程本地運行,不上傳程式,安全無憂。
22+
> AI 審查需要呼叫外部 API 或本地 Ollama。
23+
24+
## 安裝
25+
26+
```bash
27+
npm install -g eff-u-code
28+
```
29+
30+
或原始碼建構:
31+
32+
```bash
33+
git clone https://github.com/Done-0/fuck-u-code.git
34+
cd fuck-u-code && npm install && npm run build
35+
```
36+
37+
## 使用
38+
39+
### 程式分析
40+
41+
```bash
42+
fuck-u-code analyze # 分析目前目錄
43+
fuck-u-code analyze ./src # 分析指定目錄
44+
fuck-u-code analyze . -v # 詳細模式(專案概覽、語言分布、函式級指標)
45+
fuck-u-code analyze . -t 20 # 顯示最差的 20 個檔案
46+
fuck-u-code analyze . -l zh-TW # 繁體中文輸出
47+
fuck-u-code analyze . -f markdown # Markdown 終端渲染
48+
fuck-u-code analyze . -f markdown -o report.md # 匯出 Markdown
49+
fuck-u-code analyze . -f html -o report.html # 匯出 HTML
50+
fuck-u-code analyze . -f json -o report.json # 匯出 JSON
51+
fuck-u-code analyze . -e "**/*.test.ts" # 排除測試檔案
52+
```
53+
54+
| 選項 | 簡寫 | 說明 |
55+
| --- | --- | --- |
56+
| `--verbose` | `-v` | 詳細輸出 |
57+
| `--top <n>` | `-t` | 最差前 N 個檔案(預設 10) |
58+
| `--format <fmt>` | `-f` | 格式: console/markdown/json/html |
59+
| `--output <file>` | `-o` | 輸出到檔案 |
60+
| `--exclude <glob>` | `-e` | 額外排除模式 |
61+
| `--concurrency <n>` | `-c` | 並發數(預設 8) |
62+
| `--locale <lang>` | `-l` | 語言: en/zh/zh-TW/ru |
63+
64+
### AI 程式審查
65+
66+
需先設定 AI 服務商(見 [AI 設定](#ai-設定))。
67+
68+
```bash
69+
fuck-u-code ai-review . -m gpt-4o # OpenAI 相容
70+
fuck-u-code ai-review . -p anthropic -m claude-sonnet-4-5-20250929 # Anthropic
71+
fuck-u-code ai-review . -p ollama -m codellama # 本地 Ollama
72+
fuck-u-code ai-review . -m gpt-4o -t 3 # 審查最差 3 個檔案
73+
fuck-u-code ai-review . -m gpt-4o -f markdown -o review.md # 匯出 Markdown
74+
fuck-u-code ai-review . -b https://your-api.com/v1 -k sk-xxx -m model # 自訂端點
75+
```
76+
77+
| 選項 | 簡寫 | 說明 |
78+
| --- | --- | --- |
79+
| `--model <model>` | `-m` | 模型名稱(必填) |
80+
| `--provider <name>` | `-p` | 服務商: openai/anthropic/deepseek/gemini/ollama |
81+
| `--base-url <url>` | `-b` | 自訂 API 端點 |
82+
| `--api-key <key>` | `-k` | API 金鑰 |
83+
| `--top <n>` | `-t` | 審查最差前 N 個檔案(預設 5) |
84+
| `--format <fmt>` | `-f` | 格式: console/markdown/html |
85+
| `--output <file>` | `-o` | 輸出到檔案 |
86+
| `--verbose` | `-v` | 詳細輸出 |
87+
| `--locale <lang>` | `-l` | 語言: en/zh/zh-TW/ru |
88+
89+
### 設定管理
90+
91+
```bash
92+
fuck-u-code config init # 生成 .fuckucoderc.json
93+
fuck-u-code config show # 檢視目前設定
94+
fuck-u-code config set i18n.locale zh-TW # 設定預設語言
95+
fuck-u-code config set ai.provider openai # 設定 AI 服務商
96+
fuck-u-code config set ai.model gpt-4o # 設定 AI 模型
97+
fuck-u-code config set ai.apiKey sk-xxx # 設定 API 金鑰
98+
```
99+
100+
### 更新
101+
102+
更新 eff-u-code 至最新版本:
103+
104+
```bash
105+
fuck-u-code update # 更新至最新版本
106+
```
107+
108+
將會執行:
109+
- 檢查目前安裝的版本
110+
- 檢查 npm 上的最新版本
111+
- 自動安裝最新版本至全域
112+
113+
### 移除
114+
115+
移除 fuck-u-code 並清理所有本機檔案:
116+
117+
```bash
118+
fuck-u-code uninstall # 移除全域設定、MCP 設定和 npm 套件
119+
```
120+
121+
將會刪除以下內容:
122+
- 全域設定檔(`~/.fuckucoderc.json`
123+
- MCP 伺服器設定(Claude Code、Cursor)
124+
- 全域 npm 套件(`eff-u-code`
125+
126+
## 設定檔
127+
128+
透過設定檔自動搜尋,優先級:專案目錄向上搜尋 > 全域設定 `~/.fuckucoderc.json`
129+
130+
支援格式:`.fuckucoderc.json` / `.yaml` / `.js` / `fuckucode.config.js` / `package.json` 中的 `"fuckucode"` 欄位。
131+
132+
全域設定路徑:macOS/Linux `~/.fuckucoderc.json`,Windows `C:\Users\<使用者名稱>\.fuckucoderc.json`
133+
134+
完整範例(`.fuckucoderc.json`):
135+
136+
```json
137+
{
138+
"exclude": ["**/*.test.ts", "docs/**"],
139+
"include": ["**/*"],
140+
"concurrency": 8,
141+
"verbose": false,
142+
"output": {
143+
"format": "console",
144+
"top": 10,
145+
"maxIssues": 5,
146+
"showDetails": true
147+
},
148+
"metrics": {
149+
"weights": {
150+
"complexity": 0.32,
151+
"duplication": 0.20,
152+
"size": 0.18,
153+
"structure": 0.12,
154+
"error": 0.08,
155+
"documentation": 0.05,
156+
"naming": 0.05
157+
}
158+
},
159+
"ai": {
160+
"enabled": true,
161+
"provider": "openai",
162+
"model": "gpt-4o",
163+
"baseUrl": "https://api.openai.com/v1",
164+
"apiKey": "sk-your-api-key"
165+
},
166+
"i18n": {
167+
"locale": "zh-TW"
168+
}
169+
}
170+
```
171+
172+
## AI 設定
173+
174+
支援 5 種服務商,優先級:命令列引數 > 環境變數 > 設定檔。
175+
176+
| 服務商 | 環境變數 | 範例命令 |
177+
| --- | --- | --- |
178+
| OpenAI 相容 | `OPENAI_API_KEY` `OPENAI_MODEL` `OPENAI_BASE_URL` | `ai-review . -m gpt-4o` |
179+
| Anthropic | `ANTHROPIC_API_KEY` | `ai-review . -p anthropic -m claude-sonnet-4-5-20250929` |
180+
| DeepSeek | `DEEPSEEK_API_KEY` | `ai-review . -p deepseek -m deepseek-chat` |
181+
| Gemini | `GEMINI_API_KEY` | `ai-review . -p gemini -m gemini-pro` |
182+
| Ollama | `OLLAMA_HOST`(可選) | `ai-review . -p ollama -m codellama` |
183+
184+
```bash
185+
# OpenAI 相容
186+
export OPENAI_API_KEY="sk-your-key"
187+
export OPENAI_BASE_URL="https://api.openai.com/v1" # 可選
188+
189+
# 或透過設定檔
190+
fuck-u-code config set ai.provider openai
191+
fuck-u-code config set ai.model gpt-4o
192+
fuck-u-code config set ai.apiKey sk-your-key
193+
fuck-u-code config set ai.baseUrl https://api.openai.com/v1
194+
```
195+
196+
## MCP Server
197+
198+
fuck-u-code 提供 MCP (Model Context Protocol) Server,讓 Claude Code、Cursor、Windsurf 等 AI 工具可以直接呼叫程式品質分析和 AI 程式審查功能。
199+
200+
### 設定方式
201+
202+
```bash
203+
# 全域安裝
204+
npm install -g eff-u-code
205+
206+
# 自動設定(互動式)
207+
fuck-u-code mcp-install
208+
209+
# 或直接指定目標
210+
fuck-u-code mcp-install claude
211+
fuck-u-code mcp-install cursor
212+
```
213+
214+
**Claude Code**`~/.claude.json` 或專案 `.mcp.json`):
215+
216+
```json
217+
{
218+
"mcpServers": {
219+
"fuck-u-code": {
220+
"command": "fuck-u-code-mcp"
221+
}
222+
}
223+
}
224+
```
225+
226+
**Cursor**`.cursor/mcp.json`):
227+
228+
```json
229+
{
230+
"mcpServers": {
231+
"fuck-u-code": {
232+
"command": "fuck-u-code-mcp"
233+
}
234+
}
235+
}
236+
```
237+
238+
**免安裝方式(npx)**
239+
240+
```json
241+
{
242+
"mcpServers": {
243+
"fuck-u-code": {
244+
"command": "npx",
245+
"args": ["-y", "eff-u-code-mcp"]
246+
}
247+
}
248+
}
249+
```
250+
251+
### 可用工具
252+
253+
- **analyze** — 分析程式品質並產生評分報告
254+
- **ai-review** — 對評分最差的檔案執行 AI 程式審查
255+
256+
## 檔案排除
257+
258+
工具自動讀取 `.gitignore`(含子目錄),遵循標準 gitignore 規則。額外排除可用 `--exclude` 或設定檔的 `exclude` 欄位。
259+
260+
## 回饋
261+
262+
> 💬 歡迎參與開放討論
263+
> Discord: <https://discord.gg/9ThNkAFGnT>
264+
265+
## 貢獻
266+
267+
歡迎提 PR,一起最佳化"fuck-u-code" 🚀
268+
269+
## 許可證
270+
271+
MIT
272+
273+
## 聯絡方式
274+
275+
- fenderisfine@gmail.com
276+
- WeChat: l927171598
277+
278+
## 安利一下
279+
280+
- [Value Realization](https://github.com/Done-0/value-realization) — 產品價值發現分析 AI 技能(24小時內10萬+瀏覽,首日100+星)
281+
- [FateSpiral](https://fatespiral.com/) — AI 驅動的多人 RPG,無限世界,無限劇情
282+
- [玄學工坊](https://destinyteller.com/) — AI 賽博算命網站
283+
- [Jank](https://github.com/Done-0/Jank) — Go 語言開源部落格

README_ZH.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# fuck-u-code [![中文](https://img.shields.io/badge/文档-简体中文-blue?style=flat-square)](README_ZH.md) [![English](https://img.shields.io/badge/Docs-English-red?style=flat-square)](README.md) [![Русский](https://img.shields.io/badge/Docs-Русский-blue?style=flat-square)](README_RU.md)
1+
# fuck-u-code [![中文](https://img.shields.io/badge/文档-简体中文-blue?style=flat-square)](README_ZH.md) [![繁體中文](https://img.shields.io/badge/文檔-繁體中文-blue?style=flat-square)](README_ZH-TW.md) [![English](https://img.shields.io/badge/Docs-English-red?style=flat-square)](README.md) [![Русский](https://img.shields.io/badge/Docs-Русский-blue?style=flat-square)](README_RU.md)
22

33
> [!Important]
44
> 📢 记住这个命令:fuck-u-code - 让代码不再烂到发指!
@@ -59,7 +59,7 @@ fuck-u-code analyze . -e "**/*.test.ts" # 排除测试文件
5959
| `--output <file>` | `-o` | 输出到文件 |
6060
| `--exclude <glob>` | `-e` | 额外排除模式 |
6161
| `--concurrency <n>` | `-c` | 并发数(默认 8) |
62-
| `--locale <lang>` | `-l` | 语言: en/zh/ru |
62+
| `--locale <lang>` | `-l` | 语言: en/zh/ru/zh-tw |
6363

6464
### AI 代码审查
6565

src/i18n/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@
55
import en from './locales/en.json' with { type: 'json' };
66
import zh from './locales/zh.json' with { type: 'json' };
77
import ru from './locales/ru.json' with { type: 'json' };
8+
import zhTW from './locales/zh_TW.json' with { type: 'json' };
89

9-
export type Locale = 'en' | 'zh' | 'ru';
10+
export type Locale = 'en' | 'zh' | 'ru' | 'zh_TW';
1011

1112
type TranslationKey = keyof typeof en;
1213
type Translations = Record<TranslationKey, string>;
1314

15+
function assertTranslations<T extends Translations>(translations: T): T {
16+
return translations;
17+
}
18+
1419
const translations: Record<Locale, Translations> = {
15-
en: en as Translations,
16-
zh: zh as Translations,
17-
ru: ru as Translations,
20+
en: assertTranslations(en),
21+
zh: assertTranslations(zh),
22+
ru: assertTranslations(ru),
23+
zh_TW: assertTranslations(zhTW),
1824
};
1925

2026
let currentLocale: Locale = 'en';

0 commit comments

Comments
 (0)