bonzai-burn 1.0.56 → 1.0.57

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.
@@ -31,11 +31,9 @@ function tryLoad(name) {
31
31
  // Visualization loop handlers
32
32
  const listHandler = tryLoad('list');
33
33
  const readHandler = tryLoad('read');
34
- const scanCodeQualityHandler = tryLoad('scan_code_quality');
35
34
 
36
35
  if (listHandler) app.get('/list', listHandler);
37
36
  if (readHandler) app.get('/read', readHandler);
38
- if (scanCodeQualityHandler) app.post('/scan_code_quality', scanCodeQualityHandler);
39
37
 
40
38
  // Backend loop handlers
41
39
  const deleteHandler = tryLoad('delete');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bonzai-burn",
3
- "version": "1.0.56",
3
+ "version": "1.0.57",
4
4
  "description": "Git branch-based cleanup tool with bburn, baccept, and brevert commands",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,144 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { ROOT } = require('../config');
4
-
5
- function scanCodeQualityHandler(req, res) {
6
- try {
7
- const { projectPath } = req.body;
8
-
9
- if (!projectPath) {
10
- return res.status(400).json({ error: 'projectPath is required' });
11
- }
12
-
13
- const targetPath = path.join(ROOT, projectPath);
14
-
15
- if (!targetPath.startsWith(ROOT)) {
16
- return res.status(400).json({ error: 'Invalid path' });
17
- }
18
-
19
- if (!fs.existsSync(targetPath)) {
20
- return res.status(404).json({ error: 'Path not found' });
21
- }
22
-
23
- const issues = [];
24
-
25
- // Basic code quality checks
26
- function scanDirectory(dir) {
27
- const entries = fs.readdirSync(dir, { withFileTypes: true });
28
-
29
- for (const entry of entries) {
30
- const fullPath = path.join(dir, entry.name);
31
- const relativePath = path.relative(ROOT, fullPath);
32
-
33
- // Skip node_modules and other ignored directories
34
- if (entry.name === 'node_modules' || entry.name === '.git' || entry.name === 'bonzai') {
35
- continue;
36
- }
37
-
38
- if (entry.isDirectory()) {
39
- scanDirectory(fullPath);
40
- } else if (entry.isFile()) {
41
- // Check file size (warn if > 500KB)
42
- const stats = fs.statSync(fullPath);
43
- if (stats.size > 500 * 1024) {
44
- issues.push({
45
- file: relativePath,
46
- severity: 'warning',
47
- message: `Large file detected (${(stats.size / 1024).toFixed(2)}KB). Consider splitting into smaller modules.`,
48
- type: 'file-size'
49
- });
50
- }
51
-
52
- // Check for common code quality issues in JS/TS files
53
- if (entry.name.endsWith('.js') || entry.name.endsWith('.jsx') ||
54
- entry.name.endsWith('.ts') || entry.name.endsWith('.tsx')) {
55
- try {
56
- const content = fs.readFileSync(fullPath, 'utf8');
57
- const lines = content.split('\n');
58
-
59
- // Check for very long lines
60
- lines.forEach((line, index) => {
61
- if (line.length > 200) {
62
- issues.push({
63
- file: relativePath,
64
- line: index + 1,
65
- severity: 'info',
66
- message: `Long line detected (${line.length} characters). Consider breaking into multiple lines.`,
67
- type: 'line-length'
68
- });
69
- }
70
- });
71
-
72
- // Check for TODO/FIXME comments
73
- lines.forEach((line, index) => {
74
- if (line.match(/TODO|FIXME|XXX|HACK/i)) {
75
- issues.push({
76
- file: relativePath,
77
- line: index + 1,
78
- severity: 'info',
79
- message: `TODO/FIXME comment found: ${line.trim().substring(0, 100)}`,
80
- type: 'todo-comment'
81
- });
82
- }
83
- });
84
-
85
- // Check for console.log statements (potential debug code)
86
- lines.forEach((line, index) => {
87
- if (line.match(/console\.(log|debug|info|warn|error)/) && !line.includes('//')) {
88
- issues.push({
89
- file: relativePath,
90
- line: index + 1,
91
- severity: 'warning',
92
- message: `Console statement found. Consider removing or using a proper logging library.`,
93
- type: 'console-statement'
94
- });
95
- }
96
- });
97
-
98
- } catch (e) {
99
- // Skip files that can't be read
100
- }
101
- }
102
- }
103
- }
104
- }
105
-
106
- const stat = fs.statSync(targetPath);
107
- if (stat.isDirectory()) {
108
- scanDirectory(targetPath);
109
- } else {
110
- // Single file scan
111
- const relativePath = path.relative(ROOT, targetPath);
112
- const content = fs.readFileSync(targetPath, 'utf8');
113
- const lines = content.split('\n');
114
-
115
- lines.forEach((line, index) => {
116
- if (line.length > 200) {
117
- issues.push({
118
- file: relativePath,
119
- line: index + 1,
120
- severity: 'info',
121
- message: `Long line detected (${line.length} characters)`,
122
- type: 'line-length'
123
- });
124
- }
125
- });
126
- }
127
-
128
- res.json({
129
- success: true,
130
- issues: issues,
131
- totalIssues: issues.length,
132
- summary: {
133
- errors: issues.filter(i => i.severity === 'error').length,
134
- warnings: issues.filter(i => i.severity === 'warning').length,
135
- info: issues.filter(i => i.severity === 'info').length
136
- }
137
- });
138
-
139
- } catch (e) {
140
- res.status(500).json({ error: e.message });
141
- }
142
- }
143
-
144
- module.exports = scanCodeQualityHandler;