rtl-analyzer 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -66
- package/dist/contextual-preview-bridge.js +16 -11
- package/dist/contextual-preview.js +3 -3
- package/dist/css-configured-proposal.js +98 -0
- package/dist/css-spacing.js +10 -9
- package/dist/dashboard-batch-review.js +37 -0
- package/dist/dashboard-client.js +28 -22
- package/dist/dashboard-contextual-preview.js +14 -6
- package/dist/dashboard-data.js +3 -3
- package/dist/dashboard-embedded-preview.js +8 -6
- package/dist/dashboard-html.js +3 -1
- package/dist/dashboard-operation-flow.js +47 -0
- package/dist/dashboard-review-navigation.js +19 -0
- package/dist/dashboard-review-workflow.js +99 -31
- package/dist/dashboard-themes.js +34 -0
- package/dist/original-preview-runtime.js +12 -2
- package/dist/page-navigation.js +17 -0
- package/dist/policy-validation.js +6 -3
- package/dist/preview-companion.js +37 -9
- package/dist/preview-configuration.js +35 -8
- package/dist/preview-runtime.js +13 -9
- package/dist/review-session.js +10 -0
- package/dist/review-workflow.js +297 -31
- package/dist/rules.js +13 -4
- package/dist/scoped-direction-evidence.js +117 -0
- package/dist/transformations.js +14 -0
- package/dist/validation.js +6 -2
- package/package.json +2 -2
package/dist/dashboard-client.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { themeClientSource } from './dashboard-themes.js';
|
|
1
2
|
import { workflowClientSource } from './dashboard-review-workflow.js';
|
|
2
3
|
import { embeddedPreviewClientSource } from './dashboard-embedded-preview.js';
|
|
3
4
|
export const dashboardClientSource = [
|
|
4
5
|
`(async()=>{const dashboardSnapshot=JSON.parse(document.getElementById('rtl-dashboard-data').textContent),companionOrigin=window.__RTL_COMPANION_ORIGIN__||'http://127.0.0.1:4318';let d=dashboardSnapshot,sourceContext=null,sourceContextError='',pendingSourceTransition=null,updatePanelBadge=null;
|
|
5
6
|
try{pendingSourceTransition=JSON.parse(sessionStorage.getItem('rtl-source-transition')||'null')}catch{/* Older boolean markers carry no selection. */}
|
|
7
|
+
window.rtlEntryPending=!pendingSourceTransition;
|
|
6
8
|
try{const params=new URLSearchParams({inputDigest:dashboardSnapshot.inputDigest,policyDigest:dashboardSnapshot.policyDigest,mode:pendingSourceTransition?.mode||localStorage.getItem('rtl-review-workflow')||'one-by-one',findingId:new URL(location.href).searchParams.get('finding')||''});if(pendingSourceTransition?.workflowId)params.set('workflowId',pendingSourceTransition.workflowId);if(pendingSourceTransition?.selection)params.set('selection',JSON.stringify(pendingSourceTransition.selection));const response=await fetch(companionOrigin+'/review/source-context?'+params);const result=await response.json();if(!response.ok)throw Error(result.error||'SOURCE_CONTEXT_UNAVAILABLE');d=result.data;sourceContext=result.transition;if(sourceContext?.currentInputDigest!==sourceContext?.historicalInputDigest)document.querySelectorAll('.artifact-links a').forEach(link=>{link.textContent='Historical '+link.textContent;link.title='Snapshot '+dashboardSnapshot.inputDigest});document.getElementById('rtl-dashboard-data').textContent=JSON.stringify(d)}catch(error){sourceContextError=error.message}const r=document.getElementById('dashboard'),el=(t,x='',c='')=>{const n=document.createElement(t);if(c)n.className=c;if(x!==undefined)n.textContent=String(x);return n},severityLabel=x=>(__SEVERITY_LABELS__[x]??x),b=x=>{const n=el('bdi',x);n.dir='auto';return n};`,
|
|
7
9
|
`document.addEventListener('click',event=>{const target=event.target instanceof Element?event.target.closest('.stats-toggle'):null;if(!target)return;const summary=document.querySelector('.summary');if(!summary)return;summary.hidden=!summary.hidden;target.textContent=summary.hidden?'Show all statistics':'Close statistics'});`,
|
|
8
10
|
`const reviewStyle=document.createElement('style');reviewStyle.textContent='.workflow-change{border:1px solid #526b94!important;border-radius:8px!important;background:#172844!important;color:#dce7fb!important;padding:8px 11px!important;font-size:12px!important;font-weight:700!important;white-space:nowrap}.details>h2{display:none}.details>.actions{display:flex;justify-content:flex-end;gap:6px;padding:4px 0 6px;border-bottom:1px solid #263c5d}.details>.actions button{min-height:28px;padding:5px 9px;font-size:10px}.primary-review-flow{gap:8px!important}.review-section{padding:10px!important;border:1px solid #2d4668!important;border-radius:10px!important;background:linear-gradient(180deg,#12223a,#0e1a2d)!important}.details-card>h2,.details-card>p:first-of-type{display:none}.details-card{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px}.details-card:before{content:"ⓘ";color:#b8c8df;font-size:16px}.details-card>p:nth-of-type(2){margin:0!important;color:#dce6f5!important;font-size:12px!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.finding-meta{grid-column:2/-1;margin:0!important;font-size:10px!important;color:#aebed3!important}.eligibility-panel{grid-column:2/-1;margin:0!important;font-size:10px!important;color:#8fa2bd!important}.code-diff-card h2,.component-review h2,.decision-card>h2{margin:0 0 8px!important;font-size:14px!important}.diff-grid{align-items:stretch}.before-card,.after-card{min-width:0;padding:9px 10px;border-radius:8px;overflow:hidden}.before-card{border:1px solid #a64b5a;background:#321c2a}.after-card{border:1px solid #289b73;background:#12382f}.before-card h3,.after-card h3{margin:0 0 6px!important;font-size:11px!important}.before-card pre,.after-card pre{max-height:54px;margin:0!important;overflow:auto!important;white-space:pre-wrap;word-break:break-word;text-align:left;font-size:11px!important;background:transparent!important;border:0!important;padding:0!important}.after-card pre{color:#b3f4cd}.diff-arrow{align-self:center;color:#e7edf9;font-size:22px}.component-review{display:grid;grid-template-columns:1fr 1fr;gap:8px}.component-review h2,.component-review>.component-note{grid-column:1/-1}.component-review>.component-note{margin:0!important;font-size:10px!important;color:#9fb0c7!important}.component-review:after{content:"After (With Fix)\\A\\A Preview unavailable";white-space:pre-wrap;display:block;min-height:58px;padding:9px;border:1px solid #289b73;border-radius:8px;background:#12382f;color:#b3f4cd;font-size:11px;font-weight:700}.component-review:before{content:"Before (Current)\\A\\A Preview unavailable";white-space:pre-wrap;display:block;min-height:58px;padding:9px;border:1px solid #a64b5a;border-radius:8px;background:#321c2a;color:#ffd1d8;font-size:11px;font-weight:700;grid-row:3}.component-review>.preview-unavailable{grid-column:1/-1;margin:0!important;font-size:10px!important}.decision-card{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:6px}.decision-card>h2{grid-column:1/-1}.decision-card>.decision-panel,.decision-card>.review-workspace{grid-column:1/-1}.decision-card .review-workspace{margin-top:0}.finding small{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.details>.operational-details,.details>.preview-box,.details>.lifecycle-panel,.details>.manual-workflow,.details>.controlled-apply{font-size:10px}.details>.operational-details{margin-top:8px}.review-workspace,.decision-panel{padding:8px!important}.review-workspace h3,.decision-panel h3{margin:0 0 4px!important;font-size:11px!important}.review-workspace>p,.decision-panel>p{margin:3px 0!important;font-size:10px!important}.review-workspace textarea,.review-workspace input,.decision-panel textarea,.decision-panel select{min-height:28px;padding:5px;font-size:10px}.decision-card .actions{padding:0;border:0;justify-content:flex-start}';document.head.append(reviewStyle);`,
|
|
@@ -22,7 +24,7 @@ try{const params=new URLSearchParams({inputDigest:dashboardSnapshot.inputDigest,
|
|
|
22
24
|
`if(i!==0){q.disabled=true;`,
|
|
23
25
|
`q.title='Coming soon'}nav.append(q)});`,
|
|
24
26
|
`top.append(nav);`,
|
|
25
|
-
`const tools=el('div','','tools'),statsToggle=el('button','Show all statistics','stats-toggle'),workflowButton=el('button','Change review
|
|
27
|
+
`const tools=el('div','','tools'),statsToggle=el('button','Show all statistics','stats-toggle'),workflowButton=el('button','Change review mode','workflow-change'),sw=el('div','','search-wrap');`,
|
|
26
28
|
`sw.append(el('span','⌕'));`,
|
|
27
29
|
`const search=el('input');`,
|
|
28
30
|
`search.placeholder='Search findings';`,
|
|
@@ -36,8 +38,8 @@ try{const params=new URLSearchParams({inputDigest:dashboardSnapshot.inputDigest,
|
|
|
36
38
|
`app.append(top,filters);`,
|
|
37
39
|
`top.append(tools,el('span',sourceContextError?'REPORT SNAPSHOT · SOURCE UNVERIFIED':d.complete?'SCAN COMPLETE':'SCAN INCOMPLETE','status '+(d.complete?'':'warn')));`,
|
|
38
40
|
`const operations=el('details','','operations');operations.append(el('summary','Operations'));const operationBody=el('div','','operation-body');operations.append(operationBody);`,
|
|
39
|
-
`const rescan=el('section','','rescan-panel'),rescanButton=el('button','Rescan authoritative report'),rescanState=el('p','No rescan submitted','rescan-state'),rescanHistory=el('div','','rescan-history'),showRescan=x=>{if(!x)return;rescanState.textContent='Rescan persisted: '+x.reconciliation.length+' findings reconciled';rescanHistory.replaceChildren(...x.reconciliation.map(y=>el('p',y.findingId+' · '+y.status+' · '+y.confidence)))};fetch(companionOrigin+'/review/rescan').then(r=>r.ok?r.json():Promise.reject()).then(x=>showRescan(x.scans?.[0])).catch(()=>{});rescanButton.onclick=()=>{rescanButton.disabled=true;const findings=Object.values(d.queue).flat(),manifest={scanId:crypto.randomUUID?.()||String(Date.now()),inputDigest:d.inputDigest,policyDigest:d.policyDigest,timestamp:new Date().toISOString(),sourceCoverage:{complete:d.complete,filesAnalyzed:d.filesAnalyzed,filesExpected:d.filesAnalyzed},findings};fetch(companionOrigin+'/review/rescan',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({project:'invoicing',manifest})}).then(r=>r.ok?r.json():r.json().then(x=>Promise.reject(new Error(x.error||'RESCAN_FAILED')))).then(showRescan).catch(e=>{rescanState.textContent=e.message}).finally(()=>{rescanButton.disabled=false})};rescan.append(el('h2','Durable Rescan'),rescanState,rescanButton,rescanHistory);operationBody.append(rescan);`,
|
|
40
|
-
`const progress=el('section','','migration-progress'),progressBody=el('div','','progress-body');progress.append(el('h2','Migration Progress'),progressBody);const renderProgress=x=>{progressBody.replaceChildren(el('p','Total current findings: '+
|
|
41
|
+
`const rescan=el('section','','rescan-panel'),rescanButton=el('button','Rescan authoritative report'),rescanState=el('p','No rescan submitted','rescan-state'),rescanHistory=el('div','','rescan-history'),showRescan=x=>{if(!x)return;rescanState.textContent='Rescan persisted: '+x.reconciliation.length+' findings reconciled';rescanHistory.replaceChildren(...x.reconciliation.map(y=>el('p',y.findingId+' · '+y.status+' · '+y.confidence)))};fetch(companionOrigin+'/review/rescan').then(r=>r.ok?r.json():Promise.reject()).then(x=>showRescan(x.scans?.[0])).catch(()=>{});rescanButton.onclick=()=>{rescanButton.disabled=true;const findings=d.analysisFindings||Object.values(d.queue).flat(),manifest={scanId:crypto.randomUUID?.()||String(Date.now()),inputDigest:d.inputDigest,policyDigest:d.policyDigest,timestamp:new Date().toISOString(),sourceCoverage:{complete:d.complete,filesAnalyzed:d.filesAnalyzed,filesExpected:d.filesAnalyzed},findings};fetch(companionOrigin+'/review/rescan',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({project:'invoicing',manifest})}).then(r=>r.ok?r.json():r.json().then(x=>Promise.reject(new Error(x.error||'RESCAN_FAILED')))).then(showRescan).catch(e=>{rescanState.textContent=e.message}).finally(()=>{rescanButton.disabled=false})};rescan.append(el('h2','Durable Rescan'),rescanState,rescanButton,rescanHistory);operationBody.append(rescan);`,
|
|
42
|
+
`const progress=el('section','','migration-progress'),progressBody=el('div','','progress-body');progress.append(el('h2','Migration Progress'),progressBody);const renderProgress=x=>{const visible=(x.findings||[]).filter(f=>by.has(f.findingId)),validated=visible.filter(f=>f.lifecycle==='Validated').length,outstanding=visible.length-validated,percentage=visible.length?Math.round(validated/visible.length*100):0,countBy=key=>visible.reduce((counts,f)=>{counts[f[key]]=(counts[f[key]]||0)+1;return counts},{}),distribution=key=>Object.entries(countBy(key)).map(([k,v])=>k+' '+v).join(' · ')||'None';progressBody.replaceChildren(el('p','Total current findings: '+visible.length),el('p','Validated: '+validated+' · Outstanding: '+outstanding),el('p','Progress: '+percentage+'%'),el('p','Recommendations: '+distribution('recommendation')),el('p','Lifecycle: '+distribution('lifecycle')),el('p','Rescan: '+distribution('reconciliation')),...visible.map(f=>el('p',f.findingId+' · '+f.recommendation+' · '+f.lifecycle+' · '+f.reconciliation+' · evidence '+f.evidenceCount)))};fetch(companionOrigin+'/review/progress').then(r=>r.ok?r.json():Promise.reject()).then(renderProgress).catch(()=>progressBody.append(el('p','Progress unavailable; companion required')));operationBody.append(progress);app.append(operations);`,
|
|
41
43
|
`const sv=d.breakdowns.severity||[],major=sv.find(x=>x.name==='Major')?.count||0,minor=sv.find(x=>x.name==='Minor')?.count||0,info=sv.find(x=>x.name==='Info')?.count||0,rawTotal=major+minor+info,total=rawTotal||1,pct=x=>Math.round(x/total*100),sum=el('section','','summary'),wc=el('div','','card workspace-card');sum.hidden=false;statsToggle.textContent='Close statistics';`,
|
|
42
44
|
`wc.append(el('span','◈','workspace-icon'),el('div'));`,
|
|
43
45
|
`wc.lastChild.append(el('strong','Workspace'),el('span',d.filesAnalyzed+' files analyzed · '+d.findings+' findings'),el('span',d.uniqueAffectedFiles+' affected files · '+d.diagnostics+' diagnostics · '+d.blockingDiagnostics+' blocking','workspace-secondary'),el('b',d.complete?'✓ Scan complete':'! Scan incomplete','workspace-status'));`,
|
|
@@ -45,7 +47,7 @@ try{const params=new URLSearchParams({inputDigest:dashboardSnapshot.inputDigest,
|
|
|
45
47
|
`[['Total findings',d.findings,'']].forEach(x=>{const c=el('div','','card '+x[2]);`,
|
|
46
48
|
`c.append(el('strong',x[1]),el('span',x[0]));`,
|
|
47
49
|
`sum.append(c)});`,
|
|
48
|
-
`[['⚠','High Priority','Major',major,'red'],['△','Low Priority','Minor',minor,'amber']
|
|
50
|
+
`[['⚠','High Priority','Major',major,'red'],['△','Low Priority','Minor',minor,'amber']].forEach(x=>{const c=el('div','','card severity-card '+x[4]);c.setAttribute('aria-label',x[1]+' ('+x[2]+'): '+x[3]+' findings');c.append(el('strong',x[0]+' '+x[3]),el('span',x[1]+' · '+x[2]));sum.append(c)});`,
|
|
49
51
|
`const actionCard=el('div','','card green');actionCard.append(el('strong',d.actionableFindings),el('span','Actionable findings'));sum.append(actionCard);`,
|
|
50
52
|
`const chart=el('div','','card severity-chart'),donut=el('div','','donut');`,
|
|
51
53
|
`donut.style.setProperty('--major',(major/total*100)+'%');`,
|
|
@@ -85,7 +87,7 @@ try{const params=new URLSearchParams({inputDigest:dashboardSnapshot.inputDigest,
|
|
|
85
87
|
`wr.append(tp,fp,sp);`,
|
|
86
88
|
`app.append(wr);`,
|
|
87
89
|
`const srLive=el('div','','sr-only');srLive.setAttribute('role','status');srLive.setAttribute('aria-live','polite');srLive.setAttribute('aria-atomic','true');app.append(srLive);r.append(app);new MutationObserver(()=>{app.style.display=app.hidden?'none':''}).observe(app,{attributes:true,attributeFilter:['hidden']});document.addEventListener('keydown',e=>{const q=document.querySelector('dialog[open]');if(!q||e.key!=='Tab')return;const focus=[...q.querySelectorAll('button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),a[href]')];if(!focus.length)return;const first=focus[0],last=focus[focus.length-1];if(e.shiftKey&&document.activeElement===first){e.preventDefault();last.focus()}else if(!e.shiftKey&&document.activeElement===last){e.preventDefault();first.focus()}});`,
|
|
88
|
-
`const match=()=>all.filter(f=>(s.app==='all'||f.applications.includes(s.app))&&(s.severity==='all'||f.severity===s.severity)&&(s.status==='all'||f.reviewStatus===s.status)&&(s.eligibility==='all'||f.eligibility===s.eligibility)&&(s.category==='all'||f.category===s.category)&&(!s.q||[f.id,f.ruleId,f.path,f.title,f.owner].some(x=>String(x).toLowerCase().includes(s.q.toLowerCase())))),sortRows=rows=>rows.slice().sort((a,z)=>s.sort==='severity'?({Major:0,Minor:1,Info:2}[a.severity]??9)-({Major:0,Minor:1,Info:2}[z.severity]??9)||a.path.localeCompare(z.path):s.sort==='status'?a.reviewStatus.localeCompare(z.reviewStatus)||a.path.localeCompare(z.path):s.sort==='rule'?a.ruleId.localeCompare(z.ruleId)||a.path.localeCompare(z.path):a.path.localeCompare(z.path)||a.line-z.line||a.column-z.column),vis=()=>sortRows(match()).filter(f=>!s.file||f.path===s.file);`,
|
|
90
|
+
`const match=()=>all.filter(f=>(s.app==='all'||f.applications.includes(s.app))&&(s.severity==='all'||f.severity===s.severity)&&(s.status==='all'||f.reviewStatus===s.status)&&(s.eligibility==='all'||f.eligibility===s.eligibility)&&(s.category==='all'||f.category===s.category)&&(!s.q||[f.id,f.ruleId,f.path,f.title,f.owner].some(x=>String(x).toLowerCase().includes(s.q.toLowerCase())))),sortRows=rows=>rows.slice().sort((a,z)=>s.sort==='severity'?({Major:0,Minor:1,Info:2}[a.severity]??9)-({Major:0,Minor:1,Info:2}[z.severity]??9)||a.path.localeCompare(z.path):s.sort==='status'?a.reviewStatus.localeCompare(z.reviewStatus)||a.path.localeCompare(z.path):s.sort==='rule'?a.ruleId.localeCompare(z.ruleId)||a.path.localeCompare(z.path):a.path.localeCompare(z.path)||a.line-z.line||a.column-z.column),vis=()=>sortRows(match()).filter(f=>!s.file||f.path===s.file);window.rtlDashboardVisibleFindings=()=>vis();`,
|
|
89
91
|
`const previewOrigin='http://127.0.0.1:4318',previewState={available:false,checked:false};`,
|
|
90
92
|
`function treeRender(){tree.replaceChildren();`,
|
|
91
93
|
`const walk=(f,p)=>{f.folders.forEach(c=>{const z=document.createElement('details');`,
|
|
@@ -101,17 +103,17 @@ try{const params=new URLSearchParams({inputDigest:dashboardSnapshot.inputDigest,
|
|
|
101
103
|
`q.onclick=()=>selectFile(x.path);`,
|
|
102
104
|
`p.append(q)})};`,
|
|
103
105
|
`walk(d.explorer.root,tree)}function listRender(){finds.replaceChildren();`,
|
|
104
|
-
`const rows=vis(),matching=match();filterSummary.textContent=matching.length+' matching of '+all.length+' findings · '+all.
|
|
105
|
-
`if(!rows.length){finds.append(el('p','No findings match this scope.','empty'));`,
|
|
106
|
+
`const rows=vis(),matching=match();filterSummary.textContent=matching.length+' matching of '+all.length+' findings · '+all.length+' reviewable · '+all.filter(f=>f.reviewStatus!=='Not Reviewed').length+'/'+all.length+' reviewed';updatePanelBadge?.();`,
|
|
107
|
+
`if(!rows.length){finds.append(el('p',all.length?'No findings match this scope.':'No reviewable findings.','empty'));`,
|
|
106
108
|
`return}rows.forEach(f=>{const q=el('button','','finding'+(s.finding?.id===f.id?' selected':''));`,
|
|
107
|
-
`q.type='button';`,
|
|
108
|
-
`let itemTitle=f.title;if(f.ruleId==='RTL.CSS.PHYSICAL'||itemTitle==='Physical horizontal declaration'){const raw=(f.original||f.suggestion?.property||'').toLowerCase();if(raw.includes('margin'))itemTitle='
|
|
109
|
+
`q.type='button';q.dataset.findingId=f.id;`,
|
|
110
|
+
`let itemTitle=f.ruleId==='RTL.RUNTIME.DIRECTION_UNKNOWN'?'Direction unresolved by static analysis':f.title;if(f.ruleId==='RTL.CSS.PHYSICAL'||itemTitle==='Physical horizontal declaration'){const raw=(f.original||f.suggestion?.property||'').toLowerCase();if(raw.includes('margin'))itemTitle='Review physical margin';else if(raw.includes('padding'))itemTitle='Review physical padding';else if(raw.includes('border'))itemTitle='Review physical border';else if(raw.includes('text-align'))itemTitle='Review physical alignment';else itemTitle='Review physical property';}`,
|
|
109
111
|
`q.append(el('strong',itemTitle),el('small',f.ruleId+' · '+f.path+':'+f.line+':'+f.column));`,
|
|
110
112
|
`q.onclick=()=>select(f.id);`,
|
|
111
|
-
`finds.append(q)})}function source(f){code.replaceChildren();`,
|
|
113
|
+
`finds.append(q)});window.rtlRenderReviewIndicators?.()}function source(f){code.replaceChildren();`,
|
|
112
114
|
`meta.replaceChildren();`,
|
|
113
115
|
`if(!f){code.append(el('p','Select a finding to inspect source.','empty'));`,
|
|
114
|
-
`return}const findingHeading=el('div','','finding-heading');let actionable=f.title;if(f.ruleId==='RTL.CSS.PHYSICAL'||actionable==='Physical horizontal declaration'){const raw=(f.original||f.suggestion?.property||'').toLowerCase();if(raw.includes('margin'))actionable='
|
|
116
|
+
`return}const findingHeading=el('div','','finding-heading');let actionable=f.ruleId==='RTL.RUNTIME.DIRECTION_UNKNOWN'?'Direction unresolved by static analysis':f.title;if(f.ruleId==='RTL.CSS.PHYSICAL'||actionable==='Physical horizontal declaration'){const raw=(f.original||f.suggestion?.property||'').toLowerCase();if(raw.includes('margin'))actionable='Review physical margin';else if(raw.includes('padding'))actionable='Review physical padding';else if(raw.includes('border'))actionable='Review physical border';else if(raw.includes('text-align'))actionable='Review physical alignment';else actionable='Review physical property';}const titleWrap=el('div','','finding-title-wrap'),selectedTitle=el('h2',actionable,'finding-title');selectedTitle.tabIndex=-1;titleWrap.append(selectedTitle,el('p',f.ruleId+' · '+f.path+' · Line '+f.line,'finding-location'));findingHeading.append(titleWrap,el('span',['RTL.DOCUMENT.INITIAL','RTL.RUNTIME.DIRECTION_UNKNOWN'].includes(f.ruleId)?'Source information':'Prepare → Validate → Apply','finding-breadcrumb'));meta.replaceChildren(findingHeading);const ordered=vis(),at=ordered.findIndex(x=>x.id===f.id),previous=el('button','← Previous'),next=el('button','Next →'),counter=el('span','In file: '+(at+1)+' of '+ordered.length,'source-counter');previous.className='review-previous';next.className='review-next';previous.disabled=at<=0;next.disabled=at<0||at>=ordered.length-1;previous.onclick=()=>select(ordered[at-1].id);next.onclick=()=>select(ordered[at+1].id);meta.append(previous,next,counter);`,
|
|
115
117
|
`if(!d.sourceEmbeddingEnabled){code.append(el('p','Source preview unavailable. Regenerate with --embed-source-snippets.','empty'));`,
|
|
116
118
|
`return}const x=rf.get(f.id),w=x?.available?sn.get(x.sourceId):null;`,
|
|
117
119
|
`if(!w){code.append(el('p','Source preview unavailable: '+(x?.reason||'UNAVAILABLE'),'empty'));`,
|
|
@@ -121,23 +123,23 @@ try{const params=new URLSearchParams({inputDigest:dashboardSnapshot.inputDigest,
|
|
|
121
123
|
`function controlledApplyPanel(f){const box=el('section','','controlled-apply');box.append(el('h3','Controlled Apply & Rollback'),el('p','Apply is a separate, explicit action. Review approval alone never modifies source.'));const status=el('p','Checking server-side eligibility…','empty'),evidence=el('div','','apply-evidence'),actions=el('div','','actions'),live=el('p','','apply-live');live.setAttribute('aria-live','polite');box.append(status,evidence,actions,live);const identity={findingId:f.id,sourcePath:f.path,inputDigest:d.inputDigest,policyDigest:d.policyDigest,schemaVersion:d.schemaVersion};const showDialog=(title,message,confirmText,run)=>{const dialog=document.createElement('dialog');dialog.append(el('h3',title),el('p',message));const cancel=el('button','Cancel'),confirm=el('button',confirmText),row=el('div','','actions');row.append(cancel,confirm);dialog.append(row);cancel.onclick=()=>dialog.close();confirm.onclick=async()=>{confirm.disabled=true;cancel.disabled=true;dialog.close();await run()};document.body.append(dialog);dialog.addEventListener('close',()=>dialog.remove(),{once:true});dialog.showModal();confirm.focus()};const renderAudit=()=>fetch(previewOrigin+'/review/audit?sourcePath='+encodeURIComponent(f.path)).then(r=>r.ok?r.json():Promise.reject()).then(x=>{if(!x.events?.length)return;const history=el('section','','audit-history');history.append(el('h4','Audit History'),el('p','Durable operation history; reviewer identity is not inferred.'));[...x.events].sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp)).forEach(e=>{const item=el('details');item.append(el('summary',e.type+' · '+e.timestamp));const grid=el('dl','audit-grid');[['Operation',e.type],['Result',e.reason?'Failed':'Recorded'],['Source hash',e.sourceSha256],['Resulting hash',e.resultingSha256||'Not recorded'],['Details',e.reason||'None']].forEach(([k,v])=>{grid.append(el('dt',k),el('dd',v))});history.append(item)});box.append(history)}).catch(()=>{box.append(el('p','Audit history unavailable.','preview-unavailable'))});fetch(previewOrigin+'/review/apply/eligibility?'+new URLSearchParams(identity)).then(r=>r.ok?r.json():Promise.reject()).then(info=>{status.textContent=info.ready?'Ready to Apply':'Blocked: '+(info.reason||'Unavailable');status.className=info.ready?'apply-ready':'apply-blocked';if(!info.evidence){evidence.append(el('p','No approved immutable evidence is available. Apply remains disabled.','empty'));return}const e=info.evidence;evidence.append(el('p','Target: '+info.sourcePath),el('p','Finding: '+info.findingId),el('p','Original hash: '+e.originalSourceSha256),el('p','Candidate hash: '+e.candidateSourceSha256),el('h4','Approved Diff'),el('pre',e.codeDiff,'review-diff'));if(info.ready){const apply=el('button','Apply Change');apply.onclick=()=>showDialog('Confirm Controlled Apply','This will modify '+info.sourcePath+' in the original checkout. Confirm only after reviewing the exact diff above.','Confirm Apply',async()=>{status.textContent='Applying';live.textContent='Applying controlled patch…';try{const r=await fetch(previewOrigin+'/review/apply',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({identity,confirmation:'APPLY_CONFIRMED'})});const x=await r.json();if(!r.ok)throw new Error(x.error||'APPLY_FAILED');status.textContent='Applied to Source';live.textContent='Applied successfully';const rollback=el('button','Rollback Change');rollback.onclick=()=>showDialog('Confirm Rollback','This restores the backed-up original source. If the file changed after apply, rollback will be rejected as a conflict.','Confirm Rollback',async()=>{const rr=await fetch(previewOrigin+'/review/rollback',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(x.receipt)});const rx=await rr.json();if(!rr.ok){status.textContent=rx.error==='ROLLBACK_CONFLICT'?'Recovery required':'Rollback failed';live.textContent=rx.error||'ROLLBACK_FAILED';renderAudit();return}status.textContent='Rolled Back';live.textContent='Rolled back successfully';rollback.disabled=true;renderAudit()});actions.append(rollback);renderAudit()}catch(error){status.textContent=error.message==='ROLLBACK_CONFLICT'?'Recovery required':'Apply failed';live.textContent=error.message}});actions.append(apply)}}).catch(()=>{status.textContent='Controlled Apply unavailable offline';status.className='apply-blocked'});renderAudit();fetch(previewOrigin+'/review/rollback/eligibility?'+new URLSearchParams(identity)).then(r=>r.ok?r.json():Promise.reject()).then(info=>{if(!info.eligible)return;const rollback=el('button','Rollback Change');rollback.onclick=()=>showDialog('Confirm Rollback','This restores the backed-up original source. If the file changed after apply, rollback will be rejected as a conflict.','Confirm Rollback',async()=>{const rr=await fetch(previewOrigin+'/review/rollback',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(info.receipt)});const rx=await rr.json();if(!rr.ok){status.textContent=rx.error==='ROLLBACK_CONFLICT'?'Recovery required':'Rollback failed';live.textContent=rx.error||'ROLLBACK_FAILED';renderAudit();return}status.textContent='Rolled Back';live.textContent='Rolled back successfully';rollback.disabled=true;renderAudit()});actions.append(rollback)}).catch(()=>{});return box}`,
|
|
122
124
|
`function codemodPanel(f){const box=el('section','','codemod-panel');box.append(el('h3','Codemod Dry Run'),el('p','Analysis is read-only. Candidate application is isolated and never changes the original checkout.'));const state=el('p','Not analyzed','empty');const output=el('div','','codemod-output');const actions=el('div','','actions');const identity={findingId:f.id,sourcePath:f.path,inputDigest:d.inputDigest,policyDigest:d.policyDigest,schemaVersion:d.schemaVersion};const finding={...f};const dialog=(run)=>{const q=document.createElement('dialog');q.append(el('h3','Confirm Candidate Apply'),el('p','This writes only to the isolated candidate session. It does not modify the original checkout or approve the review.'));const cancel=el('button','Cancel'),confirm=el('button','Apply to Candidate');const row=el('div','','actions');row.append(cancel,confirm);q.append(row);cancel.onclick=()=>q.close();confirm.onclick=async()=>{confirm.disabled=true;cancel.disabled=true;q.close();await run()};document.body.append(q);q.addEventListener('close',()=>q.remove(),{once:true});q.showModal();confirm.focus()};const analyze=el('button','Analyze Transformation');analyze.onclick=()=>{state.textContent='Analyzing…';fetch(previewOrigin+'/review/codemod/analyze',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({finding})}).then(r=>r.ok?r.json():r.json().then(x=>Promise.reject(new Error(x.error||'ANALYSIS_FAILED')))).then(x=>{state.textContent='Analyzed: '+x.transformationId;output.replaceChildren(el('p','Source hash: '+x.sourceSha256),el('p','Transformation: '+x.transformationId),el('p',x.reason),el('pre',JSON.stringify(x.patch,null,2),'review-diff'));const apply=el('button','Apply to Candidate');apply.onclick=()=>dialog(async()=>{state.textContent='Applying to candidate…';fetch(previewOrigin+'/review/sessions/'+encodeURIComponent(reviewSession?.id||'')+'/codemod/apply',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({finding,confirmation:'CANDIDATE_APPLY_CONFIRMED',sourceSha256:x.sourceSha256})}).then(r=>r.ok?r.json():r.json().then(y=>Promise.reject(new Error(y.error||'CANDIDATE_APPLY_FAILED')))).then(y=>{state.textContent='Candidate-applied patch';output.append(el('p','Candidate hash: '+y.candidateSha256));const diff=el('pre','','review-diff');fetch(previewOrigin+'/review/sessions/'+encodeURIComponent(y.id)+'/diff').then(r=>r.json()).then(z=>{diff.textContent=z.diff;output.append(diff)});}).catch(error=>{state.textContent=error.message==='STALE_SOURCE'?'Stale source':'Candidate apply failed: '+error.message})});actions.append(apply)}).catch(error=>{state.textContent=error.message==='STALE_SOURCE'?'Stale source':'Unsupported or blocked: '+error.message})};box.append(state,output,actions,analyze);return box}`,
|
|
123
125
|
`function validationPanel(f){const box=el('section','','validation-panel');box.append(el('h3','Validation Results'),el('p','Current validation is distinct from archived evidence and review decisions.'));const state=el('p','Idle','validation-state'),output=el('div','','validation-output'),run=el('button','Run Validation'),archive=el('button','Archive Evidence');archive.disabled=true;const identity={findingId:f.id,sourcePath:f.path,inputDigest:d.inputDigest,policyDigest:d.policyDigest,schemaVersion:d.schemaVersion};const section=(title,content)=>{const q=el('details');q.open=true;q.append(el('summary',title),content);return q};run.onclick=()=>{if(!reviewSession?.id){state.textContent='Unavailable: create a candidate session first';return}state.textContent='Running';run.disabled=true;output.replaceChildren(el('p','Validation job running…','empty'));Promise.all([fetch(previewOrigin+'/review/codemod/analyze',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({finding:f})}),fetch(previewOrigin+'/review/sessions/'+encodeURIComponent(reviewSession.id))]).then(async([a,s])=>{const analyzed=await a.json(),session=await s.json();if(!a.ok||!analyzed.patch)throw new Error(analyzed.error||'ANALYSIS_FAILED');return fetch(previewOrigin+'/review/sessions/'+encodeURIComponent(session.id)+'/validate',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({finding:f,patch:analyzed.patch})})}).then(r=>r.ok?r.json():r.json().then(x=>Promise.reject(new Error(x.error||'VALIDATION_FAILED')))).then(x=>{const v=x.result;state.textContent=v.state;const scanner=el('div'); scanner.append(el('p','Completed: '+v.finishedAt));scanner.append(el('p','Scanner before: '+(v.scannerBefore.findingPresent?'finding present':'finding absent')+' · '+v.scannerBefore.resultDigest),el('p','Scanner after: '+(v.scannerAfter.findingPresent?'finding present':'finding absent')+' · '+v.scannerAfter.resultDigest));const browser=el('div');browser.append(el('p','Environment: '+v.environment.node+' · '+v.environment.viewport+' · '+v.environment.locale+' · '+v.environment.timezone),el('p','Original/Candidate LTR and RTL: '+(v.browserDomValidation.filter(x=>x.includes('ltr')||x.includes('rtl')).join('; ')||'No route results recorded')),el('p','DOM: '+(v.browserDomValidation.join('; ')||'None recorded')),el('p','Browser errors: '+(v.browserErrors.join('; ')||'None recorded')),el('p','Screenshots: '+(v.screenshotReferences.length?v.screenshotReferences.join(', '):'No screenshot artifacts recorded')));const identityView=el('dl','validation-identity');[['Job',v.jobId],['Original source hash',v.originalSourceSha256],['Candidate source hash',v.candidateSourceSha256],['Patch path',v.patch.path],['Patch range',v.patch.startOffset+'–'+v.patch.endOffset]].forEach(([k,val])=>{identityView.append(el('dt',k),el('dd',val))});output.replaceChildren(section('Scanner before / after',scanner),section('Browser, DOM and screenshots',browser),section('Source and patch identity',identityView));archive.disabled=v.state!=='Passed';archive.onclick=()=>fetch(previewOrigin+'/review/evidence',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({...identity,candidatePatchIdentity:{path:v.patch.path,expectedSha256:v.patch.expectedSha256,replacementSha256:null},originalSourceSha256:v.originalSourceSha256,candidateSourceSha256:v.candidateSourceSha256,codeDiff:'Validation result '+v.jobId,scannerBefore:v.scannerBefore,scannerAfter:v.scannerAfter,browserDomValidation:v.browserDomValidation,screenshotReferences:v.screenshotReferences,timestamp:v.finishedAt,decision:'Ready for Review',patch:v.patch})}).then(r=>{state.textContent=r.ok?'Evidence Archived':'Archive Failed'})}).catch(error=>{state.textContent=error.message;run.disabled=false;output.replaceChildren(el('p','Validation failed: '+error.message,'preview-unavailable'))})};box.append(state,output,run,archive);return box}`,
|
|
124
|
-
`function primaryReview(f){const flow=el('div','','primary-review-flow'),detailsCard=el('section','','review-section details-card'),diff=el('section','','review-section code-diff-card'),component=el('section','','review-section component-review'),decision=el('section','','review-section decision-card');flow.style.display='flex';flow.style.flexDirection='column';flow.style.gap='14px';[detailsCard,diff,component,decision].forEach(x=>{x.style.border='1px solid #263c5d';x.style.borderRadius='12px';x.style.padding='16px';x.style.background='#14243b'});detailsCard.append(el('h2','Why this change?'),el('p',f.title),el('p',f.rationale||'No additional explanation is available.'),el('div','Rule: '+f.ruleId+' · Severity: '+severityLabel(f.severity)+' · Confidence: '+f.confidence,'finding-meta'),el('p','Codemod Eligibility: '+f.eligibility,'eligibility-panel'));const snippet=rf.get(f.id),windowSource=snippet?.available?sn.get(snippet.sourceId):null,highlighted=windowSource?.lines.find(x=>x.highlighted)?.text||f.original||'Source unavailable',before=el('pre',highlighted,'before-code'),after=el('pre',f.suggestion?.value||(f.eligibilityTransformationId?'Candidate transformation: '+f.eligibilityTransformationId+' (analyze before applying)':'No verified suggested fix is available.'),'after-code');diff.append(el('h2','Before / After (Code)'),el('div','','diff-grid'));diff.lastChild.style.display='grid';diff.lastChild.style.gridTemplateColumns='minmax(0,1fr) auto minmax(0,1fr)';diff.lastChild.style.gap='10px';diff.lastChild.append(el('div','', 'before-card'),el('span','→','diff-arrow'),el('div','', 'after-card'));diff.lastChild.children[0].append(el('h3','Before'),before);diff.lastChild.children[2].append(el('h3','After (Suggested Fix)'),after);component.append(el('h2','Component Review (Live Review)'),el('p','Visual comparison is shown only when a validated candidate preview is available.','component-note'));if(!previewState.available)component.append(el('p','Live component preview unavailable. Start the local companion to enable a real LTR/RTL comparison.','preview-unavailable'));else component.append(el('div','LTR / RTL preview controls are available from the owning route preview.','component-available'));decision.append(el('h2','Decision'),decisionPanel(f),reviewWorkspace(f));flow.append(detailsCard,diff,component,decision);return flow}`,
|
|
126
|
+
`function primaryReview(f){if(f.ruleId==='RTL.DOCUMENT.INITIAL'||f.ruleId==='RTL.RUNTIME.DIRECTION_UNKNOWN'){const flow=el('section','','direction-information'),initial=f.ruleId==='RTL.DOCUMENT.INITIAL';flow.append(el('h2',initial?'Initial HTML direction':'Direction unresolved by static analysis'),el('p',initial?'This is a source fact, not a detected defect. The application may change direction after load.':'A dynamic direction expression is not inherently incorrect. Static analysis cannot determine every runtime state.'),el('h3','Source'),el('pre',f.original||'Source unavailable'),el('p',initial?'No fix or approval is required for this informational item.':'No automatic code change is suggested merely because direction is dynamic. Runtime observations describe only the inspected state, not all application states.'),el('p',f.limitation||''));const preview=el('p','Checking preview mapping…','direction-preview-status');flow.append(preview);const query=new URLSearchParams({inputDigest:d.inputDigest,policyDigest:d.policyDigest,findingId:f.id,mode:'ltr'});fetch(previewOrigin+'/contextual-preview?'+query).then(r=>r.ok?r.json():Promise.reject()).then(info=>{if(!flow.isConnected)return;preview.textContent=info.route?'Page context configured for '+info.route.application+' · '+info.route.path+'; this is not a verified mapping to the source fact.':'No mapped preview for this finding.'}).catch(()=>{if(flow.isConnected)preview.textContent='Preview mapping unavailable; start the local companion to check it.'});return flow}const flow=el('div','','primary-review-flow'),detailsCard=el('section','','review-section details-card'),diff=el('section','','review-section code-diff-card'),component=el('section','','review-section component-review'),decision=el('section','','review-section decision-card');flow.style.display='flex';flow.style.flexDirection='column';flow.style.gap='14px';[detailsCard,diff,component,decision].forEach(x=>{x.style.border='1px solid #263c5d';x.style.borderRadius='12px';x.style.padding='16px';x.style.background='#14243b'});detailsCard.append(el('h2','Why this change?'),el('p',f.title),el('p',f.rationale||'No additional explanation is available.'),el('div','Rule: '+f.ruleId+' · Severity: '+severityLabel(f.severity)+' · Confidence in static evidence: '+f.confidence,'finding-meta'),el('p',f.ruleId==='RTL.CSS.PHYSICAL'?'A physical declaration is a context-dependent review item, not proof of an RTL defect. Confidence describes the static source match, not visual correctness. Compare every affected element, including local direction overrides; a logical replacement can be equivalent, desirable, or incorrect depending on intent.':'Confidence describes the strength of static evidence, not verified visual correctness.','finding-confidence-note'),el('p','Codemod Eligibility: '+f.eligibility,'eligibility-panel'));const snippet=rf.get(f.id),windowSource=snippet?.available?sn.get(snippet.sourceId):null,highlighted=windowSource?.lines.find(x=>x.highlighted)?.text||f.original||'Source unavailable',before=el('pre',highlighted,'before-code'),after=el('pre',f.suggestion?.value||(f.eligibilityTransformationId?'Candidate transformation: '+f.eligibilityTransformationId+' (analyze before applying)':'No verified suggested fix is available.'),'after-code');diff.append(el('h2','Before / After (Code)'),el('div','','diff-grid'));diff.lastChild.style.display='grid';diff.lastChild.style.gridTemplateColumns='minmax(0,1fr) auto minmax(0,1fr)';diff.lastChild.style.gap='10px';diff.lastChild.append(el('div','', 'before-card'),el('span','→','diff-arrow'),el('div','', 'after-card'));diff.lastChild.children[0].append(el('h3','Before'),before);diff.lastChild.children[2].append(el('h3',f.suggestion?.value?(f.ruleId==='RTL.CSS.PHYSICAL'?'After (Proposed Change)':'After (Suggested Fix)'):'After (No verified suggested fix)'),after);component.append(el('h2','Component Review (Live Review)'),el('p','Visual comparison is shown only when a validated candidate preview is available.','component-note'));if(!previewState.available)component.append(el('p','Live component preview unavailable. Start the local companion to enable a real LTR/RTL comparison.','preview-unavailable'));else component.append(el('div','LTR / RTL preview controls are available from the owning route preview.','component-available'));decision.append(el('h2','Decision'),decisionPanel(f),reviewWorkspace(f));flow.append(detailsCard,diff,component,decision);return flow}`,
|
|
125
127
|
`if(!f){details.append(el('p',sourceContext?.selection?.reason||'Select a finding to view details.','empty'));`,
|
|
126
128
|
`return}details.append(el('h2',f.title));`,
|
|
127
|
-
`const a=el('div','','actions'),back=el('button','← Back to Findings','mobile-back');back.type='button';back.onclick=()=>{document.querySelector('.finding-list')?.scrollIntoView({behavior:'smooth'});document.querySelector('.finding-list .finding.selected')?.focus()};const ordered=vis(),at=ordered.findIndex(x=>x.id===f.id),prev=el('button','Previous finding'),next=el('button','Next finding');prev.disabled=at<=0;next.disabled=at<0||at>=ordered.length-1;prev.onclick=()=>select(ordered[at-1].id);next.onclick=()=>select(ordered[at+1].id);a.append(back,prev,next);`,
|
|
129
|
+
`const a=el('div','','actions'),back=el('button','← Back to Findings','mobile-back');back.type='button';back.onclick=()=>{document.querySelector('.finding-list')?.scrollIntoView({behavior:'smooth'});document.querySelector('.finding-list .finding.selected')?.focus()};const ordered=vis(),at=ordered.findIndex(x=>x.id===f.id),prev=el('button','Previous finding'),next=el('button','Next finding');prev.className='review-previous';next.className='review-next';prev.disabled=at<=0;next.disabled=at<0||at>=ordered.length-1;prev.onclick=()=>select(ordered[at-1].id);next.onclick=()=>select(ordered[at+1].id);a.append(back,prev,next);`,
|
|
128
130
|
`[['Copy relative path',f.path],['Copy location',f.path+':'+f.line+':'+f.column]].forEach(x=>{const q=el('button',x[0]);`,
|
|
129
131
|
`q.onclick=()=>navigator.clipboard?.writeText(x[1]);`,
|
|
130
132
|
`a.append(q)});`,
|
|
131
|
-
`details.append(a);details.append(primaryReview(f));details.append(el('details','','operational-details'));details.lastChild.open=false;details.lastChild.append(el('summary','Validation, archived evidence, and rollback'));const operational=details.lastChild;recoverEvidence(f,operational);if(f.eligibilityTransformationId==='bidi-isolate-auto'){operational.append(codemodPanel(f));operational.append(validationPanel(f))}operational.append(controlledApplyPanel(f));`,
|
|
133
|
+
`details.append(a);details.append(primaryReview(f));if(f.ruleId==='RTL.DOCUMENT.INITIAL'||f.ruleId==='RTL.RUNTIME.DIRECTION_UNKNOWN')return;details.append(el('details','','operational-details'));details.lastChild.open=false;details.lastChild.append(el('summary','Validation, archived evidence, and rollback'));const operational=details.lastChild;recoverEvidence(f,operational);if(f.eligibilityTransformationId==='bidi-isolate-auto'){operational.append(codemodPanel(f));operational.append(validationPanel(f))}operational.append(controlledApplyPanel(f));`,
|
|
132
134
|
`if(f.previewMappingId){const box=el('div','','preview-box');box.append(el('strong','Owning Route Preview'),el('p','Open the real Invoicing application route.'));const buttons=el('div','','actions');[['Open LTR Preview','ltr'],['Open RTL Preview','rtl']].forEach(x=>{const q=el('button',x[0]);q.disabled=!previewState.available;q.title=previewState.available?'Open validated preview':'Local preview unavailable';q.onclick=()=>fetch(previewOrigin+'/mappings/'+encodeURIComponent(f.previewMappingId)+'/preview?mode='+x[1]).then(r=>r.ok?r.json():Promise.reject()).then(info=>window.open(info.url,'_blank','noopener,noreferrer')).catch(()=>previewUnavailable(box));buttons.append(q)});box.append(buttons);details.append(box);if(!previewState.available)previewUnavailable(box)}`,
|
|
133
135
|
`[['Rule',f.ruleId],['Severity',severityLabel(f.severity)+' ('+f.severity+')'],['Category',f.category],['Confidence',f.confidence],['Location',f.path+':'+f.line+':'+f.column],['Owner',f.owner],['Rationale',f.rationale],['Treatment',f.treatment],['Limitation',f.limitation]].forEach(x=>details.append(el('h3',x[0]),b(x[1])))}function select(id){const f=by.get(id);`,
|
|
134
|
-
`if(!f)return;`,
|
|
136
|
+
`if(!f)return;const pagePosition={x:scrollX,y:scrollY};const previousCompare=details.querySelector('.component-compare');if(previousCompare&&!previousCompare.closest('.embedded-expanded'))sp.style.setProperty('--review-preview-min-height',previousCompare.getBoundingClientRect().height+'px');`,
|
|
135
137
|
`s.file=f.path;`,
|
|
136
138
|
`s.finding=f;`,
|
|
137
139
|
`treeRender();`,
|
|
138
140
|
`listRender();`,
|
|
139
141
|
`source(f);writeUrl();`,
|
|
140
|
-
`detail(f)}function selectFile(path){s.file=path;`,
|
|
142
|
+
`detail(f);scrollTo(pagePosition.x,pagePosition.y);requestAnimationFrame(()=>scrollTo(pagePosition.x,pagePosition.y))}window.addEventListener('rtl-dashboard-select',event=>{if(event.detail&&by.has(event.detail))select(event.detail)});function selectFile(path){s.file=path;`,
|
|
141
143
|
`const f=vis()[0]||null;`,
|
|
142
144
|
`s.finding=f;`,
|
|
143
145
|
`treeRender();`,
|
|
@@ -156,9 +158,9 @@ try{const params=new URLSearchParams({inputDigest:dashboardSnapshot.inputDigest,
|
|
|
156
158
|
`const writeUrl=()=>{const p=new URLSearchParams();if(s.q)p.set('q',s.q);if(s.app!=='all')p.set('app',s.app);if(s.severity!=='all')p.set('severity',s.severity);if(s.status!=='all')p.set('status',s.status);if(s.eligibility!=='all')p.set('eligibility',s.eligibility);if(s.category!=='all')p.set('category',s.category);if(s.sort!=='path')p.set('sort',s.sort);if(s.finding?.id)p.set('finding',s.finding.id);const next='?'+p.toString();if(location.search!==next)history.pushState(null,'',next)};`,
|
|
157
159
|
`const readUrl=()=>{const p=new URLSearchParams(location.search);s.q=p.get('q')||'';s.app=p.get('app')||'all';s.severity=p.get('severity')||'all';s.status=p.get('status')||'all';s.eligibility=p.get('eligibility')||'all';s.category=p.get('category')||'all';s.sort=p.get('sort')||'path';search.value=s.q;sel.value=s.app;severityFilter.value=s.severity;statusFilter.value=s.status;eligibilityFilter.value=s.eligibility;categoryFilter.value=s.category;sortFilter.value=s.sort;return p.get('finding')};`,
|
|
158
160
|
`search.oninput=()=>{s.q=search.value;writeUrl();refresh()};`,
|
|
159
|
-
`window.onpopstate=()=>{const id=readUrl();if(id&&by.has(id)){
|
|
160
|
-
`function showWorkflowScreen(){app.hidden=true;document.body.style.overflow='hidden';document.querySelector('.workflow-screen')?.remove();const screen=document.createElement('main');screen.className='workflow-screen';Object.assign(screen.style,{position:'fixed',inset:'0',zIndex:'100',overflow:'auto',background:'radial-gradient(circle at 50% 35%,#1b2245 0,#0d1228 48%,#080d1d 100%)',color:'#f5f7ff',fontFamily:'Inter,ui-sans-serif,system-ui,sans-serif'});const header=document.createElement('header');Object.assign(header.style,{minHeight:'72px',display:'flex',alignItems:'center',gap:'28px',padding:'10px 44px',boxSizing:'border-box',borderBottom:'1px solid #465276',background:'linear-gradient(180deg,#121a36,#0c1328)',flexWrap:'wrap'});const brand=el('div','','workflow-brand');brand.innerHTML='<span style="display:grid;place-items:center;width:44px;height:44px;border-radius:12px;background:linear-gradient(145deg,#984cff,#4d1cab);font-size:19px;font-weight:900"></></span><strong style="font-size:26px;letter-spacing:-.5px">RTL Analyzer — Fix Studio</strong>';Object.assign(brand.style,{display:'flex',alignItems:'center',gap:'16px'});const project=el('button','▣ invoicing-app ⌄');Object.assign(project.style,{padding:'10px 18px',border:'1px solid #68769d',borderRadius:'12px',background:'#17213e',color:'#f5f7ff',fontSize:'16px',fontWeight:'700'});const scan=el('div','','workflow-scan');scan.innerHTML='<span style="display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:#19b86b;color:#071b18;font-weight:900">✓</span><span><strong>Scan complete</strong><small>Analyzed '+d.filesAnalyzed+' files</small></span>';Object.assign(scan.style,{display:'flex',alignItems:'center',gap:'10px',fontSize:'16px'});scan.querySelector('small').style.display='block';scan.querySelector('small').style.color='#b8c2dc';const findingCount=el('button',(d.findings||0)+' findings ⚙');Object.assign(findingCount.style,{marginLeft:'auto',padding:'12px 20px',border:'1px solid #68769d',borderRadius:'12px',background:'#17213e',color:'#f5f7ff',fontSize:'16px',fontWeight:'800'});header.append(brand,project,scan,findingCount);const content=document.createElement('section');Object.assign(content.style,{maxWidth:'1400px',margin:'0 auto',padding:'54px 28px 34px',boxSizing:'border-box'});const hero=el('div','','workflow-hero');hero.innerHTML='<div style="margin:auto;width:94px;height:72px;border:3px solid #a66cff;border-radius:16px;display:grid;place-items:center;color:#c69cff;font-size:25px;font-weight:900;box-shadow:0 0 35px #854fff66"></></div><h1 id="workflow-title">How would you like to review fixes?</h1><p>Choose a workflow before opening Fix Studio. You can change it later.</p>';Object.assign(hero.style,{textAlign:'center'});hero.querySelector('h1').style.cssText='margin:16px 0 8px;font-size:50px;line-height:1.12;letter-spacing:-1.5px';hero.querySelector('p').style.cssText='margin:0;color:#c4cce2;font-size:24px';const options=el('div','','workflow-options');Object.assign(options.style,{display:'grid',gridTemplateColumns:'repeat(2,minmax(0,1fr))',gap:'34px',marginTop:'44px'});const makeCard=(kind,title,icon,copy,badges,buttonText,action)=>{const card=el('article','','workflow-card');Object.assign(card.style,{minHeight:'378px',boxSizing:'border-box',padding:'28px 38px 32px',border:'2px solid '+(kind==='one'?'#a05cff':'#455579'),borderRadius:'22px',background:kind==='one'?'linear-gradient(145deg,#30205b,#151b38)':'linear-gradient(145deg,#18243f,#111a31)',boxShadow:kind==='one'?'0 0 28px #8952ff55':'none',display:'flex',flexDirection:'column'});const top=el('div','','workflow-card-top');top.innerHTML='<span style="display:grid;place-items:center;width:80px;height:76px;border-radius:17px;background:'+(kind==='one'?'#47247d':'#4b4431')+';font-size:38px">'+icon+'</span><h2>'+title+'</h2><span class="workflow-radio" aria-hidden="true">'+(kind==='one'?'◉':'○')+'</span>';Object.assign(top.style,{display:'grid',gridTemplateColumns:'80px 1fr 38px',alignItems:'center',gap:'20px'});top.querySelector('h2').style.cssText='margin:0;font-size:28px;line-height:1.15';top.querySelector('.workflow-radio').style.cssText='font-size:40px;color:'+(kind==='one'?'#fff':'#c5cde1');const desc=el('p',copy);desc.style.cssText='margin:20px 0 24px;font-size:19px;line-height:1.42;color:#f0f2fb;max-width:620px';const badgesBox=el('div','','workflow-badges');badges.forEach(x=>{const b=el('span','◈ '+x);b.style.cssText='display:inline-block;margin-right:16px;padding:11px 20px;border-radius:12px;background:#354266;color:#f4f5ff;font-size:16px;font-weight:700'});badgesBox.append(...badgesBox.children);badges.forEach(x=>{const b=el('span','◈ '+x);b.style.cssText='display:inline-block;margin-right:16px;padding:11px 20px;border-radius:12px;background:#354266;color:#f4f5ff;font-size:16px;font-weight:700';badgesBox.append(b)});const divider=document.createElement('hr');divider.style.cssText='width:100%;border:0;border-top:1px solid #526182;margin:25px 0 26px';const actionButton=el('button','▷ '+buttonText);Object.assign(actionButton.style,{marginTop:'auto',minHeight:'66px',borderRadius:'14px',border:'2px solid '+(kind==='one'?'#a45cff':'#7381a8'),background:kind==='one'?'linear-gradient(90deg,#7840ed,#873dff)':'transparent',color:'#fff',fontSize:'22px',fontWeight:'800',cursor:'pointer'});actionButton.onclick=action;card.append(top,desc,badgesBox,divider,actionButton);card.onclick=e=>{if(e.target!==actionButton){options.querySelectorAll('.workflow-card').forEach(x=>x.style.borderColor='#455579');card.style.borderColor='#a05cff'}};return card};const scopeLabel=el('label','Review scope: '),scopeSelect=document.createElement('select');scopeSelect.setAttribute('aria-label','Review scope');['all','invoicing','procurement'].forEach(x=>scopeSelect.append(new Option(x==='all'?'All scanned files':x,x)));scopeLabel.append(scopeSelect);content.append(scopeLabel);const commit=mode=>{localStorage.setItem('rtl-review-workflow',mode);screen.remove();app.hidden=false;document.body.style.overflow='';srLive.textContent=mode==='apply-first'?'Prepare all, then review selected. Candidate review is available from the finding.':'Review one by one selected.';window.dispatchEvent(new CustomEvent('rtl-review-workflow-entered',{detail:{mode,scope:scopeSelect.value==='all'?[]:all.filter(f=>f.applications.includes(scopeSelect.value)).map(f=>f.path).filter((p,i,a)=>a.indexOf(p)===i)}}))};options.append(makeCard('apply','Prepare all, then review','⚡','Prepare supported fixes together in an isolated candidate. Explicitly approve selected fixes, validate accepted changes, then Apply to source.',['Candidate only','Tests & rollback'],'Prepare all & review',()=>commit('apply-first')),makeCard('one','Review one by one','◉','Inspect each finding, compare before and after, and decide before applying.',['Manual control','Before / After'],'Start manual review',()=>commit('one-by-one')));const reassurance=el('div','','workflow-reassurance');reassurance.innerHTML='<span style="font-size:27px;color:#86d9ff">♢</span><span>Your original project files remain unchanged until you explicitly approve applying changes.</span>';Object.assign(reassurance.style,{maxWidth:'1070px',margin:'38px auto 0',padding:'16px 34px',display:'flex',justifyContent:'center',alignItems:'center',gap:'18px',border:'2px solid #416394',borderRadius:'14px',background:'#1a294b',fontSize:'20px'});const more=el('button','ⓘ What happens in each mode?');more.style.cssText='display:block;margin:26px auto 0;border:0;background:transparent;color:#c49cff;text-decoration:underline;font-size:18px;cursor:pointer';const explanation=el('p','Review one by one previews each finding. Prepare all, then review prepares supported fixes together in isolation. Both require explicit approval, accepted-candidate validation and source Apply; preparation never changes original source.');explanation.hidden=true;explanation.style.cssText='max-width:700px;margin:12px auto;color:#c4cce2;text-align:center';more.onclick=()=>{explanation.hidden=!explanation.hidden};content.append(hero,options,reassurance,more,explanation);screen.append(header,content);window.addEventListener('resize',()=>{options.style.gridTemplateColumns=innerWidth<900?'1fr':'repeat(2,minmax(0,1fr))';hero.querySelector('h1').style.fontSize=innerWidth<900?'34px':'50px'},{once:true});if(sourceContextError)screen.append(el('p','Source context blocked: '+sourceContextError,'source-context-status'));document.body.append(screen)}workflowButton.onclick=showWorkflowScreen;const requested=readUrl();setTimeout(()=>{if(pendingSourceTransition||localStorage.getItem('rtl-review-workflow')){if(!sourceContextError)sessionStorage.removeItem('rtl-source-transition');app.hidden=false}else showWorkflowScreen();const reconciled=sourceContext?.selection?.findingId||requested;if(reconciled&&by.has(reconciled))select(reconciled);else if(d.explorer.initialFindingId)select(d.explorer.initialFindingId);else refresh()},0);`,
|
|
161
|
-
`function polishWorkflowScreen(){const screen=document.querySelector('.workflow-screen');if(!screen||screen.dataset.polished)return;screen.dataset.polished='true';const style=document.createElement('style');style.textContent='.workflow-screen .workflow-card{transition:border-color .16s ease,background .16s ease,box-shadow .16s ease}.workflow-screen .workflow-card.workflow-selected{border-color:#a05cff!important;background:linear-gradient(145deg,#30205b,#151b38)!important;box-shadow:0 0 28px #8952ff55!important}.workflow-screen .workflow-card:focus-visible{outline:3px solid #d8c2ff;outline-offset:4px;box-shadow:0 0 0 6px #7b4fd755!important}.workflow-screen .workflow-card .workflow-radio{font-size:0}.workflow-screen .workflow-card .workflow-radio:before{content:"";display:block;width:22px;height:22px;border:2px solid #c5cde1;border-radius:50%}.workflow-screen .workflow-card.workflow-selected .workflow-radio:before{border-color:#fff;box-shadow:inset 0 0 0 5px #a05cff,0 0 0 2px #fff}.workflow-screen .workflow-card p{font-weight:400}.workflow-screen .workflow-badges span{font-weight:500}.workflow-screen .workflow-card h2,.workflow-screen .workflow-card button{font-weight:700}';screen.append(style);const icons={eye:'<svg viewBox="0 0 32 24" aria-hidden="true"><path d="M2 12s4.2-8 14-8 14 8 14 8-4.2 8-14 8S2 12 2 12Z" fill="none" stroke="currentColor" stroke-width="2.2"/><circle cx="16" cy="12" r="4" fill="none" stroke="currentColor" stroke-width="2.2"/><path d="M21 20h7M24 17v6" stroke="currentColor" stroke-width="2"/></svg>',layers:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m12 3 9 5-9 5-9-5 9-5Zm-7 9 7 4 7-4m-14 5 7 4 7-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/></svg>',shield:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3 20 6v5c0 5-3.4 8.3-8 10-4.6-1.7-8-5-8-10V6l8-3Z" fill="none" stroke="currentColor" stroke-width="2"/><path d="m8 12 2.5 2.5L16 9" fill="none" stroke="currentColor" stroke-width="2"/></svg>',sliders:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16M4 17h16M8 4v6M16 14v6" stroke="currentColor" stroke-width="2"/><circle cx="8" cy="7" r="2" fill="#354266" stroke="currentColor" stroke-width="2"/><circle cx="16" cy="17" r="2" fill="#354266" stroke="currentColor" stroke-width="2"/></svg>',compare:'<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="10" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><rect x="11" y="5" width="10" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/></svg>',play:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m8 5 11 7-11 7V5Z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/></svg>'};const cards=[...screen.querySelectorAll('.workflow-card')];cards.forEach((card,index)=>{card.tabIndex=0;card.setAttribute('role','radio');card.setAttribute('aria-checked',index===1?'true':'false');card.classList.toggle('workflow-selected',index===1);const top=card.querySelector('.workflow-card-top span');if(top){top.innerHTML=index===1?icons.eye:'<span aria-hidden="true" style="font-size:38px">⚡</span>';top.firstElementChild?.setAttribute('focusable','false');top.querySelector('svg')?.setAttribute('style','width:48px;height:42px;color:#fff')};const badgeIcons=index===1?[icons.sliders,icons.compare]:[icons.layers,icons.shield];card.querySelectorAll('.workflow-badges span').forEach((badge,i)=>{const label=badge.textContent?.replace(/^◈\s*/,'')||'';badge.innerHTML=badgeIcons[i]+'<span>'+label+'</span>';badge.firstElementChild?.setAttribute('style','width:20px;height:20px;vertical-align:middle;margin-right:8px');});const action=card.querySelector('button');if(action){const label=action.textContent?.replace(/^▷\s*/,'')||'';action.innerHTML=icons.play+'<span>'+label+'</span>';action.firstElementChild?.setAttribute('style','width:22px;height:22px;vertical-align:middle;margin-right:10px')};const select=()=>{cards.forEach((other,i)=>{other.classList.toggle('workflow-selected',other===card);other.setAttribute('aria-checked',other===card?'true':'false');const radio=other.querySelector('.workflow-radio');if(radio){radio.textContent='';radio.setAttribute('aria-label',other===card?'Selected':'Not selected')}})};card.addEventListener('click',e=>{if(e.target instanceof Element&&e.target.closest('button')===card.querySelector('button'))return;select()});card.addEventListener('keydown',e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();select()}})});const reassurance=screen.querySelector('.workflow-reassurance');if(reassurance){reassurance.replaceChildren();reassurance.insertAdjacentHTML('afterbegin',icons.shield+'<span>
|
|
161
|
+
`window.onpopstate=()=>{const id=readUrl();if(id&&by.has(id)){select(id);return}refresh()};`,
|
|
162
|
+
`function showWorkflowScreen(){app.hidden=true;document.body.style.overflow='hidden';document.querySelector('.workflow-screen')?.remove();const screen=document.createElement('main');screen.className='workflow-screen';Object.assign(screen.style,{position:'fixed',inset:'0',zIndex:'100',overflow:'auto',background:'radial-gradient(circle at 50% 35%,#1b2245 0,#0d1228 48%,#080d1d 100%)',color:'#f5f7ff',fontFamily:'Inter,ui-sans-serif,system-ui,sans-serif'});const header=document.createElement('header');Object.assign(header.style,{minHeight:'72px',display:'flex',alignItems:'center',gap:'28px',padding:'10px 44px',boxSizing:'border-box',borderBottom:'1px solid #465276',background:'linear-gradient(180deg,#121a36,#0c1328)',flexWrap:'wrap'});const brand=el('div','','workflow-brand');brand.innerHTML='<span style="display:grid;place-items:center;width:44px;height:44px;border-radius:12px;background:linear-gradient(145deg,#984cff,#4d1cab);font-size:19px;font-weight:900"></></span><strong style="font-size:26px;letter-spacing:-.5px">RTL Analyzer — Fix Studio</strong>';Object.assign(brand.style,{display:'flex',alignItems:'center',gap:'16px'});const project=el('span','▣ Current project');fetch(previewOrigin+'/health').then(r=>r.ok?r.json():Promise.reject()).then(info=>{if(info.application)project.textContent='▣ '+info.application}).catch(()=>{});Object.assign(project.style,{padding:'10px 18px',border:'1px solid #68769d',borderRadius:'12px',background:'#17213e',color:'#f5f7ff',fontSize:'16px',fontWeight:'700'});const scan=el('div','','workflow-scan');scan.innerHTML='<span style="display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:#19b86b;color:#071b18;font-weight:900">✓</span><span><strong>Scan complete</strong><small>Analyzed '+d.filesAnalyzed+' files</small></span>';Object.assign(scan.style,{display:'flex',alignItems:'center',gap:'10px',fontSize:'16px'});scan.querySelector('small').style.display='block';scan.querySelector('small').style.color='#b8c2dc';const findingCount=el('button',(d.findings||0)+' findings ⚙');Object.assign(findingCount.style,{marginLeft:'auto',padding:'12px 20px',border:'1px solid #68769d',borderRadius:'12px',background:'#17213e',color:'#f5f7ff',fontSize:'16px',fontWeight:'800'});header.append(brand,project,scan,findingCount);const content=document.createElement('section');Object.assign(content.style,{maxWidth:'1400px',margin:'0 auto',padding:'54px 28px 34px',boxSizing:'border-box'});const hero=el('div','','workflow-hero');hero.innerHTML='<div style="margin:auto;width:94px;height:72px;border:3px solid #a66cff;border-radius:16px;display:grid;place-items:center;color:#c69cff;font-size:25px;font-weight:900;box-shadow:0 0 35px #854fff66"></></div><h1 id="workflow-title">How would you like to review fixes?</h1><p>Choose a workflow before opening Fix Studio. You can change it later.</p>';Object.assign(hero.style,{textAlign:'center'});hero.querySelector('h1').style.cssText='margin:16px 0 8px;font-size:50px;line-height:1.12;letter-spacing:-1.5px';hero.querySelector('p').style.cssText='margin:0;color:#c4cce2;font-size:24px';const options=el('div','','workflow-options');Object.assign(options.style,{display:'grid',gridTemplateColumns:'repeat(2,minmax(0,1fr))',gap:'34px',marginTop:'44px'});const makeCard=(kind,title,icon,copy,badges,buttonText,action)=>{const card=el('article','','workflow-card');Object.assign(card.style,{minHeight:'378px',boxSizing:'border-box',padding:'28px 38px 32px',border:'2px solid '+(kind==='one'?'#a05cff':'#455579'),borderRadius:'22px',background:kind==='one'?'linear-gradient(145deg,#30205b,#151b38)':'linear-gradient(145deg,#18243f,#111a31)',boxShadow:kind==='one'?'0 0 28px #8952ff55':'none',display:'flex',flexDirection:'column'});const top=el('div','','workflow-card-top');top.innerHTML='<span style="display:grid;place-items:center;width:80px;height:76px;border-radius:17px;background:'+(kind==='one'?'#47247d':'#4b4431')+';font-size:38px">'+icon+'</span><h2>'+title+'</h2><span class="workflow-radio" aria-hidden="true">'+(kind==='one'?'◉':'○')+'</span>';Object.assign(top.style,{display:'grid',gridTemplateColumns:'80px 1fr 38px',alignItems:'center',gap:'20px'});top.querySelector('h2').style.cssText='margin:0;font-size:28px;line-height:1.15';top.querySelector('.workflow-radio').style.cssText='font-size:40px;color:'+(kind==='one'?'#fff':'#c5cde1');const desc=el('p',copy);desc.style.cssText='margin:20px 0 24px;font-size:19px;line-height:1.42;color:#f0f2fb;max-width:620px';const badgesBox=el('div','','workflow-badges');badges.forEach(x=>{const b=el('span','◈ '+x);b.style.cssText='display:inline-block;margin-right:16px;padding:11px 20px;border-radius:12px;background:#354266;color:#f4f5ff;font-size:16px;font-weight:700'});badgesBox.append(...badgesBox.children);badges.forEach(x=>{const b=el('span','◈ '+x);b.style.cssText='display:inline-block;margin-right:16px;padding:11px 20px;border-radius:12px;background:#354266;color:#f4f5ff;font-size:16px;font-weight:700';badgesBox.append(b)});const divider=document.createElement('hr');divider.style.cssText='width:100%;border:0;border-top:1px solid #526182;margin:25px 0 26px';const actionButton=el('button','▷ '+buttonText);Object.assign(actionButton.style,{marginTop:'auto',minHeight:'66px',borderRadius:'14px',border:'2px solid '+(kind==='one'?'#a45cff':'#7381a8'),background:kind==='one'?'linear-gradient(90deg,#7840ed,#873dff)':'transparent',color:'#fff',fontSize:'22px',fontWeight:'800',cursor:'pointer'});actionButton.onclick=action;card.append(top,desc,badgesBox,divider,actionButton);card.onclick=e=>{if(e.target!==actionButton){options.querySelectorAll('.workflow-card').forEach(x=>x.style.borderColor='#455579');card.style.borderColor='#a05cff'}};return card};const scopeLabel=el('label','Review scope: '),scopeSelect=document.createElement('select');scopeSelect.setAttribute('aria-label','Review scope');['all',...[...new Set(all.flatMap(f=>f.applications||[]))].sort()].forEach(x=>scopeSelect.append(new Option(x==='all'?'All scanned files':x,x)));scopeLabel.append(scopeSelect);content.append(scopeLabel);const commit=mode=>{const restart=!!window.rtlEntryPending;localStorage.setItem('rtl-review-workflow',mode);screen.remove();app.hidden=false;document.body.style.overflow='';srLive.textContent=mode==='apply-first'?'Prepare all, then review selected. Candidate review is available from the finding.':'Review one by one selected.';window.dispatchEvent(new CustomEvent('rtl-review-workflow-entered',{detail:{mode,restart,scope:scopeSelect.value==='all'?[]:all.filter(f=>f.applications.includes(scopeSelect.value)).map(f=>f.path).filter((p,i,a)=>a.indexOf(p)===i)}}))};options.append(makeCard('apply','Prepare all, then review','⚡','Prepare supported fixes together in an isolated candidate. Explicitly approve selected fixes, validate accepted changes, then Apply to source.',['Candidate only','Tests & rollback'],'Prepare all & review',()=>commit('apply-first')),makeCard('one','Review one by one','◉','Inspect each finding, compare before and after, and decide before applying.',['Manual control','Before / After'],'Start manual review',()=>commit('one-by-one')));const reassurance=el('div','','workflow-reassurance');reassurance.innerHTML='<span style="font-size:27px;color:#86d9ff">♢</span><span>Preparation happens in an isolated candidate. Original files change only through the separate explicit Apply step.</span>';Object.assign(reassurance.style,{maxWidth:'1070px',margin:'38px auto 0',padding:'16px 34px',display:'flex',justifyContent:'center',alignItems:'center',gap:'18px',border:'2px solid #416394',borderRadius:'14px',background:'#1a294b',fontSize:'20px'});const more=el('button','ⓘ What happens in each mode?');more.style.cssText='display:block;margin:26px auto 0;border:0;background:transparent;color:#c49cff;text-decoration:underline;font-size:18px;cursor:pointer';const explanation=el('p','Review one by one previews each finding. Prepare all, then review prepares supported fixes together in isolation. Both require explicit approval, accepted-candidate validation and source Apply; preparation never changes original source.');explanation.hidden=true;explanation.style.cssText='max-width:700px;margin:12px auto;color:#c4cce2;text-align:center';more.onclick=()=>{explanation.hidden=!explanation.hidden};const current=window.rtlReviewModeState?.(),modeStatus=el('p',current?'Existing review: '+current.label+' · Status: '+current.state+'. Decisions and drafts are preserved. Starting a new review keeps the previous review in history; source files do not change.':'No active review session. Choose a review mode.','workflow-mode-status');modeStatus.setAttribute('role','status');content.append(hero,modeStatus,el('h2','Start a new review'),options,reassurance,more,explanation);if(current){const cancel=el('button',window.rtlEntryPending?(current.state==='Reviewing'?'Resume existing review':'View completed review'):'Return to current review');cancel.onclick=()=>{screen.remove();app.hidden=false;document.body.style.overflow='';window.dispatchEvent(new CustomEvent('rtl-review-resume'));workflowButton.focus()};content.prepend(cancel)}screen.append(header,content);document.dispatchEvent(new Event('rtl-workflow-screen-ready'));window.addEventListener('resize',()=>{options.style.gridTemplateColumns=innerWidth<900?'1fr':'repeat(2,minmax(0,1fr))';hero.querySelector('h1').style.fontSize=innerWidth<900?'34px':'50px'},{once:true});if(sourceContextError)screen.append(el('p','Source context blocked: '+sourceContextError,'source-context-status'));document.body.append(screen)}workflowButton.onclick=showWorkflowScreen;const requested=readUrl();setTimeout(()=>{if(pendingSourceTransition){if(!sourceContextError)sessionStorage.removeItem('rtl-source-transition');app.hidden=false}else showWorkflowScreen();const reconciled=sourceContext?.selection?.findingId||requested;if(reconciled&&by.has(reconciled))select(reconciled);else if(d.explorer.initialFindingId)select(d.explorer.initialFindingId);else refresh()},0);`,
|
|
163
|
+
`function polishWorkflowScreen(){const screen=document.querySelector('.workflow-screen');if(!screen||screen.dataset.polished)return;screen.dataset.polished='true';const style=document.createElement('style');style.textContent='.workflow-screen .workflow-card{transition:border-color .16s ease,background .16s ease,box-shadow .16s ease}.workflow-screen .workflow-card.workflow-selected{border-color:#a05cff!important;background:linear-gradient(145deg,#30205b,#151b38)!important;box-shadow:0 0 28px #8952ff55!important}.workflow-screen .workflow-card:focus-visible{outline:3px solid #d8c2ff;outline-offset:4px;box-shadow:0 0 0 6px #7b4fd755!important}.workflow-screen .workflow-card .workflow-radio{font-size:0}.workflow-screen .workflow-card .workflow-radio:before{content:"";display:block;width:22px;height:22px;border:2px solid #c5cde1;border-radius:50%}.workflow-screen .workflow-card.workflow-selected .workflow-radio:before{border-color:#fff;box-shadow:inset 0 0 0 5px #a05cff,0 0 0 2px #fff}.workflow-screen .workflow-card p{font-weight:400}.workflow-screen .workflow-badges span{font-weight:500}.workflow-screen .workflow-card h2,.workflow-screen .workflow-card button{font-weight:700}';screen.append(style);const icons={eye:'<svg viewBox="0 0 32 24" aria-hidden="true"><path d="M2 12s4.2-8 14-8 14 8 14 8-4.2 8-14 8S2 12 2 12Z" fill="none" stroke="currentColor" stroke-width="2.2"/><circle cx="16" cy="12" r="4" fill="none" stroke="currentColor" stroke-width="2.2"/><path d="M21 20h7M24 17v6" stroke="currentColor" stroke-width="2"/></svg>',layers:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m12 3 9 5-9 5-9-5 9-5Zm-7 9 7 4 7-4m-14 5 7 4 7-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/></svg>',shield:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3 20 6v5c0 5-3.4 8.3-8 10-4.6-1.7-8-5-8-10V6l8-3Z" fill="none" stroke="currentColor" stroke-width="2"/><path d="m8 12 2.5 2.5L16 9" fill="none" stroke="currentColor" stroke-width="2"/></svg>',sliders:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16M4 17h16M8 4v6M16 14v6" stroke="currentColor" stroke-width="2"/><circle cx="8" cy="7" r="2" fill="#354266" stroke="currentColor" stroke-width="2"/><circle cx="16" cy="17" r="2" fill="#354266" stroke="currentColor" stroke-width="2"/></svg>',compare:'<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="10" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><rect x="11" y="5" width="10" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/></svg>',play:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m8 5 11 7-11 7V5Z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/></svg>'};const cards=[...screen.querySelectorAll('.workflow-card')];cards.forEach((card,index)=>{card.tabIndex=0;card.setAttribute('role','radio');card.setAttribute('aria-checked',index===1?'true':'false');card.classList.toggle('workflow-selected',index===1);const top=card.querySelector('.workflow-card-top span');if(top){top.innerHTML=index===1?icons.eye:'<span aria-hidden="true" style="font-size:38px">⚡</span>';top.firstElementChild?.setAttribute('focusable','false');top.querySelector('svg')?.setAttribute('style','width:48px;height:42px;color:#fff')};const badgeIcons=index===1?[icons.sliders,icons.compare]:[icons.layers,icons.shield];card.querySelectorAll('.workflow-badges span').forEach((badge,i)=>{const label=badge.textContent?.replace(/^◈\s*/,'')||'';badge.innerHTML=badgeIcons[i]+'<span>'+label+'</span>';badge.firstElementChild?.setAttribute('style','width:20px;height:20px;vertical-align:middle;margin-right:8px');});const action=card.querySelector('button');if(action){const label=action.textContent?.replace(/^▷\s*/,'')||'';action.innerHTML=icons.play+'<span>'+label+'</span>';action.firstElementChild?.setAttribute('style','width:22px;height:22px;vertical-align:middle;margin-right:10px')};const select=()=>{cards.forEach((other,i)=>{other.classList.toggle('workflow-selected',other===card);other.setAttribute('aria-checked',other===card?'true':'false');const radio=other.querySelector('.workflow-radio');if(radio){radio.textContent='';radio.setAttribute('aria-label',other===card?'Selected':'Not selected')}})};card.addEventListener('click',e=>{if(e.target instanceof Element&&e.target.closest('button')===card.querySelector('button'))return;select()});card.addEventListener('keydown',e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();select()}})});const reassurance=screen.querySelector('.workflow-reassurance');if(reassurance){reassurance.replaceChildren();reassurance.insertAdjacentHTML('afterbegin',icons.shield+'<span>Preparation happens in an isolated candidate. Original files change only through the separate explicit Apply step.</span>');reassurance.firstElementChild?.setAttribute('style','width:30px;height:30px;color:#86d9ff;flex:0 0 auto')};};new MutationObserver(polishWorkflowScreen).observe(document.body,{childList:true});polishWorkflowScreen();`,
|
|
162
164
|
`function previewUnavailable(box){if(!box.querySelector('.preview-unavailable')){const n=el('p','Local preview unavailable. Start the optional companion to enable owning-route previews.','preview-unavailable');box.append(n)}}fetch(previewOrigin+'/health').then(r=>r.ok?r.json():Promise.reject()).then(()=>{previewState.available=true;previewState.checked=true;if(s.finding)detail(s.finding)}).catch(()=>{previewState.checked=true;if(s.finding)detail(s.finding)});`,
|
|
163
165
|
`const componentFixStyle=document.createElement('style');componentFixStyle.textContent='.component-review{display:block!important}.component-review:before,.component-review:after{content:none!important;display:none!important}.component-toolbar{display:flex;align-items:center;gap:6px;margin:-2px 0 7px;padding-bottom:7px;border-bottom:1px solid #263c5d;color:#aebed3;font-size:10px}.component-toolbar button{min-height:24px;padding:3px 7px;border:1px solid #385579;border-radius:6px;background:#142944;color:#dce7fb;font-size:10px}.component-toolbar button:disabled{opacity:.55}.component-helper{margin:0 0 8px!important;color:#9fb0c7!important;font-size:10px!important}.component-compare{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:stretch;gap:8px;min-width:0}.component-frame{display:flex;flex-direction:column;min-width:0;min-height:70px;padding:9px 10px;border-radius:8px}.component-frame h3{display:flex;justify-content:space-between;gap:8px;margin:0 0 7px!important;font-size:11px!important}.component-frame p{margin:auto 0 0!important;font-size:10px!important}.component-before{border:1px solid #4a627f;background:#18283e;color:#dce7fb}.component-after{border:1px solid #289b73;background:#12382f;color:#b3f4cd}.component-arrow{align-self:center;color:#e7edf9;font-size:22px}.component-review .preview-unavailable{display:none!important}@media(max-width:760px){.component-compare{grid-template-columns:1fr}.component-arrow{transform:rotate(90deg);justify-self:center}.component-frame{min-height:58px}}';document.head.append(componentFixStyle);const normalizeComponentReview=()=>document.querySelectorAll('.component-review').forEach(component=>{if(component.querySelector('.component-compare'))return;const title=component.querySelector('h2')?.textContent||'Component Review (Live Review)';component.replaceChildren(el('h2',title));const toolbar=el('div','','component-toolbar');const route=el('span','Route: Unverified');const viewport=el('button','Desktop');viewport.disabled=true;const ltr=el('button','LTR');ltr.disabled=true;const rtl=el('button','RTL');rtl.disabled=true;const expand=el('button','Expand');expand.disabled=true;toolbar.append(route,viewport,ltr,rtl,expand);const helper=el('p','Live preview unavailable. Start the optional companion to enable a real comparison.','component-helper');const compare=el('div','','component-compare');const before=el('div','','component-frame component-before');before.append(el('h3','Before (Current)'),el('p','Preview unavailable'));const arrow=el('span','→','component-arrow');const after=el('div','','component-frame component-after');after.append(el('h3','After (With Fix)'),el('p','Preview unavailable'));compare.append(before,arrow,after);component.append(toolbar,helper,compare)});new MutationObserver(normalizeComponentReview).observe(document.body,{childList:true,subtree:true});normalizeComponentReview();`,
|
|
164
166
|
`document.addEventListener('input',event=>{const target=event.target;if(!(target instanceof HTMLTextAreaElement||target instanceof HTMLInputElement))return;const panel=target.closest('.review-workspace');if(!panel)return;const notes=panel.querySelector('textarea')?.value.trim()||'';const refs=panel.querySelector('input')?.value.split(',').map(x=>x.trim()).filter(Boolean)||[];const ready=!!notes&&refs.length>0;panel.querySelectorAll('button').forEach(button=>{if(button.textContent==='Mark Ready for Review')button.disabled=!ready;if(button.textContent==='Approve')button.disabled=!ready})});`,
|
|
@@ -166,14 +168,15 @@ try{const params=new URLSearchParams({inputDigest:dashboardSnapshot.inputDigest,
|
|
|
166
168
|
`function manualPanel(f){const box=el('section','','manual-workflow'),state=el('p','No manual implementation registered','manual-state'),before=document.createElement('textarea'),after=document.createElement('textarea'),register=el('button','Register Manual Change'),history=el('div','','manual-history');before.placeholder='Before source';after.placeholder='After source';box.append(el('h3','Manual Implementation'),state,before,after,register,history);const identity={findingId:f.id,sourcePath:f.path,inputDigest:d.inputDigest,policyDigest:d.policyDigest,schemaVersion:d.schemaVersion};const load=()=>fetch(previewOrigin+'/review/manual-changes?'+new URLSearchParams(identity)).then(r=>r.json()).then(x=>{history.replaceChildren(...(x.changes||[]).map(c=>el('pre','Before/After · '+c.timestamp+'\\n'+c.beforeText+'\\n---\\n'+c.afterText,'manual-diff')));if(x.changes?.length)state.textContent='Manual change validated and persisted'}).catch(()=>{state.textContent='Manual history unavailable'});register.onclick=()=>{register.disabled=true;fetch(previewOrigin+'/review/manual-changes',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({...identity,beforeText:before.value,afterText:after.value})}).then(r=>r.ok?r.json():r.json().then(x=>Promise.reject(new Error(x.error||'MANUAL_CHANGE_FAILED')))).then(()=>{state.textContent='Manual change registered and validated';load()}).catch(e=>{state.textContent=e.message;register.disabled=false})};load();return box}`,
|
|
167
169
|
`function controlledApplyPanel(f){const box=el('section','','controlled-apply'),status=el('p','Checking server-side eligibility…','empty'),evidence=el('div','','apply-evidence'),actions=el('div','','actions'),live=el('p','','apply-live');const identity={findingId:f.id,sourcePath:f.path,inputDigest:d.inputDigest,policyDigest:d.policyDigest,schemaVersion:d.schemaVersion};box.append(el('h3','Controlled Apply & Rollback'),el('p','Apply is a separate, explicit action. Review approval alone never modifies source.'),status,evidence,actions,live);const audit=()=>fetch(previewOrigin+'/review/audit?sourcePath='+encodeURIComponent(f.path)).then(r=>r.json()).then(x=>{box.querySelector('.audit-history')?.remove();if(!x.events?.length)return;const h=el('section','','audit-history');h.append(el('h4','Audit History'));x.events.forEach(e=>h.append(el('p',e.type+' · '+(e.resultingSha256||e.sourceSha256))));box.append(h)});const refresh=()=>fetch(previewOrigin+'/review/apply/eligibility?'+new URLSearchParams(identity)).then(r=>r.json()).then(info=>{status.textContent=info.ready?'Ready to Apply':'Blocked: '+(info.reason||'Unavailable');status.className=info.ready?'apply-ready':'apply-blocked';evidence.replaceChildren();actions.replaceChildren();if(!info.evidence||!info.ready)return;const e=info.evidence;evidence.append(el('p','Original hash: '+e.originalSourceSha256),el('p','Candidate hash: '+e.candidateSourceSha256),el('pre',e.codeDiff,'review-diff'));const apply=el('button','Apply Change');apply.onclick=()=>{if(!window.confirm('Confirm Apply'))return;fetch(previewOrigin+'/review/apply',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({identity,confirmation:'APPLY_CONFIRMED'})}).then(r=>r.json().then(x=>({ok:r.ok,x}))).then(({ok,x})=>{if(!ok)throw new Error(x.error||'APPLY_FAILED');status.textContent='Applied to Source';live.textContent='Applied successfully';const rollback=el('button','Rollback Change');rollback.onclick=()=>{if(!window.confirm('Confirm Rollback'))return;fetch(previewOrigin+'/review/rollback',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(x.receipt)}).then(r=>r.json().then(y=>({ok:r.ok,y}))).then(({ok,y})=>{if(!ok)throw new Error(y.error||'ROLLBACK_FAILED');status.textContent='Rolled Back';live.textContent='Rolled back successfully';rollback.disabled=true;audit()})};actions.append(rollback);audit()}).catch(error=>{status.textContent=error.message;live.textContent=error.message})};actions.append(apply)}).catch(()=>{status.textContent='Controlled Apply unavailable offline'});window.addEventListener('review-record-updated',refresh);refresh();audit();return box}`,
|
|
168
170
|
`const dashboardFetch=window.fetch.bind(window);window.fetch=(input,init)=>{const promise=dashboardFetch(input,init);if(String(input).includes('/review/records')&&init?.method==='POST'&&String(init.body||'').includes('"status":"Approved"'))promise.then(r=>{if(r.ok)window.dispatchEvent(new Event('review-approval-updated'))});return promise};window.addEventListener('review-approval-updated',()=>{if(s.finding)detail(s.finding)});`,
|
|
169
|
-
`const originalDetail=detail;detail=f=>{originalDetail(f);if(f){details.append(lifecyclePanel(f));if(f.eligibility!=='AUTOMATED_ELIGIBLE')details.append(manualPanel(f))}};if(s.finding){details.append(lifecyclePanel(s.finding));if(s.finding.eligibility!=='AUTOMATED_ELIGIBLE')details.append(manualPanel(s.finding))}`,
|
|
171
|
+
`const originalDetail=detail;detail=f=>{originalDetail(f);if(f&&!['RTL.DOCUMENT.INITIAL','RTL.RUNTIME.DIRECTION_UNKNOWN'].includes(f.ruleId)){details.append(lifecyclePanel(f));if(f.eligibility!=='AUTOMATED_ELIGIBLE')details.append(manualPanel(f))}};if(s.finding){details.append(lifecyclePanel(s.finding));if(s.finding.eligibility!=='AUTOMATED_ELIGIBLE')details.append(manualPanel(s.finding))}`,
|
|
170
172
|
`const rollbackConflictFetch=window.fetch.bind(window);window.fetch=(input,init)=>{const promise=rollbackConflictFetch(input,init);if(String(input).includes('/review/rollback')&&init?.method==='POST')promise.then(async response=>{if(response.status!==409)return;const payload=await response.clone().json().catch(()=>null);if(payload?.error!=='ROLLBACK_CONFLICT')return;document.querySelectorAll('.controlled-apply').forEach(panel=>{const status=panel.querySelector('.apply-ready,.apply-blocked,.empty');const live=panel.querySelector('.apply-live');if(status)status.textContent='Recovery required';if(live)live.textContent='ROLLBACK_CONFLICT'})});return promise};`,
|
|
171
173
|
`const decisionFixStyle=document.createElement('style');decisionFixStyle.textContent='.decision-card{display:block!important;padding:10px!important}.decision-heading{display:flex;align-items:center;gap:8px;margin-bottom:8px}.decision-heading .decision-icon{color:#d5b2ff;font-size:20px}.decision-heading strong{font-size:14px}.decision-heading span:last-child{color:#ddc7ff;font-size:11px;border:1px solid #9564cf;border-radius:99px;padding:2px 9px;background:#302244}.decision-actions{display:flex;align-items:center;gap:8px;flex-wrap:nowrap}.decision-actions button{flex:1 1 0;min-height:34px;padding:7px 10px;border:1px solid #385579;border-radius:8px;background:#102039;color:#e7eefb;font-size:11px;font-weight:750;white-space:nowrap}.decision-actions button[aria-pressed=true]{background:linear-gradient(180deg,#7440d1,#4f209c);border-color:#a477f5;color:#fff}.decision-actions button:disabled{opacity:.52}.technical-details{margin-top:8px;border:1px solid #2d4668;border-radius:10px;background:#0e1a2d}.technical-details>summary{cursor:pointer;padding:8px 10px;color:#cbd8ea;font-size:11px;font-weight:750;list-style:none}.technical-details>summary::-webkit-details-marker{display:none}.technical-details>summary:before{content:"▸";margin-right:7px}.technical-details[open]>summary:before{content:"▾"}.technical-body{display:grid;gap:8px;padding:0 10px 10px}.technical-body>.operational-details,.technical-body>.preview-box,.technical-body>.lifecycle-panel,.technical-body>.manual-workflow,.technical-body>.metadata-details{margin:0!important}.technical-body h3{margin:7px 0 2px!important;font-size:10px!important;color:#aebed3}.technical-body>p,.technical-body>div,.technical-body>section{font-size:10px}.details-card .finding-meta{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.details-card .location-badge{grid-column:2/-1;color:#8fa2bd;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media(max-width:760px){.decision-actions{flex-wrap:wrap}.decision-actions button{flex:1 1 calc(50% - 8px)}}';document.head.append(decisionFixStyle);const normalizeDecision=()=>document.querySelectorAll('.decision-card').forEach(card=>{if(card.dataset.rebuilt)return;card.dataset.rebuilt='true';const sourcePanel=card.querySelector('.decision-panel'),review=card.querySelector('.review-workspace');card.replaceChildren();const heading=el('div','','decision-heading');heading.append(el('span','⚖','decision-icon'),el('strong','Decision'),el('span','Choose how to handle this finding.'));const actions=el('div','','decision-actions');['Approve fix','Defer','False positive','Needs review','Apply & Preview'].forEach(label=>{const button=el('button',label);button.disabled=true;button.title='Unavailable: local companion required';actions.append(button)});card.append(heading,actions);const detailRoot=card.closest('.details');if(!detailRoot)return;let technical=detailRoot.querySelector('.technical-details');if(!technical){technical=document.createElement('details');technical.className='technical-details';technical.open=false;const summary=el('summary','Technical details & operations');const body=el('div','','technical-body');technical.append(summary,body);detailRoot.append(technical)}const body=technical.querySelector('.technical-body');[sourcePanel,review,...detailRoot.querySelectorAll(':scope > .operational-details,:scope > .preview-box,:scope > .lifecycle-panel,:scope > .manual-workflow')].filter(Boolean).forEach(node=>{if(!body.contains(node))body.append(node)});const labels=['Category','Owner','Rationale','Treatment','Limitation'];for(const label of labels){const h=[...detailRoot.querySelectorAll(':scope > h3')].find(x=>x.textContent===label);if(h){const v=h.nextElementSibling;if(v){const block=document.createElement('div');block.className='metadata-details';block.append(h,v);body.append(block)}}}const loc=[...detailRoot.querySelectorAll(':scope > h3')].find(x=>x.textContent==='Location');if(loc){const value=loc.nextElementSibling;const badge=el('span','Location: '+(value?.textContent||''),'location-badge');card.querySelector('.finding-meta')?.after(badge);loc.remove();value?.remove()}});new MutationObserver(normalizeDecision).observe(document.body,{childList:true,subtree:true});normalizeDecision();`,
|
|
172
174
|
`const compactMetadataCleanup=()=>document.querySelectorAll('.details').forEach(root=>{['Rule','Severity','Confidence'].forEach(label=>{const h=[...root.querySelectorAll(':scope > h3')].find(x=>x.textContent===label);if(h){h.nextElementSibling?.remove();h.remove()}})});new MutationObserver(compactMetadataCleanup).observe(document.body,{childList:true,subtree:true});compactMetadataCleanup();`,
|
|
173
|
-
`const sourceDetailsFixStyle=document.createElement('style');sourceDetailsFixStyle.textContent='.meta{display:flex;align-items:center;gap:6px;min-width:0}.meta bdi{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.finding-heading{flex:1;min-width:0;display:grid;gap:3px}.finding-heading strong{font:600 13px Inter,system-ui;color:#edf2fc}.finding-heading bdi{font-size:10px;color:#adbed4;max-width:100%}.meta{flex-wrap:wrap}.meta .copy-icon{width:26px;min-width:26px;height:24px;padding:0;border:1px solid #385579;border-radius:6px;background:#142944;color:#dce7fb;font-size:13px;line-height:1}.code-scroll{flex:0 1 auto!important;min-width:0;box-sizing:border-box;min-height:52px;max-height:120px!important;overflow:auto!important}.code-scroll .line{min-width:100%;width:max-content;grid-template-columns:48px max-content}.code-scroll .text{overflow:visible;text-overflow:clip;white-space:pre}.details-card{display:block!important;padding:8px 10px!important}.details-card .details-summary-row{display:flex;align-items:center;gap:8px;min-width:0;flex-wrap:wrap}.details-card .details-summary-row h2{display:flex;align-items:center;gap:7px;flex:0 0 auto;margin:0!important;font-size:14px!important}.details-card .details-summary-row h2:before{content:"ⓘ";color:#b8c8df}.details-card .details-summary-row .summary-explanation{min-width:120px;flex:1 1 180px;color:#dce6f5;font-size:11px;white-space:normal;line-height:1.5}.details-card .detail-badge{padding:3px 7px;border:1px solid #385579;border-radius:6px;background:#142944;color:#dce7f5;font-size:10px;white-space:nowrap}.details-card .more-details{margin-top:6px;border-top:1px solid #263c5d}.details-card .more-details>summary{cursor:pointer;padding-top:6px;color:#cdb7ff;font-size:10px;list-style:none}.details-card .more-details>summary::-webkit-details-marker{display:none}.details-card .more-details>summary:before{content:"▸";margin-right:6px}.details-card .more-details[open]>summary:before{content:"▾"}.details-card .more-details-body{display:grid;gap:3px;padding-top:5px;color:#b9c7da;font-size:10px}.details-card .more-details-body p{margin:0!important;white-space:normal!important}';document.head.append(sourceDetailsFixStyle);const normalizeSourceDetails=()=>{document.querySelectorAll('.meta').forEach(meta=>{const action=document.querySelector('.details>.actions');if(action){[...action.querySelectorAll('button')].filter(b=>/^Copy (relative path|location)$/.test(b.textContent||'')).forEach(old=>{const copy=old.cloneNode(true);copy.className='copy-icon';copy.textContent=old.textContent?.includes('location')?'⌖':'⧉';copy.setAttribute('aria-label',old.textContent||'Copy');copy.title=old.textContent||'Copy';copy.onclick=old.onclick;meta.append(copy);old.remove()});if(!action.querySelector('button'))action.remove()}const hit=document.querySelector('.code-scroll .line.hit');const scrollFindingId=hit?.querySelector('.finding-range')?.dataset.findingId||hit?.closest('.code-scroll')?.querySelector('.finding-range')?.dataset.findingId||'';if(hit
|
|
174
|
-
`const finalReviewStyle=document.createElement('style');finalReviewStyle.textContent=".stats-toggle{display:inline-flex!important;align-items:center;padding:6px 9px!important;border:1px solid #496488!important;border-radius:6px!important;background:#14243a!important;font-size:11px!important;box-shadow:none!important}.scope-row>.stats-toggle{margin-left:auto;flex:none}.summary[hidden]{display:none!important}.summary{gap:8px!important;padding:6px 14px!important}.summary .card:not(.workspace-card):not(.severity-chart){min-height:44px!important;padding:6px 10px!important;display:flex;align-items:center;gap:9px;box-shadow:none;border-color:#304561}.summary .card strong{font-size:21px!important;line-height:1.2}.scope-row{min-height:42px!important;padding:4px 14px 6px!important}.panel-toggle-btn[aria-expanded=true]{background:linear-gradient(#7040b4,#502b88)!important;border-color:#a980df!important;color:#fff!important}.panel-toggle-btn[aria-expanded=false]{background:transparent!important;border-style:dashed!important;color:#afbed2!important}.review-pane>.meta{order:-3!important}.review-pane>.review-session-toolbar{order:-2!important;margin:0 8px 4px}.review-pane>.code{order:-1!important;margin:0 8px!important;border:1px solid #304b6e!important;border-bottom:0!important;border-radius:9px 9px 0 0!important;overflow:hidden!important;min-height:0!important;flex:0 0 auto!important}.review-pane>.code .code-scroll{min-height:42px!important;max-height:100px!important;padding:4px 0}.primary-review-flow{gap:0!important}.review-section.details-card{border-radius:0!important;border-top:0!important;border-bottom:0!important;padding:5px 9px!important;background:#101e32!important}.review-section.code-diff-card{border-top:0!important;border-radius:0 0 9px 9px!important;padding:7px 9px!important}.code-diff-card h2{font-size:12px!important;margin-bottom:5px!important}.before-card,.after-card{padding:6px 8px!important;border-radius:6px}.review-section.component-review{margin-top:8px;padding:8px!important}.component-toolbar{margin:0 0 5px!important;padding-bottom:5px!important}.component-toolbar button[data-direction][aria-pressed=true]{background:#733dc0!important;border:1px solid #cfadff!important;color:#fff!important;box-shadow:0 0 0 1px #cfadff44}.component-toolbar button[data-direction][aria-pressed=false]{background:transparent!important;color:#aebfd6!important}.component-frame{padding:7px!important}.component-frame h3{min-height:28px;align-items:center!important;margin-bottom:4px!important}.preview-status{gap:4px}.context-instance{max-width:48%!important}.embedded-state{min-height:16px!important;margin:3px 0!important}.review-section.decision-card{margin-top:0!important;border-top:0!important;border-radius:0 0 9px 9px!important;padding:8px!important}.component-review:not(.embedded-expanded){border-radius:9px 9px 0 0!important}.decision-heading{margin-bottom:5px!important}.decision-actions{gap:6px!important}.decision-actions button{min-height:32px!important}.decision-actions button:first-child[aria-pressed=false]:not(:disabled){background:linear-gradient(#8247cd,#5e2caa)!important;border-color:#b98beb!important}.decision-actions button[aria-pressed=true]{background:#253c57!important;border:2px solid #c3a0ef!important;box-shadow:inset 3px 0 #c3a0ef!important}.workflow-notes{margin-top:5px!important}.current-review-status{margin:3px 0!important;color:#aebed2;font-size:10px}.details-card .more-details{margin-top:3px!important}.details-card .more-details>summary{padding-top:3px!important}@media(max-width:760px){.scope-row{flex-wrap:wrap!important}.scope-row>.stats-toggle{margin-left:0}.review-pane>.meta{flex-wrap:wrap!important}.meta .finding-heading{flex:1 1 100%!important;display:flex!important;flex-wrap:wrap;gap:4px}.meta .finding-title-wrap{flex:1 1 100%;width:100%}.meta .finding-breadcrumb{flex-basis:100%;white-space:normal}.summary .card{min-width:0;flex-wrap:wrap;gap:3px}.stats-toggle{white-space:normal}.component-frame h3{gap:4px!important}.context-instance{max-width:65%!important}.decision-actions button{white-space:normal!important}.review-pane>.meta{order:-3!important}}";document.head.append(finalReviewStyle);setTimeout(()=>document.head.append(finalReviewStyle),0);`,
|
|
175
|
+
`const sourceDetailsFixStyle=document.createElement('style');sourceDetailsFixStyle.textContent='.meta{display:flex;align-items:center;gap:6px;min-width:0}.meta bdi{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.finding-heading{flex:1;min-width:0;display:grid;gap:3px}.finding-heading strong{font:600 13px Inter,system-ui;color:#edf2fc}.finding-heading bdi{font-size:10px;color:#adbed4;max-width:100%}.meta{flex-wrap:wrap}.meta .copy-icon{width:26px;min-width:26px;height:24px;padding:0;border:1px solid #385579;border-radius:6px;background:#142944;color:#dce7fb;font-size:13px;line-height:1}.component-review:not(.embedded-expanded) .component-compare{min-height:var(--review-preview-min-height,0px)}.code-scroll{flex:0 1 auto!important;min-width:0;box-sizing:border-box;min-height:52px;max-height:120px!important;overflow:auto!important}.code-scroll .line{min-width:100%;width:max-content;grid-template-columns:48px max-content}.code-scroll .text{overflow:visible;text-overflow:clip;white-space:pre}.details-card{display:block!important;padding:8px 10px!important}.details-card .details-summary-row{display:flex;align-items:center;gap:8px;min-width:0;flex-wrap:wrap}.details-card .details-summary-row h2{display:flex;align-items:center;gap:7px;flex:0 0 auto;margin:0!important;font-size:14px!important}.details-card .details-summary-row h2:before{content:"ⓘ";color:#b8c8df}.details-card .details-summary-row .summary-explanation{min-width:120px;flex:1 1 180px;color:#dce6f5;font-size:11px;white-space:normal;line-height:1.5}.details-card .detail-badge{padding:3px 7px;border:1px solid #385579;border-radius:6px;background:#142944;color:#dce7f5;font-size:10px;white-space:nowrap}.details-card .more-details{margin-top:6px;border-top:1px solid #263c5d}.details-card .more-details>summary{cursor:pointer;padding-top:6px;color:#cdb7ff;font-size:10px;list-style:none}.details-card .more-details>summary::-webkit-details-marker{display:none}.details-card .more-details>summary:before{content:"▸";margin-right:6px}.details-card .more-details[open]>summary:before{content:"▾"}.details-card .more-details-body{display:grid;gap:3px;padding-top:5px;color:#b9c7da;font-size:10px}.details-card .more-details-body p{margin:0!important;white-space:normal!important}';document.head.append(sourceDetailsFixStyle);const normalizeSourceDetails=()=>{document.querySelectorAll('.meta').forEach(meta=>{const action=document.querySelector('.details>.actions');if(action){[...action.querySelectorAll('button')].filter(b=>/^Copy (relative path|location)$/.test(b.textContent||'')).forEach(old=>{const copy=old.cloneNode(true);copy.className='copy-icon';copy.textContent=old.textContent?.includes('location')?'⌖':'⧉';copy.setAttribute('aria-label',old.textContent||'Copy');copy.title=old.textContent||'Copy';copy.onclick=old.onclick;meta.append(copy);old.remove()});if(!action.querySelector('button'))action.remove()}const hit=document.querySelector('.code-scroll .line.hit');const scrollFindingId=hit?.querySelector('.finding-range')?.dataset.findingId||hit?.closest('.code-scroll')?.querySelector('.finding-range')?.dataset.findingId||'';if(hit){meta.dataset.scrolledFinding=scrollFindingId;const scrollContainer=hit.closest('.code-scroll');if(scrollContainer instanceof HTMLElement){const range=hit.querySelector('.finding-range');const target=range instanceof HTMLElement?range:hit;const box=scrollContainer.getBoundingClientRect(),targetBox=target.getBoundingClientRect();const pad=Math.max(10,Math.round(parseFloat(getComputedStyle(hit).lineHeight)||18));if(targetBox.top<box.top+pad)scrollContainer.scrollTop=Math.max(0,scrollContainer.scrollTop+(targetBox.top-box.top)-pad);else if(targetBox.bottom>box.bottom-pad)scrollContainer.scrollTop+=targetBox.bottom-box.bottom+pad;if(targetBox.left<box.left+pad)scrollContainer.scrollLeft=Math.max(0,scrollContainer.scrollLeft+(targetBox.left-box.left)-pad);else if(targetBox.right>box.right-pad)scrollContainer.scrollLeft+=targetBox.right-box.right+pad;}}});document.querySelectorAll('.details-card').forEach(card=>{if(card.dataset.compactDetails)return;const title=card.querySelector('p:first-of-type'),explanation=card.querySelector('p:nth-of-type(2)'),meta=card.querySelector('.finding-meta'),eligibility=card.querySelector('.eligibility-panel');if(!explanation||!meta)return;card.dataset.compactDetails='true';const fullExplanation=explanation.textContent||'No additional explanation is available.';const original=s.finding?.original||'';const short=s.finding?.ruleId==='RTL.CSS.PHYSICAL'?'Physical property detected; review intent and every affected target. A visual defect is not established.':/text-align\\s*:/.test(original)?'Proposes direction-aware start/end alignment on the selected element.':/margin-(left|right)\\s*:/.test(original)?'Proposes a logical margin that follows text direction.':/padding-(left|right)\\s*:/.test(original)?'Proposes logical padding that follows text direction.':/border-(left|right)/.test(original)?'Proposes a logical border side that follows text direction.':fullExplanation.length>100?fullExplanation.slice(0,97)+'…':fullExplanation;const row=el('div','','details-summary-row');const heading=el('h2',s.finding?.ruleId==='RTL.CSS.PHYSICAL'?'Why this finding?':'Why this change?');row.append(heading,el('span',short,'summary-explanation'));const parts=(meta.textContent||'').split(' · ');parts.forEach(part=>row.append(el('span',part,'detail-badge')));const more=document.createElement('details');more.className='more-details';const summary=el('summary','Explanation and limitations');const body=el('div','','more-details-body');body.append(el('p',fullExplanation));const confidenceNote=card.querySelector('.finding-confidence-note');if(confidenceNote)body.append(confidenceNote);if(eligibility)body.append(el('p',eligibility.textContent||''));const caveat=card.querySelector('.semantic-review');if(caveat)body.append(caveat);more.append(summary,body);card.replaceChildren(row,more)});};new MutationObserver(normalizeSourceDetails).observe(document.body,{childList:true,subtree:true});addEventListener('resize',()=>requestAnimationFrame(normalizeSourceDetails));normalizeSourceDetails();`,
|
|
176
|
+
`const finalReviewStyle=document.createElement('style');finalReviewStyle.textContent=".approval-confirmation{width:min(390px,calc(100vw - 32px));border:1px solid #9a6df0;border-radius:12px;background:#12213a;color:#f4f7ff;padding:20px;box-shadow:0 14px 48px #000a}.approval-confirmation::backdrop{background:#050a16a8}.approval-confirmation h2{margin:0 0 8px;font-size:18px}.approval-confirmation p{line-height:1.5}.approval-confirmation .actions{display:grid}.approval-confirmation button{min-height:40px;border:1px solid #647997;border-radius:7px;background:#172b46;color:white}.approval-confirmation button:first-child{background:#742fe0;border-color:#a47bed}.stats-toggle{display:inline-flex!important;align-items:center;padding:6px 9px!important;border:1px solid #496488!important;border-radius:6px!important;background:#14243a!important;font-size:11px!important;box-shadow:none!important}.scope-row>.stats-toggle{margin-left:auto;flex:none}.summary[hidden]{display:none!important}.summary{gap:8px!important;padding:6px 14px!important}.summary .card:not(.workspace-card):not(.severity-chart){min-height:44px!important;padding:6px 10px!important;display:flex;align-items:center;gap:9px;box-shadow:none;border-color:#304561}.summary .card strong{font-size:21px!important;line-height:1.2}.scope-row{min-height:42px!important;padding:4px 14px 6px!important}.panel-toggle-btn[aria-expanded=true]{background:linear-gradient(#7040b4,#502b88)!important;border-color:#a980df!important;color:#fff!important}.panel-toggle-btn[aria-expanded=false]{background:transparent!important;border-style:dashed!important;color:#afbed2!important}.review-pane>.meta{order:-3!important}.review-pane>.review-session-toolbar{order:-2!important;margin:0 8px 4px}.review-pane>.code{order:-1!important;margin:0 8px!important;border:1px solid #304b6e!important;border-bottom:0!important;border-radius:9px 9px 0 0!important;overflow:hidden!important;min-height:0!important;flex:0 0 auto!important}.review-pane>.code .code-scroll{min-height:42px!important;max-height:100px!important;padding:4px 0}.primary-review-flow{gap:0!important}.review-section.details-card{border-radius:0!important;border-top:0!important;border-bottom:0!important;padding:5px 9px!important;background:#101e32!important}.review-section.code-diff-card{border-top:0!important;border-radius:0 0 9px 9px!important;padding:7px 9px!important}.code-diff-card h2{font-size:12px!important;margin-bottom:5px!important}.before-card,.after-card{padding:6px 8px!important;border-radius:6px}.review-section.component-review{margin-top:8px;padding:8px!important}.component-toolbar{margin:0 0 5px!important;padding-bottom:5px!important}.component-toolbar button[data-direction][aria-pressed=true]{background:#733dc0!important;border:1px solid #cfadff!important;color:#fff!important;box-shadow:0 0 0 1px #cfadff44}.component-toolbar button[data-direction][aria-pressed=false]{background:transparent!important;color:#aebfd6!important}.component-frame{padding:7px!important}.component-frame h3{min-height:28px;align-items:center!important;margin-bottom:4px!important}.preview-status{gap:4px}.context-instance{max-width:48%!important}.embedded-state{min-height:16px!important;margin:3px 0!important}.review-section.decision-card{margin-top:0!important;border-top:0!important;border-radius:0 0 9px 9px!important;padding:8px!important}.component-review:not(.embedded-expanded){border-radius:9px 9px 0 0!important}.decision-heading{margin-bottom:5px!important}.decision-actions{gap:6px!important}.decision-actions button{min-height:32px!important}.decision-actions button:first-child[aria-pressed=false]:not(:disabled){background:linear-gradient(#8247cd,#5e2caa)!important;border-color:#b98beb!important}.decision-actions button[aria-pressed=true]{background:#253c57!important;border:2px solid #c3a0ef!important;box-shadow:inset 3px 0 #c3a0ef!important}.workflow-notes{margin-top:5px!important}.current-review-status{margin:3px 0!important;color:#aebed2;font-size:10px}.details-card .more-details{margin-top:3px!important}.details-card .more-details>summary{padding-top:3px!important}@media(max-width:760px){.scope-row{flex-wrap:wrap!important}.scope-row>.stats-toggle{margin-left:0}.review-pane>.meta{flex-wrap:wrap!important}.meta .finding-heading{flex:1 1 100%!important;display:flex!important;flex-wrap:wrap;gap:4px}.meta .finding-title-wrap{flex:1 1 100%;width:100%}.meta .finding-breadcrumb{flex-basis:100%;white-space:normal}.summary .card{min-width:0;flex-wrap:wrap;gap:3px}.stats-toggle{white-space:normal}.component-frame h3{gap:4px!important}.context-instance{max-width:65%!important}.decision-actions button{white-space:normal!important}.review-pane>.meta{order:-3!important}}";document.head.append(finalReviewStyle);setTimeout(()=>document.head.append(finalReviewStyle),0);`,
|
|
175
177
|
embeddedPreviewClientSource,
|
|
176
178
|
workflowClientSource,
|
|
179
|
+
themeClientSource,
|
|
177
180
|
`})();`,
|
|
178
181
|
`const sourceActionCleanup=()=>{document.querySelectorAll('.details>.actions').forEach(action=>{action.querySelectorAll('button').forEach(button=>{if(/^Copy (relative path|location)$/.test(button.textContent||''))button.remove()});if(!action.querySelector('button'))action.remove()});document.querySelectorAll('.meta').forEach(meta=>{const seen=new Set();meta.querySelectorAll('.copy-icon').forEach(button=>{const label=button.getAttribute('aria-label');if(seen.has(label))button.remove();else seen.add(label)})})};new MutationObserver(sourceActionCleanup).observe(document.body,{childList:true,subtree:true});sourceActionCleanup();`,
|
|
179
182
|
`const removeLegacySourceActions=()=>document.querySelectorAll('.details>.actions').forEach(action=>action.remove());new MutationObserver(removeLegacySourceActions).observe(document.body,{childList:true,subtree:true});removeLegacySourceActions();`,
|
|
@@ -181,4 +184,7 @@ try{const params=new URLSearchParams({inputDigest:dashboardSnapshot.inputDigest,
|
|
|
181
184
|
`const singleWorkflowRadioStyle=document.createElement('style');singleWorkflowRadioStyle.textContent='.workflow-screen .workflow-card .workflow-radio{display:block!important;width:24px!important;height:24px!important;box-sizing:border-box!important;border:2px solid #c5cde1!important;border-radius:50%!important;font-size:0!important;line-height:1!important;box-shadow:none!important}.workflow-screen .workflow-card .workflow-radio:before{content:none!important;display:none!important}.workflow-screen .workflow-card.workflow-selected .workflow-radio{border-color:#fff!important;box-shadow:inset 0 0 0 5px #a05cff,0 0 0 2px #fff!important}';document.head.append(singleWorkflowRadioStyle);`,
|
|
182
185
|
`const consolidateComponentPreviewControls=()=>{document.querySelectorAll('.component-review').forEach(component=>{const toolbar=component.querySelector('.component-toolbar'),preview=component.querySelector('.preview-box');if(toolbar&&preview&&!toolbar.querySelector('.route-actions')){const group=document.createElement('div');group.className='route-actions';group.setAttribute('aria-label','Open route previews');[...preview.querySelectorAll('button')].forEach(button=>{button.textContent=button.textContent.replace('Open ','');button.title=button.title||'Open external route preview';group.append(button)});toolbar.append(group);preview.remove()}})};const componentToolbarStyle=document.createElement('style');componentToolbarStyle.textContent='.component-toolbar{flex-wrap:wrap}.route-actions{display:flex;align-items:center;gap:5px;margin-left:auto}.route-actions button{min-height:24px;padding:3px 7px;border:1px solid #385579;border-radius:6px;background:#142944;color:#dce7fb;font-size:10px}.route-actions button:disabled{opacity:.5}@media(max-width:760px){.route-actions{margin-left:0}}';document.head.append(componentToolbarStyle);new MutationObserver(consolidateComponentPreviewControls).observe(document.body,{childList:true,subtree:true});consolidateComponentPreviewControls();setTimeout(consolidateComponentPreviewControls,700);`,
|
|
183
186
|
`const verifiedDiffFetch=window.fetch.bind(window);window.fetch=(input,init)=>{const response=verifiedDiffFetch(input,init);if(!String(input).includes('/review/sessions/')||!String(input).endsWith('/diff'))return response;return response.then(async r=>{const payload=await r.clone().json().catch(()=>null);if(payload&&payload.state&&payload.state!=='ready'&&payload.state!=='unchanged')payload.diff='Candidate comparison unavailable: '+(payload.reason||payload.state);return payload?new Response(JSON.stringify(payload),{status:r.status,headers:{'content-type':'application/json'} }):r});};`,
|
|
187
|
+
`addEventListener('resize',()=>document.querySelector('.review-pane')?.style.removeProperty('--review-preview-min-height'));const sourceLineNumberStyle=document.createElement('style');sourceLineNumberStyle.textContent='.code-scroll .no{position:sticky;left:0;z-index:2;box-sizing:border-box;background:#101b2e;border-right:1px solid #384d6c}';document.head.append(sourceLineNumberStyle);`,
|
|
188
|
+
`const moveChooserTheme=()=>{let trigger=document.querySelector('.tools .color-theme-trigger'),chooser=document.querySelector('.workflow-screen header');if(!trigger){const tools=document.querySelector('.tools');if(!tools)return;trigger=document.createElement('button');trigger.className='color-theme-trigger';trigger.type='button';trigger.textContent='🎨';trigger.title='Color theme';trigger.setAttribute('aria-label','Color theme');trigger.onclick=()=>{const menu=document.querySelector('.theme-menu');if(!menu)return;menu.showPopover();const box=trigger.getBoundingClientRect();menu.style.left=Math.max(12,Math.min(box.right-260,innerWidth-272))+'px';menu.style.top=Math.min(box.bottom+8,innerHeight-menu.offsetHeight-12)+'px'};tools.append(trigger)}if(chooser&&!chooser.querySelector('.chooser-theme-trigger')){const clone=trigger.cloneNode(true);clone.classList.add('chooser-theme-trigger');clone.onclick=()=>{trigger.click();const menu=document.querySelector('.theme-menu'),box=clone.getBoundingClientRect();if(menu){menu.style.left=Math.max(12,Math.min(box.right-260,innerWidth-272))+'px';menu.style.top=Math.min(box.bottom+8,innerHeight-menu.offsetHeight-12)+'px'}};clone.onkeydown=e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();clone.click()}};const findings=[...chooser.children].find(x=>/findings/i.test(x.textContent||''));chooser.insertBefore(clone,findings||null)}};new MutationObserver(moveChooserTheme).observe(document.body,{childList:true,subtree:true});moveChooserTheme();setTimeout(moveChooserTheme,500);`,
|
|
189
|
+
`setTimeout(()=>{const app=document.querySelector('#dashboard> .app');if(app&&!app.hidden&&!document.querySelector('.workflow-screen'))return;if(!document.querySelector('.workflow-screen')){app&&(app.hidden=false);document.querySelector('.workflow-change')?.click()}},750);`,
|
|
184
190
|
].join('');
|
|
@@ -55,7 +55,7 @@ export const contextualPreviewClientSource = String.raw `
|
|
|
55
55
|
}
|
|
56
56
|
async function contextRoutes(record,f,current){
|
|
57
57
|
if(!current||!live(record,current.component))return;contextControls(current);
|
|
58
|
-
const token=(record.routeToken||0)+1;record.routeToken=token;record.contextResolving=true;for(const item of current.items){item.state.dataset.state='loading';item.state.dataset.contextStatus='loading-route';item.state.textContent='Resolving current route and contextual target…'}
|
|
58
|
+
current.component.dataset.mappingMissing='false';current.component.querySelector('.mapping-unavailable')?.remove();const token=(record.routeToken||0)+1;record.routeToken=token;record.contextResolving=true;for(const item of current.items){item.state.dataset.state='loading';item.state.dataset.contextStatus='loading-route';item.state.textContent='Resolving current route and contextual target…'}
|
|
59
59
|
try{
|
|
60
60
|
const query=new URLSearchParams({inputDigest:d.inputDigest,policyDigest:d.policyDigest,findingId:f.id,mode:record.mode,...(record.workflowId?{workflowId:record.workflowId}:{}),...(record.routeId?{routeId:record.routeId}:{})});
|
|
61
61
|
let info=await request('/contextual-preview?'+query);
|
|
@@ -68,13 +68,16 @@ export const contextualPreviewClientSource = String.raw `
|
|
|
68
68
|
record.contextResolving=false;record.contextInfo=info;record.routeId=info.route?.id;record.runtime=info.candidate?.available?{runtime:{origin:info.candidate.origin,status:'healthy'}}:null;if(info.original?.available){const u=new URL(info.original.origin);if(u.protocol==='http:'&&u.hostname==='127.0.0.1')originalOrigins.add(u.origin)}syncRoute(current);
|
|
69
69
|
if(!record.contextDefaults){record.contextDefaults=true;if(info.mapping.preferredViewport!==undefined){record.viewport=info.mapping.preferredViewport;const viewport=[...current.component.querySelector('.component-toolbar').querySelectorAll('button')].find(b=>['Desktop','Tablet','Mobile'].includes(b.textContent));if(viewport)viewport.textContent=['Desktop','Tablet','Mobile'][record.viewport]}if(info.mapping.preferredMode&&info.mapping.preferredMode!==record.mode){record.mode=info.mapping.preferredMode;syncControls(current);return contextRoutes(record,f,current)}}
|
|
70
70
|
syncControls(current);
|
|
71
|
-
for(const controls of current.contextControls){controls.route.replaceChildren(...info.mapping.routes.map(route=>new Option(route.label,route.id)));controls.route.value=record.routeId||'';controls.route.disabled=!info.mapping.routes.length;controls.reset.hidden=info.dataAdapter==='none'||!info.route;controls.reveal.hidden=!info.mapping.css?.media&&!info.mapping.routes.some(r=>r.prepare==='sidebar');controls.start.hidden
|
|
71
|
+
for(const controls of current.contextControls){controls.route.replaceChildren(...info.mapping.routes.map(route=>new Option(route.label,route.id)));controls.route.value=record.routeId||'';controls.route.disabled=!info.mapping.routes.length;controls.reset.hidden=info.dataAdapter==='none'||!info.route;controls.reveal.hidden=!info.mapping.css?.media&&!info.mapping.routes.some(r=>r.prepare==='sidebar');controls.start.hidden=!info.review?.hasAutomaticFix||!!info.candidate?.available;controls.start.disabled=!info.route||!record.session||info.review?.workflowState!=='Reviewing'}
|
|
72
72
|
const summary=info.mapping.label+' · '+info.path+':'+info.line;current.contextSummary.textContent=summary;
|
|
73
|
-
const helper=current.component.querySelector('.component-helper');if(helper)helper.textContent=(info.mapping.configured?'Configured context · ':'Example-specific context · ')+summary+' · '+(info.mapping.limitation||'Live target checks are separate from validation and approval.')+(info.review?.inScope===false?' · Outside the selected review scope; original contextual review remains available.':
|
|
73
|
+
const helper=current.component.querySelector('.component-helper'),hasPatch=!!info.review?.hasAutomaticFix,afterPane=current.component.querySelector('.component-after'),arrow=current.component.querySelector('.component-arrow');current.component.dataset.manualOnly=String(!hasPatch);if(afterPane)afterPane.style.display='';if(arrow)arrow.style.display='';const compare=current.component.querySelector('.component-compare');if(compare)compare.style.gridTemplateColumns='minmax(0,1fr) auto minmax(0,1fr)';if(helper)helper.textContent=(info.mapping.configured?'Configured context · ':'Example-specific context · ')+summary+' · '+(info.mapping.limitation||'Live target checks are separate from validation and approval.')+(info.review?.inScope===false?' · Outside the selected review scope; original contextual review remains available.':hasPatch?'':' · Source requiring review. '+(info.review?.reason||f.rationale||'No supported candidate patch.'));
|
|
74
74
|
for(const item of current.items){const descriptor=info[item.role==='original'?'original':'candidate'];item.context=descriptor;item.application=info.route?.application;
|
|
75
75
|
if(item.role==='candidate'&&descriptor?.available&&candidateEligible(record)&&record.entryApplied){activateVerifiedCandidate(current);if(!item.frame)item.state.textContent='Waiting for verified Before before displaying this isolated candidate…';}
|
|
76
76
|
else if(descriptor?.available&&item.role==='original'){load(item,descriptor.url,record,f,descriptor.sourceHash);resize(item,record)}
|
|
77
|
-
else{clearTimeout(item.timeout);item.box.replaceChildren();item.frame=null;item.ready=null;clearContextTargets(item);item.state.dataset.state='unavailable';item.state.dataset.contextStatus=!info.route?'mapping-missing':'runtime-unavailable';item.state.textContent=item.role==='original'?(descriptor?.reason||info.reason||'Unresolved contextual mapping.'):(!record.session?'No candidate prepared · validation: Not run':descriptor?.reason||info.candidateReason||'No isolated candidate is available.');}
|
|
77
|
+
else{clearTimeout(item.timeout);item.box.replaceChildren();item.frame=null;item.ready=null;clearContextTargets(item);item.state.dataset.state='unavailable';item.state.dataset.contextStatus=!info.route?'mapping-missing':'runtime-unavailable';item.state.textContent=item.role==='original'?(descriptor?.reason||info.reason||'Unresolved contextual mapping.'):!info.review?.hasAutomaticFix?'Manual review required · '+[info.review?.reason,f.rationale,f.treatment].filter((v,i,a)=>v&&a.indexOf(v)===i).join(' '):(!record.session?'No candidate prepared · validation: Not run':descriptor?.reason||info.candidateReason||'No isolated candidate is available.');}
|
|
78
|
+
}
|
|
79
|
+
if(!info.route){
|
|
80
|
+
current.component.dataset.mappingMissing='true';const unavailable=el('section','','mapping-unavailable');unavailable.setAttribute('role','status');unavailable.append(el('h3','Live preview unavailable'),el('p',info.review?.hasAutomaticFix?'This finding has no configured page/element mapping. Review the supported candidate in code; its visual effect has not been verified.':'Source requiring review. No configured page/element mapping or supported candidate patch is available. '+(f.rationale||'')));unavailable.append(el('p','Approval is unavailable without a verified page/element binding and required direction evidence. Review the code, choose Defer or Needs review, or configure an accurate preview binding.'));current.component.append(unavailable);
|
|
78
81
|
}
|
|
79
82
|
updateCandidateAction(current);syncRoute(current);
|
|
80
83
|
current.component.querySelectorAll('.route-actions button').forEach((button,index)=>{button.disabled=!info.candidate?.available;button.onclick=()=>{const url=new URL(info.candidate.urls?.[index?'rtl':'ltr']||info.candidate.url);if(!info.candidate.urls)url.searchParams.set('lang',index?'ar':'en');if(originAllowed(url.href,'candidate'))window.open(url.href,'_blank','noopener,noreferrer')}});
|
|
@@ -92,7 +95,11 @@ export const contextualPreviewClientSource = String.raw `
|
|
|
92
95
|
}
|
|
93
96
|
window.addEventListener('message',event=>{
|
|
94
97
|
if(!view?.record.contextual||selected!==view.record.key||view.record.contextResolving)return;const record=view.record,p=event.data;
|
|
95
|
-
if(!p||!['rtl-context-status','rtl-context-navigation'].includes(p.type)||p.version!==2)return;
|
|
98
|
+
if(!p||!['rtl-context-status','rtl-context-navigation','rtl-context-direction-changed'].includes(p.type)||p.version!==2)return;
|
|
99
|
+
if(p.type==='rtl-context-direction-changed'){
|
|
100
|
+
const item=view.items.find(item=>item.frame&&event.source===item.frame.contentWindow&&event.origin===new URL(item.url).origin&&p.nonce===item.nonce&&p.role===item.role&&p.application===item.application&&p.projectRoot===item.context?.projectRoot&&p.runtimeSessionId===item.context?.runtimeSessionId&&p.sessionId===(record.session?.id||'before-only')&&p.findingId===record.finding.id&&p.sourcePath===record.finding.path&&p.sourceSha256===item.expectedHash&&p.routeId===record.routeId);
|
|
101
|
+
if(!item||!Number.isSafeInteger(p.directionRevision)||p.directionRevision<=(item.directionRevision??-1))return; item.directionRevision=p.directionRevision; item.ready=null; item.contextReport=null; item.verifiedMapping=null; item.lastVerifiedReport=null; item.state.dataset.state='loading'; item.state.dataset.contextStatus='direction-changed'; item.state.textContent='Live application direction changed; refreshing evidence…'; contextProbe(item,record,record.finding,'highlight'); return;
|
|
102
|
+
}
|
|
96
103
|
if(p.type==='rtl-context-navigation'){
|
|
97
104
|
const item=view.items.find(item=>item.frame&&event.source===item.frame.contentWindow&&event.origin===new URL(item.url).origin&&p.nonce===item.nonce&&p.role===item.role&&p.application===item.application&&p.projectRoot===item.context?.projectRoot&&p.runtimeSessionId===item.context?.runtimeSessionId&&p.sessionId===(record.session?.id||'before-only')&&p.findingId===record.finding.id&&p.sourcePath===record.finding.path&&p.sourceSha256===item.expectedHash&&p.routeId===record.routeId);
|
|
98
105
|
if(!item)return;const route=record.contextInfo.mapping.routes.find(route=>route.application===p.nextApplication);
|
|
@@ -100,6 +107,7 @@ export const contextualPreviewClientSource = String.raw `
|
|
|
100
107
|
}
|
|
101
108
|
for(const item of view.items){
|
|
102
109
|
if(!item.frame||event.source!==item.frame.contentWindow||event.origin!==new URL(item.url).origin||p.nonce!==item.nonce||p.role!==item.role||p.application!==item.application||p.projectRoot!==item.context?.projectRoot||p.runtimeSessionId!==item.context?.runtimeSessionId||p.sessionId!==(record.session?.id||'before-only')||p.findingId!==record.finding.id||p.sourcePath!==record.finding.path||p.sourceSha256!==item.expectedHash||p.routeId!==record.routeId||!['ltr','rtl'].includes(p.dir)||typeof p.route!=='string'||p.route.length>200||!/^\/[a-zA-Z0-9/_-]*$/.test(p.route)||!Array.isArray(p.targets)||p.targets.length>500||p.targets.some(t=>!t||!Number.isInteger(t.index)||typeof t.label!=='string'||t.label.length>100||typeof t.rendered!=='boolean'||!t.rect||Object.values(t.rect).some(n=>typeof n!=='number'||!Number.isFinite(n))))continue;
|
|
110
|
+
if(!Number.isSafeInteger(p.directionRevision)||p.directionRevision<(item.directionRevision??0)||p.targets.some(t=>!['ltr','rtl'].includes(t.effectiveDirection)))continue; item.directionRevision=p.directionRevision;
|
|
103
111
|
item.currentRoute=p.route;syncRoute(view);
|
|
104
112
|
if(p.dir!==record.mode){item.contextReport=p;item.ready=null;clearTimeout(item.timeout);item.state.dataset.state='navigated';item.state.dataset.contextStatus='navigated';item.state.textContent='Live application · direction changed inside the app to '+p.dir.toUpperCase()+'. Re-select '+record.mode.toUpperCase()+' in the toolbar to restore the comparison direction.';continue}
|
|
105
113
|
if(item.role==='original'&&typeof p.seedData==='string'&&p.seedData.length<100000){record.seedSnapshot=p.seedData;record.defaultSeed=p.defaultSeedData}
|
|
@@ -109,7 +117,7 @@ export const contextualPreviewClientSource = String.raw `
|
|
|
109
117
|
const targetStatus=p.route!==record.contextInfo.route.path||p.targetStatus==='navigated'?'navigated':p.targetStatus==='document'&&rendered?'document':p.targetStatus==='verified'&&rendered&&p.routeReady&&(!record.contextInfo.mapping.configured||!record.contextInfo.mapping.sourceSelector||p.sourceStatus==='source-rule-matched')?'verified':p.targetStatus==='preparing'?'preparing':['source-not-loaded','target-mismatch','missing-target','route-not-ready'].includes(p.targetStatus)?p.targetStatus:p.targets.length?'hidden':'unresolved';
|
|
110
118
|
item.state.dataset.contextStatus=item.targetRestoreFailed?'target-selection-required':targetStatus;item.state.dataset.routeReady=String(!!p.routeReady);item.state.dataset.targetCount=String(p.targets.length);item.state.dataset.state=item.targetRestoreFailed?'unresolved':targetStatus==='navigated'?'navigated':['verified','document'].includes(targetStatus)?'ready':targetStatus==='preparing'?'loading':'unresolved';
|
|
111
119
|
const contextLabel=item.targetRestoreFailed?'Previous target could not be restored. Select a target.':targetStatus==='verified'?'Verified targets: '+p.targets.length+(offscreen?' · '+offscreen+' outside viewport':''):targetStatus==='document'?'Page/document-wide context':targetStatus==='navigated'?'Live application · navigated away from target':targetStatus==='route-not-ready'?'Application readiness target not observed on configured route':targetStatus==='source-not-loaded'?'Source stylesheet/rule not observed on this route · mapping unverified':targetStatus==='target-mismatch'?'Configured target does not match the source rule · mapping unverified':targetStatus==='missing-target'?'Source rule loaded; configured target is missing on this route':targetStatus==='hidden'?'Selector located · hidden at this viewport':targetStatus==='preparing'?'Preparing existing UI state…':'Route ready; target unresolved. Retry Highlight targets or restore the required UI state.';
|
|
112
|
-
const css=item.targetRestoreFailed?null:p.targets.find(t=>t.index===item.instance)?.css;const evidence=contextLabel+' · '+p.route+' · '+p.dir.toUpperCase()+(css?' · CSS '+css.sourceProperty+(css.resolvedProperty!==css.sourceProperty?' → '+css.resolvedProperty:'')+': '+css.contribution+' · computed '+css.computedValue:'')+(item.role==='candidate'?' · '+candidateStatus(record)+' · '+(record.contextInfo.review.applied?'selected preview patch present':'selected finding unchanged')+' · '+record.contextInfo.review.patchInventory.length+' actual candidate patches':'');if(item.diagnostic)setText(item.diagnostic,(item.role==='original'?'Before: ':'After: ')+evidence);setText(item.state,['verified','document'].includes(targetStatus)?contextLabel:evidence);
|
|
120
|
+
const css=item.targetRestoreFailed?null:p.targets.find(t=>t.index===item.instance)?.css;const evidence=contextLabel+' · '+p.route+' · page '+p.dir.toUpperCase()+' · target '+(p.targets.find(t=>t.index===item.instance)?.effectiveDirection||'unknown').toUpperCase()+(css?' · CSS '+css.sourceProperty+(css.resolvedProperty!==css.sourceProperty?' → '+css.resolvedProperty:'')+': '+css.contribution+' · computed '+css.computedValue:'')+(item.role==='candidate'?' · '+candidateStatus(record)+' · '+(record.contextInfo.review.applied?'selected preview patch present':'selected finding unchanged')+' · '+record.contextInfo.review.patchInventory.length+' actual candidate patches':'');if(item.diagnostic)setText(item.diagnostic,(item.role==='original'?'Before: ':'After: ')+evidence);setText(item.state,['verified','document'].includes(targetStatus)?contextLabel:evidence);
|
|
113
121
|
if(['verified','document','navigated','hidden'].includes(targetStatus)&&!item.targetRestoreFailed){item.ready=p;clearTimeout(item.timeout)}else if(item.targetRestoreFailed){item.ready=null;item.lastVerifiedReport=null;item.verifiedMapping=null;}
|
|
114
122
|
if(['verified','document'].includes(targetStatus)&&!item.targetRestoreFailed){item.lastVerifiedReport=p;item.verifiedMapping={sourceHash:item.expectedHash,routeId:record.routeId};}
|
|
115
123
|
item.contextReport=p;if(item.role==='original')activateVerifiedCandidate(view);updateCandidateAction(view);syncRoute(view);
|
package/dist/dashboard-data.js
CHANGED
|
@@ -6,8 +6,8 @@ const breakdown = (values) => { const counts = new Map(); for (const value of va
|
|
|
6
6
|
counts.set(value, (counts.get(value) ?? 0) + 1); return [...counts].sort((a, b) => sort(a[0], b[0])).map(([name, count]) => ({ name, count })); };
|
|
7
7
|
const findingSort = (a, b) => sort(a.path, b.path) || a.line - b.line || a.column - b.column || sort(a.id, b.id);
|
|
8
8
|
function mapFinding(f, ref, sourceText) { const eligibility = classifyEligibility(f, !ref?.missingEvidenceIds.length, sourceText); const reviewClassification = eligibility.eligibility === 'AUTOMATED_ELIGIBLE' ? 'Automated / Codemod Eligible' : eligibility.eligibility === 'ASSISTED' ? 'Assisted' : 'Manual'; return { id: f.id, ruleId: f.ruleId, ruleVersion: f.ruleVersion, category: f.category, severity: f.severity, confidence: f.confidence, title: f.title, sourceMechanism: f.sourceMechanism, path: f.path, line: f.range.start.line, column: f.range.start.column, range: f.range, original: f.original, owner: f.ownership, applications: f.applications.slice().sort(sort), rationale: f.rationale, treatment: f.treatment, limitation: f.limitation, evidenceIds: f.evidenceIds.slice(), missingEvidenceIds: ref?.missingEvidenceIds.slice() ?? [], duplicateEvidenceIds: ref?.duplicateEvidenceIds.slice() ?? [], relatedLocations: f.relatedLocations.slice().sort((a, b) => sort(a.path, b.path) || a.range.start.offset - b.range.start.offset).map(x => `${x.path}:${x.range.start.line}:${x.range.start.column}`), issueIds: f.issueIds.slice().sort(sort), suggestion: f.suggestion ? { property: f.suggestion.property, value: f.suggestion.value } : null, previewMappingId: approvedPreviewForSource(f.path)?.id ?? null, reviewStatus: f.id === 'RTL.ICON.PROGRESSION:237172da962fe4d0605ddd83' ? 'Needs Manual Investigation' : 'Not Reviewed', reviewClassification, eligibility: eligibility.eligibility, eligibilityReason: eligibility.reason, eligibilityEvidence: eligibility.evidence, eligibilityTransformationId: eligibility.transformationId, eligibilityBlockers: eligibility.blockers, ...(f.exceptionReason ? { exceptionReason: f.exceptionReason } : {}), ...(f.originalCategory ? { originalCategory: f.originalCategory } : {}) }; }
|
|
9
|
-
export function toDashboardData(report, snippets) { const refs = new Map(report.evidenceReferences.map(ref => [ref.findingId, ref])); const
|
|
10
|
-
const key = f.category === '
|
|
9
|
+
export function toDashboardData(report, snippets) { const refs = new Map(report.evidenceReferences.map(ref => [ref.findingId, ref])); const reported = report.findings.slice().sort((a, b) => sort(a.path, b.path) || a.range.start.offset - b.range.start.offset || sort(a.id, b.id)).map(f => mapFinding(f, refs.get(f.id), snippets?.sourceTextByPath?.[f.path])); const findings = reported.filter(f => !['INFORMATIONAL', 'INTENTIONAL_LTR'].includes(f.category) && f.ruleId !== 'RTL.RUNTIME.DIRECTION_UNKNOWN'); const actionable = findings; const queue = { critical: [], major: [], minor: [], runtimeConfig: [] }; for (const f of findings) {
|
|
10
|
+
const key = f.category === 'RUNTIME_CONFIG' ? 'runtimeConfig' : f.severity.toLowerCase();
|
|
11
11
|
(queue[key] ??= []).push(f);
|
|
12
12
|
} for (const values of Object.values(queue))
|
|
13
13
|
values.sort(findingSort); const byPath = new Map(); for (const f of findings)
|
|
@@ -19,4 +19,4 @@ export function toDashboardData(report, snippets) { const refs = new Map(report.
|
|
|
19
19
|
folder.folders.set(name, child);
|
|
20
20
|
} child.findingCount += fs.length; folder = child; });
|
|
21
21
|
folder.files.push({ name: parts.at(-1), path, findingCount: fs.length, findingIds: fs.map(f => f.id).sort(sort) });
|
|
22
|
-
} const freeze = (f) => ({ name: f.name, path: f.path, findingCount: f.findingCount, folders: [...f.folders.values()].sort((a, b) => sort(a.name, b.name)).map(freeze), files: f.files.sort((a, b) => sort(a.name, b.name) || sort(a.path, b.path)) }); const direct = findings.flatMap(f => f.applications); const sharedOwnership = null; const sharedImpact = null; const unresolved = null; const refsList = [...refs.values()]; return { viewModelVersion: 1, kind: report.kind, schemaVersion: report.schemaVersion, inputDigest: report.inputDigest, policyDigest: report.policyDigest, complete: report.complete, filesAnalyzed: report.files.length, skippedPaths: report.skipped.slice().sort(sort), findings: findings.length, actionableFindings: actionable.length, uniqueAffectedFiles:
|
|
22
|
+
} const freeze = (f) => ({ name: f.name, path: f.path, findingCount: f.findingCount, folders: [...f.folders.values()].sort((a, b) => sort(a.name, b.name)).map(freeze), files: f.files.sort((a, b) => sort(a.name, b.name) || sort(a.path, b.path)) }); const direct = findings.flatMap(f => f.applications); const sharedOwnership = null; const sharedImpact = null; const unresolved = null; const visibleIds = new Set(findings.map(f => f.id)); const refsList = [...refs.values()].filter(r => visibleIds.has(r.findingId)); return { viewModelVersion: 1, kind: report.kind, schemaVersion: report.schemaVersion, inputDigest: report.inputDigest, policyDigest: report.policyDigest, complete: report.complete, filesAnalyzed: report.files.length, skippedPaths: report.skipped.slice().sort(sort), findings: findings.length, actionableFindings: actionable.length, uniqueAffectedFiles: new Set(findings.map(f => f.path)).size, diagnostics: report.diagnostics.length, blockingDiagnostics: report.diagnostics.filter(d => d.blocking).length, breakdowns: { severity: breakdown(findings.map(f => f.severity)), category: breakdown(findings.map(f => f.category)), rule: breakdown(findings.map(f => f.ruleId)), confidence: breakdown(findings.map(f => f.confidence)), application: breakdown(direct) }, files: breakdown(findings.map(f => f.path)), owners: breakdown(findings.map(f => f.owner)), warnings: { unresolvedReachability: findings.filter(f => f.applications.length === 0).length, missingEvidence: refsList.reduce((n, r) => n + r.missingEvidenceIds.length, 0), duplicateEvidence: refsList.reduce((n, r) => n + r.duplicateEvidenceIds.length, 0) }, analysisFindings: reported, diagnosticsDetail: report.diagnostics.slice().sort((a, b) => sort(a.path, b.path) || a.range.start.offset - b.range.start.offset || sort(a.code, b.code)).map(d => ({ path: d.path, line: d.range.start.line, column: d.range.start.column, code: d.code, impact: d.impact ?? 'none', blocking: Boolean(d.blocking), message: d.message, rationale: d.rationale ?? '' })), queue, sourceEmbeddingEnabled: Boolean(snippets), explorer: { root: freeze(root), initialFindingId: actionable[0]?.id ?? findings[0]?.id ?? null }, scopeBreakdown: { directApplications: breakdown(direct), sharedLibraryOwnership: sharedOwnership, sharedLibraryImpact: sharedImpact, unresolvedReachability: unresolved }, ...(snippets ? { sourcePrivacyWarning: 'Embedded source may contain sensitive information; review and protect this dashboard accordingly.', sourceSnippets: { sources: snippets.sources, findings: snippets.findings, embeddedBytes: snippets.embeddedBytes } } : {}) }; }
|