@rigour-labs/cli 6.11.0 → 6.11.1-rc.2
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/learn-reviews.d.ts +2 -0
- package/dist/commands/learn-reviews.js +15 -1
- package/dist/commands/studio-learning.d.ts +5 -0
- package/dist/commands/studio-learning.js +12 -2
- package/package.json +3 -3
- package/studio-dist/assets/{index-BCsbfh30.js → index-BjCU3jxW.js} +13 -13
- package/studio-dist/index.html +1 -1
package/dist/cli.js
CHANGED
|
@@ -403,6 +403,7 @@ program
|
|
|
403
403
|
.option('--promote <id>', 'Accept a candidate as a lesson (recorded as your decision)')
|
|
404
404
|
.option('--reject <id>', 'Reject a candidate or lesson: the judges are told this team decided against it')
|
|
405
405
|
.option('--why <text>', 'Why, recorded with --promote or --reject')
|
|
406
|
+
.option('--use-wording <id>', 'Take the corrected wording a newer version suggests for a lesson you decided (the old wording is kept as evidence)')
|
|
406
407
|
.option('--compile', 'Propose a deterministic check for each verified lesson a template fits, and list the compiled checks')
|
|
407
408
|
.option('--approve-check <id>', 'Approve a compiled check: it runs on every review (a note unless gates.compiled_lessons.block)')
|
|
408
409
|
.option('--withdraw-check <id>', 'Take a compiled check back: it stops running')
|
|
@@ -15,6 +15,8 @@ export interface LearnReviewsOptions {
|
|
|
15
15
|
/** A person's decision on a compiled check: it runs (approve) or stops (withdraw). */
|
|
16
16
|
approveCheck?: string;
|
|
17
17
|
withdrawCheck?: string;
|
|
18
|
+
/** A person takes the corrected wording a newer version suggested for a lesson they decided. */
|
|
19
|
+
useWording?: string;
|
|
18
20
|
}
|
|
19
21
|
export declare function learnReviewsCommand(cwd: string, options: LearnReviewsOptions): Promise<void>;
|
|
20
22
|
/** owner/name from the origin remote (https or ssh, any host alias). */
|
|
@@ -11,7 +11,7 @@ import { execFileSync } from 'child_process';
|
|
|
11
11
|
import chalk from 'chalk';
|
|
12
12
|
import path from 'path';
|
|
13
13
|
import { personOf } from './git-identity.js';
|
|
14
|
-
import { branchBase, decideCompiledCheck, decideLesson, defaultExec, proposeCompiledChecks, readCompiledChecks, suspension, githubToken, learnFromReviews, lessonsPath, readLessons, ruleWriterFor, ConfigSchema } from '@rigour-labs/core';
|
|
14
|
+
import { acceptSuggestedText, branchBase, decideCompiledCheck, decideLesson, defaultExec, proposeCompiledChecks, readCompiledChecks, suspension, githubToken, learnFromReviews, lessonsPath, readLessons, ruleWriterFor, ConfigSchema } from '@rigour-labs/core';
|
|
15
15
|
import { loadConfig } from './review-config.js';
|
|
16
16
|
export async function learnReviewsCommand(cwd, options) {
|
|
17
17
|
if (options.promote)
|
|
@@ -20,6 +20,8 @@ export async function learnReviewsCommand(cwd, options) {
|
|
|
20
20
|
return decide(cwd, options.reject, 'rejected', options.why);
|
|
21
21
|
if (options.list)
|
|
22
22
|
return list(cwd, options.json);
|
|
23
|
+
if (options.useWording)
|
|
24
|
+
return useWording(cwd, options.useWording);
|
|
23
25
|
if (options.compile)
|
|
24
26
|
return compile(cwd, options.json);
|
|
25
27
|
if (options.approveCheck)
|
|
@@ -58,6 +60,8 @@ function list(cwd, json) {
|
|
|
58
60
|
const prs = [...new Set(l.evidence.map(e => `#${e.pr}`))].join(', ');
|
|
59
61
|
const by = l.promotedBy ? chalk.dim(` [${l.promotedBy}]`) : '';
|
|
60
62
|
console.log(`${label[l.state]} ${chalk.dim(l.id)} ${l.file || '(team standard)'}: ${l.text}${by} ${chalk.dim(`(${prs})`)}`);
|
|
63
|
+
if (l.suggestedText)
|
|
64
|
+
console.log(chalk.cyan(` corrected wording (${l.suggestedWhy ?? 'reworded'}): ${l.suggestedText}`) + chalk.dim(` take it: rigour learn-reviews --use-wording ${l.id}`));
|
|
61
65
|
}
|
|
62
66
|
if (lessons.length === 0)
|
|
63
67
|
console.log('No review lessons yet. Run `rigour learn-reviews`.');
|
|
@@ -113,6 +117,16 @@ function decideCheckOrThrow(cwd, id, state) {
|
|
|
113
117
|
}
|
|
114
118
|
console.log(state === 'active' ? chalk.green(`✔ Runs from now on (a note unless gates.compiled_lessons.block): ${check.message}`) : chalk.yellow(`✔ Taken back: ${check.message}`));
|
|
115
119
|
}
|
|
120
|
+
/** A person takes the suggested wording of a lesson they decided; the old wording is kept as evidence. */
|
|
121
|
+
function useWording(cwd, id) {
|
|
122
|
+
const lesson = acceptSuggestedText(cwd, id, personOf(cwd));
|
|
123
|
+
if (!lesson) {
|
|
124
|
+
console.error(chalk.red(`No lesson ${id} with a suggested wording.`));
|
|
125
|
+
process.exitCode = 1;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
console.log(chalk.green(`✔ Now reads: ${lesson.text}`));
|
|
129
|
+
}
|
|
116
130
|
/** A person's decision, kept as evidence with who made it (their git email) and why. */
|
|
117
131
|
function decide(cwd, id, decision, why) {
|
|
118
132
|
const lesson = decideLesson(cwd, id, decision, personOf(cwd), why);
|
|
@@ -38,6 +38,11 @@ export interface LessonJourney {
|
|
|
38
38
|
detail: string;
|
|
39
39
|
evidence: string[];
|
|
40
40
|
};
|
|
41
|
+
/** A corrected wording for a review lesson a person decided, waiting for them (core acceptSuggestedText). */
|
|
42
|
+
suggestedText?: {
|
|
43
|
+
text: string;
|
|
44
|
+
why: string;
|
|
45
|
+
};
|
|
41
46
|
}
|
|
42
47
|
export interface StudioLearning {
|
|
43
48
|
lessons: LessonJourney[];
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* lesson's subject prefix). Counts that Rigour cannot know here are null, never 0: PR catches
|
|
8
8
|
* recorded on another machine (CI) never reach this one.
|
|
9
9
|
*/
|
|
10
|
-
import { decideCompiledCheck, decideLesson, fixLessonPrefix, proposeCompiledChecks, readCompiledChecks, suspension, localOutcomeMetrics, pendingDecision, listKnowledgeLessons, readLessons } from '@rigour-labs/core';
|
|
10
|
+
import { acceptSuggestedText, decideCompiledCheck, decideLesson, fixLessonPrefix, proposeCompiledChecks, readCompiledChecks, suspension, localOutcomeMetrics, pendingDecision, listKnowledgeLessons, readLessons } from '@rigour-labs/core';
|
|
11
11
|
import { personOf } from './git-identity.js';
|
|
12
12
|
import { checkoutRoots, eventsAcross, storiesAcross } from './studio-checkouts.js';
|
|
13
13
|
const WEEK_MS = 7 * 24 * 60 * 60 * 1000;
|
|
@@ -50,6 +50,7 @@ export function buildLearning(input) {
|
|
|
50
50
|
stoppedInDevelopment: null,
|
|
51
51
|
reachedPr: null,
|
|
52
52
|
...decisionFor(l),
|
|
53
|
+
...(l.suggestedText ? { suggestedText: { text: l.suggestedText, why: l.suggestedWhy ?? 'reworded' } } : {}),
|
|
53
54
|
})),
|
|
54
55
|
// Lessons back to a candidate when outcomes stopped promoting come first: a person decides each once.
|
|
55
56
|
].sort((a, b) => Number(!!b.reclassified) - Number(!!a.reclassified) || b.learnedAt.localeCompare(a.learnedAt))
|
|
@@ -92,13 +93,22 @@ export function decideReviewLesson(cwd, body) {
|
|
|
92
93
|
const { id, decision, why } = (body ?? {});
|
|
93
94
|
if (typeof id !== 'string' || !/^[0-9a-f]{12}$/.test(id))
|
|
94
95
|
throw new Error('a review lesson id (12 hex characters) is required');
|
|
96
|
+
if (decision === 'reworded')
|
|
97
|
+
return rewordFromStudio(cwd, id);
|
|
95
98
|
if (decision !== 'accepted' && decision !== 'rejected' && decision !== 'dismissed')
|
|
96
|
-
throw new Error('decision is accepted, rejected or
|
|
99
|
+
throw new Error('decision is accepted, rejected, dismissed or reworded');
|
|
97
100
|
const lesson = decideLesson(cwd, id, decision, personOf(cwd), typeof why === 'string' && why.trim() ? why.trim() : 'decided in Studio');
|
|
98
101
|
if (!lesson)
|
|
99
102
|
throw new Error(`no review lesson ${id}`);
|
|
100
103
|
return { id: lesson.id, state: lesson.state };
|
|
101
104
|
}
|
|
105
|
+
/** A person takes a decided lesson's suggested wording from Studio, recorded as `--use-wording` records it. */
|
|
106
|
+
function rewordFromStudio(cwd, id) {
|
|
107
|
+
const lesson = acceptSuggestedText(cwd, id, personOf(cwd));
|
|
108
|
+
if (!lesson)
|
|
109
|
+
throw new Error(`no review lesson ${id} with a suggested wording`);
|
|
110
|
+
return { id: lesson.id, state: lesson.state };
|
|
111
|
+
}
|
|
102
112
|
/**
|
|
103
113
|
* A person's decision on a compiled check from Studio, as `rigour learn-reviews --approve-check / --withdraw-check`
|
|
104
114
|
* records it: with their git email, committed with the check. With no git email set, it is refused.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rigour-labs/cli",
|
|
3
|
-
"version": "6.11.
|
|
3
|
+
"version": "6.11.1-rc.2",
|
|
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"
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"inquirer": "9.2.16",
|
|
60
60
|
"ora": "^8.0.1",
|
|
61
61
|
"yaml": "^2.8.2",
|
|
62
|
-
"@rigour-labs/core": "6.11.
|
|
62
|
+
"@rigour-labs/core": "6.11.1-rc.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/fs-extra": "^11.0.4",
|
|
66
66
|
"@types/inquirer": "9.0.7",
|
|
67
67
|
"@types/node": "^25.0.3",
|
|
68
|
-
"@rigour-labs/studio": "6.11.
|
|
68
|
+
"@rigour-labs/studio": "6.11.1-rc.2"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "tsc && pnpm bundle-studio",
|