@decocms/parity 0.35.6 → 0.35.8
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/AGENTS.md +1 -1
- package/dist/cli.js +434 -549
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -85993,7 +85993,8 @@ var ModuleVerdict = z2.object({
|
|
|
85993
85993
|
medium: z2.number(),
|
|
85994
85994
|
low: z2.number(),
|
|
85995
85995
|
checksRun: z2.number(),
|
|
85996
|
-
pagesAnalyzed: z2.number()
|
|
85996
|
+
pagesAnalyzed: z2.number(),
|
|
85997
|
+
uncappedScore: z2.number().optional()
|
|
85997
85998
|
});
|
|
85998
85999
|
var RunCaveat = z2.object({
|
|
85999
86000
|
id: z2.string(),
|
|
@@ -86828,24 +86829,30 @@ function countBy(arr, pick) {
|
|
|
86828
86829
|
|
|
86829
86830
|
// src/report/html-template.ts
|
|
86830
86831
|
var REPORT_CSS = `
|
|
86832
|
+
/* Palette follows the deco site family (decocms.com/migrations, the plugin tour): forest + lime
|
|
86833
|
+
on warm paper in light, a warm near-black in dark. --on-accent is the text color on an
|
|
86834
|
+
--accent-action fill: lime in dark needs dark text, forest in light needs white. */
|
|
86831
86835
|
:root[data-theme="dark"], :root {
|
|
86832
|
-
--surface-base: #
|
|
86833
|
-
--surface-elevated: #
|
|
86834
|
-
--surface-overlay: #
|
|
86835
|
-
--surface-sidebar: #
|
|
86836
|
-
--border-default: #
|
|
86837
|
-
--border-strong: #
|
|
86838
|
-
--text-primary: #
|
|
86839
|
-
--text-secondary: #
|
|
86840
|
-
--text-muted: #
|
|
86841
|
-
--accent-action: #
|
|
86842
|
-
--accent
|
|
86843
|
-
--accent-
|
|
86844
|
-
--
|
|
86845
|
-
--
|
|
86846
|
-
--
|
|
86847
|
-
--state-
|
|
86848
|
-
--
|
|
86836
|
+
--surface-base: #12110f;
|
|
86837
|
+
--surface-elevated: #1b1a17;
|
|
86838
|
+
--surface-overlay: #25231f;
|
|
86839
|
+
--surface-sidebar: #161512;
|
|
86840
|
+
--border-default: #2e2b26;
|
|
86841
|
+
--border-strong: #3d3a33;
|
|
86842
|
+
--text-primary: #ecebe6;
|
|
86843
|
+
--text-secondary: #c9c5bd;
|
|
86844
|
+
--text-muted: #8f8a80;
|
|
86845
|
+
--accent-action: #d0ec1a;
|
|
86846
|
+
--on-accent: #07401a;
|
|
86847
|
+
--accent-tint: rgba(208,236,26,0.10);
|
|
86848
|
+
--accent-ink: #d0ec1a;
|
|
86849
|
+
--accent-prod: #5aa9f0;
|
|
86850
|
+
--accent-cand: #c08cff;
|
|
86851
|
+
--state-good: #8fd14f;
|
|
86852
|
+
--state-warn: #f0b613;
|
|
86853
|
+
--state-bad: #ff6b5e;
|
|
86854
|
+
--state-info: #5aa9f0;
|
|
86855
|
+
--shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.18);
|
|
86849
86856
|
/* legacy tokens (mapped for backwards compat) */
|
|
86850
86857
|
--bg: var(--surface-base);
|
|
86851
86858
|
--bg-card: var(--surface-elevated);
|
|
@@ -86863,27 +86870,31 @@ var REPORT_CSS = `
|
|
|
86863
86870
|
--low: var(--text-muted);
|
|
86864
86871
|
}
|
|
86865
86872
|
:root[data-theme="light"] {
|
|
86866
|
-
--surface-base: #
|
|
86873
|
+
--surface-base: #fafaf8;
|
|
86867
86874
|
--surface-elevated: #ffffff;
|
|
86868
|
-
--surface-overlay: #
|
|
86875
|
+
--surface-overlay: #f3f1ee;
|
|
86869
86876
|
--surface-sidebar: #ffffff;
|
|
86870
|
-
--border-default: #
|
|
86871
|
-
--border-strong: #
|
|
86872
|
-
--text-primary: #
|
|
86873
|
-
--text-secondary: #
|
|
86874
|
-
--text-muted: #
|
|
86875
|
-
--accent-action: #
|
|
86876
|
-
--accent
|
|
86877
|
-
--accent-
|
|
86878
|
-
--
|
|
86879
|
-
--
|
|
86880
|
-
--
|
|
86881
|
-
--
|
|
86877
|
+
--border-default: #e7e4df;
|
|
86878
|
+
--border-strong: #d2cec7;
|
|
86879
|
+
--text-primary: #1d1a17;
|
|
86880
|
+
--text-secondary: #4a4540;
|
|
86881
|
+
--text-muted: #77716b;
|
|
86882
|
+
--accent-action: #07401a;
|
|
86883
|
+
--on-accent: #ffffff;
|
|
86884
|
+
--accent-tint: #f1f8cf;
|
|
86885
|
+
--accent-ink: #07401a;
|
|
86886
|
+
--accent-prod: #1c6fb8;
|
|
86887
|
+
--accent-cand: #7c3aed;
|
|
86888
|
+
--state-good: #3f7d00;
|
|
86889
|
+
--state-warn: #a66b00;
|
|
86890
|
+
--state-bad: #c4281c;
|
|
86891
|
+
--state-info: #1c6fb8;
|
|
86892
|
+
--shadow-card: 0 1px 2px rgba(29,26,23,0.05), 0 6px 18px rgba(29,26,23,0.05);
|
|
86882
86893
|
}
|
|
86883
86894
|
* { box-sizing: border-box; }
|
|
86884
86895
|
html, body { margin: 0; padding: 0; min-height: 100vh; }
|
|
86885
86896
|
body {
|
|
86886
|
-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
|
|
86897
|
+
font-family: Switzer, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
|
|
86887
86898
|
background: var(--surface-base);
|
|
86888
86899
|
color: var(--text-primary);
|
|
86889
86900
|
line-height: 1.55;
|
|
@@ -86983,11 +86994,12 @@ var REPORT_CSS = `
|
|
|
86983
86994
|
}
|
|
86984
86995
|
.nav-item:hover { background: var(--surface-overlay); color: var(--text-primary); }
|
|
86985
86996
|
.nav-item.active {
|
|
86986
|
-
background: var(--
|
|
86987
|
-
color: var(--
|
|
86988
|
-
|
|
86997
|
+
background: var(--accent-tint);
|
|
86998
|
+
color: var(--accent-ink);
|
|
86999
|
+
font-weight: 600;
|
|
86989
87000
|
}
|
|
86990
|
-
|
|
87001
|
+
/* Emoji glyphs render differently per OS and fight the palette; the labels carry the meaning. */
|
|
87002
|
+
.nav-item .icon { display: none; }
|
|
86991
87003
|
.nav-item .label { flex: 1; }
|
|
86992
87004
|
.nav-item .count {
|
|
86993
87005
|
background: var(--surface-base);
|
|
@@ -86998,7 +87010,7 @@ var REPORT_CSS = `
|
|
|
86998
87010
|
border-radius: 10px;
|
|
86999
87011
|
font-variant-numeric: tabular-nums;
|
|
87000
87012
|
}
|
|
87001
|
-
.nav-item.active .count { background: var(--accent-action); border-color: var(--accent-action); color:
|
|
87013
|
+
.nav-item.active .count { background: var(--accent-action); border-color: var(--accent-action); color: var(--on-accent); }
|
|
87002
87014
|
.sidebar-footer {
|
|
87003
87015
|
padding: 16px 20px;
|
|
87004
87016
|
border-top: 1px solid var(--border-default);
|
|
@@ -87053,7 +87065,7 @@ var REPORT_CSS = `
|
|
|
87053
87065
|
.health-score::after {
|
|
87054
87066
|
content: "";
|
|
87055
87067
|
position: absolute;
|
|
87056
|
-
inset:
|
|
87068
|
+
inset: 10px;
|
|
87057
87069
|
border-radius: 50%;
|
|
87058
87070
|
background: var(--surface-elevated);
|
|
87059
87071
|
z-index: 1;
|
|
@@ -87062,7 +87074,7 @@ var REPORT_CSS = `
|
|
|
87062
87074
|
position: relative; z-index: 2;
|
|
87063
87075
|
}
|
|
87064
87076
|
.health-score .score-num {
|
|
87065
|
-
font-size: 46px; font-weight:
|
|
87077
|
+
font-size: 46px; font-weight: 600; letter-spacing: -0.03em; line-height: 1;
|
|
87066
87078
|
color: var(--text-primary);
|
|
87067
87079
|
}
|
|
87068
87080
|
.health-score .score-num small {
|
|
@@ -87078,7 +87090,7 @@ var REPORT_CSS = `
|
|
|
87078
87090
|
}
|
|
87079
87091
|
.dash-hero-info { display: flex; flex-direction: column; gap: 8px; }
|
|
87080
87092
|
.dash-hero-info .verdict-text {
|
|
87081
|
-
font-size:
|
|
87093
|
+
font-size: 24px; font-weight: 600; letter-spacing: -0.02em;
|
|
87082
87094
|
}
|
|
87083
87095
|
.dash-hero-info .verdict-text.pass { color: var(--state-good); }
|
|
87084
87096
|
.dash-hero-info .verdict-text.warn { color: var(--state-warn); }
|
|
@@ -87100,8 +87112,8 @@ var REPORT_CSS = `
|
|
|
87100
87112
|
.tile {
|
|
87101
87113
|
background: var(--surface-elevated);
|
|
87102
87114
|
border: 1px solid var(--border-default);
|
|
87103
|
-
border-radius:
|
|
87104
|
-
padding:
|
|
87115
|
+
border-radius: 16px;
|
|
87116
|
+
padding: 18px;
|
|
87105
87117
|
box-shadow: var(--shadow-card);
|
|
87106
87118
|
cursor: pointer;
|
|
87107
87119
|
transition: transform 0.15s, border-color 0.15s;
|
|
@@ -87109,15 +87121,31 @@ var REPORT_CSS = `
|
|
|
87109
87121
|
color: inherit;
|
|
87110
87122
|
display: block;
|
|
87111
87123
|
}
|
|
87112
|
-
.tile:hover { transform: translateY(-2px); border-color: var(--
|
|
87113
|
-
.tile .tile-icon {
|
|
87114
|
-
.tile .tile-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.
|
|
87115
|
-
.tile .tile-
|
|
87116
|
-
.tile .tile-
|
|
87117
|
-
.tile.
|
|
87118
|
-
.tile.state-
|
|
87119
|
-
.tile.state-
|
|
87120
|
-
.tile.state-
|
|
87124
|
+
.tile:hover { transform: translateY(-2px); border-color: var(--border-strong); text-decoration: none; }
|
|
87125
|
+
.tile .tile-icon { display: none; }
|
|
87126
|
+
.tile .tile-label { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
|
|
87127
|
+
.tile .tile-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tile-state, var(--text-muted)); }
|
|
87128
|
+
.tile .tile-value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-top: 10px; line-height: 1.1; }
|
|
87129
|
+
.tile .tile-meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
|
|
87130
|
+
.tile.state-pass { --tile-state: var(--state-good); }
|
|
87131
|
+
.tile.state-warn { --tile-state: var(--state-warn); }
|
|
87132
|
+
.tile.state-fail { --tile-state: var(--state-bad); }
|
|
87133
|
+
.tile.state-info { --tile-state: var(--state-info); }
|
|
87134
|
+
/* Score breakdown + visual parity line (dashboard) */
|
|
87135
|
+
.visual-parity { margin: 6px 0 2px; font-size: 15px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
|
|
87136
|
+
.visual-parity span { font-size: 12px; color: var(--text-muted); }
|
|
87137
|
+
.score-breakdown { margin-bottom: 16px; }
|
|
87138
|
+
.sb-capped { font-size: 13px; color: var(--state-bad); background: var(--surface-overlay); border-left: 3px solid var(--state-bad); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
|
|
87139
|
+
.sb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
|
87140
|
+
.sb-table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 6px 8px; border-bottom: 1px solid var(--border-default); }
|
|
87141
|
+
.sb-table td { padding: 7px 8px; border-bottom: 1px solid var(--border-default); vertical-align: top; color: var(--text-primary); }
|
|
87142
|
+
.sb-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
87143
|
+
.sb-table small { color: var(--text-muted); }
|
|
87144
|
+
.sb-status { font-size: 11px; font-weight: 600; text-transform: uppercase; }
|
|
87145
|
+
.sb-cap { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
|
|
87146
|
+
.sb-lost { display: flex; align-items: center; gap: 8px; min-width: 180px; }
|
|
87147
|
+
.sb-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-overlay); overflow: hidden; }
|
|
87148
|
+
.sb-bar span { display: block; height: 100%; background: var(--state-bad); }
|
|
87121
87149
|
|
|
87122
87150
|
/* Cards */
|
|
87123
87151
|
.card {
|
|
@@ -87202,7 +87230,7 @@ var REPORT_CSS = `
|
|
|
87202
87230
|
.tag.sev-medium { background: rgba(242,201,76,0.15); color: #f2c94c; }
|
|
87203
87231
|
.tag.sev-low { background: rgba(138,147,166,0.15); color: var(--text-muted); }
|
|
87204
87232
|
.tag.tag-mono { font-family: "SF Mono", Menlo, monospace; text-transform: none; }
|
|
87205
|
-
.tag.tag-page { background:
|
|
87233
|
+
.tag.tag-page { background: color-mix(in srgb, var(--state-info) 14%, transparent); color: var(--state-info); }
|
|
87206
87234
|
.issue h3 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4; }
|
|
87207
87235
|
.issue-section { margin-top: 10px; border-top: 1px solid var(--border-default); padding-top: 8px; }
|
|
87208
87236
|
.issue-section summary { cursor: pointer; display: flex; align-items: center; justify-content: space-between; list-style: none; padding: 4px 0; }
|
|
@@ -87259,37 +87287,9 @@ var REPORT_CSS = `
|
|
|
87259
87287
|
.agentic-pillar { margin-top: 14px; }
|
|
87260
87288
|
.agentic-pillar-head { font-weight: 600; margin-bottom: 6px; }
|
|
87261
87289
|
|
|
87262
|
-
/* Side-by-side iframes */
|
|
87263
|
-
.sbs-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
|
|
87264
|
-
.sbs-toolbar button { background: var(--surface-overlay); color: var(--text-primary); border: 1px solid var(--border-default); padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
|
|
87265
|
-
.sbs-toolbar button.active { background: var(--accent-action); color: white; border-color: var(--accent-action); }
|
|
87266
|
-
.sbs-toolbar button:hover { border-color: var(--accent-action); }
|
|
87267
|
-
/* Inferred URL pair — captured on only one side. Issue #77. */
|
|
87268
|
-
.sbs-toolbar button.sbs-btn-inferred { opacity: 0.7; border-style: dashed; }
|
|
87269
|
-
.sbs-toolbar .sbs-btn-flag {
|
|
87270
|
-
display: inline-block;
|
|
87271
|
-
margin-left: 4px;
|
|
87272
|
-
background: var(--state-warn);
|
|
87273
|
-
color: white;
|
|
87274
|
-
font-size: 10px;
|
|
87275
|
-
font-weight: 700;
|
|
87276
|
-
padding: 0 6px;
|
|
87277
|
-
border-radius: 8px;
|
|
87278
|
-
}
|
|
87279
|
-
.sbs-toolbar .label { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
|
|
87280
|
-
.sbs-toolbar .toolbar-right { margin-left: auto; font-size: 11px; color: var(--text-muted); }
|
|
87281
|
-
.sbs-container { display: flex; gap: 16px; justify-content: center; align-items: flex-start; }
|
|
87282
|
-
.sbs-frame { display: flex; flex-direction: column; flex-shrink: 0; }
|
|
87283
|
-
.sbs-frame .frame-title { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
|
|
87284
|
-
.sbs-frame .frame-url { text-align: center; font-size: 11px; color: var(--text-muted); margin-bottom: 8px; word-break: break-all; max-width: 375px; }
|
|
87285
|
-
.sbs-iframe { width: 375px; height: 78vh; border: 1px solid var(--border-default); border-radius: 12px; background: white; }
|
|
87286
|
-
.sbs-status { font-size: 12px; padding: 8px 12px; border-radius: 6px; margin-bottom: 10px; }
|
|
87287
|
-
.sbs-status.ok { background: rgba(46,194,126,0.12); color: var(--state-good); border: 1px solid rgba(46,194,126,0.3); }
|
|
87288
|
-
.sbs-status.warn { background: rgba(245,166,35,0.12); color: var(--state-warn); border: 1px solid rgba(245,166,35,0.3); }
|
|
87289
|
-
|
|
87290
87290
|
/* LLM Prompt panel */
|
|
87291
87291
|
.prompt-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
|
|
87292
|
-
.prompt-toolbar button { background: var(--accent-action); color:
|
|
87292
|
+
.prompt-toolbar button { background: var(--accent-action); color: var(--on-accent); border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
|
|
87293
87293
|
.prompt-toolbar button:hover { opacity: 0.9; }
|
|
87294
87294
|
.prompt-toolbar button.secondary { background: var(--surface-overlay); color: var(--text-primary); border: 1px solid var(--border-default); }
|
|
87295
87295
|
.prompt-toolbar .feedback { font-size: 12px; color: var(--state-good); margin-left: 8px; opacity: 0; transition: opacity 0.2s; }
|
|
@@ -87321,7 +87321,7 @@ var REPORT_CSS = `
|
|
|
87321
87321
|
.url-cell a { color: var(--accent-action); text-decoration: none; }
|
|
87322
87322
|
.url-cell a:hover { text-decoration: underline; }
|
|
87323
87323
|
.net-cat { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; background: var(--surface-overlay); color: var(--text-muted); }
|
|
87324
|
-
.net-cat.cat-document { background:
|
|
87324
|
+
.net-cat.cat-document { background: color-mix(in srgb, var(--state-info) 14%, transparent); color: var(--state-info); }
|
|
87325
87325
|
.net-cat.cat-static-asset { background: rgba(46,194,126,0.15); color: var(--state-good); }
|
|
87326
87326
|
.net-cat.cat-image { background: rgba(245,166,35,0.15); color: var(--state-warn); }
|
|
87327
87327
|
.net-cat.cat-font { background: rgba(184,110,255,0.15); color: var(--accent-cand); }
|
|
@@ -87443,10 +87443,10 @@ var REPORT_CSS = `
|
|
|
87443
87443
|
color: var(--text-muted);
|
|
87444
87444
|
border-color: rgba(138, 147, 166, 0.3);
|
|
87445
87445
|
}
|
|
87446
|
-
.vd-badge.sev-critical { background: var(--critical); color:
|
|
87447
|
-
.vd-badge.sev-high { background: var(--high); color:
|
|
87446
|
+
.vd-badge.sev-critical { background: var(--critical); color: var(--surface-base); border-color: var(--critical); }
|
|
87447
|
+
.vd-badge.sev-high { background: var(--high); color: var(--surface-base); border-color: var(--high); }
|
|
87448
87448
|
.vd-badge.sev-medium { background: var(--medium); color: #1a1a1a; border-color: var(--medium); }
|
|
87449
|
-
.vd-badge.sev-low { background: var(--low); color:
|
|
87449
|
+
.vd-badge.sev-low { background: var(--low); color: var(--surface-base); border-color: var(--low); }
|
|
87450
87450
|
|
|
87451
87451
|
.vd-list {
|
|
87452
87452
|
display: flex;
|
|
@@ -88104,8 +88104,7 @@ var REPORT_CSS = `
|
|
|
88104
88104
|
/* Accessibility — keyboard focus rings. Issue #81. */
|
|
88105
88105
|
.nav-item:focus-visible,
|
|
88106
88106
|
.action-btn:focus-visible,
|
|
88107
|
-
.copy-btn:focus-visible
|
|
88108
|
-
.sbs-toolbar button:focus-visible {
|
|
88107
|
+
.copy-btn:focus-visible {
|
|
88109
88108
|
outline: 2px solid var(--accent-action);
|
|
88110
88109
|
outline-offset: 2px;
|
|
88111
88110
|
}
|
|
@@ -88143,7 +88142,6 @@ var REPORT_CSS = `
|
|
|
88143
88142
|
}
|
|
88144
88143
|
.health-score { margin: 0 auto; }
|
|
88145
88144
|
.tiles { grid-template-columns: repeat(2, 1fr); }
|
|
88146
|
-
.sbs-container { flex-direction: column; }
|
|
88147
88145
|
}
|
|
88148
88146
|
|
|
88149
88147
|
/* Print */
|
|
@@ -88229,14 +88227,9 @@ var REPORT_JS = `
|
|
|
88229
88227
|
var btn = document.getElementById('theme-toggle');
|
|
88230
88228
|
if (btn) btn.textContent = next === 'dark' ? '☀ Light' : '\uD83C\uDF19 Dark';
|
|
88231
88229
|
}
|
|
88232
|
-
|
|
88233
|
-
|
|
88234
|
-
|
|
88235
|
-
document.documentElement.setAttribute('data-theme', saved);
|
|
88236
|
-
var btn0 = document.getElementById('theme-toggle');
|
|
88237
|
-
if (btn0) btn0.textContent = saved === 'dark' ? '☀ Light' : '\uD83C\uDF19 Dark';
|
|
88238
|
-
}
|
|
88239
|
-
} catch (e) {}
|
|
88230
|
+
// The theme itself is set in <head> (THEME_BOOT) so there is no flash; here only the label.
|
|
88231
|
+
var btn0 = document.getElementById('theme-toggle');
|
|
88232
|
+
if (btn0) btn0.textContent = document.documentElement.getAttribute('data-theme') === 'light' ? '\uD83C\uDF19 Dark' : '☀ Light';
|
|
88240
88233
|
var tBtn = document.getElementById('theme-toggle');
|
|
88241
88234
|
if (tBtn) tBtn.addEventListener('click', toggleTheme);
|
|
88242
88235
|
|
|
@@ -88452,71 +88445,9 @@ var REPORT_JS = `
|
|
|
88452
88445
|
if (ev.key === 'Escape' && lb.classList.contains('open')) close();
|
|
88453
88446
|
});
|
|
88454
88447
|
})();
|
|
88455
|
-
|
|
88456
|
-
// ---- Side-by-side iframe controller ----
|
|
88457
|
-
var sbsState = window.__parity_sbs || {};
|
|
88458
|
-
var proxyBase = window.__parity_proxy; // set by 'parity serve' on the served page
|
|
88459
|
-
// Side-by-side is mobile-only today. When the proxy is active, force the
|
|
88460
|
-
// upstream response to render at the mobile breakpoint by appending
|
|
88461
|
-
// viewport=mobile — the proxy strips X-Frame-Options AND injects a 375
|
|
88462
|
-
// viewport meta + mobile UA. Issue #70.
|
|
88463
|
-
function proxied(u) { return proxyBase ? proxyBase + encodeURIComponent(u) + '&viewport=mobile' : u; }
|
|
88464
|
-
var statusEl = document.getElementById('sbs-status');
|
|
88465
|
-
if (statusEl) {
|
|
88466
|
-
statusEl.textContent = proxyBase
|
|
88467
|
-
? '✓ proxy server active — iframes bypass X-Frame-Options'
|
|
88468
|
-
: '⚠ no proxy (file://) — sites with X-Frame-Options will appear empty. Run "parity serve <runId>" to start the local proxy.';
|
|
88469
|
-
statusEl.className = proxyBase ? 'sbs-status ok' : 'sbs-status warn';
|
|
88470
|
-
}
|
|
88471
|
-
if (sbsState.pairs && sbsState.pairs.length > 0) {
|
|
88472
|
-
var current = 0;
|
|
88473
|
-
var syncEnabled = true;
|
|
88474
|
-
var btns = document.querySelectorAll('[data-sbs-btn]');
|
|
88475
|
-
var iframeProd = document.getElementById('sbs-prod');
|
|
88476
|
-
var iframeCand = document.getElementById('sbs-cand');
|
|
88477
|
-
var urlProdEl = document.getElementById('sbs-url-prod');
|
|
88478
|
-
var urlCandEl = document.getElementById('sbs-url-cand');
|
|
88479
|
-
var syncToggle = document.getElementById('sbs-sync');
|
|
88480
|
-
|
|
88481
|
-
function load(idx) {
|
|
88482
|
-
current = idx;
|
|
88483
|
-
var pair = sbsState.pairs[idx];
|
|
88484
|
-
if (!pair) return;
|
|
88485
|
-
iframeProd.src = proxied(pair.prodUrl);
|
|
88486
|
-
iframeCand.src = proxied(pair.candUrl);
|
|
88487
|
-
urlProdEl.textContent = pair.prodUrl;
|
|
88488
|
-
urlCandEl.textContent = pair.candUrl;
|
|
88489
|
-
btns.forEach(function(b) {
|
|
88490
|
-
b.classList.toggle('active', b.dataset.sbsBtn === String(idx));
|
|
88491
|
-
});
|
|
88492
|
-
}
|
|
88493
|
-
btns.forEach(function(b) {
|
|
88494
|
-
b.addEventListener('click', function() { load(Number(b.dataset.sbsBtn)); });
|
|
88495
|
-
});
|
|
88496
|
-
if (syncToggle) {
|
|
88497
|
-
syncToggle.addEventListener('change', function() { syncEnabled = syncToggle.checked; });
|
|
88498
|
-
}
|
|
88499
|
-
var syncing = false;
|
|
88500
|
-
function attachScroll(src, dst) {
|
|
88501
|
-
try {
|
|
88502
|
-
src.contentWindow.addEventListener('scroll', function() {
|
|
88503
|
-
if (!syncEnabled || syncing) return;
|
|
88504
|
-
syncing = true;
|
|
88505
|
-
try { dst.contentWindow.scrollTo(src.contentWindow.scrollX, src.contentWindow.scrollY); } catch (e) {}
|
|
88506
|
-
setTimeout(function() { syncing = false; }, 30);
|
|
88507
|
-
}, { passive: true });
|
|
88508
|
-
} catch (e) {}
|
|
88509
|
-
}
|
|
88510
|
-
function tryAttach() {
|
|
88511
|
-
attachScroll(iframeProd, iframeCand);
|
|
88512
|
-
attachScroll(iframeCand, iframeProd);
|
|
88513
|
-
}
|
|
88514
|
-
iframeProd.addEventListener('load', tryAttach);
|
|
88515
|
-
iframeCand.addEventListener('load', tryAttach);
|
|
88516
|
-
if (sbsState.pairs.length > 0) load(0);
|
|
88517
|
-
}
|
|
88518
88448
|
})();
|
|
88519
88449
|
`.trim();
|
|
88450
|
+
var THEME_BOOT = `try{var t=localStorage.getItem('parity-theme');if(t!=='light'&&t!=='dark')t=matchMedia('(prefers-color-scheme: light)').matches?'light':'dark';document.documentElement.setAttribute('data-theme',t)}catch(e){}`;
|
|
88520
88451
|
|
|
88521
88452
|
// src/report/issue-html.ts
|
|
88522
88453
|
import { relative } from "node:path";
|
|
@@ -97526,7 +97457,8 @@ function computeModuleVerdicts(checks, issues) {
|
|
|
97526
97457
|
const checksFailed = modChecks.filter((c) => c.status === "fail").length;
|
|
97527
97458
|
const checksWarn = modChecks.filter((c) => c.status === "warn").length;
|
|
97528
97459
|
const pagesAnalyzed = derivePagesAnalyzed(modChecks, modIssues);
|
|
97529
|
-
|
|
97460
|
+
const uncappedScore = computeScore(modIssues, { pagesAnalyzed }).score;
|
|
97461
|
+
let score = uncappedScore;
|
|
97530
97462
|
const status = counts.critical > 0 || checksFailed > 0 ? "fail" : counts.high > 0 || checksWarn > 0 ? "warn" : "pass";
|
|
97531
97463
|
if (status === "fail")
|
|
97532
97464
|
score = Math.min(score, FAIL_SCORE_CAP);
|
|
@@ -97539,12 +97471,16 @@ function computeModuleVerdicts(checks, issues) {
|
|
|
97539
97471
|
medium: counts.medium,
|
|
97540
97472
|
low: counts.low,
|
|
97541
97473
|
checksRun: modChecks.length,
|
|
97542
|
-
pagesAnalyzed
|
|
97474
|
+
pagesAnalyzed,
|
|
97475
|
+
uncappedScore
|
|
97543
97476
|
});
|
|
97544
97477
|
}
|
|
97545
97478
|
result.sort((a, b) => a.module.localeCompare(b.module));
|
|
97546
97479
|
return result;
|
|
97547
97480
|
}
|
|
97481
|
+
function moduleWeight(mv) {
|
|
97482
|
+
return Math.max(1, mv.pagesAnalyzed);
|
|
97483
|
+
}
|
|
97548
97484
|
function computeCompositeVerdict(moduleVerdicts, checks, issues) {
|
|
97549
97485
|
const counts = { critical: 0, high: 0, medium: 0, low: 0 };
|
|
97550
97486
|
for (const i of issues)
|
|
@@ -97557,7 +97493,7 @@ function computeCompositeVerdict(moduleVerdicts, checks, issues) {
|
|
|
97557
97493
|
let weightSum = 0;
|
|
97558
97494
|
let totalPagesAnalyzed = 0;
|
|
97559
97495
|
for (const mv of moduleVerdicts) {
|
|
97560
|
-
const weight =
|
|
97496
|
+
const weight = moduleWeight(mv);
|
|
97561
97497
|
weightedScoreSum += mv.score * weight;
|
|
97562
97498
|
weightSum += weight;
|
|
97563
97499
|
totalPagesAnalyzed = Math.max(totalPagesAnalyzed, mv.pagesAnalyzed);
|
|
@@ -97583,6 +97519,38 @@ function computeCompositeVerdict(moduleVerdicts, checks, issues) {
|
|
|
97583
97519
|
modulesRun: moduleVerdicts.map((mv) => mv.module).sort()
|
|
97584
97520
|
};
|
|
97585
97521
|
}
|
|
97522
|
+
function explainCompositeScore(moduleVerdicts, verdict, checks) {
|
|
97523
|
+
if (moduleVerdicts.length === 0 || verdict.status === "inconclusive")
|
|
97524
|
+
return null;
|
|
97525
|
+
const weightSum = moduleVerdicts.reduce((s, mv) => s + moduleWeight(mv), 0);
|
|
97526
|
+
const failedChecks = (mod) => checks.filter((c) => c.status === "fail" && (mod === undefined || moduleOfCheck(c.name) === mod)).map((c) => c.name);
|
|
97527
|
+
const criticalNote = (n) => n > 0 ? [`${n} critical issue${n === 1 ? "" : "s"}`] : [];
|
|
97528
|
+
const modules = moduleVerdicts.map((mv) => {
|
|
97529
|
+
const weightShare = moduleWeight(mv) / weightSum;
|
|
97530
|
+
const capBound = mv.status === "fail" && (mv.uncappedScore !== undefined ? mv.uncappedScore > mv.score : mv.score === FAIL_SCORE_CAP);
|
|
97531
|
+
return {
|
|
97532
|
+
module: mv.module,
|
|
97533
|
+
score: mv.score,
|
|
97534
|
+
status: mv.status,
|
|
97535
|
+
weight: moduleWeight(mv),
|
|
97536
|
+
weightShare,
|
|
97537
|
+
pointsLost: (100 - mv.score) * weightShare,
|
|
97538
|
+
cappedBy: capBound ? [...failedChecks(mv.module), ...criticalNote(mv.critical)] : []
|
|
97539
|
+
};
|
|
97540
|
+
}).sort((a, b) => b.pointsLost - a.pointsLost || a.module.localeCompare(b.module));
|
|
97541
|
+
const uncappedScore = Math.round(moduleVerdicts.reduce((s, mv) => s + mv.score * moduleWeight(mv), 0) / weightSum);
|
|
97542
|
+
const failed = verdict.status === "fail";
|
|
97543
|
+
if ((failed ? Math.min(uncappedScore, FAIL_SCORE_CAP) : uncappedScore) !== verdict.score) {
|
|
97544
|
+
return null;
|
|
97545
|
+
}
|
|
97546
|
+
return {
|
|
97547
|
+
modules,
|
|
97548
|
+
uncappedScore,
|
|
97549
|
+
score: verdict.score,
|
|
97550
|
+
capped: failed && uncappedScore > FAIL_SCORE_CAP,
|
|
97551
|
+
failedBy: failed ? [...failedChecks(), ...criticalNote(verdict.critical)] : []
|
|
97552
|
+
};
|
|
97553
|
+
}
|
|
97586
97554
|
|
|
97587
97555
|
// src/extract/loader-props.ts
|
|
97588
97556
|
var LOADER_RE = /(^|\/)loaders\//;
|
|
@@ -98023,7 +97991,6 @@ var TAB_HELP = {
|
|
|
98023
97991
|
summary: "Migration health at a glance. Score, blocking issues, and a tile per check category. Click a tile to jump to the corresponding tab.",
|
|
98024
97992
|
visualdiff: "Per-page pixel + semantic diff between prod and cand screenshots. Pages that didn't change are auto-skipped via the cross-run cache. LLM Vision interprets the heatmap when ANTHROPIC_API_KEY or a local claude CLI is available.",
|
|
98025
97993
|
seo: "Robots.txt, sitemap, and per-page meta-tag parity between prod and cand. Red rows diverge. Catches noindex / canonical / og:* / JSON-LD regressions that silently destroy organic traffic.",
|
|
98026
|
-
sidebyside: "Live mobile iframe of prod vs cand, with synchronized scroll. Requires `parity serve <runId>` to bypass X-Frame-Options. Mobile viewport is forced via the proxy (Issue #70).",
|
|
98027
97994
|
issues: "Flat list of every issue surfaced by any check, sorted by severity. The Top issues block on the Dashboard is the LLM-aggregated, deduped version of this list.",
|
|
98028
97995
|
vitals: "Web Vitals (LCP / FCP / TTFB / INP / CLS) per page, prod vs cand. Δ green = cand better; Δ red = regression. Mobile is the default measurement viewport.",
|
|
98029
97996
|
cache: "Cache hit rate and missed opportunities on cand. Opportunities = static assets with hashed URLs returning MISS — adding a cache rule for them is usually free perf.",
|
|
@@ -98062,6 +98029,7 @@ function renderDashboard2(run) {
|
|
|
98062
98029
|
</div>
|
|
98063
98030
|
<div class="dash-hero-info">
|
|
98064
98031
|
<div class="verdict-text ${v.status}">${statusLabel}</div>
|
|
98032
|
+
${renderVisualParity(run)}
|
|
98065
98033
|
${inconclusive ? "" : deltaChip}
|
|
98066
98034
|
${renderAcceptedFindings(run)}
|
|
98067
98035
|
<div class="verdict-sub">${inconclusive ? "Nothing was measured — 0 checks ran, so this run says nothing about parity." : `${v.critical + v.high} blocking issue${v.critical + v.high !== 1 ? "s" : ""} ${v.critical > 0 ? `(${v.critical} critical)` : ""}`}</div>
|
|
@@ -98074,7 +98042,7 @@ function renderDashboard2(run) {
|
|
|
98074
98042
|
</div>
|
|
98075
98043
|
</div>
|
|
98076
98044
|
|
|
98077
|
-
${
|
|
98045
|
+
${renderScoreBreakdown(run)}
|
|
98078
98046
|
|
|
98079
98047
|
<div class="tiles">
|
|
98080
98048
|
${tiles.map((t) => renderTile(t)).join("")}
|
|
@@ -98090,17 +98058,45 @@ function renderAcceptedFindings(run) {
|
|
|
98090
98058
|
const stale = a.stale.map((e) => `<div style="color:var(--state-warn);font-size:12px;margin-top:2px">⚠ stale acceptance (matched nothing): ${escapeHtml([e.check, e.id, e.page, e.match].filter(Boolean).join(" · "))} — ${escapeHtml(e.note)}</div>`).join("");
|
|
98091
98059
|
return line + stale;
|
|
98092
98060
|
}
|
|
98093
|
-
|
|
98094
|
-
|
|
98061
|
+
var STATUS_COLOR = {
|
|
98062
|
+
pass: "var(--state-good)",
|
|
98063
|
+
warn: "var(--state-warn)",
|
|
98064
|
+
fail: "var(--state-bad)"
|
|
98065
|
+
};
|
|
98066
|
+
function renderVisualParity(run) {
|
|
98067
|
+
const vd = run.visualDiff;
|
|
98068
|
+
if (!vd || vd.pagesChecked === 0)
|
|
98095
98069
|
return "";
|
|
98096
|
-
const
|
|
98097
|
-
|
|
98098
|
-
|
|
98099
|
-
|
|
98100
|
-
|
|
98101
|
-
|
|
98102
|
-
|
|
98103
|
-
|
|
98070
|
+
const all = vd.pagesPassed === vd.pagesChecked;
|
|
98071
|
+
return `<div class="visual-parity" style="color:${all ? STATUS_COLOR.pass : STATUS_COLOR.warn}">
|
|
98072
|
+
<strong>Visual: ${vd.pagesPassed} of ${vd.pagesChecked} page${vd.pagesChecked === 1 ? "" : "s"} match prod</strong>
|
|
98073
|
+
<span>${all ? "no visual difference found" : `${vd.pagesChecked - vd.pagesPassed} with differences — see Visual Diff`}</span>
|
|
98074
|
+
</div>`;
|
|
98075
|
+
}
|
|
98076
|
+
function renderScoreBreakdown(run) {
|
|
98077
|
+
const ex = explainCompositeScore(run.moduleVerdicts ?? [], run.verdict, run.checks);
|
|
98078
|
+
if (!ex)
|
|
98079
|
+
return "";
|
|
98080
|
+
const totalLost = ex.modules.reduce((s, m) => s + m.pointsLost, 0);
|
|
98081
|
+
const maxLost = Math.max(...ex.modules.map((m) => m.pointsLost), 0.0001);
|
|
98082
|
+
const capNote = (by) => by.length > 0 ? `<div class="sb-cap">held at ${FAIL_SCORE_CAP} by FAIL: ${escapeHtml(by.join(", "))}</div>` : "";
|
|
98083
|
+
const rows = ex.modules.map((m) => `<tr>
|
|
98084
|
+
<td><strong>${escapeHtml(m.module)}</strong>${capNote(m.cappedBy)}</td>
|
|
98085
|
+
<td><span class="sb-status" style="color:${STATUS_COLOR[m.status]}">${m.status}</span></td>
|
|
98086
|
+
<td class="num" style="color:${STATUS_COLOR[m.status]}">${m.score}</td>
|
|
98087
|
+
<td class="num">${Math.round(m.weightShare * 100)}%<small> · ${m.weight} page${m.weight === 1 ? "" : "s"}</small></td>
|
|
98088
|
+
<td><div class="sb-lost"><span class="sb-bar"><span style="width:${(m.pointsLost / maxLost * 100).toFixed(1)}%"></span></span><span class="num">−${m.pointsLost.toFixed(1)}</span></div></td>
|
|
98089
|
+
</tr>`).join("");
|
|
98090
|
+
const headline = ex.capped ? `<div class="sb-capped">Capped at ${FAIL_SCORE_CAP}: the modules average ${ex.uncappedScore}, but any FAIL holds the score at ${FAIL_SCORE_CAP} or below. Triggered by ${escapeHtml(ex.failedBy.join(", "))}.</div>` : "";
|
|
98091
|
+
return `<div class="card score-breakdown">
|
|
98092
|
+
<h2>Why ${ex.score}?</h2>
|
|
98093
|
+
<div class="hint">${ex.uncappedScore} = 100 − ${totalLost.toFixed(1)} points lost, each module weighted by the pages it analyzed.${ex.failedBy.length > 0 && !ex.capped ? ` The verdict is FAIL, but the ${FAIL_SCORE_CAP} cap does not bind: the modules already average below it.` : ""}</div>
|
|
98094
|
+
${headline}
|
|
98095
|
+
<table class="sb-table">
|
|
98096
|
+
<thead><tr><th>Module</th><th>Status</th><th class="num">Score</th><th class="num">Weight</th><th>Points lost</th></tr></thead>
|
|
98097
|
+
<tbody>${rows}</tbody>
|
|
98098
|
+
</table>
|
|
98099
|
+
</div>`;
|
|
98104
98100
|
}
|
|
98105
98101
|
function buildTiles(run) {
|
|
98106
98102
|
const tiles = [];
|
|
@@ -99198,105 +99194,6 @@ function renderPromptPanel(run) {
|
|
|
99198
99194
|
<div class="prompt-md" id="prompt-md">${escapeHtml(md)}</div>
|
|
99199
99195
|
</div>`;
|
|
99200
99196
|
}
|
|
99201
|
-
function classifyPath2(path, isFirstNonHome) {
|
|
99202
|
-
const lower = path.toLowerCase();
|
|
99203
|
-
if (/\/(checkout|finalizar|finalize)/.test(lower))
|
|
99204
|
-
return "checkout";
|
|
99205
|
-
if (/\/(cart|carrinho|sacola|bag)/.test(lower))
|
|
99206
|
-
return "cart";
|
|
99207
|
-
if (/\/(c|category|collections|categoria|departamento)\//.test(lower) || /\/loja\//.test(lower))
|
|
99208
|
-
return "plp";
|
|
99209
|
-
if (/\/(p|product|produto)\//.test(lower) || /\/dp\//.test(lower))
|
|
99210
|
-
return "pdp";
|
|
99211
|
-
return isFirstNonHome ? "plp" : "pdp";
|
|
99212
|
-
}
|
|
99213
|
-
function buildSideBySidePairs(run) {
|
|
99214
|
-
if (!run.prodUrl)
|
|
99215
|
-
return [];
|
|
99216
|
-
const slots = {
|
|
99217
|
-
home: { prodPath: "/", candPath: "/" }
|
|
99218
|
-
};
|
|
99219
|
-
for (const side of ["prod", "cand"]) {
|
|
99220
|
-
let seenNonHome = false;
|
|
99221
|
-
for (const fc of run.flowCaptures) {
|
|
99222
|
-
if (fc.side !== side || fc.viewport !== "mobile")
|
|
99223
|
-
continue;
|
|
99224
|
-
for (const p of fc.pages) {
|
|
99225
|
-
const path = pathOf5(p.url);
|
|
99226
|
-
if (path === "/" || path === "")
|
|
99227
|
-
continue;
|
|
99228
|
-
const role = classifyPath2(path, !seenNonHome);
|
|
99229
|
-
seenNonHome = true;
|
|
99230
|
-
if (role === "other")
|
|
99231
|
-
continue;
|
|
99232
|
-
if (!slots[role])
|
|
99233
|
-
slots[role] = {};
|
|
99234
|
-
const slot = slots[role];
|
|
99235
|
-
if (!slot)
|
|
99236
|
-
continue;
|
|
99237
|
-
const key = side === "prod" ? "prodPath" : "candPath";
|
|
99238
|
-
if (!slot[key])
|
|
99239
|
-
slot[key] = path;
|
|
99240
|
-
}
|
|
99241
|
-
}
|
|
99242
|
-
}
|
|
99243
|
-
const order = [
|
|
99244
|
-
["home", "Home"],
|
|
99245
|
-
["plp", "PLP"],
|
|
99246
|
-
["pdp", "PDP"],
|
|
99247
|
-
["cart", "Cart"],
|
|
99248
|
-
["checkout", "Checkout"]
|
|
99249
|
-
];
|
|
99250
|
-
const pairs = [];
|
|
99251
|
-
for (const [role, label] of order) {
|
|
99252
|
-
const slot = slots[role];
|
|
99253
|
-
if (!slot)
|
|
99254
|
-
continue;
|
|
99255
|
-
const prodPath = slot.prodPath ?? slot.candPath;
|
|
99256
|
-
const candPath = slot.candPath ?? slot.prodPath;
|
|
99257
|
-
if (!prodPath || !candPath)
|
|
99258
|
-
continue;
|
|
99259
|
-
const bothCaptured = slot.prodPath && slot.candPath;
|
|
99260
|
-
pairs.push({
|
|
99261
|
-
label,
|
|
99262
|
-
prodUrl: new URL(prodPath, run.prodUrl).toString(),
|
|
99263
|
-
candUrl: new URL(candPath, run.candUrl).toString(),
|
|
99264
|
-
inferred: !bothCaptured,
|
|
99265
|
-
tooltip: !bothCaptured ? "Path captured on one side only; the other iframe falls back to the same path. May 404 if the migrated site uses different routing." : undefined
|
|
99266
|
-
});
|
|
99267
|
-
}
|
|
99268
|
-
return pairs;
|
|
99269
|
-
}
|
|
99270
|
-
function renderSideBySidePanel(run) {
|
|
99271
|
-
const pairs = buildSideBySidePairs(run);
|
|
99272
|
-
if (pairs.length === 0) {
|
|
99273
|
-
return `<div class="empty">No captured URLs available for side-by-side view.</div>`;
|
|
99274
|
-
}
|
|
99275
|
-
return `
|
|
99276
|
-
<div class="card">
|
|
99277
|
-
<h2>Side-by-side mobile</h2>
|
|
99278
|
-
<div class="hint">Compare prod (Fresh, left) with cand (TanStack, right) in mobile viewport. Scroll sync works when the proxy is active OR when the site implements a <code>postMessage</code> handler.</div>
|
|
99279
|
-
<div id="sbs-status" class="sbs-status warn">loading…</div>
|
|
99280
|
-
<div class="sbs-toolbar">
|
|
99281
|
-
${pairs.map((p, i) => `<button data-sbs-btn="${i}"${p.inferred ? ` class="sbs-btn-inferred" title="${escapeHtml(p.tooltip ?? "")}"` : ""}>${escapeHtml(p.label)}${p.inferred ? ' <span class="sbs-btn-flag">?</span>' : ""}</button>`).join("")}
|
|
99282
|
-
<label class="label"><input type="checkbox" id="sbs-sync" checked/> Synchronized scroll</label>
|
|
99283
|
-
<div class="toolbar-right">tip: use <code>parity serve <runId></code> to bypass X-Frame-Options</div>
|
|
99284
|
-
</div>
|
|
99285
|
-
<div class="sbs-container">
|
|
99286
|
-
<div class="sbs-frame">
|
|
99287
|
-
<div class="frame-title">prod (Fresh)</div>
|
|
99288
|
-
<div class="frame-url" id="sbs-url-prod">${escapeHtml(pairs[0].prodUrl)}</div>
|
|
99289
|
-
<iframe id="sbs-prod" class="sbs-iframe" src="" sandbox="allow-same-origin allow-scripts allow-forms allow-popups" loading="lazy"></iframe>
|
|
99290
|
-
</div>
|
|
99291
|
-
<div class="sbs-frame">
|
|
99292
|
-
<div class="frame-title">cand (TanStack)</div>
|
|
99293
|
-
<div class="frame-url" id="sbs-url-cand">${escapeHtml(pairs[0].candUrl)}</div>
|
|
99294
|
-
<iframe id="sbs-cand" class="sbs-iframe" src="" sandbox="allow-same-origin allow-scripts allow-forms allow-popups" loading="lazy"></iframe>
|
|
99295
|
-
</div>
|
|
99296
|
-
</div>
|
|
99297
|
-
<script>window.__parity_sbs = ${JSON.stringify({ pairs })};</script>
|
|
99298
|
-
</div>`;
|
|
99299
|
-
}
|
|
99300
99197
|
var LLM_ONLY_TABS = new Set(["visualdiff", "prompt"]);
|
|
99301
99198
|
function hasAnyLlmOutput(run) {
|
|
99302
99199
|
if (run.visualDiff?.results.some((p) => p.llmCalled))
|
|
@@ -99309,7 +99206,6 @@ function buildNav(run) {
|
|
|
99309
99206
|
{ tab: "summary", label: "Dashboard", icon: "\uD83C\uDFE0" },
|
|
99310
99207
|
{ tab: "visualdiff", label: "Visual Diff", icon: "\uD83D\uDDBC", count: run.visualDiff?.pagesWithDiffs },
|
|
99311
99208
|
{ tab: "seo", label: "SEO", icon: "\uD83D\uDD0D", count: run.seo?.issues.length },
|
|
99312
|
-
{ tab: "sidebyside", label: "Side-by-side", icon: "⇆" },
|
|
99313
99209
|
{ tab: "issues", label: "Issues", icon: "⚠", count: run.issues.length },
|
|
99314
99210
|
{ tab: "vitals", label: "Vitals", icon: "\uD83D\uDCCA" },
|
|
99315
99211
|
{ tab: "cache", label: "Cache", icon: "\uD83D\uDCBE" },
|
|
@@ -99336,6 +99232,8 @@ function renderHtmlReport(run, runDir) {
|
|
|
99336
99232
|
<meta charset="utf-8"/>
|
|
99337
99233
|
<title>parity — ${escapeHtml(run.id)}</title>
|
|
99338
99234
|
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
99235
|
+
<script>${THEME_BOOT}</script>
|
|
99236
|
+
<link rel="stylesheet" href="https://api.fontshare.com/v2/css?f[]=switzer@400,500,600,700&display=swap"/>
|
|
99339
99237
|
<style>${REPORT_CSS}</style>
|
|
99340
99238
|
</head>
|
|
99341
99239
|
<body>
|
|
@@ -99386,10 +99284,6 @@ function renderHtmlReport(run, runDir) {
|
|
|
99386
99284
|
${tabHelp(TAB_HELP.seo)}
|
|
99387
99285
|
${renderSeoPanel(run, runDir)}
|
|
99388
99286
|
</section>
|
|
99389
|
-
<section class="panel" data-panel="sidebyside">
|
|
99390
|
-
${tabHelp(TAB_HELP.sidebyside)}
|
|
99391
|
-
${renderSideBySidePanel(run)}
|
|
99392
|
-
</section>
|
|
99393
99287
|
<section class="panel" data-panel="issues">
|
|
99394
99288
|
${tabHelp(TAB_HELP.issues)}
|
|
99395
99289
|
${renderIssuesPanel(run, runDir)}
|
|
@@ -102610,7 +102504,7 @@ function taskShot(planDir, id, side) {
|
|
|
102610
102504
|
// src/server/proxy-server.ts
|
|
102611
102505
|
import { existsSync as existsSync19, readFileSync as readFileSync23, statSync as statSync2 } from "node:fs";
|
|
102612
102506
|
import { createServer } from "node:http";
|
|
102613
|
-
import { extname,
|
|
102507
|
+
import { extname, normalize as normalize2, resolve as resolve8, sep } from "node:path";
|
|
102614
102508
|
var MIME2 = {
|
|
102615
102509
|
".html": "text/html; charset=utf-8",
|
|
102616
102510
|
".css": "text/css; charset=utf-8",
|
|
@@ -102713,25 +102607,10 @@ async function handleRequest(req, res, runDir) {
|
|
|
102713
102607
|
return;
|
|
102714
102608
|
}
|
|
102715
102609
|
if (path === "/" || path === "/index.html") {
|
|
102716
|
-
return
|
|
102610
|
+
return serveStatic(res, runDir, "/report.html");
|
|
102717
102611
|
}
|
|
102718
102612
|
return serveStatic(res, runDir, path);
|
|
102719
102613
|
}
|
|
102720
|
-
function serveReportHtml(res, runDir) {
|
|
102721
|
-
const filePath = join24(runDir, "report.html");
|
|
102722
|
-
if (!existsSync19(filePath)) {
|
|
102723
|
-
res.statusCode = 404;
|
|
102724
|
-
res.end("report.html not found");
|
|
102725
|
-
return;
|
|
102726
|
-
}
|
|
102727
|
-
const html = readFileSync23(filePath, "utf8");
|
|
102728
|
-
const inject = `<script>window.__parity_proxy = "/proxy?url=";</script>`;
|
|
102729
|
-
const out = html.includes("</head>") ? html.replace("</head>", `${inject}</head>`) : `${inject}${html}`;
|
|
102730
|
-
res.statusCode = 200;
|
|
102731
|
-
res.setHeader("content-type", "text/html; charset=utf-8");
|
|
102732
|
-
res.setHeader("cache-control", "no-store");
|
|
102733
|
-
res.end(out);
|
|
102734
|
-
}
|
|
102735
102614
|
function serveStatic(res, runDir, path) {
|
|
102736
102615
|
const safePath = normalize2(path).replace(/^[/\\]+/, "");
|
|
102737
102616
|
const filePath = resolve8(runDir, safePath);
|
|
@@ -114774,17 +114653,41 @@ function mcpEndpoint(url) {
|
|
|
114774
114653
|
const trimmed = url.replace(/\/+$/, "");
|
|
114775
114654
|
return /\/mcp(\/|$)/.test(trimmed) ? trimmed : `${trimmed}/mcp/self`;
|
|
114776
114655
|
}
|
|
114777
|
-
|
|
114778
|
-
|
|
114656
|
+
var KIND_LABEL = {
|
|
114657
|
+
home: "Home",
|
|
114658
|
+
plp: "Listagem",
|
|
114659
|
+
pdp: "Produto",
|
|
114660
|
+
search: "Busca",
|
|
114661
|
+
institutional: "Institucional",
|
|
114662
|
+
blog: "Blog",
|
|
114663
|
+
account: "Minha conta",
|
|
114664
|
+
checkout: "Checkout"
|
|
114665
|
+
};
|
|
114666
|
+
function cardTitle(card) {
|
|
114667
|
+
const label = KIND_LABEL[card.kind] ?? card.kind;
|
|
114668
|
+
if (!card.path.startsWith("/"))
|
|
114669
|
+
return `${label} (página de amostra)`;
|
|
114670
|
+
return card.path === "/" ? label : `${label} · ${card.path}`;
|
|
114779
114671
|
}
|
|
114780
114672
|
var PARITY_COMMENT_PREFIX = "[parity]";
|
|
114673
|
+
var LANE_TEXT = {
|
|
114674
|
+
triage: "Em triagem: a captura ainda não ligou componentes a esta página.",
|
|
114675
|
+
backlog: "Na fila: falta construir os componentes abaixo.",
|
|
114676
|
+
building: "Em construção.",
|
|
114677
|
+
review: "Em revisão: PR aberto, aguardando os gates.",
|
|
114678
|
+
done: "Concluída: componentes construídos e comparação aprovada."
|
|
114679
|
+
};
|
|
114781
114680
|
function cardDescription(card) {
|
|
114782
|
-
const
|
|
114783
|
-
|
|
114784
|
-
|
|
114785
|
-
|
|
114786
|
-
|
|
114681
|
+
const where = card.path.startsWith("/") ? `\`${card.path}\`` : "página de amostra da captura";
|
|
114682
|
+
const lines = [
|
|
114683
|
+
`Migrar **${KIND_LABEL[card.kind] ?? card.kind}** (${where}) para o site novo.`,
|
|
114684
|
+
"",
|
|
114685
|
+
`**Status:** ${LANE_TEXT[card.column] ?? card.column}`
|
|
114686
|
+
];
|
|
114687
|
+
if (card.blockers.length) {
|
|
114688
|
+
lines.push("", "### O que falta", ...card.blockers.map((b) => `- [ ] ${b}`));
|
|
114787
114689
|
}
|
|
114690
|
+
lines.push("", "### Pronto quando", "- todos os componentes da página estão construídos", "- `parity heatmap` da página não acusa diferença de pixel (mobile e desktop)");
|
|
114788
114691
|
return lines.join(`
|
|
114789
114692
|
`);
|
|
114790
114693
|
}
|
|
@@ -114854,11 +114757,13 @@ var callTool2 = async (cfg, name, args) => {
|
|
|
114854
114757
|
};
|
|
114855
114758
|
async function syncBoardToStudio(board, cfg, opts = {}, call = callTool2) {
|
|
114856
114759
|
const existing = await call(cfg, "TASK_BOARD_ITEM_LIST", {});
|
|
114857
|
-
const
|
|
114858
|
-
const
|
|
114760
|
+
const inScope = (i) => cfg.project ? i.virtualMcpId === cfg.project : opts.repo ? i.repo === opts.repo : true;
|
|
114761
|
+
const scoped = (existing.items ?? []).filter(inScope);
|
|
114762
|
+
const byTitle = new Map(scoped.map((i) => [i.title, i]));
|
|
114763
|
+
const byId = new Map(scoped.map((i) => [i.id, i]));
|
|
114859
114764
|
const result = { created: 0, updated: 0, skipped: 0, ids: {} };
|
|
114860
|
-
const upsert = async (title, description, status, knownId) => {
|
|
114861
|
-
const found = (knownId ? byId.get(knownId) : undefined) ?? byTitle.get(title);
|
|
114765
|
+
const upsert = async (title, description, status, knownId, legacyTitle) => {
|
|
114766
|
+
const found = (knownId ? byId.get(knownId) : undefined) ?? byTitle.get(title) ?? (legacyTitle ? byTitle.get(legacyTitle) : undefined);
|
|
114862
114767
|
if (found) {
|
|
114863
114768
|
await call(cfg, "TASK_BOARD_ITEM_UPDATE", { id: found.id, title, status, description });
|
|
114864
114769
|
result.updated += 1;
|
|
@@ -114881,7 +114786,7 @@ async function syncBoardToStudio(board, cfg, opts = {}, call = callTool2) {
|
|
|
114881
114786
|
result.skipped += 1;
|
|
114882
114787
|
continue;
|
|
114883
114788
|
}
|
|
114884
|
-
const id = await upsert(cardTitle(card
|
|
114789
|
+
const id = await upsert(cardTitle(card), cardDescription(card), status, card.boardItemId, card.path);
|
|
114885
114790
|
if (id)
|
|
114886
114791
|
result.ids[card.path] = id;
|
|
114887
114792
|
}
|
|
@@ -115390,14 +115295,14 @@ function planTouchCommand(dir, page, opts) {
|
|
|
115390
115295
|
}
|
|
115391
115296
|
|
|
115392
115297
|
// src/commands/pr.ts
|
|
115393
|
-
import { existsSync as
|
|
115298
|
+
import { existsSync as existsSync31, readFileSync as readFileSync41, writeFileSync as writeFileSync33 } from "node:fs";
|
|
115394
115299
|
import { join as join46 } from "node:path";
|
|
115395
|
-
import
|
|
115300
|
+
import chalk35 from "chalk";
|
|
115396
115301
|
|
|
115397
115302
|
// src/commands/run.ts
|
|
115398
|
-
import { existsSync as
|
|
115303
|
+
import { existsSync as existsSync30, readFileSync as readFileSync40, unlinkSync as unlinkSync4 } from "node:fs";
|
|
115399
115304
|
import { join as join45 } from "node:path";
|
|
115400
|
-
import
|
|
115305
|
+
import chalk34 from "chalk";
|
|
115401
115306
|
import ora8 from "ora";
|
|
115402
115307
|
|
|
115403
115308
|
// src/diff/score-band.ts
|
|
@@ -115984,70 +115889,6 @@ function formatMs(ms) {
|
|
|
115984
115889
|
return `${min}m${sec.toString().padStart(2, "0")}s`;
|
|
115985
115890
|
}
|
|
115986
115891
|
|
|
115987
|
-
// src/commands/serve.ts
|
|
115988
|
-
import { existsSync as existsSync30 } from "node:fs";
|
|
115989
|
-
import chalk34 from "chalk";
|
|
115990
|
-
async function serveRunAndBlock(runDir, opts = {}) {
|
|
115991
|
-
let handle;
|
|
115992
|
-
try {
|
|
115993
|
-
handle = await startProxyServer(runDir, { port: opts.port });
|
|
115994
|
-
} catch (err) {
|
|
115995
|
-
console.error(chalk34.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
|
|
115996
|
-
return 2;
|
|
115997
|
-
}
|
|
115998
|
-
const label = opts.label ?? "parity serve";
|
|
115999
|
-
console.log("");
|
|
116000
|
-
console.log(chalk34.bold(` ${label}`));
|
|
116001
|
-
console.log(` ${chalk34.green("●")} ${handle.url}`);
|
|
116002
|
-
console.log(chalk34.dim(` Servindo: ${runDir}`));
|
|
116003
|
-
console.log(chalk34.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
|
|
116004
|
-
console.log(chalk34.dim(` Ctrl+C pra parar (2x pra forçar saída).
|
|
116005
|
-
`));
|
|
116006
|
-
if (opts.open !== false) {
|
|
116007
|
-
const { default: open } = await import("open");
|
|
116008
|
-
await open(handle.url).catch(() => {
|
|
116009
|
-
return;
|
|
116010
|
-
});
|
|
116011
|
-
}
|
|
116012
|
-
let shuttingDown = false;
|
|
116013
|
-
const onSignal = () => {
|
|
116014
|
-
if (shuttingDown) {
|
|
116015
|
-
process.stderr.write(`
|
|
116016
|
-
forçando saída.
|
|
116017
|
-
`);
|
|
116018
|
-
process.exit(130);
|
|
116019
|
-
}
|
|
116020
|
-
shuttingDown = true;
|
|
116021
|
-
process.stderr.write(`
|
|
116022
|
-
parando servidor…
|
|
116023
|
-
`);
|
|
116024
|
-
handle.close().catch(() => {
|
|
116025
|
-
return;
|
|
116026
|
-
});
|
|
116027
|
-
setTimeout(() => process.exit(0), 300);
|
|
116028
|
-
};
|
|
116029
|
-
process.on("SIGINT", onSignal);
|
|
116030
|
-
process.on("SIGTERM", onSignal);
|
|
116031
|
-
await new Promise(() => {});
|
|
116032
|
-
return 0;
|
|
116033
|
-
}
|
|
116034
|
-
async function serveCommand(runId, opts) {
|
|
116035
|
-
const paths = getRunPaths(opts.output, runId);
|
|
116036
|
-
if (!existsSync30(paths.runDir)) {
|
|
116037
|
-
console.error(chalk34.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
|
|
116038
|
-
return 1;
|
|
116039
|
-
}
|
|
116040
|
-
if (!existsSync30(paths.reportHtml)) {
|
|
116041
|
-
console.error(chalk34.red(`✖ report.html não existe em ${paths.runDir}`));
|
|
116042
|
-
return 1;
|
|
116043
|
-
}
|
|
116044
|
-
return serveRunAndBlock(paths.runDir, {
|
|
116045
|
-
port: opts.port,
|
|
116046
|
-
open: opts.open,
|
|
116047
|
-
label: `parity serve · ${runId}`
|
|
116048
|
-
});
|
|
116049
|
-
}
|
|
116050
|
-
|
|
116051
115892
|
// src/commands/run.ts
|
|
116052
115893
|
var PRESETS = {
|
|
116053
115894
|
smoke: {
|
|
@@ -116214,14 +116055,14 @@ function readRunChecks(reportPath) {
|
|
|
116214
116055
|
async function runCommand(rawOpts) {
|
|
116215
116056
|
if (!rawOpts.prod) {
|
|
116216
116057
|
const target = rawOpts.cand ?? "<url>";
|
|
116217
|
-
console.error(`${
|
|
116218
|
-
For one site, use: ${
|
|
116058
|
+
console.error(`${chalk34.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
|
|
116059
|
+
For one site, use: ${chalk34.cyan(`parity e2e --url ${target}`)}
|
|
116219
116060
|
(runs the functional flows + all checks in single-site mode — no prod baseline needed).`);
|
|
116220
116061
|
return 2;
|
|
116221
116062
|
}
|
|
116222
116063
|
let opts = applyPreset(rawOpts);
|
|
116223
116064
|
if (rawOpts.preset) {
|
|
116224
|
-
console.log(
|
|
116065
|
+
console.log(chalk34.dim(` preset: ${rawOpts.preset}`));
|
|
116225
116066
|
}
|
|
116226
116067
|
if (opts.pt)
|
|
116227
116068
|
setLlmLanguage("pt");
|
|
@@ -116229,14 +116070,14 @@ async function runCommand(rawOpts) {
|
|
|
116229
116070
|
disableInteractive();
|
|
116230
116071
|
const llmCfgErr = applyLlmOptions(opts);
|
|
116231
116072
|
if (llmCfgErr) {
|
|
116232
|
-
console.error(
|
|
116073
|
+
console.error(chalk34.red(` ${llmCfgErr}`));
|
|
116233
116074
|
return 2;
|
|
116234
116075
|
}
|
|
116235
116076
|
const llmStillAvailable = isLlmAvailable();
|
|
116236
116077
|
const preSmart = opts;
|
|
116237
116078
|
opts = applySmartDefaults(opts, llmStillAvailable);
|
|
116238
116079
|
if (!llmStillAvailable && opts.visualPages !== preSmart.visualPages) {
|
|
116239
|
-
console.log(
|
|
116080
|
+
console.log(chalk34.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
|
|
116240
116081
|
}
|
|
116241
116082
|
let interactivePromptShown = false;
|
|
116242
116083
|
if (!opts.only && !opts.skip && !rawOpts.preset) {
|
|
@@ -116262,14 +116103,14 @@ async function runCommand(rawOpts) {
|
|
|
116262
116103
|
if (isContentProfile && !opts.only && !opts.skip) {
|
|
116263
116104
|
opts.only = "seo,visual,vitals,cache,console,html,network";
|
|
116264
116105
|
moduleDropReason = "profile: content → e2e module dropped (commerce purchase-journey/cart make no sense on a content site); pass --profile commerce to force";
|
|
116265
|
-
console.log(
|
|
116106
|
+
console.log(chalk34.yellow(` INCONCLUSIVE: ${moduleDropReason}`));
|
|
116266
116107
|
}
|
|
116267
116108
|
const selection = resolveSelection({ only: opts.only, skip: opts.skip });
|
|
116268
116109
|
if (selection.errors.length > 0) {
|
|
116269
|
-
console.error(
|
|
116110
|
+
console.error(chalk34.red(" --only/--skip: invalid value(s):"));
|
|
116270
116111
|
for (const e of selection.errors)
|
|
116271
|
-
console.error(
|
|
116272
|
-
console.error(
|
|
116112
|
+
console.error(chalk34.red(` - ${e}`));
|
|
116113
|
+
console.error(chalk34.dim(`
|
|
116273
116114
|
valid modules: ${Object.keys(MODULES).join(", ")}`));
|
|
116274
116115
|
return 2;
|
|
116275
116116
|
}
|
|
@@ -116281,14 +116122,14 @@ async function runCommand(rawOpts) {
|
|
|
116281
116122
|
const explicitFlows = userSetFlows ? opts.flows.split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
116282
116123
|
const scoped = resolveScopedFlows({ explicitFlows, selectionFlows: selection.flows });
|
|
116283
116124
|
flows = scoped.flows;
|
|
116284
|
-
console.log(
|
|
116125
|
+
console.log(chalk34.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows.join(",")}${explicitFlows.length > 0 ? " (scoped by --flows)" : ""}`));
|
|
116285
116126
|
if (scoped.starved.length > 0) {
|
|
116286
|
-
console.log(
|
|
116127
|
+
console.log(chalk34.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
|
|
116287
116128
|
}
|
|
116288
116129
|
} else {
|
|
116289
116130
|
flows = opts.flows.split(",").map((s) => s.trim());
|
|
116290
116131
|
if (!interactivePromptShown) {
|
|
116291
|
-
console.log(
|
|
116132
|
+
console.log(chalk34.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
|
|
116292
116133
|
}
|
|
116293
116134
|
}
|
|
116294
116135
|
if (isContentProfile) {
|
|
@@ -116297,16 +116138,16 @@ async function runCommand(rawOpts) {
|
|
|
116297
116138
|
if (!flows.includes("homepage"))
|
|
116298
116139
|
flows.unshift("homepage");
|
|
116299
116140
|
if (before !== flows.join(",")) {
|
|
116300
|
-
console.log(
|
|
116141
|
+
console.log(chalk34.dim(` profile: content → flows scoped to ${flows.join(",")} (dropped plp/pdp; was: ${before}); CEP skipped`));
|
|
116301
116142
|
}
|
|
116302
116143
|
}
|
|
116303
116144
|
const pagesScopeWarning = pagesFlowsScopeWarning(opts, flows);
|
|
116304
116145
|
if (pagesScopeWarning) {
|
|
116305
|
-
console.log(
|
|
116146
|
+
console.log(chalk34.dim(` ${pagesScopeWarning}`));
|
|
116306
116147
|
}
|
|
116307
116148
|
if (hasSelection) {
|
|
116308
116149
|
for (const note of applySelectionDefaults(opts, selection.modules)) {
|
|
116309
|
-
console.log(
|
|
116150
|
+
console.log(chalk34.dim(` ${note}`));
|
|
116310
116151
|
}
|
|
116311
116152
|
}
|
|
116312
116153
|
const viewports = opts.viewports.split(",").map((s) => s.trim());
|
|
@@ -116320,37 +116161,37 @@ async function runCommand(rawOpts) {
|
|
|
116320
116161
|
const ignore = loadParityIgnore();
|
|
116321
116162
|
if (opts.clearCache) {
|
|
116322
116163
|
const cacheFile = join45(opts.output, "cache", "verdicts.json");
|
|
116323
|
-
if (
|
|
116164
|
+
if (existsSync30(cacheFile)) {
|
|
116324
116165
|
try {
|
|
116325
116166
|
unlinkSync4(cacheFile);
|
|
116326
|
-
console.log(
|
|
116167
|
+
console.log(chalk34.dim(` cache wiped: ${cacheFile}`));
|
|
116327
116168
|
} catch (err) {
|
|
116328
|
-
console.log(
|
|
116169
|
+
console.log(chalk34.yellow(` cache wipe falhou: ${err.message}`));
|
|
116329
116170
|
}
|
|
116330
116171
|
}
|
|
116331
116172
|
}
|
|
116332
116173
|
const llmTimeoutRaw = opts.llmTimeout ?? 60;
|
|
116333
116174
|
if (!Number.isFinite(llmTimeoutRaw)) {
|
|
116334
|
-
console.error(
|
|
116175
|
+
console.error(chalk34.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
|
|
116335
116176
|
return 2;
|
|
116336
116177
|
}
|
|
116337
116178
|
const llmTimeoutSec = Math.max(5, Math.floor(llmTimeoutRaw));
|
|
116338
116179
|
if (isLlmAvailable()) {
|
|
116339
|
-
console.log(
|
|
116180
|
+
console.log(chalk34.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
|
|
116340
116181
|
} else {
|
|
116341
|
-
console.log(
|
|
116182
|
+
console.log(chalk34.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
|
|
116342
116183
|
}
|
|
116343
116184
|
if (isInteractiveMode()) {
|
|
116344
|
-
console.log(
|
|
116185
|
+
console.log(chalk34.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
|
|
116345
116186
|
}
|
|
116346
116187
|
const primaryViewport = viewports[0] ?? "mobile";
|
|
116347
116188
|
const preflight = await preflightCheck(opts.prod, opts.cand, primaryViewport);
|
|
116348
116189
|
if (!preflight.ok) {
|
|
116349
|
-
console.error(
|
|
116190
|
+
console.error(chalk34.red(`
|
|
116350
116191
|
✖ pre-flight falhou:`));
|
|
116351
116192
|
for (const err of preflight.errors)
|
|
116352
|
-
console.error(
|
|
116353
|
-
console.error(
|
|
116193
|
+
console.error(chalk34.red(` - ${err}`));
|
|
116194
|
+
console.error(chalk34.dim(`
|
|
116354
116195
|
dica: verifique se as URLs estão corretas e acessíveis`));
|
|
116355
116196
|
return 2;
|
|
116356
116197
|
}
|
|
@@ -116361,7 +116202,7 @@ async function runCommand(rawOpts) {
|
|
|
116361
116202
|
if (prodHomeHtml) {
|
|
116362
116203
|
platform = detectPlatform({ url: opts.prod, html: prodHomeHtml });
|
|
116363
116204
|
if (platform !== "custom") {
|
|
116364
|
-
console.log(
|
|
116205
|
+
console.log(chalk34.dim(` Detected platform: ${platform}`));
|
|
116365
116206
|
}
|
|
116366
116207
|
}
|
|
116367
116208
|
const prodHost = hostOf3(opts.prod);
|
|
@@ -116396,11 +116237,11 @@ async function runCommand(rawOpts) {
|
|
|
116396
116237
|
viewports,
|
|
116397
116238
|
timestamp
|
|
116398
116239
|
});
|
|
116399
|
-
console.log(
|
|
116240
|
+
console.log(chalk34.bold(`
|
|
116400
116241
|
parity run ${runId}`));
|
|
116401
|
-
console.log(
|
|
116402
|
-
console.log(
|
|
116403
|
-
console.log(
|
|
116242
|
+
console.log(chalk34.dim(` prod: ${opts.prod}`));
|
|
116243
|
+
console.log(chalk34.dim(` cand: ${opts.cand}`));
|
|
116244
|
+
console.log(chalk34.dim(` profile: ${profile} · flows: ${flows.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
|
|
116404
116245
|
`));
|
|
116405
116246
|
const spinner = ora8("Launching browser…").start();
|
|
116406
116247
|
let browser = null;
|
|
@@ -116412,7 +116253,7 @@ async function runCommand(rawOpts) {
|
|
|
116412
116253
|
const min = Math.floor(elapsedSec / 60);
|
|
116413
116254
|
const sec = elapsedSec % 60;
|
|
116414
116255
|
const mmss = `${min.toString().padStart(2, "0")}:${sec.toString().padStart(2, "0")}`;
|
|
116415
|
-
spinner.text = `${
|
|
116256
|
+
spinner.text = `${chalk34.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
|
|
116416
116257
|
};
|
|
116417
116258
|
const setSpinnerLabel = (label) => {
|
|
116418
116259
|
currentSpinnerLabel = label;
|
|
@@ -116532,8 +116373,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
116532
116373
|
for (const flow of flows) {
|
|
116533
116374
|
const flowStart = Date.now();
|
|
116534
116375
|
let lastStepTotal = 0;
|
|
116535
|
-
const sideTag = side === "prod" ?
|
|
116536
|
-
const prefix = `${
|
|
116376
|
+
const sideTag = side === "prod" ? chalk34.cyan("prod") : chalk34.magenta("cand");
|
|
116377
|
+
const prefix = `${chalk34.dim(`[${viewport}/`)}${sideTag}${chalk34.dim("]")}`;
|
|
116537
116378
|
setSpinnerLabel(`${prefix} ${flow}: starting…`);
|
|
116538
116379
|
const cap = await runFlow(flow, {
|
|
116539
116380
|
baseUrl,
|
|
@@ -116550,7 +116391,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
116550
116391
|
onStep: (event) => {
|
|
116551
116392
|
if (event.phase === "start") {
|
|
116552
116393
|
lastStepTotal = event.total;
|
|
116553
|
-
setSpinnerLabel(`${prefix} ${flow} ${
|
|
116394
|
+
setSpinnerLabel(`${prefix} ${flow} ${chalk34.dim(`${event.index}/${event.total}`)} ${event.name}…`);
|
|
116554
116395
|
}
|
|
116555
116396
|
}
|
|
116556
116397
|
});
|
|
@@ -116559,18 +116400,18 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
116559
116400
|
const target = lastStepTotal || recorded;
|
|
116560
116401
|
const failed = cap.steps?.find((s) => s.status === "failed");
|
|
116561
116402
|
const lastStep = cap.steps?.[cap.steps.length - 1];
|
|
116562
|
-
const elapsedDim =
|
|
116563
|
-
const counts = target > 0 ?
|
|
116403
|
+
const elapsedDim = chalk34.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
|
|
116404
|
+
const counts = target > 0 ? chalk34.dim(`${okSteps}/${target}`) : "";
|
|
116564
116405
|
let glyph;
|
|
116565
116406
|
let detail;
|
|
116566
116407
|
if (failed) {
|
|
116567
|
-
glyph =
|
|
116568
|
-
detail = `stopped at ${
|
|
116408
|
+
glyph = chalk34.red("✗");
|
|
116409
|
+
detail = `stopped at ${chalk34.yellow(failed.name)}`;
|
|
116569
116410
|
} else if (target > 0 && okSteps < target) {
|
|
116570
|
-
glyph =
|
|
116571
|
-
detail = lastStep ? `ended at ${
|
|
116411
|
+
glyph = chalk34.yellow("▴");
|
|
116412
|
+
detail = lastStep ? `ended at ${chalk34.dim(lastStep.name)}` : "incomplete";
|
|
116572
116413
|
} else {
|
|
116573
|
-
glyph =
|
|
116414
|
+
glyph = chalk34.green("✓");
|
|
116574
116415
|
detail = "";
|
|
116575
116416
|
}
|
|
116576
116417
|
const summary = `${glyph} ${prefix} ${flow} ${counts} ${detail} ${elapsedDim}`.replace(/\s+/g, " ").trim();
|
|
@@ -116632,7 +116473,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
116632
116473
|
const vitalsPagesLimit = opts.vitalsPages ?? vitalsPagesDefault;
|
|
116633
116474
|
const vitalsRuns = Math.max(1, Number.parseInt(opts.runs, 10) || 1);
|
|
116634
116475
|
if (candIsDevServer && vitalsPagesLimit > 0) {
|
|
116635
|
-
console.log(
|
|
116476
|
+
console.log(chalk34.dim(` cand=localhost detectado — vitals-pages=${vitalsPagesLimit}, networkidle desabilitado (issue #55)`));
|
|
116636
116477
|
}
|
|
116637
116478
|
if (browser && vitalsPagesLimit > 0) {
|
|
116638
116479
|
currentPhase = "vitals-pages";
|
|
@@ -117010,23 +116851,20 @@ ${formatTimingsSummary(runTimings, buildFlowBreakdown(allFlowCaptures))}`);
|
|
|
117010
116851
|
${formatPagePairTable(pagePairs)}`);
|
|
117011
116852
|
const missed = pagePairs.filter((p) => !p.match).length;
|
|
117012
116853
|
if (missed > 0) {
|
|
117013
|
-
console.log(
|
|
116854
|
+
console.log(chalk34.red(`
|
|
117014
116855
|
✖ ${missed}/${pagePairs.length} requested page pair(s) were not measured as requested — this report describes other pages; fix the URLs or the capture`));
|
|
117015
116856
|
}
|
|
117016
116857
|
}
|
|
117017
116858
|
const failOnGate = evaluateFailOnGate(remainingIssues, failOn, verdict.status);
|
|
117018
116859
|
if (failOnGate.exitCode === 1) {
|
|
117019
|
-
console.log(
|
|
116860
|
+
console.log(chalk34.red(failOnGate.message));
|
|
117020
116861
|
return 1;
|
|
117021
116862
|
}
|
|
117022
116863
|
if (opts.open) {
|
|
117023
|
-
|
|
117024
|
-
|
|
117025
|
-
|
|
117026
|
-
|
|
117027
|
-
browser = null;
|
|
117028
|
-
}
|
|
117029
|
-
return await serveRunAndBlock(paths.runDir, { label: `parity run · ${runId}` });
|
|
116864
|
+
const { default: open } = await import("open");
|
|
116865
|
+
await open(paths.reportHtml).catch(() => {
|
|
116866
|
+
return;
|
|
116867
|
+
});
|
|
117030
116868
|
}
|
|
117031
116869
|
return 0;
|
|
117032
116870
|
} catch (err) {
|
|
@@ -117086,7 +116924,7 @@ function parsePagePair(entry) {
|
|
|
117086
116924
|
}
|
|
117087
116925
|
function resolveExplicitPages(pagesFile, pagesList) {
|
|
117088
116926
|
if (pagesFile) {
|
|
117089
|
-
if (!
|
|
116927
|
+
if (!existsSync30(pagesFile)) {
|
|
117090
116928
|
throw new Error(`--pages-file não encontrado: ${pagesFile}`);
|
|
117091
116929
|
}
|
|
117092
116930
|
const raw = readFileSync40(pagesFile, "utf-8");
|
|
@@ -117307,10 +117145,10 @@ function hostOf3(url) {
|
|
|
117307
117145
|
function printSummary8(run, htmlPath, meta) {
|
|
117308
117146
|
const { verdict } = run;
|
|
117309
117147
|
const inconclusive = verdict.status === "inconclusive";
|
|
117310
|
-
const emoji = inconclusive ?
|
|
117311
|
-
const score = inconclusive ?
|
|
117148
|
+
const emoji = inconclusive ? chalk34.dim("○") : verdict.status === "pass" ? chalk34.green("✔") : verdict.status === "warn" ? chalk34.yellow("⚠") : chalk34.red("✖");
|
|
117149
|
+
const score = inconclusive ? chalk34.dim("—") : verdict.status === "pass" ? chalk34.green(verdict.score) : verdict.status === "warn" ? chalk34.yellow(verdict.score) : chalk34.red(verdict.score);
|
|
117312
117150
|
const prev = run.previousRun;
|
|
117313
|
-
const scoreDelta = !prev ?
|
|
117151
|
+
const scoreDelta = !prev ? chalk34.dim(" (sem run anterior comparável)") : prev.scoreDelta > 0 ? chalk34.green(` (+${prev.scoreDelta} vs run anterior: ${prev.score})`) : prev.scoreDelta < 0 ? chalk34.red(` (${prev.scoreDelta} vs run anterior: ${prev.score})`) : chalk34.dim(` (= run anterior: ${prev.score})`);
|
|
117314
117152
|
console.log("");
|
|
117315
117153
|
if (inconclusive) {
|
|
117316
117154
|
const why = run.pagePairs?.some((p) => !p.match) ? "the requested --pages were not measured (table below)" : "nothing was measured (0 checks ran)";
|
|
@@ -117320,52 +117158,52 @@ function printSummary8(run, htmlPath, meta) {
|
|
|
117320
117158
|
console.log(` ${emoji} parity ${verdict.status.toUpperCase()} · score ${score}/100${accepted}${scoreDelta}`);
|
|
117321
117159
|
}
|
|
117322
117160
|
for (const e of run.acceptedFindings?.stale ?? []) {
|
|
117323
|
-
console.log(` ${
|
|
117161
|
+
console.log(` ${chalk34.yellow("⚠")} stale acceptance (matched nothing — \`parity accept remove\`): ${[e.check, e.id, e.page, e.match].filter(Boolean).join(" · ")} — ${e.note}`);
|
|
117324
117162
|
}
|
|
117325
|
-
console.log(` checks: ${
|
|
117326
|
-
console.log(` issues: ${
|
|
117163
|
+
console.log(` checks: ${chalk34.green(verdict.checksPassed)} pass · ${chalk34.red(verdict.checksFailed)} fail · ${chalk34.dim(`${verdict.checksSkipped} skipped`)}`);
|
|
117164
|
+
console.log(` issues: ${chalk34.red(verdict.critical)} critical · ${chalk34.yellow(verdict.high)} high · ${verdict.medium} medium · ${chalk34.dim(`${verdict.low} low`)}`);
|
|
117327
117165
|
const band = run.scoreBand;
|
|
117328
117166
|
const bandLine = band ? formatScoreBand(band) : null;
|
|
117329
117167
|
if (band && bandLine) {
|
|
117330
|
-
console.log(` ${
|
|
117168
|
+
console.log(` ${chalk34.dim(bandLine)}`);
|
|
117331
117169
|
const caveat = scoreBandCaveat(band);
|
|
117332
117170
|
if (caveat)
|
|
117333
|
-
console.log(` ${
|
|
117171
|
+
console.log(` ${chalk34.yellow("⚠")} ${caveat}`);
|
|
117334
117172
|
}
|
|
117335
117173
|
for (const c of run.caveats ?? []) {
|
|
117336
|
-
const mark = c.level === "warn" ?
|
|
117174
|
+
const mark = c.level === "warn" ? chalk34.yellow("⚠") : chalk34.dim("ℹ");
|
|
117337
117175
|
console.log(` ${mark} ${c.summary}`);
|
|
117338
117176
|
}
|
|
117339
117177
|
if (run.moduleVerdicts && run.moduleVerdicts.length > 0) {
|
|
117340
117178
|
const perModule = run.moduleVerdicts.map((mv) => {
|
|
117341
|
-
const colored = mv.status === "pass" ?
|
|
117179
|
+
const colored = mv.status === "pass" ? chalk34.green(mv.score) : mv.status === "warn" ? chalk34.yellow(mv.score) : chalk34.red(mv.score);
|
|
117342
117180
|
return `${mv.module} ${colored}`;
|
|
117343
117181
|
}).join(" · ");
|
|
117344
117182
|
console.log(` modules: ${perModule} → composite ${score}`);
|
|
117345
117183
|
}
|
|
117346
117184
|
if (run.visualDiff) {
|
|
117347
117185
|
const vd = run.visualDiff;
|
|
117348
|
-
const parityIcon = vd.parityOk ?
|
|
117349
|
-
const parityLabel = vd.parityOk ?
|
|
117350
|
-
const cacheNote = vd.pagesFromCache > 0 ?
|
|
117351
|
-
console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${
|
|
117186
|
+
const parityIcon = vd.parityOk ? chalk34.green("✔") : chalk34.red("✖");
|
|
117187
|
+
const parityLabel = vd.parityOk ? chalk34.green("OK") : chalk34.red("DIFFS");
|
|
117188
|
+
const cacheNote = vd.pagesFromCache > 0 ? chalk34.dim(` · ${vd.pagesFromCache} cached`) : "";
|
|
117189
|
+
console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk34.red(vd.pagesWithDiffs)} diffs · ${chalk34.green(vd.pagesPassed)} pass${cacheNote}`);
|
|
117352
117190
|
}
|
|
117353
117191
|
if (run.topIssues.length > 0) {
|
|
117354
117192
|
console.log("");
|
|
117355
|
-
console.log(
|
|
117193
|
+
console.log(chalk34.bold(" Top issues:"));
|
|
117356
117194
|
for (const g of groupIssues(run.topIssues).slice(0, 5)) {
|
|
117357
117195
|
const i = g.sample;
|
|
117358
|
-
const sev = i.severity === "critical" ?
|
|
117359
|
-
const pagesNote = g.pages.length > 1 ?
|
|
117196
|
+
const sev = i.severity === "critical" ? chalk34.red(`[${i.severity}]`) : i.severity === "high" ? chalk34.yellow(`[${i.severity}]`) : chalk34.dim(`[${i.severity}]`);
|
|
117197
|
+
const pagesNote = g.pages.length > 1 ? chalk34.dim(` (${g.pages.length} páginas)`) : "";
|
|
117360
117198
|
console.log(` ${sev} ${i.summary}${pagesNote}`);
|
|
117361
117199
|
}
|
|
117362
117200
|
}
|
|
117363
117201
|
if (meta.promotedCount > 0 || meta.deprecatedCount > 0) {
|
|
117364
117202
|
console.log("");
|
|
117365
|
-
console.log(
|
|
117203
|
+
console.log(chalk34.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk34.green(`+${meta.promotedCount}`)} promoted · ${chalk34.yellow(meta.deprecatedCount)} deprecated`));
|
|
117366
117204
|
}
|
|
117367
117205
|
console.log("");
|
|
117368
|
-
console.log(
|
|
117206
|
+
console.log(chalk34.dim(` → ${htmlPath}`));
|
|
117369
117207
|
console.log("");
|
|
117370
117208
|
}
|
|
117371
117209
|
|
|
@@ -117389,26 +117227,26 @@ async function prCommand(opts) {
|
|
|
117389
117227
|
preset: opts.preset ?? "ci",
|
|
117390
117228
|
open: false
|
|
117391
117229
|
};
|
|
117392
|
-
console.log(
|
|
117393
|
-
console.log(
|
|
117230
|
+
console.log(chalk35.dim(` prod : ${opts.prod}`));
|
|
117231
|
+
console.log(chalk35.dim(` preview : ${opts.preview}`));
|
|
117394
117232
|
console.log("");
|
|
117395
117233
|
const runCode = await runCommand(runOpts);
|
|
117396
117234
|
const runs = listRuns(opts.output);
|
|
117397
117235
|
if (runs.length === 0) {
|
|
117398
|
-
console.error(
|
|
117236
|
+
console.error(chalk35.red("no run was produced — cannot build PR comment"));
|
|
117399
117237
|
return runCode || 1;
|
|
117400
117238
|
}
|
|
117401
117239
|
const latest = runs[0];
|
|
117402
117240
|
const reportJsonPath = join46(opts.output, "runs", latest.id, "report.json");
|
|
117403
|
-
if (!
|
|
117404
|
-
console.error(
|
|
117241
|
+
if (!existsSync31(reportJsonPath)) {
|
|
117242
|
+
console.error(chalk35.red(`report.json not found at ${reportJsonPath}`));
|
|
117405
117243
|
return runCode || 1;
|
|
117406
117244
|
}
|
|
117407
117245
|
const run = JSON.parse(readFileSync41(reportJsonPath, "utf8"));
|
|
117408
117246
|
const markdown = buildPrComment(run, opts);
|
|
117409
117247
|
if (opts.out) {
|
|
117410
117248
|
writeFileSync33(opts.out, markdown, "utf8");
|
|
117411
|
-
console.log(
|
|
117249
|
+
console.log(chalk35.dim(` wrote PR comment: ${opts.out}`));
|
|
117412
117250
|
} else {
|
|
117413
117251
|
process.stdout.write(`
|
|
117414
117252
|
${markdown}
|
|
@@ -117418,7 +117256,7 @@ ${markdown}
|
|
|
117418
117256
|
try {
|
|
117419
117257
|
writeFileSync33(process.env.GITHUB_STEP_SUMMARY, markdown, { flag: "a" });
|
|
117420
117258
|
} catch (err) {
|
|
117421
|
-
console.error(
|
|
117259
|
+
console.error(chalk35.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
|
|
117422
117260
|
}
|
|
117423
117261
|
}
|
|
117424
117262
|
return runCode;
|
|
@@ -117478,14 +117316,14 @@ function buildPrComment(run, opts) {
|
|
|
117478
117316
|
}
|
|
117479
117317
|
|
|
117480
117318
|
// src/commands/prompt.ts
|
|
117481
|
-
import { existsSync as
|
|
117482
|
-
import
|
|
117319
|
+
import { existsSync as existsSync32, writeFileSync as writeFileSync34 } from "node:fs";
|
|
117320
|
+
import chalk36 from "chalk";
|
|
117483
117321
|
function promptCommand(runId, opts) {
|
|
117484
117322
|
let run;
|
|
117485
117323
|
try {
|
|
117486
117324
|
run = loadRun(opts.output, runId);
|
|
117487
117325
|
} catch (err) {
|
|
117488
|
-
console.error(
|
|
117326
|
+
console.error(chalk36.red(`✖ ${err.message}`));
|
|
117489
117327
|
return 1;
|
|
117490
117328
|
}
|
|
117491
117329
|
const md = buildLlmPrompt(run, {
|
|
@@ -117494,10 +117332,10 @@ function promptCommand(runId, opts) {
|
|
|
117494
117332
|
});
|
|
117495
117333
|
if (opts.out) {
|
|
117496
117334
|
writeFileSync34(opts.out, md, "utf8");
|
|
117497
|
-
console.log(
|
|
117498
|
-
if (
|
|
117335
|
+
console.log(chalk36.green(`✔ prompt salvo em ${opts.out}`));
|
|
117336
|
+
if (existsSync32(opts.out)) {
|
|
117499
117337
|
const sizeKb = (md.length / 1024).toFixed(1);
|
|
117500
|
-
console.log(
|
|
117338
|
+
console.log(chalk36.dim(` ${md.length} chars (${sizeKb} KB)`));
|
|
117501
117339
|
}
|
|
117502
117340
|
} else {
|
|
117503
117341
|
process.stdout.write(md);
|
|
@@ -117506,12 +117344,12 @@ function promptCommand(runId, opts) {
|
|
|
117506
117344
|
}
|
|
117507
117345
|
|
|
117508
117346
|
// src/commands/qa.ts
|
|
117509
|
-
import { existsSync as
|
|
117347
|
+
import { existsSync as existsSync36, readFileSync as readFileSync44 } from "node:fs";
|
|
117510
117348
|
import { basename as basename6, dirname as dirname10, join as join50 } from "node:path";
|
|
117511
|
-
import
|
|
117349
|
+
import chalk38 from "chalk";
|
|
117512
117350
|
|
|
117513
117351
|
// src/board/sweep-cards.ts
|
|
117514
|
-
import { existsSync as
|
|
117352
|
+
import { existsSync as existsSync33, readFileSync as readFileSync42 } from "node:fs";
|
|
117515
117353
|
var QA_PREFIX = "[QA]";
|
|
117516
117354
|
var CARD_BODY_MAX = 1200;
|
|
117517
117355
|
var CLOSED = new Set(["done", "archived", "merged"]);
|
|
@@ -117838,7 +117676,7 @@ function readSpecs(entries) {
|
|
|
117838
117676
|
const out = {};
|
|
117839
117677
|
for (const e of entries)
|
|
117840
117678
|
for (const ev of e.issue?.evidence ?? [])
|
|
117841
|
-
if (ev.kind === "spec" &&
|
|
117679
|
+
if (ev.kind === "spec" && existsSync33(ev.path))
|
|
117842
117680
|
out[ev.path] = readFileSync42(ev.path, "utf8");
|
|
117843
117681
|
return out;
|
|
117844
117682
|
}
|
|
@@ -117863,7 +117701,7 @@ function plannedEvidenceUrls(entries, run, cfg) {
|
|
|
117863
117701
|
return {};
|
|
117864
117702
|
const out = {};
|
|
117865
117703
|
for (const p of cardEvidencePaths(entries))
|
|
117866
|
-
if (
|
|
117704
|
+
if (existsSync33(p))
|
|
117867
117705
|
out[p] = `${base}/fs/org/read?path=${encodeURIComponent(evidenceLibraryPath(p, run))}`;
|
|
117868
117706
|
return out;
|
|
117869
117707
|
}
|
|
@@ -117871,7 +117709,7 @@ async function uploadEvidence(entries, run, cfg, call, opts) {
|
|
|
117871
117709
|
const upload = opts.upload ?? ((local, lib) => uploadToLibrary(cfg, local, lib, call));
|
|
117872
117710
|
const out = {};
|
|
117873
117711
|
for (const p of cardEvidencePaths(entries)) {
|
|
117874
|
-
if (!
|
|
117712
|
+
if (!existsSync33(p))
|
|
117875
117713
|
continue;
|
|
117876
117714
|
const url = await upload(p, evidenceLibraryPath(p, run));
|
|
117877
117715
|
if (url)
|
|
@@ -117887,9 +117725,9 @@ function truncate6(s, n) {
|
|
|
117887
117725
|
}
|
|
117888
117726
|
|
|
117889
117727
|
// src/commands/sweep.ts
|
|
117890
|
-
import { existsSync as
|
|
117728
|
+
import { existsSync as existsSync35, readFileSync as readFileSync43, writeFileSync as writeFileSync35 } from "node:fs";
|
|
117891
117729
|
import { join as join49 } from "node:path";
|
|
117892
|
-
import
|
|
117730
|
+
import chalk37 from "chalk";
|
|
117893
117731
|
import { z as z4 } from "zod";
|
|
117894
117732
|
|
|
117895
117733
|
// ../../node_modules/.bun/@axe-core+playwright@4.14.0+61592b2670ac03c8/node_modules/@axe-core/playwright/dist/index.mjs
|
|
@@ -118452,13 +118290,13 @@ function menuLinkIssues(visits) {
|
|
|
118452
118290
|
|
|
118453
118291
|
// src/engine/regression-specs.ts
|
|
118454
118292
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
118455
|
-
import { existsSync as
|
|
118293
|
+
import { existsSync as existsSync34 } from "node:fs";
|
|
118456
118294
|
import { join as join48, resolve as resolve20 } from "node:path";
|
|
118457
118295
|
import { stripVTControlCharacters } from "node:util";
|
|
118458
118296
|
function runRegressionSpecs(repoDirArg, baseUrl) {
|
|
118459
118297
|
const repoDir = resolve20(repoDirArg);
|
|
118460
118298
|
const dir = join48(repoDir, "tests", "qa");
|
|
118461
|
-
if (!
|
|
118299
|
+
if (!existsSync34(dir))
|
|
118462
118300
|
return null;
|
|
118463
118301
|
spawnSync2("npx", ["playwright", "install", "chromium"], {
|
|
118464
118302
|
cwd: repoDir,
|
|
@@ -118466,7 +118304,7 @@ function runRegressionSpecs(repoDirArg, baseUrl) {
|
|
|
118466
118304
|
timeout: 10 * 60000
|
|
118467
118305
|
});
|
|
118468
118306
|
const config = join48(dir, "playwright.config.ts");
|
|
118469
|
-
const args =
|
|
118307
|
+
const args = existsSync34(config) ? ["playwright", "test", "-c", config, "--reporter=json"] : ["playwright", "test", "tests/qa", "--reporter=json"];
|
|
118470
118308
|
const res = spawnSync2("npx", args, {
|
|
118471
118309
|
cwd: repoDir,
|
|
118472
118310
|
env: { ...process.env, BASE_URL: baseUrl, CI: "1" },
|
|
@@ -118608,16 +118446,16 @@ async function sweepCommand(opts) {
|
|
|
118608
118446
|
const trend = annotateTrend(opts.output, done.runId);
|
|
118609
118447
|
if (!opts.json) {
|
|
118610
118448
|
if (trend) {
|
|
118611
|
-
console.log(
|
|
118449
|
+
console.log(chalk37.dim(` trend vs ${trend.previousRunId}: ${trend.new} new · ${trend.recurring} recurring · ${trend.resolved} resolved`));
|
|
118612
118450
|
} else {
|
|
118613
|
-
console.log(
|
|
118451
|
+
console.log(chalk37.dim(" trend: first sweep of this host"));
|
|
118614
118452
|
}
|
|
118615
118453
|
const missed = missedFloors(readReport(done.reportJson) ?? { flowCaptures: [] });
|
|
118616
118454
|
if (missed.length)
|
|
118617
|
-
console.log(
|
|
118455
|
+
console.log(chalk37.yellow(` não alcançado (${missed.length}): ${missed.join(", ")}`));
|
|
118618
118456
|
const unverified = readUnverified(done.reportJson);
|
|
118619
118457
|
if (unverified.length) {
|
|
118620
|
-
console.log(
|
|
118458
|
+
console.log(chalk37.yellow(` não verificado (${unverified.length}): ${unverified.slice(0, 8).join(", ")}${unverified.length > 8 ? "…" : ""}`));
|
|
118621
118459
|
}
|
|
118622
118460
|
}
|
|
118623
118461
|
if (opts.board) {
|
|
@@ -118731,7 +118569,7 @@ async function addProbeFindings(url, runDir, reportJson, rc, json, specsRepo) {
|
|
|
118731
118569
|
`, "utf8");
|
|
118732
118570
|
if (!json) {
|
|
118733
118571
|
for (const i of issues)
|
|
118734
|
-
console.log(
|
|
118572
|
+
console.log(chalk37[i.inconclusive ? "yellow" : "red"](` ${i.summary}`));
|
|
118735
118573
|
}
|
|
118736
118574
|
}
|
|
118737
118575
|
function missedFloors(report) {
|
|
@@ -118764,7 +118602,7 @@ var SEVERITIES = ["critical", "high", "medium", "low"];
|
|
|
118764
118602
|
var SWEEPER_ISSUES_FILE = "sweeper-issues.json";
|
|
118765
118603
|
function readSweeperIssues(runDir) {
|
|
118766
118604
|
const path = join49(runDir, SWEEPER_ISSUES_FILE);
|
|
118767
|
-
if (!
|
|
118605
|
+
if (!existsSync35(path))
|
|
118768
118606
|
return { issues: [], dropped: new Set };
|
|
118769
118607
|
const parsed = z4.object({
|
|
118770
118608
|
issues: agentIssues,
|
|
@@ -118792,7 +118630,7 @@ function normalizeAgentIssue(raw) {
|
|
|
118792
118630
|
var agentIssues = z4.preprocess((v) => Array.isArray(v) ? v.map(normalizeAgentIssue) : v, z4.array(Issue).default([]));
|
|
118793
118631
|
function readCardReview(runDir) {
|
|
118794
118632
|
const path = join49(runDir, CARD_REVIEW_FILE);
|
|
118795
|
-
if (!
|
|
118633
|
+
if (!existsSync35(path))
|
|
118796
118634
|
return { issues: [], hold: new Map };
|
|
118797
118635
|
const parsed = z4.object({
|
|
118798
118636
|
issues: agentIssues,
|
|
@@ -118826,28 +118664,28 @@ function mergeIssues(report, agent, dropped) {
|
|
|
118826
118664
|
}
|
|
118827
118665
|
async function sweepFileCommand(opts) {
|
|
118828
118666
|
if ((opts.board ?? "studio") !== "studio") {
|
|
118829
|
-
console.error(
|
|
118667
|
+
console.error(chalk37.red(`--board ${opts.board}: only "studio" is supported`));
|
|
118830
118668
|
return 2;
|
|
118831
118669
|
}
|
|
118832
118670
|
const minSeverity = opts.minSeverity ?? "medium";
|
|
118833
118671
|
if (!SEVERITIES.includes(minSeverity)) {
|
|
118834
|
-
console.error(
|
|
118672
|
+
console.error(chalk37.red(`--min-severity ${opts.minSeverity}: use ${SEVERITIES.join("|")}`));
|
|
118835
118673
|
return 2;
|
|
118836
118674
|
}
|
|
118837
118675
|
const runId = opts.run ?? listRuns(opts.output).find((r) => readReport(r.reportPath)?.mode === "sweep")?.id;
|
|
118838
118676
|
if (!runId) {
|
|
118839
|
-
console.error(
|
|
118677
|
+
console.error(chalk37.red(`no sweep run in ${opts.output} — run \`parity sweep --url …\` first`));
|
|
118840
118678
|
return 2;
|
|
118841
118679
|
}
|
|
118842
118680
|
const paths = getRunPaths(opts.output, runId);
|
|
118843
118681
|
const report = readReport(paths.reportJson);
|
|
118844
118682
|
if (!report || report.mode !== "sweep") {
|
|
118845
|
-
console.error(
|
|
118683
|
+
console.error(chalk37.red(`${runId} is not a sweep run`));
|
|
118846
118684
|
return 2;
|
|
118847
118685
|
}
|
|
118848
118686
|
const cfg = studioConfigFromEnv();
|
|
118849
118687
|
if (!cfg) {
|
|
118850
|
-
console.error(
|
|
118688
|
+
console.error(chalk37.red(`Studio not configured — ${STUDIO_LOGIN_HINT}; org via PARITY_STUDIO_ORG or PARITY_STUDIO_URL.`));
|
|
118851
118689
|
return 2;
|
|
118852
118690
|
}
|
|
118853
118691
|
const agent = readSweeperIssues(paths.runDir);
|
|
@@ -118893,7 +118731,7 @@ async function sweepFileCommand(opts) {
|
|
|
118893
118731
|
allowAutomation: opts.allowAutomation
|
|
118894
118732
|
});
|
|
118895
118733
|
} catch (err) {
|
|
118896
|
-
console.error(
|
|
118734
|
+
console.error(chalk37.red(err instanceof Error ? err.message : String(err)));
|
|
118897
118735
|
return 1;
|
|
118898
118736
|
}
|
|
118899
118737
|
if (opts.json) {
|
|
@@ -118910,14 +118748,14 @@ async function sweepFileCommand(opts) {
|
|
|
118910
118748
|
}));
|
|
118911
118749
|
return 0;
|
|
118912
118750
|
}
|
|
118913
|
-
const head = opts.yes ?
|
|
118751
|
+
const head = opts.yes ? chalk37.bold(" filed on the Studio board") : chalk37.bold(" dry run — add --yes to file");
|
|
118914
118752
|
console.log(`
|
|
118915
118753
|
${head} (run ${runId}, ≥ ${minSeverity}${agent.issues.length ? `, +${agent.issues.length} from sweeper` : ""})`);
|
|
118916
118754
|
for (const e of result.entries) {
|
|
118917
|
-
const tag = e.action === "create" ?
|
|
118755
|
+
const tag = e.action === "create" ? chalk37.green("create ") : e.action === "update" ? chalk37.yellow("update ") : e.action === "regression" ? chalk37.red("regress") : chalk37.dim("skip ");
|
|
118918
118756
|
console.log(` ${tag} ${e.title}`);
|
|
118919
118757
|
}
|
|
118920
|
-
console.log(
|
|
118758
|
+
console.log(chalk37.dim(` ${result.created} created · ${result.updated} updated · ${result.regressions} regressions · ${result.skipped} skipped${result.summaryRef ? ` · summary ${result.summaryRef}` : ""}`));
|
|
118921
118759
|
return 0;
|
|
118922
118760
|
}
|
|
118923
118761
|
function countTotals(issues) {
|
|
@@ -118967,11 +118805,11 @@ async function sweepScheduleCommand(opts) {
|
|
|
118967
118805
|
console.log(JSON.stringify(job));
|
|
118968
118806
|
return 0;
|
|
118969
118807
|
}
|
|
118970
|
-
console.log(
|
|
118808
|
+
console.log(chalk37.bold(`
|
|
118971
118809
|
control-plane JOB_CREATE payload (monthly sweep)
|
|
118972
118810
|
`));
|
|
118973
118811
|
console.log(JSON.stringify(job, null, 2));
|
|
118974
|
-
console.log(
|
|
118812
|
+
console.log(chalk37.dim([
|
|
118975
118813
|
"",
|
|
118976
118814
|
" How to create it:",
|
|
118977
118815
|
" • from Claude Code with the parity plugin: /parity:sweep schedule … (calls the deco-control-plane MCP `JOB_CREATE` with this payload)",
|
|
@@ -118990,22 +118828,22 @@ async function sweepScheduleCommand(opts) {
|
|
|
118990
118828
|
var SEVERITIES2 = ["critical", "high", "medium", "low"];
|
|
118991
118829
|
async function qaFileCommand(opts) {
|
|
118992
118830
|
if ((opts.board ?? "studio") !== "studio") {
|
|
118993
|
-
console.error(
|
|
118831
|
+
console.error(chalk38.red(`--board ${opts.board}: only "studio" is supported`));
|
|
118994
118832
|
return 2;
|
|
118995
118833
|
}
|
|
118996
118834
|
const minSeverity = opts.minSeverity ?? "medium";
|
|
118997
118835
|
if (!SEVERITIES2.includes(minSeverity)) {
|
|
118998
|
-
console.error(
|
|
118836
|
+
console.error(chalk38.red(`--min-severity ${opts.minSeverity}: use ${SEVERITIES2.join("|")}`));
|
|
118999
118837
|
return 2;
|
|
119000
118838
|
}
|
|
119001
|
-
if (!
|
|
119002
|
-
console.error(
|
|
118839
|
+
if (!existsSync36(opts.issues)) {
|
|
118840
|
+
console.error(chalk38.red(`${opts.issues}: not found`));
|
|
119003
118841
|
return 2;
|
|
119004
118842
|
}
|
|
119005
118843
|
const raw = JSON.parse(readFileSync44(opts.issues, "utf8"));
|
|
119006
118844
|
const parsed = agentIssues.safeParse(Array.isArray(raw) ? raw : raw?.issues);
|
|
119007
118845
|
if (!parsed.success) {
|
|
119008
|
-
console.error(
|
|
118846
|
+
console.error(chalk38.red(`${opts.issues}: ${parsed.error.message}`));
|
|
119009
118847
|
return 2;
|
|
119010
118848
|
}
|
|
119011
118849
|
const dir = dirname10(opts.issues);
|
|
@@ -119017,7 +118855,7 @@ async function qaFileCommand(opts) {
|
|
|
119017
118855
|
const { issues, held } = applyCardReview(parsed.data, review);
|
|
119018
118856
|
const cfg = studioConfigFromEnv();
|
|
119019
118857
|
if (!cfg) {
|
|
119020
|
-
console.error(
|
|
118858
|
+
console.error(chalk38.red(`Studio not configured — ${STUDIO_LOGIN_HINT}`));
|
|
119021
118859
|
return 2;
|
|
119022
118860
|
}
|
|
119023
118861
|
const info = {
|
|
@@ -119053,24 +118891,24 @@ async function qaFileCommand(opts) {
|
|
|
119053
118891
|
}));
|
|
119054
118892
|
return 0;
|
|
119055
118893
|
}
|
|
119056
|
-
console.log(
|
|
118894
|
+
console.log(chalk38.bold(`
|
|
119057
118895
|
${opts.yes ? "filed on the Studio board" : "dry run — add --yes to file"}`));
|
|
119058
118896
|
for (const e of result.entries)
|
|
119059
118897
|
console.log(` ${e.action.padEnd(10)} ${e.title}`);
|
|
119060
118898
|
for (const h of held)
|
|
119061
|
-
console.log(
|
|
119062
|
-
console.log(
|
|
118899
|
+
console.log(chalk38.dim(` ${h}`));
|
|
118900
|
+
console.log(chalk38.dim(` ${result.created} created · ${result.updated} updated · ${result.regressions} regressions`));
|
|
119063
118901
|
return 0;
|
|
119064
118902
|
} catch (err) {
|
|
119065
|
-
console.error(
|
|
118903
|
+
console.error(chalk38.red(err instanceof Error ? err.message : String(err)));
|
|
119066
118904
|
return 1;
|
|
119067
118905
|
}
|
|
119068
118906
|
}
|
|
119069
118907
|
|
|
119070
118908
|
// src/commands/report.ts
|
|
119071
|
-
import { existsSync as
|
|
118909
|
+
import { existsSync as existsSync37, readFileSync as readFileSync45, writeFileSync as writeFileSync36 } from "node:fs";
|
|
119072
118910
|
import { join as join51 } from "node:path";
|
|
119073
|
-
import
|
|
118911
|
+
import chalk39 from "chalk";
|
|
119074
118912
|
import open3 from "open";
|
|
119075
118913
|
|
|
119076
118914
|
// src/report/deck-template.ts
|
|
@@ -119596,7 +119434,6 @@ var ALL_REPORT_SECTIONS = [
|
|
|
119596
119434
|
"summary",
|
|
119597
119435
|
"visualdiff",
|
|
119598
119436
|
"seo",
|
|
119599
|
-
"sidebyside",
|
|
119600
119437
|
"issues",
|
|
119601
119438
|
"vitals",
|
|
119602
119439
|
"cache",
|
|
@@ -119631,7 +119468,8 @@ function extractJsonSection(run, section) {
|
|
|
119631
119468
|
candUrl: run.candUrl,
|
|
119632
119469
|
verdict: run.verdict,
|
|
119633
119470
|
topIssues: run.topIssues,
|
|
119634
|
-
durationMs: run.durationMs
|
|
119471
|
+
durationMs: run.durationMs,
|
|
119472
|
+
scoreBreakdown: explainCompositeScore(run.moduleVerdicts ?? [], run.verdict, run.checks)
|
|
119635
119473
|
};
|
|
119636
119474
|
case "visualdiff":
|
|
119637
119475
|
return run.visualDiff ?? null;
|
|
@@ -119657,8 +119495,6 @@ function extractJsonSection(run, section) {
|
|
|
119657
119495
|
return extractPagesSlice(run);
|
|
119658
119496
|
case "console":
|
|
119659
119497
|
return run.checks.filter((c) => c.name === "console-errors-baseline").flatMap((c) => c.issues);
|
|
119660
|
-
case "sidebyside":
|
|
119661
|
-
return extractSideBySideSlice(run);
|
|
119662
119498
|
case "prompt":
|
|
119663
119499
|
return {
|
|
119664
119500
|
runId: run.id,
|
|
@@ -119715,26 +119551,6 @@ function extractPagesSlice(run) {
|
|
|
119715
119551
|
}
|
|
119716
119552
|
return rows;
|
|
119717
119553
|
}
|
|
119718
|
-
function extractSideBySideSlice(run) {
|
|
119719
|
-
const pairs = [];
|
|
119720
|
-
for (const fc of run.flowCaptures) {
|
|
119721
|
-
for (const p of fc.pages) {
|
|
119722
|
-
if (p.side !== "prod")
|
|
119723
|
-
continue;
|
|
119724
|
-
const candPath = pathOf7(p.url);
|
|
119725
|
-
const cand = fc.pages.find((q) => q.side === "cand" && pathOf7(q.url) === candPath && q.viewport === p.viewport);
|
|
119726
|
-
if (!cand)
|
|
119727
|
-
continue;
|
|
119728
|
-
pairs.push({
|
|
119729
|
-
label: `${candPath || "/"} · ${p.viewport}`,
|
|
119730
|
-
prodUrl: p.url,
|
|
119731
|
-
candUrl: cand.url,
|
|
119732
|
-
viewport: p.viewport
|
|
119733
|
-
});
|
|
119734
|
-
}
|
|
119735
|
-
}
|
|
119736
|
-
return pairs;
|
|
119737
|
-
}
|
|
119738
119554
|
function pathOf7(url) {
|
|
119739
119555
|
try {
|
|
119740
119556
|
return new URL(url).pathname || "/";
|
|
@@ -119751,7 +119567,7 @@ async function reportCommand(runId, opts) {
|
|
|
119751
119567
|
try {
|
|
119752
119568
|
run = loadRun(opts.output, runId);
|
|
119753
119569
|
} catch (err) {
|
|
119754
|
-
console.error(
|
|
119570
|
+
console.error(chalk39.red(`failed to load run: ${err.message}`));
|
|
119755
119571
|
return 1;
|
|
119756
119572
|
}
|
|
119757
119573
|
let plan = null;
|
|
@@ -119759,29 +119575,33 @@ async function reportCommand(runId, opts) {
|
|
|
119759
119575
|
try {
|
|
119760
119576
|
plan = loadPlan(opts.planDir);
|
|
119761
119577
|
} catch (err) {
|
|
119762
|
-
console.error(
|
|
119578
|
+
console.error(chalk39.red(`failed to read migration-plan.json: ${err.message}`));
|
|
119763
119579
|
return 1;
|
|
119764
119580
|
}
|
|
119765
119581
|
if (!plan) {
|
|
119766
|
-
console.error(
|
|
119582
|
+
console.error(chalk39.red(`no migration-plan.json in ${opts.planDir}`));
|
|
119767
119583
|
return 1;
|
|
119768
119584
|
}
|
|
119769
119585
|
}
|
|
119770
119586
|
const html = renderDeckHtml(buildDeckModel(run, plan), opts.lang ?? "en");
|
|
119771
119587
|
const dest = opts.out ?? join51(paths.runDir, "deck.html");
|
|
119772
119588
|
writeFileSync36(dest, html, "utf8");
|
|
119773
|
-
console.log(`${
|
|
119589
|
+
console.log(`${chalk39.green("✓")} deck → ${dest}`);
|
|
119774
119590
|
if (opts.open) {
|
|
119775
119591
|
await open3(dest).catch((err) => {
|
|
119776
|
-
console.error(
|
|
119592
|
+
console.error(chalk39.red(`failed to open: ${err.message}`));
|
|
119777
119593
|
});
|
|
119778
119594
|
}
|
|
119779
119595
|
return 0;
|
|
119780
119596
|
}
|
|
119781
119597
|
if (opts.section) {
|
|
119598
|
+
if (opts.section === "sidebyside") {
|
|
119599
|
+
console.error(chalk39.yellow("⚠ section `sidebyside` was removed from the report — use `parity cockpit --prod <url> --cand <url>` for the live prod × cand view."));
|
|
119600
|
+
return 1;
|
|
119601
|
+
}
|
|
119782
119602
|
if (!ALL_REPORT_SECTIONS.includes(opts.section)) {
|
|
119783
|
-
console.error(
|
|
119784
|
-
console.error(
|
|
119603
|
+
console.error(chalk39.red(`unknown section "${opts.section}"`));
|
|
119604
|
+
console.error(chalk39.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
|
|
119785
119605
|
return 1;
|
|
119786
119606
|
}
|
|
119787
119607
|
if (opts.json) {
|
|
@@ -119789,40 +119609,40 @@ async function reportCommand(runId, opts) {
|
|
|
119789
119609
|
const run = loadRun(opts.output, runId);
|
|
119790
119610
|
const payload = extractReportSection({ kind: "json", section: opts.section, run });
|
|
119791
119611
|
if (payload === null) {
|
|
119792
|
-
console.error(
|
|
119612
|
+
console.error(chalk39.red(`section "${opts.section}" not present in this run`));
|
|
119793
119613
|
return 1;
|
|
119794
119614
|
}
|
|
119795
119615
|
process.stdout.write(`${JSON.stringify(payload, null, 2)}
|
|
119796
119616
|
`);
|
|
119797
119617
|
return 0;
|
|
119798
119618
|
} catch (err) {
|
|
119799
|
-
console.error(
|
|
119619
|
+
console.error(chalk39.red(`failed to load run: ${err.message}`));
|
|
119800
119620
|
return 1;
|
|
119801
119621
|
}
|
|
119802
119622
|
}
|
|
119803
|
-
if (!
|
|
119804
|
-
console.error(
|
|
119623
|
+
if (!existsSync37(paths.reportHtml)) {
|
|
119624
|
+
console.error(chalk39.red(`report.html not found at ${paths.reportHtml}`));
|
|
119805
119625
|
return 1;
|
|
119806
119626
|
}
|
|
119807
119627
|
const html = readFileSync45(paths.reportHtml, "utf8");
|
|
119808
119628
|
const slice = extractReportSection({ kind: "html", section: opts.section, html });
|
|
119809
119629
|
if (slice === null) {
|
|
119810
|
-
console.error(
|
|
119630
|
+
console.error(chalk39.red(`section "${opts.section}" not present in this report`));
|
|
119811
119631
|
return 1;
|
|
119812
119632
|
}
|
|
119813
119633
|
process.stdout.write(slice);
|
|
119814
119634
|
return 0;
|
|
119815
119635
|
}
|
|
119816
|
-
console.log(
|
|
119636
|
+
console.log(chalk39.dim(`opening ${paths.reportHtml}`));
|
|
119817
119637
|
await open3(paths.reportHtml).catch((err) => {
|
|
119818
|
-
console.error(
|
|
119638
|
+
console.error(chalk39.red(`failed to open: ${err.message}`));
|
|
119819
119639
|
});
|
|
119820
119640
|
return 0;
|
|
119821
119641
|
}
|
|
119822
119642
|
|
|
119823
119643
|
// src/commands/rerender.ts
|
|
119824
119644
|
import { writeFileSync as writeFileSync37 } from "node:fs";
|
|
119825
|
-
import
|
|
119645
|
+
import chalk40 from "chalk";
|
|
119826
119646
|
function analyzeFrames(before, frames, opts = {}) {
|
|
119827
119647
|
const threshold = opts.flashWhite ?? Math.min(97, before.white + 20);
|
|
119828
119648
|
const flashes = [];
|
|
@@ -119904,7 +119724,7 @@ function visibleImagesInPage() {
|
|
|
119904
119724
|
var SKELETON = "[class*='skeleton' i], .animate-pulse, [aria-busy='true'], .loading";
|
|
119905
119725
|
async function rerenderCommand(opts) {
|
|
119906
119726
|
if (!opts.selector && !opts.text) {
|
|
119907
|
-
console.error(
|
|
119727
|
+
console.error(chalk40.red("pass --selector or --text"));
|
|
119908
119728
|
return 2;
|
|
119909
119729
|
}
|
|
119910
119730
|
const browser = await launchBrowser({ headless: true });
|
|
@@ -119985,7 +119805,7 @@ async function rerenderCommand(opts) {
|
|
|
119985
119805
|
t0 = Date.now();
|
|
119986
119806
|
const clicked = await target.click({ timeout: 5000 }).then(() => true).catch(() => false);
|
|
119987
119807
|
if (!clicked) {
|
|
119988
|
-
console.error(
|
|
119808
|
+
console.error(chalk40.yellow("target not clickable — nothing measured"));
|
|
119989
119809
|
return 2;
|
|
119990
119810
|
}
|
|
119991
119811
|
await page.waitForTimeout(opts.settleMs);
|
|
@@ -120072,20 +119892,20 @@ async function rerenderCommand(opts) {
|
|
|
120072
119892
|
console.log(JSON.stringify({ url: opts.url, action: opts.selector ?? opts.text, ...report }));
|
|
120073
119893
|
return 0;
|
|
120074
119894
|
}
|
|
120075
|
-
console.log(
|
|
119895
|
+
console.log(chalk40.bold(`
|
|
120076
119896
|
click ${opts.selector ?? `"${opts.text}"`} on ${urlBefore}`));
|
|
120077
119897
|
if (report.urlAfter !== urlBefore)
|
|
120078
119898
|
console.log(` url → ${report.urlAfter}`);
|
|
120079
119899
|
console.log(` ${requests.length} request(s): ${requests.slice(0, 6).join(" · ")}`);
|
|
120080
119900
|
for (const r of regions.slice(0, 10))
|
|
120081
|
-
console.log(` ${r.remounted ?
|
|
119901
|
+
console.log(` ${r.remounted ? chalk40.red("REMOUNTED") : "changed "} ${r.region.padEnd(48)} +${r.added}/-${r.removed} attrs ${r.attrs} text ${r.text}`);
|
|
120082
119902
|
for (const s of report.skeletons)
|
|
120083
|
-
console.log(
|
|
119903
|
+
console.log(chalk40.yellow(` skeletons ×${s.count} in ${s.region}`));
|
|
120084
119904
|
const [b0, a0] = [report.visibleImages.before[0], report.visibleImages.after[0]];
|
|
120085
119905
|
console.log(b0 === a0 ? ` main visible image unchanged: ${a0 ?? "none"}` : ` main visible image: ${b0 ?? "none"} → ${a0 ?? "none"}`);
|
|
120086
119906
|
for (const f of flashes)
|
|
120087
|
-
console.log(
|
|
120088
|
-
console.log(
|
|
119907
|
+
console.log(chalk40.red(` white flash +${f.from}–${f.to}ms (peak ${f.peakWhite.toFixed(0)}% white)`));
|
|
119908
|
+
console.log(chalk40.dim(` settled at +${settledAt ?? "?"}ms · ${post.length} frames${opts.sheet ? ` · sheet ${opts.sheet}` : ""}`));
|
|
120089
119909
|
return 0;
|
|
120090
119910
|
} finally {
|
|
120091
119911
|
await browser.close().catch(() => {
|
|
@@ -120094,6 +119914,70 @@ async function rerenderCommand(opts) {
|
|
|
120094
119914
|
}
|
|
120095
119915
|
}
|
|
120096
119916
|
|
|
119917
|
+
// src/commands/serve.ts
|
|
119918
|
+
import { existsSync as existsSync38 } from "node:fs";
|
|
119919
|
+
import chalk41 from "chalk";
|
|
119920
|
+
async function serveRunAndBlock(runDir, opts = {}) {
|
|
119921
|
+
let handle;
|
|
119922
|
+
try {
|
|
119923
|
+
handle = await startProxyServer(runDir, { port: opts.port });
|
|
119924
|
+
} catch (err) {
|
|
119925
|
+
console.error(chalk41.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
|
|
119926
|
+
return 2;
|
|
119927
|
+
}
|
|
119928
|
+
const label = opts.label ?? "parity serve";
|
|
119929
|
+
console.log("");
|
|
119930
|
+
console.log(chalk41.bold(` ${label}`));
|
|
119931
|
+
console.log(` ${chalk41.green("●")} ${handle.url}`);
|
|
119932
|
+
console.log(chalk41.dim(` Servindo: ${runDir}`));
|
|
119933
|
+
console.log(chalk41.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
|
|
119934
|
+
console.log(chalk41.dim(` Ctrl+C pra parar (2x pra forçar saída).
|
|
119935
|
+
`));
|
|
119936
|
+
if (opts.open !== false) {
|
|
119937
|
+
const { default: open } = await import("open");
|
|
119938
|
+
await open(handle.url).catch(() => {
|
|
119939
|
+
return;
|
|
119940
|
+
});
|
|
119941
|
+
}
|
|
119942
|
+
let shuttingDown = false;
|
|
119943
|
+
const onSignal = () => {
|
|
119944
|
+
if (shuttingDown) {
|
|
119945
|
+
process.stderr.write(`
|
|
119946
|
+
forçando saída.
|
|
119947
|
+
`);
|
|
119948
|
+
process.exit(130);
|
|
119949
|
+
}
|
|
119950
|
+
shuttingDown = true;
|
|
119951
|
+
process.stderr.write(`
|
|
119952
|
+
parando servidor…
|
|
119953
|
+
`);
|
|
119954
|
+
handle.close().catch(() => {
|
|
119955
|
+
return;
|
|
119956
|
+
});
|
|
119957
|
+
setTimeout(() => process.exit(0), 300);
|
|
119958
|
+
};
|
|
119959
|
+
process.on("SIGINT", onSignal);
|
|
119960
|
+
process.on("SIGTERM", onSignal);
|
|
119961
|
+
await new Promise(() => {});
|
|
119962
|
+
return 0;
|
|
119963
|
+
}
|
|
119964
|
+
async function serveCommand(runId, opts) {
|
|
119965
|
+
const paths = getRunPaths(opts.output, runId);
|
|
119966
|
+
if (!existsSync38(paths.runDir)) {
|
|
119967
|
+
console.error(chalk41.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
|
|
119968
|
+
return 1;
|
|
119969
|
+
}
|
|
119970
|
+
if (!existsSync38(paths.reportHtml)) {
|
|
119971
|
+
console.error(chalk41.red(`✖ report.html não existe em ${paths.runDir}`));
|
|
119972
|
+
return 1;
|
|
119973
|
+
}
|
|
119974
|
+
return serveRunAndBlock(paths.runDir, {
|
|
119975
|
+
port: opts.port,
|
|
119976
|
+
open: opts.open,
|
|
119977
|
+
label: `parity serve · ${runId}`
|
|
119978
|
+
});
|
|
119979
|
+
}
|
|
119980
|
+
|
|
120097
119981
|
// src/commands/states.ts
|
|
120098
119982
|
import chalk42 from "chalk";
|
|
120099
119983
|
var ROOT_ATTR = "data-parity-states";
|
|
@@ -121796,13 +121680,14 @@ program.command("studio").description("Work the deco Studio task board: list tas
|
|
|
121796
121680
|
}));
|
|
121797
121681
|
registerCommands(program.command("cms").description(`${DESCRIPTION} Same as the standalone \`vtex-cms\` bin.`));
|
|
121798
121682
|
registerCatalogCommands(program.command("catalog").description(`${CATALOG_DESCRIPTION} Same as the standalone \`catalog\` bin.`));
|
|
121799
|
-
program.command("serve").argument("<runId>", "Run ID to serve").description("Spawns a local HTTP server that serves
|
|
121683
|
+
program.command("serve").argument("<runId>", "Run ID to serve").description("[deprecated: use `parity report <runId>` to open a report, `parity cockpit` for the live prod × cand view] Spawns a local HTTP server that serves a run directory. It existed for the report's Side-by-side tab, which moved to the cockpit.").option("--output <dir>", "Output directory where runs live", "./parity-output").option("--port <n>", "Fixed port (default: auto-pick free port)", (v) => Number(v)).option("--no-open", "Don't open the browser automatically").action(async (runId, opts) => {
|
|
121684
|
+
deprecatedNotice("serve", "report <runId> (or `parity cockpit`)");
|
|
121800
121685
|
process.exit(await serveCommand(runId, opts));
|
|
121801
121686
|
});
|
|
121802
121687
|
program.command("event").argument("<type>", "Event type: phase-change | dispatch | bench | score | note | …").description("Record a migration event into <dir>/events.jsonl — the sanctioned emission path for hooks and the orchestrator. The cockpit daemon tails this file into its live activity feed.").option("--dir <dir>", "Directory holding events.jsonl (the target's .parity/)", ".parity").option("--data <json>", `JSON object of event fields, e.g. '{"agent":"porter","component":"hero"}'`).action((type, opts) => {
|
|
121803
121688
|
process.exit(eventCommand(type, opts));
|
|
121804
121689
|
});
|
|
121805
|
-
program.command("report").argument("<runId>", "Run ID to open").description("Open the HTML report for a run in the default browser. With --section, extract a single tab to stdout instead — useful for agents that need just the SEO/Network/Vitals slice without parsing the whole report. Issue #74.").option("--output <dir>", "Output directory", "./parity-output").option("--section <name>", "Extract one tab to stdout instead of opening the report. Valid names: summary, visualdiff, seo,
|
|
121690
|
+
program.command("report").argument("<runId>", "Run ID to open").description("Open the HTML report for a run in the default browser. With --section, extract a single tab to stdout instead — useful for agents that need just the SEO/Network/Vitals slice without parsing the whole report. Issue #74.").option("--output <dir>", "Output directory", "./parity-output").option("--section <name>", "Extract one tab to stdout instead of opening the report. Valid names: summary, visualdiff, seo, issues, vitals, cache, checks, prompt, pages, console, network, diff.").option("--json", "Pair with --section to emit a normalized JSON projection of the section (from report.json) instead of the raw HTML slice.").option("--deck", "Render the presentation deck instead: one topic per full-viewport page, advanced sideways, in a single self-contained HTML file. For showing the result to someone rather than debugging it. Issue #290.", false).option("--out <path>", "Where to write the deck (default: deck.html in the run dir)").option("--lang <pt|en>", "Initial deck language; the in-page toggle still switches live", "en").option("--open", "Open the rendered deck in the browser", false).option("--plan-dir <dir>", "With --deck: dir holding migration-plan.json. Adds the component heat map (grouped by page, plus global) and the block-by-block table. Without it those pages are omitted, not drawn empty. Issue #291.").action(async (runId, opts) => {
|
|
121806
121691
|
process.exit(await reportCommand(runId, {
|
|
121807
121692
|
output: opts.output,
|
|
121808
121693
|
section: opts.section,
|