@rigour-labs/cli 5.3.2 → 5.4.0

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.
@@ -543,8 +543,21 @@ function resolveMCPServerConfig() {
543
543
  // Running from local dev checkout — use local path
544
544
  return { command: 'node', args: [localMcpEntry] };
545
545
  }
546
- // Fallback: published npm package
547
- return { command: 'npx', args: ['-y', '@rigour-labs/mcp'] };
546
+ // Fallback: pin published npm package so Cursor resolves a known build
547
+ let mcpSpec = '@rigour-labs/mcp@5.3.2';
548
+ try {
549
+ const mcpPkgPath = path.resolve(thisDir, '../../../rigour-mcp/package.json');
550
+ if (fs.existsSync(mcpPkgPath)) {
551
+ const pkg = JSON.parse(fs.readFileSync(mcpPkgPath, 'utf-8'));
552
+ if (pkg.version && pkg.version.trim().length > 0) {
553
+ mcpSpec = `@rigour-labs/mcp@${pkg.version}`;
554
+ }
555
+ }
556
+ }
557
+ catch {
558
+ // Keep pinned fallback.
559
+ }
560
+ return { command: 'npx', args: ['-y', mcpSpec] };
548
561
  }
549
562
  async function initMCPForDetectedTools(cwd, detectedIDEs, force) {
550
563
  const mcpServerConfig = resolveMCPServerConfig();
@@ -442,16 +442,32 @@ async function setupApiAndLaunch(apiPort, studioPort, eventsPath, cwd, studioPro
442
442
  }
443
443
  else if (url.pathname === '/api/cursor-api-key/status') {
444
444
  try {
445
- const { getCursorApiKey } = await import('@rigour-labs/core');
445
+ const { getCursorApiKey, countCursorAdminImportedEvents } = await import('@rigour-labs/core');
446
446
  const configured = Boolean(getCursorApiKey());
447
+ const importedCount = await countCursorAdminImportedEvents(cwd);
447
448
  res.writeHead(200, { 'Content-Type': 'application/json' });
448
- res.end(JSON.stringify({ configured }));
449
+ res.end(JSON.stringify({ configured, importedCount }));
449
450
  }
450
451
  catch (e) {
451
452
  res.writeHead(500);
452
453
  res.end(JSON.stringify({ error: e.message }));
453
454
  }
454
455
  }
456
+ else if (url.pathname === '/api/cursor-sync' && req.method === 'POST') {
457
+ try {
458
+ const { syncCursorUsageFromAdminApi } = await import('@rigour-labs/core');
459
+ const result = await syncCursorUsageFromAdminApi(cwd);
460
+ res.writeHead(200, { 'Content-Type': 'application/json' });
461
+ res.end(JSON.stringify({ success: true, ...result }));
462
+ }
463
+ catch (e) {
464
+ res.writeHead(502, { 'Content-Type': 'application/json' });
465
+ res.end(JSON.stringify({
466
+ success: false,
467
+ error: e.message || 'Cursor usage sync failed',
468
+ }));
469
+ }
470
+ }
455
471
  else if (url.pathname === '/api/cursor-api-key' && req.method === 'POST') {
456
472
  let body = '';
457
473
  req.on('data', chunk => body += chunk);
@@ -463,10 +479,24 @@ async function setupApiAndLaunch(apiPort, studioPort, eventsPath, cwd, studioPro
463
479
  res.end(JSON.stringify({ error: 'Missing apiKey' }));
464
480
  return;
465
481
  }
466
- const { updateCursorApiKey } = await import('@rigour-labs/core');
482
+ const { updateCursorApiKey, syncCursorUsageFromAdminApi } = await import('@rigour-labs/core');
467
483
  updateCursorApiKey(apiKey.trim());
484
+ let syncResult = { importedCount: 0, totalEvents: 0 };
485
+ let syncError;
486
+ try {
487
+ syncResult = await syncCursorUsageFromAdminApi(cwd);
488
+ }
489
+ catch (syncErr) {
490
+ syncError = syncErr?.message || 'Initial Cursor sync failed';
491
+ }
468
492
  res.writeHead(200, { 'Content-Type': 'application/json' });
469
- res.end(JSON.stringify({ success: true, configured: true }));
493
+ res.end(JSON.stringify({
494
+ success: true,
495
+ configured: true,
496
+ importedCount: syncResult.importedCount,
497
+ totalEvents: syncResult.totalEvents,
498
+ syncError,
499
+ }));
470
500
  }
471
501
  catch (e) {
472
502
  res.writeHead(500);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigour-labs/cli",
3
- "version": "5.3.2",
3
+ "version": "5.4.0",
4
4
  "description": "AI-native quality gates with local LLM analysis. Forces AI agents (Claude, Cursor, Copilot, Cline, Windsurf) to meet engineering standards. Bayesian Brain learns your codebase. Zero config: npx rigour-scan.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://rigour.run",
@@ -53,7 +53,7 @@
53
53
  "inquirer": "9.2.16",
54
54
  "ora": "^8.0.1",
55
55
  "yaml": "^2.8.2",
56
- "@rigour-labs/core": "5.3.2"
56
+ "@rigour-labs/core": "5.4.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/fs-extra": "^11.0.4",