@rigour-labs/cli 5.0.0 → 5.0.1

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.
@@ -19,6 +19,7 @@ import chalk from 'chalk';
19
19
  import { randomUUID } from 'crypto';
20
20
  import { runHookChecker, scanInputForCredentials, formatDLPAlert, createDLPAuditEntry } from '@rigour-labs/core';
21
21
  // ── Studio event logging ─────────────────────────────────────────────
22
+ const MAX_EVENT_LOG_LINES = 2000;
22
23
  async function logStudioEvent(cwd, event) {
23
24
  try {
24
25
  const rigourDir = path.join(cwd, '.rigour');
@@ -30,11 +31,30 @@ async function logStudioEvent(cwd, event) {
30
31
  ...event,
31
32
  }) + '\n';
32
33
  await fs.appendFile(eventsPath, logEntry);
34
+ // Rotate: keep last MAX_EVENT_LOG_LINES entries to prevent unbounded growth
35
+ await rotateEventLog(eventsPath);
33
36
  }
34
37
  catch {
35
38
  // Silent fail
36
39
  }
37
40
  }
41
+ async function rotateEventLog(eventsPath) {
42
+ try {
43
+ const stat = await fs.stat(eventsPath);
44
+ // Only check rotation when file exceeds ~500KB (avoids reading on every append)
45
+ if (stat.size < 512 * 1024)
46
+ return;
47
+ const content = await fs.readFile(eventsPath, 'utf-8');
48
+ const lines = content.trim().split('\n');
49
+ if (lines.length > MAX_EVENT_LOG_LINES) {
50
+ const trimmed = lines.slice(-MAX_EVENT_LOG_LINES).join('\n') + '\n';
51
+ await fs.writeFile(eventsPath, trimmed);
52
+ }
53
+ }
54
+ catch {
55
+ // Silent fail — rotation is best-effort
56
+ }
57
+ }
38
58
  // ── Tool detection ───────────────────────────────────────────────────
39
59
  const TOOL_MARKERS = {
40
60
  claude: ['CLAUDE.md', '.claude'],
@@ -249,6 +269,8 @@ process.stdin.on('end', async () => {
249
269
  const proc = spawnSync(
250
270
  command,
251
271
  [...baseArgs, '--mode', 'dlp', '--stdin'],
272
+ // Note: joining with \\n is safe — credential patterns match within single values.
273
+ // A credential split across two toolInput fields would be malformed regardless.
252
274
  { input: textsToScan.join('\\n'), encoding: 'utf-8', timeout: 3000 }
253
275
  );
254
276
  if (proc.error) throw proc.error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigour-labs/cli",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "CLI quality gates for AI-generated code. Forces AI agents (Claude, Cursor, Copilot) to meet strict engineering standards with PASS/FAIL enforcement.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://rigour.run",
@@ -44,7 +44,7 @@
44
44
  "inquirer": "9.2.16",
45
45
  "ora": "^8.0.1",
46
46
  "yaml": "^2.8.2",
47
- "@rigour-labs/core": "5.0.0"
47
+ "@rigour-labs/core": "5.0.1"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/fs-extra": "^11.0.4",