ai-code-reviewer-plus 0.1.0 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js ADDED
File without changes
package/package.json CHANGED
@@ -1,75 +1,23 @@
1
1
  {
2
2
  "name": "ai-code-reviewer-plus",
3
- "description": "AI-powered intelligent code reviewer — multi-dimensional semantic analysis, five-tier severity classification, actionable fix suggestions via Claude Code Skill",
4
- "version": "0.1.0",
5
- "bin": {
6
- "ai-code-reviewer-plus": "./dist/cli.js"
7
- },
8
- "main": "dist/index.js",
9
- "module": "dist/index.mjs",
10
- "types": "dist/index.d.ts",
11
- "exports": {
12
- ".": {
13
- "require": "./dist/index.js",
14
- "import": "./dist/index.mjs"
15
- }
16
- },
17
- "files": [
18
- "dist",
19
- ".claude",
20
- ".claude-plugin"
21
- ],
22
- "devDependencies": {
23
- "@eslint-sets/eslint-config": "^6.3.1",
24
- "@types/node": "^26.1.0",
25
- "eslint": "^9.39.4",
26
- "npm-run-all": "^4.1.5",
27
- "prettier": "^3.9.4",
28
- "prettier-config-common": "^1.5.0",
29
- "rm-all": "^1.1.1",
30
- "tsup": "^8.5.1",
31
- "typescript": "^5.9.3",
32
- "vitepress": "^1.6.4",
33
- "vitest": "^3.2.6"
3
+ "version": "1.0.0-beta.0",
4
+ "description": "get os lang",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
34
8
  },
35
- "engines": {
36
- "node": ">=18.20"
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/saqqdy/ai-code-reviewer-plus.git"
37
12
  },
38
- "sideEffects": false,
39
13
  "keywords": [
40
14
  "ai-code-reviewer-plus",
41
- "code-review",
42
- "intelligent-review",
43
- "semantic-analysis",
44
- "pr-review",
45
- "claude-code",
46
- "claude-code-skill"
15
+ "saqqdy"
47
16
  ],
17
+ "author": "saqqdy <https://github.com/saqqdy>",
48
18
  "license": "MIT",
49
- "author": "saqqdy<https://github.com/saqqdy>",
50
- "homepage": "https://github.com/saqqdy/ai-code-reviewer-plus#readme",
51
19
  "bugs": {
52
20
  "url": "https://github.com/saqqdy/ai-code-reviewer-plus/issues"
53
21
  },
54
- "repository": {
55
- "type": "git",
56
- "url": "git+https://github.com/saqqdy/ai-code-reviewer-plus.git"
57
- },
58
- "scripts": {
59
- "build": "run-s clean build:bundle build:types",
60
- "build:bundle": "tsup",
61
- "build:types": "tsc --emitDeclarationOnly",
62
- "clean": "rm-all dist",
63
- "dev": "tsup --watch",
64
- "lint": "eslint --fix .",
65
- "prettier": "prettier --write \"**/*.{js,ts,mjs,yml,json,md}\"",
66
- "test": "vitest run",
67
- "test:watch": "vitest",
68
- "test:coverage": "vitest run --coverage",
69
- "dist": "run-s lint build",
70
- "typecheck": "tsc --noEmit",
71
- "docs:dev": "vitepress dev docs",
72
- "docs:build": "vitepress build docs",
73
- "docs:preview": "vitepress preview docs"
74
- }
75
- }
22
+ "homepage": "https://github.com/saqqdy/ai-code-reviewer-plus#readme"
23
+ }
@@ -1,36 +0,0 @@
1
- # AI Code Reviewer Plus — Claude Code Guide
2
-
3
- ## Project Overview
4
-
5
- AI Code Reviewer 是一个 Claude Code Skill 插件,用 AI 语义理解替代传统 linter。
6
-
7
- ## Architecture
8
-
9
- ```
10
- .claude/skills/ai-code-reviewer-plus/ ← Skill 定义
11
- src/ ← TypeScript 源码
12
- internal/ ← 内部规划文档
13
- ```
14
-
15
- ## Development Commands
16
-
17
- ```bash
18
- pnpm install # 安装依赖
19
- pnpm run build # 构建
20
- pnpm run test # 测试
21
- pnpm run lint # Lint
22
- ```
23
-
24
- ## Key Principles
25
-
26
- 1. **语义级理解** — AI 理解代码意图
27
- 2. **五级严重性** — BLOCKER > HIGH > MEDIUM > LOW > SUGGESTION
28
- 3. **可执行建议** — 给出最小修复代码
29
- 4. **多维度覆盖** — 正确性/安全性/性能/可维护性/最佳实践
30
-
31
- ## Code Style
32
-
33
- - TypeScript 5.9+,strict mode
34
- - 文件命名:kebab-case
35
- - 导出:named exports
36
- - 测试:vitest
@@ -1,77 +0,0 @@
1
- ---
2
- name: ai-code-reviewer-plus
3
- description: AI 智能代码审查 — 多维度语义分析,五级严重性分类,给出可执行的修复建议
4
- version: 0.1.0
5
- triggers:
6
- - /review
7
- - /code-review
8
- - /pr-review
9
- ---
10
-
11
- # AI Code Reviewer Plus — 智能代码审查
12
-
13
- AI Code Reviewer 是一个 Claude Code Skill 插件,用 AI 语义理解替代传统 linter,让每次 PR Review 都有实质性价值。
14
-
15
- > **v0.1.0 范围**:数据采集层 + 规则引擎(10 条基础规则)。AI 语义增强分析由 Claude 在执行 Skill 时实时提供,深度规则库将在 v0.2.0 扩展。
16
-
17
- ## 可用命令
18
-
19
- ### `/review [branch]` — 审查分支 Diff
20
- ### `/review-file <file>` — 审查单个文件
21
- ### `/review-commit <hash>` — 审查单个 Commit
22
-
23
- ## 核心原则
24
-
25
- 1. **语义理解** — 理解代码意图再做判断
26
- 2. **五级分类** — BLOCKER > HIGH > MEDIUM > LOW > SUGGESTION
27
- 3. **证据链** — 每个发现关联具体代码位置
28
- 4. **可执行** — 给出最小修复代码片段
29
-
30
- ## 审查维度
31
-
32
- - **正确性**: 逻辑错误、空指针、边界条件
33
- - **安全性**: XSS、SQL注入、敏感数据泄露
34
- - **性能**: N+1查询、内存泄漏、不必要的重渲染
35
- - **可维护性**: 重复代码、复杂度过高、命名不规范
36
- - **最佳实践**: 框架规范、代码风格、设计模式
37
-
38
- ## 执行流程
39
-
40
- ### Step 1: 数据采集
41
- 使用程序化 API:
42
- ```typescript
43
- import { collectDiff, detectProject, analyzeDiffs } from 'ai-code-reviewer-plus'
44
- ```
45
-
46
- ### Step 2: 多维度分析
47
- 遍历 diff hunks,应用规则库,生成 ReviewFinding
48
-
49
- ### Step 3: 报告生成
50
- 按严重级别分组,Markdown 格式化输出
51
-
52
- ## 输出格式
53
-
54
- ```markdown
55
- # 🔍 Code Review Report
56
-
57
- ## 📊 Review Summary
58
- - Total findings: 12
59
- - 🚫 Blockers: 1
60
- - 🔴 High: 3
61
- ...
62
-
63
- ## 🚫 Blockers (Must Fix)
64
- - 🚫 **SEC-001** [BLOCKER] `src/auth.ts:45`
65
- **XSS vulnerability in user input**
66
- 💡 Sanitize user input before rendering.
67
- ```
68
-
69
- ## 配置文件
70
-
71
- 创建 `.ai-code-reviewer-plus.yml`:
72
- ```yaml
73
- rules:
74
- enabled: [COR-001, SEC-001, PER-001]
75
- excludePaths: [node_modules/, dist/]
76
- maxFindingsPerFile: 20
77
- ```
@@ -1,14 +0,0 @@
1
- {
2
- "name": "ai-code-reviewer-plus",
3
- "description": "AI-powered intelligent code reviewer via Claude Code Skill",
4
- "owner": { "name": "saqqdy", "url": "https://github.com/saqqdy" },
5
- "plugins": [{
6
- "name": "ai-code-reviewer-plus",
7
- "description": "AI-powered intelligent code reviewer via Claude Code Skill",
8
- "version": "0.1.0",
9
- "author": { "name": "saqqdy", "url": "https://github.com/saqqdy" },
10
- "source": "./",
11
- "category": "development",
12
- "tags": ["code-review", "ai", "semantic-analysis", "claude-code-skill"]
13
- }]
14
- }
@@ -1,9 +0,0 @@
1
- {
2
- "name": "ai-code-reviewer-plus",
3
- "version": "0.1.0",
4
- "description": "AI Code Reviewer — AI-powered intelligent code reviewer via Claude Code Skill",
5
- "author": { "name": "saqqdy", "url": "https://github.com/saqqdy" },
6
- "repository": "https://github.com/saqqdy/ai-code-reviewer-plus",
7
- "license": "MIT",
8
- "keywords": ["code-review", "ai", "semantic-analysis", "claude-code-skill"]
9
- }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 saqqdy
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.md DELETED
@@ -1,263 +0,0 @@
1
- # 🚀 AI Code Reviewer Plus
2
-
3
- > AI-powered intelligent code reviewer — multi-dimensional semantic analysis, five-tier severity classification, actionable fix suggestions via Claude Code Skill.
4
-
5
- [![npm version](https://img.shields.io/npm/v/ai-code-reviewer-plus.svg)](https://www.npmjs.com/package/ai-code-reviewer-plus)
6
- [![license](https://img.shields.io/npm/l/ai-code-reviewer-plus.svg)](https://github.com/saqqdy/ai-code-reviewer-plus/blob/master/LICENSE)
7
-
8
- [中文文档](README_CN.md) | [完整文档](https://ai-code-reviewer-plus.vercel.app)
9
-
10
- ---
11
-
12
- ## 🎯 The Problem It Solves
13
-
14
- Traditional linters catch syntax errors, but miss **semantic issues**:
15
-
16
- ```typescript
17
- // Linter: ✅ No syntax errors
18
- function processUser(input: any) {
19
- return input.name.trim() // Runtime: 💥 if input is null
20
- }
21
- ```
22
-
23
- Questions linters can't answer:
24
- - Is this business logic correct?
25
- - Are there security vulnerabilities?
26
- - Will this cause performance issues?
27
- - Is this maintainable?
28
-
29
- | Scenario | Traditional Linter | AI Code Reviewer |
30
- |----------|-------------------|------------------|
31
- | "Is this safe?" | Pattern matching, can't understand context | AI understands business semantics |
32
- | "How to fix?" | Reports error only | Provides executable fix snippets |
33
- | "Is it critical?" | Binary pass/fail | 5-tier severity: BLOCKER → SUGGESTION |
34
-
35
- ---
36
-
37
- ## ✨ The Solution
38
-
39
- AI Code Reviewer uses **semantic understanding** across five dimensions:
40
-
41
- | Dimension | Focus | Example Rules |
42
- |-----------|-------|---------------|
43
- | **Correctness** | Logic errors, null pointers | COR-001: Null check missing |
44
- | **Security** | XSS, SQL injection, data leakage | SEC-001: User input unsanitized |
45
- | **Performance** | N+1 queries, memory leaks | PER-001: Loop inside loop |
46
- | **Maintainability** | Duplicate code, complexity | MAIN-001: Duplicated logic |
47
- | **Best Practices** | Framework conventions | BP-001: Vue reactive rules |
48
-
49
- ## 📊 Five-Tier Severity
50
-
51
- Not all issues are equal. AI Code Reviewer classifies by impact:
52
-
53
- | Level | Icon | Meaning | Action |
54
- |-------|------|---------|--------|
55
- | **BLOCKER** | 🚫 | Must fix, blocks merge | Fix immediately |
56
- | **HIGH** | 🔴 | Critical, breaks functionality | Fix this iteration |
57
- | **MEDIUM** | 🟡 | Important, affects quality | Plan to fix |
58
- | **LOW** | 🟢 | Minor, polish level | Fix later |
59
- | **SUGGESTION** | 💡 | Optional improvement | Optional |
60
-
61
- ---
62
-
63
- ## ✨ Core Features
64
-
65
- ### 🔍 Multi-Dimensional Analysis
66
-
67
- - **Correctness** — Logic errors, null pointers, boundary conditions
68
- - **Security** — XSS, SQL injection, data leakage
69
- - **Performance** — N+1 queries, memory leaks, unnecessary re-renders
70
- - **Maintainability** — Duplicate code, complexity, naming
71
- - **Best Practices** — Framework conventions, code style
72
-
73
- ### 📊 Five-Tier Severity Classification
74
-
75
- | Level | Meaning | Action |
76
- |-------|---------|--------|
77
- | 🚫 BLOCKER | Must fix, blocks merge | Fix immediately |
78
- | 🔴 HIGH | High priority | Fix this iteration |
79
- | 🟡 MEDIUM | Medium priority | Plan to fix |
80
- | 🟢 LOW | Low priority | Fix later |
81
- | 💡 SUGGESTION | Optional improvement | Optional |
82
-
83
- ---
84
-
85
- ## 🚀 Getting Started
86
-
87
- ### Option 1: Claude Code Plugin (Recommended)
88
-
89
- ```bash
90
- # In Claude Code, run:
91
- /plugin marketplace add saqqdy/ai-code-reviewer-plus
92
- /plugin install ai-code-reviewer-plus
93
- ```
94
-
95
- #### Available Commands
96
-
97
- | Command | Description |
98
- |---------|-------------|
99
- | `/review [branch]` | Review diff against target branch |
100
- | `/review-file <file>` | Review a single file |
101
- | `/review-commit <hash>` | Review a specific commit |
102
-
103
- ### Option 2: CLI (Zero-Install)
104
-
105
- ```bash
106
- npx ai-code-reviewer-plus review --branch main
107
- npx ai-code-reviewer-plus review-file src/index.ts
108
- npx ai-code-reviewer-plus review-commit abc1234
109
- ```
110
-
111
- ### Option 3: Programmatic Usage
112
-
113
- ```bash
114
- pnpm add ai-code-reviewer-plus
115
- ```
116
-
117
- ```typescript
118
- import { collectDiff, detectProject } from 'ai-code-reviewer-plus'
119
-
120
- const diffs = await collectDiff({
121
- root: process.cwd(),
122
- targetBranch: 'main'
123
- })
124
-
125
- const project = await detectProject(process.cwd())
126
- ```
127
-
128
- ---
129
-
130
- ## 📋 Example Output
131
-
132
- ```
133
- /review main
134
-
135
- 🔍 Reviewing diff against main...
136
-
137
- 📁 Project: vue3 (typescript)
138
- 📝 Files changed: 3
139
-
140
- 📊 Review Summary:
141
- - Total findings: 12
142
- - 🚫 Blockers: 1
143
- - 🔴 High: 3
144
- - 🟡 Medium: 5
145
- - 🟢 Low: 2
146
- - 💡 Suggestions: 1
147
-
148
- 🚫 Blockers (Must Fix):
149
-
150
- - 🚫 **SEC-001** [BLOCKER] `src/auth.ts:45`
151
- **XSS vulnerability in user input**
152
-
153
- User input is directly rendered without sanitization.
154
- ```typescript
155
- element.innerHTML = userInput // 💥 Dangerous!
156
- ```
157
-
158
- 💡 **Fix**: Sanitize user input before rendering.
159
- ```typescript
160
- element.textContent = sanitize(userInput)
161
- ```
162
-
163
- Confidence: 🟢 High
164
- ```
165
-
166
- ---
167
-
168
- ## 🚀 Quick Experience
169
-
170
- Not sure where to start? Follow this path:
171
-
172
- | Step | Method | Time | What You'll See |
173
- |------|--------|------|-----------------|
174
- | 1 | CLI | 1 min | Diff collection + project detection |
175
- | 2 | API example | 3 min | Programmatic interface + formatting |
176
- | 3 | Skill | 5 min | **Full review** (rules + AI analysis) |
177
-
178
- **Fastest path**: Install the Skill, run `/review main` — one command, full experience.
179
-
180
- ```bash
181
- # Step 1: Try CLI instantly (in any git repo)
182
- npx ai-code-reviewer-plus review --branch main
183
-
184
- # Step 2: Run the API example
185
- git clone https://github.com/saqqdy/ai-code-reviewer-plus.git
186
- cd ai-code-reviewer-plus && pnpm install
187
- npx tsx examples/basic-usage.ts
188
-
189
- # Step 3: Full AI-powered review (in Claude Code)
190
- /plugin install ai-code-reviewer-plus
191
- /review main
192
- ```
193
-
194
- ---
195
-
196
- ## ⚙️ Configuration
197
-
198
- Create `.ai-code-reviewer-plus.yml` to customize:
199
-
200
- ```yaml
201
- rules:
202
- enabled:
203
- - COR-001 # Null pointer check
204
- - SEC-001 # XSS prevention
205
- - SEC-002 # SQL injection
206
- - PER-001 # N+1 query detection
207
- disabled:
208
- - STYLE-001 # Naming conventions
209
- severityOverrides:
210
- SEC-001: BLOCKER # XSS must fix immediately
211
-
212
- excludePaths:
213
- - node_modules/
214
- - dist/
215
- - coverage/
216
-
217
- maxFindingsPerFile: 20
218
- outputFormat: markdown
219
- ```
220
-
221
- ---
222
-
223
- ## 🗂️ Project Structure
224
-
225
- ```
226
- ai-code-reviewer-plus/
227
- ├── .claude/skills/ai-code-reviewer-plus/ # Claude Code Skill
228
- ├── src/ # TypeScript source
229
- │ ├── collectors/ # Git data collectors
230
- │ ├── utils/ # Utilities
231
- │ └── types.ts # Type definitions
232
- ├── docs/ # VitePress docs
233
- └── examples/ # Usage examples
234
- ```
235
-
236
- ---
237
-
238
- ## 🛠️ Development
239
-
240
- ```bash
241
- pnpm install # Install dependencies
242
- pnpm run lint # ESLint check
243
- pnpm run typecheck # TypeScript check
244
- pnpm run test # Run tests
245
- pnpm run build # Build (ESM + CJS)
246
- pnpm run docs:dev # Start docs server
247
- ```
248
-
249
- ---
250
-
251
- ## 📋 Version Roadmap
252
-
253
- | Version | Theme | Status |
254
- |---------|-------|--------|
255
- | v0.1.0 | Core framework + CLI + Skill | ✅ Current |
256
- | v0.2.0 | Rule library + AI analysis engine | 📋 Planned |
257
- | v1.0.0 | Production-ready + Marketplace | 📋 Planned |
258
-
259
- ---
260
-
261
- ## 📄 License
262
-
263
- [MIT](./LICENSE)
@@ -1,31 +0,0 @@
1
- /**
2
- * Pattern-based analyzers — detect common issues via rule matching
3
- *
4
- * Each analyzer scans diff hunks for known anti-patterns and produces
5
- * ReviewFinding objects. The Claude Code Skill adds AI semantic analysis
6
- * on top of these rule-based detections.
7
- */
8
- import type { ParsedDiff, ReviewDimension, ReviewFinding, SeverityLevel } from '../types';
9
- interface Rule {
10
- id: string;
11
- dimension: ReviewDimension;
12
- severity: SeverityLevel;
13
- pattern: RegExp;
14
- title: string;
15
- description: string;
16
- suggestion: string;
17
- fixExample?: string;
18
- }
19
- /**
20
- * Analyze a set of diffs against the rule library
21
- */
22
- export declare function analyzeDiffs(diffs: ParsedDiff[], enabledRules?: string[], disabledRules?: string[], severityOverrides?: Record<string, SeverityLevel>): ReviewFinding[];
23
- /**
24
- * Analyze raw code text against the rule library
25
- */
26
- export declare function analyzeCode(code: string, file: string, enabledRules?: string[], disabledRules?: string[], severityOverrides?: Record<string, SeverityLevel>): ReviewFinding[];
27
- /**
28
- * Get all available rule IDs grouped by dimension
29
- */
30
- export declare function getAvailableRules(): Record<ReviewDimension, Rule[]>;
31
- export {};
@@ -1 +0,0 @@
1
- export {};