devbonzai 2.2.205 → 2.2.206

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.206",
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,18 +6,28 @@ 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
32
  const prompt = `You are analyzing a codebase for architectural violations.
23
33
 
@@ -44,8 +54,11 @@ Respond ONLY with a JSON array of violations:
44
54
 
45
55
  If no violations found, return empty array: []`;
46
56
 
57
+ console.log('🔵 [scan_standards] Prompt length:', prompt.length, 'chars');
58
+
47
59
  // Use cursor-agent like prompt_agent does
48
60
  const args = ['--print', '--force', '--workspace', projectPath, prompt];
61
+ console.log('🔵 [scan_standards] Spawning cursor-agent...');
49
62
 
50
63
  const proc = spawn('cursor-agent', args, {
51
64
  cwd: projectPath,
@@ -53,37 +66,60 @@ If no violations found, return empty array: []`;
53
66
  stdio: ['ignore', 'pipe', 'pipe']
54
67
  });
55
68
 
69
+ console.log('🔵 [scan_standards] Process spawned, PID:', proc.pid);
70
+
56
71
  let stdout = '';
57
72
  let stderr = '';
58
73
 
59
74
  proc.stdout.on('data', (d) => {
60
- stdout += d.toString();
75
+ const data = d.toString();
76
+ console.log('📤 [scan_standards] stdout chunk:', data.length, 'bytes');
77
+ stdout += data;
61
78
  });
62
79
 
63
80
  proc.stderr.on('data', (d) => {
64
- stderr += d.toString();
81
+ const data = d.toString();
82
+ console.log('⚠️ [scan_standards] stderr chunk:', data.length, 'bytes');
83
+ stderr += data;
65
84
  });
66
85
 
67
86
  proc.on('error', (error) => {
68
- console.error('Standards scan process error:', error);
87
+ console.error(' [scan_standards] Process error:', error.message);
69
88
  return res.status(500).json({ error: error.message });
70
89
  });
71
90
 
72
91
  proc.on('close', (code) => {
92
+ console.log('🔵 [scan_standards] Process closed with code:', code);
93
+ console.log('🔵 [scan_standards] stdout total:', stdout.length, 'bytes');
94
+ console.log('🔵 [scan_standards] stderr total:', stderr.length, 'bytes');
95
+
73
96
  if (code !== 0) {
74
- console.error('Standards scan failed with code:', code);
97
+ console.error(' [scan_standards] Failed with code:', code);
98
+ console.error('❌ [scan_standards] stderr:', stderr);
75
99
  return res.status(500).json({ error: `Process exited with code ${code}`, stderr });
76
100
  }
77
101
 
78
102
  // Parse AI response
103
+ console.log('🔵 [scan_standards] Parsing response...');
79
104
  const jsonMatch = stdout.match(/\[[\s\S]*\]/);
80
- const violations = jsonMatch ? JSON.parse(jsonMatch[0]) : [];
105
+
106
+ if (!jsonMatch) {
107
+ console.log('⚠️ [scan_standards] No JSON array found in response');
108
+ console.log('⚠️ [scan_standards] Raw stdout:', stdout.substring(0, 500));
109
+ }
81
110
 
82
- res.json({ violations });
111
+ try {
112
+ const violations = jsonMatch ? JSON.parse(jsonMatch[0]) : [];
113
+ console.log('✅ [scan_standards] Found', violations.length, 'violations');
114
+ res.json({ violations });
115
+ } catch (parseError) {
116
+ console.error('❌ [scan_standards] JSON parse error:', parseError.message);
117
+ res.status(500).json({ error: 'Failed to parse response', raw: stdout });
118
+ }
83
119
  });
84
120
 
85
121
  } catch (error) {
86
- console.error('Standards scan error:', error);
122
+ console.error(' [scan_standards] Error:', error.message);
87
123
  res.status(500).json({ error: error.message });
88
124
  }
89
125
  };
@@ -99,7 +135,7 @@ function getFileTree(projectPath) {
99
135
  );
100
136
  return realFiles.slice(0, 200).join('\n'); // Limit to 200 entries
101
137
  } catch (e) {
102
- console.error('Error getting file tree:', e);
138
+ console.error('❌ [scan_standards] Error getting file tree:', e);
103
139
  return 'Unable to read file tree';
104
140
  }
105
141
  }