vibecop 0.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/LICENSE +21 -0
- package/README.md +257 -0
- package/dist/ast-grep-napi.darwin-arm64-q04mnpgp.node +0 -0
- package/dist/cli.js +18020 -0
- package/package.json +86 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bhavya Bhushan
|
|
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
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# vibecop
|
|
2
|
+
|
|
3
|
+
[](https://github.com/bhvbhushan/vibecop/blob/main/LICENSE)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
[](https://github.com/bhvbhushan/vibecop/actions/workflows/ci.yml)
|
|
7
|
+
|
|
8
|
+
AI code quality toolkit — deterministic linter for the AI coding era. Catches the bugs that AI agents introduce: god functions, N+1 queries, fire-and-forget DB calls, leftover debug logging, and 18 more patterns. Like `eslint` for structural quality, but focused on the antipatterns AI generates.
|
|
9
|
+
|
|
10
|
+
Built on [ast-grep](https://ast-grep.github.io/) for fast, tree-sitter-based AST analysis. No LLM required — every finding is deterministic and reproducible.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# npm
|
|
16
|
+
npm install -g vibecop
|
|
17
|
+
|
|
18
|
+
# bun (recommended)
|
|
19
|
+
bun add -g vibecop
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Requires Node.js >= 20 or Bun >= 1.0.
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Scan current directory
|
|
28
|
+
vibecop scan .
|
|
29
|
+
|
|
30
|
+
# Scan specific directory with JSON output
|
|
31
|
+
vibecop scan src/ --format json
|
|
32
|
+
|
|
33
|
+
# Check what detectors are available
|
|
34
|
+
vibecop check
|
|
35
|
+
|
|
36
|
+
# CI mode — exit code 1 if errors found
|
|
37
|
+
vibecop scan . --format text
|
|
38
|
+
|
|
39
|
+
# Scan with custom config
|
|
40
|
+
vibecop scan . --config .vibecop.yml
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Benchmarks
|
|
44
|
+
|
|
45
|
+
Tested against 10 popular open-source vibe-coded projects (April 2026). These are real results, not synthetic:
|
|
46
|
+
|
|
47
|
+
| Project | Stars | Files | Findings | Key Issues Found |
|
|
48
|
+
|---------|:-----:|:-----:|:--------:|------------------|
|
|
49
|
+
| [**context7**](https://github.com/upstash/context7) | 51.3K | 68 | 118 | 71 console.logs, 21 god functions, 3 N+1 queries |
|
|
50
|
+
| [**dyad**](https://github.com/dyad-sh/dyad) | 20K | 970 | 1,104 | 402 god functions, 47 unchecked DB results, 12 placeholder values |
|
|
51
|
+
| [**bolt.diy**](https://github.com/stackblitz-labs/bolt.diy) | 19.2K | 398 | 949 | 294 `any` types, 9 `dangerouslySetInnerHTML`, 24 N+1 queries |
|
|
52
|
+
| [**screenpipe**](https://github.com/screenpipe/screenpipe) | 17.9K | 362 | 1,340 | 387 `any` types, 236 empty error handlers, 3 dead code paths |
|
|
53
|
+
| [**browser-tools-mcp**](https://github.com/AgentDeskAI/browser-tools-mcp) | 7.2K | 12 | 420 | 319 console.logs, 49 `any` types, 15 empty error handlers |
|
|
54
|
+
| [**magic-mcp**](https://github.com/21st-dev/magic-mcp) | 4.6K | 14 | 28 | 22 console.logs, 3 empty error handlers, 3 god functions |
|
|
55
|
+
| [**code-review-graph**](https://github.com/tirth8205/code-review-graph) | 3.9K | 94 | 410 | 139 unchecked DB results, 71 N+1 queries, 6 SQL injections |
|
|
56
|
+
| [**vibe-check-mcp**](https://github.com/PV-Bhat/vibe-check-mcp-server) | 480 | 53 | 113 | 74 console.logs, 18 `any` types, 9 god functions |
|
|
57
|
+
| [**codeledger**](https://github.com/bhvbhushan/codeledger) | 3 | 54 | 30 | 13 god functions, 6 SQL injections, 5 `any` types |
|
|
58
|
+
| [**mcptest**](https://github.com/bhvbhushan/mcptest) | — | 37 | 1 | 1 god function |
|
|
59
|
+
|
|
60
|
+
**4,513 findings** across **2,062 files** in 10 vibe-coded projects. Most common antipatterns: god functions (38%), excessive `any` (21%), leftover `console.log` (26%).
|
|
61
|
+
|
|
62
|
+
### Example Output
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
src/services/user.service.ts
|
|
66
|
+
45:1 error Function 'processUserData' is too complex (232 lines, cyclomatic complexity 41, 3 params) god-function
|
|
67
|
+
89:5 warning Database or API call inside a loop — potential N+1 query n-plus-one-query
|
|
68
|
+
145:5 warning Database mutation result is not checked — errors will be silently ignored unchecked-db-result
|
|
69
|
+
|
|
70
|
+
src/components/PaymentModal.tsx
|
|
71
|
+
1:1 warning Component has too many hooks (8 useState, 3 useEffect, 593 lines) god-component
|
|
72
|
+
201:9 warning dangerouslySetInnerHTML can lead to XSS attacks if the content is not sanitized dangerous-inner-html
|
|
73
|
+
|
|
74
|
+
src/config/auth.ts
|
|
75
|
+
12:5 error Placeholder placeholder domain found: "yourdomain.com" placeholder-in-production
|
|
76
|
+
18:5 error Auth token stored in localStorage — vulnerable to XSS token-in-localstorage
|
|
77
|
+
|
|
78
|
+
src/utils/api.ts
|
|
79
|
+
34:12 warning Double type assertion (as unknown as X) bypasses TypeScript's type safety double-type-assertion
|
|
80
|
+
67:1 info TODO comment in production code (security-related) todo-in-production
|
|
81
|
+
|
|
82
|
+
✖ 9 problems (3 errors, 5 warnings, 1 info)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Detectors (22 total)
|
|
86
|
+
|
|
87
|
+
### Quality (12 detectors)
|
|
88
|
+
|
|
89
|
+
| ID | Detector | Description | Severity |
|
|
90
|
+
|----|----------|-------------|----------|
|
|
91
|
+
| `god-function` | God Function | Functions exceeding line, complexity, or parameter thresholds | error/warning |
|
|
92
|
+
| `god-component` | God Component | React components with too many hooks, lines, or imports | warning |
|
|
93
|
+
| `n-plus-one-query` | N+1 Query | DB/API calls inside loops or `.map(async ...)` callbacks | warning |
|
|
94
|
+
| `unbounded-query` | Unbounded Query | `findMany`/`findAll` without a `take`/`limit` clause | info |
|
|
95
|
+
| `debug-console-in-prod` | Debug Console in Prod | `console.log`/`console.debug` left in production code | warning |
|
|
96
|
+
| `dead-code-path` | Dead Code Path | Identical if/else branches, unreachable code after return/throw | warning |
|
|
97
|
+
| `double-type-assertion` | Double Type Assertion | `as unknown as X` patterns that bypass TypeScript type safety | warning |
|
|
98
|
+
| `excessive-any` | Excessive Any | Files with 4+ `any` type annotations | warning |
|
|
99
|
+
| `todo-in-production` | TODO in Production | TODO/FIXME/HACK comments, escalated if security-related | info/warning |
|
|
100
|
+
| `empty-error-handler` | Empty Error Handler | Catch/except blocks that silently swallow errors | warning |
|
|
101
|
+
| `excessive-comment-ratio` | Excessive Comment Ratio | Files with >50% comment lines | info |
|
|
102
|
+
| `over-defensive-coding` | Over-Defensive Coding | Redundant null checks on values that can't be null | info |
|
|
103
|
+
|
|
104
|
+
### Security (5 detectors)
|
|
105
|
+
|
|
106
|
+
| ID | Detector | Description | Severity |
|
|
107
|
+
|----|----------|-------------|----------|
|
|
108
|
+
| `sql-injection` | SQL Injection | Template literals or string concatenation in SQL query methods | error |
|
|
109
|
+
| `dangerous-inner-html` | Dangerous innerHTML | `dangerouslySetInnerHTML` usage without sanitization | warning |
|
|
110
|
+
| `token-in-localstorage` | Token in localStorage | Auth/JWT tokens stored in XSS-accessible storage | error |
|
|
111
|
+
| `placeholder-in-production` | Placeholder in Production | `yourdomain.com`, `changeme`, `xxx` left in config | error |
|
|
112
|
+
| `insecure-defaults` | Insecure Defaults | `eval()`, `rejectUnauthorized: false`, hardcoded credentials | error |
|
|
113
|
+
|
|
114
|
+
### Correctness (3 detectors)
|
|
115
|
+
|
|
116
|
+
| ID | Detector | Description | Severity |
|
|
117
|
+
|----|----------|-------------|----------|
|
|
118
|
+
| `unchecked-db-result` | Unchecked DB Result | Fire-and-forget database mutations (insert/update/delete) | warning |
|
|
119
|
+
| `undeclared-import` | Undeclared Import | Imports not declared in package.json/requirements.txt | error |
|
|
120
|
+
| `mixed-concerns` | Mixed Concerns | Files importing both UI frameworks and database/server libraries | warning |
|
|
121
|
+
|
|
122
|
+
### Testing (2 detectors)
|
|
123
|
+
|
|
124
|
+
| ID | Detector | Description | Severity |
|
|
125
|
+
|----|----------|-------------|----------|
|
|
126
|
+
| `trivial-assertion` | Trivial Assertion | `expect(true).toBe(true)` and similar no-op tests | info |
|
|
127
|
+
| `over-mocking` | Over-Mocking | Test files with excessive mock/spy usage | info |
|
|
128
|
+
|
|
129
|
+
## GitHub Action
|
|
130
|
+
|
|
131
|
+
Add vibecop as a PR gate that posts inline review comments on changed lines:
|
|
132
|
+
|
|
133
|
+
```yaml
|
|
134
|
+
# .github/workflows/vibecop.yml
|
|
135
|
+
name: vibecop
|
|
136
|
+
on: [pull_request]
|
|
137
|
+
|
|
138
|
+
jobs:
|
|
139
|
+
scan:
|
|
140
|
+
runs-on: ubuntu-latest
|
|
141
|
+
steps:
|
|
142
|
+
- uses: actions/checkout@v4
|
|
143
|
+
- uses: bhvbhushan/vibecop@main
|
|
144
|
+
with:
|
|
145
|
+
on-failure: comment-only # or: request-changes, label, auto-close
|
|
146
|
+
severity-threshold: warning
|
|
147
|
+
max-findings: 50
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Action Inputs
|
|
151
|
+
|
|
152
|
+
| Input | Description | Default |
|
|
153
|
+
|-------|-------------|---------|
|
|
154
|
+
| `github-token` | GitHub token for API access | `${{ github.token }}` |
|
|
155
|
+
| `config` | Path to `.vibecop.yml` config file | `.vibecop.yml` |
|
|
156
|
+
| `on-failure` | Action on findings: `comment-only`, `request-changes`, `label`, `auto-close` | `comment-only` |
|
|
157
|
+
| `label` | Label to apply when `on-failure` is `label` | `vibecop:needs-review` |
|
|
158
|
+
| `max-findings` | Maximum findings to report (0 = unlimited) | `50` |
|
|
159
|
+
| `severity-threshold` | Minimum severity for inline comments (`error`, `warning`, `info`) | `warning` |
|
|
160
|
+
| `working-directory` | Directory to scan (relative to repo root) | `.` |
|
|
161
|
+
|
|
162
|
+
### Action Outputs
|
|
163
|
+
|
|
164
|
+
| Output | Description |
|
|
165
|
+
|--------|-------------|
|
|
166
|
+
| `findings-count` | Total number of findings |
|
|
167
|
+
| `errors-count` | Number of error-severity findings |
|
|
168
|
+
| `warnings-count` | Number of warning-severity findings |
|
|
169
|
+
| `has-findings` | Whether any findings were detected (`true`/`false`) |
|
|
170
|
+
| `scan-time-ms` | Scan duration in milliseconds |
|
|
171
|
+
|
|
172
|
+
## Configuration
|
|
173
|
+
|
|
174
|
+
Create `.vibecop.yml` in your project root:
|
|
175
|
+
|
|
176
|
+
```yaml
|
|
177
|
+
rules:
|
|
178
|
+
god-function:
|
|
179
|
+
severity: warning
|
|
180
|
+
debug-console-in-prod:
|
|
181
|
+
severity: "off" # disable a detector
|
|
182
|
+
excessive-any:
|
|
183
|
+
severity: warning
|
|
184
|
+
|
|
185
|
+
ignore:
|
|
186
|
+
- "**/dist/**"
|
|
187
|
+
- "**/vendor/**"
|
|
188
|
+
- "**/generated/**"
|
|
189
|
+
|
|
190
|
+
pr-gate:
|
|
191
|
+
on-failure: request-changes
|
|
192
|
+
severity-threshold: warning
|
|
193
|
+
max-findings: 50
|
|
194
|
+
label: "vibecop:needs-review"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## CLI Options
|
|
198
|
+
|
|
199
|
+
| Flag | Description | Default |
|
|
200
|
+
|------|-------------|---------|
|
|
201
|
+
| `--format` | Output format: `text`, `json`, `html`, `sarif`, `github` | `text` |
|
|
202
|
+
| `--config` | Path to config file | `.vibecop.yml` |
|
|
203
|
+
| `--no-config` | Ignore config file | |
|
|
204
|
+
| `--max-findings` | Maximum findings to report | `100` |
|
|
205
|
+
| `--output` | Write report to file | |
|
|
206
|
+
|
|
207
|
+
## Languages
|
|
208
|
+
|
|
209
|
+
| Language | Extensions | Detectors |
|
|
210
|
+
|----------|-----------|-----------|
|
|
211
|
+
| TypeScript | `.ts`, `.tsx` | All 22 |
|
|
212
|
+
| JavaScript | `.js`, `.jsx`, `.mjs`, `.cjs` | 18 (excludes TS-specific) |
|
|
213
|
+
| Python | `.py` | 10 (correctness, quality, security) |
|
|
214
|
+
|
|
215
|
+
## Architecture
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
vibecop CLI (Commander)
|
|
219
|
+
+-- Scan Engine -- discovers files, loads AST, runs detectors, collects findings
|
|
220
|
+
+-- Config Loader (Zod) -- validates .vibecop.yml, merges defaults, per-rule config
|
|
221
|
+
+-- Detectors (22) -- AST pattern matching via ast-grep (@ast-grep/napi)
|
|
222
|
+
+-- Formatters (5) -- text, json, csv, html, sarif output
|
|
223
|
+
+-- Project Analyzer -- parses package.json, requirements.txt, lockfiles
|
|
224
|
+
+-- GitHub Action -- diff parser, finding filter, PR review poster
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Versioning
|
|
228
|
+
|
|
229
|
+
vibecop follows [Semantic Versioning](https://semver.org/):
|
|
230
|
+
|
|
231
|
+
- **0.x.y** ... pre-1.0, the API may change between minor versions
|
|
232
|
+
- **PATCH** (0.x.Y) ... bug fixes, new detectors, doc updates
|
|
233
|
+
- **MINOR** (0.X.0) ... new detector categories, output formats, config options
|
|
234
|
+
- **MAJOR** (X.0.0) ... breaking CLI changes, removed detectors, config format changes
|
|
235
|
+
|
|
236
|
+
## Roadmap
|
|
237
|
+
|
|
238
|
+
- [x] **Phase 1**: Core scanner with 7 detectors, 5 output formats, `.vibecop.yml` config
|
|
239
|
+
- [x] **Phase 2**: PR Gate GitHub Action, 15 new detectors (7 → 22), monorepo support, real-world validation
|
|
240
|
+
- [ ] **Phase 3**: Cross-file analysis (duplicate code detection, repeated constants), npm publish
|
|
241
|
+
- [ ] **Phase 4**: LLM-powered deep review mode (separation of concerns, semantic duplication)
|
|
242
|
+
|
|
243
|
+
## Contributing
|
|
244
|
+
|
|
245
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, code standards, and how to add new detectors.
|
|
246
|
+
|
|
247
|
+
## Security
|
|
248
|
+
|
|
249
|
+
See [SECURITY.md](SECURITY.md) for reporting vulnerabilities.
|
|
250
|
+
|
|
251
|
+
## Code of Conduct
|
|
252
|
+
|
|
253
|
+
See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
|
|
254
|
+
|
|
255
|
+
## License
|
|
256
|
+
|
|
257
|
+
[MIT](LICENSE)
|
|
Binary file
|