devbonzai 2.2.205 → 2.2.207

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devbonzai",
3
- "version": "2.2.205",
3
+ "version": "2.2.207",
4
4
  "description": "Quickly set up a local file server in any repository for browser-based file access",
5
5
  "main": "cli.js",
6
6
  "bin": {
@@ -6,20 +6,30 @@ const { listAllFiles } = require('../utils/fileList');
6
6
  const { getIgnorePatterns, shouldIgnore } = require('../utils/ignore');
7
7
 
8
8
  module.exports = async function scanStandards(req, res) {
9
+ console.log('🔵 [scan_standards] Endpoint hit');
10
+
9
11
  try {
10
12
  const { projectPath, standards } = req.body;
13
+ console.log('🔵 [scan_standards] projectPath:', projectPath);
14
+ console.log('🔵 [scan_standards] standards:', Array.isArray(standards) ? standards.length + ' rules' : 'string input');
11
15
 
12
16
  if (!projectPath || !standards) {
17
+ console.log('❌ [scan_standards] Error: projectPath and standards required');
13
18
  return res.status(400).json({ error: 'projectPath and standards required' });
14
19
  }
15
20
 
16
21
  // Get file structure for context
22
+ console.log('🔵 [scan_standards] Getting file tree...');
17
23
  const fileTree = getFileTree(projectPath);
24
+ console.log('🔵 [scan_standards] File tree entries:', fileTree.split('\n').length);
18
25
 
19
26
  // Sample a few key files for AI to analyze (don't send entire codebase)
27
+ console.log('🔵 [scan_standards] Getting sample files...');
20
28
  const sampleFiles = getSampleFiles(projectPath, 10);
29
+ console.log('🔵 [scan_standards] Sample files found:', sampleFiles.length);
30
+ sampleFiles.forEach(f => console.log(' 📄', f.path, `(${f.size} bytes)`));
21
31
 
22
- const prompt = `You are analyzing a codebase for architectural violations.
32
+ const prompt = `Analyze this codebase for architectural violations.
23
33
 
24
34
  PROJECT STRUCTURE:
25
35
  ${fileTree}
@@ -27,25 +37,22 @@ ${fileTree}
27
37
  SAMPLE FILES:
28
38
  ${sampleFiles.map(f => `=== ${f.path} ===\n${f.content.substring(0, 500)}...\n`).join('\n')}
29
39
 
30
- ARCHITECTURAL STANDARDS TO CHECK:
40
+ STANDARDS TO CHECK:
31
41
  ${Array.isArray(standards) ? standards.map((s, i) => `${i + 1}. ${s}`).join('\n') : standards}
32
42
 
33
- Analyze the codebase and identify violations of these standards.
43
+ CRITICAL: Your response must be ONLY a valid JSON array. No markdown, no explanation, no summary text.
44
+ Start your response with [ and end with ]. Nothing else.
34
45
 
35
- Respond ONLY with a JSON array of violations:
36
- [
37
- {
38
- "rule": "Controllers should only handle HTTP requests",
39
- "file": "src/controllers/UserController.ts",
40
- "description": "Contains business logic and database queries",
41
- "severity": "high"
42
- }
43
- ]
46
+ Output format:
47
+ [{"rule":"rule name","file":"path/to/file","description":"what violates it","severity":"high|medium|low"}]
44
48
 
45
- If no violations found, return empty array: []`;
49
+ Empty if no violations: []`;
50
+
51
+ console.log('🔵 [scan_standards] Prompt length:', prompt.length, 'chars');
46
52
 
47
53
  // Use cursor-agent like prompt_agent does
48
54
  const args = ['--print', '--force', '--workspace', projectPath, prompt];
55
+ console.log('🔵 [scan_standards] Spawning cursor-agent...');
49
56
 
50
57
  const proc = spawn('cursor-agent', args, {
51
58
  cwd: projectPath,
@@ -53,37 +60,60 @@ If no violations found, return empty array: []`;
53
60
  stdio: ['ignore', 'pipe', 'pipe']
54
61
  });
55
62
 
63
+ console.log('🔵 [scan_standards] Process spawned, PID:', proc.pid);
64
+
56
65
  let stdout = '';
57
66
  let stderr = '';
58
67
 
59
68
  proc.stdout.on('data', (d) => {
60
- stdout += d.toString();
69
+ const data = d.toString();
70
+ console.log('📤 [scan_standards] stdout chunk:', data.length, 'bytes');
71
+ stdout += data;
61
72
  });
62
73
 
63
74
  proc.stderr.on('data', (d) => {
64
- stderr += d.toString();
75
+ const data = d.toString();
76
+ console.log('⚠️ [scan_standards] stderr chunk:', data.length, 'bytes');
77
+ stderr += data;
65
78
  });
66
79
 
67
80
  proc.on('error', (error) => {
68
- console.error('Standards scan process error:', error);
81
+ console.error(' [scan_standards] Process error:', error.message);
69
82
  return res.status(500).json({ error: error.message });
70
83
  });
71
84
 
72
85
  proc.on('close', (code) => {
86
+ console.log('🔵 [scan_standards] Process closed with code:', code);
87
+ console.log('🔵 [scan_standards] stdout total:', stdout.length, 'bytes');
88
+ console.log('🔵 [scan_standards] stderr total:', stderr.length, 'bytes');
89
+
73
90
  if (code !== 0) {
74
- console.error('Standards scan failed with code:', code);
91
+ console.error(' [scan_standards] Failed with code:', code);
92
+ console.error('❌ [scan_standards] stderr:', stderr);
75
93
  return res.status(500).json({ error: `Process exited with code ${code}`, stderr });
76
94
  }
77
95
 
78
96
  // Parse AI response
97
+ console.log('🔵 [scan_standards] Parsing response...');
79
98
  const jsonMatch = stdout.match(/\[[\s\S]*\]/);
80
- const violations = jsonMatch ? JSON.parse(jsonMatch[0]) : [];
99
+
100
+ if (!jsonMatch) {
101
+ console.log('⚠️ [scan_standards] No JSON array found in response');
102
+ console.log('⚠️ [scan_standards] Raw stdout:', stdout.substring(0, 500));
103
+ }
81
104
 
82
- res.json({ violations });
105
+ try {
106
+ const violations = jsonMatch ? JSON.parse(jsonMatch[0]) : [];
107
+ console.log('✅ [scan_standards] Found', violations.length, 'violations');
108
+ res.json({ violations });
109
+ } catch (parseError) {
110
+ console.error('❌ [scan_standards] JSON parse error:', parseError.message);
111
+ res.status(500).json({ error: 'Failed to parse response', raw: stdout });
112
+ }
83
113
  });
84
114
 
85
115
  } catch (error) {
86
- console.error('Standards scan error:', error);
116
+ console.error(' [scan_standards] Error:', error.message);
87
117
  res.status(500).json({ error: error.message });
88
118
  }
89
119
  };
@@ -99,7 +129,7 @@ function getFileTree(projectPath) {
99
129
  );
100
130
  return realFiles.slice(0, 200).join('\n'); // Limit to 200 entries
101
131
  } catch (e) {
102
- console.error('Error getting file tree:', e);
132
+ console.error('❌ [scan_standards] Error getting file tree:', e);
103
133
  return 'Unable to read file tree';
104
134
  }
105
135
  }