@corbat-tech/coding-standards-mcp 1.1.0 → 2.1.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/README.md +253 -110
- package/dist/analysis/code-analyzer.d.ts +45 -0
- package/dist/analysis/code-analyzer.d.ts.map +1 -0
- package/dist/analysis/code-analyzer.js +534 -0
- package/dist/analysis/code-analyzer.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +25 -6
- package/dist/config.js.map +1 -1
- package/dist/logger.d.ts +20 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +35 -0
- package/dist/logger.js.map +1 -1
- package/dist/resources.d.ts.map +1 -1
- package/dist/resources.js +8 -0
- package/dist/resources.js.map +1 -1
- package/dist/tools/definitions.d.ts +40 -1
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +68 -10
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/handlers/get-context.d.ts.map +1 -1
- package/dist/tools/handlers/get-context.js +115 -0
- package/dist/tools/handlers/get-context.js.map +1 -1
- package/dist/tools/handlers/index.d.ts +1 -0
- package/dist/tools/handlers/index.d.ts.map +1 -1
- package/dist/tools/handlers/index.js +1 -0
- package/dist/tools/handlers/index.js.map +1 -1
- package/dist/tools/handlers/validate.d.ts +4 -1
- package/dist/tools/handlers/validate.d.ts.map +1 -1
- package/dist/tools/handlers/validate.js +37 -42
- package/dist/tools/handlers/validate.js.map +1 -1
- package/dist/tools/handlers/verify.d.ts +38 -0
- package/dist/tools/handlers/verify.d.ts.map +1 -0
- package/dist/tools/handlers/verify.js +172 -0
- package/dist/tools/handlers/verify.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +5 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +14 -7
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
|
|
23
23
|
**Works with GitHub Copilot, Continue, Cline, Tabnine, Amazon Q, and [25+ more tools](docs/compatibility.md)**
|
|
24
24
|
|
|
25
|
+
⚡ **Try it in 30 seconds** — just add the config below and start coding.
|
|
26
|
+
|
|
25
27
|
</div>
|
|
26
28
|
|
|
27
29
|
---
|
|
@@ -32,13 +34,16 @@ AI-generated code works, but rarely passes code review:
|
|
|
32
34
|
|
|
33
35
|
| Without Corbat | With Corbat |
|
|
34
36
|
|----------------|-------------|
|
|
37
|
+
| Methods with 50+ lines | Max 20 lines per method |
|
|
35
38
|
| No dependency injection | Proper DI with interfaces |
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
| God classes,
|
|
39
|
-
|
|
|
39
|
+
| `throw new Error('failed')` | Custom exceptions with context |
|
|
40
|
+
| Missing or minimal tests | Tests included, TDD approach |
|
|
41
|
+
| God classes, mixed concerns | SOLID principles, clean layers |
|
|
42
|
+
| Works on my machine | Production-ready patterns |
|
|
43
|
+
|
|
44
|
+
**Sound familiar?** You spend more time fixing AI code than writing it yourself.
|
|
40
45
|
|
|
41
|
-
**
|
|
46
|
+
**Corbat MCP solves this** by injecting your team's coding standards *before* the AI generates code — not after.
|
|
42
47
|
|
|
43
48
|
---
|
|
44
49
|
|
|
@@ -70,140 +75,252 @@ AI-generated code works, but rarely passes code review:
|
|
|
70
75
|
|
|
71
76
|
> [Complete setup guide](docs/setup.md) for all 25+ tools
|
|
72
77
|
|
|
73
|
-
**3. Done!** Corbat auto-detects your stack.
|
|
78
|
+
**3. Done!** Corbat auto-detects your stack and applies the right standards.
|
|
74
79
|
|
|
75
|
-
|
|
76
|
-
You: "Create a payment service"
|
|
80
|
+
> **Zero overhead.** Corbat runs locally and adds ~50ms to detect your stack. After that, it's just context for the AI.
|
|
77
81
|
|
|
78
|
-
|
|
79
|
-
✓ Profile: java-spring-backend
|
|
80
|
-
✓ Architecture: Hexagonal + DDD
|
|
81
|
-
✓ Testing: TDD, 80%+ coverage
|
|
82
|
-
```
|
|
82
|
+
> **Fully customizable.** Don't like a rule? Override it in `.corbat.json`. [Jump to customization →](#customize)
|
|
83
83
|
|
|
84
84
|
---
|
|
85
85
|
|
|
86
|
-
##
|
|
87
|
-
|
|
88
|
-
Tested across 20 real-world scenarios:
|
|
89
|
-
|
|
90
|
-
| Metric | Without | With | Impact |
|
|
91
|
-
|--------|:-------:|:----:|:------:|
|
|
92
|
-
| **Quality Score** | 63/100 | 93/100 | +48% |
|
|
93
|
-
| **Code Smells** | 43 | 0 | -100% |
|
|
94
|
-
| **SOLID Compliance** | 50% | 89% | +78% |
|
|
95
|
-
| **Tests Generated** | 219 | 558 | +155% |
|
|
96
|
-
| **SonarQube** | FAIL | PASS | Fixed |
|
|
97
|
-
|
|
98
|
-
[View detailed benchmark report with code samples](docs/comparison-tests/RESULTS-REPORT.md)
|
|
99
|
-
|
|
100
|
-
---
|
|
86
|
+
## See It In Action
|
|
101
87
|
|
|
102
|
-
|
|
88
|
+
```
|
|
89
|
+
You: "Create a user registration service"
|
|
90
|
+
```
|
|
103
91
|
|
|
104
|
-
|
|
92
|
+
**Without Corbat**, you get:
|
|
105
93
|
|
|
106
94
|
```typescript
|
|
107
95
|
class UserService {
|
|
108
|
-
private users: User
|
|
96
|
+
private users: Map<string, User> = new Map();
|
|
109
97
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
createUser(name: string, email: string) {
|
|
115
|
-
const user = { id: Date.now(), name, email };
|
|
116
|
-
this.users.push(user);
|
|
98
|
+
register(name: string, email: string, password: string) {
|
|
99
|
+
if (!name || !email || !password) throw new Error('Invalid input');
|
|
100
|
+
const user = { id: crypto.randomUUID(), name, email, password };
|
|
101
|
+
this.users.set(user.id, user);
|
|
117
102
|
return user;
|
|
118
103
|
}
|
|
119
104
|
}
|
|
120
|
-
//
|
|
105
|
+
// ✗ Hardcoded storage ✗ Password in plain text ✗ Generic error ✗ No tests
|
|
121
106
|
```
|
|
122
107
|
|
|
123
|
-
|
|
108
|
+
**With Corbat**, you get:
|
|
124
109
|
|
|
125
110
|
```typescript
|
|
111
|
+
// Domain
|
|
126
112
|
interface UserRepository {
|
|
127
|
-
|
|
128
|
-
|
|
113
|
+
save(user: User): Promise<void>;
|
|
114
|
+
findByEmail(email: string): Promise<User | null>;
|
|
129
115
|
}
|
|
130
116
|
|
|
131
|
-
class
|
|
117
|
+
class EmailAlreadyExistsError extends Error {
|
|
118
|
+
constructor(email: string) {
|
|
119
|
+
super(`Email already registered: ${email}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Application
|
|
124
|
+
class RegisterUserUseCase {
|
|
132
125
|
constructor(
|
|
133
126
|
private readonly repository: UserRepository,
|
|
134
|
-
private readonly
|
|
127
|
+
private readonly hasher: PasswordHasher
|
|
135
128
|
) {}
|
|
136
129
|
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
140
|
-
return user;
|
|
141
|
-
}
|
|
130
|
+
async execute(input: RegisterUserInput): Promise<User> {
|
|
131
|
+
const existing = await this.repository.findByEmail(input.email);
|
|
132
|
+
if (existing) throw new EmailAlreadyExistsError(input.email);
|
|
142
133
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
input.email.toLowerCase()
|
|
149
|
-
);
|
|
150
|
-
this.repository.save(user);
|
|
134
|
+
const user = User.create({
|
|
135
|
+
...input,
|
|
136
|
+
password: await this.hasher.hash(input.password)
|
|
137
|
+
});
|
|
138
|
+
await this.repository.save(user);
|
|
151
139
|
return user;
|
|
152
140
|
}
|
|
153
141
|
}
|
|
154
|
-
// ✓
|
|
142
|
+
// ✓ Repository interface ✓ Password hashing ✓ Custom error ✓ Testable
|
|
155
143
|
```
|
|
156
144
|
|
|
145
|
+
```typescript
|
|
146
|
+
// Test included
|
|
147
|
+
describe('RegisterUserUseCase', () => {
|
|
148
|
+
const repository = { save: vi.fn(), findByEmail: vi.fn() };
|
|
149
|
+
const hasher = { hash: vi.fn() };
|
|
150
|
+
const useCase = new RegisterUserUseCase(repository, hasher);
|
|
151
|
+
|
|
152
|
+
beforeEach(() => vi.clearAllMocks());
|
|
153
|
+
|
|
154
|
+
it('should hash password before saving', async () => {
|
|
155
|
+
repository.findByEmail.mockResolvedValue(null);
|
|
156
|
+
hasher.hash.mockResolvedValue('hashed_password');
|
|
157
|
+
|
|
158
|
+
await useCase.execute({ name: 'John', email: 'john@test.com', password: 'secret' });
|
|
159
|
+
|
|
160
|
+
expect(hasher.hash).toHaveBeenCalledWith('secret');
|
|
161
|
+
expect(repository.save).toHaveBeenCalledWith(
|
|
162
|
+
expect.objectContaining({ password: 'hashed_password' })
|
|
163
|
+
);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('should reject duplicate emails', async () => {
|
|
167
|
+
repository.findByEmail.mockResolvedValue({ id: '1', email: 'john@test.com' });
|
|
168
|
+
|
|
169
|
+
await expect(
|
|
170
|
+
useCase.execute({ name: 'John', email: 'john@test.com', password: 'secret' })
|
|
171
|
+
).rejects.toThrow(EmailAlreadyExistsError);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**This is what "passes code review on the first try" looks like.**
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## What Corbat Enforces
|
|
181
|
+
|
|
182
|
+
Corbat injects these guardrails before code generation:
|
|
183
|
+
|
|
184
|
+
### Code Quality
|
|
185
|
+
| Rule | Why It Matters |
|
|
186
|
+
|------|----------------|
|
|
187
|
+
| **Max 20 lines per method** | Readable, testable, single-purpose functions |
|
|
188
|
+
| **Max 200 lines per class** | Single Responsibility Principle |
|
|
189
|
+
| **Meaningful names** | No `data`, `info`, `temp`, `x` |
|
|
190
|
+
| **No magic numbers** | Constants with descriptive names |
|
|
191
|
+
|
|
192
|
+
### Architecture
|
|
193
|
+
| Rule | Why It Matters |
|
|
194
|
+
|------|----------------|
|
|
195
|
+
| **Interfaces for dependencies** | Testable code, easy mocking |
|
|
196
|
+
| **Layer separation** | Domain logic isolated from infrastructure |
|
|
197
|
+
| **Hexagonal/Clean patterns** | Framework-agnostic business rules |
|
|
198
|
+
|
|
199
|
+
### Error Handling
|
|
200
|
+
| Rule | Why It Matters |
|
|
201
|
+
|------|----------------|
|
|
202
|
+
| **Custom exceptions** | `UserNotFoundError` vs `Error('not found')` |
|
|
203
|
+
| **Error context** | Include IDs, values, state in errors |
|
|
204
|
+
| **No empty catches** | Every error handled or propagated |
|
|
205
|
+
|
|
206
|
+
### Security (verified against OWASP Top 10)
|
|
207
|
+
| Rule | Why It Matters |
|
|
208
|
+
|------|----------------|
|
|
209
|
+
| **Input validation** | Reject bad data at boundaries |
|
|
210
|
+
| **No hardcoded secrets** | Environment variables only |
|
|
211
|
+
| **Parameterized queries** | Prevent SQL injection |
|
|
212
|
+
| **Output encoding** | Prevent XSS |
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Benchmark Results v3.0
|
|
217
|
+
|
|
218
|
+
We evaluated Corbat across **15 real-world scenarios** in 6 languages.
|
|
219
|
+
|
|
220
|
+
### The Key Insight
|
|
221
|
+
|
|
222
|
+
Corbat generates **focused, production-ready code** — not verbose boilerplate:
|
|
223
|
+
|
|
224
|
+
| Scenario | With Corbat | Without Corbat | What This Means |
|
|
225
|
+
|----------|:-----------:|:--------------:|-----------------|
|
|
226
|
+
| Kotlin Coroutines | 236 lines | 1,923 lines | Same functionality, 8x less to maintain |
|
|
227
|
+
| Java Hexagonal | 623 lines | 2,740 lines | Clean architecture without the bloat |
|
|
228
|
+
| Go Clean Arch | 459 lines | 2,012 lines | Idiomatic Go, not Java-in-Go |
|
|
229
|
+
| TypeScript NestJS | 395 lines | 1,554 lines | Right patterns, right size |
|
|
230
|
+
|
|
231
|
+
**This isn't "less code for less code's sake"** — it's the right abstractions without over-engineering.
|
|
232
|
+
|
|
233
|
+
### Value Metrics
|
|
234
|
+
|
|
235
|
+
When we measure what actually matters for production code:
|
|
236
|
+
|
|
237
|
+
| Metric | Result | What It Means |
|
|
238
|
+
|--------|:------:|---------------|
|
|
239
|
+
| **Code Reduction** | 67% | Less to maintain, review, and debug |
|
|
240
|
+
| **Security** | 100% | Zero vulnerabilities across all scenarios |
|
|
241
|
+
| **Maintainability** | 93% win | Easier to understand and modify |
|
|
242
|
+
| **Architecture Efficiency** | 87% win | Better patterns per line of code |
|
|
243
|
+
| **Cognitive Load** | -59% | Faster onboarding for new developers |
|
|
244
|
+
|
|
245
|
+
📊 [Detailed value analysis](benchmarks/v3/CORBAT_VALUE_REPORT.md)
|
|
246
|
+
|
|
247
|
+
### Security: Zero Vulnerabilities Detected
|
|
248
|
+
|
|
249
|
+
Every scenario was analyzed using pattern detection for OWASP Top 10 vulnerabilities:
|
|
250
|
+
|
|
251
|
+
- ✓ No SQL/NoSQL injection patterns
|
|
252
|
+
- ✓ No XSS vulnerabilities
|
|
253
|
+
- ✓ No hardcoded credentials
|
|
254
|
+
- ✓ Input validation at all boundaries
|
|
255
|
+
- ✓ Proper error messages (no stack traces to users)
|
|
256
|
+
|
|
257
|
+
### Languages & Patterns Tested
|
|
258
|
+
|
|
259
|
+
| Language | Scenarios | Patterns |
|
|
260
|
+
|:--------:|:---------:|:---------|
|
|
261
|
+
| ☕ Java | 5 | Spring Boot, DDD Aggregates, Hexagonal, Kafka Events, Saga |
|
|
262
|
+
| 📘 TypeScript | 4 | Express REST, NestJS Clean, React Components, Next.js Full-Stack |
|
|
263
|
+
| 🐍 Python | 2 | FastAPI CRUD, Repository Pattern |
|
|
264
|
+
| 🐹 Go | 2 | HTTP Handlers, Clean Architecture |
|
|
265
|
+
| 🦀 Rust | 1 | Axum with Repository Trait |
|
|
266
|
+
| 🟣 Kotlin | 1 | Coroutines + Strategy Pattern |
|
|
267
|
+
|
|
268
|
+
📖 [Full benchmark methodology](benchmarks/v3/BENCHMARK_REPORT_V3.md) · [Value analysis](benchmarks/v3/CORBAT_VALUE_REPORT.md)
|
|
269
|
+
|
|
157
270
|
---
|
|
158
271
|
|
|
159
272
|
## Built-in Profiles
|
|
160
273
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
|
164
|
-
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
| `
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
### Architecture Patterns Enforced
|
|
180
|
-
|
|
181
|
-
- **Hexagonal Architecture** — Ports & Adapters, infrastructure isolation
|
|
182
|
-
- **Domain-Driven Design** — Aggregates, Value Objects, Domain Events
|
|
183
|
-
- **SOLID Principles** — Single responsibility, dependency inversion
|
|
184
|
-
- **Clean Code** — Max 20 lines/method, meaningful names, no magic numbers
|
|
185
|
-
- **Error Handling** — Custom exceptions with context, no generic catches
|
|
186
|
-
- **Testing** — TDD workflow, unit + integration, mocking strategies
|
|
274
|
+
Corbat auto-detects your stack and applies the right standards:
|
|
275
|
+
|
|
276
|
+
| Profile | Stack | What You Get |
|
|
277
|
+
|---------|-------|--------------|
|
|
278
|
+
| `java-spring-backend` | Java 21 + Spring Boot 3 | Hexagonal + DDD, TDD with 80%+ coverage |
|
|
279
|
+
| `kotlin-spring` | Kotlin + Spring Boot 3 | Coroutines, Kotest + MockK |
|
|
280
|
+
| `nodejs` | Node.js + TypeScript | Clean Architecture, Vitest |
|
|
281
|
+
| `nextjs` | Next.js 14+ | App Router patterns, Server Components |
|
|
282
|
+
| `react` | React 18+ | Hooks, Testing Library, accessible components |
|
|
283
|
+
| `vue` | Vue 3.5+ | Composition API, Vitest |
|
|
284
|
+
| `angular` | Angular 19+ | Standalone components, Jest |
|
|
285
|
+
| `python` | Python + FastAPI | Async patterns, pytest |
|
|
286
|
+
| `go` | Go 1.22+ | Idiomatic Go, table-driven tests |
|
|
287
|
+
| `rust` | Rust + Axum | Ownership patterns, proptest |
|
|
288
|
+
| `csharp-dotnet` | C# 12 + ASP.NET Core 8 | Clean + CQRS, xUnit |
|
|
289
|
+
| `flutter` | Dart 3 + Flutter | BLoC/Riverpod, widget tests |
|
|
290
|
+
|
|
291
|
+
**Auto-detection:** Corbat reads `pom.xml`, `package.json`, `go.mod`, `Cargo.toml`, etc.
|
|
187
292
|
|
|
188
293
|
---
|
|
189
294
|
|
|
190
|
-
##
|
|
295
|
+
## When to Use Corbat
|
|
296
|
+
|
|
297
|
+
| Use Case | Why Corbat Helps |
|
|
298
|
+
|----------|------------------|
|
|
299
|
+
| **Starting a new project** | Correct architecture from day one |
|
|
300
|
+
| **Teams with juniors** | Everyone produces senior-level patterns |
|
|
301
|
+
| **Strict code review standards** | AI code meets your bar automatically |
|
|
302
|
+
| **Regulated industries** | Consistent security and documentation |
|
|
303
|
+
| **Legacy modernization** | New code follows modern patterns |
|
|
191
304
|
|
|
192
|
-
###
|
|
305
|
+
### When Corbat Might Not Be Needed
|
|
193
306
|
|
|
194
|
-
|
|
307
|
+
- Quick prototypes where quality doesn't matter
|
|
308
|
+
- One-off scripts you'll throw away
|
|
309
|
+
- Learning projects where you want to make mistakes
|
|
195
310
|
|
|
196
|
-
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Customize
|
|
197
314
|
|
|
198
|
-
###
|
|
315
|
+
### Option 1: Interactive Setup
|
|
199
316
|
|
|
200
317
|
```bash
|
|
201
318
|
npx corbat-init
|
|
202
319
|
```
|
|
203
320
|
|
|
204
|
-
|
|
321
|
+
Detects your stack and generates a `.corbat.json` with sensible defaults.
|
|
205
322
|
|
|
206
|
-
### Manual
|
|
323
|
+
### Option 2: Manual Configuration
|
|
207
324
|
|
|
208
325
|
Create `.corbat.json` in your project root:
|
|
209
326
|
|
|
@@ -214,54 +331,80 @@ Create `.corbat.json` in your project root:
|
|
|
214
331
|
"pattern": "hexagonal",
|
|
215
332
|
"layers": ["domain", "application", "infrastructure", "api"]
|
|
216
333
|
},
|
|
217
|
-
"ddd": {
|
|
218
|
-
"aggregates": true,
|
|
219
|
-
"valueObjects": true,
|
|
220
|
-
"domainEvents": true
|
|
221
|
-
},
|
|
222
334
|
"quality": {
|
|
223
335
|
"maxMethodLines": 20,
|
|
224
336
|
"maxClassLines": 200,
|
|
225
337
|
"minCoverage": 80
|
|
226
338
|
},
|
|
227
339
|
"rules": {
|
|
228
|
-
"always": [
|
|
229
|
-
|
|
340
|
+
"always": [
|
|
341
|
+
"Use records for DTOs",
|
|
342
|
+
"Prefer Optional over null"
|
|
343
|
+
],
|
|
344
|
+
"never": [
|
|
345
|
+
"Use field injection",
|
|
346
|
+
"Catch generic Exception"
|
|
347
|
+
]
|
|
230
348
|
}
|
|
231
349
|
}
|
|
232
350
|
```
|
|
233
351
|
|
|
352
|
+
### Option 3: Use a Template
|
|
353
|
+
|
|
354
|
+
**[Browse 14 ready-to-use templates](docs/templates.md)** for Java, Python, Node.js, React, Go, Rust, and more.
|
|
355
|
+
|
|
234
356
|
---
|
|
235
357
|
|
|
236
358
|
## How It Works
|
|
237
359
|
|
|
238
360
|
```
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
361
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
362
|
+
│ Your Prompt │────▶│ Corbat MCP │────▶│ AI + Rules │
|
|
363
|
+
└─────────────┘ └──────┬──────┘ └─────────────┘
|
|
364
|
+
│
|
|
365
|
+
┌──────────────┼──────────────┐
|
|
366
|
+
▼ ▼ ▼
|
|
367
|
+
┌────────────┐ ┌────────────┐ ┌────────────┐
|
|
368
|
+
│ 1. Detect │ │ 2. Load │ │ 3. Inject │
|
|
369
|
+
│ Stack │ │ Profile │ │ Guardrails │
|
|
370
|
+
└────────────┘ └────────────┘ └────────────┘
|
|
371
|
+
pom.xml hexagonal max 20 lines
|
|
372
|
+
package.json + DDD + interfaces
|
|
373
|
+
go.mod + SOLID + custom errors
|
|
245
374
|
```
|
|
246
375
|
|
|
376
|
+
Corbat doesn't modify AI output — it ensures the AI knows your standards *before* generating.
|
|
377
|
+
|
|
378
|
+
**Important:** Corbat provides context and guidelines to the AI. The actual code quality depends on how well the AI model follows these guidelines. In our testing, models like Claude and GPT-4 consistently respect these guardrails.
|
|
379
|
+
|
|
247
380
|
---
|
|
248
381
|
|
|
249
382
|
## Documentation
|
|
250
383
|
|
|
251
384
|
| Resource | Description |
|
|
252
385
|
|----------|-------------|
|
|
253
|
-
| [Setup Guide](docs/setup.md) | Installation for
|
|
386
|
+
| [Setup Guide](docs/setup.md) | Installation for Cursor, VS Code, JetBrains, and 25+ more |
|
|
254
387
|
| [Templates](docs/templates.md) | Ready-to-use `.corbat.json` configurations |
|
|
255
|
-
| [Compatibility](docs/compatibility.md) | Full list of supported tools |
|
|
256
|
-
| [Benchmark
|
|
257
|
-
| [API Reference](docs/full-documentation.md) | Tools, prompts, and configuration |
|
|
388
|
+
| [Compatibility](docs/compatibility.md) | Full list of supported AI tools |
|
|
389
|
+
| [Benchmark Analysis](benchmarks/v3/BENCHMARK_REPORT_V3.md) | Detailed results from 15 scenarios |
|
|
390
|
+
| [API Reference](docs/full-documentation.md) | Tools, prompts, and configuration options |
|
|
258
391
|
|
|
259
392
|
---
|
|
260
393
|
|
|
261
394
|
<div align="center">
|
|
262
395
|
|
|
263
|
-
|
|
396
|
+
### Stop fixing AI code. Start shipping it.
|
|
397
|
+
|
|
398
|
+
Add to your MCP config and you're done:
|
|
399
|
+
|
|
400
|
+
```json
|
|
401
|
+
{ "mcpServers": { "corbat": { "command": "npx", "args": ["-y", "@corbat-tech/coding-standards-mcp"] }}}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
**Your code reviews will thank you.**
|
|
405
|
+
|
|
406
|
+
---
|
|
264
407
|
|
|
265
|
-
*
|
|
408
|
+
*Developed by [corbat-tech](https://corbat.tech)*
|
|
266
409
|
|
|
267
410
|
</div>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight code analyzer using regex and heuristics.
|
|
3
|
+
* No AST parsing to keep it fast and dependency-free.
|
|
4
|
+
*
|
|
5
|
+
* This module provides real code analysis instead of just returning checklists.
|
|
6
|
+
* It detects anti-patterns, measures code quality metrics, and provides
|
|
7
|
+
* actionable feedback.
|
|
8
|
+
*/
|
|
9
|
+
export interface AnalysisIssue {
|
|
10
|
+
type: 'CRITICAL' | 'WARNING' | 'INFO';
|
|
11
|
+
rule: string;
|
|
12
|
+
message: string;
|
|
13
|
+
line?: number;
|
|
14
|
+
suggestion?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CodeMetrics {
|
|
17
|
+
totalLines: number;
|
|
18
|
+
codeLines: number;
|
|
19
|
+
commentLines: number;
|
|
20
|
+
methodCount: number;
|
|
21
|
+
classCount: number;
|
|
22
|
+
interfaceCount: number;
|
|
23
|
+
testCount: number;
|
|
24
|
+
maxMethodLines: number;
|
|
25
|
+
maxClassLines: number;
|
|
26
|
+
customErrorCount: number;
|
|
27
|
+
importCount: number;
|
|
28
|
+
}
|
|
29
|
+
export interface AnalysisResult {
|
|
30
|
+
issues: AnalysisIssue[];
|
|
31
|
+
score: number;
|
|
32
|
+
summary: string;
|
|
33
|
+
metrics: CodeMetrics;
|
|
34
|
+
passed: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Analyze code and return issues, metrics, and score.
|
|
38
|
+
* @throws Error if code exceeds MAX_CODE_SIZE
|
|
39
|
+
*/
|
|
40
|
+
export declare function analyzeCode(code: string): AnalysisResult;
|
|
41
|
+
/**
|
|
42
|
+
* Format analysis result as markdown.
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatAnalysisAsMarkdown(result: AnalysisResult): string;
|
|
45
|
+
//# sourceMappingURL=code-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-analyzer.d.ts","sourceRoot":"","sources":["../../src/analysis/code-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAsLD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAkGxD;AA0OD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAwFvE"}
|