rulereceipt 0.1.31 → 0.1.32
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.
|
@@ -92,9 +92,12 @@ function ruleLabel(result, all) {
|
|
|
92
92
|
function countBy(results, status) {
|
|
93
93
|
return results.filter((r) => r.status === status).length;
|
|
94
94
|
}
|
|
95
|
-
function renderResultRow(result, all) {
|
|
95
|
+
function renderResultRow(result, all, hideEvidence) {
|
|
96
96
|
const bucket = bucketOf(result);
|
|
97
97
|
const cls = BUCKET_CLASS[bucket];
|
|
98
|
+
const evidence = !hideEvidence && result.evidence
|
|
99
|
+
? `<p class="result__evidence">${clean(result.evidence)}</p>`
|
|
100
|
+
: "";
|
|
98
101
|
return `
|
|
99
102
|
<article class="result result--${cls}">
|
|
100
103
|
<div class="result__head">
|
|
@@ -102,9 +105,30 @@ function renderResultRow(result, all) {
|
|
|
102
105
|
<span class="result__id">${clean(ruleLabel(result, all))}</span>
|
|
103
106
|
</div>
|
|
104
107
|
<h3 class="result__title">${clean(result.ruleTitle)}</h3>
|
|
105
|
-
${
|
|
108
|
+
${evidence}
|
|
106
109
|
</article>`;
|
|
107
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* The explanation every rule in a section shares, or null when they differ.
|
|
113
|
+
*
|
|
114
|
+
* Judgment rules all carry the same sentence, because the reason is the
|
|
115
|
+
* same one every time. Rendered per-rule that produced thirteen copies of
|
|
116
|
+
* one 300-character paragraph on a real 14-rule file. Fixed in the terminal
|
|
117
|
+
* report first and missed here, which was the wrong half to miss — this is
|
|
118
|
+
* the report that gets sent to someone else.
|
|
119
|
+
*
|
|
120
|
+
* Conditional on the text being byte-identical: `--llm` gives each judgment
|
|
121
|
+
* rule its own model opinion, and hoisting those would delete the only
|
|
122
|
+
* per-rule content the section has.
|
|
123
|
+
*/
|
|
124
|
+
function sharedEvidence(rs) {
|
|
125
|
+
if (rs.length < 2)
|
|
126
|
+
return null;
|
|
127
|
+
const first = rs[0].evidence;
|
|
128
|
+
if (!first)
|
|
129
|
+
return null;
|
|
130
|
+
return rs.every((r) => r.evidence === first) ? first : null;
|
|
131
|
+
}
|
|
108
132
|
function renderSection(bucket, results, all) {
|
|
109
133
|
const inSection = results.filter((r) => bucketOf(r) === bucket);
|
|
110
134
|
if (inSection.length === 0)
|
|
@@ -112,11 +136,14 @@ function renderSection(bucket, results, all) {
|
|
|
112
136
|
const note = bucket === "UNCLEAR_JUDGMENT"
|
|
113
137
|
? `<p class="section__note">These were never questions a tool could settle — they need someone to read the session and decide. That is expected, not a gap in the check.</p>`
|
|
114
138
|
: "";
|
|
139
|
+
const shared = sharedEvidence(inSection);
|
|
140
|
+
const sharedBlock = shared ? `<p class="section__shared">${clean(shared)}</p>` : "";
|
|
115
141
|
return `
|
|
116
142
|
<section class="section">
|
|
117
143
|
<h2 class="section__title">${clean(BUCKET_LABEL[bucket])} <span class="section__count">${inSection.length}</span></h2>
|
|
118
144
|
${note}
|
|
119
|
-
${
|
|
145
|
+
${sharedBlock}
|
|
146
|
+
${inSection.map((r) => renderResultRow(r, all, shared !== null)).join("")}
|
|
120
147
|
</section>`;
|
|
121
148
|
}
|
|
122
149
|
/**
|
|
@@ -202,6 +229,7 @@ export function generateHtmlReport(results, meta) {
|
|
|
202
229
|
.result--judgment { border-left-color: #6b6f76; }
|
|
203
230
|
.badge--judgment { background: #f2f3f5; color: #4a4e55; }
|
|
204
231
|
.section__note { font-size: 13px; color: var(--muted); margin: -4px 0 12px; }
|
|
232
|
+
.section__shared { font-size: 13px; color: var(--muted); margin: 0 0 14px; padding: 10px 12px; border-left: 2px solid var(--line); background: var(--panel); border-radius: 0 6px 6px 0; white-space: pre-wrap; }
|
|
205
233
|
.result__id { font-size: 12px; color: var(--muted); }
|
|
206
234
|
.result__title { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
|
|
207
235
|
.result__evidence { margin: 0; font-size: 14px; color: var(--muted); white-space: pre-wrap; }
|