agentlytics 0.2.10 → 0.2.11

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.
Files changed (2) hide show
  1. package/index.js +23 -9
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -201,16 +201,30 @@ try {
201
201
  require('better-sqlite3');
202
202
  } catch (e) {
203
203
  if (e.message && e.message.includes('Could not locate the bindings file')) {
204
- console.log(chalk.cyan(' ⟳ Rebuilding native SQLite module...'));
204
+ console.log(chalk.cyan(' ⟳ Native SQLite module not found, downloading prebuilt binary...'));
205
+ const bsqlDir = path.dirname(require.resolve('better-sqlite3/package.json'));
206
+ let rebuilt = false;
207
+ // 1) Use prebuild-install (dep of better-sqlite3) to download a prebuilt binary
205
208
  try {
206
- const bsqlDir = path.dirname(require.resolve('better-sqlite3/package.json'));
207
- execSync('npx --yes prebuild-install -r napi || npx --yes node-gyp rebuild --release', {
208
- cwd: bsqlDir, stdio: 'pipe', timeout: 120000,
209
- });
210
- console.log(chalk.green(' ✓ Native module rebuilt'));
211
- } catch (rebuildErr) {
212
- console.error(chalk.red(' Failed to rebuild better-sqlite3:'), rebuildErr.message);
213
- console.error(chalk.dim(' Try: npm install better-sqlite3 --build-from-source'));
209
+ const prebuildBin = require.resolve('prebuild-install/bin.js');
210
+ execSync(`node "${prebuildBin}" -r napi`, { cwd: bsqlDir, stdio: 'pipe', timeout: 60000 });
211
+ rebuilt = true;
212
+ } catch {}
213
+ // 2) Fallback: compile from source via node-gyp
214
+ if (!rebuilt) {
215
+ console.log(chalk.cyan(' Prebuilt unavailable, compiling from source...'));
216
+ try {
217
+ execSync('npx --yes node-gyp rebuild --release', { cwd: bsqlDir, stdio: 'pipe', timeout: 120000 });
218
+ rebuilt = true;
219
+ } catch {}
220
+ }
221
+ if (rebuilt) {
222
+ console.log(chalk.green(' ✓ Native module ready'));
223
+ // Clear require cache so the freshly built binding is picked up
224
+ delete require.cache[require.resolve('better-sqlite3')];
225
+ } else {
226
+ console.error(chalk.red(' ✗ Failed to build better-sqlite3.'));
227
+ console.error(chalk.dim(' Ensure build tools are installed (python3, make, g++).'));
214
228
  process.exit(1);
215
229
  }
216
230
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentlytics",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "Comprehensive analytics dashboard for AI coding agents — Cursor, Windsurf, Claude Code, VS Code Copilot, Zed, Antigravity, OpenCode, Command Code",
5
5
  "main": "index.js",
6
6
  "bin": {