bugvinash 1.0.1

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 Reejal
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,176 @@
1
+ <div align="center">
2
+
3
+ # 🧠 BUGVINASH | बग विनाश | ਬੱਗ ਵਿਨਾਸ਼ | বাগবিনাশ | பக் வினாஷ்
4
+ ### _Destroying Bugs Before They Destroy Your GPA 💀_
5
+
6
+ <img src="https://img.shields.io/badge/CLI-Tool-black?style=for-the-badge&logo=linux&logoColor=white"/>
7
+ <img src="https://img.shields.io/badge/React-Analyzer-61DAFB?style=for-the-badge&logo=react&logoColor=black"/>
8
+ <img src="https://img.shields.io/badge/Auto-Fix-Enabled?logoColor=green&logoSize=15&color=green
9
+ "/>
10
+ <img src="https://img.shields.io/badge/Made%20By-Student%20With%20Backlogs-ff4444?style=for-the-badge"/>
11
+
12
+ </div>
13
+
14
+ ---
15
+
16
+ ## ⚡ What is BUGVINASH?
17
+
18
+ **BUGVINASH** is a CLI tool that scans your React project, detects bugs, performance issues, and bad practices —
19
+ and optionally fixes them automatically.
20
+
21
+ > Because debugging at 3 AM before exams is not a lifestyle… it's a problem.
22
+
23
+ ---
24
+
25
+ ## 🚀 Installation
26
+
27
+ ```bash
28
+ npm install -g bugvinash
29
+ ```
30
+
31
+ ---
32
+
33
+ ## 🧪 Usage
34
+
35
+ Run inside your React project:
36
+
37
+ ```bash
38
+ bugvinash
39
+ ```
40
+
41
+ ---
42
+
43
+ ## 🛠 Auto Fix Mode
44
+
45
+ ```bash
46
+ bugvinash --fix
47
+ ```
48
+
49
+ ---
50
+
51
+ ## 🔍 What It Actually Does
52
+
53
+ ### 🐛 Bug Detection
54
+ - Detects `.map()` on undefined
55
+ - Missing `key` in React lists
56
+ - Syntax issues via AST
57
+ - Common React mistakes
58
+
59
+ ---
60
+
61
+ ### ⚡ Performance Checks
62
+ - Debug logs (`console.log`)
63
+ - Possible unnecessary re-renders
64
+ - Inefficient patterns
65
+
66
+ ---
67
+
68
+ ### 🧹 Cleaner
69
+ - Finds unwanted logs
70
+ - Removes them automatically using `--fix`
71
+
72
+ ---
73
+
74
+ ### 🧠 AST Intelligence
75
+ - Detects:
76
+ - Unused variables
77
+ - `useEffect` without dependency array
78
+ - Suspicious patterns
79
+
80
+ ---
81
+
82
+ ### 📊 Project Health Score
83
+
84
+ You get a final score like:
85
+
86
+ ```
87
+ 📊 Project Score: 67/100
88
+ ```
89
+
90
+ > The lower the score… the more your code is crying internally.
91
+
92
+ ---
93
+
94
+ ## 💻 Example Output
95
+
96
+ ```
97
+ 🧠 BUGVINASH - Destroying Bugs...
98
+
99
+ ⚡ Performance Check:
100
+ ⚠ src/App.js → Debug logs present
101
+
102
+ 🐛 Bug Detection:
103
+ ⚠ src/App.js → Possible .map() on undefined
104
+ ⚠ src/App.js → Missing key prop in list rendering
105
+
106
+ 🧹 Cleaner Check:
107
+ ⚠ src/App.js → contains console.log
108
+
109
+ 📊 Project Score: 55/100
110
+
111
+ ✅ Your project is healthier now!
112
+ ```
113
+
114
+
115
+
116
+ ---
117
+
118
+ ## 🧠 Why This Exists
119
+
120
+ Because:
121
+
122
+ - You forgot `key` in `.map()`
123
+ - You left `console.log()` in production
124
+ - Your `useEffect` is doing black magic
125
+ - Your code works… but you don’t know why
126
+
127
+ > BUGVINASH knows.
128
+
129
+ ---
130
+
131
+ ## 💀 Real Talk
132
+
133
+ Built by a student
134
+ with backlogs…
135
+ and bugs…
136
+ who decided to eliminate at least one of them.
137
+
138
+ ---
139
+
140
+ ## 🔮 Future Scope
141
+
142
+ - AI-powered bug fixing 🤖
143
+ - VS Code Extension 🧩
144
+ - Advanced refactoring ⚡
145
+
146
+ ---
147
+
148
+ ## 🤝 Contributing
149
+
150
+ Pull requests are welcome.
151
+ Suggestions are welcome.
152
+ Bugs are not (BUGVINASH already handles them 😏)
153
+
154
+ ---
155
+
156
+ ## 📜 License
157
+
158
+ MIT License © 2026 Reejal
159
+
160
+ ---
161
+
162
+ ## ⭐ Support
163
+
164
+ If this tool helped you:
165
+
166
+ - ⭐ Star the repo
167
+ - 🧑‍💻 Share with dev friends
168
+ - ☕ Use before panic debugging
169
+
170
+ ---
171
+
172
+ <div align="center">
173
+
174
+ ### 💀 _“Your code had bugs… now it has fear.”_
175
+
176
+ </div>
package/bin/index.js ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+
3
+ const chalk = require("chalk");
4
+ const ora = require("ora");
5
+
6
+ const { runPerformance } = require("../lib/modules/performance");
7
+ const { runBugExplainer } = require("../lib/modules/bug");
8
+ const { runCleaner } = require("../lib/modules/cleaner");
9
+ const { generateReadme } = require("../lib/modules/readme");
10
+ const { getScore } = require("../lib/core/scorer");
11
+
12
+ const FIX_MODE = process.argv.includes("--fix");
13
+ global.FIX_MODE = FIX_MODE;
14
+
15
+ console.log(chalk.cyan.bold("\n🧠 BUGVINASH - Destroying Bugs...\n"));
16
+
17
+ async function run() {
18
+ const spinner = ora("Analyzing project...").start();
19
+
20
+ try {
21
+ await runPerformance();
22
+ await runBugExplainer();
23
+ await runCleaner();
24
+ await generateReadme();
25
+
26
+
27
+ spinner.succeed("Analysis complete!");
28
+
29
+ console.log(chalk.blue(`\n📊 Project Score: ${getScore()}/100`));
30
+
31
+ if (FIX_MODE) {
32
+ console.log(chalk.green("🛠 Auto-fix mode applied!\n"));
33
+ }
34
+
35
+ console.log(chalk.green("\n✅ Your project is healthier now!\n"));
36
+
37
+
38
+ } catch (err) {
39
+ spinner.fail("Error occurred");
40
+ console.error(err);
41
+ }
42
+ }
43
+
44
+ run();
@@ -0,0 +1,65 @@
1
+ const fs = require("fs");
2
+ const parser = require("@babel/parser");
3
+ const traverse = require("@babel/traverse").default;
4
+
5
+ function analyzeFile(filePath) {
6
+ try {
7
+ const code = fs.readFileSync(filePath, "utf-8");
8
+
9
+
10
+ const ast = parser.parse(code, {
11
+ sourceType: "module",
12
+ plugins: ["jsx"]
13
+ });
14
+
15
+ const issues = new Set();
16
+
17
+ traverse(ast, {
18
+ CallExpression(path) {
19
+ const callee = path.node.callee;
20
+
21
+ if (
22
+ callee.object &&
23
+ callee.object.name === "console" &&
24
+ callee.property &&
25
+ callee.property.name === "log"
26
+ ) {
27
+ issues.add("console.log detected");
28
+ }
29
+
30
+ if (callee.property && callee.property.name === "map") {
31
+ issues.add(".map() usage detected");
32
+ }
33
+ },
34
+
35
+ Identifier(path) {
36
+ if (path.node.name === "useEffect") {
37
+ const parent = path.parent;
38
+
39
+ if (parent.arguments && parent.arguments.length === 1) {
40
+ issues.add("useEffect without dependency array");
41
+ }
42
+ }
43
+ },
44
+
45
+ VariableDeclarator(path) {
46
+ const name = path.node.id.name;
47
+
48
+ if (
49
+ path.scope.bindings[name] &&
50
+ !path.scope.bindings[name].referenced
51
+ ) {
52
+ issues.add(`Unused variable: ${name}`);
53
+ }
54
+ }
55
+ });
56
+
57
+ return Array.from(issues);
58
+
59
+
60
+ } catch (err) {
61
+ return [`Syntax error in file: ${err.reasonCode || err.message}`];
62
+ }
63
+ }
64
+
65
+ module.exports = { analyzeFile };
@@ -0,0 +1,11 @@
1
+ const glob = require("glob");
2
+
3
+ function getAllFiles() {
4
+ const files = glob.sync("src/**/*.{js,jsx}", {
5
+ ignore: ["node_modules/**"]
6
+ });
7
+
8
+ return files;
9
+ }
10
+
11
+ module.exports = { getAllFiles };
@@ -0,0 +1,12 @@
1
+ let score = 100;
2
+
3
+ function reduce(points) {
4
+ score -= points;
5
+ }
6
+
7
+ function getScore() {
8
+ if (score < 0) score = 0;
9
+ return score;
10
+ }
11
+
12
+ module.exports = { reduce, getScore };
@@ -0,0 +1,85 @@
1
+ const fs = require("fs");
2
+ const { getAllFiles } = require("../core/scanner");
3
+ const { warning } = require("../utils/logger");
4
+ const { reduce } = require("../core/scorer");
5
+
6
+ function applyFixes(content) {
7
+ let fixed = content;
8
+
9
+ fixed = fixed.replace(/(\w+)\.map\(/g, "$1?.map(");
10
+
11
+ fixed = fixed.replace(
12
+ /useEffect(()\s*=>\s*{([\s\S]*?)}\s*)/g,
13
+ "useEffect(() => {$1}, [])"
14
+ );
15
+
16
+ fixed = fixed.replace(
17
+ /.map\((\w+)\s*=>\s*<(\w+)/g,
18
+ '.map(($1, index) => <$2 key={index})'
19
+ );
20
+
21
+ fixed = fixed.replace(
22
+ /const\s+(\w+)\s*=\s*[^;]+;\s*\n(?!.*\1)/g,
23
+ ""
24
+ );
25
+
26
+ return fixed;
27
+ }
28
+
29
+ async function runBugExplainer() {
30
+ console.log("\n🐛 Bug Detection:\n");
31
+
32
+ const astModule = require("../core/astScanner");
33
+ const files = getAllFiles();
34
+
35
+ files.forEach(file => {
36
+ let content = fs.readFileSync(file, "utf-8");
37
+ let updated = content;
38
+
39
+
40
+ const reported = new Set();
41
+
42
+ if (content.includes(".map(") && content.includes("undefined")) {
43
+ const msg = "Possible .map() on undefined";
44
+ if (!reported.has(msg)) {
45
+ warning(`${file} → ${msg}`);
46
+ reduce(10);
47
+ reported.add(msg);
48
+ }
49
+ }
50
+
51
+ if (content.includes(".map(") && !content.includes("key=")) {
52
+ const msg = "Missing key prop in list rendering";
53
+ if (!reported.has(msg)) {
54
+ warning(`${file} → ${msg}`);
55
+ reduce(8);
56
+ reported.add(msg);
57
+ }
58
+ }
59
+
60
+ if (astModule && typeof astModule.analyzeFile === "function") {
61
+ const astIssues = astModule.analyzeFile(file);
62
+
63
+ astIssues.forEach(issue => {
64
+ if (!reported.has(issue)) {
65
+ warning(`${file} → ${issue}`);
66
+ reduce(5);
67
+ reported.add(issue);
68
+ }
69
+ });
70
+ }
71
+
72
+ if (global.FIX_MODE) {
73
+ updated = applyFixes(content);
74
+
75
+ if (updated !== content) {
76
+ fs.writeFileSync(file, updated);
77
+ console.log(`🛠 Fixed issues in ${file}`);
78
+ }
79
+ }
80
+
81
+
82
+ });
83
+ }
84
+
85
+ module.exports = { runBugExplainer };
@@ -0,0 +1,36 @@
1
+ const fs = require("fs");
2
+ const { getAllFiles } = require("../core/scanner");
3
+ const { warning, success } = require("../utils/logger");
4
+ const { reduce } = require("../core/scorer");
5
+
6
+ async function runCleaner() {
7
+ console.log("\n🧹 Cleaner Check:\n");
8
+
9
+ const files = getAllFiles();
10
+ let count = 0;
11
+
12
+ files.forEach(file => {
13
+ let content = fs.readFileSync(file, "utf-8");
14
+
15
+
16
+ if (content.includes("console.log")) {
17
+ if (global.FIX_MODE) {
18
+ const cleaned = content.replace(/console\.log\([^)]*\);?/g, "");
19
+ fs.writeFileSync(file, cleaned);
20
+ warning(`${file} → console.log removed`);
21
+ } else {
22
+ warning(`${file} → contains console.log`);
23
+ }
24
+
25
+ reduce(3);
26
+ count++;
27
+ }
28
+
29
+
30
+ });
31
+
32
+ console.log(`📊 Console logs found: ${count}`);
33
+ success("Cleaner scan completed");
34
+ }
35
+
36
+ module.exports = { runCleaner };
@@ -0,0 +1,46 @@
1
+ const fs = require("fs");
2
+ const { getAllFiles } = require("../core/scanner");
3
+ const { warning, success } = require("../utils/logger");
4
+ const { reduce } = require("../core/scorer"); // 🔥 NEW
5
+
6
+ async function runPerformance() {
7
+ console.log("\n⚡ Performance Check:\n");
8
+
9
+ const files = getAllFiles();
10
+ let issues = 0;
11
+
12
+ files.forEach(file => {
13
+ const content = fs.readFileSync(file, "utf-8");
14
+
15
+ const reported = new Set();
16
+
17
+ if (content.includes("useEffect") && content.includes("setState")) {
18
+ const msg = "Possible unnecessary re-render";
19
+ if (!reported.has(msg)) {
20
+ warning(`${file} → ${msg}`);
21
+ reduce(6);
22
+ issues++;
23
+ reported.add(msg);
24
+ }
25
+ }
26
+
27
+ if (content.includes("console.log")) {
28
+ const msg = "Debug logs present";
29
+ if (!reported.has(msg)) {
30
+ warning(`${file} → ${msg}`);
31
+ reduce(4);
32
+ issues++;
33
+ reported.add(msg);
34
+ }
35
+ }
36
+
37
+
38
+ });
39
+
40
+ console.log(`📊 Files scanned: ${files.length}`);
41
+ console.log(`⚠ Issues found: ${issues}`);
42
+
43
+ success("Performance scan completed");
44
+ }
45
+
46
+ module.exports = { runPerformance };
@@ -0,0 +1,23 @@
1
+ const fs = require("fs");
2
+ const { success } = require("../utils/logger");
3
+
4
+ async function generateReadme() {
5
+ console.log("\n📄 Generating README:\n");
6
+
7
+ const content = `
8
+
9
+ # 🚀 Project (Analyzed by BugVinash)
10
+
11
+ ## Features
12
+
13
+ * Code scanned
14
+ * Bugs detected
15
+ * Cleaner applied
16
+ `;
17
+
18
+ fs.writeFileSync("README.md", content);
19
+
20
+ success("README.md created");
21
+ }
22
+
23
+ module.exports = { generateReadme };
@@ -0,0 +1,19 @@
1
+ const chalk = require("chalk");
2
+
3
+ function success(msg) {
4
+ console.log(chalk.green(`✔ ${msg}`));
5
+ }
6
+
7
+ function warning(msg) {
8
+ console.log(chalk.yellow(`⚠ ${msg}`));
9
+ }
10
+
11
+ function error(msg) {
12
+ console.log(chalk.red(`❌ ${msg}`));
13
+ }
14
+
15
+ function info(msg) {
16
+ console.log(chalk.cyan(`ℹ ${msg}`));
17
+ }
18
+
19
+ module.exports = { success, warning, error, info };
package/package.json ADDED
@@ -0,0 +1 @@
1
+ {"name":"bugvinash","version":"1.0.1","description":"🚀 All-in-one React project analyzer & auto-fixer (bugs, performance, cleanup, README generator)","main":"bin/index.js","bin":{"bugvinash":"./bin/index.js"},"type":"commonjs","scripts":{"start":"node bin/index.js","dev":"node bin/index.js","test":"echo \"No tests yet\""},"keywords":["react","cli","bug-fixer","code-analyzer","developer-tool","performance","cleanup"],"author":"Reejal","license":"MIT","dependencies":{"@babel/parser":"^7.29.2","@babel/traverse":"^7.29.0","chalk":"^4.1.2","fs-extra":"^11.3.4","glob":"^13.0.6","ora":"^5.4.1"},"engines":{"node":">=14"}}