vibecode-anything 0.3.0 → 0.4.0
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/README.md +239 -67
- package/dist/cli.js +2140 -73
- package/dist/core/adapters.d.ts +26 -3
- package/dist/core/adapters.js +411 -25
- package/dist/core/agent-adapter.d.ts +67 -0
- package/dist/core/agent-adapter.js +312 -0
- package/dist/core/anti-cheat.d.ts +6 -0
- package/dist/core/anti-cheat.js +372 -0
- package/dist/core/badge.d.ts +18 -0
- package/dist/core/badge.js +360 -0
- package/dist/core/cache.d.ts +47 -0
- package/dist/core/cache.js +403 -0
- package/dist/core/ci-export.d.ts +35 -0
- package/dist/core/ci-export.js +796 -0
- package/dist/core/ci-formats.d.ts +21 -0
- package/dist/core/ci-formats.js +388 -0
- package/dist/core/client-codegen.d.ts +36 -0
- package/dist/core/client-codegen.js +2538 -0
- package/dist/core/compose.d.ts +71 -0
- package/dist/core/compose.js +1088 -0
- package/dist/core/docs-export.d.ts +37 -0
- package/dist/core/docs-export.js +2706 -0
- package/dist/core/doctor.d.ts +21 -1
- package/dist/core/doctor.js +234 -21
- package/dist/core/exec.d.ts +26 -2
- package/dist/core/exec.js +235 -8
- package/dist/core/fixtures.d.ts +153 -0
- package/dist/core/fixtures.js +2245 -0
- package/dist/core/format.d.ts +77 -0
- package/dist/core/format.js +632 -0
- package/dist/core/fs-snapshot.d.ts +37 -0
- package/dist/core/fs-snapshot.js +216 -0
- package/dist/core/graphql-export.d.ts +34 -0
- package/dist/core/graphql-export.js +2482 -0
- package/dist/core/har-export.d.ts +29 -0
- package/dist/core/har-export.js +988 -0
- package/dist/core/html-report.d.ts +27 -0
- package/dist/core/html-report.js +1535 -0
- package/dist/core/http-export.d.ts +31 -0
- package/dist/core/http-export.js +726 -0
- package/dist/core/impact.d.ts +80 -0
- package/dist/core/impact.js +1412 -0
- package/dist/core/lint.d.ts +38 -0
- package/dist/core/lint.js +1111 -0
- package/dist/core/load-export.d.ts +37 -0
- package/dist/core/load-export.js +1813 -0
- package/dist/core/mcp-export.d.ts +35 -0
- package/dist/core/mcp-export.js +1736 -0
- package/dist/core/mock-server.d.ts +47 -0
- package/dist/core/mock-server.js +1722 -0
- package/dist/core/openapi-export.d.ts +44 -0
- package/dist/core/openapi-export.js +1074 -0
- package/dist/core/parity.d.ts +6 -1
- package/dist/core/parity.js +36 -1
- package/dist/core/playwright-exporter.d.ts +23 -0
- package/dist/core/playwright-exporter.js +1343 -0
- package/dist/core/png.js +45 -9
- package/dist/core/regression.d.ts +54 -0
- package/dist/core/regression.js +529 -0
- package/dist/core/responsive.d.ts +86 -0
- package/dist/core/responsive.js +606 -0
- package/dist/core/run.d.ts +74 -0
- package/dist/core/run.js +696 -0
- package/dist/core/scheduler.d.ts +24 -0
- package/dist/core/scheduler.js +162 -0
- package/dist/core/schema-export.d.ts +29 -0
- package/dist/core/schema-export.js +2215 -0
- package/dist/core/schema.d.ts +3 -2
- package/dist/core/schema.js +460 -17
- package/dist/core/security.d.ts +233 -0
- package/dist/core/security.js +1839 -0
- package/dist/core/server-export.d.ts +38 -0
- package/dist/core/server-export.js +3198 -0
- package/dist/core/spec-writer.d.ts +9 -0
- package/dist/core/spec-writer.js +1202 -0
- package/dist/core/store.d.ts +11 -2
- package/dist/core/store.js +128 -8
- package/dist/core/target-map.d.ts +34 -0
- package/dist/core/target-map.js +262 -0
- package/dist/core/test-exporter.d.ts +25 -0
- package/dist/core/test-exporter.js +1918 -0
- package/dist/core/types.d.ts +182 -14
- package/dist/core/visual-semantic.d.ts +67 -0
- package/dist/core/visual-semantic.js +673 -0
- package/dist/core/visual.js +65 -16
- package/dist/core/watch.d.ts +28 -3
- package/dist/core/watch.js +222 -12
- package/dist/core/yaml.d.ts +5 -0
- package/dist/core/yaml.js +1009 -0
- package/dist/diagnostics/diagnose.d.ts +53 -0
- package/dist/diagnostics/diagnose.js +1083 -0
- package/dist/diagnostics/flake.d.ts +71 -0
- package/dist/diagnostics/flake.js +608 -0
- package/dist/diagnostics/mutation-audit.d.ts +69 -0
- package/dist/diagnostics/mutation-audit.js +769 -0
- package/dist/diagnostics/spatial.d.ts +42 -0
- package/dist/diagnostics/spatial.js +346 -0
- package/dist/diagnostics/trends.d.ts +122 -0
- package/dist/diagnostics/trends.js +1190 -0
- package/dist/discovery/discover.d.ts +111 -0
- package/dist/discovery/discover.js +2017 -0
- package/dist/discovery/lock.d.ts +116 -0
- package/dist/discovery/lock.js +1505 -0
- package/dist/discovery/routes.d.ts +36 -0
- package/dist/discovery/routes.js +1494 -0
- package/dist/discovery/test-importer.d.ts +92 -0
- package/dist/discovery/test-importer.js +4952 -0
- package/dist/index.d.ts +123 -0
- package/dist/index.js +99 -0
- package/dist/ingestors/api-collections.d.ts +28 -0
- package/dist/ingestors/api-collections.js +2335 -0
- package/dist/ingestors/api-repo.d.ts +2 -1
- package/dist/ingestors/api-repo.js +483 -85
- package/dist/ingestors/asyncapi.d.ts +26 -0
- package/dist/ingestors/asyncapi.js +2105 -0
- package/dist/ingestors/bridges.d.ts +2 -0
- package/dist/ingestors/bridges.js +702 -0
- package/dist/ingestors/cli.d.ts +2 -1
- package/dist/ingestors/cli.js +234 -46
- package/dist/ingestors/curl.d.ts +14 -0
- package/dist/ingestors/curl.js +1024 -0
- package/dist/ingestors/graphql.d.ts +56 -0
- package/dist/ingestors/graphql.js +1852 -0
- package/dist/ingestors/http-file.d.ts +20 -0
- package/dist/ingestors/http-file.js +923 -0
- package/dist/ingestors/index.js +486 -6
- package/dist/ingestors/openrpc.d.ts +29 -0
- package/dist/ingestors/openrpc.js +1807 -0
- package/dist/ingestors/proto.d.ts +47 -0
- package/dist/ingestors/proto.js +2690 -0
- package/dist/ingestors/trace.d.ts +10 -0
- package/dist/ingestors/trace.js +599 -0
- package/dist/ingestors/video.d.ts +4 -1
- package/dist/ingestors/video.js +86 -36
- package/dist/ingestors/web.d.ts +16 -1
- package/dist/ingestors/web.js +474 -32
- package/dist/mcp/server.js +3532 -67
- package/dist/oracles/api-repo.js +102 -30
- package/dist/oracles/cli.js +65 -17
- package/dist/oracles/http-workflow.d.ts +68 -0
- package/dist/oracles/http-workflow.js +828 -0
- package/dist/oracles/image.js +178 -28
- package/dist/oracles/index.d.ts +3 -1
- package/dist/oracles/index.js +243 -14
- package/dist/oracles/perf-budget.d.ts +90 -0
- package/dist/oracles/perf-budget.js +1329 -0
- package/dist/oracles/stream.d.ts +94 -0
- package/dist/oracles/stream.js +1268 -0
- package/dist/oracles/ui-states.d.ts +49 -0
- package/dist/oracles/ui-states.js +894 -0
- package/dist/oracles/video.d.ts +1 -1
- package/dist/oracles/video.js +232 -16
- package/dist/oracles/web.js +464 -73
- package/dist/plugins/builtins.d.ts +12 -0
- package/dist/plugins/builtins.js +1052 -0
- package/dist/plugins/registry.d.ts +86 -0
- package/dist/plugins/registry.js +554 -0
- package/dist/setup/index.js +145 -33
- package/package.json +56 -47
- package/skills/vibecode-anything/SKILL.md +75 -52
|
@@ -0,0 +1,1535 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { artifactPath, ensureDir } from "./store.js";
|
|
4
|
+
import { isForbiddenObjectKey, isSensitiveHeaderName, isSensitiveKeyName, redactSensitiveTextWithOptions } from "./security.js";
|
|
5
|
+
import { redactHeaders } from "../ingestors/trace.js";
|
|
6
|
+
const MAX_PNG_BYTES = 2 * 1024 * 1024;
|
|
7
|
+
const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
8
|
+
export function escapeHtml(value) {
|
|
9
|
+
return String(value)
|
|
10
|
+
.replace(/&/g, "&")
|
|
11
|
+
.replace(/</g, "<")
|
|
12
|
+
.replace(/>/g, ">")
|
|
13
|
+
.replace(/"/g, """)
|
|
14
|
+
.replace(/'/g, "'");
|
|
15
|
+
}
|
|
16
|
+
function safeJsonForScript(value) {
|
|
17
|
+
return JSON.stringify(value)
|
|
18
|
+
.replace(/</g, "\\u003c")
|
|
19
|
+
.replace(/>/g, "\\u003e")
|
|
20
|
+
.replace(/&/g, "\\u0026")
|
|
21
|
+
.replace(/\u2028/g, "\\u2028")
|
|
22
|
+
.replace(/\u2029/g, "\\u2029");
|
|
23
|
+
}
|
|
24
|
+
function isRecord(value) {
|
|
25
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
function redactSensitiveText(input) {
|
|
28
|
+
return redactSensitiveTextWithOptions(input, { vaultToken: "[REDACTED_VAULT_PATH]" });
|
|
29
|
+
}
|
|
30
|
+
function redactHeaderRecord(headers) {
|
|
31
|
+
if (!isRecord(headers))
|
|
32
|
+
return {};
|
|
33
|
+
const masked = redactHeaders(headers, "mask");
|
|
34
|
+
const out = {};
|
|
35
|
+
for (const [key, val] of Object.entries(masked)) {
|
|
36
|
+
if (isForbiddenObjectKey(key))
|
|
37
|
+
continue;
|
|
38
|
+
const safeKey = redactSensitiveText(key);
|
|
39
|
+
if (isForbiddenObjectKey(safeKey))
|
|
40
|
+
continue;
|
|
41
|
+
if (isSensitiveHeaderName(key) || isSensitiveKeyName(key)) {
|
|
42
|
+
out[safeKey] = "[REDACTED]";
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
out[safeKey] = redactSensitiveText(val);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
function sanitizeValue(value, depth = 0) {
|
|
51
|
+
if (depth > 8)
|
|
52
|
+
return "[TRUNCATED]";
|
|
53
|
+
if (typeof value === "string")
|
|
54
|
+
return redactSensitiveText(value);
|
|
55
|
+
if (value === null || typeof value !== "object")
|
|
56
|
+
return value;
|
|
57
|
+
if (Array.isArray(value)) {
|
|
58
|
+
return value.map((item) => sanitizeValue(item, depth + 1));
|
|
59
|
+
}
|
|
60
|
+
const obj = value;
|
|
61
|
+
const out = {};
|
|
62
|
+
for (const [key, entry] of Object.entries(obj)) {
|
|
63
|
+
if (entry === undefined || isForbiddenObjectKey(key))
|
|
64
|
+
continue;
|
|
65
|
+
const safeKey = redactSensitiveText(key);
|
|
66
|
+
if (isForbiddenObjectKey(safeKey))
|
|
67
|
+
continue;
|
|
68
|
+
if (key.toLowerCase() === "headers" && isRecord(entry)) {
|
|
69
|
+
const strHeaders = {};
|
|
70
|
+
for (const [hk, hv] of Object.entries(entry)) {
|
|
71
|
+
if (hv !== undefined && hv !== null && !isForbiddenObjectKey(hk))
|
|
72
|
+
strHeaders[hk] = String(hv);
|
|
73
|
+
}
|
|
74
|
+
out[safeKey] = redactHeaderRecord(strHeaders);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (isSensitiveHeaderName(key) || isSensitiveKeyName(key)) {
|
|
78
|
+
out[safeKey] = "[REDACTED]";
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
out[safeKey] = sanitizeValue(entry, depth + 1);
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
function clampRatio(value) {
|
|
86
|
+
const n = typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
87
|
+
return Math.max(0, Math.min(1, n));
|
|
88
|
+
}
|
|
89
|
+
function formatPercent(ratio) {
|
|
90
|
+
return `${(clampRatio(ratio) * 100).toFixed(1)}%`;
|
|
91
|
+
}
|
|
92
|
+
function formatDuration(ms) {
|
|
93
|
+
if (!Number.isFinite(ms) || ms <= 0)
|
|
94
|
+
return "0ms";
|
|
95
|
+
if (ms < 1000)
|
|
96
|
+
return `${Math.round(ms)}ms`;
|
|
97
|
+
return `${(ms / 1000).toFixed(2)}s`;
|
|
98
|
+
}
|
|
99
|
+
function gateBadgeMeta(status) {
|
|
100
|
+
switch (status) {
|
|
101
|
+
case "pass":
|
|
102
|
+
return { label: "PASS", cls: "badge-pass" };
|
|
103
|
+
case "pass_with_warnings":
|
|
104
|
+
return { label: "PASS WITH WARNINGS", cls: "badge-warn" };
|
|
105
|
+
case "incomplete":
|
|
106
|
+
return { label: "INCOMPLETE", cls: "badge-skip" };
|
|
107
|
+
case "fail":
|
|
108
|
+
default:
|
|
109
|
+
return { label: "FAIL", cls: "badge-fail" };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function statusBadgeClass(status) {
|
|
113
|
+
switch (status) {
|
|
114
|
+
case "pass":
|
|
115
|
+
case "passed":
|
|
116
|
+
return "badge-pass";
|
|
117
|
+
case "warn":
|
|
118
|
+
case "in_progress":
|
|
119
|
+
return "badge-warn";
|
|
120
|
+
case "skipped":
|
|
121
|
+
case "pending":
|
|
122
|
+
return "badge-skip";
|
|
123
|
+
case "fail":
|
|
124
|
+
case "failed":
|
|
125
|
+
case "error":
|
|
126
|
+
default:
|
|
127
|
+
return "badge-fail";
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function readPngDataUri(filePath) {
|
|
131
|
+
try {
|
|
132
|
+
if (!filePath || !fs.existsSync(filePath))
|
|
133
|
+
return { uri: null };
|
|
134
|
+
const stat = fs.statSync(filePath);
|
|
135
|
+
if (!stat.isFile() || stat.size <= 0)
|
|
136
|
+
return { uri: null };
|
|
137
|
+
if (stat.size > MAX_PNG_BYTES) {
|
|
138
|
+
return { uri: null, note: `Skipped PNG larger than 2 MB (${(stat.size / (1024 * 1024)).toFixed(2)} MB)` };
|
|
139
|
+
}
|
|
140
|
+
const buf = fs.readFileSync(filePath);
|
|
141
|
+
if (buf.length < PNG_SIGNATURE.length || !buf.subarray(0, PNG_SIGNATURE.length).equals(PNG_SIGNATURE)) {
|
|
142
|
+
return { uri: null };
|
|
143
|
+
}
|
|
144
|
+
return { uri: `data:image/png;base64,${buf.toString("base64")}` };
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return { uri: null };
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function resolveCandidateFilePaths(rawPath, workspaceDir) {
|
|
151
|
+
const candidates = [];
|
|
152
|
+
const trimmed = rawPath.trim();
|
|
153
|
+
if (!trimmed)
|
|
154
|
+
return candidates;
|
|
155
|
+
if (path.isAbsolute(trimmed)) {
|
|
156
|
+
candidates.push(trimmed);
|
|
157
|
+
}
|
|
158
|
+
else if (workspaceDir) {
|
|
159
|
+
candidates.push(path.resolve(workspaceDir, trimmed));
|
|
160
|
+
candidates.push(artifactPath(trimmed, workspaceDir));
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
candidates.push(path.resolve(trimmed));
|
|
164
|
+
}
|
|
165
|
+
return candidates;
|
|
166
|
+
}
|
|
167
|
+
function firstExistingPng(pathsToTry) {
|
|
168
|
+
const seen = new Set();
|
|
169
|
+
for (const candidate of pathsToTry) {
|
|
170
|
+
if (!candidate || seen.has(candidate))
|
|
171
|
+
continue;
|
|
172
|
+
seen.add(candidate);
|
|
173
|
+
const loaded = readPngDataUri(candidate);
|
|
174
|
+
if (loaded.uri || loaded.note)
|
|
175
|
+
return loaded;
|
|
176
|
+
}
|
|
177
|
+
return { uri: null };
|
|
178
|
+
}
|
|
179
|
+
function resolveVisualBundle(contract, invariant, result, workspaceDir) {
|
|
180
|
+
const omittedNotes = [];
|
|
181
|
+
// Reference PNG candidates
|
|
182
|
+
const refPaths = [];
|
|
183
|
+
const refKey = invariant?.input?.referenceArtifact;
|
|
184
|
+
if (typeof refKey === "string" && refKey.trim()) {
|
|
185
|
+
const mapped = contract.artifacts?.files?.[refKey];
|
|
186
|
+
if (typeof mapped === "string" && mapped.trim()) {
|
|
187
|
+
if (workspaceDir) {
|
|
188
|
+
refPaths.push(artifactPath(mapped, workspaceDir));
|
|
189
|
+
refPaths.push(path.resolve(workspaceDir, mapped));
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
refPaths.push(artifactPath(mapped));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (workspaceDir) {
|
|
196
|
+
refPaths.push(artifactPath(refKey, workspaceDir));
|
|
197
|
+
refPaths.push(path.resolve(workspaceDir, refKey));
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
refPaths.push(artifactPath(refKey));
|
|
201
|
+
refPaths.push(path.resolve(refKey));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const refFromMetrics = (typeof result.metrics?.referencePath === "string" && result.metrics.referencePath) ||
|
|
205
|
+
(typeof result.metrics?.referencePng === "string" && result.metrics.referencePng) ||
|
|
206
|
+
(typeof result.diff?.referencePath === "string" && result.diff.referencePath) ||
|
|
207
|
+
null;
|
|
208
|
+
if (refFromMetrics) {
|
|
209
|
+
refPaths.push(...resolveCandidateFilePaths(refFromMetrics, workspaceDir));
|
|
210
|
+
}
|
|
211
|
+
// Candidate PNG candidates
|
|
212
|
+
const candPaths = [];
|
|
213
|
+
const candRaw = [
|
|
214
|
+
result.metrics?.candidatePath,
|
|
215
|
+
result.metrics?.candidatePngPath,
|
|
216
|
+
result.metrics?.candidatePng,
|
|
217
|
+
result.diff?.candidatePath,
|
|
218
|
+
result.diff?.candidatePngPath,
|
|
219
|
+
result.diff?.candidatePng
|
|
220
|
+
];
|
|
221
|
+
for (const raw of candRaw) {
|
|
222
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
223
|
+
candPaths.push(...resolveCandidateFilePaths(raw, workspaceDir));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// Diff Heatmap PNG candidates
|
|
227
|
+
const diffPaths = [];
|
|
228
|
+
const diffRaw = [
|
|
229
|
+
result.metrics?.diffPngPath,
|
|
230
|
+
result.metrics?.diffPng,
|
|
231
|
+
result.diff?.diffPath,
|
|
232
|
+
result.diff?.diffPngPath,
|
|
233
|
+
result.diff?.diffPng
|
|
234
|
+
];
|
|
235
|
+
for (const raw of diffRaw) {
|
|
236
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
237
|
+
diffPaths.push(...resolveCandidateFilePaths(raw, workspaceDir));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const refLoaded = firstExistingPng(refPaths);
|
|
241
|
+
const candLoaded = firstExistingPng(candPaths);
|
|
242
|
+
const diffLoaded = firstExistingPng(diffPaths);
|
|
243
|
+
if (refLoaded.note)
|
|
244
|
+
omittedNotes.push(`Reference: ${refLoaded.note}`);
|
|
245
|
+
if (candLoaded.note)
|
|
246
|
+
omittedNotes.push(`Candidate: ${candLoaded.note}`);
|
|
247
|
+
if (diffLoaded.note)
|
|
248
|
+
omittedNotes.push(`Diff: ${diffLoaded.note}`);
|
|
249
|
+
return {
|
|
250
|
+
referenceUri: refLoaded.uri,
|
|
251
|
+
candidateUri: candLoaded.uri,
|
|
252
|
+
diffUri: diffLoaded.uri,
|
|
253
|
+
omittedNotes
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function extractDiffViews(diff) {
|
|
257
|
+
if (!isRecord(diff))
|
|
258
|
+
return { unifiedDiff: null, jsonDiff: null };
|
|
259
|
+
const unifiedCandidates = [
|
|
260
|
+
isRecord(diff.goldenStdout) ? diff.goldenStdout.unified : undefined,
|
|
261
|
+
diff.unified,
|
|
262
|
+
isRecord(diff.stdout) ? diff.stdout.unified : undefined,
|
|
263
|
+
isRecord(diff.body) ? diff.body.unified : undefined
|
|
264
|
+
];
|
|
265
|
+
let unifiedDiff = null;
|
|
266
|
+
for (const candidate of unifiedCandidates) {
|
|
267
|
+
if (typeof candidate === "string" && candidate.trim().length > 0) {
|
|
268
|
+
unifiedDiff = redactSensitiveText(candidate);
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
const rest = {};
|
|
273
|
+
for (const [key, val] of Object.entries(diff)) {
|
|
274
|
+
if (key === "diffPng" || key === "diffPath" || key === "diffPngPath" || key === "candidatePath" || key === "referencePath") {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
if (unifiedDiff && (key === "goldenStdout" || key === "unified"))
|
|
278
|
+
continue;
|
|
279
|
+
rest[key] = sanitizeValue(val);
|
|
280
|
+
}
|
|
281
|
+
const jsonDiff = Object.keys(rest).length > 0 ? JSON.stringify(rest, null, 2) : null;
|
|
282
|
+
return { unifiedDiff, jsonDiff };
|
|
283
|
+
}
|
|
284
|
+
function formatMetricsEntries(metrics) {
|
|
285
|
+
if (!isRecord(metrics))
|
|
286
|
+
return [];
|
|
287
|
+
const skipKeys = new Set([
|
|
288
|
+
"candidatePath",
|
|
289
|
+
"candidatePngPath",
|
|
290
|
+
"candidatePng",
|
|
291
|
+
"diffPngPath",
|
|
292
|
+
"diffPng",
|
|
293
|
+
"referencePath",
|
|
294
|
+
"referencePng",
|
|
295
|
+
"matchedRegions"
|
|
296
|
+
]);
|
|
297
|
+
const out = [];
|
|
298
|
+
for (const [key, val] of Object.entries(metrics)) {
|
|
299
|
+
if (val === undefined || skipKeys.has(key) || isForbiddenObjectKey(key))
|
|
300
|
+
continue;
|
|
301
|
+
const safeKey = redactSensitiveText(key);
|
|
302
|
+
if (isSensitiveHeaderName(key) || isSensitiveKeyName(key)) {
|
|
303
|
+
out.push([safeKey, "[REDACTED]"]);
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (typeof val === "number") {
|
|
307
|
+
out.push([safeKey, Number.isInteger(val) ? String(val) : val.toFixed(4)]);
|
|
308
|
+
}
|
|
309
|
+
else if (typeof val === "boolean") {
|
|
310
|
+
out.push([safeKey, val ? "true" : "false"]);
|
|
311
|
+
}
|
|
312
|
+
else if (typeof val === "string") {
|
|
313
|
+
out.push([safeKey, redactSensitiveText(val)]);
|
|
314
|
+
}
|
|
315
|
+
else if (isRecord(val) && typeof val.width === "number" && typeof val.height === "number") {
|
|
316
|
+
out.push([safeKey, `${val.width}x${val.height}`]);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return out;
|
|
320
|
+
}
|
|
321
|
+
function prepareInvariantView(contract, invariant, result, workspaceDir) {
|
|
322
|
+
const isHoldout = invariant?.holdout === true || result.metrics?.redacted === true;
|
|
323
|
+
const durationMs = typeof result.durationMs === "number" && Number.isFinite(result.durationMs) ? result.durationMs : 0;
|
|
324
|
+
const safeId = redactSensitiveText(String(result.id ?? "unknown"));
|
|
325
|
+
const safeType = redactSensitiveText(String(result.type ?? "unknown"));
|
|
326
|
+
const safeSeverity = redactSensitiveText(String(result.severity ?? "hard"));
|
|
327
|
+
const safeStatus = redactSensitiveText(String(result.status ?? "fail"));
|
|
328
|
+
if (isHoldout) {
|
|
329
|
+
const rawHint = typeof invariant?.holdoutHint === "string" && invariant.holdoutHint.trim()
|
|
330
|
+
? redactSensitiveText(invariant.holdoutHint.trim())
|
|
331
|
+
: null;
|
|
332
|
+
const safeHint = rawHint && !rawHint.includes("[REDACTED_VAULT_PATH]") ? rawHint : null;
|
|
333
|
+
const redactedFailures = [];
|
|
334
|
+
if (result.status === "fail" || result.status === "error") {
|
|
335
|
+
if (safeHint) {
|
|
336
|
+
redactedFailures.push(safeHint);
|
|
337
|
+
}
|
|
338
|
+
else if (result.metrics?.redacted === true &&
|
|
339
|
+
Array.isArray(result.failures) &&
|
|
340
|
+
typeof result.failures[0] === "string" &&
|
|
341
|
+
result.failures[0].trim() &&
|
|
342
|
+
!/\.vibecode-vault/i.test(result.failures[0])) {
|
|
343
|
+
const scrubbed = redactSensitiveText(result.failures[0].trim());
|
|
344
|
+
redactedFailures.push(scrubbed && !scrubbed.includes("[REDACTED_VAULT_PATH]")
|
|
345
|
+
? scrubbed
|
|
346
|
+
: "Holdout invariant failed (expected details redacted)");
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
redactedFailures.push("Holdout invariant failed (expected details redacted)");
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return {
|
|
353
|
+
id: safeId,
|
|
354
|
+
type: safeType,
|
|
355
|
+
severity: safeSeverity,
|
|
356
|
+
status: safeStatus,
|
|
357
|
+
score: typeof result.score === "number" ? result.score : 0,
|
|
358
|
+
durationMs,
|
|
359
|
+
isHoldout: true,
|
|
360
|
+
label: safeHint ?? "Holdout invariant (details redacted)",
|
|
361
|
+
failures: redactedFailures,
|
|
362
|
+
reason: null,
|
|
363
|
+
metrics: [["redacted", "true"]],
|
|
364
|
+
unifiedDiff: null,
|
|
365
|
+
jsonDiff: null,
|
|
366
|
+
repro: null,
|
|
367
|
+
headers: null,
|
|
368
|
+
visuals: { referenceUri: null, candidateUri: null, diffUri: null, omittedNotes: [] }
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
const label = typeof invariant?.description === "string" && invariant.description.trim()
|
|
372
|
+
? redactSensitiveText(invariant.description.trim())
|
|
373
|
+
: safeId;
|
|
374
|
+
const failures = Array.isArray(result.failures)
|
|
375
|
+
? result.failures.filter((f) => typeof f === "string" && f.trim().length > 0).map(redactSensitiveText)
|
|
376
|
+
: [];
|
|
377
|
+
const reasonParts = [];
|
|
378
|
+
if (typeof result.reason === "string" && result.reason.trim()) {
|
|
379
|
+
reasonParts.push(redactSensitiveText(result.reason.trim()));
|
|
380
|
+
}
|
|
381
|
+
if (result.diagnostic?.message) {
|
|
382
|
+
const cleanDiagMsg = redactSensitiveText(result.diagnostic.message);
|
|
383
|
+
if (!reasonParts.includes(cleanDiagMsg))
|
|
384
|
+
reasonParts.push(cleanDiagMsg);
|
|
385
|
+
}
|
|
386
|
+
const { unifiedDiff, jsonDiff } = extractDiffViews(result.diff);
|
|
387
|
+
const repro = typeof result.repro === "string" && result.repro.trim() ? redactSensitiveText(result.repro.trim()) : null;
|
|
388
|
+
const maskedHeaders = invariant?.input?.headers ? redactHeaderRecord(invariant.input.headers) : null;
|
|
389
|
+
const headers = maskedHeaders && Object.keys(maskedHeaders).length > 0 ? maskedHeaders : null;
|
|
390
|
+
const visuals = resolveVisualBundle(contract, invariant, result, workspaceDir);
|
|
391
|
+
return {
|
|
392
|
+
id: safeId,
|
|
393
|
+
type: safeType,
|
|
394
|
+
severity: safeSeverity,
|
|
395
|
+
status: safeStatus,
|
|
396
|
+
score: typeof result.score === "number" ? result.score : 0,
|
|
397
|
+
durationMs,
|
|
398
|
+
isHoldout: false,
|
|
399
|
+
label,
|
|
400
|
+
failures,
|
|
401
|
+
reason: reasonParts.length > 0 ? reasonParts.join(" — ") : null,
|
|
402
|
+
metrics: formatMetricsEntries(result.metrics),
|
|
403
|
+
unifiedDiff,
|
|
404
|
+
jsonDiff,
|
|
405
|
+
repro,
|
|
406
|
+
headers,
|
|
407
|
+
visuals
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function renderUnifiedDiffHtml(unified) {
|
|
411
|
+
const lines = unified.replace(/\r\n?/g, "\n").split("\n");
|
|
412
|
+
const rendered = lines
|
|
413
|
+
.map((line) => {
|
|
414
|
+
let cls = "diff-ctx";
|
|
415
|
+
if (line.startsWith("+++") || line.startsWith("---"))
|
|
416
|
+
cls = "diff-meta";
|
|
417
|
+
else if (line.startsWith("@@"))
|
|
418
|
+
cls = "diff-hunk";
|
|
419
|
+
else if (line.startsWith("+"))
|
|
420
|
+
cls = "diff-add";
|
|
421
|
+
else if (line.startsWith("-"))
|
|
422
|
+
cls = "diff-del";
|
|
423
|
+
return `<div class="diff-line ${cls}">${escapeHtml(line || " ")}</div>`;
|
|
424
|
+
})
|
|
425
|
+
.join("");
|
|
426
|
+
return `<div class="diff-block" role="region" aria-label="Unified diff">${rendered}</div>`;
|
|
427
|
+
}
|
|
428
|
+
function renderVisualCompareHtml(invId, visuals) {
|
|
429
|
+
const hasRef = Boolean(visuals.referenceUri);
|
|
430
|
+
const hasCand = Boolean(visuals.candidateUri);
|
|
431
|
+
const hasDiff = Boolean(visuals.diffUri);
|
|
432
|
+
if (!hasRef && !hasCand && !hasDiff) {
|
|
433
|
+
if (visuals.omittedNotes.length === 0)
|
|
434
|
+
return "";
|
|
435
|
+
return `<p class="muted-note">${escapeHtml(visuals.omittedNotes.join(" · "))}</p>`;
|
|
436
|
+
}
|
|
437
|
+
const safeId = escapeHtml(invId);
|
|
438
|
+
const noteHtml = visuals.omittedNotes.length > 0
|
|
439
|
+
? `<p class="muted-note">${escapeHtml(visuals.omittedNotes.join(" · "))}</p>`
|
|
440
|
+
: "";
|
|
441
|
+
if (hasRef && hasCand) {
|
|
442
|
+
const diffToggleBtn = hasDiff
|
|
443
|
+
? `<button type="button" class="btn-ghost diff-toggle-btn" data-diff-toggle aria-pressed="false">Diff Heatmap</button>`
|
|
444
|
+
: "";
|
|
445
|
+
const diffLayer = hasDiff
|
|
446
|
+
? `<img class="compare-img compare-diff-layer" src="${visuals.diffUri}" alt="Pixel diff heatmap for ${safeId}" hidden>`
|
|
447
|
+
: "";
|
|
448
|
+
return `
|
|
449
|
+
<div class="visual-compare" data-visual-compare>
|
|
450
|
+
<div class="visual-toolbar">
|
|
451
|
+
<span class="visual-title">Visual Comparison</span>
|
|
452
|
+
<div class="visual-actions">
|
|
453
|
+
<span class="visual-split-readout" data-split-readout>50%</span>
|
|
454
|
+
${diffToggleBtn}
|
|
455
|
+
</div>
|
|
456
|
+
</div>
|
|
457
|
+
<div class="compare-stage" style="--pos: 50%;" data-compare-stage>
|
|
458
|
+
<img class="compare-img compare-base" src="${visuals.candidateUri}" alt="Candidate image for ${safeId}">
|
|
459
|
+
<div class="compare-overlay" data-compare-overlay>
|
|
460
|
+
<img class="compare-img compare-ref" src="${visuals.referenceUri}" alt="Reference image for ${safeId}">
|
|
461
|
+
</div>
|
|
462
|
+
${diffLayer}
|
|
463
|
+
<div class="compare-divider" data-compare-divider aria-hidden="true">
|
|
464
|
+
<span class="compare-handle">↔</span>
|
|
465
|
+
</div>
|
|
466
|
+
<span class="compare-tag compare-tag-left">Reference</span>
|
|
467
|
+
<span class="compare-tag compare-tag-right">Candidate</span>
|
|
468
|
+
<input
|
|
469
|
+
type="range"
|
|
470
|
+
min="0"
|
|
471
|
+
max="100"
|
|
472
|
+
value="50"
|
|
473
|
+
class="compare-range"
|
|
474
|
+
data-compare-range
|
|
475
|
+
aria-label="Before and after comparison slider for ${safeId}"
|
|
476
|
+
>
|
|
477
|
+
</div>
|
|
478
|
+
${noteHtml}
|
|
479
|
+
</div>
|
|
480
|
+
`;
|
|
481
|
+
}
|
|
482
|
+
const singleCards = [];
|
|
483
|
+
if (hasRef) {
|
|
484
|
+
singleCards.push(`<figure class="single-img-card"><figcaption>Reference</figcaption><img src="${visuals.referenceUri}" alt="Reference image for ${safeId}"></figure>`);
|
|
485
|
+
}
|
|
486
|
+
if (hasCand) {
|
|
487
|
+
singleCards.push(`<figure class="single-img-card"><figcaption>Candidate</figcaption><img src="${visuals.candidateUri}" alt="Candidate image for ${safeId}"></figure>`);
|
|
488
|
+
}
|
|
489
|
+
if (hasDiff) {
|
|
490
|
+
singleCards.push(`<figure class="single-img-card"><figcaption>Diff Heatmap</figcaption><img src="${visuals.diffUri}" alt="Diff heatmap for ${safeId}"></figure>`);
|
|
491
|
+
}
|
|
492
|
+
return `<div class="single-img-grid">${singleCards.join("")}</div>${noteHtml}`;
|
|
493
|
+
}
|
|
494
|
+
function renderConvergenceChart(history) {
|
|
495
|
+
if (!Array.isArray(history) || history.length < 2)
|
|
496
|
+
return "";
|
|
497
|
+
const width = 760;
|
|
498
|
+
const height = 220;
|
|
499
|
+
const padLeft = 48;
|
|
500
|
+
const padRight = 24;
|
|
501
|
+
const padTop = 20;
|
|
502
|
+
const padBottom = 34;
|
|
503
|
+
const plotW = width - padLeft - padRight;
|
|
504
|
+
const plotH = height - padTop - padBottom;
|
|
505
|
+
const count = history.length;
|
|
506
|
+
const xFor = (idx) => (count === 1 ? padLeft : padLeft + (idx / (count - 1)) * plotW);
|
|
507
|
+
const yFor = (ratio) => padTop + (1 - clampRatio(ratio)) * plotH;
|
|
508
|
+
const parityPoints = history.map((entry, idx) => ({
|
|
509
|
+
x: xFor(idx),
|
|
510
|
+
y: yFor(entry.parity),
|
|
511
|
+
entry
|
|
512
|
+
}));
|
|
513
|
+
const compositePoints = history.map((entry, idx) => ({
|
|
514
|
+
x: xFor(idx),
|
|
515
|
+
y: yFor(entry.compositeScore),
|
|
516
|
+
entry
|
|
517
|
+
}));
|
|
518
|
+
const toPolyline = (pts) => pts.map((p) => `${p.x.toFixed(1)},${p.y.toFixed(1)}`).join(" ");
|
|
519
|
+
const gridLines = [0, 0.25, 0.5, 0.75, 1]
|
|
520
|
+
.map((tick) => {
|
|
521
|
+
const y = yFor(tick).toFixed(1);
|
|
522
|
+
return `<g>
|
|
523
|
+
<line x1="${padLeft}" y1="${y}" x2="${width - padRight}" y2="${y}" class="chart-grid" />
|
|
524
|
+
<text x="${padLeft - 8}" y="${(Number(y) + 4).toFixed(1)}" text-anchor="end" class="chart-axis">${Math.round(tick * 100)}%</text>
|
|
525
|
+
</g>`;
|
|
526
|
+
})
|
|
527
|
+
.join("");
|
|
528
|
+
const xLabels = history
|
|
529
|
+
.map((entry, idx) => {
|
|
530
|
+
if (count > 12 && idx !== 0 && idx !== count - 1 && idx % Math.ceil(count / 8) !== 0) {
|
|
531
|
+
return "";
|
|
532
|
+
}
|
|
533
|
+
const x = xFor(idx).toFixed(1);
|
|
534
|
+
return `<text x="${x}" y="${height - 10}" text-anchor="middle" class="chart-axis">#${escapeHtml(String(entry.iteration))}</text>`;
|
|
535
|
+
})
|
|
536
|
+
.join("");
|
|
537
|
+
const parityDots = parityPoints
|
|
538
|
+
.map((pt) => `<circle cx="${pt.x.toFixed(1)}" cy="${pt.y.toFixed(1)}" r="3.5" class="chart-dot-parity"><title>Iter #${escapeHtml(String(pt.entry.iteration))}: Hard Parity ${formatPercent(pt.entry.parity)} (${pt.entry.hardPassed}/${pt.entry.hardTotal})</title></circle>`)
|
|
539
|
+
.join("");
|
|
540
|
+
const compositeDots = compositePoints
|
|
541
|
+
.map((pt) => `<circle cx="${pt.x.toFixed(1)}" cy="${pt.y.toFixed(1)}" r="3.5" class="chart-dot-composite"><title>Iter #${escapeHtml(String(pt.entry.iteration))}: Composite ${formatPercent(pt.entry.compositeScore)} (${escapeHtml(redactSensitiveText(pt.entry.gateStatus))})</title></circle>`)
|
|
542
|
+
.join("");
|
|
543
|
+
const first = history[0];
|
|
544
|
+
const latest = history[history.length - 1];
|
|
545
|
+
const deltaParity = (clampRatio(latest.parity) - clampRatio(first.parity)) * 100;
|
|
546
|
+
const deltaLabel = `${deltaParity >= 0 ? "+" : ""}${deltaParity.toFixed(1)}%`;
|
|
547
|
+
return `
|
|
548
|
+
<section class="panel" aria-label="Iteration convergence">
|
|
549
|
+
<div class="panel-head">
|
|
550
|
+
<h2>Iteration Convergence</h2>
|
|
551
|
+
<div class="chart-legend">
|
|
552
|
+
<span class="legend-item"><span class="legend-dot legend-parity"></span>Hard Parity (${formatPercent(latest.parity)}, ${escapeHtml(deltaLabel)})</span>
|
|
553
|
+
<span class="legend-item"><span class="legend-dot legend-composite"></span>Composite Score (${formatPercent(latest.compositeScore)})</span>
|
|
554
|
+
</div>
|
|
555
|
+
</div>
|
|
556
|
+
<div class="chart-wrap">
|
|
557
|
+
<svg viewBox="0 0 ${width} ${height}" class="convergence-svg" role="img" aria-label="Hard parity and composite score across ${count} iterations">
|
|
558
|
+
${gridLines}
|
|
559
|
+
<polyline fill="none" class="chart-line-composite" points="${toPolyline(compositePoints)}" />
|
|
560
|
+
<polyline fill="none" class="chart-line-parity" points="${toPolyline(parityPoints)}" />
|
|
561
|
+
${compositeDots}
|
|
562
|
+
${parityDots}
|
|
563
|
+
${xLabels}
|
|
564
|
+
</svg>
|
|
565
|
+
</div>
|
|
566
|
+
</section>
|
|
567
|
+
`;
|
|
568
|
+
}
|
|
569
|
+
function renderSlicesSection(slices) {
|
|
570
|
+
if (!Array.isArray(slices) || slices.length === 0)
|
|
571
|
+
return "";
|
|
572
|
+
const pills = slices
|
|
573
|
+
.map((slice) => {
|
|
574
|
+
const cls = statusBadgeClass(slice.status);
|
|
575
|
+
const scoreText = typeof slice.lastScore === "number" ? ` · ${formatPercent(slice.lastScore)}` : "";
|
|
576
|
+
return `
|
|
577
|
+
<div class="slice-pill">
|
|
578
|
+
<span class="badge ${cls}">${escapeHtml(redactSensitiveText(slice.status.replace(/_/g, " ")))}</span>
|
|
579
|
+
<span class="slice-id">${escapeHtml(redactSensitiveText(slice.id))}</span>
|
|
580
|
+
<span class="slice-title">${escapeHtml(redactSensitiveText(slice.title))}</span>
|
|
581
|
+
<span class="slice-meta">${slice.invariantIds.length} inv${escapeHtml(scoreText)}</span>
|
|
582
|
+
</div>
|
|
583
|
+
`;
|
|
584
|
+
})
|
|
585
|
+
.join("");
|
|
586
|
+
return `
|
|
587
|
+
<section class="panel" aria-label="Slice progress">
|
|
588
|
+
<div class="panel-head">
|
|
589
|
+
<h2>Slices</h2>
|
|
590
|
+
<span class="muted-note">${slices.filter((s) => s.status === "passed").length}/${slices.length} passed</span>
|
|
591
|
+
</div>
|
|
592
|
+
<div class="slice-grid">${pills}</div>
|
|
593
|
+
</section>
|
|
594
|
+
`;
|
|
595
|
+
}
|
|
596
|
+
function renderFixtureSummarySection(fixtureSummary) {
|
|
597
|
+
if (!fixtureSummary || fixtureSummary.applied !== true)
|
|
598
|
+
return "";
|
|
599
|
+
const statusBadge = fixtureSummary.rolledBack
|
|
600
|
+
? `<span class="badge badge-pass">ROLLED BACK</span>`
|
|
601
|
+
: `<span class="badge badge-warn">ROLLBACK INCOMPLETE</span>`;
|
|
602
|
+
const failedBadge = fixtureSummary.failedHooks > 0
|
|
603
|
+
? `<span class="badge badge-fail">${fixtureSummary.failedHooks} HOOK FAILED</span>`
|
|
604
|
+
: "";
|
|
605
|
+
const items = [
|
|
606
|
+
["Seeded Files", String(fixtureSummary.seededFiles)],
|
|
607
|
+
["Restored Paths", String(fixtureSummary.restoredPaths)],
|
|
608
|
+
["Removed Paths", String(fixtureSummary.removedNewPaths)],
|
|
609
|
+
["HTTP Hooks", `${fixtureSummary.httpSetupCount} setup / ${fixtureSummary.httpTeardownCount} teardown`],
|
|
610
|
+
["Command Hooks", `${fixtureSummary.commandSetupCount} setup / ${fixtureSummary.commandTeardownCount} teardown`],
|
|
611
|
+
["Duration", formatDuration(fixtureSummary.totalDurationMs)]
|
|
612
|
+
];
|
|
613
|
+
const warnings = Array.isArray(fixtureSummary.warnings)
|
|
614
|
+
? fixtureSummary.warnings
|
|
615
|
+
.filter((w) => typeof w === "string" && w.trim().length > 0)
|
|
616
|
+
.map((w) => redactSensitiveText(w.trim()))
|
|
617
|
+
: [];
|
|
618
|
+
const warningsHtml = warnings.length > 0
|
|
619
|
+
? `<ul class="failure-list">${warnings.map((w) => `<li>${escapeHtml(w)}</li>`).join("")}</ul>`
|
|
620
|
+
: "";
|
|
621
|
+
return `
|
|
622
|
+
<section class="panel" aria-label="Fixtures and rollback summary">
|
|
623
|
+
<div class="panel-head">
|
|
624
|
+
<h2>Fixtures & Rollback</h2>
|
|
625
|
+
<div class="header-controls">${statusBadge}${failedBadge}</div>
|
|
626
|
+
</div>
|
|
627
|
+
<div class="kv-grid">${items
|
|
628
|
+
.map(([k, v]) => `<div class="kv-item"><span class="kv-key">${escapeHtml(k)}</span><span class="kv-val">${escapeHtml(v)}</span></div>`)
|
|
629
|
+
.join("")}</div>
|
|
630
|
+
${warningsHtml}
|
|
631
|
+
</section>
|
|
632
|
+
`;
|
|
633
|
+
}
|
|
634
|
+
function renderInvariantCard(view) {
|
|
635
|
+
const statusCls = statusBadgeClass(view.status);
|
|
636
|
+
const isFailed = view.status === "fail" || view.status === "error";
|
|
637
|
+
const isPassed = view.status === "pass";
|
|
638
|
+
const openAttr = isFailed && !view.isHoldout ? " open" : "";
|
|
639
|
+
const holdoutBadge = view.isHoldout ? `<span class="badge badge-holdout">HOLDOUT</span>` : "";
|
|
640
|
+
const metricsHtml = view.metrics.length > 0
|
|
641
|
+
? `<div class="kv-grid">${view.metrics
|
|
642
|
+
.map(([k, v]) => `<div class="kv-item"><span class="kv-key">${escapeHtml(k)}</span><span class="kv-val">${escapeHtml(v)}</span></div>`)
|
|
643
|
+
.join("")}</div>`
|
|
644
|
+
: "";
|
|
645
|
+
let bodyHtml = "";
|
|
646
|
+
if (view.isHoldout) {
|
|
647
|
+
const failureHtml = view.failures.length > 0
|
|
648
|
+
? `<ul class="failure-list">${view.failures.map((f) => `<li>${escapeHtml(f)}</li>`).join("")}</ul>`
|
|
649
|
+
: "";
|
|
650
|
+
bodyHtml = `
|
|
651
|
+
<div class="holdout-notice">
|
|
652
|
+
<strong>Redacted Holdout Invariant</strong>
|
|
653
|
+
<p>${escapeHtml(view.label)}</p>
|
|
654
|
+
${failureHtml}
|
|
655
|
+
<p class="muted-note">Expected outputs, inputs, raw diffs, and repro commands are withheld for holdout integrity.</p>
|
|
656
|
+
</div>
|
|
657
|
+
`;
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
const failuresHtml = view.failures.length > 0
|
|
661
|
+
? `<div class="sub-section"><div class="sub-label">Failures</div><ul class="failure-list">${view.failures
|
|
662
|
+
.map((f) => `<li>${escapeHtml(f)}</li>`)
|
|
663
|
+
.join("")}</ul></div>`
|
|
664
|
+
: "";
|
|
665
|
+
const reasonHtml = view.reason
|
|
666
|
+
? `<div class="sub-section"><div class="sub-label">Diagnostic</div><p class="reason-text">${escapeHtml(view.reason)}</p></div>`
|
|
667
|
+
: "";
|
|
668
|
+
const headersHtml = view.headers
|
|
669
|
+
? `<div class="sub-section"><div class="sub-label">Request Headers</div><div class="kv-grid">${Object.entries(view.headers)
|
|
670
|
+
.map(([k, v]) => `<div class="kv-item"><span class="kv-key">${escapeHtml(k)}</span><span class="kv-val">${escapeHtml(v)}</span></div>`)
|
|
671
|
+
.join("")}</div></div>`
|
|
672
|
+
: "";
|
|
673
|
+
const visualHtml = renderVisualCompareHtml(view.id, view.visuals);
|
|
674
|
+
const unifiedDiffHtml = view.unifiedDiff
|
|
675
|
+
? `<div class="sub-section"><div class="sub-label">Unified Diff</div>${renderUnifiedDiffHtml(view.unifiedDiff)}</div>`
|
|
676
|
+
: "";
|
|
677
|
+
const jsonDiffHtml = view.jsonDiff
|
|
678
|
+
? `<div class="sub-section"><div class="sub-label">Diff Details</div><pre class="code-block">${escapeHtml(view.jsonDiff)}</pre></div>`
|
|
679
|
+
: "";
|
|
680
|
+
const reproHtml = view.repro
|
|
681
|
+
? `<div class="sub-section">
|
|
682
|
+
<div class="sub-label">Reproduce</div>
|
|
683
|
+
<div class="repro-bar">
|
|
684
|
+
<code class="repro-cmd" data-repro-text>${escapeHtml(view.repro)}</code>
|
|
685
|
+
<button type="button" class="btn-ghost copy-btn" data-copy-repro>Copy</button>
|
|
686
|
+
</div>
|
|
687
|
+
</div>`
|
|
688
|
+
: "";
|
|
689
|
+
bodyHtml = `
|
|
690
|
+
${failuresHtml}
|
|
691
|
+
${reasonHtml}
|
|
692
|
+
${metricsHtml ? `<div class="sub-section"><div class="sub-label">Metrics</div>${metricsHtml}</div>` : ""}
|
|
693
|
+
${headersHtml}
|
|
694
|
+
${visualHtml}
|
|
695
|
+
${unifiedDiffHtml}
|
|
696
|
+
${jsonDiffHtml}
|
|
697
|
+
${reproHtml}
|
|
698
|
+
`;
|
|
699
|
+
}
|
|
700
|
+
return `
|
|
701
|
+
<details
|
|
702
|
+
class="inv-card"
|
|
703
|
+
data-inv-card
|
|
704
|
+
data-status="${escapeHtml(view.status)}"
|
|
705
|
+
data-failed="${isFailed ? "true" : "false"}"
|
|
706
|
+
data-passed="${isPassed ? "true" : "false"}"
|
|
707
|
+
data-holdout="${view.isHoldout ? "true" : "false"}"
|
|
708
|
+
data-search="${escapeHtml(`${view.id} ${view.type} ${view.severity} ${view.label}`.toLowerCase())}"
|
|
709
|
+
${openAttr}
|
|
710
|
+
>
|
|
711
|
+
<summary class="inv-summary">
|
|
712
|
+
<div class="inv-summary-left">
|
|
713
|
+
<span class="badge ${statusCls}">${escapeHtml(view.status.toUpperCase())}</span>
|
|
714
|
+
<span class="inv-id">${escapeHtml(view.id)}</span>
|
|
715
|
+
<span class="pill pill-subtle">${escapeHtml(view.severity)}</span>
|
|
716
|
+
<span class="pill pill-subtle">${escapeHtml(view.type)}</span>
|
|
717
|
+
${holdoutBadge}
|
|
718
|
+
<span class="inv-desc">${escapeHtml(view.label)}</span>
|
|
719
|
+
</div>
|
|
720
|
+
<div class="inv-summary-right">
|
|
721
|
+
<span class="inv-score">${formatPercent(view.score)}</span>
|
|
722
|
+
<span class="inv-dur">${escapeHtml(formatDuration(view.durationMs))}</span>
|
|
723
|
+
</div>
|
|
724
|
+
</summary>
|
|
725
|
+
<div class="inv-body">${bodyHtml}</div>
|
|
726
|
+
</details>
|
|
727
|
+
`;
|
|
728
|
+
}
|
|
729
|
+
const REPORT_CSS = `
|
|
730
|
+
:root {
|
|
731
|
+
color-scheme: dark light;
|
|
732
|
+
--bg: #0a0a0c;
|
|
733
|
+
--surface: #111114;
|
|
734
|
+
--surface-2: #17171c;
|
|
735
|
+
--border: #26262e;
|
|
736
|
+
--border-strong: #3a3a46;
|
|
737
|
+
--text: #f4f4f6;
|
|
738
|
+
--text-muted: #9a9aa8;
|
|
739
|
+
--accent: #38bdf8;
|
|
740
|
+
--pass: #22c55e;
|
|
741
|
+
--pass-bg: rgba(34, 197, 94, 0.14);
|
|
742
|
+
--fail: #ef4444;
|
|
743
|
+
--fail-bg: rgba(239, 68, 68, 0.15);
|
|
744
|
+
--warn: #f59e0b;
|
|
745
|
+
--warn-bg: rgba(245, 158, 11, 0.15);
|
|
746
|
+
--skip: #94a3b8;
|
|
747
|
+
--skip-bg: rgba(148, 163, 184, 0.15);
|
|
748
|
+
--holdout: #a855f7;
|
|
749
|
+
--holdout-bg: rgba(168, 85, 247, 0.16);
|
|
750
|
+
--diff-add-bg: rgba(34, 197, 94, 0.14);
|
|
751
|
+
--diff-add-fg: #86efac;
|
|
752
|
+
--diff-del-bg: rgba(239, 68, 68, 0.14);
|
|
753
|
+
--diff-del-fg: #fca5a5;
|
|
754
|
+
--diff-hunk-fg: #38bdf8;
|
|
755
|
+
--font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
756
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
|
757
|
+
}
|
|
758
|
+
@media (prefers-color-scheme: light) {
|
|
759
|
+
:root:not([data-theme="dark"]) {
|
|
760
|
+
--bg: #fafafa;
|
|
761
|
+
--surface: #ffffff;
|
|
762
|
+
--surface-2: #f4f4f6;
|
|
763
|
+
--border: #e4e4e7;
|
|
764
|
+
--border-strong: #d4d4d8;
|
|
765
|
+
--text: #111114;
|
|
766
|
+
--text-muted: #52525b;
|
|
767
|
+
--accent: #0284c7;
|
|
768
|
+
--pass: #15803d;
|
|
769
|
+
--pass-bg: rgba(21, 128, 61, 0.12);
|
|
770
|
+
--fail: #b91c1c;
|
|
771
|
+
--fail-bg: rgba(185, 28, 28, 0.12);
|
|
772
|
+
--warn: #b45309;
|
|
773
|
+
--warn-bg: rgba(180, 83, 9, 0.12);
|
|
774
|
+
--skip: #475569;
|
|
775
|
+
--skip-bg: rgba(71, 85, 105, 0.12);
|
|
776
|
+
--holdout: #7e22ce;
|
|
777
|
+
--holdout-bg: rgba(126, 34, 206, 0.12);
|
|
778
|
+
--diff-add-bg: rgba(21, 128, 61, 0.1);
|
|
779
|
+
--diff-add-fg: #166534;
|
|
780
|
+
--diff-del-bg: rgba(185, 28, 28, 0.1);
|
|
781
|
+
--diff-del-fg: #991b1b;
|
|
782
|
+
--diff-hunk-fg: #0369a1;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
:root[data-theme="light"] {
|
|
786
|
+
--bg: #fafafa;
|
|
787
|
+
--surface: #ffffff;
|
|
788
|
+
--surface-2: #f4f4f6;
|
|
789
|
+
--border: #e4e4e7;
|
|
790
|
+
--border-strong: #d4d4d8;
|
|
791
|
+
--text: #111114;
|
|
792
|
+
--text-muted: #52525b;
|
|
793
|
+
--accent: #0284c7;
|
|
794
|
+
--pass: #15803d;
|
|
795
|
+
--pass-bg: rgba(21, 128, 61, 0.12);
|
|
796
|
+
--fail: #b91c1c;
|
|
797
|
+
--fail-bg: rgba(185, 28, 28, 0.12);
|
|
798
|
+
--warn: #b45309;
|
|
799
|
+
--warn-bg: rgba(180, 83, 9, 0.12);
|
|
800
|
+
--skip: #475569;
|
|
801
|
+
--skip-bg: rgba(71, 85, 105, 0.12);
|
|
802
|
+
--holdout: #7e22ce;
|
|
803
|
+
--holdout-bg: rgba(126, 34, 206, 0.12);
|
|
804
|
+
--diff-add-bg: rgba(21, 128, 61, 0.1);
|
|
805
|
+
--diff-add-fg: #166534;
|
|
806
|
+
--diff-del-bg: rgba(185, 28, 28, 0.1);
|
|
807
|
+
--diff-del-fg: #991b1b;
|
|
808
|
+
--diff-hunk-fg: #0369a1;
|
|
809
|
+
}
|
|
810
|
+
* { box-sizing: border-box; }
|
|
811
|
+
body {
|
|
812
|
+
margin: 0;
|
|
813
|
+
background: var(--bg);
|
|
814
|
+
color: var(--text);
|
|
815
|
+
font-family: var(--font-sans);
|
|
816
|
+
font-size: 14px;
|
|
817
|
+
line-height: 1.5;
|
|
818
|
+
-webkit-font-smoothing: antialiased;
|
|
819
|
+
}
|
|
820
|
+
.shell {
|
|
821
|
+
max-width: 1120px;
|
|
822
|
+
margin: 0 auto;
|
|
823
|
+
padding: 28px 20px 64px;
|
|
824
|
+
display: flex;
|
|
825
|
+
flex-direction: column;
|
|
826
|
+
gap: 18px;
|
|
827
|
+
}
|
|
828
|
+
.header {
|
|
829
|
+
display: flex;
|
|
830
|
+
flex-wrap: wrap;
|
|
831
|
+
justify-content: space-between;
|
|
832
|
+
align-items: flex-start;
|
|
833
|
+
gap: 16px;
|
|
834
|
+
padding: 20px 22px;
|
|
835
|
+
background: var(--surface);
|
|
836
|
+
border: 1px solid var(--border);
|
|
837
|
+
border-radius: 12px;
|
|
838
|
+
}
|
|
839
|
+
.title-row {
|
|
840
|
+
display: flex;
|
|
841
|
+
flex-wrap: wrap;
|
|
842
|
+
align-items: center;
|
|
843
|
+
gap: 10px;
|
|
844
|
+
}
|
|
845
|
+
h1 {
|
|
846
|
+
margin: 0;
|
|
847
|
+
font-size: 20px;
|
|
848
|
+
font-weight: 600;
|
|
849
|
+
letter-spacing: -0.02em;
|
|
850
|
+
}
|
|
851
|
+
h2 {
|
|
852
|
+
margin: 0;
|
|
853
|
+
font-size: 13px;
|
|
854
|
+
font-weight: 600;
|
|
855
|
+
text-transform: uppercase;
|
|
856
|
+
letter-spacing: 0.06em;
|
|
857
|
+
color: var(--text-muted);
|
|
858
|
+
}
|
|
859
|
+
.meta-row {
|
|
860
|
+
margin-top: 8px;
|
|
861
|
+
display: flex;
|
|
862
|
+
flex-wrap: wrap;
|
|
863
|
+
align-items: center;
|
|
864
|
+
gap: 8px;
|
|
865
|
+
color: var(--text-muted);
|
|
866
|
+
font-size: 12px;
|
|
867
|
+
}
|
|
868
|
+
.header-controls {
|
|
869
|
+
display: flex;
|
|
870
|
+
align-items: center;
|
|
871
|
+
gap: 8px;
|
|
872
|
+
}
|
|
873
|
+
.kpi-grid {
|
|
874
|
+
display: grid;
|
|
875
|
+
grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
|
|
876
|
+
gap: 12px;
|
|
877
|
+
}
|
|
878
|
+
.kpi-card {
|
|
879
|
+
background: var(--surface);
|
|
880
|
+
border: 1px solid var(--border);
|
|
881
|
+
border-radius: 10px;
|
|
882
|
+
padding: 14px 16px;
|
|
883
|
+
}
|
|
884
|
+
.kpi-label {
|
|
885
|
+
font-size: 11px;
|
|
886
|
+
text-transform: uppercase;
|
|
887
|
+
letter-spacing: 0.06em;
|
|
888
|
+
color: var(--text-muted);
|
|
889
|
+
}
|
|
890
|
+
.kpi-value {
|
|
891
|
+
margin-top: 4px;
|
|
892
|
+
font-size: 24px;
|
|
893
|
+
font-weight: 650;
|
|
894
|
+
letter-spacing: -0.02em;
|
|
895
|
+
font-variant-numeric: tabular-nums;
|
|
896
|
+
}
|
|
897
|
+
.kpi-sub {
|
|
898
|
+
margin-top: 2px;
|
|
899
|
+
font-size: 12px;
|
|
900
|
+
color: var(--text-muted);
|
|
901
|
+
}
|
|
902
|
+
.panel {
|
|
903
|
+
background: var(--surface);
|
|
904
|
+
border: 1px solid var(--border);
|
|
905
|
+
border-radius: 12px;
|
|
906
|
+
padding: 16px 18px;
|
|
907
|
+
}
|
|
908
|
+
.panel-head {
|
|
909
|
+
display: flex;
|
|
910
|
+
flex-wrap: wrap;
|
|
911
|
+
justify-content: space-between;
|
|
912
|
+
align-items: center;
|
|
913
|
+
gap: 10px;
|
|
914
|
+
margin-bottom: 12px;
|
|
915
|
+
}
|
|
916
|
+
.badge, .pill {
|
|
917
|
+
display: inline-flex;
|
|
918
|
+
align-items: center;
|
|
919
|
+
gap: 5px;
|
|
920
|
+
padding: 2px 8px;
|
|
921
|
+
border-radius: 999px;
|
|
922
|
+
font-size: 11px;
|
|
923
|
+
font-weight: 600;
|
|
924
|
+
letter-spacing: 0.03em;
|
|
925
|
+
white-space: nowrap;
|
|
926
|
+
}
|
|
927
|
+
.badge-pass { background: var(--pass-bg); color: var(--pass); }
|
|
928
|
+
.badge-fail { background: var(--fail-bg); color: var(--fail); }
|
|
929
|
+
.badge-warn { background: var(--warn-bg); color: var(--warn); }
|
|
930
|
+
.badge-skip { background: var(--skip-bg); color: var(--skip); }
|
|
931
|
+
.badge-holdout { background: var(--holdout-bg); color: var(--holdout); }
|
|
932
|
+
.pill-subtle {
|
|
933
|
+
background: var(--surface-2);
|
|
934
|
+
color: var(--text-muted);
|
|
935
|
+
border: 1px solid var(--border);
|
|
936
|
+
font-weight: 500;
|
|
937
|
+
}
|
|
938
|
+
.btn-ghost {
|
|
939
|
+
appearance: none;
|
|
940
|
+
background: var(--surface-2);
|
|
941
|
+
color: var(--text);
|
|
942
|
+
border: 1px solid var(--border);
|
|
943
|
+
border-radius: 8px;
|
|
944
|
+
padding: 5px 10px;
|
|
945
|
+
font-size: 12px;
|
|
946
|
+
font-weight: 500;
|
|
947
|
+
cursor: pointer;
|
|
948
|
+
transition: border-color 0.15s ease, background 0.15s ease;
|
|
949
|
+
}
|
|
950
|
+
.btn-ghost:hover { border-color: var(--border-strong); }
|
|
951
|
+
.btn-ghost[aria-pressed="true"], .filter-pill.active {
|
|
952
|
+
background: var(--text);
|
|
953
|
+
color: var(--bg);
|
|
954
|
+
border-color: var(--text);
|
|
955
|
+
}
|
|
956
|
+
.gate-reasons {
|
|
957
|
+
margin: 0;
|
|
958
|
+
padding-left: 18px;
|
|
959
|
+
color: var(--fail);
|
|
960
|
+
font-size: 13px;
|
|
961
|
+
}
|
|
962
|
+
.slice-grid {
|
|
963
|
+
display: flex;
|
|
964
|
+
flex-wrap: wrap;
|
|
965
|
+
gap: 8px;
|
|
966
|
+
}
|
|
967
|
+
.slice-pill {
|
|
968
|
+
display: inline-flex;
|
|
969
|
+
align-items: center;
|
|
970
|
+
gap: 8px;
|
|
971
|
+
padding: 6px 10px;
|
|
972
|
+
background: var(--surface-2);
|
|
973
|
+
border: 1px solid var(--border);
|
|
974
|
+
border-radius: 8px;
|
|
975
|
+
font-size: 12px;
|
|
976
|
+
}
|
|
977
|
+
.slice-id { font-family: var(--font-mono); font-weight: 600; }
|
|
978
|
+
.slice-meta { color: var(--text-muted); font-variant-numeric: tabular-nums; }
|
|
979
|
+
.chart-wrap { width: 100%; overflow-x: auto; }
|
|
980
|
+
.convergence-svg { width: 100%; height: auto; display: block; }
|
|
981
|
+
.chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 3; }
|
|
982
|
+
.chart-axis { fill: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }
|
|
983
|
+
.chart-line-parity { stroke: var(--pass); stroke-width: 2.25; }
|
|
984
|
+
.chart-line-composite { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 3; }
|
|
985
|
+
.chart-dot-parity { fill: var(--pass); }
|
|
986
|
+
.chart-dot-composite { fill: var(--accent); }
|
|
987
|
+
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-muted); }
|
|
988
|
+
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
|
|
989
|
+
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
|
|
990
|
+
.legend-parity { background: var(--pass); }
|
|
991
|
+
.legend-composite { background: var(--accent); }
|
|
992
|
+
.filter-bar {
|
|
993
|
+
display: flex;
|
|
994
|
+
flex-wrap: wrap;
|
|
995
|
+
justify-content: space-between;
|
|
996
|
+
align-items: center;
|
|
997
|
+
gap: 10px;
|
|
998
|
+
margin-bottom: 12px;
|
|
999
|
+
}
|
|
1000
|
+
.filter-group { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
1001
|
+
.search-input {
|
|
1002
|
+
background: var(--surface-2);
|
|
1003
|
+
color: var(--text);
|
|
1004
|
+
border: 1px solid var(--border);
|
|
1005
|
+
border-radius: 8px;
|
|
1006
|
+
padding: 6px 10px;
|
|
1007
|
+
font-size: 12px;
|
|
1008
|
+
min-width: 200px;
|
|
1009
|
+
}
|
|
1010
|
+
.inv-list { display: flex; flex-direction: column; gap: 8px; }
|
|
1011
|
+
.inv-card {
|
|
1012
|
+
border: 1px solid var(--border);
|
|
1013
|
+
border-radius: 10px;
|
|
1014
|
+
background: var(--surface-2);
|
|
1015
|
+
overflow: hidden;
|
|
1016
|
+
}
|
|
1017
|
+
.inv-card[hidden] { display: none; }
|
|
1018
|
+
.inv-summary {
|
|
1019
|
+
list-style: none;
|
|
1020
|
+
cursor: pointer;
|
|
1021
|
+
padding: 11px 14px;
|
|
1022
|
+
display: flex;
|
|
1023
|
+
flex-wrap: wrap;
|
|
1024
|
+
justify-content: space-between;
|
|
1025
|
+
align-items: center;
|
|
1026
|
+
gap: 10px;
|
|
1027
|
+
}
|
|
1028
|
+
.inv-summary::-webkit-details-marker { display: none; }
|
|
1029
|
+
.inv-summary-left {
|
|
1030
|
+
display: flex;
|
|
1031
|
+
flex-wrap: wrap;
|
|
1032
|
+
align-items: center;
|
|
1033
|
+
gap: 7px;
|
|
1034
|
+
min-width: 0;
|
|
1035
|
+
}
|
|
1036
|
+
.inv-id { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
|
|
1037
|
+
.inv-desc { color: var(--text-muted); font-size: 12.5px; }
|
|
1038
|
+
.inv-summary-right {
|
|
1039
|
+
display: inline-flex;
|
|
1040
|
+
align-items: center;
|
|
1041
|
+
gap: 12px;
|
|
1042
|
+
font-family: var(--font-mono);
|
|
1043
|
+
font-size: 12px;
|
|
1044
|
+
color: var(--text-muted);
|
|
1045
|
+
}
|
|
1046
|
+
.inv-body {
|
|
1047
|
+
border-top: 1px solid var(--border);
|
|
1048
|
+
padding: 14px;
|
|
1049
|
+
background: var(--surface);
|
|
1050
|
+
display: flex;
|
|
1051
|
+
flex-direction: column;
|
|
1052
|
+
gap: 12px;
|
|
1053
|
+
}
|
|
1054
|
+
.sub-section { display: flex; flex-direction: column; gap: 6px; }
|
|
1055
|
+
.sub-label {
|
|
1056
|
+
font-size: 11px;
|
|
1057
|
+
text-transform: uppercase;
|
|
1058
|
+
letter-spacing: 0.06em;
|
|
1059
|
+
color: var(--text-muted);
|
|
1060
|
+
font-weight: 600;
|
|
1061
|
+
}
|
|
1062
|
+
.failure-list { margin: 0; padding-left: 18px; color: var(--fail); font-size: 13px; }
|
|
1063
|
+
.reason-text { margin: 0; color: var(--text); font-size: 13px; }
|
|
1064
|
+
.muted-note { margin: 0; color: var(--text-muted); font-size: 12px; }
|
|
1065
|
+
.holdout-notice {
|
|
1066
|
+
padding: 12px 14px;
|
|
1067
|
+
border-radius: 8px;
|
|
1068
|
+
border: 1px dashed var(--holdout);
|
|
1069
|
+
background: var(--holdout-bg);
|
|
1070
|
+
display: flex;
|
|
1071
|
+
flex-direction: column;
|
|
1072
|
+
gap: 6px;
|
|
1073
|
+
}
|
|
1074
|
+
.kv-grid {
|
|
1075
|
+
display: grid;
|
|
1076
|
+
grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
|
|
1077
|
+
gap: 8px;
|
|
1078
|
+
}
|
|
1079
|
+
.kv-item {
|
|
1080
|
+
padding: 6px 10px;
|
|
1081
|
+
border-radius: 7px;
|
|
1082
|
+
background: var(--surface-2);
|
|
1083
|
+
border: 1px solid var(--border);
|
|
1084
|
+
display: flex;
|
|
1085
|
+
flex-direction: column;
|
|
1086
|
+
gap: 2px;
|
|
1087
|
+
}
|
|
1088
|
+
.kv-key { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
|
|
1089
|
+
.kv-val { font-size: 12.5px; font-family: var(--font-mono); word-break: break-word; }
|
|
1090
|
+
.diff-block {
|
|
1091
|
+
font-family: var(--font-mono);
|
|
1092
|
+
font-size: 12px;
|
|
1093
|
+
line-height: 1.45;
|
|
1094
|
+
border: 1px solid var(--border);
|
|
1095
|
+
border-radius: 8px;
|
|
1096
|
+
overflow-x: auto;
|
|
1097
|
+
background: var(--bg);
|
|
1098
|
+
padding: 8px 0;
|
|
1099
|
+
}
|
|
1100
|
+
.diff-line { padding: 1px 12px; white-space: pre; }
|
|
1101
|
+
.diff-add { background: var(--diff-add-bg); color: var(--diff-add-fg); }
|
|
1102
|
+
.diff-del { background: var(--diff-del-bg); color: var(--diff-del-fg); }
|
|
1103
|
+
.diff-hunk { color: var(--diff-hunk-fg); font-weight: 600; }
|
|
1104
|
+
.diff-meta { color: var(--text-muted); font-weight: 600; }
|
|
1105
|
+
.code-block {
|
|
1106
|
+
margin: 0;
|
|
1107
|
+
padding: 10px 12px;
|
|
1108
|
+
border-radius: 8px;
|
|
1109
|
+
border: 1px solid var(--border);
|
|
1110
|
+
background: var(--bg);
|
|
1111
|
+
font-family: var(--font-mono);
|
|
1112
|
+
font-size: 12px;
|
|
1113
|
+
overflow-x: auto;
|
|
1114
|
+
white-space: pre-wrap;
|
|
1115
|
+
word-break: break-word;
|
|
1116
|
+
}
|
|
1117
|
+
.repro-bar {
|
|
1118
|
+
display: flex;
|
|
1119
|
+
align-items: center;
|
|
1120
|
+
justify-content: space-between;
|
|
1121
|
+
gap: 10px;
|
|
1122
|
+
padding: 8px 10px;
|
|
1123
|
+
border-radius: 8px;
|
|
1124
|
+
border: 1px solid var(--border);
|
|
1125
|
+
background: var(--bg);
|
|
1126
|
+
}
|
|
1127
|
+
.repro-cmd {
|
|
1128
|
+
font-family: var(--font-mono);
|
|
1129
|
+
font-size: 12px;
|
|
1130
|
+
word-break: break-all;
|
|
1131
|
+
}
|
|
1132
|
+
.visual-compare {
|
|
1133
|
+
border: 1px solid var(--border);
|
|
1134
|
+
border-radius: 10px;
|
|
1135
|
+
padding: 12px;
|
|
1136
|
+
background: var(--surface-2);
|
|
1137
|
+
}
|
|
1138
|
+
.visual-toolbar {
|
|
1139
|
+
display: flex;
|
|
1140
|
+
justify-content: space-between;
|
|
1141
|
+
align-items: center;
|
|
1142
|
+
gap: 10px;
|
|
1143
|
+
margin-bottom: 10px;
|
|
1144
|
+
}
|
|
1145
|
+
.visual-title { font-size: 12px; font-weight: 600; }
|
|
1146
|
+
.visual-actions { display: flex; align-items: center; gap: 10px; }
|
|
1147
|
+
.visual-split-readout { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
|
|
1148
|
+
.compare-stage {
|
|
1149
|
+
position: relative;
|
|
1150
|
+
width: 100%;
|
|
1151
|
+
max-width: 760px;
|
|
1152
|
+
margin: 0 auto;
|
|
1153
|
+
border-radius: 8px;
|
|
1154
|
+
overflow: hidden;
|
|
1155
|
+
border: 1px solid var(--border);
|
|
1156
|
+
background: repeating-conic-gradient(var(--surface) 0% 25%, var(--bg) 0% 50%) 50% / 16px 16px;
|
|
1157
|
+
user-select: none;
|
|
1158
|
+
}
|
|
1159
|
+
.compare-img {
|
|
1160
|
+
display: block;
|
|
1161
|
+
width: 100%;
|
|
1162
|
+
height: auto;
|
|
1163
|
+
image-rendering: pixelated;
|
|
1164
|
+
}
|
|
1165
|
+
.compare-overlay {
|
|
1166
|
+
position: absolute;
|
|
1167
|
+
inset: 0;
|
|
1168
|
+
clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0);
|
|
1169
|
+
}
|
|
1170
|
+
.compare-diff-layer {
|
|
1171
|
+
position: absolute;
|
|
1172
|
+
inset: 0;
|
|
1173
|
+
width: 100%;
|
|
1174
|
+
height: 100%;
|
|
1175
|
+
object-fit: contain;
|
|
1176
|
+
background: var(--bg);
|
|
1177
|
+
z-index: 4;
|
|
1178
|
+
}
|
|
1179
|
+
.compare-diff-layer[hidden] { display: none; }
|
|
1180
|
+
.compare-divider {
|
|
1181
|
+
position: absolute;
|
|
1182
|
+
top: 0;
|
|
1183
|
+
bottom: 0;
|
|
1184
|
+
left: var(--pos, 50%);
|
|
1185
|
+
width: 2px;
|
|
1186
|
+
background: var(--accent);
|
|
1187
|
+
transform: translateX(-1px);
|
|
1188
|
+
pointer-events: none;
|
|
1189
|
+
z-index: 3;
|
|
1190
|
+
}
|
|
1191
|
+
.compare-handle {
|
|
1192
|
+
position: absolute;
|
|
1193
|
+
top: 50%;
|
|
1194
|
+
left: 50%;
|
|
1195
|
+
transform: translate(-50%, -50%);
|
|
1196
|
+
width: 28px;
|
|
1197
|
+
height: 28px;
|
|
1198
|
+
border-radius: 50%;
|
|
1199
|
+
background: var(--accent);
|
|
1200
|
+
color: #0a0a0c;
|
|
1201
|
+
display: flex;
|
|
1202
|
+
align-items: center;
|
|
1203
|
+
justify-content: center;
|
|
1204
|
+
font-weight: 700;
|
|
1205
|
+
font-size: 13px;
|
|
1206
|
+
}
|
|
1207
|
+
.compare-tag {
|
|
1208
|
+
position: absolute;
|
|
1209
|
+
top: 8px;
|
|
1210
|
+
padding: 2px 8px;
|
|
1211
|
+
border-radius: 6px;
|
|
1212
|
+
font-size: 11px;
|
|
1213
|
+
font-weight: 600;
|
|
1214
|
+
background: rgba(10, 10, 12, 0.72);
|
|
1215
|
+
color: #fff;
|
|
1216
|
+
z-index: 3;
|
|
1217
|
+
pointer-events: none;
|
|
1218
|
+
}
|
|
1219
|
+
.compare-tag-left { left: 8px; }
|
|
1220
|
+
.compare-tag-right { right: 8px; }
|
|
1221
|
+
.compare-range {
|
|
1222
|
+
position: absolute;
|
|
1223
|
+
inset: 0;
|
|
1224
|
+
width: 100%;
|
|
1225
|
+
height: 100%;
|
|
1226
|
+
margin: 0;
|
|
1227
|
+
opacity: 0;
|
|
1228
|
+
cursor: ew-resize;
|
|
1229
|
+
z-index: 5;
|
|
1230
|
+
}
|
|
1231
|
+
.single-img-grid {
|
|
1232
|
+
display: grid;
|
|
1233
|
+
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
|
1234
|
+
gap: 10px;
|
|
1235
|
+
}
|
|
1236
|
+
.single-img-card {
|
|
1237
|
+
margin: 0;
|
|
1238
|
+
padding: 10px;
|
|
1239
|
+
border-radius: 8px;
|
|
1240
|
+
border: 1px solid var(--border);
|
|
1241
|
+
background: var(--surface-2);
|
|
1242
|
+
}
|
|
1243
|
+
.single-img-card figcaption {
|
|
1244
|
+
font-size: 11px;
|
|
1245
|
+
color: var(--text-muted);
|
|
1246
|
+
margin-bottom: 6px;
|
|
1247
|
+
}
|
|
1248
|
+
.single-img-card img {
|
|
1249
|
+
width: 100%;
|
|
1250
|
+
height: auto;
|
|
1251
|
+
border-radius: 4px;
|
|
1252
|
+
display: block;
|
|
1253
|
+
}
|
|
1254
|
+
`;
|
|
1255
|
+
const REPORT_JS = `
|
|
1256
|
+
(function () {
|
|
1257
|
+
var root = document.documentElement;
|
|
1258
|
+
var themeBtn = document.getElementById("theme-toggle");
|
|
1259
|
+
try {
|
|
1260
|
+
var saved = localStorage.getItem("vibecode-report-theme");
|
|
1261
|
+
if (saved === "light" || saved === "dark") {
|
|
1262
|
+
root.setAttribute("data-theme", saved);
|
|
1263
|
+
}
|
|
1264
|
+
} catch (e) {}
|
|
1265
|
+
|
|
1266
|
+
function currentTheme() {
|
|
1267
|
+
var attr = root.getAttribute("data-theme");
|
|
1268
|
+
if (attr === "light" || attr === "dark") return attr;
|
|
1269
|
+
return window.matchMedia && window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
function syncThemeLabel() {
|
|
1273
|
+
if (!themeBtn) return;
|
|
1274
|
+
themeBtn.textContent = currentTheme() === "dark" ? "Light theme" : "Dark theme";
|
|
1275
|
+
}
|
|
1276
|
+
syncThemeLabel();
|
|
1277
|
+
|
|
1278
|
+
if (themeBtn) {
|
|
1279
|
+
themeBtn.addEventListener("click", function () {
|
|
1280
|
+
var next = currentTheme() === "dark" ? "light" : "dark";
|
|
1281
|
+
root.setAttribute("data-theme", next);
|
|
1282
|
+
try { localStorage.setItem("vibecode-report-theme", next); } catch (e) {}
|
|
1283
|
+
syncThemeLabel();
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
var activeFilter = "all";
|
|
1288
|
+
var searchQuery = "";
|
|
1289
|
+
var cards = Array.prototype.slice.call(document.querySelectorAll("[data-inv-card]"));
|
|
1290
|
+
var filterButtons = Array.prototype.slice.call(document.querySelectorAll("[data-filter]"));
|
|
1291
|
+
var searchInput = document.getElementById("inv-search");
|
|
1292
|
+
|
|
1293
|
+
function applyFilters() {
|
|
1294
|
+
for (var i = 0; i < cards.length; i++) {
|
|
1295
|
+
var card = cards[i];
|
|
1296
|
+
var matchFilter =
|
|
1297
|
+
activeFilter === "all" ||
|
|
1298
|
+
(activeFilter === "failed" && card.getAttribute("data-failed") === "true") ||
|
|
1299
|
+
(activeFilter === "passed" && card.getAttribute("data-passed") === "true") ||
|
|
1300
|
+
(activeFilter === "holdout" && card.getAttribute("data-holdout") === "true");
|
|
1301
|
+
var haystack = card.getAttribute("data-search") || "";
|
|
1302
|
+
var matchSearch = !searchQuery || haystack.indexOf(searchQuery) !== -1;
|
|
1303
|
+
card.hidden = !(matchFilter && matchSearch);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
for (var f = 0; f < filterButtons.length; f++) {
|
|
1308
|
+
filterButtons[f].addEventListener("click", function (ev) {
|
|
1309
|
+
var btn = ev.currentTarget;
|
|
1310
|
+
activeFilter = btn.getAttribute("data-filter") || "all";
|
|
1311
|
+
for (var j = 0; j < filterButtons.length; j++) {
|
|
1312
|
+
filterButtons[j].classList.toggle("active", filterButtons[j] === btn);
|
|
1313
|
+
}
|
|
1314
|
+
applyFilters();
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
if (searchInput) {
|
|
1319
|
+
searchInput.addEventListener("input", function () {
|
|
1320
|
+
searchQuery = String(searchInput.value || "").trim().toLowerCase();
|
|
1321
|
+
applyFilters();
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
var compares = Array.prototype.slice.call(document.querySelectorAll("[data-visual-compare]"));
|
|
1326
|
+
for (var c = 0; c < compares.length; c++) {
|
|
1327
|
+
(function (box) {
|
|
1328
|
+
var range = box.querySelector("[data-compare-range]");
|
|
1329
|
+
var stage = box.querySelector("[data-compare-stage]");
|
|
1330
|
+
var readout = box.querySelector("[data-split-readout]");
|
|
1331
|
+
var diffBtn = box.querySelector("[data-diff-toggle]");
|
|
1332
|
+
var diffLayer = box.querySelector(".compare-diff-layer");
|
|
1333
|
+
|
|
1334
|
+
if (range && stage) {
|
|
1335
|
+
range.addEventListener("input", function () {
|
|
1336
|
+
var val = Number(range.value);
|
|
1337
|
+
if (!Number.isFinite(val)) val = 50;
|
|
1338
|
+
var clamped = Math.max(0, Math.min(100, val));
|
|
1339
|
+
stage.style.setProperty("--pos", clamped + "%");
|
|
1340
|
+
if (readout) readout.textContent = clamped + "%";
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
if (diffBtn && diffLayer) {
|
|
1344
|
+
diffBtn.addEventListener("click", function () {
|
|
1345
|
+
var pressed = diffBtn.getAttribute("aria-pressed") === "true";
|
|
1346
|
+
var next = !pressed;
|
|
1347
|
+
diffBtn.setAttribute("aria-pressed", next ? "true" : "false");
|
|
1348
|
+
diffLayer.hidden = !next;
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
})(compares[c]);
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
var copyButtons = Array.prototype.slice.call(document.querySelectorAll("[data-copy-repro]"));
|
|
1355
|
+
for (var b = 0; b < copyButtons.length; b++) {
|
|
1356
|
+
copyButtons[b].addEventListener("click", function (ev) {
|
|
1357
|
+
var btn = ev.currentTarget;
|
|
1358
|
+
var bar = btn.parentElement;
|
|
1359
|
+
var codeEl = bar ? bar.querySelector("[data-repro-text]") : null;
|
|
1360
|
+
var text = codeEl ? codeEl.textContent || "" : "";
|
|
1361
|
+
if (!text) return;
|
|
1362
|
+
function markCopied() {
|
|
1363
|
+
var prev = btn.textContent;
|
|
1364
|
+
btn.textContent = "Copied!";
|
|
1365
|
+
setTimeout(function () { btn.textContent = prev || "Copy"; }, 1400);
|
|
1366
|
+
}
|
|
1367
|
+
if (navigator.clipboard && typeof navigator.clipboard.writeText === "function") {
|
|
1368
|
+
navigator.clipboard.writeText(text).then(markCopied, markCopied);
|
|
1369
|
+
} else {
|
|
1370
|
+
try {
|
|
1371
|
+
var ta = document.createElement("textarea");
|
|
1372
|
+
ta.value = text;
|
|
1373
|
+
ta.setAttribute("readonly", "");
|
|
1374
|
+
ta.style.position = "fixed";
|
|
1375
|
+
ta.style.opacity = "0";
|
|
1376
|
+
document.body.appendChild(ta);
|
|
1377
|
+
ta.select();
|
|
1378
|
+
document.execCommand("copy");
|
|
1379
|
+
document.body.removeChild(ta);
|
|
1380
|
+
markCopied();
|
|
1381
|
+
} catch (e) {}
|
|
1382
|
+
}
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
})();
|
|
1386
|
+
`;
|
|
1387
|
+
export function buildHtmlReport(options) {
|
|
1388
|
+
const { contract, report, history, workspaceDir } = options;
|
|
1389
|
+
const invMap = new Map();
|
|
1390
|
+
for (const inv of contract.invariants || []) {
|
|
1391
|
+
invMap.set(inv.id, inv);
|
|
1392
|
+
}
|
|
1393
|
+
const results = Array.isArray(report.results) ? report.results : [];
|
|
1394
|
+
const views = results.map((res) => prepareInvariantView(contract, invMap.get(res.id), res, workspaceDir));
|
|
1395
|
+
const totalDurationMs = views.reduce((sum, v) => sum + v.durationMs, 0);
|
|
1396
|
+
const failedCount = views.filter((v) => v.status === "fail" || v.status === "error").length;
|
|
1397
|
+
const passedCount = views.filter((v) => v.status === "pass").length;
|
|
1398
|
+
const holdoutCount = views.filter((v) => v.isHoldout).length;
|
|
1399
|
+
const targetName = redactSensitiveText(contract.target?.name || "Unnamed Target");
|
|
1400
|
+
const domains = Array.isArray(contract.target?.domains) ? contract.target.domains : [];
|
|
1401
|
+
const gateMeta = gateBadgeMeta(report.gate?.status || "fail");
|
|
1402
|
+
const antiCheat = report.antiCheat;
|
|
1403
|
+
const antiCheatHtml = antiCheat
|
|
1404
|
+
? `<span class="badge ${antiCheat.status === "clean" ? "badge-pass" : "badge-fail"}">ANTI-CHEAT: ${escapeHtml(redactSensitiveText(antiCheat.status).toUpperCase())}</span>`
|
|
1405
|
+
: "";
|
|
1406
|
+
const gateReasons = [];
|
|
1407
|
+
const rawReasons = [
|
|
1408
|
+
...(Array.isArray(report.gate?.reasons) ? report.gate.reasons : []),
|
|
1409
|
+
...(antiCheat?.status === "suspected" && Array.isArray(antiCheat.reasons) ? antiCheat.reasons : [])
|
|
1410
|
+
];
|
|
1411
|
+
for (const r of rawReasons) {
|
|
1412
|
+
if (typeof r !== "string" || !r.trim())
|
|
1413
|
+
continue;
|
|
1414
|
+
const scrubbed = redactSensitiveText(r.trim());
|
|
1415
|
+
if (!gateReasons.includes(scrubbed))
|
|
1416
|
+
gateReasons.push(scrubbed);
|
|
1417
|
+
}
|
|
1418
|
+
const gateReasonsSection = gateReasons.length > 0
|
|
1419
|
+
? `<section class="panel" aria-label="Gate reasons">
|
|
1420
|
+
<div class="panel-head"><h2>Gate Diagnostics</h2></div>
|
|
1421
|
+
<ul class="gate-reasons">${gateReasons.map((r) => `<li>${escapeHtml(r)}</li>`).join("")}</ul>
|
|
1422
|
+
</section>`
|
|
1423
|
+
: "";
|
|
1424
|
+
const domainBadgesHtml = domains
|
|
1425
|
+
.map((domain) => `<span class="pill pill-subtle">${escapeHtml(redactSensitiveText(String(domain)))}</span>`)
|
|
1426
|
+
.join("");
|
|
1427
|
+
const safeSchemaVersion = redactSensitiveText(report.schemaVersion || contract.schemaVersion || "0.2.0");
|
|
1428
|
+
const safeTimestamp = redactSensitiveText(report.timestamp || "");
|
|
1429
|
+
const safeGateStatus = redactSensitiveText(report.gate?.status || "fail");
|
|
1430
|
+
// Compact safe telemetry JSON (strictly free of holdout details or secrets)
|
|
1431
|
+
const safeMeta = {
|
|
1432
|
+
target: targetName,
|
|
1433
|
+
gate: safeGateStatus,
|
|
1434
|
+
hardParity: clampRatio(report.hard?.parity ?? report.parity),
|
|
1435
|
+
compositeScore: clampRatio(report.compositeScore),
|
|
1436
|
+
total: views.length,
|
|
1437
|
+
passed: passedCount,
|
|
1438
|
+
failed: failedCount,
|
|
1439
|
+
holdout: holdoutCount,
|
|
1440
|
+
timestamp: safeTimestamp
|
|
1441
|
+
};
|
|
1442
|
+
return `<!DOCTYPE html>
|
|
1443
|
+
<html lang="en">
|
|
1444
|
+
<head>
|
|
1445
|
+
<meta charset="utf-8">
|
|
1446
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1447
|
+
<title>${escapeHtml(targetName)} — Vibecode Parity Report</title>
|
|
1448
|
+
<style>${REPORT_CSS}</style>
|
|
1449
|
+
</head>
|
|
1450
|
+
<body>
|
|
1451
|
+
<main class="shell">
|
|
1452
|
+
<header class="header">
|
|
1453
|
+
<div>
|
|
1454
|
+
<div class="title-row">
|
|
1455
|
+
<h1>${escapeHtml(targetName)}</h1>
|
|
1456
|
+
<span class="badge ${gateMeta.cls}">${escapeHtml(gateMeta.label)}</span>
|
|
1457
|
+
${antiCheatHtml}
|
|
1458
|
+
${domainBadgesHtml}
|
|
1459
|
+
</div>
|
|
1460
|
+
<div class="meta-row">
|
|
1461
|
+
<span>Schema ${escapeHtml(safeSchemaVersion)}</span>
|
|
1462
|
+
<span>·</span>
|
|
1463
|
+
<span>Verified ${escapeHtml(safeTimestamp)}</span>
|
|
1464
|
+
<span>·</span>
|
|
1465
|
+
<span>Total duration ${escapeHtml(formatDuration(totalDurationMs))}</span>
|
|
1466
|
+
</div>
|
|
1467
|
+
</div>
|
|
1468
|
+
<div class="header-controls">
|
|
1469
|
+
<button type="button" id="theme-toggle" class="btn-ghost">Light theme</button>
|
|
1470
|
+
</div>
|
|
1471
|
+
</header>
|
|
1472
|
+
|
|
1473
|
+
<section class="kpi-grid" aria-label="Parity summary">
|
|
1474
|
+
<div class="kpi-card">
|
|
1475
|
+
<div class="kpi-label">Hard Parity</div>
|
|
1476
|
+
<div class="kpi-value">${formatPercent(report.hard?.parity ?? report.parity)}</div>
|
|
1477
|
+
<div class="kpi-sub">${report.hard?.passed ?? 0} / ${report.hard?.total ?? 0} hard passed</div>
|
|
1478
|
+
</div>
|
|
1479
|
+
<div class="kpi-card">
|
|
1480
|
+
<div class="kpi-label">Composite Score</div>
|
|
1481
|
+
<div class="kpi-value">${formatPercent(report.compositeScore)}</div>
|
|
1482
|
+
<div class="kpi-sub">Overall parity ${formatPercent(report.parity)}</div>
|
|
1483
|
+
</div>
|
|
1484
|
+
<div class="kpi-card">
|
|
1485
|
+
<div class="kpi-label">Soft Perceptual</div>
|
|
1486
|
+
<div class="kpi-value">${formatPercent(report.soft?.meanScore ?? 1)}</div>
|
|
1487
|
+
<div class="kpi-sub">${report.soft?.passed ?? 0} / ${report.soft?.total ?? 0} soft passed</div>
|
|
1488
|
+
</div>
|
|
1489
|
+
<div class="kpi-card">
|
|
1490
|
+
<div class="kpi-label">Invariants</div>
|
|
1491
|
+
<div class="kpi-value">${passedCount} / ${views.length}</div>
|
|
1492
|
+
<div class="kpi-sub">${failedCount} failed · ${holdoutCount} holdout</div>
|
|
1493
|
+
</div>
|
|
1494
|
+
</section>
|
|
1495
|
+
|
|
1496
|
+
${gateReasonsSection}
|
|
1497
|
+
${renderSlicesSection(contract.slices)}${report.fixtureSummary?.applied ? `\n ${renderFixtureSummarySection(report.fixtureSummary)}` : ""}
|
|
1498
|
+
${renderConvergenceChart(history)}
|
|
1499
|
+
|
|
1500
|
+
<section class="panel" aria-label="Invariants">
|
|
1501
|
+
<div class="filter-bar">
|
|
1502
|
+
<div class="filter-group" role="tablist" aria-label="Filter invariants">
|
|
1503
|
+
<button type="button" class="btn-ghost filter-pill active" data-filter="all">All (${views.length})</button>
|
|
1504
|
+
<button type="button" class="btn-ghost filter-pill" data-filter="failed">Failed (${failedCount})</button>
|
|
1505
|
+
<button type="button" class="btn-ghost filter-pill" data-filter="passed">Passed (${passedCount})</button>
|
|
1506
|
+
<button type="button" class="btn-ghost filter-pill" data-filter="holdout">Holdout (${holdoutCount})</button>
|
|
1507
|
+
</div>
|
|
1508
|
+
<input type="search" id="inv-search" class="search-input" placeholder="Filter by id, type, or description..." aria-label="Search invariants">
|
|
1509
|
+
</div>
|
|
1510
|
+
<div class="inv-list">
|
|
1511
|
+
${views.length > 0 ? views.map(renderInvariantCard).join("") : `<p class="muted-note">No invariant results recorded.</p>`}
|
|
1512
|
+
</div>
|
|
1513
|
+
</section>
|
|
1514
|
+
</main>
|
|
1515
|
+
<script id="vibecode-report-meta" type="application/json">${safeJsonForScript(safeMeta)}</script>
|
|
1516
|
+
<script>${REPORT_JS}</script>
|
|
1517
|
+
</body>
|
|
1518
|
+
</html>
|
|
1519
|
+
`;
|
|
1520
|
+
}
|
|
1521
|
+
export function writeHtmlReport(workspaceDir, options) {
|
|
1522
|
+
const resolvedWorkspace = path.resolve(workspaceDir);
|
|
1523
|
+
const outPath = options.outPath
|
|
1524
|
+
? path.resolve(options.outPath)
|
|
1525
|
+
: path.join(resolvedWorkspace, ".vibecode", "report.html");
|
|
1526
|
+
const html = buildHtmlReport({
|
|
1527
|
+
...options,
|
|
1528
|
+
workspaceDir: options.workspaceDir ?? resolvedWorkspace
|
|
1529
|
+
});
|
|
1530
|
+
ensureDir(path.dirname(outPath));
|
|
1531
|
+
const tmpPath = `${outPath}.tmp`;
|
|
1532
|
+
fs.writeFileSync(tmpPath, html, "utf8");
|
|
1533
|
+
fs.renameSync(tmpPath, outPath);
|
|
1534
|
+
return outPath;
|
|
1535
|
+
}
|