devbonzai 2.2.204 → 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.204",
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",
@@ -3,9 +3,6 @@ const path = require('path');
3
3
  // Root directory (one level up from templates/)
4
4
  const ROOT = path.join(__dirname, '..');
5
5
 
6
- // Anthropic API key for Claude
7
- const ANTHROPIC_API_KEY = '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';
8
-
9
6
  // Initialize babelParser (optional dependency)
10
7
  let babelParser = null;
11
8
  try {
@@ -16,7 +13,6 @@ try {
16
13
 
17
14
  module.exports = {
18
15
  ROOT,
19
- babelParser,
20
- ANTHROPIC_API_KEY
16
+ babelParser
21
17
  };
22
18
 
@@ -1,30 +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
- const { ANTHROPIC_API_KEY } = require('../config');
8
7
 
9
8
  module.exports = async function scanStandards(req, res) {
10
9
  try {
11
- const { projectPath, standards, apiKey } = req.body;
10
+ const { projectPath, standards } = req.body;
12
11
 
13
12
  if (!projectPath || !standards) {
14
13
  return res.status(400).json({ error: 'projectPath and standards required' });
15
14
  }
16
15
 
17
- // Use provided apiKey or fall back to config
18
- const anthropicApiKey = apiKey || ANTHROPIC_API_KEY;
19
-
20
16
  // Get file structure for context
21
17
  const fileTree = getFileTree(projectPath);
22
18
 
23
19
  // Sample a few key files for AI to analyze (don't send entire codebase)
24
20
  const sampleFiles = getSampleFiles(projectPath, 10);
25
21
 
26
- const anthropic = new Anthropic({ apiKey: anthropicApiKey });
27
-
28
22
  const prompt = `You are analyzing a codebase for architectural violations.
29
23
 
30
24
  PROJECT STRUCTURE:
@@ -50,21 +44,42 @@ Respond ONLY with a JSON array of violations:
50
44
 
51
45
  If no violations found, return empty array: []`;
52
46
 
53
- const message = await anthropic.messages.create({
54
- model: 'claude-sonnet-4-20250514',
55
- max_tokens: 4000,
56
- 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();
57
61
  });
58
62
 
59
- // Parse AI response
60
- const responseText = message.content[0].text;
61
- const jsonMatch = responseText.match(/\[[\s\S]*\]/);
62
- const violations = jsonMatch ? JSON.parse(jsonMatch[0]) : [];
63
+ proc.stderr.on('data', (d) => {
64
+ stderr += d.toString();
65
+ });
63
66
 
64
- res.json({
65
- violations,
66
- tokensUsed: message.usage.input_tokens + message.usage.output_tokens,
67
- cost: estimateCost(message.usage)
67
+ proc.on('error', (error) => {
68
+ console.error('Standards scan process error:', error);
69
+ return res.status(500).json({ error: error.message });
70
+ });
71
+
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]) : [];
81
+
82
+ res.json({ violations });
68
83
  });
69
84
 
70
85
  } catch (error) {
@@ -133,11 +148,3 @@ function getSampleFiles(projectPath, limit = 10) {
133
148
  .sort((a, b) => b.size - a.size)
134
149
  .slice(0, limit);
135
150
  }
136
-
137
- function estimateCost(usage) {
138
- // Claude Sonnet 4 pricing
139
- const inputCost = (usage.input_tokens / 1000000) * 3.00;
140
- const outputCost = (usage.output_tokens / 1000000) * 15.00;
141
- return (inputCost + outputCost).toFixed(4);
142
- }
143
-