vibeclean 1.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pithon
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,245 @@
1
+ # ๐Ÿงน vibeclean
2
+
3
+ Audit your codebase for the mess vibe coding left behind.
4
+
5
+ AI assistants write great code. They just write it differently every time. `vibeclean` finds the inconsistencies.
6
+
7
+ Terminal screenshot/GIF:
8
+ - Add `assets/vibeclean-demo.gif` (recommended for Vibeathon voting)
9
+ - Keep it short (3-8s) and show `npx vibeclean` + score + `--rules` output
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ npx vibeclean
15
+ ```
16
+
17
+ One command. Zero config.
18
+
19
+ PR-focused mode:
20
+
21
+ ```bash
22
+ npx vibeclean --changed --base main
23
+ ```
24
+
25
+ ## What It Detects
26
+
27
+ - ๐Ÿ”€ Pattern inconsistencies (multiple HTTP clients, mixed async styles, mixed imports)
28
+ - ๐Ÿ“ Naming chaos (camelCase + snake_case + mixed file naming)
29
+ - ๐Ÿ—‘๏ธ AI leftovers (TODO/FIXME, console logs, placeholders, localhost URLs)
30
+ - ๐Ÿ“ฆ Dependency bloat (unused packages, duplicate functionality, deprecated libs)
31
+ - ๐Ÿ’€ Dead code (orphan files, unused exports, stubs)
32
+ - โš ๏ธ Error handling gaps (empty catches, unhandled async, mixed error patterns)
33
+
34
+ ## Example Output
35
+
36
+ ```text
37
+ ๐Ÿงน vibeclean v1.0.0 โ€” Cleaning up the vibe
38
+
39
+ Scanning project... โœ“ Found 124 source files in 0.8s
40
+
41
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
42
+
43
+ โš ๏ธ NAMING INCONSISTENCY Score: 6/10
44
+ โ”œโ”€ camelCase: 72%, snake_case: 28%
45
+ โ”œโ”€ Mixed directories: 4
46
+ โ””โ”€ Component filename mismatches: 3
47
+
48
+ โš ๏ธ PATTERN INCONSISTENCY Score: 8/10
49
+ โ”œโ”€ HTTP clients: fetch (12), axios (5), got (1)
50
+ โ”œโ”€ Mixed async: async/await (78%), .then() (22%)
51
+ โ””โ”€ Module style: import files 25, require files 6
52
+
53
+ ๐Ÿšจ AI LEFTOVERS Score: 7/10
54
+ โ”œโ”€ console.* statements: 23
55
+ โ”œโ”€ TODO/FIXME markers: 12 (8 AI-like)
56
+ โ””โ”€ Placeholders/localhost: 9
57
+
58
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
59
+
60
+ ๐Ÿ“Š VIBE CLEANLINESS SCORE: 38/100
61
+ Your codebase has significant vibe coding debt.
62
+
63
+ ๐Ÿงน Found 67 issues across 6 categories
64
+ ๐Ÿ“‹ Run vibeclean --rules to generate AI rules file
65
+ ```
66
+
67
+ ## Vibe Cleanliness Score
68
+
69
+ Each category gets a score from `0-10` (higher = more inconsistency). `vibeclean` converts this into an overall score out of `100` (higher = cleaner).
70
+
71
+ - `80-100`: consistent and clean
72
+ - `60-79`: manageable debt
73
+ - `40-59`: visible inconsistency debt
74
+ - `<40`: significant vibe debt
75
+
76
+ ## Generate Rules for AI Assistants
77
+
78
+ ```bash
79
+ vibeclean --rules
80
+ vibeclean --rules --cursor --claude
81
+ ```
82
+
83
+ Generated files:
84
+
85
+ - `.vibeclean-rules.md`
86
+ - `.cursorrules` (optional)
87
+ - `CLAUDE.md` (optional)
88
+
89
+ These encode your dominant project conventions so future AI-assisted code stays consistent.
90
+
91
+ ## CLI Usage
92
+
93
+ ```text
94
+ Usage: vibeclean [options] [directory]
95
+
96
+ Arguments:
97
+ directory Project directory to scan (default: current directory)
98
+
99
+ Options:
100
+ -f, --fix Apply safe autofixes before scoring (TODO/commented code/noisy console)
101
+ --json Output results as JSON
102
+ --report <format> Output format: text, json, markdown (default: text)
103
+ --report-file <path> Write report output to file
104
+ --profile <name> Preset profile: app, library, cli (default: app)
105
+ --changed Scan only changed files in the current git working tree
106
+ --base <ref> Git base ref to diff against when using --changed (default: HEAD)
107
+ --baseline Compare against baseline file and detect regressions
108
+ --baseline-file <path> Baseline file path for compare/write (default: .vibeclean-baseline.json)
109
+ --write-baseline Write current report to baseline file
110
+ --rules Generate .vibeclean-rules.md file
111
+ --cursor Also generate .cursorrules file
112
+ --claude Also generate CLAUDE.md file
113
+ --min-severity <level> Minimum severity: low, medium, high (default: low)
114
+ --fail-on <level> Fail if findings hit this severity: low, medium, high
115
+ --max-issues <n> Fail if total issues exceed this number
116
+ --min-score <n> Fail if overall score is below this threshold (0-100)
117
+ --ignore <patterns> Additional ignore patterns (comma-separated)
118
+ --max-files <n> Maximum files to scan (default: 500)
119
+ -q, --quiet Summary output only
120
+ -v, --version Show version
121
+ -h, --help Show help
122
+ ```
123
+
124
+ ## CI / PR Quality Gates
125
+
126
+ ```bash
127
+ # Fail CI on high-severity findings in changed files only
128
+ vibeclean --changed --base main --fail-on high
129
+
130
+ # Fail if quality drifts too far
131
+ vibeclean --min-score 75 --max-issues 20
132
+ ```
133
+
134
+ When a gate fails, vibeclean exits with status code `1`.
135
+
136
+ ## Profiles
137
+
138
+ ```bash
139
+ # Default
140
+ vibeclean --profile app
141
+
142
+ # Libraries: ignores common example/benchmark folders
143
+ vibeclean --profile library
144
+
145
+ # CLI projects: reduces test/bin leftovers noise
146
+ vibeclean --profile cli
147
+ ```
148
+
149
+ Profiles apply sensible defaults, but you can still override with `.vibecleanrc` and `--ignore`.
150
+
151
+ ## Baseline Compare
152
+
153
+ ```bash
154
+ # Create baseline snapshot
155
+ vibeclean --write-baseline --baseline-file .vibeclean-baseline.json
156
+
157
+ # Compare current branch against baseline (fails on regressions by default)
158
+ vibeclean --baseline --baseline-file .vibeclean-baseline.json
159
+ ```
160
+
161
+ Baseline compare tracks:
162
+ - overall score drift
163
+ - issue count drift
164
+ - high-severity finding drift
165
+ - category-level score regressions
166
+
167
+ ## Markdown PR Report
168
+
169
+ ```bash
170
+ # Print markdown to stdout
171
+ vibeclean --report markdown
172
+
173
+ # Write markdown report to file for PR comments/artifacts
174
+ vibeclean --report markdown --report-file vibeclean-report.md
175
+ ```
176
+
177
+ ## Autofix Mode
178
+
179
+ ```bash
180
+ vibeclean --fix
181
+ ```
182
+
183
+ Safe autofix currently removes:
184
+ - TODO/FIXME/HACK/XXX comment lines
185
+ - obvious commented-out code blocks
186
+ - standalone `console.log/debug/trace` lines
187
+
188
+ After fixes are applied, vibeclean re-scores the project and reports what changed.
189
+
190
+ ## Configuration
191
+
192
+ Create `.vibecleanrc` or `.vibecleanrc.json` in project root:
193
+
194
+ ```json
195
+ {
196
+ "maxFiles": 500,
197
+ "changedOnly": false,
198
+ "changedBase": "main",
199
+ "profile": "app",
200
+ "baseline": false,
201
+ "baselineFile": ".vibeclean-baseline.json",
202
+ "failOnRegression": true,
203
+ "reportFormat": "text",
204
+ "ignore": ["scripts/", "*.test.js", "*.spec.js"],
205
+ "severity": "medium",
206
+ "failOn": "high",
207
+ "maxIssues": 30,
208
+ "minScore": 70,
209
+ "rules": {
210
+ "naming": true,
211
+ "patterns": true,
212
+ "leftovers": true,
213
+ "dependencies": true,
214
+ "deadcode": true,
215
+ "errorhandling": true
216
+ },
217
+ "allowedPatterns": {
218
+ "httpClient": "fetch",
219
+ "asyncStyle": "async-await",
220
+ "stateManagement": "zustand"
221
+ }
222
+ }
223
+ ```
224
+
225
+ ## Why vibeclean?
226
+
227
+ ESLint checks syntax and style. SonarQube checks quality and vulnerabilities.
228
+
229
+ `vibeclean` checks the specific mess that AI coding creates: pattern inconsistency across sessions.
230
+
231
+ ## Contributing
232
+
233
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md).
234
+
235
+ ## Development
236
+
237
+ ```bash
238
+ npm install
239
+ npm test
240
+ node bin/vibeclean.js .
241
+ ```
242
+
243
+ ## License
244
+
245
+ MIT โ€” see [`LICENSE`](LICENSE).
@@ -0,0 +1,154 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs/promises";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { Command } from "commander";
7
+ import chalk from "chalk";
8
+ import ora from "ora";
9
+ import { runAudit } from "../src/index.js";
10
+ import { writeBaselineSnapshot } from "../src/baseline.js";
11
+ import { renderMarkdownReport } from "../src/markdown-report.js";
12
+ import { renderReport } from "../src/reporter.js";
13
+
14
+ async function readToolVersion() {
15
+ const currentFile = fileURLToPath(import.meta.url);
16
+ const rootDir = path.resolve(path.dirname(currentFile), "..");
17
+ try {
18
+ const raw = await fs.readFile(path.join(rootDir, "package.json"), "utf8");
19
+ const parsed = JSON.parse(raw);
20
+ return parsed.version || "1.0.0";
21
+ } catch {
22
+ return "1.0.0";
23
+ }
24
+ }
25
+
26
+ async function main() {
27
+ const version = await readToolVersion();
28
+
29
+ const program = new Command();
30
+ program
31
+ .name("vibeclean")
32
+ .description("Audit your codebase for the mess vibe coding left behind.")
33
+ .version(version, "-v, --version", "Show version")
34
+ .argument("[directory]", "Project directory to scan", process.cwd())
35
+ .option("-f, --fix", "Apply safe autofixes before scoring (TODO/commented code/noisy console)")
36
+ .option("--json", "Output results as JSON")
37
+ .option("--report <format>", "Output format: text, json, markdown", "text")
38
+ .option("--report-file <path>", "Write report output to file")
39
+ .option("--profile <name>", "Preset profile: app, library, cli", "app")
40
+ .option("--changed", "Scan only changed files in the current git working tree")
41
+ .option("--base <ref>", "Git base ref to diff against when using --changed", "HEAD")
42
+ .option("--baseline", "Compare current report against a baseline snapshot file")
43
+ .option("--baseline-file <path>", "Baseline file path for compare/write", ".vibeclean-baseline.json")
44
+ .option("--write-baseline", "Write current report to the baseline snapshot file")
45
+ .option("--rules", "Generate .vibeclean-rules.md file")
46
+ .option("--cursor", "Also generate .cursorrules file")
47
+ .option("--claude", "Also generate CLAUDE.md file")
48
+ .option("--min-severity <level>", "Minimum severity to report: low, medium, high", "low")
49
+ .option("--fail-on <level>", "Fail with exit code 1 if findings reach this severity: low, medium, high")
50
+ .option("--max-issues <n>", "Fail with exit code 1 if total issues exceed this number")
51
+ .option("--min-score <n>", "Fail with exit code 1 if overall score falls below this threshold (0-100)")
52
+ .option("--ignore <patterns>", "Additional patterns to ignore (comma-separated)")
53
+ .option("--max-files <n>", "Maximum files to scan", "500")
54
+ .option("-q, --quiet", "Only show summary, not individual issues")
55
+ .action(async (directory, options) => {
56
+ const spinner = ora("Running vibeclean diagnostics...").start();
57
+
58
+ try {
59
+ const result = await runAudit(directory, {
60
+ ...options,
61
+ maxFiles: Number.parseInt(options.maxFiles, 10),
62
+ maxIssues: Number.parseInt(options.maxIssues, 10),
63
+ minScore: Number.parseInt(options.minScore, 10),
64
+ profile: options.profile,
65
+ baseline: Boolean(options.baseline),
66
+ baselineFile: options.baselineFile,
67
+ reportFormat: options.report,
68
+ reportFile: options.reportFile || null,
69
+ changedOnly: Boolean(options.changed),
70
+ changedBase: options.base,
71
+ minSeverity: options.minSeverity,
72
+ failOn: options.failOn,
73
+ version
74
+ });
75
+
76
+ spinner.stop();
77
+
78
+ let baselineWriteResult = null;
79
+ if (options.writeBaseline) {
80
+ baselineWriteResult = await writeBaselineSnapshot(
81
+ result.rootDir,
82
+ options.baselineFile,
83
+ result.report
84
+ );
85
+ }
86
+
87
+ const reportFormat = options.json
88
+ ? "json"
89
+ : String(result.config?.reportFormat || options.report || "text").toLowerCase();
90
+ const payload = {
91
+ report: result.report,
92
+ generatedRules: result.generatedRules
93
+ };
94
+
95
+ if (reportFormat === "json") {
96
+ const jsonOutput = JSON.stringify(payload, null, 2);
97
+ if (options.reportFile) {
98
+ await fs.writeFile(options.reportFile, `${jsonOutput}\n`, "utf8");
99
+ console.log(chalk.green(`Saved JSON report to ${options.reportFile}`));
100
+ } else {
101
+ console.log(jsonOutput);
102
+ }
103
+ } else if (reportFormat === "markdown") {
104
+ const markdownOutput = renderMarkdownReport(result.report);
105
+ if (options.reportFile) {
106
+ await fs.writeFile(options.reportFile, markdownOutput, "utf8");
107
+ console.log(chalk.green(`Saved Markdown report to ${options.reportFile}`));
108
+ } else {
109
+ console.log(markdownOutput);
110
+ }
111
+ } else {
112
+ console.log(renderReport(result.report, { quiet: Boolean(options.quiet) }));
113
+
114
+ if (result.generatedRules?.length) {
115
+ console.log("");
116
+ console.log(chalk.green.bold(" ๐Ÿ“‹ Generated rule files"));
117
+ for (const item of result.generatedRules) {
118
+ console.log(` ${chalk.green("โœ“")} ${item.path}`);
119
+ }
120
+ }
121
+
122
+ if (baselineWriteResult) {
123
+ console.log("");
124
+ console.log(chalk.green.bold(" ๐Ÿ“Œ Baseline updated"));
125
+ console.log(` ${chalk.green("โœ“")} ${baselineWriteResult.path}`);
126
+ }
127
+
128
+ if (result.report.gateFailures?.length) {
129
+ console.log("");
130
+ console.log(chalk.red.bold(" โ›” Quality gates failed"));
131
+ for (const failure of result.report.gateFailures) {
132
+ console.log(` ${chalk.red("โ€ข")} ${failure}`);
133
+ }
134
+ }
135
+ }
136
+
137
+ if (baselineWriteResult && reportFormat !== "text") {
138
+ console.log(chalk.green(`Baseline updated: ${baselineWriteResult.path}`));
139
+ }
140
+
141
+ if (result.report.gateFailures?.length) {
142
+ process.exitCode = 1;
143
+ }
144
+ } catch (error) {
145
+ spinner.fail("vibeclean failed");
146
+ console.error(chalk.red(error?.message || "Unknown error"));
147
+ process.exitCode = 1;
148
+ }
149
+ });
150
+
151
+ await program.parseAsync(process.argv);
152
+ }
153
+
154
+ main();
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "vibeclean",
3
+ "version": "1.0.0",
4
+ "description": "Audit your codebase for vibe coding mess. Detect inconsistencies, AI leftovers, and pattern chaos with one command.",
5
+ "type": "module",
6
+ "bin": {
7
+ "vibeclean": "bin/vibeclean.js"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "src/",
12
+ "LICENSE",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "start": "node ./bin/vibeclean.js",
17
+ "check": "node ./bin/vibeclean.js --quiet",
18
+ "test": "node --test"
19
+ },
20
+ "keywords": [
21
+ "vibe-coding",
22
+ "code-quality",
23
+ "consistency",
24
+ "audit",
25
+ "cli",
26
+ "linter",
27
+ "developer-tools",
28
+ "ai-code",
29
+ "technical-debt",
30
+ "code-review",
31
+ "cleanup",
32
+ "dead-code",
33
+ "unused-dependencies",
34
+ "cursor",
35
+ "copilot",
36
+ "claude",
37
+ "chatgpt"
38
+ ],
39
+ "author": "Pithon",
40
+ "license": "MIT",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/piths/vibeclean.git"
44
+ },
45
+ "engines": {
46
+ "node": ">=18.0.0"
47
+ },
48
+ "dependencies": {
49
+ "acorn": "^8.11.0",
50
+ "acorn-jsx": "^5.3.0",
51
+ "acorn-walk": "^8.3.0",
52
+ "chalk": "^5.3.0",
53
+ "commander": "^12.0.0",
54
+ "glob": "^10.0.0",
55
+ "ignore": "^5.3.0",
56
+ "ora": "^8.0.0"
57
+ }
58
+ }