devbonzai 2.2.203 → 2.2.205

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.203",
3
+ "version": "2.2.205",
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": {
@@ -22,7 +22,6 @@
22
22
  "author": "",
23
23
  "license": "ISC",
24
24
  "dependencies": {
25
- "@anthropic-ai/sdk": "^0.52.0",
26
25
  "express": "^4.18.2",
27
26
  "cors": "^2.8.5",
28
27
  "body-parser": "^1.20.2",
@@ -1,32 +1,24 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const glob = require('glob');
4
- const { Anthropic } = require('@anthropic-ai/sdk');
4
+ const { spawn } = require('child_process');
5
5
  const { listAllFiles } = require('../utils/fileList');
6
6
  const { getIgnorePatterns, shouldIgnore } = require('../utils/ignore');
7
7
 
8
- // Hardcoded API key as fallback
9
- const DEFAULT_API_KEY = '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';
10
-
11
8
  module.exports = async function scanStandards(req, res) {
12
9
  try {
13
- const { projectPath, standards, apiKey } = req.body;
10
+ const { projectPath, standards } = req.body;
14
11
 
15
12
  if (!projectPath || !standards) {
16
13
  return res.status(400).json({ error: 'projectPath and standards required' });
17
14
  }
18
15
 
19
- // Use provided apiKey or fall back to default
20
- const anthropicApiKey = apiKey || DEFAULT_API_KEY;
21
-
22
16
  // Get file structure for context
23
17
  const fileTree = getFileTree(projectPath);
24
18
 
25
19
  // Sample a few key files for AI to analyze (don't send entire codebase)
26
20
  const sampleFiles = getSampleFiles(projectPath, 10);
27
21
 
28
- const anthropic = new Anthropic({ apiKey: anthropicApiKey });
29
-
30
22
  const prompt = `You are analyzing a codebase for architectural violations.
31
23
 
32
24
  PROJECT STRUCTURE:
@@ -52,21 +44,42 @@ Respond ONLY with a JSON array of violations:
52
44
 
53
45
  If no violations found, return empty array: []`;
54
46
 
55
- const message = await anthropic.messages.create({
56
- model: 'claude-sonnet-4-20250514',
57
- max_tokens: 4000,
58
- messages: [{ role: 'user', content: prompt }]
47
+ // Use cursor-agent like prompt_agent does
48
+ const args = ['--print', '--force', '--workspace', projectPath, prompt];
49
+
50
+ const proc = spawn('cursor-agent', args, {
51
+ cwd: projectPath,
52
+ env: process.env,
53
+ stdio: ['ignore', 'pipe', 'pipe']
54
+ });
55
+
56
+ let stdout = '';
57
+ let stderr = '';
58
+
59
+ proc.stdout.on('data', (d) => {
60
+ stdout += d.toString();
61
+ });
62
+
63
+ proc.stderr.on('data', (d) => {
64
+ stderr += d.toString();
65
+ });
66
+
67
+ proc.on('error', (error) => {
68
+ console.error('Standards scan process error:', error);
69
+ return res.status(500).json({ error: error.message });
59
70
  });
60
71
 
61
- // Parse AI response
62
- const responseText = message.content[0].text;
63
- const jsonMatch = responseText.match(/\[[\s\S]*\]/);
64
- const violations = jsonMatch ? JSON.parse(jsonMatch[0]) : [];
72
+ proc.on('close', (code) => {
73
+ if (code !== 0) {
74
+ console.error('Standards scan failed with code:', code);
75
+ return res.status(500).json({ error: `Process exited with code ${code}`, stderr });
76
+ }
77
+
78
+ // Parse AI response
79
+ const jsonMatch = stdout.match(/\[[\s\S]*\]/);
80
+ const violations = jsonMatch ? JSON.parse(jsonMatch[0]) : [];
65
81
 
66
- res.json({
67
- violations,
68
- tokensUsed: message.usage.input_tokens + message.usage.output_tokens,
69
- cost: estimateCost(message.usage)
82
+ res.json({ violations });
70
83
  });
71
84
 
72
85
  } catch (error) {
@@ -135,11 +148,3 @@ function getSampleFiles(projectPath, limit = 10) {
135
148
  .sort((a, b) => b.size - a.size)
136
149
  .slice(0, limit);
137
150
  }
138
-
139
- function estimateCost(usage) {
140
- // Claude Sonnet 4 pricing
141
- const inputCost = (usage.input_tokens / 1000000) * 3.00;
142
- const outputCost = (usage.output_tokens / 1000000) * 15.00;
143
- return (inputCost + outputCost).toFixed(4);
144
- }
145
-