walkdiff 0.6.0 → 0.7.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/CHANGELOG.md +16 -0
- package/README.md +2 -2
- package/app-ui/assets/index-DCzspYup.js +63 -0
- package/app-ui/assets/index-DZU5WQ7m.css +1 -0
- package/app-ui/index.html +2 -2
- package/package.json +1 -1
- package/report-ui/assets/index-BY-qwtzV.js +81 -0
- package/report-ui/assets/index-v4H3BNvl.css +1 -0
- package/report-ui/index.html +2 -2
- package/walkdiff.mjs +127 -34
- package/app-ui/assets/index-C9vapwd-.js +0 -63
- package/app-ui/assets/index-tNGj7j9a.css +0 -1
- package/report-ui/assets/index-BjF-nSXK.css +0 -1
- package/report-ui/assets/index-D1vvUwVU.js +0 -81
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--bg:#fff;--bg-subtle:#f6f8fa;--border:#d0d7de;--text:#1f2328;--text-muted:#59636e;--accent:#0969da;--added-bg:#dafbe1;--added-text:#1a7f37;--removed-bg:#ffebe9;--removed-text:#cf222e;--hunk-bg:#ddf4ff;--selected-bg:#eaeef2;--mono:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--topbar-height:48px;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light dark}@media (prefers-color-scheme:dark){:root{--lightningcss-light: ;--lightningcss-dark:initial;--bg:#0d1117;--bg-subtle:#151b23;--border:#3d444d;--text:#e6edf3;--text-muted:#9198a1;--accent:#4493f8;--added-bg:#12261e;--added-text:#3fb950;--removed-bg:#25171c;--removed-text:#f85149;--hunk-bg:#121d2f;--selected-bg:#212830}}*{box-sizing:border-box}body{background:var(--bg);color:var(--text);margin:0;font:14px/1.5 system-ui,-apple-system,Segoe UI,sans-serif}a{color:var(--accent)}code{font-family:var(--mono);background:var(--bg-subtle);border-radius:4px;padding:1px 4px;font-size:12px}.layout{flex-direction:column;height:100vh;display:flex}.changes-panel{flex:1;grid-template-columns:minmax(240px,320px) 1fr;min-height:0;display:grid}.changes-panel[hidden]{display:none}.tab-panel{flex:1;min-height:0}.tab-panel>*{max-width:960px}.report-tabs{border-bottom:1px solid var(--border);flex-wrap:wrap;gap:4px;padding:0 24px;display:flex}.report-tab{color:var(--text-muted);font:inherit;cursor:pointer;background:0 0;border:0;border-bottom:2px solid #0000;align-items:center;gap:6px;margin-bottom:-1px;padding:8px 12px;display:inline-flex}.report-tab:hover{color:var(--text)}.report-tab[aria-selected=true]{border-bottom-color:var(--accent);color:var(--text);font-weight:600}.tab-count{background:var(--selected-bg);border-radius:10px;padding:0 6px;font-size:11px;font-weight:600}.tab-intro{color:var(--text-muted);margin:0 0 12px;font-size:13px}.impact-entry{border:1px solid var(--border);border-radius:6px;margin-bottom:12px}.impact-entry-title{background:var(--bg-subtle);flex-wrap:wrap;align-items:baseline;gap:8px;margin:0;padding:8px 12px;font-size:13px;display:flex}.file-risks>summary{cursor:pointer;padding:4px 0;font-weight:600}.header{border-bottom:1px solid var(--border);padding:16px 24px}.header h1{margin:0 0 4px;font-size:20px}.meta{color:var(--text-muted);margin:0}.file-list{border-right:1px solid var(--border);background:var(--bg-subtle);overflow-y:auto}.file-list ul{margin:0;padding:8px 0;list-style:none}.file{width:100%;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:baseline;gap:8px;padding:4px 12px;display:flex}.file:hover,.file.selected{background:var(--selected-bg)}.path{overflow-wrap:anywhere;font-family:var(--mono);flex:1;font-size:12px}.counts{white-space:nowrap;font-size:12px}.status{font-family:var(--mono);color:var(--text-muted);font-size:11px;font-weight:600}.status-added{color:var(--added-text)}.status-deleted{color:var(--removed-text)}.added{color:var(--added-text)}.removed{color:var(--removed-text)}.content{padding:16px 24px;overflow:auto}.previous-path{color:var(--text-muted)}.similarity{color:var(--text-muted);font-weight:400}.hunk-header td{background:var(--hunk-bg);color:var(--text-muted);padding:4px 8px}.line-number{width:1%;color:var(--text-muted);text-align:right;-webkit-user-select:none;user-select:none;white-space:nowrap;padding:0 8px}.marker{-webkit-user-select:none;user-select:none;width:1.5ch;display:inline-block}.line-added{background:var(--added-bg)}.line-removed{background:var(--removed-bg)}.notice{color:var(--text-muted);padding:24px}.notice-error{color:var(--removed-text)}@media (width<=720px){.layout{height:auto}.changes-panel{grid-template-rows:auto 1fr;grid-template-columns:1fr}.report-tabs{padding:0 8px}.file-list{border-right:0;border-bottom:1px solid var(--border);max-height:40vh}}:root{--quiet-text:#6e7781;--word-added-bg:#aceebb;--word-removed-bg:#ffcecb}@media (prefers-color-scheme:dark){:root{--quiet-text:#7d8590;--word-added-bg:#1a5c34;--word-removed-bg:#8e2a2f}}.review-summary{margin:6px 0 0}.file-group-title{text-transform:uppercase;letter-spacing:.04em;color:var(--text-muted);margin:8px 12px 0;font-size:11px;font-weight:600}.file-hint{color:var(--text-muted);font-family:system-ui,-apple-system,Segoe UI,sans-serif;font-size:11px;display:block}.file-view-header{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;display:flex}.file-view-header h2{font-family:var(--mono);overflow-wrap:anywhere;margin:0;font-size:14px}.view-toggle{border:1px solid var(--border);border-radius:6px;display:inline-flex;overflow:hidden}.view-toggle button{background:var(--bg);color:var(--text);font:inherit;cursor:pointer;border:0;padding:4px 10px;font-size:12px}.view-toggle button[aria-pressed=true]{background:var(--selected-bg);font-weight:600}.unit-summary{color:var(--text-muted);margin:0 0 12px}.unit{border:1px solid var(--border);border-radius:6px;margin-bottom:12px;overflow:hidden}.unit>summary{background:var(--bg-subtle);cursor:pointer;flex-wrap:wrap;align-items:baseline;gap:8px;padding:8px 12px;display:flex}.unit[open]>summary{border-bottom:1px solid var(--border)}.unit-kind{text-transform:uppercase;color:var(--text-muted);font-size:11px;font-weight:600}.unit-name{background:0 0;padding:0;font-size:13px;font-weight:600}.change-label{margin-left:auto;font-size:12px;font-weight:600}.tone-added{color:var(--added-text)}.tone-removed{color:var(--removed-text)}.tone-modified{color:var(--accent)}.tone-quiet{color:var(--quiet-text);font-weight:400}.unit-note{color:var(--text-muted);margin:0;padding:8px 12px}.code{border-collapse:collapse;table-layout:fixed;width:100%;font-family:var(--mono);font-size:12px}.hunks{border:1px solid var(--border)}.line-number-column{width:48px}.line{white-space:pre-wrap;overflow-wrap:anywhere;vertical-align:top;padding:0 8px}.side-by-side .line-number:nth-child(3){border-left:1px solid var(--border)}.empty{background:var(--bg-subtle)}.word-added{background:var(--word-added-bg);border-radius:2px}.word-removed{background:var(--word-removed-bg);border-radius:2px}:root{--syntax-comment:#59636e;--syntax-string:#0a3069;--syntax-constant:#0550ae;--syntax-keyword:#a40e26;--syntax-type:#953800;--syntax-function:#6639ba;--syntax-meta:#116329}@media (prefers-color-scheme:dark){:root{--syntax-comment:#9198a1;--syntax-string:#a5d6ff;--syntax-constant:#79c0ff;--syntax-keyword:#ff7b72;--syntax-type:#ffa657;--syntax-function:#d2a8ff;--syntax-meta:#7ee787}}.syntax{color:var(--syntax-color)}.syntax-comment{--syntax-color:var(--syntax-comment)}.syntax-string{--syntax-color:var(--syntax-string)}.syntax-constant{--syntax-color:var(--syntax-constant)}.syntax-keyword{--syntax-color:var(--syntax-keyword)}.syntax-type{--syntax-color:var(--syntax-type)}.syntax-function{--syntax-color:var(--syntax-function)}.syntax-meta{--syntax-color:var(--syntax-meta)}.syntax.word-added,.syntax.word-removed{color:color-mix(in srgb, var(--syntax-color) 40%, var(--text))}.elided td{background:var(--hunk-bg);padding:0}.elided button{width:100%;color:var(--text-muted);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:2px 8px}@media (width<=720px){.line-number-column{width:32px}}:root{--warning-text:#9a6700;--warning-bg:#fff8c5}@media (prefers-color-scheme:dark){:root{--warning-text:#d29922;--warning-bg:#2b2111}}.impact-summary,.file-hint-impact{color:var(--warning-text)}.impact-badge{background:var(--warning-bg);color:var(--warning-text);border-radius:10px;padding:0 6px;font-size:11px;font-weight:600}.impact{border-top:1px solid var(--border);padding:8px 12px;font-size:13px}.impact-warning{background:var(--warning-bg)}.impact-note{color:var(--text-muted);margin:0}.impact-title{margin:0 0 6px;font-weight:600}.impact-touched>summary{color:var(--text-muted);cursor:pointer;margin-top:6px}.impact-more{color:var(--text-muted);margin:6px 0 0}.reference-list{margin:0;padding:0;list-style:none}.reference{grid-template-columns:auto auto 1fr;align-items:baseline;gap:2px 8px;padding:3px 0;display:grid}.reference a{font-family:var(--mono);font-size:12px}.reference-caller{color:var(--text-muted);font-size:12px}.reference-snippet{overflow-wrap:anywhere;white-space:pre-wrap;grid-column:2/-1}.confidence{text-transform:uppercase;color:var(--text-muted);font-size:10px;font-weight:600}.confidence-exact{color:var(--added-text)}.confidence-possible{color:var(--quiet-text);font-weight:400}:root{--high-text:#cf222e;--high-bg:#ffebe9;--medium-text:#9a6700;--medium-bg:#fff8c5;--low-text:#59636e;--low-bg:#eaeef2}@media (prefers-color-scheme:dark){:root{--high-text:#f85149;--high-bg:#3c1618;--medium-text:#d29922;--medium-bg:#2b2111;--low-text:#9198a1;--low-bg:#262c36}}.level-badge,.severity{text-transform:uppercase;vertical-align:middle;border-radius:4px;padding:0 6px;font-size:11px;font-weight:600;display:inline-block}.level-high,.severity-high{background:var(--high-bg);color:var(--high-text)}.level-medium,.severity-medium{background:var(--medium-bg);color:var(--medium-text)}.level-low,.severity-low{background:var(--low-bg);color:var(--low-text)}.risk-view{max-width:960px}.level-box{border-radius:6px;padding:12px 16px}.level-title{margin:0 0 4px;font-size:16px}.level-explanation{color:var(--text);opacity:.85;margin:0;font-size:13px}.section-title{margin:24px 0 8px;font-size:15px}.risk-list,.risk-places,.not-checked{margin:0;padding:0;list-style:none}.risk{border:1px solid var(--border);border-left-width:3px;border-radius:6px;margin-bottom:8px;padding:8px 12px}.risk-high{border-left-color:var(--high-text)}.risk-medium{border-left-color:var(--medium-text)}.risk-header{flex-wrap:wrap;align-items:baseline;gap:8px;display:flex}.risk-category{color:var(--text-muted);font-size:12px}.risk-title{font-weight:600}.risk-count{color:var(--text-muted)}.risk-detail{color:var(--text-muted);margin:4px 0;font-size:13px}.risk-place{flex-wrap:wrap;align-items:baseline;gap:4px 8px;padding:2px 0;font-size:12px;display:flex}.risk-evidence{overflow-wrap:anywhere;white-space:pre-wrap;flex-basis:100%}.link-button{color:var(--accent);font-family:var(--mono);cursor:pointer;background:0 0;border:0;padding:0;font-size:12px}.link-button:hover{text-decoration:underline}.not-checked li{color:var(--text-muted);padding:4px 0;font-size:13px}.file-risks{margin-bottom:12px}.ai-note{color:var(--text-muted);margin:16px 0 0;font-size:13px}.chapters{margin:0;padding-left:20px}.chapter{margin-bottom:12px}.chapter-title{margin:0;font-weight:600}.chapter-summary{color:var(--text-muted);margin:2px 0 4px;font-size:13px}.chapter-units,.citations{margin:0;padding:0;list-style:none}.chapter-units li,.citations li{flex-wrap:wrap;align-items:baseline;gap:6px;padding:1px 0;font-size:12px;display:flex}.chapter-path{color:var(--text-muted);font-family:var(--mono);font-size:11px}.ai-list{margin:0;padding:0;list-style:none}.ai-list.questions{padding-left:20px;list-style:decimal}.ai-item{margin-bottom:10px}.ai-item-title{font-weight:600}.ai-item-detail{color:var(--text-muted);margin:2px 0 4px;font-size:13px}.verdict{text-transform:uppercase;border-radius:4px;margin-right:8px;padding:0 6px;font-size:11px;font-weight:600;display:inline-block}.verdict-matches{background:var(--added-bg);color:var(--added-text)}.verdict-contradicts{background:var(--high-bg);color:var(--high-text)}.verdict-undocumented,.verdict-notFound{background:var(--medium-bg);color:var(--medium-text)}.file-map{border:1px solid var(--border);background:var(--bg-subtle);border-radius:6px;margin-bottom:12px;padding:8px 12px}.file-map-note{color:var(--text-muted);margin:0 0 6px;font-size:12px}.file-map-rows{margin:0;padding:0;list-style:none}.file-map-row{flex-wrap:wrap;align-items:baseline;gap:2px 8px;padding:2px 0;font-size:12px;display:flex}.file-map-row .change-label{margin-left:0}.file-map-size,.file-map-link,.file-map-unchanged{color:var(--text-muted);font-size:11px}.file-map-unchanged{padding:1px 0;font-style:italic}.unit-facts{border-bottom:1px solid var(--border);margin:0;padding:6px 12px 6px 28px;font-size:12px}.unit{scroll-margin-top:8px}.guide{max-width:1120px;margin:0 auto;padding:36px 32px 72px;font-size:15px}.guide-eyebrow,.guide-path,.guide-note,.guide-keys,.guide-lede{color:var(--text-muted);margin:0}.guide-eyebrow{margin-bottom:8px;font-size:14px}.guide-title{letter-spacing:-.01em;text-wrap:balance;margin:0 0 8px;font-size:30px;font-weight:650;line-height:1.25}.guide-title+.guide-lede{margin-bottom:28px}.guide-heading{margin:0 0 10px;font-size:15px;font-weight:600}.guide-all-clear{border:1px solid var(--border);border-radius:8px;padding:14px 16px}.guide-checks{border:1px solid var(--border);border-radius:8px;margin:0 0 8px;padding:0;list-style:none}.guide-check{border-left:3px solid var(--border);overflow-wrap:anywhere;padding:12px 16px 12px 14px}.guide-check+.guide-check{border-top:1px solid var(--border)}.guide-check-high{border-left-color:var(--high-text)}.guide-check-medium{border-left-color:var(--medium-text)}.guide-start{border:1px solid var(--border);background:var(--bg-subtle);border-radius:12px;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:16px 24px;margin:0 0 28px;padding:22px 24px;display:flex}.guide-effort{flex:280px;min-width:0}.guide-button{border:1px solid var(--border);color:var(--text);white-space:nowrap;border-radius:6px;padding:9px 18px;font-weight:500;text-decoration:none;display:inline-block}.guide-button:hover{background:var(--bg-subtle)}.guide-button-primary,.guide-button-primary:hover{border-color:var(--accent);background:var(--accent);color:var(--bg);font-weight:600}.guide-button-primary:hover{filter:brightness(1.08)}.guide-start .guide-button-primary{border-radius:8px;padding:11px 26px;font-size:15px}.guide-progress{background:var(--selected-bg);border-radius:2px;height:4px}.guide-progress-bar{background:var(--accent);border-radius:2px;height:4px}.guide-stop-title{overflow-wrap:anywhere;margin:0 0 2px;font-size:20px}.guide-stop-kind{color:var(--text-muted);margin-left:6px;font-size:13px;font-weight:400}.guide-path{overflow-wrap:anywhere;margin-bottom:14px;font-size:13px}.guide-why{background:var(--bg-subtle);border-radius:8px;margin:14px 0;padding:12px 16px}.guide-why-title{margin:0 0 4px;font-weight:600}.guide-why ul,.guide-facts,.guide-plain-list{margin:0;padding-left:20px}.guide-why p{margin:0}.guide-facts{color:var(--text-muted);margin-bottom:14px;font-size:14px}.guide-section{margin-top:24px}.guide-details>summary{cursor:pointer;font-weight:600}.guide-evidence{overflow-wrap:anywhere;font-size:14px}.guide-evidence p{color:var(--text-muted);margin:0 0 6px}.guide-evidence .guide-coverage{color:var(--text)}.guide-coverage-full strong{color:var(--added-text)}.guide-coverage-gap strong{color:var(--medium-text)}.guide-nav{border-top:1px solid var(--border);justify-content:space-between;align-items:center;gap:16px;margin-top:32px;padding-top:16px;display:flex}.guide-keys{text-align:center;margin-top:10px;font-size:12px}.guide-check a{color:inherit;text-decoration:underline;-webkit-text-decoration-color:var(--border);text-decoration-color:var(--border);text-underline-offset:3px}.guide-with-rail{grid-template-columns:300px minmax(0,1fr);align-items:start;max-width:1500px;margin:0 auto;display:grid}.guide-rail{top:var(--topbar-height);box-sizing:border-box;height:calc(100vh - var(--topbar-height));border-right:1px solid var(--border);flex-direction:column;padding:20px 12px 16px;font-size:13px;display:flex;position:sticky}.guide-rail-brief{margin:0 8px 14px}.guide-rail-title{margin:0 8px 8px;font-size:14px;font-weight:600}.guide-rail>.guide-progress{flex:none;margin:0 8px 12px}.guide-rail-list{flex:1;min-height:0;margin:0;padding:0;list-style:none;overflow-y:auto}.guide-rail-item{color:var(--text);border-radius:6px;align-items:flex-start;gap:10px;padding:7px 8px;text-decoration:none;display:flex}.guide-rail-item:hover{background:var(--bg-subtle);text-decoration:none}.guide-rail-item-current,.guide-rail-item-current:hover{background:var(--selected-bg)}.guide-rail-mark{box-sizing:border-box;border:1px solid var(--border);width:20px;height:20px;color:var(--text-muted);text-align:center;border-radius:50%;flex:none;font-size:11px;line-height:18px}.guide-rail-item-current .guide-rail-mark{border-color:var(--accent);color:var(--accent)}.guide-rail-item-done .guide-rail-mark{border-color:var(--added-text);background:var(--added-text);color:var(--bg)}.guide-rail-text{flex:1;min-width:0}.guide-rail-discussion{color:var(--text-muted);white-space:nowrap;flex:none;margin-left:auto;font-size:11px}.guide-rail-name,.guide-rail-path{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.guide-rail-name{font-family:var(--mono);font-size:12px}.guide-rail-item-done .guide-rail-name{color:var(--text-muted)}.guide-rail-path{color:var(--text-muted);text-align:left;direction:rtl;font-size:11px}.guide-rail-comment{color:var(--accent);flex:none;font-size:11px}.guide-rail-finish{color:var(--text);border-radius:6px;flex:none;margin-top:6px;padding:7px 8px 7px 38px}.guide-rail-finish-current{background:var(--selected-bg)}.guide-rail-overall{border-top:1px solid var(--border);color:var(--text-muted);flex:none;margin:10px 8px 0;padding-top:12px}.guide-rail-overall p{margin:0 0 6px}.guide-rail-overall a{margin-top:8px;display:inline-block}.guide-stop{min-width:0;padding:28px 32px 48px;font-size:15px}.guide-finish{max-width:760px}.guide-stop-number{color:var(--text-muted);margin-right:4px;font-weight:400}.guide-nav-forward{flex-wrap:wrap;gap:10px;display:flex}button.guide-button{background:var(--bg);font:inherit;cursor:pointer;font-weight:500}button.guide-button:hover{background:var(--bg-subtle)}button.guide-button-primary,button.guide-button-primary:hover{background:var(--accent)}.review-controls{flex-wrap:wrap;align-items:flex-start;gap:8px 12px;display:flex}.review-mark,.review-comment-add{border:1px solid var(--border);background:var(--bg);color:var(--text);font:inherit;cursor:pointer;border-radius:6px;padding:5px 12px;font-size:13px}.review-mark:hover,.review-comment-add:hover{background:var(--bg-subtle)}.review-mark-done{border-color:var(--added-text);color:var(--added-text)}.review-comment{flex:100%}.review-comment-label{margin-bottom:4px;font-size:13px;font-weight:600;display:block}.review-comment textarea{box-sizing:border-box;border:1px solid var(--border);background:var(--bg);width:100%;color:var(--text);font:inherit;resize:vertical;border-radius:6px;padding:8px 10px;font-size:14px}.review-comment-note{color:var(--text-muted);margin:4px 0 0;font-size:12px}.unit-review{border-top:1px solid var(--border);padding:10px 12px}.unit-reviewed,.file-review-done{color:var(--added-text)}.unit-reviewed{font-size:12px}.file-comment-count{color:var(--text-muted);white-space:nowrap;flex:none;margin-left:4px;font-size:11px}.file-review-mark{color:var(--text-muted);flex:none;margin-left:4px;font-size:11px}.file-review-done{color:var(--added-text);font-size:13px}.guide-comment-list{margin:0 0 12px;padding:0;list-style:none}.guide-comment-list li{border-top:1px solid var(--border);overflow-wrap:anywhere;padding:10px 0}.guide-comment-list p{white-space:pre-wrap;margin:4px 0 0}@media (width<=900px){.guide-with-rail{grid-template-columns:minmax(0,1fr)}.guide-rail{border-right:0;border-bottom:1px solid var(--border);height:auto;max-height:45vh;position:static}.guide-stop{padding:20px 16px 40px}}.guide-updated{background:var(--hunk-bg);border-radius:8px;margin:0 0 20px;padding:12px 16px}.guide-since{margin:0 0 6px;font-weight:600}.guide-rail-item-outdated .guide-rail-mark{border-color:var(--medium-text);color:var(--medium-text)}.unit-changed{color:var(--medium-text);font-size:12px}.guide-panel{border:1px solid var(--border);background:var(--bg-subtle);border-radius:8px;margin-top:20px;padding:16px 18px}.guide-panel .guide-note{margin-top:8px}.guide-warning{border:1px solid var(--medium-text);background:var(--medium-bg);border-radius:8px;margin-top:24px;padding:16px 18px}.guide-warning-title{color:var(--medium-text);margin:0 0 4px;font-size:16px;font-weight:600}.guide-warning-lede{margin:0 0 12px}.guide-warning-list{margin:0;padding:0;list-style:none}.guide-warning-list li{border-top:1px solid var(--border);overflow-wrap:anywhere;padding:10px 0}.guide-warning-reason{margin-top:2px;font-size:14px;display:block}.guide-warning-reason code{background:var(--bg);font-family:var(--mono);border-radius:4px;padding:1px 5px;font-size:12px}.guide-submit textarea{box-sizing:border-box;border:1px solid var(--border);background:var(--bg);width:100%;color:var(--text);font:inherit;resize:vertical;border-radius:6px;padding:8px 10px;font-size:14px}.guide-submit-events{border:0;gap:8px;margin:12px 0;padding:0;display:grid}.guide-submit-events label{cursor:pointer;gap:8px;display:flex}.guide-submit-hint{color:var(--text-muted);font-size:13px;display:block}.guide-submit-row{flex-wrap:wrap;align-items:center;gap:12px;margin-top:12px;display:flex}.guide-submit-posted{color:var(--added-text);font-weight:600}.guide-error{color:var(--high-text);white-space:pre-wrap;overflow-wrap:anywhere;margin:8px 0 0}.reviewer-summary{flex-wrap:wrap;gap:8px;margin:-16px 0 20px;padding:0;font-size:13px;list-style:none;display:flex}.reviewer-badge{background:var(--low-bg);color:var(--low-text);border-radius:999px;padding:2px 10px}.reviewer-badge-approved{background:var(--added-bg);color:var(--added-text)}.reviewer-badge-changesRequested{background:var(--high-bg);color:var(--high-text)}.conversation{max-width:900px}.thread{border:1px solid var(--border);overflow-wrap:anywhere;border-radius:8px;margin:12px 0;padding:12px 14px}.thread-resolved{background:var(--bg-subtle)}.thread-summary{cursor:pointer;flex-wrap:wrap;align-items:baseline;gap:4px 10px;display:flex}.thread[open]>.thread-summary{margin-bottom:10px}.thread-place{color:var(--text-muted);font-family:var(--mono);font-size:12px}.thread-excerpt{flex:240px;min-width:0;font-size:14px}.thread[open] .thread-excerpt{display:none}.thread-tags{gap:6px;display:flex}.thread-tag{background:var(--bg-subtle);color:var(--text-muted);border-radius:999px;padding:1px 6px;font-size:11px}.thread-code{margin-bottom:8px}.thread-context{border:1px solid var(--border);border-collapse:separate;border-spacing:0;width:100%;font-family:var(--mono);border-radius:6px;margin-bottom:6px;font-size:12px;overflow:hidden}.thread-context td{vertical-align:top;padding:1px 8px}.thread-context-number,.thread-context-marker{width:1%;color:var(--text-muted);text-align:right;white-space:nowrap;-webkit-user-select:none;user-select:none}.thread-context-text code{white-space:pre-wrap;overflow-wrap:anywhere}.thread-context-added{background:var(--added-bg)}.thread-context-removed{background:var(--removed-bg)}.thread-context-commented td{box-shadow:inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent)}.thread-context-commented .thread-context-number{box-shadow:inset 3px 0 0 var(--accent), inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent);color:var(--accent);font-weight:600}.line-focused td{background:color-mix(in srgb, var(--accent) 22%, transparent);transition:background .6s}.thread-no-context{color:var(--text-muted);margin:0 0 6px;font-size:13px}.thread-comment{border-top:1px solid var(--border);padding:8px 0}.thread-comment p{white-space:pre-wrap;margin:4px 0 0}.thread-author{font-size:13px;font-weight:600}.thread-actions{flex-wrap:wrap;gap:8px;margin-top:10px;display:flex}.thread-actions textarea{box-sizing:border-box;border:1px solid var(--border);background:var(--bg);color:var(--text);font:inherit;border-radius:6px;flex:100%;padding:8px 10px;font-size:14px}.sr-only{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.impact-lead{flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:8px 16px;margin-bottom:14px;display:flex}.impact-lead-text{color:var(--text-muted);flex:420px;margin:0}.impact-lead-text strong{color:var(--text)}.impact-view .impact-entry{border:1px solid var(--border);border-left-width:3px;border-radius:6px;margin:0 0 8px;padding:0}.impact-tone-warning{border-left-color:var(--high-text)!important}.impact-tone-attention{border-left-color:var(--medium-text)!important}.impact-entry-summary{cursor:pointer;padding:10px 14px 10px 30px;list-style:none;display:block;position:relative}.impact-entry-summary::-webkit-details-marker{display:none}.impact-entry-summary:before{content:"▸";color:var(--text-muted);position:absolute;left:12px}.impact-entry[open]>.impact-entry-summary:before{content:"▾"}.impact-entry-summary:hover{background:var(--bg-subtle)}.impact-entry-headline{overflow-wrap:anywhere;font-weight:600;display:block}.impact-tone-warning .impact-entry-headline{color:var(--high-text)}.impact-entry-place{color:var(--text-muted);overflow-wrap:anywhere;margin-top:2px;font-size:13px;display:block}.impact-entry-body{border-top:1px solid var(--border);padding:4px 14px 12px}.guide-explain,.ai-more{border:1px solid var(--border);border-radius:8px;margin:14px 0;padding:10px 14px}.guide-explain summary,.ai-more>summary{cursor:pointer;font-weight:600}.guide-explain li{margin-bottom:4px}.guide-tools{color:var(--text-muted);margin:8px 0}.guide-tools strong{color:var(--text)}.check-table{border-collapse:collapse;width:100%;margin-bottom:8px}.check-table th,.check-table td{border-bottom:1px solid var(--border);text-align:left;vertical-align:top;padding:7px 10px}.check-table thead th{color:var(--text-muted);font-size:12px;font-weight:600}.check-table tbody td:last-child{color:var(--text-muted);overflow-wrap:anywhere}.check-result{white-space:nowrap}.check-issues .check-result,.check-notRun .check-result{color:var(--medium-text);font-weight:600}.check-clean .check-result{color:var(--added-text)}.ai-points{margin:0 0 8px;padding:0;list-style:none}.ai-point{border-bottom:1px solid var(--border);padding:8px 0}.ai-point summary,.ai-notes summary,.ai-chapters summary{cursor:pointer}.ai-notes{margin:0;padding:0;list-style:none}.ai-notes li{padding:6px 0}.ai-chapters{margin:10px 0 0;padding-left:22px}.ai-chapters li{margin-bottom:6px}.topbar{z-index:10;box-sizing:border-box;min-height:var(--topbar-height);border-bottom:1px solid var(--border);background:var(--bg-subtle);flex-shrink:0;align-items:center;gap:8px 28px;padding:6px 24px;font-size:13px;display:flex;position:sticky;top:0}.topbar-trail{white-space:nowrap;align-items:center;gap:8px;min-width:0;display:flex}.topbar-brand{align-items:center;gap:8px;font-size:14px;font-weight:650;display:inline-flex}.topbar-logo{border-radius:5px;flex-shrink:0}.topbar-separator,.topbar-progress{color:var(--text-muted)}.topbar-nav{gap:4px;display:flex}.topbar-nav a{color:var(--text-muted);white-space:nowrap;border-radius:6px;padding:5px 10px;text-decoration:none}.topbar-nav a:hover{color:var(--text)}.topbar-nav a[aria-current=page]{background:var(--selected-bg);color:var(--text);font-weight:600}.topbar-progress{white-space:nowrap;margin:0 0 0 auto}.guide-heading-block{border-bottom:1px solid var(--border);margin-bottom:28px;padding-bottom:24px}.guide-columns{grid-template-columns:minmax(0,1fr) 300px;align-items:start;gap:32px;display:grid}.guide-effort-title{letter-spacing:-.01em;margin:0 0 2px;font-size:20px;font-weight:650}.guide-effort .guide-progress{margin-top:10px}.guide-sidebar{gap:16px;display:grid}.guide-stats{border:1px solid var(--border);background:var(--border);border-radius:12px;grid-template-columns:1fr 1fr;gap:1px;margin:0;display:grid;overflow:hidden}.guide-stat{background:var(--bg);min-width:0;padding:12px 14px}.guide-stat dt{color:var(--text-muted);font-size:12px}.guide-stat dd{overflow-wrap:anywhere;margin:2px 0 0;font-size:20px;font-weight:650}.guide-card{border:1px solid var(--border);border-radius:12px;padding:14px 16px}.guide-card-title{justify-content:space-between;margin:0 0 8px;font-size:13px;font-weight:600;display:flex}.guide-card-title a{font-weight:400}.guide-check-summary{margin:0;padding:0;font-size:13px;list-style:none}.guide-check-summary li{justify-content:space-between;gap:12px;padding:3px 0;display:flex}.guide-all-clear,.guide-checks{margin-bottom:24px}@media (width<=900px){.guide{padding:24px 16px 56px}.guide-title{font-size:24px}.guide-columns{grid-template-columns:minmax(0,1fr);gap:24px}.topbar{flex-wrap:wrap;padding:6px 16px}.topbar-progress{display:none}}.line-number-button{width:100%;color:inherit;font:inherit;text-align:inherit;cursor:pointer;background:0 0;border:0;padding:0}.line-number-button:hover,.line-number-button:focus-visible{color:var(--accent);text-decoration:underline}.line-number-selected{background:var(--hunk-bg);color:var(--accent)}.line-number-commented{box-shadow:inset 3px 0 0 var(--accent)}.line-comment-panel{z-index:5;border:1px solid var(--accent);background:var(--bg);border-radius:10px;margin-top:12px;padding:12px 14px;position:sticky;bottom:0;box-shadow:0 -4px 16px #00000026}.line-comment-panel textarea{box-sizing:border-box;width:100%;font:inherit;margin:6px 0 8px}.line-comment-actions{gap:8px;display:flex}.line-comment-list{margin:12px 0 0;padding:0;font-size:13px;list-style:none}.line-comment-list li{overflow-wrap:anywhere;padding:4px 0}.line-comment-text{color:var(--text-muted)}
|
package/report-ui/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Walkdiff review</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-BY-qwtzV.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="./assets/index-v4H3BNvl.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<!-- Replaced when the script starts, so a script that never runs is not a blank page. -->
|
package/walkdiff.mjs
CHANGED
|
@@ -156,6 +156,39 @@ async function exists(path) {
|
|
|
156
156
|
return false;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
+
// packages/review-model/src/analysisSteps.ts
|
|
160
|
+
/**
|
|
161
|
+
* The steps of analyzing a PR, in the order they run. The app shows where an analysis is,
|
|
162
|
+
* and the CLI prints each one, so a long run never looks stuck.
|
|
163
|
+
*/
|
|
164
|
+
const AnalysisStep = {
|
|
165
|
+
FetchingPullRequest: "fetchingPullRequest",
|
|
166
|
+
FetchingCommits: "fetchingCommits",
|
|
167
|
+
ReadingChanges: "readingChanges",
|
|
168
|
+
TracingCallers: "tracingCallers",
|
|
169
|
+
CheckingDependencies: "checkingDependencies",
|
|
170
|
+
ScanningCode: "scanningCode",
|
|
171
|
+
CheckingQuality: "checkingQuality",
|
|
172
|
+
CheckingBreakingChanges: "checkingBreakingChanges",
|
|
173
|
+
FindingCoverage: "findingCoverage",
|
|
174
|
+
ReviewingWithAi: "reviewingWithAi"
|
|
175
|
+
};
|
|
176
|
+
const STEP_LABELS = {
|
|
177
|
+
[AnalysisStep.FetchingPullRequest]: "Fetching the pull request",
|
|
178
|
+
[AnalysisStep.FetchingCommits]: "Fetching its commits",
|
|
179
|
+
[AnalysisStep.ReadingChanges]: "Reading the changed code",
|
|
180
|
+
[AnalysisStep.TracingCallers]: "Finding code that uses it",
|
|
181
|
+
[AnalysisStep.CheckingDependencies]: "Checking dependencies",
|
|
182
|
+
[AnalysisStep.ScanningCode]: "Scanning for security problems",
|
|
183
|
+
[AnalysisStep.CheckingQuality]: "Checking code quality",
|
|
184
|
+
[AnalysisStep.CheckingBreakingChanges]: "Looking for breaking changes",
|
|
185
|
+
[AnalysisStep.FindingCoverage]: "Looking for test coverage",
|
|
186
|
+
[AnalysisStep.ReviewingWithAi]: "Waiting for the AI review"
|
|
187
|
+
};
|
|
188
|
+
Object.values(AnalysisStep);
|
|
189
|
+
function stepLabel(step) {
|
|
190
|
+
return STEP_LABELS[step];
|
|
191
|
+
}
|
|
159
192
|
const GitHostKind = {
|
|
160
193
|
GitHub: "github",
|
|
161
194
|
GitLab: "gitlab"
|
|
@@ -664,6 +697,8 @@ const reviewSummarySchema = z.object({
|
|
|
664
697
|
/** `owner/repo#12` or `group/project!12`, known before the analysis finishes. */
|
|
665
698
|
displayName: z.string(),
|
|
666
699
|
status: z.enum(ReviewStatus),
|
|
700
|
+
/** The step a running analysis is on; null unless analyzing. Kept in memory, not stored. */
|
|
701
|
+
step: z.enum(AnalysisStep).nullable().default(null),
|
|
667
702
|
/** Why the last analysis failed; null otherwise. */
|
|
668
703
|
error: z.string().nullable(),
|
|
669
704
|
/** False until an analysis succeeds; a failed refresh keeps the earlier report. */
|
|
@@ -1025,6 +1060,8 @@ const reviewThreadSchema = z.object({
|
|
|
1025
1060
|
path: z.string().nullable(),
|
|
1026
1061
|
/** Null when the code it was on has since changed, or it isn't on a line. */
|
|
1027
1062
|
line: lineSchema.nullable(),
|
|
1063
|
+
/** Which version of the file `line` counts in: a comment on a removed line is on the old one. */
|
|
1064
|
+
side: z.enum(LineSide).default(LineSide.New),
|
|
1028
1065
|
isResolved: z.boolean(),
|
|
1029
1066
|
isOutdated: z.boolean(),
|
|
1030
1067
|
comments: z.array(threadCommentSchema).readonly()
|
|
@@ -6279,6 +6316,7 @@ async function assessRisk(request) {
|
|
|
6279
6316
|
noise: file.noise,
|
|
6280
6317
|
after: request.headTexts.at(index)
|
|
6281
6318
|
})).filter((file) => !isIgnored(config, file.diff.path));
|
|
6319
|
+
request.reportStep(AnalysisStep.CheckingDependencies);
|
|
6282
6320
|
const dependencies = await scanDependencies({
|
|
6283
6321
|
repoDir: request.repoDir,
|
|
6284
6322
|
base: request.base,
|
|
@@ -6290,6 +6328,7 @@ async function assessRisk(request) {
|
|
|
6290
6328
|
privatePackages: config.dependencies.private,
|
|
6291
6329
|
allowedLicenses: config.dependencies.allowedLicenses ?? void 0
|
|
6292
6330
|
});
|
|
6331
|
+
request.reportStep(AnalysisStep.ScanningCode);
|
|
6293
6332
|
const codeScan = await runCodeScanners({
|
|
6294
6333
|
files: scanned,
|
|
6295
6334
|
semgrepRules: config.scanners.semgrep.rules,
|
|
@@ -6297,11 +6336,13 @@ async function assessRisk(request) {
|
|
|
6297
6336
|
run: request.runScanner,
|
|
6298
6337
|
disabled: request.disabledChecks
|
|
6299
6338
|
});
|
|
6339
|
+
request.reportStep(AnalysisStep.CheckingQuality);
|
|
6300
6340
|
const quality = config.quality.enabled ? await assessQuality(request, scanned, config) : {
|
|
6301
6341
|
findings: [],
|
|
6302
6342
|
checksRun: [],
|
|
6303
6343
|
notChecked: [QUALITY_TURNED_OFF]
|
|
6304
6344
|
};
|
|
6345
|
+
request.reportStep(AnalysisStep.CheckingBreakingChanges);
|
|
6305
6346
|
const breaking = await scanBreakingChanges({
|
|
6306
6347
|
repoDir: request.repoDir,
|
|
6307
6348
|
base: request.base,
|
|
@@ -6830,6 +6871,8 @@ function lastSegment(call) {
|
|
|
6830
6871
|
const NUL = 0;
|
|
6831
6872
|
/** Diffs the two commits and runs every analysis layer over the changed files. */
|
|
6832
6873
|
async function analyzeChangedFiles(repoDir, from, to, options) {
|
|
6874
|
+
const reportStep = options.reportStep ?? ignoreStep;
|
|
6875
|
+
reportStep(AnalysisStep.ReadingChanges);
|
|
6833
6876
|
const diffs = await collectFileDiffs(repoDir, from, to);
|
|
6834
6877
|
const texts = await readFileTexts(repoDir, from, to, diffs);
|
|
6835
6878
|
const noise = diffs.map((diff, index) => classifyNoise(diff.path, textAt(texts, index).after ?? textAt(texts, index).before));
|
|
@@ -6837,6 +6880,7 @@ async function analyzeChangedFiles(repoDir, from, to, options) {
|
|
|
6837
6880
|
const versions = await Promise.all(diffs.map((diff, index) => extractVersions(diff, textAt(texts, index), plans.at(index))));
|
|
6838
6881
|
const analyzed = versions.filter((version) => version !== void 0);
|
|
6839
6882
|
const unitsByPath = compareUnits(analyzed);
|
|
6883
|
+
reportStep(AnalysisStep.TracingCallers);
|
|
6840
6884
|
const impacts = await traceImpact(repoDir, to, analyzedFiles(diffs, plans, unitsByPath));
|
|
6841
6885
|
const withImpact = (unit) => ({
|
|
6842
6886
|
...unit,
|
|
@@ -6859,10 +6903,12 @@ async function analyzeChangedFiles(repoDir, from, to, options) {
|
|
|
6859
6903
|
versions: analyzed,
|
|
6860
6904
|
network: options.network,
|
|
6861
6905
|
runScanner: options.runScanner ?? runScannerProcess,
|
|
6862
|
-
disabledChecks: new Set(options.disabledChecks)
|
|
6906
|
+
disabledChecks: new Set(options.disabledChecks),
|
|
6907
|
+
reportStep
|
|
6863
6908
|
})
|
|
6864
6909
|
};
|
|
6865
6910
|
}
|
|
6911
|
+
function ignoreStep() {}
|
|
6866
6912
|
function analyzedFiles(diffs, plans, unitsByPath) {
|
|
6867
6913
|
return diffs.flatMap((diff, index) => {
|
|
6868
6914
|
const plan = plans.at(index);
|
|
@@ -8288,14 +8334,25 @@ function getJson(request) {
|
|
|
8288
8334
|
return send(request, { headers: request.headers });
|
|
8289
8335
|
}
|
|
8290
8336
|
function writeJson(request) {
|
|
8291
|
-
return send(request,
|
|
8337
|
+
return send(request, jsonWriteInit(request));
|
|
8338
|
+
}
|
|
8339
|
+
/**
|
|
8340
|
+
* Sends a write whose reply isn't needed, without reading the reply. Some writes answer
|
|
8341
|
+
* 204 No Content, such as GitLab publishing draft notes; parsing that empty body as JSON
|
|
8342
|
+
* reported a review that had been posted as failed, and posting again duplicated it.
|
|
8343
|
+
*/
|
|
8344
|
+
async function writeIgnoringReply(request) {
|
|
8345
|
+
await throwIfFailed(await fetchWithinOrigin(request.url, jsonWriteInit(request)), request);
|
|
8346
|
+
}
|
|
8347
|
+
function jsonWriteInit(request) {
|
|
8348
|
+
return {
|
|
8292
8349
|
method: request.method,
|
|
8293
8350
|
headers: {
|
|
8294
8351
|
...request.headers,
|
|
8295
8352
|
"Content-Type": "application/json"
|
|
8296
8353
|
},
|
|
8297
8354
|
body: JSON.stringify(request.body)
|
|
8298
|
-
}
|
|
8355
|
+
};
|
|
8299
8356
|
}
|
|
8300
8357
|
/**
|
|
8301
8358
|
* Downloads a file, or resolves to undefined if it is larger than `maxBytes`. Unlike API calls this
|
|
@@ -8341,14 +8398,16 @@ async function readLimited(response, maxBytes) {
|
|
|
8341
8398
|
}
|
|
8342
8399
|
async function send(request, init) {
|
|
8343
8400
|
const response = await fetchWithinOrigin(request.url, init);
|
|
8344
|
-
|
|
8345
|
-
const body = (await response.text()).slice(0, MAX_ERROR_BODY_CHARS);
|
|
8346
|
-
const detail = UNAUTHORIZED_STATUSES.has(response.status) ? `${body}\n${request.authHint}` : body;
|
|
8347
|
-
throw new HostApiError(response.status, request.url, detail);
|
|
8348
|
-
}
|
|
8401
|
+
await throwIfFailed(response, request);
|
|
8349
8402
|
const body = await response.json();
|
|
8350
8403
|
return request.schema.parse(body);
|
|
8351
8404
|
}
|
|
8405
|
+
async function throwIfFailed(response, request) {
|
|
8406
|
+
if (response.ok) return;
|
|
8407
|
+
const body = (await response.text()).slice(0, MAX_ERROR_BODY_CHARS);
|
|
8408
|
+
const detail = UNAUTHORIZED_STATUSES.has(response.status) ? `${body}\n${request.authHint}` : body;
|
|
8409
|
+
throw new HostApiError(response.status, request.url, detail);
|
|
8410
|
+
}
|
|
8352
8411
|
/**
|
|
8353
8412
|
* Follows redirects only on the same origin. `fetch` drops `Authorization` when it leaves an
|
|
8354
8413
|
* origin but keeps custom headers, so GitLab's `PRIVATE-TOKEN` would go wherever a redirect
|
|
@@ -8417,14 +8476,17 @@ const issueCommentSchema = z.object({
|
|
|
8417
8476
|
body: z.string().nullable()
|
|
8418
8477
|
});
|
|
8419
8478
|
const compareSchema = z.object({ merge_base_commit: z.object({ sha: commitShaSchema }) });
|
|
8479
|
+
const THREADS_PER_PAGE = 100;
|
|
8480
|
+
const GITHUB_LEFT = "LEFT";
|
|
8481
|
+
const GITHUB_RIGHT = "RIGHT";
|
|
8420
8482
|
const CONVERSATION_QUERY = `query($owner: String!, $repo: String!, $number: Int!) {
|
|
8421
8483
|
repository(owner: $owner, name: $repo) {
|
|
8422
8484
|
pullRequest(number: $number) {
|
|
8423
8485
|
latestReviews(first: 30) { nodes { state author { login } } }
|
|
8424
|
-
reviewThreads(first:
|
|
8486
|
+
reviewThreads(first: ${THREADS_PER_PAGE}) {
|
|
8425
8487
|
pageInfo { hasNextPage }
|
|
8426
8488
|
nodes {
|
|
8427
|
-
id isResolved isOutdated path line
|
|
8489
|
+
id isResolved isOutdated path line diffSide
|
|
8428
8490
|
comments(first: 50) { nodes { bodyText createdAt url author { login } } }
|
|
8429
8491
|
}
|
|
8430
8492
|
}
|
|
@@ -8448,6 +8510,7 @@ const conversationResponseSchema = z.object({ repository: z.object({ pullRequest
|
|
|
8448
8510
|
isOutdated: z.boolean(),
|
|
8449
8511
|
path: z.string(),
|
|
8450
8512
|
line: z.number().int().positive().nullable(),
|
|
8513
|
+
diffSide: z.enum([GITHUB_LEFT, GITHUB_RIGHT]),
|
|
8451
8514
|
comments: z.object({ nodes: z.array(z.object({
|
|
8452
8515
|
bodyText: z.string(),
|
|
8453
8516
|
createdAt: z.string(),
|
|
@@ -8533,6 +8596,7 @@ var GitHubHost = class {
|
|
|
8533
8596
|
id: thread.id,
|
|
8534
8597
|
path: thread.path,
|
|
8535
8598
|
line: thread.line,
|
|
8599
|
+
side: thread.diffSide === GITHUB_LEFT ? LineSide.Old : LineSide.New,
|
|
8536
8600
|
isResolved: thread.isResolved,
|
|
8537
8601
|
isOutdated: thread.isOutdated,
|
|
8538
8602
|
comments: thread.comments.nodes.map((comment) => ({
|
|
@@ -8619,12 +8683,11 @@ var GitHubHost = class {
|
|
|
8619
8683
|
});
|
|
8620
8684
|
}
|
|
8621
8685
|
async #write(method, url, body) {
|
|
8622
|
-
await
|
|
8686
|
+
await writeIgnoringReply({
|
|
8623
8687
|
method,
|
|
8624
8688
|
url,
|
|
8625
8689
|
body,
|
|
8626
8690
|
headers: this.#headers(),
|
|
8627
|
-
schema: z.unknown(),
|
|
8628
8691
|
authHint: this.#authHint
|
|
8629
8692
|
});
|
|
8630
8693
|
}
|
|
@@ -8665,11 +8728,11 @@ function githubReviewComment(comment) {
|
|
|
8665
8728
|
if (comment.range === null) return {
|
|
8666
8729
|
path: comment.path,
|
|
8667
8730
|
line: comment.line,
|
|
8668
|
-
side:
|
|
8731
|
+
side: GITHUB_RIGHT,
|
|
8669
8732
|
body: comment.body
|
|
8670
8733
|
};
|
|
8671
8734
|
const { side, start, end } = comment.range;
|
|
8672
|
-
const githubSide = side === LineSide.Old ?
|
|
8735
|
+
const githubSide = side === LineSide.Old ? GITHUB_LEFT : GITHUB_RIGHT;
|
|
8673
8736
|
const number = (ref) => side === LineSide.Old ? ref.oldLine : ref.newLine;
|
|
8674
8737
|
const startLine = number(start);
|
|
8675
8738
|
const endLine = number(end);
|
|
@@ -8720,7 +8783,9 @@ const discussionSchema = z.object({
|
|
|
8720
8783
|
resolved: z.boolean().optional(),
|
|
8721
8784
|
position: z.object({
|
|
8722
8785
|
new_path: z.string().nullable().optional(),
|
|
8723
|
-
new_line: z.number().int().positive().nullable().optional()
|
|
8786
|
+
new_line: z.number().int().positive().nullable().optional(),
|
|
8787
|
+
old_path: z.string().nullable().optional(),
|
|
8788
|
+
old_line: z.number().int().positive().nullable().optional()
|
|
8724
8789
|
}).nullable().optional()
|
|
8725
8790
|
}))
|
|
8726
8791
|
});
|
|
@@ -8749,8 +8814,17 @@ const pipelinesSchema = z.array(z.object({ id: z.number() }));
|
|
|
8749
8814
|
const pipelineJobsSchema = z.array(z.object({
|
|
8750
8815
|
id: z.number(),
|
|
8751
8816
|
name: z.string(),
|
|
8752
|
-
artifacts_file: z.object({ size: z.number() }).nullish()
|
|
8817
|
+
artifacts_file: z.object({ size: z.number() }).nullish(),
|
|
8818
|
+
artifacts: z.array(z.object({ file_type: z.string() })).nullish()
|
|
8753
8819
|
}));
|
|
8820
|
+
/**
|
|
8821
|
+
* The artifact type GitLab gives a job's `reports: coverage_report`. GitLab teams usually publish
|
|
8822
|
+
* coverage this way from a job named `test`, so the job's name alone would miss it.
|
|
8823
|
+
*/
|
|
8824
|
+
const COVERAGE_REPORT_ARTIFACT_TYPE = "cobertura";
|
|
8825
|
+
function declaresCoverageReport(job) {
|
|
8826
|
+
return job.artifacts?.some((artifact) => artifact.file_type === COVERAGE_REPORT_ARTIFACT_TYPE) === true;
|
|
8827
|
+
}
|
|
8754
8828
|
var GitLabHost = class {
|
|
8755
8829
|
#ref;
|
|
8756
8830
|
#token;
|
|
@@ -8868,8 +8942,9 @@ var GitLabHost = class {
|
|
|
8868
8942
|
const position = notes.at(0)?.position;
|
|
8869
8943
|
return {
|
|
8870
8944
|
id: discussion.id,
|
|
8871
|
-
path: position?.new_path ?? null,
|
|
8872
|
-
line: position?.new_line ?? null,
|
|
8945
|
+
path: position?.new_path ?? position?.old_path ?? null,
|
|
8946
|
+
line: position?.new_line ?? position?.old_line ?? null,
|
|
8947
|
+
side: position?.new_line == null && position?.old_line != null ? LineSide.Old : LineSide.New,
|
|
8873
8948
|
isResolved: notes.some((note) => note.resolvable === true) && notes.filter((note) => note.resolvable === true).every((note) => note.resolved === true),
|
|
8874
8949
|
isOutdated: false,
|
|
8875
8950
|
comments: notes.map((note) => ({
|
|
@@ -8899,7 +8974,10 @@ var GitLabHost = class {
|
|
|
8899
8974
|
});
|
|
8900
8975
|
const [pipeline] = await read(`${projectApi}/pipelines?sha=${encodeURIComponent(headSha)}&per_page=1`, pipelinesSchema);
|
|
8901
8976
|
if (pipeline === void 0) return [];
|
|
8902
|
-
const
|
|
8977
|
+
const jobs = await read(`${projectApi}/pipelines/${pipeline.id}/jobs?per_page=100`, pipelineJobsSchema);
|
|
8978
|
+
const declared = jobs.filter(declaresCoverageReport);
|
|
8979
|
+
const named = jobs.filter((job) => !declaresCoverageReport(job) && COVERAGE_ARCHIVE_NAME.test(job.name));
|
|
8980
|
+
const wanted = [...declared, ...named].filter((job) => job.artifacts_file != null && job.artifacts_file.size <= 209715200).slice(0, 5);
|
|
8903
8981
|
return (await Promise.all(wanted.map(async (job) => ({
|
|
8904
8982
|
name: job.name,
|
|
8905
8983
|
zip: await downloadFile({
|
|
@@ -8918,12 +8996,11 @@ var GitLabHost = class {
|
|
|
8918
8996
|
return `${webOrigin}/api/v4/projects/${encodeURIComponent(projectPath)}/merge_requests/${number}`;
|
|
8919
8997
|
}
|
|
8920
8998
|
async #write(method, url, body) {
|
|
8921
|
-
await
|
|
8999
|
+
await writeIgnoringReply({
|
|
8922
9000
|
method,
|
|
8923
9001
|
url,
|
|
8924
9002
|
body,
|
|
8925
9003
|
headers: this.#headers(),
|
|
8926
|
-
schema: z.unknown(),
|
|
8927
9004
|
authHint: this.#authHint
|
|
8928
9005
|
});
|
|
8929
9006
|
}
|
|
@@ -9514,7 +9591,7 @@ async function handleApi(request, response, pathname, context) {
|
|
|
9514
9591
|
const method = request.method ?? "GET";
|
|
9515
9592
|
if (pathname === "/api/reviews") {
|
|
9516
9593
|
if (method === "GET") {
|
|
9517
|
-
sendJson(response, 200, context.
|
|
9594
|
+
sendJson(response, 200, context.service.list());
|
|
9518
9595
|
return;
|
|
9519
9596
|
}
|
|
9520
9597
|
if (method === "POST") {
|
|
@@ -9796,6 +9873,8 @@ var ReviewService = class {
|
|
|
9796
9873
|
#generate;
|
|
9797
9874
|
#log;
|
|
9798
9875
|
#waiting = [];
|
|
9876
|
+
/** Where each running analysis is. Only ever one entry while analyses run one at a time. */
|
|
9877
|
+
#steps = /* @__PURE__ */ new Map();
|
|
9799
9878
|
#drained = Promise.resolve();
|
|
9800
9879
|
#running = false;
|
|
9801
9880
|
constructor(store, generate, log) {
|
|
@@ -9834,6 +9913,13 @@ var ReviewService = class {
|
|
|
9834
9913
|
}
|
|
9835
9914
|
return this.#store.get(id);
|
|
9836
9915
|
}
|
|
9916
|
+
/** The review list, with the step each running analysis is on. */
|
|
9917
|
+
list() {
|
|
9918
|
+
return this.#store.list().map((review) => ({
|
|
9919
|
+
...review,
|
|
9920
|
+
step: this.#steps.get(review.id) ?? null
|
|
9921
|
+
}));
|
|
9922
|
+
}
|
|
9837
9923
|
/** Resolves once the queue is empty. */
|
|
9838
9924
|
idle() {
|
|
9839
9925
|
return this.#drained;
|
|
@@ -9854,12 +9940,19 @@ var ReviewService = class {
|
|
|
9854
9940
|
if (review === void 0) return;
|
|
9855
9941
|
this.#store.setStatus(id, ReviewStatus.Analyzing);
|
|
9856
9942
|
try {
|
|
9857
|
-
const report = await this.#generate(
|
|
9943
|
+
const report = await this.#generate({
|
|
9944
|
+
ref: parsePullRequestUrl(review.url),
|
|
9945
|
+
ai: review.ai,
|
|
9946
|
+
attachedCoverage: this.#store.attachedCoverageOf(id),
|
|
9947
|
+
reportStep: (step) => this.#steps.set(id, step)
|
|
9948
|
+
});
|
|
9858
9949
|
if (this.#store.get(id) !== void 0) this.#store.markReady(id, summarize(report));
|
|
9859
9950
|
} catch (error) {
|
|
9860
9951
|
const message = error instanceof Error ? error.message : String(error);
|
|
9861
9952
|
this.#log(`${review.displayName}: ${message}`);
|
|
9862
9953
|
if (this.#store.get(id) !== void 0) this.#store.markFailed(id, message);
|
|
9954
|
+
} finally {
|
|
9955
|
+
this.#steps.delete(id);
|
|
9863
9956
|
}
|
|
9864
9957
|
}
|
|
9865
9958
|
};
|
|
@@ -10113,7 +10206,6 @@ function gitLabMergeRequestUrl(env) {
|
|
|
10113
10206
|
// packages/cli/src/reviewCommand.ts
|
|
10114
10207
|
const PREFERRED_REPORT_PORT = 4318;
|
|
10115
10208
|
const ANY_FREE_PORT = 0;
|
|
10116
|
-
const SHORT_SHA_LENGTH = 10;
|
|
10117
10209
|
async function runReview(options, deps) {
|
|
10118
10210
|
const ref = parsePullRequestUrl(options.url ?? await detectPullRequestUrl(deps.env));
|
|
10119
10211
|
const model = await analyzePullRequest(ref, options, deps);
|
|
@@ -10138,22 +10230,23 @@ async function serveReportOnPreferredPort(reportDir, port) {
|
|
|
10138
10230
|
}
|
|
10139
10231
|
}
|
|
10140
10232
|
async function analyzePullRequest(ref, options, deps) {
|
|
10141
|
-
deps.
|
|
10233
|
+
deps.reportStep(AnalysisStep.FetchingPullRequest);
|
|
10142
10234
|
const snapshot = await gitHostFor(ref, deps.tokens).fetchPullRequest();
|
|
10143
10235
|
const { pullRequest } = snapshot;
|
|
10144
|
-
deps.
|
|
10236
|
+
deps.reportStep(AnalysisStep.FetchingCommits);
|
|
10145
10237
|
const repoDir = await fetchCommits({
|
|
10146
10238
|
cacheDir: deps.cacheDir,
|
|
10147
10239
|
cloneUrl: snapshot.cloneUrl,
|
|
10148
10240
|
credentials: snapshot.gitAuth,
|
|
10149
10241
|
commits: [pullRequest.mergeBaseSha, pullRequest.headSha]
|
|
10150
10242
|
});
|
|
10151
|
-
deps.log("Analyzing changes…");
|
|
10152
10243
|
const { files, risk } = await analyzeChangedFiles(repoDir, pullRequest.mergeBaseSha, pullRequest.headSha, {
|
|
10153
10244
|
network: options.network,
|
|
10154
|
-
disabledChecks: options.disabledChecks ?? []
|
|
10245
|
+
disabledChecks: options.disabledChecks ?? [],
|
|
10246
|
+
reportStep: deps.reportStep
|
|
10155
10247
|
});
|
|
10156
10248
|
const config = await readWalkdiffConfig(repoDir, pullRequest.mergeBaseSha);
|
|
10249
|
+
deps.reportStep(AnalysisStep.FindingCoverage);
|
|
10157
10250
|
const testCoverage = await coverageFor(options, {
|
|
10158
10251
|
ref,
|
|
10159
10252
|
repoDir,
|
|
@@ -10161,6 +10254,7 @@ async function analyzePullRequest(ref, options, deps) {
|
|
|
10161
10254
|
diffs: files.map((file) => file.diff),
|
|
10162
10255
|
patterns: config.coverage.paths
|
|
10163
10256
|
}, deps);
|
|
10257
|
+
if (options.ai !== void 0) deps.reportStep(AnalysisStep.ReviewingWithAi);
|
|
10164
10258
|
const ai = options.ai === void 0 ? { status: AiReviewStatus.Disabled } : await reviewWithAi({
|
|
10165
10259
|
repoDir,
|
|
10166
10260
|
base: pullRequest.mergeBaseSha,
|
|
@@ -10220,9 +10314,6 @@ function describeAiReview(ai) {
|
|
|
10220
10314
|
function defaultReportDir(cacheDir, ref) {
|
|
10221
10315
|
return join(cacheDir, "reports", new URL(ref.webOrigin).host, repositoryPath(ref), String(ref.number));
|
|
10222
10316
|
}
|
|
10223
|
-
function shortSha(sha) {
|
|
10224
|
-
return sha.slice(0, SHORT_SHA_LENGTH);
|
|
10225
|
-
}
|
|
10226
10317
|
// packages/cli/src/appCommand.ts
|
|
10227
10318
|
const DATABASE_FILE = "walkdiff.db";
|
|
10228
10319
|
/** Runs the local app until the process is stopped. */
|
|
@@ -10232,7 +10323,7 @@ async function runApp(options, deps) {
|
|
|
10232
10323
|
await mkdir(dataDir, { recursive: true });
|
|
10233
10324
|
const store = new ReviewStore(join(dataDir, DATABASE_FILE), deps.now);
|
|
10234
10325
|
store.markInterrupted();
|
|
10235
|
-
const server = await startAppServer(store, new ReviewService(store, async (ref, ai, attachedCoverage) => {
|
|
10326
|
+
const server = await startAppServer(store, new ReviewService(store, async ({ ref, ai, attachedCoverage, reportStep }) => {
|
|
10236
10327
|
const settings = store.getSettings();
|
|
10237
10328
|
const model = await analyzePullRequest(ref, {
|
|
10238
10329
|
network: options.network,
|
|
@@ -10244,7 +10335,8 @@ async function runApp(options, deps) {
|
|
|
10244
10335
|
tokens: await hostTokensFor(ref, deps.env, runCommand),
|
|
10245
10336
|
cacheDir,
|
|
10246
10337
|
now: deps.now,
|
|
10247
|
-
log: deps.log
|
|
10338
|
+
log: deps.log,
|
|
10339
|
+
reportStep
|
|
10248
10340
|
});
|
|
10249
10341
|
const reportDir = defaultReportDir(cacheDir, ref);
|
|
10250
10342
|
await writeReport(model, reportDir);
|
|
@@ -10472,7 +10564,8 @@ async function main(argv) {
|
|
|
10472
10564
|
cacheDir: command.options.cacheDir ?? defaultCacheDir(process.env),
|
|
10473
10565
|
env: process.env,
|
|
10474
10566
|
now: () => /* @__PURE__ */ new Date(),
|
|
10475
|
-
log: (message) => console.error(message)
|
|
10567
|
+
log: (message) => console.error(message),
|
|
10568
|
+
reportStep: (step) => console.error(`${stepLabel(step)}…`)
|
|
10476
10569
|
});
|
|
10477
10570
|
return;
|
|
10478
10571
|
case "app":
|