refactor(cleanup): simplify pass on the R-a diff

engine-compare imports the coordinator's title limit and trim instead
of a copy whose reason went with Arm B; the autonomy gate exports one
parser and its test runs in-process with two CLI runs; one import
scanner in lib-imports; the fenced-section walker shared from
tests/helpers/md-section.mjs instead of six copies; plan-gate hash
in-process; living-paths scans once; routing drops the orchestrator
filter whose files are gone; small leftovers removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-11-07 13:31:30 +01:00
commit efe981f7bc
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
18 changed files with 161 additions and 358 deletions

View file

@ -444,7 +444,7 @@ function effectiveSeverity(f) {
return getRule(f.rule_key)?.severity ?? f.severity;
}
function trimText(text, max) {
export function trimText(text, max) {
return text.slice(0, max - TRIM_MARKER.length) + TRIM_MARKER;
}

View file

@ -18,6 +18,7 @@
// (lib/review/coordinator-contract.mjs runContract, `engine:out-of-scope`).
import { ENGINES } from './engine-findings.mjs';
import { JUDGE_TITLE_MAX, trimText } from './coordinator-contract.mjs';
// The (file,line,rule_key) triplet a finding is deduped and matched on.
const tripletOf = (f) => `${f.file}\u0000${f.line}\u0000${f.rule_key}`;
@ -26,14 +27,10 @@ const normTitle = (f) => String(f.title).trim().toLowerCase();
// The row a finding is matched to after the coordinator: its triplet plus its
// `normTitle`. An untitled finding gets a key no titled row has.
const rowOf = (f) => `${tripletOf(f)}\u0000${f.title === undefined ? '\u0001' : normTitle(f)}`;
// The coordinator trims an over-long MINOR/SUGGESTION title as
// lib/review/coordinator-contract.mjs judgeFilter does; its marker and limit
// are inlined.
const TRIM_MARKER = ' […trimmed]';
const JUDGE_TITLE_MAX = 100;
// A title as that trim writes it: over JUDGE_TITLE_MAX characters, cut to
// leave room for the marker, then the marker; any other title unchanged.
const trimmedTitle = (t) => (t.length > JUDGE_TITLE_MAX ? t.slice(0, JUDGE_TITLE_MAX - TRIM_MARKER.length) + TRIM_MARKER : t);
// A title as lib/review/coordinator-contract.mjs judgeFilter trims an
// over-long MINOR/SUGGESTION title: over JUDGE_TITLE_MAX characters it is
// trimText's cut; any other title unchanged.
const trimmedTitle = (t) => (t.length > JUDGE_TITLE_MAX ? trimText(t, JUDGE_TITLE_MAX) : t);
export { tripletOf, normTitle, rowOf, trimmedTitle };

View file

@ -150,10 +150,7 @@ export function collisions(corpus, t = THRESHOLDS) {
// ---- loading ----
/** Orchestrator reference docs are not spawnable capabilities (CLAUDE.md, Inventory). */
const isReferenceDoc = (name, description) => /-orchestrator$/.test(name) || /^Reference document, not a spawnable/.test(description.trim());
/** Skills, commands and spawnable agents of a plugin root. */
/** Skills, commands and agents of a plugin root. */
export function loadEntries(root) {
const entries = [];
const skillsDir = join(root, 'skills');
@ -174,9 +171,7 @@ export function loadEntries(root) {
const text = readFileSync(join(d, file), 'utf8');
const fm = readFrontmatterFields(text).fields;
const name = fm.name ? String(fm.name.value) : file.replace(/\.md$/, '');
const description = descriptionOf(text);
if (kind === 'agent' && isReferenceDoc(name, description)) continue;
entries.push({ id: `${kind}:${name}`, kind, name, description });
entries.push({ id: `${kind}:${name}`, kind, name, description: descriptionOf(text) });
}
}
return entries;

View file

@ -15,13 +15,8 @@
import { isMain } from './is-main.mjs';
/**
* A --gates value: true|closed = on, false|open = off, else undefined.
*
* @param {string|undefined} v
* @returns {boolean|undefined}
*/
export function gatesValue(v) {
/** A --gates value: true|closed = on, false|open = off, else undefined. */
function gatesValue(v) {
if (v === 'true' || v === 'closed') return true;
if (v === 'false' || v === 'open') return false;
return undefined;