@rigour-labs/cli 6.7.6 → 6.7.7
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/dist/cli.js +1 -0
- package/dist/commands/backtest.d.ts +1 -0
- package/dist/commands/backtest.js +12 -1
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -488,6 +488,7 @@ hooksCmd
|
|
|
488
488
|
const backtestCmd = program
|
|
489
489
|
.command('backtest')
|
|
490
490
|
.description('Score the review against the points people made reviewing this repository (.rigour/backtest.json); exit 1 until every point is caught with no false block')
|
|
491
|
+
.option('--last <n>', 'The front door: run on the last n merged pull requests (their human reviews and approved heads), no ledger needed')
|
|
491
492
|
.option('--round <id>', 'Run one round only')
|
|
492
493
|
.option('--reviewer', 'Run the reviewer too, with each round\'s human review hidden')
|
|
493
494
|
.option('--json', 'Output the score in JSON format')
|
|
@@ -3,6 +3,7 @@ export interface BacktestOptions {
|
|
|
3
3
|
reviewer?: boolean;
|
|
4
4
|
json?: boolean;
|
|
5
5
|
config?: string;
|
|
6
|
+
last?: string;
|
|
6
7
|
}
|
|
7
8
|
export declare function backtestCommand(cwd: string, options: BacktestOptions): Promise<number>;
|
|
8
9
|
export declare function backtestInitCommand(cwd: string, options: {
|
|
@@ -6,10 +6,21 @@
|
|
|
6
6
|
* caught with no false block, so a rule change is measured, not believed.
|
|
7
7
|
*/
|
|
8
8
|
import chalk from 'chalk';
|
|
9
|
-
import { backtestPassed, formatBacktest, loadLedger, runBacktest, scaffoldLedger, LEDGER_PATH } from '@rigour-labs/core';
|
|
9
|
+
import { backtestLast, backtestPassed, formatBacktest, formatLast, loadLedger, runBacktest, scaffoldLedger, LEDGER_PATH } from '@rigour-labs/core';
|
|
10
10
|
import { loadConfig, UsageError } from './review-config.js';
|
|
11
11
|
export async function backtestCommand(cwd, options) {
|
|
12
12
|
const config = await loadConfig(cwd, options);
|
|
13
|
+
if (options.last !== undefined) {
|
|
14
|
+
const last = Number(options.last);
|
|
15
|
+
if (!Number.isInteger(last) || last <= 0)
|
|
16
|
+
throw new UsageError('--last takes how many merged pull requests to run, a positive number');
|
|
17
|
+
const report = await backtestLast(cwd, config, { last, reviewer: options.reviewer, progress: message => process.stderr.write(`${message}\n`) });
|
|
18
|
+
if (options.json)
|
|
19
|
+
console.log(JSON.stringify(report, null, 2));
|
|
20
|
+
else
|
|
21
|
+
console.log((report.blocksOnApproved.length ? chalk.red : chalk.green)(formatLast(report)));
|
|
22
|
+
return report.blocksOnApproved.length ? 1 : 0;
|
|
23
|
+
}
|
|
13
24
|
const ledger = loadLedger(cwd);
|
|
14
25
|
const results = await runBacktest(cwd, config, ledger, {
|
|
15
26
|
round: options.round,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rigour-labs/cli",
|
|
3
|
-
"version": "6.7.
|
|
3
|
+
"version": "6.7.7",
|
|
4
4
|
"description": "Code review that happens while your agent writes: deterministic checks on the lines it changed, quiet unless it can prove a defect, and learning from your team's fixes and dismissals. Works with Claude Code, Cursor, Codex, Cline and Windsurf.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.13"
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"inquirer": "9.2.16",
|
|
57
57
|
"ora": "^8.0.1",
|
|
58
58
|
"yaml": "^2.8.2",
|
|
59
|
-
"@rigour-labs/core": "6.7.
|
|
59
|
+
"@rigour-labs/core": "6.7.7"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/fs-extra": "^11.0.4",
|
|
63
63
|
"@types/inquirer": "9.0.7",
|
|
64
64
|
"@types/node": "^25.0.3",
|
|
65
|
-
"@rigour-labs/studio": "6.7.
|
|
65
|
+
"@rigour-labs/studio": "6.7.7"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsc && pnpm bundle-studio",
|