limn-review 0.1.153 → 0.1.154

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "limn-review",
3
- "version": "0.1.153",
3
+ "version": "0.1.154",
4
4
  "description": "Dashboard for tracking your team's GitHub PR activity across repos. Runs on your machine with your gh login.",
5
5
  "type": "module",
6
6
  "author": "Alex Wakeman",
@@ -1,3 +1,3 @@
1
- import{d as Ie,r as p,j as e}from"./tanstack-BnbsafB1.js";import{aV as z,aU as Qe,cH as je,cO as Xe,co as Ze,cF as et,cq as Te,aO as tt,cG as U,A as Ne,aT as Se,T as ne,v as st,a4 as nt,an as ie,bp as Ee,a0 as _e,e as G,a3 as it,aR as Me,h as Be,p as at,j as rt,a as lt,C as ct,dk as ot,bU as ut,aW as dt,dc as mt,dd as ht,Y as xt,G as pt,S as ft,s as K,bC as gt,cE as bt,cD as jt,cn as Nt,bh as vt,bV as wt,az as kt,bg as yt,b5 as Rt,c3 as Le,bF as Pt,cj as $e,ck as Ct,cx as At,cM as Ft,cL as It,d5 as Tt,d6 as St,aS as Et,aP as _t,cm as Mt,cl as Bt,cy as Lt,d2 as $t,au as Ot,Z as Ut,aQ as Dt,bJ as Ht,bS as ae,V as Wt,t as Yt,K as qt,R as Gt,b$ as Oe,cW as Kt,ah as ve,u as Vt,I as zt}from"./index-DoDcUqdp.js";import{r as Jt,t as Qt,S as Xt,C as Zt,T as es,F as ts,f as ss}from"./ClaudeReviewTab-DLH3LipL.js";import"./markdown-CcoLFczy.js";import"./highlight-DIEV0qGG.js";import"./vis-C3BCkP5U.js";const ns="inline-flex h-7 items-center whitespace-nowrap rounded-ui bg-ui-raise px-2.5 text-meta font-medium text-ui-ink hover:bg-ui-hover disabled:cursor-not-allowed disabled:opacity-50 touch:h-10 touch:px-3",we="inline-flex h-7 items-center whitespace-nowrap rounded-ui bg-ui-raise px-2.5 text-meta font-medium text-ui-ink hover:bg-ui-hover disabled:cursor-not-allowed disabled:opacity-50 touch:h-10 touch:px-3",ke="inline-flex items-center rounded-ui bg-ui-raise px-1.5 py-px font-mono text-meta text-ui-ink";function is(t){return t instanceof Be||t instanceof Error?t.message:"Something went wrong"}function Ue({plan:t}){return e.jsx("ul",{className:"list-disc space-y-0.5 pl-5 text-body text-ui-ink",children:t.summary.map((s,n)=>e.jsx("li",{children:s},n))})}function ye(t,s){var n;return((n=t==null?void 0:t.find(a=>a.ref===s))==null?void 0:n.title)??null}function as({plan:t,items:s}){return e.jsxs("div",{className:"mt-2 space-y-3 text-meta text-ui-ink",children:[t.steps.length>0&&e.jsx("ol",{className:"list-decimal space-y-2 pl-5",children:t.steps.map((n,a)=>e.jsxs("li",{children:[e.jsx("div",{className:"font-medium text-ui-ink",children:n.title}),n.files.length>0&&e.jsx("div",{className:"mt-0.5 font-mono text-meta text-ui-mute",children:n.files.join(", ")}),e.jsx("p",{className:"mt-0.5 whitespace-pre-wrap",children:n.change}),n.refs.length>0&&e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:n.refs.map(i=>e.jsx("span",{className:ke,children:i},i))})]},a))}),t.notAddressed.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 font-semibold text-ui-mute",children:"Will not fix"}),e.jsx("ul",{className:"space-y-1",children:t.notAddressed.map(n=>e.jsxs("li",{children:[e.jsx("span",{className:ke,children:n.ref})," ",ye(s,n.ref)&&e.jsxs("span",{className:"font-medium",children:[ye(s,n.ref),": "]}),n.reason]},n.ref))})]}),t.notCovered.length>0&&e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold text-ui-mute",children:"Not in the plan: "}),t.notCovered.join(", ")]})]})}function rs({pr:t,fix:s,liveStatus:n,passRunning:a,auth:i}){var w,h;const l=s.plan,o=z(s.plan??s),g=Qe((s.plan??s).provider,(s.plan??s).model),c=je(g,"plan"),m=je(g,"fix"),v=Me(c),F=Xe(t.id),u=Ze(t.id),k=et(t.id),M=Te(t.id),C=Ie({mutationKey:tt(t.id)})>0,B=U(j=>j.noteAiFixRun),[E,I]=p.useState(""),[y,D]=p.useState(!1);if(!l)return null;const R=l.plan,_=l.status==="plan_ready"&&!a,L=E.trim(),P=L.length>Ne,r=()=>{!_||C||L===""||P||F.mutate({fixId:s.id,text:L},{onSuccess:()=>I("")})},d=()=>{B({prId:t.id,repoFullName:t.repoFullName,prNumber:t.number,prTitle:t.title}),u.mutate(s.id)},f=F.error??u.error??k.error;return e.jsxs("div",{className:"mt-3 rounded-ui bg-ui-surface p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1 text-meta font-semibold text-ui-ink",children:["Plan",R&&l.revision>1&&e.jsxs("span",{className:"font-normal text-ui-mute",children:["· version ",l.revision]}),l.model&&e.jsxs("span",{className:"font-normal text-ui-mute",children:["· ",Se(l.provider,l.model,l.effort)]}),e.jsxs(ne,{title:"Plan first",children:[e.jsxs("p",{children:[v," reads the code and writes a plan. It changes nothing."]}),e.jsxs("p",{children:["Tell ",v," what to change and it rewrites the plan, taking the whole conversation into account. Each message runs ",v," again."]}),e.jsxs("p",{children:["When you approve, ",v," builds the fix from this plan. You still review the diff and press Push."]})]})]}),R?e.jsxs(e.Fragment,{children:[e.jsx(Ue,{plan:R}),e.jsxs("button",{type:"button",className:"hit mt-2 inline-flex items-center gap-1 text-meta text-ui-mute hover:text-ui-ink","aria-expanded":y,onClick:()=>D(j=>!j),children:[e.jsx(st,{dir:y?"down":"right"}),"Details"]}),y&&e.jsx(as,{plan:R,items:s.reviewItems})]}):!a&&e.jsx("p",{className:"text-meta text-ui-mute",children:"No plan yet."}),s.error&&e.jsx("p",{className:"mt-2 rounded-ui bg-ui-raise p-2 text-meta text-ui-warn",children:s.error}),e.jsx(nt,{transcript:l.transcript,plannedBy:o}),a&&e.jsxs("div",{className:"mt-3",children:[e.jsx(ie,{active:!0,label:R?"Updating the plan":"Making the plan",value:Ee(n),timeConstantSec:30}),e.jsxs("div",{className:"mt-1 flex items-center gap-2 text-meta text-ui-mute",children:[_e[((w=n==null?void 0:n.progress)==null?void 0:w.phase)??""]??"Working…",e.jsx("button",{type:"button",className:we,onClick:()=>M.mutate(),children:"Cancel"})]}),((h=n==null?void 0:n.progress)==null?void 0:h.recentActivity)&&n.progress.recentActivity.length>0&&e.jsx("pre",{className:"mt-1 max-h-32 overflow-auto rounded-ui bg-ui-surface p-2 text-meta leading-relaxed text-ui-mute",children:n.progress.recentActivity.slice(-8).join(`
1
+ import{d as Ie,r as p,j as e}from"./tanstack-BnbsafB1.js";import{aV as z,aU as Qe,cH as je,cO as Xe,co as Ze,cF as et,cq as Te,aO as tt,cG as U,A as Ne,aT as Se,T as ne,v as st,a4 as nt,an as ie,bp as Ee,a0 as _e,e as G,a3 as it,aR as Me,h as Be,p as at,j as rt,a as lt,C as ct,dk as ot,bU as ut,aW as dt,dc as mt,dd as ht,Y as xt,G as pt,S as ft,s as K,bC as gt,cE as bt,cD as jt,cn as Nt,bh as vt,bV as wt,az as kt,bg as yt,b5 as Rt,c3 as Le,bF as Pt,cj as $e,ck as Ct,cx as At,cM as Ft,cL as It,d5 as Tt,d6 as St,aS as Et,aP as _t,cm as Mt,cl as Bt,cy as Lt,d2 as $t,au as Ot,Z as Ut,aQ as Dt,bJ as Ht,bS as ae,V as Wt,t as Yt,K as qt,R as Gt,b$ as Oe,cW as Kt,ah as ve,u as Vt,I as zt}from"./index-CUiijl9W.js";import{r as Jt,t as Qt,S as Xt,C as Zt,T as es,F as ts,f as ss}from"./ClaudeReviewTab-ODIMXiSJ.js";import"./markdown-CcoLFczy.js";import"./highlight-DIEV0qGG.js";import"./vis-C3BCkP5U.js";const ns="inline-flex h-7 items-center whitespace-nowrap rounded-ui bg-ui-raise px-2.5 text-meta font-medium text-ui-ink hover:bg-ui-hover disabled:cursor-not-allowed disabled:opacity-50 touch:h-10 touch:px-3",we="inline-flex h-7 items-center whitespace-nowrap rounded-ui bg-ui-raise px-2.5 text-meta font-medium text-ui-ink hover:bg-ui-hover disabled:cursor-not-allowed disabled:opacity-50 touch:h-10 touch:px-3",ke="inline-flex items-center rounded-ui bg-ui-raise px-1.5 py-px font-mono text-meta text-ui-ink";function is(t){return t instanceof Be||t instanceof Error?t.message:"Something went wrong"}function Ue({plan:t}){return e.jsx("ul",{className:"list-disc space-y-0.5 pl-5 text-body text-ui-ink",children:t.summary.map((s,n)=>e.jsx("li",{children:s},n))})}function ye(t,s){var n;return((n=t==null?void 0:t.find(a=>a.ref===s))==null?void 0:n.title)??null}function as({plan:t,items:s}){return e.jsxs("div",{className:"mt-2 space-y-3 text-meta text-ui-ink",children:[t.steps.length>0&&e.jsx("ol",{className:"list-decimal space-y-2 pl-5",children:t.steps.map((n,a)=>e.jsxs("li",{children:[e.jsx("div",{className:"font-medium text-ui-ink",children:n.title}),n.files.length>0&&e.jsx("div",{className:"mt-0.5 font-mono text-meta text-ui-mute",children:n.files.join(", ")}),e.jsx("p",{className:"mt-0.5 whitespace-pre-wrap",children:n.change}),n.refs.length>0&&e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:n.refs.map(i=>e.jsx("span",{className:ke,children:i},i))})]},a))}),t.notAddressed.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 font-semibold text-ui-mute",children:"Will not fix"}),e.jsx("ul",{className:"space-y-1",children:t.notAddressed.map(n=>e.jsxs("li",{children:[e.jsx("span",{className:ke,children:n.ref})," ",ye(s,n.ref)&&e.jsxs("span",{className:"font-medium",children:[ye(s,n.ref),": "]}),n.reason]},n.ref))})]}),t.notCovered.length>0&&e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold text-ui-mute",children:"Not in the plan: "}),t.notCovered.join(", ")]})]})}function rs({pr:t,fix:s,liveStatus:n,passRunning:a,auth:i}){var w,h;const l=s.plan,o=z(s.plan??s),g=Qe((s.plan??s).provider,(s.plan??s).model),c=je(g,"plan"),m=je(g,"fix"),v=Me(c),F=Xe(t.id),u=Ze(t.id),k=et(t.id),M=Te(t.id),C=Ie({mutationKey:tt(t.id)})>0,B=U(j=>j.noteAiFixRun),[E,I]=p.useState(""),[y,D]=p.useState(!1);if(!l)return null;const R=l.plan,_=l.status==="plan_ready"&&!a,L=E.trim(),P=L.length>Ne,r=()=>{!_||C||L===""||P||F.mutate({fixId:s.id,text:L},{onSuccess:()=>I("")})},d=()=>{B({prId:t.id,repoFullName:t.repoFullName,prNumber:t.number,prTitle:t.title}),u.mutate(s.id)},f=F.error??u.error??k.error;return e.jsxs("div",{className:"mt-3 rounded-ui bg-ui-surface p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1 text-meta font-semibold text-ui-ink",children:["Plan",R&&l.revision>1&&e.jsxs("span",{className:"font-normal text-ui-mute",children:["· version ",l.revision]}),l.model&&e.jsxs("span",{className:"font-normal text-ui-mute",children:["· ",Se(l.provider,l.model,l.effort)]}),e.jsxs(ne,{title:"Plan first",children:[e.jsxs("p",{children:[v," reads the code and writes a plan. It changes nothing."]}),e.jsxs("p",{children:["Tell ",v," what to change and it rewrites the plan, taking the whole conversation into account. Each message runs ",v," again."]}),e.jsxs("p",{children:["When you approve, ",v," builds the fix from this plan. You still review the diff and press Push."]})]})]}),R?e.jsxs(e.Fragment,{children:[e.jsx(Ue,{plan:R}),e.jsxs("button",{type:"button",className:"hit mt-2 inline-flex items-center gap-1 text-meta text-ui-mute hover:text-ui-ink","aria-expanded":y,onClick:()=>D(j=>!j),children:[e.jsx(st,{dir:y?"down":"right"}),"Details"]}),y&&e.jsx(as,{plan:R,items:s.reviewItems})]}):!a&&e.jsx("p",{className:"text-meta text-ui-mute",children:"No plan yet."}),s.error&&e.jsx("p",{className:"mt-2 rounded-ui bg-ui-raise p-2 text-meta text-ui-warn",children:s.error}),e.jsx(nt,{transcript:l.transcript,plannedBy:o}),a&&e.jsxs("div",{className:"mt-3",children:[e.jsx(ie,{active:!0,label:R?"Updating the plan":"Making the plan",value:Ee(n),timeConstantSec:30}),e.jsxs("div",{className:"mt-1 flex items-center gap-2 text-meta text-ui-mute",children:[_e[((w=n==null?void 0:n.progress)==null?void 0:w.phase)??""]??"Working…",e.jsx("button",{type:"button",className:we,onClick:()=>M.mutate(),children:"Cancel"})]}),((h=n==null?void 0:n.progress)==null?void 0:h.recentActivity)&&n.progress.recentActivity.length>0&&e.jsx("pre",{className:"mt-1 max-h-32 overflow-auto rounded-ui bg-ui-surface p-2 text-meta leading-relaxed text-ui-mute",children:n.progress.recentActivity.slice(-8).join(`
2
2
  `)})]}),_&&R&&e.jsxs("div",{className:"mt-3",children:[e.jsx(G,{kind:"plan",auth:i,meter:!1,followUp:!0,provider:c,children:e.jsx(it,{name:v,draft:E,setDraft:I,busy:C,maxChars:Ne,onSend:r})}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[e.jsx(G,{kind:"fix",auth:i,followUp:!0,provider:m,children:e.jsx("button",{type:"button","data-ai-run":!0,className:ns,disabled:C,onClick:d,children:"Approve and build"})}),e.jsx("button",{type:"button",className:we,disabled:C,onClick:()=>k.mutate(s.id),children:"Discard plan"})]})]}),f!=null&&e.jsx("p",{className:"mt-1 text-meta text-ui-danger",children:is(f)})]})}function De({fix:t}){var n;const s=((n=t.plan)==null?void 0:n.status)==="approved"?t.plan.plan:null;return s?e.jsxs("div",{className:"mb-2 rounded-ui bg-ui-surface p-2",children:[e.jsx("div",{className:"mb-1 text-meta font-semibold text-ui-mute",children:"Built from your plan"}),e.jsx(Ue,{plan:s})]}):null}function ls(t,s,n){var a;return t??((s==null?void 0:s.status)==="succeeded"?s.id:((a=n.find(i=>i.status==="succeeded"))==null?void 0:a.id)??null)}function cs(t,s,n){return s==null||n==null||s===n.id?null:t!=null?"Uses the review you picked, not the latest.":n.status==="failed"?"Uses the last review that finished. The latest one failed.":n.status==="running"||n.status==="queued"?"Uses the last review that finished. A newer one is running.":"Uses the last review that finished."}const Re=ct,os=rt;function us(t){return t.kind==="finding"&&t.findingId!=null?`claude-finding-${t.findingId}`:null}function ds(t){const s=U(n=>n.openClaudeReview);return n=>{s({id:t.id,number:t.number,title:t.title,repoFullName:t.repoFullName,authorLogin:null,authorDisplayName:null,authorAvatarUrl:null});const a=Date.now()+3e3,i=()=>{const l=document.getElementById(n);if(l){l.scrollIntoView({behavior:"smooth",block:"center"});return}Date.now()<a&&requestAnimationFrame(i)};requestAnimationFrame(i)}}function Pe({refId:t,item:s,onJump:n}){const a=s?`${lt[s.kind]} ${t}`:t,i=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"shrink-0",children:a}),s&&e.jsxs("span",{className:"min-w-0 truncate font-normal",children:["· ",s.title]})]}),l=s?us(s):null;return l?e.jsx("button",{type:"button",onClick:()=>n(l),"aria-label":`${a}: ${(s==null?void 0:s.title)??""}. Show in AI Review`,className:`${Re} max-w-[22rem] hover:bg-ui-hover`,children:i}):e.jsx("span",{className:`${Re} max-w-[22rem]`,children:i})}function ms(t){var s;switch(t.seed){case"review":{const n=((s=t.reviewItems)==null?void 0:s.length)??0;return`Fix from ${t.sourceReviewId==null?"the CI check":"the AI review"}${n>0?` (${n} item${n===1?"":"s"})`:""}.`}case"plain":return"Fix from your instruction.";case"comments":return"Fix from picked comments (no longer offered).";case"ci_analysis":return"Fix from the CI analysis (no longer offered).";default:return""}}function hs({pr:t,fix:s}){const n=z(s),a=ds(t),i=s.changeReport,l=new Map((s.reviewItems??[]).map(c=>[c.ref,c])),o=(s.reviewItems??[]).filter(c=>!c.included);if(!i&&o.length===0)return null;const g=l.size>0;return e.jsxs("div",{className:"mt-2 text-meta",children:[e.jsx(at,{report:i,filesChanged:s.filesChanged,by:n,refsInfo:g?e.jsx("p",{children:"Each tag is a review item the change answers. A finding tag opens it in the AI Review tab."}):null,renderRef:c=>e.jsx(Pe,{refId:c,item:l.get(c),onJump:a},c)}),o.length>0&&e.jsxs("section",{children:[e.jsxs("div",{className:os,children:["Left out",e.jsx(ne,{title:"Left out",children:e.jsxs("p",{children:["These review items did not fit in what ",n," was sent, so it never saw them."]})})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:o.map(c=>e.jsx(Pe,{refId:c.ref,item:c,onJump:a},c.ref))})]})]})}const xs=["findings","earlier_findings","judged_threads","untouched_threads","ci_failures","sonar","style_bots","story"],ps={findings:"Claude’s findings",earlier_findings:"Earlier findings still open",judged_threads:"Threads Claude says need a fix",untouched_threads:"Unanswered threads",ci_failures:"CI failures",sonar:"SonarCloud issues",style_bots:"Style bot comments",story:"Ticket gaps"};function Ce(t,s="Claude"){return t==="findings"?`${s}’s findings`:t==="judged_threads"?`Threads ${s} says need a fix`:ps[t]}function V(t,s){return s[t.key]??t.defaultIncluded}function fs(t,s){return t.items.filter(n=>V(n,s)).map(n=>n.key)}function He(t,s){const n=new Set;let a=0;for(const i of t.items)if(V(i,s)){if(a>0&&a+i.chars>t.budgetChars){n.add(i.key);continue}a+=i.chars}return n}function gs(t,s){const n={};for(const a of t.items)n[a.key]=a.section===s;return n}const bs={blocker:"Blocker",warning:"Warning",nit:"Nit",question:"Question",praise:"Praise"},Ae={blocker:"bg-ui-danger/10 text-ui-danger",warning:"bg-ui-raise text-ui-warn",nit:"bg-ui-raise text-ui-mute"},We="whitespace-nowrap rounded-ui bg-ui-raise px-1 py-px text-meta text-ui-warn",Z=new Set;function js(t,s){return t?s!=null?`${t}:${s}`:t:null}function Ns({item:t,picked:s,cut:n,disabled:a,onToggle:i}){return e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 pt-0.5",children:[e.jsx("label",{className:"flex cursor-pointer items-center touch:-my-3 touch:min-h-10 touch:min-w-10 touch:justify-center",children:e.jsx(K,{checked:s,disabled:a,onChange:l=>i(l.target.checked),"aria-label":`Include in the fix: ${t.label}`})}),s&&n&&e.jsx("span",{className:We,children:"Won’t fit"})]})}function vs({item:t,picked:s,cut:n,disabled:a,onToggle:i}){const l=js(t.path,t.line);return e.jsx("li",{children:e.jsxs("label",{className:`flex cursor-pointer items-start gap-2 rounded-ui border px-2 py-1.5 text-meta ${s?"border-ui-line bg-ui-sel":"border-ui-line"}`,children:[e.jsx(K,{className:"mt-0.5",checked:s,disabled:a,onChange:o=>i(o.target.checked)}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[t.severity&&Ae[t.severity]&&e.jsx("span",{className:`rounded-ui px-1 py-px text-meta font-medium ${Ae[t.severity]}`,children:bs[t.severity]}),e.jsx("span",{className:"break-words text-ui-ink",children:t.label}),s&&n&&e.jsx("span",{className:We,children:"Won’t fit"})]}),(l||t.detail)&&e.jsxs("span",{className:"mt-0.5 block break-words text-meta text-ui-mute",children:[l&&e.jsx("span",{className:"font-mono",children:l}),l&&t.detail?" · ":"",t.detail]})]})]})})}function ws({preview:t,overrides:s,onChange:n,disabled:a,pr:i,review:l}){const o=He(t,s),g=new Map;for(const r of t.items){const d=g.get(r.section)??[];d.push(r),g.set(r.section,d)}const c=(r,d)=>{const f={...s};for(const w of r)f[w]=d;n(f)},m=l!=null&&l.id===t.sourceReviewId?l:null,v=Jt(l),F=Qt(l),u=p.useMemo(()=>m!=null?ot(m):null,[m]),k=p.useMemo(()=>new Map(((u==null?void 0:u.findings)??[]).map(r=>[r.id,r])),[u]),M=p.useMemo(()=>{var r;return new Map((((r=u==null?void 0:u.followUp)==null?void 0:r.items)??[]).map(d=>[d.priorFindingId,d]))},[u]),C=p.useMemo(()=>u!=null?ut(u):new Map,[u]),B=p.useMemo(()=>u!=null?dt(u):new Set,[u]),E=p.useMemo(()=>{var d;const r=new Set;for(const f of t.items)((d=f.card)==null?void 0:d.kind)==="story"&&r.add(f.card.ticketReviewId);return[...r].sort((f,w)=>f-w)},[t.items]),I=mt(i.id,E.length>0),y=p.useMemo(()=>{var d;const r=new Map;for(const f of((d=I.data)==null?void 0:d.tickets)??[])f.review!=null&&r.set(f.review.id,f.review);return r},[I.data]),D=p.useMemo(()=>I.data==null?[]:E.filter(r=>!y.has(r)),[I.data,E,y]),R=ht(D),_=p.useMemo(()=>{const r=new Map(y);for(const d of R)r.set(d.id,d);return r},[y,R]);if(t.items.length===0)return e.jsx("p",{className:"text-meta text-ui-mute",children:"The review found nothing to fix."});const L=(m==null?void 0:m.headSha)??i.headSha,P=r=>{var H,T;const d=V(r,s),f=o.has(r.key),w=b=>c([r.key],b),h=e.jsx(Ns,{item:r,picked:d,cut:f,disabled:a,onToggle:w}),j=r.card;switch(j==null?void 0:j.kind){case"finding":{const b=k.get(j.findingId);if(b==null)break;return e.jsx(ts,{authorName:ss(l,b),prId:i.id,finding:b,editable:!1,prUrl:i.githubUrl,repoFullName:i.repoFullName,headSha:L,posting:!1,postError:null,inChangeset:b.fileInDiff,priorStatus:C.get(b.id),alreadyPosted:B.has(b.id),actions:!1,selection:h,docReferences:(m==null?void 0:m.docReferences)??null},r.key)}case"earlier_finding":{const b=M.get(j.priorFindingId);if(b==null)break;return e.jsx(ft,{item:b,muted:!1,findingsById:k,headMoved:((H=u==null?void 0:u.followUp)==null?void 0:H.headMoved)??!1,changedPaths:Z,actions:!1,selection:h,by:v},r.key)}case"thread":return e.jsx(es,{t:j.assessment,muted:!1,actions:!1,selection:h,notCheckedNote:j.inReview?void 0:`${F} didn’t check this one.`,by:F},r.key);case"ci":return e.jsx(Zt,{f:j.item,suggestion:j.item.suggestion,changedPaths:Z,selection:h},r.key);case"sonar":return e.jsx(Xt,{issue:j.issue,selection:h},r.key);case"story":{const b=_.get(j.ticketReviewId),S=b==null?void 0:b.items.find($=>$.id===j.itemId);if(b==null||S==null)break;const N={review:b,viewedPrId:i.id,changedPaths:Z,actions:!1,selection:h};if(S.status==="missing")return e.jsx(xt,{item:S,...N},r.key);const x=(T=b.assessment)==null?void 0:T.criteria.find($=>$.ref===S.ref);if(x==null||x.status==="met")break;return e.jsx(pt,{c:x,item:S,...N},r.key)}}return e.jsx(vs,{item:r,picked:d,cut:f,disabled:a,onToggle:w},r.key)};return e.jsxs("div",{className:"space-y-3",children:[xs.filter(r=>g.has(r)).map(r=>{const d=g.get(r),f=d.filter(h=>V(h,s)).length,w=f===d.length;return e.jsxs("section",{"aria-label":Ce(r,v),children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx("h4",{className:"text-meta font-semibold text-ui-ink",children:Ce(r,v)}),e.jsxs("span",{className:"text-meta text-ui-mute",children:[f," of ",d.length]}),e.jsx("button",{type:"button",className:"hit ml-auto text-meta text-ui-accent hover:underline disabled:opacity-50",disabled:a,onClick:()=>c(d.map(h=>h.key),!w),children:w?"Untick all":"Tick all"})]}),e.jsx("ul",{className:"space-y-1.5",children:d.map(P)})]},r)}),o.size>0&&e.jsxs("p",{className:"text-meta text-ui-warn",children:[o.size," ticked ",o.size===1?"item does":"items do"," not fit in one fix and will be left out. Untick something to make room."]})]})}const ks="inline-flex h-7 items-center whitespace-nowrap rounded-ui bg-ui-raise px-2.5 text-meta font-medium text-ui-ink hover:bg-ui-hover disabled:cursor-not-allowed disabled:opacity-50 touch:h-10 touch:px-3",Fe="inline-flex h-7 items-center whitespace-nowrap rounded-ui bg-ui-raise px-2.5 text-meta font-medium text-ui-ink hover:bg-ui-hover disabled:cursor-not-allowed disabled:opacity-50 touch:h-10 touch:px-3";function Ye(t){return{prId:t.id,repoId:t.repoId,repoFullName:t.repoFullName,prNumber:t.number,prTitle:t.title,githubUrl:t.githubUrl}}function ys(t){const s=gt({mergeable:t.mergeable,mergeStateStatus:t.mergeStateStatus,isDraft:t.isDraft,inMergeQueue:t.inMergeQueue===!0}).verdict;return bt({state:t.state,verdict:s,viewerCanPush:t.viewerCanPush})}function Rs({pr:t}){const s=jt(t.id),n=Nt(),a=vt(s),i=t.baseRefName??"the base branch";p.useEffect(()=>{wt(t.id)},[t.id]);const l=Ye(t),o=(s==null?void 0:s.phase)==="succeeded"?s.resolution:null;return e.jsxs("div",{className:"mb-3 rounded-ui bg-ui-surface p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-body font-medium text-ui-ink",children:[e.jsx(kt,{size:13,className:"text-ai-signal"}),"This branch conflicts with ",i]}),e.jsxs("p",{className:"mt-1 text-meta text-ui-mute",children:[n," reads the code and picks a result for each conflict. You check its choices in the resolver before anything is pushed."]}),a&&s!=null?e.jsxs("div",{className:"mt-2",children:[e.jsx(ie,{active:!0,label:`Resolving conflicts with ${n}`,timeConstantSec:60}),e.jsxs("div",{className:"mt-1 flex items-center gap-2 text-meta text-ui-mute",children:[yt(s.phase,n),e.jsx("button",{type:"button",className:Fe,onClick:()=>Rt(t.id),children:"Cancel"})]})]}):e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[e.jsx(G,{kind:"resolve",children:e.jsx("button",{type:"button",className:ks,onClick:()=>Le(l,{providerName:n}),children:o!=null?"Run again":`Resolve merge conflicts with ${n}`})}),o!=null&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:Fe,onClick:()=>Pt(l),children:"Open the resolver"}),e.jsxs("span",{className:"text-meta text-ui-mute",children:[z(o)," decided ",o.choices.length," of ",o.decidableTotal," change",o.decidableTotal===1?"":"s","."]})]}),(s==null?void 0:s.phase)==="failed"&&s.error!=null&&e.jsx("span",{className:"text-meta text-ui-danger",children:s.error}),(s==null?void 0:s.phase)==="cancelled"&&e.jsx("span",{className:"text-meta text-ui-mute",children:"Cancelled."})]})]})}const te="inline-flex h-7 items-center whitespace-nowrap rounded-ui bg-ui-raise px-2.5 text-meta font-medium text-ui-ink hover:bg-ui-hover disabled:cursor-not-allowed disabled:opacity-50 touch:h-10 touch:px-3";function se(t){return t instanceof Be||t instanceof Error?t.message:"Something went wrong"}const ee="inline-flex h-7 items-center whitespace-nowrap rounded-ui bg-ui-raise px-2.5 text-meta font-medium text-ui-ink hover:bg-ui-hover disabled:cursor-not-allowed disabled:opacity-50 touch:h-10 touch:px-3";function Ps({children:t,info:s}){return e.jsxs("div",{className:"flex items-center gap-1.5 px-4 pb-2 pt-4 text-title text-ui-ink md:px-5",children:[e.jsx("h3",{children:t}),s]})}function Os({pr:t}){const s=$e().enabled,n=U(c=>c.aiFixTabFocus),a=U(c=>c.consumeAiFixTabFocus),[i,l]=p.useState(null),[o,g]=p.useState(null);return p.useEffect(()=>{n&&n.prId===t.id&&(n.reviewId!=null&&l(n.reviewId),n.only!=null&&g(n.only),a())},[n,t.id,a]),s?e.jsx("div",{className:"pb-6",children:e.jsx(Cs,{pr:t,handoffReviewId:i,onlySection:o,onOnlySectionApplied:()=>g(null)})}):e.jsx(e.Fragment,{})}function Cs({pr:t,handoffReviewId:s,onlySection:n,onOnlySectionApplied:a}){var oe,ue,de,me,he,xe,pe,fe,ge,be;const{data:i,isLoading:l}=Ct(t.id,!0),{data:o,isLoading:g}=At(t.id),c=(o==null?void 0:o.review)??null,m=ls(s,c,(o==null?void 0:o.history)??[]),v=cs(s,m,c),F=U(A=>A.setPrDetailTab),u=Ft("fix",zt),k=Me(u.chosen.provider),M=It().data,C=Tt(t.id),B=St(t.id),E=Te(t.id),I=$e(),y=Et(M,u.chosen.provider,"plan"),[D,R]=p.useState(!1),_=D&&y,L=U(A=>A.noteAiFixRun),P=Ie({mutationKey:_t(t.id)})>0,r=((oe=i==null?void 0:i.fix)==null?void 0:oe.status)??null,d=r==="planned",f=d&&((de=(ue=i==null?void 0:i.fix)==null?void 0:ue.plan)==null?void 0:de.status)==="planning",w=r==="running"||r==="queued"||P||f,{status:h}=Mt(t.id,w),j=(h==null?void 0:h.status)??r??"idle",H=j==="running"||j==="queued",T=H&&!d,b=d&&(f||H),S=d&&(((he=(me=i==null?void 0:i.fix)==null?void 0:me.plan)==null?void 0:he.status)==="planning"||((pe=(xe=i==null?void 0:i.fix)==null?void 0:xe.plan)==null?void 0:pe.status)==="plan_ready"),N=(i==null?void 0:i.fix)??null,x=Bt(t.id,m,(i==null?void 0:i.enabled)!==!1&&(m!=null||!g)),$=m==null&&x.data!=null&&x.data.sourceReviewId==null&&x.data.items.length>0,q=m!=null||$,Ge=Lt(m!=null&&(c==null?void 0:c.id)!==m?m:null),Ke=m!=null&&(c==null?void 0:c.id)===m?c:Ge.data??null,[J,Q]=p.useState({});p.useEffect(()=>Q({}),[m]);const[Ve,W]=p.useState(!1);p.useEffect(()=>{n==null||!x.data||(Q(gs(x.data,n)),W(!0),a())},[n,x.data,a]);const re=!S&&(Ve||!N||N.status!=="succeeded"),X=ys(t),[le,ze]=p.useState(!1),Y=$t(t.id,t.repoFullName),O=x.data?fs(x.data,J):[],ce=x.data?He(x.data,J).size:0,Je=()=>{if(!q||!x.data||O.length===0)return;const A={model:u.chosen.model,provider:u.chosen.provider,seed:"review",...m!=null?{sourceReviewId:m}:{},include:O,...Y.names.length>0?{checks:Y.names}:{}};_?B.mutate(A,{onSuccess:()=>W(!1)}):(L({prId:t.id,repoFullName:t.repoFullName,prNumber:t.number,prTitle:t.title}),C.mutate(A,{onSuccess:()=>W(!1)})),le&&X&&Le(Ye(t),{model:Dt(u.chosen.model),providerName:I.providerName})};return e.jsxs("div",{children:[e.jsx(Ps,{info:e.jsxs(ne,{title:"AI Fix",children:[e.jsxs("p",{children:[k," reads the PR's code and edits files in a private copy. It has no shell. Tick Run tests to let it run the project's own test, lint and type checks in a sandbox."]}),e.jsx("p",{children:"A fix starts from an AI review. Pick what it should work on: the review's findings, earlier findings still open, threads the review says need a fix, unanswered threads, CI failures and ticket gaps are ticked; style bot comments are not."}),e.jsx("p",{children:"With no AI review, a fix can start from a finished CI check: it works on the failures the check says this PR can fix."}),e.jsxs("p",{children:["Tick Plan first to read ",k,"'s plan, steer it and approve it before anything changes."]}),e.jsxs("p",{children:[k," reports what it changed in each file and what it left alone, and why."]}),e.jsx("p",{children:"Nothing is pushed until you press Push. An automatic fix on your own PR is pushed for you only when Push automatically is on in Settings."})]}),children:"AI Fix"}),e.jsxs("div",{className:"px-4",children:[X&&e.jsx(Rs,{pr:t}),(i==null?void 0:i.enabled)===!1?e.jsx("p",{className:"text-body text-ui-mute",children:"The agentic fixer is turned off."}):e.jsxs(e.Fragment,{children:[!T&&!S&&!q&&!g&&!x.isLoading&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-meta text-ui-mute",children:(c==null?void 0:c.status)==="running"||(c==null?void 0:c.status)==="queued"?"A fix starts from an AI review. One is running.":"A fix starts from a finished AI review."}),e.jsx("button",{type:"button",className:te,onClick:()=>F(t.id,"claude_review"),children:"Open AI Review"})]}),!T&&!S&&q&&!re&&e.jsx("button",{type:"button",className:ee,onClick:()=>W(!0),children:"New fix"}),!T&&q&&re&&e.jsxs("div",{children:[v&&e.jsx("p",{className:"mb-2 text-meta text-ui-mute",children:v}),$&&e.jsx("p",{className:"mb-2 text-meta text-ui-mute",children:"No AI review yet. This fix works on the CI check’s failures."}),x.isLoading&&e.jsx("p",{className:"text-meta text-ui-mute",children:"Loading…"}),x.isError&&m!=null&&e.jsx("p",{className:"text-meta text-ui-danger",children:se(x.error)}),x.data&&e.jsx(ws,{preview:x.data,overrides:J,onChange:Q,disabled:P,pr:t,review:Ke}),x.data&&x.data.items.length>0&&X&&e.jsxs("label",{className:"mt-3 flex cursor-pointer items-start gap-2 text-meta text-ui-ink",children:[e.jsx(K,{className:"mt-0.5",checked:le,disabled:P,onChange:A=>ze(A.target.checked)}),e.jsxs("span",{children:["Also resolve merge conflicts with ",t.baseRefName??"the base branch",e.jsx("span",{className:"block text-meta text-ui-mute",children:"You check the merge in the resolver. It lands as its own commit, apart from the fix."})]})]}),x.data&&x.data.items.length>0&&e.jsx(Ot,{state:Y,disabled:P}),x.data&&x.data.items.length>0&&e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 max-md:sticky max-md:bottom-0 max-md:z-20 max-md:-mx-4 max-md:bg-ui-surface max-md:px-4 max-md:py-3",children:[e.jsx(Ut,{state:u,onPick:u.pick,disabled:P}),y&&e.jsxs("label",{className:"flex cursor-pointer items-center gap-1.5 text-meta text-ui-ink",children:[e.jsx(K,{checked:_,disabled:P,onChange:A=>R(A.target.checked)}),"Plan first"]}),e.jsx(G,{kind:"fix",auth:i==null?void 0:i.auth,anyProvider:!0,provider:u.chosen.provider,children:e.jsx("button",{type:"button",className:te,disabled:P||O.length===0||Y.on&&Y.query.isLoading,onClick:Je,children:_?"Make a plan":"Start fix"})}),e.jsx("span",{className:"text-meta text-ui-mute",children:O.length===0?"Nothing ticked.":`${O.length-ce} item${O.length-ce===1?"":"s"}`}),(N==null?void 0:N.status)==="succeeded"&&e.jsx("button",{type:"button",className:ee,onClick:()=>W(!1),children:"Close"})]})]}),T&&e.jsx("button",{type:"button",className:ee,onClick:()=>E.mutate(),children:"Cancel"}),(C.isError||B.isError)&&e.jsx("p",{className:"mt-1 text-meta text-ui-danger",children:se(C.error??B.error)}),N&&d&&e.jsx(rs,{pr:t,fix:N,liveStatus:h,passRunning:b,auth:i==null?void 0:i.auth}),T&&e.jsxs("div",{className:"mt-3",children:[N&&e.jsx(De,{fix:N}),e.jsx(ie,{active:!0,label:"Running AI fix",value:Ee(h),timeConstantSec:40}),e.jsxs("div",{className:"mt-1 flex items-center gap-2 text-meta text-ui-mute",children:[(N==null?void 0:N.trigger)==="auto"&&e.jsx(qe,{}),_e[((fe=h==null?void 0:h.progress)==null?void 0:fe.phase)??""]??"Working…"]}),((ge=h==null?void 0:h.progress)==null?void 0:ge.recentActivity)&&h.progress.recentActivity.length>0&&e.jsx("pre",{className:"mt-1 max-h-32 overflow-auto rounded-ui bg-ui-surface p-2 text-meta leading-relaxed text-ui-mute",children:h.progress.recentActivity.slice(-8).join(`
3
3
  `)})]}),!T&&N&&!d&&e.jsx(Fs,{pr:t,fix:N,headInfo:(i==null?void 0:i.headInfo)??null,viewerCanPush:(i==null?void 0:i.viewerCanPush)??!1}),l&&!N&&e.jsx("p",{className:"mt-3 text-meta text-ui-mute",children:"Loading…"})]}),e.jsx(Ts,{history:(i==null?void 0:i.history)??[],currentFixId:((be=i==null?void 0:i.fix)==null?void 0:be.id)??null})]})]})}function qe(){return e.jsx("span",{className:"inline-flex items-center rounded-ui bg-ui-raise px-1.5 py-px text-meta font-medium text-ui-mute",children:"Auto fix"})}function As(t){return Se(t.provider,t.model,t.effort)}function Fs({pr:t,fix:s,headInfo:n,viewerCanPush:a}){var o,g,c;const i=p.useMemo(()=>Ht(s.patch),[s.patch]);if(s.status==="failed"&&((o=s.plan)==null?void 0:o.status)==="failed")return e.jsxs("div",{className:"mt-3 rounded-ui border border-ui-danger/40 bg-ui-danger/10 p-2 text-meta text-ui-danger",children:[z(s.plan??s)," could not make a plan: ",s.error??"unknown error"]});if(s.status==="cancelled"&&((g=s.plan)==null?void 0:g.status)==="discarded")return e.jsx("p",{className:"mt-3 text-meta text-ui-mute",children:"The plan was discarded."});if(s.status==="failed")return e.jsxs("div",{className:"mt-3 rounded-ui border border-ui-danger/40 bg-ui-danger/10 p-2 text-meta text-ui-danger",children:["The fix run failed: ",s.error??"unknown error"]});if(s.status==="cancelled")return e.jsx("p",{className:"mt-3 text-meta text-ui-mute",children:"The fix run was cancelled."});if(s.status!=="succeeded")return e.jsx(e.Fragment,{});const l=!s.patch||s.filesChanged.length===0;return e.jsxs("div",{className:"mt-3 border-t border-ui-line pt-3",children:[e.jsxs("p",{className:"mb-1 text-meta text-ui-mute",children:[s.trigger==="auto"&&e.jsxs(e.Fragment,{children:[e.jsx(qe,{})," "]}),ms(s)," · ",As(s),s.finishedAt&&e.jsxs(e.Fragment,{children:[" · ",ae(s.finishedAt)]})]}),s.pushedAt==null&&s.error&&e.jsx("p",{className:"mb-2 rounded-ui bg-ui-raise p-2 text-meta text-ui-warn",children:s.error}),e.jsx(De,{fix:s}),s.summary&&e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(Wt,{children:s.summary})}),e.jsx(hs,{pr:t,fix:s}),e.jsx(Yt,{checks:s.checks}),l?e.jsx("p",{className:"mt-2 text-meta text-ui-mute",children:"No files changed."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-1 mt-2 flex items-center justify-between gap-3 text-meta text-ui-mute",children:[e.jsxs("span",{children:[s.filesChanged.length," file",s.filesChanged.length===1?"":"s"," changed",!((c=s.checks)!=null&&c.ran)&&" · Not built or tested here."]}),e.jsx(qt,{})]}),e.jsx("div",{className:"overflow-hidden rounded-ui bg-ui-surface text-ui-ink",children:e.jsx(Gt,{files:i})}),e.jsx(Ss,{pr:t,fix:s,headInfo:n,viewerCanPush:a})]})]})}function Is({fix:t}){return e.jsxs("div",{className:"mb-2 rounded-ui bg-ui-raise p-2 text-meta text-ui-success",children:[e.jsxs("div",{children:["Pushed to ",e.jsx("span",{className:"font-mono",children:t.pushedBranch}),t.pushedPrUrl&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("a",{href:Oe(t.pushedPrUrl),target:"_blank",rel:"noreferrer",className:"hit underline",children:["PR #",t.pushedPrNumber]})]}),t.pushedAt&&e.jsxs(e.Fragment,{children:[" · ",ae(t.pushedAt)]})]}),t.commitMessage&&e.jsx("div",{className:"mt-1 font-mono text-meta text-ui-success",children:t.commitMessage})]})}function Ts({history:t,currentFixId:s}){const n=t.filter(a=>a.pushedAt!=null&&a.id!==s);return n.length===0?null:e.jsxs("div",{className:"mt-6",children:[e.jsx("div",{className:"mb-2 text-title text-ui-ink",children:"Earlier fixes pushed"}),e.jsx("ul",{className:"space-y-2",children:n.map(a=>e.jsxs("li",{className:"text-meta",children:[e.jsx("div",{className:"font-mono text-ui-ink",children:a.commitMessage??"(no commit message)"}),e.jsxs("div",{className:"mt-0.5 text-meta text-ui-faint",children:[a.pushedBranch&&e.jsx("span",{className:"font-mono",children:a.pushedBranch}),a.pushedPrUrl&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("a",{href:Oe(a.pushedPrUrl),target:"_blank",rel:"noreferrer",className:"hit underline",children:["PR #",a.pushedPrNumber]})]}),a.pushedAt&&e.jsxs(e.Fragment,{children:[" · ",ae(a.pushedAt)]})]})]},a.id))})]})}function Ss({pr:t,fix:s,headInfo:n,viewerCanPush:a}){const i=Kt(t.id),l=(n==null?void 0:n.canPushSameBranch)??!1,[o,g]=p.useState(l?"existing":"new"),[c,m]=p.useState((n==null?void 0:n.suggestedBranch)??""),v=p.useRef(!1);if(p.useEffect(()=>{!v.current&&(n!=null&&n.suggestedBranch)&&(m(n.suggestedBranch),v.current=!0,n.canPushSameBranch||g("new"))},[n]),s.pushedAt!=null)return e.jsx(Is,{fix:s});if(!a)return e.jsx("p",{className:"mt-2 text-meta text-ui-mute",children:"You need write access to push this fix."});const F=o==="new"&&c.trim().length===0,u=i.isPending,k=()=>{i.mutate({fixId:s.id,body:{target:o,branch:o==="new"?c.trim():void 0}})};return e.jsxs("div",{className:"mt-3 rounded-ui bg-ui-surface p-2",children:[s.commitMessage&&e.jsx("div",{className:"mb-2 rounded-ui bg-ui-surface px-2 py-1 font-mono text-meta text-ui-ink",title:"Commit message",children:s.commitMessage}),e.jsxs("label",{className:`flex items-center gap-2 text-meta ${l?"":"opacity-40"}`,title:l?void 0:"The PR head is a fork you cannot push to — use a new branch",children:[e.jsx(ve,{className:"mt-0",checked:o==="existing",disabled:!l||u,onChange:()=>g("existing")}),"Push to the PR branch",(n==null?void 0:n.headRef)&&e.jsxs("span",{className:"font-mono text-ui-faint",children:["(",n.headRef,")"]})]}),e.jsxs("label",{className:"mt-1 flex items-center gap-2 text-meta",children:[e.jsx(ve,{className:"mt-0",checked:o==="new",disabled:u,onChange:()=>g("new")}),"New branch + open a PR"]}),o==="new"&&e.jsx("input",{type:"text",className:"mt-1 w-full rounded-ui bg-ui-raise px-2 py-1 font-mono text-meta ring-1 ring-inset ring-ui-line focus:outline-none focus:ring-2 focus:ring-ui-accent touch:min-h-10",value:c,disabled:u,onChange:M=>m(M.target.value),placeholder:"branch-name"}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",className:te,disabled:u||F,onClick:k,children:u?"Pushing…":o==="new"?"Push + open PR":"Push"}),e.jsx(Vt,{checks:s.checks})]}),i.isError&&e.jsx("div",{className:"mt-2 text-meta text-ui-danger",children:se(i.error)})]})}export{Os as AiFixTab};
@@ -1,4 +1,4 @@
1
- import{j as e,r as f,d as Bt,k as Qs}from"./tanstack-BnbsafB1.js";import{bS as cs,bE as et,b2 as tt,aZ as st,a_ as nt,$ as us,aT as ds,c as ve,aV as We,aR as Ve,bY as ms,ax as hs,cn as ut,bL as Xs,cc as Js,cb as Zs,ar as ee,ad as it,v as ye,T as te,ab as de,bw as en,b$ as ae,aX as xs,bf as tn,be as sn,o as nn,aC as Ht,n as an,ca as ln,aD as rn,B as on,O as Ie,ag as q,a8 as ne,cd as cn,F as un,cZ as dn,h as mn,g as ps,e as le,a2 as hn,cC as xn,c9 as pn,c8 as fn,ae as dt,cj as me,ct as fs,d4 as gn,cv as bn,cw as jn,cu as vn,bc as Te,cG as gs,bd as yn,b8 as kn,an as mt,ba as Nn,l as wn,bb as Cn,af as J,V as ue,b9 as Rn,az as bs,i as ke,b7 as $n,as as Pe,f as js,k as Sn,q as Se,aM as ht,cU as In,cY as Pn,cQ as En,aw as xt,cV as _n,cK as An,a5 as Tn,bQ as Q,bR as ze,D as Ln,c2 as Fn,aH as Ot,bK as Mn,dc as pt,d8 as Bn,da as Hn,db as On,d9 as Dn,ce as Un,bD as Gn,bi as Wn,by as vs,c7 as ys,U as Vn,aF as zn,aE as qn,H as Kn,bP as Yn,aA as ks,cg as Qn,aG as Xn,aI as Jn,d7 as Ns,z as Zn,bN as ws,cf as ei,c6 as ti,b6 as si,ch as ni,dh as ii,y as ai,bx as li,cN as ri,aB as oi,G as ci,X as ui,_ as di,M as mi,a7 as hi,bj as xi,c4 as pi,bB as fi,cx as gi,c$ as bi,cI as ji,cA as vi,cr as yi,df as ki,de as Ni,cR as wi,cP as Ci,bn as Ri,cB as $i,d1 as Cs,cy as Si,aU as Rs,a9 as Ii,ai as Pi,aj as ce,ak as Dt,Z as Ei,bk as Be,P as He,d as _i,aY as Ut,bv as Ai,bI as Ti,am as $s,aN as Li,a$ as Gt,W as Ss,bs as Fi,dk as Mi,bA as Bi,bM as Hi,c1 as Oi,bU as Di,aW as Ui,br as Gi,c0 as Wi,cs as Vi,cX as zi,bG as qi,bX as Ki,Q as Is,x as Yi,r as Qi,c5 as Xi,N as Ji,al as Zi,w as ea,ao as ta,bm as sa,ac as at,av as Ps,m as na,bo as ia,aa as Wt,b as Xe,bO as Vt,bT as aa,b0 as zt,L as la,ay as ra,bW as oa,cz as ca,bZ as ua,aq as da,b_ as ma,cS as ha,at as xa,a6 as pa,ci as fa,c_ as ga,dg as ba,d0 as ja,b1 as va,dj as ya,bH as ka,d3 as Na,aK as wa,aJ as Ca,aL as Ra,cJ as $a,bu as qt,bt as Sa,bz as Ia,dl as Es,b4 as Pa,a1 as Ea,J as _a}from"./index-DoDcUqdp.js";const Aa="https://sonarcloud.io",Ta={blocker:"Blocker",critical:"Critical",major:"Major",minor:"Minor",info:"Info"},La={new_coverage:"Coverage on new code",coverage:"Coverage",new_line_coverage:"Line coverage on new code",line_coverage:"Line coverage",new_branch_coverage:"Branch coverage on new code",branch_coverage:"Branch coverage",new_uncovered_lines:"Uncovered new lines",uncovered_lines:"Uncovered lines",new_lines_to_cover:"New lines to cover",new_duplicated_lines_density:"Duplicated lines on new code",duplicated_lines_density:"Duplicated lines",new_duplicated_lines:"Duplicated new lines",duplicated_lines:"Duplicated lines",new_lines:"New lines",new_reliability_rating:"Reliability rating on new code",new_security_rating:"Security rating on new code",new_maintainability_rating:"Maintainability rating on new code",new_security_review_rating:"Security review rating on new code",new_security_hotspots_reviewed:"Security hotspots reviewed",new_violations:"Issues on new code",new_bugs:"Bugs on new code",new_vulnerabilities:"Vulnerabilities on new code",new_code_smells:"Code smells on new code"};function ft(t){return La[t]??t.replace(/^new_/,"").replace(/_/g," ").replace(/^./,s=>s.toUpperCase())}const _s=t=>/_rating$/.test(t),Fa=t=>/(coverage|density|hotspots_reviewed)$/.test(t);function lt(t,s){const n=Number(s);return Number.isFinite(n)?_s(t)?"ABCDE"[Math.round(n)-1]??s:Fa(t)?`${Math.round(n*10)/10}%`:String(n):s}function Ma(t){const s=ft(t.metric),n=t.actual!=null?lt(t.metric,t.actual):null,l=t.threshold!=null?lt(t.metric,t.threshold):null,r=n!=null?`${s} is ${n}.`:`${s} fails.`;if(l==null)return r;const o=_s(t.metric)?`${l} or better`:t.comparator==="LT"?`at least ${l}`:t.comparator==="GT"?`at most ${l}`:l;return`${r} The quality gate needs ${o}.`}function Ba(t){return((t==null?void 0:t.conditions)??[]).filter(s=>s.status==="ERROR"||s.status==="WARN")}const As=t=>/coverage|uncovered_lines|lines_to_cover/.test(t),Ha=t=>/duplicat/.test(t);function Oa(t){return As(t)||Ha(t)}function Da(t,s){return Ba(t).filter(n=>Oa(n.metric)).map(n=>{const l=As(n.metric),r=n.files??[],o=r.length>0?`
1
+ import{j as e,r as f,d as Bt,k as Qs}from"./tanstack-BnbsafB1.js";import{bS as cs,bE as et,b2 as tt,aZ as st,a_ as nt,$ as us,aT as ds,c as ve,aV as We,aR as Ve,bY as ms,ax as hs,cn as ut,bL as Xs,cc as Js,cb as Zs,ar as ee,ad as it,v as ye,T as te,ab as de,bw as en,b$ as ae,aX as xs,bf as tn,be as sn,o as nn,aC as Ht,n as an,ca as ln,aD as rn,B as on,O as Ie,ag as q,a8 as ne,cd as cn,F as un,cZ as dn,h as mn,g as ps,e as le,a2 as hn,cC as xn,c9 as pn,c8 as fn,ae as dt,cj as me,ct as fs,d4 as gn,cv as bn,cw as jn,cu as vn,bc as Te,cG as gs,bd as yn,b8 as kn,an as mt,ba as Nn,l as wn,bb as Cn,af as J,V as ue,b9 as Rn,az as bs,i as ke,b7 as $n,as as Pe,f as js,k as Sn,q as Se,aM as ht,cU as In,cY as Pn,cQ as En,aw as xt,cV as _n,cK as An,a5 as Tn,bQ as Q,bR as ze,D as Ln,c2 as Fn,aH as Ot,bK as Mn,dc as pt,d8 as Bn,da as Hn,db as On,d9 as Dn,ce as Un,bD as Gn,bi as Wn,by as vs,c7 as ys,U as Vn,aF as zn,aE as qn,H as Kn,bP as Yn,aA as ks,cg as Qn,aG as Xn,aI as Jn,d7 as Ns,z as Zn,bN as ws,cf as ei,c6 as ti,b6 as si,ch as ni,dh as ii,y as ai,bx as li,cN as ri,aB as oi,G as ci,X as ui,_ as di,M as mi,a7 as hi,bj as xi,c4 as pi,bB as fi,cx as gi,c$ as bi,cI as ji,cA as vi,cr as yi,df as ki,de as Ni,cR as wi,cP as Ci,bn as Ri,cB as $i,d1 as Cs,cy as Si,aU as Rs,a9 as Ii,ai as Pi,aj as ce,ak as Dt,Z as Ei,bk as Be,P as He,d as _i,aY as Ut,bv as Ai,bI as Ti,am as $s,aN as Li,a$ as Gt,W as Ss,bs as Fi,dk as Mi,bA as Bi,bM as Hi,c1 as Oi,bU as Di,aW as Ui,br as Gi,c0 as Wi,cs as Vi,cX as zi,bG as qi,bX as Ki,Q as Is,x as Yi,r as Qi,c5 as Xi,N as Ji,al as Zi,w as ea,ao as ta,bm as sa,ac as at,av as Ps,m as na,bo as ia,aa as Wt,b as Xe,bO as Vt,bT as aa,b0 as zt,L as la,ay as ra,bW as oa,cz as ca,bZ as ua,aq as da,b_ as ma,cS as ha,at as xa,a6 as pa,ci as fa,c_ as ga,dg as ba,d0 as ja,b1 as va,dj as ya,bH as ka,d3 as Na,aK as wa,aJ as Ca,aL as Ra,cJ as $a,bu as qt,bt as Sa,bz as Ia,dl as Es,b4 as Pa,a1 as Ea,J as _a}from"./index-CUiijl9W.js";const Aa="https://sonarcloud.io",Ta={blocker:"Blocker",critical:"Critical",major:"Major",minor:"Minor",info:"Info"},La={new_coverage:"Coverage on new code",coverage:"Coverage",new_line_coverage:"Line coverage on new code",line_coverage:"Line coverage",new_branch_coverage:"Branch coverage on new code",branch_coverage:"Branch coverage",new_uncovered_lines:"Uncovered new lines",uncovered_lines:"Uncovered lines",new_lines_to_cover:"New lines to cover",new_duplicated_lines_density:"Duplicated lines on new code",duplicated_lines_density:"Duplicated lines",new_duplicated_lines:"Duplicated new lines",duplicated_lines:"Duplicated lines",new_lines:"New lines",new_reliability_rating:"Reliability rating on new code",new_security_rating:"Security rating on new code",new_maintainability_rating:"Maintainability rating on new code",new_security_review_rating:"Security review rating on new code",new_security_hotspots_reviewed:"Security hotspots reviewed",new_violations:"Issues on new code",new_bugs:"Bugs on new code",new_vulnerabilities:"Vulnerabilities on new code",new_code_smells:"Code smells on new code"};function ft(t){return La[t]??t.replace(/^new_/,"").replace(/_/g," ").replace(/^./,s=>s.toUpperCase())}const _s=t=>/_rating$/.test(t),Fa=t=>/(coverage|density|hotspots_reviewed)$/.test(t);function lt(t,s){const n=Number(s);return Number.isFinite(n)?_s(t)?"ABCDE"[Math.round(n)-1]??s:Fa(t)?`${Math.round(n*10)/10}%`:String(n):s}function Ma(t){const s=ft(t.metric),n=t.actual!=null?lt(t.metric,t.actual):null,l=t.threshold!=null?lt(t.metric,t.threshold):null,r=n!=null?`${s} is ${n}.`:`${s} fails.`;if(l==null)return r;const o=_s(t.metric)?`${l} or better`:t.comparator==="LT"?`at least ${l}`:t.comparator==="GT"?`at most ${l}`:l;return`${r} The quality gate needs ${o}.`}function Ba(t){return((t==null?void 0:t.conditions)??[]).filter(s=>s.status==="ERROR"||s.status==="WARN")}const As=t=>/coverage|uncovered_lines|lines_to_cover/.test(t),Ha=t=>/duplicat/.test(t);function Oa(t){return As(t)||Ha(t)}function Da(t,s){return Ba(t).filter(n=>Oa(n.metric)).map(n=>{const l=As(n.metric),r=n.files??[],o=r.length>0?`
2
2
 
3
3
  Files with the most ${l?"uncovered":"duplicated"} new lines:
4
4
  ${r.map(c=>`- ${c.path}: ${c.lines} ${c.lines===1?"line":"lines"}`).join(`
@@ -1 +1 @@
1
- import{r as w,j as s}from"./tanstack-BnbsafB1.js";import{cT as j,c_ as y,cp as N,T as b,b3 as g,di as k,bS as v,aM as f,ap as T,E as C,bl as x,bq as $}from"./index-DoDcUqdp.js";import"./markdown-CcoLFczy.js";import"./highlight-DIEV0qGG.js";import"./vis-C3BCkP5U.js";function h(e){return e==null?"—":$(e)}function B(e){const t=[];for(const i of e){const a=v(i.at),n=t[t.length-1];if(n&&n.label===a){n.to=i.at,n.count+=1,i.kind==="review"?n.reviews+=1:n.comments+=1;continue}t.push({from:i.at,to:i.at,label:a,count:1,reviews:i.kind==="review"?1:0,comments:i.kind==="review"?0:1})}return t}function I(e){const t=[];return e.reviews>0&&t.push(`${e.reviews} review${e.reviews===1?"":"s"}`),e.comments>0&&t.push(`${e.comments} comment${e.comments===1?"":"s"}`),t.join(", ")}const P=40;function d({label:e,value:t,tone:i}){return s.jsxs("div",{children:[s.jsx("div",{className:"text-meta font-semibold text-ui-mute",children:e}),s.jsx("div",{className:`text-body font-semibold ${i==="warn"?"text-ui-danger":"text-ui-ink"}`,children:t})]})}function R({bot:e,color:t}){const i=g(e.kind),a=e.ttfrAnomaly,n=e.typicalTtfrHours==null,c=e.typicalFollowups!=null&&e.followupCount>=e.typicalFollowups+2,u=B(e.touches),r=u.slice(0,P),l=e.touches.length-r.reduce((o,p)=>o+p.count,0),m=n?"building baseline":a?`slower than typical — usually ${h(e.typicalTtfrHours)}`:`within typical (${h(e.typicalTtfrHours)})`;return s.jsxs("div",{className:"space-y-2 rounded-ui border border-ui-line p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-body font-semibold text-ui-ink",children:[s.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full",style:{background:t},"aria-hidden":!0}),e.label]}),s.jsx("span",{className:"rounded-ui px-1.5 py-0.5 text-meta font-medium",style:{...k(i.color),background:`${i.color}1a`},children:i.label}),e.firstTouchAt&&s.jsxs("span",{className:"text-meta text-ui-mute",children:["first touch ",v(e.firstTouchAt)]}),a&&s.jsxs("span",{className:"rounded-ui bg-ui-danger/10 px-1.5 py-0.5 text-meta font-semibold text-ui-danger",children:[s.jsx(f,{size:11,className:"inline-block align-[-0.1em]"})," slower than usual"]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[s.jsx(d,{label:"Time to first review",value:h(e.ttfrHours),tone:a?"warn":"default"}),s.jsx(d,{label:"Follow-ups",value:String(e.followupCount),tone:c?"warn":"default"}),s.jsx(d,{label:"Comments",value:String(e.commentCount)}),s.jsx(d,{label:"Touches",value:String(e.touchCount)})]}),s.jsxs("div",{className:"text-meta text-ui-mute",children:[s.jsxs("span",{className:a?"font-medium text-ui-danger":"",children:[!n&&a&&s.jsx(f,{size:11,className:"mr-1 inline-block align-[-0.1em]"}),m]}),e.ttfrBasis&&!n&&s.jsxs("span",{children:[" · from ",e.ttfrBasis==="ready"?"ready-for-review":"opened"]}),e.typicalFollowups!=null&&s.jsxs("span",{children:[" · ",e.followupCount," follow-up",e.followupCount===1?"":"s"," vs ",e.typicalFollowups," typical",c?" (more than usual)":""]}),!n&&s.jsxs("span",{children:[" · baseline: ",e.baselinePrs," PRs"]})]}),u.length>0&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[r.map((o,p)=>s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-ui bg-ui-raise px-1.5 py-0.5 text-meta text-ui-mute",title:`${o.count>1?`${I(o)} · `:""}${o.from===o.to?x(o.from):`${x(o.from)} – ${x(o.to)}`}`,children:[o.reviews>0&&s.jsx(T,{size:11}),o.comments>0&&s.jsx(C,{size:11}),o.count>1&&s.jsxs("span",{className:"font-medium",children:["×",o.count]}),o.label]},p)),l>0&&s.jsxs("span",{className:"text-meta text-ui-mute",children:["+",l," more touches"]})]})]})}function z({pr:e}){const{data:t,isLoading:i,isError:a}=j(e.id,!0),{data:n}=y(),c=w.useMemo(()=>{var l;return((l=(n??[]).find(m=>m.id===e.repoId))==null?void 0:l.workspaceId)??null},[n,e.repoId]),u=N(c),r=(t==null?void 0:t.bots)??[];return s.jsxs("div",{className:"space-y-3 p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(b,{title:"Bot activity",children:[s.jsx("p",{children:"How each review bot behaved on this pull request, compared with its own usual over the last 84 days. No AI is involved."}),s.jsx("p",{children:"A touch is one review or one comment, so a review submitted with three inline comments counts as four."})]}),s.jsx("span",{className:"text-meta text-ui-mute",children:"Each bot against its own usual"})]}),i?s.jsx("div",{className:"h-24 animate-pulse rounded-ui bg-ui-surface"}):a?s.jsx("div",{className:"text-body text-ui-danger",children:"Couldn’t load bot behaviour for this PR."}):r.length===0?s.jsx("div",{className:"rounded-ui border border-dashed border-ui-line p-6 text-center text-body text-ui-mute",children:"No automated-reviewer activity on this PR."}):r.map(l=>s.jsx(R,{bot:l,color:u({login:l.login,kind:l.kind})},l.key))]})}export{z as PrBotBehaviourTab};
1
+ import{r as w,j as s}from"./tanstack-BnbsafB1.js";import{cT as j,c_ as y,cp as N,T as b,b3 as g,di as k,bS as v,aM as f,ap as T,E as C,bl as x,bq as $}from"./index-CUiijl9W.js";import"./markdown-CcoLFczy.js";import"./highlight-DIEV0qGG.js";import"./vis-C3BCkP5U.js";function h(e){return e==null?"—":$(e)}function B(e){const t=[];for(const i of e){const a=v(i.at),n=t[t.length-1];if(n&&n.label===a){n.to=i.at,n.count+=1,i.kind==="review"?n.reviews+=1:n.comments+=1;continue}t.push({from:i.at,to:i.at,label:a,count:1,reviews:i.kind==="review"?1:0,comments:i.kind==="review"?0:1})}return t}function I(e){const t=[];return e.reviews>0&&t.push(`${e.reviews} review${e.reviews===1?"":"s"}`),e.comments>0&&t.push(`${e.comments} comment${e.comments===1?"":"s"}`),t.join(", ")}const P=40;function d({label:e,value:t,tone:i}){return s.jsxs("div",{children:[s.jsx("div",{className:"text-meta font-semibold text-ui-mute",children:e}),s.jsx("div",{className:`text-body font-semibold ${i==="warn"?"text-ui-danger":"text-ui-ink"}`,children:t})]})}function R({bot:e,color:t}){const i=g(e.kind),a=e.ttfrAnomaly,n=e.typicalTtfrHours==null,c=e.typicalFollowups!=null&&e.followupCount>=e.typicalFollowups+2,u=B(e.touches),r=u.slice(0,P),l=e.touches.length-r.reduce((o,p)=>o+p.count,0),m=n?"building baseline":a?`slower than typical — usually ${h(e.typicalTtfrHours)}`:`within typical (${h(e.typicalTtfrHours)})`;return s.jsxs("div",{className:"space-y-2 rounded-ui border border-ui-line p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-body font-semibold text-ui-ink",children:[s.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full",style:{background:t},"aria-hidden":!0}),e.label]}),s.jsx("span",{className:"rounded-ui px-1.5 py-0.5 text-meta font-medium",style:{...k(i.color),background:`${i.color}1a`},children:i.label}),e.firstTouchAt&&s.jsxs("span",{className:"text-meta text-ui-mute",children:["first touch ",v(e.firstTouchAt)]}),a&&s.jsxs("span",{className:"rounded-ui bg-ui-danger/10 px-1.5 py-0.5 text-meta font-semibold text-ui-danger",children:[s.jsx(f,{size:11,className:"inline-block align-[-0.1em]"})," slower than usual"]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[s.jsx(d,{label:"Time to first review",value:h(e.ttfrHours),tone:a?"warn":"default"}),s.jsx(d,{label:"Follow-ups",value:String(e.followupCount),tone:c?"warn":"default"}),s.jsx(d,{label:"Comments",value:String(e.commentCount)}),s.jsx(d,{label:"Touches",value:String(e.touchCount)})]}),s.jsxs("div",{className:"text-meta text-ui-mute",children:[s.jsxs("span",{className:a?"font-medium text-ui-danger":"",children:[!n&&a&&s.jsx(f,{size:11,className:"mr-1 inline-block align-[-0.1em]"}),m]}),e.ttfrBasis&&!n&&s.jsxs("span",{children:[" · from ",e.ttfrBasis==="ready"?"ready-for-review":"opened"]}),e.typicalFollowups!=null&&s.jsxs("span",{children:[" · ",e.followupCount," follow-up",e.followupCount===1?"":"s"," vs ",e.typicalFollowups," typical",c?" (more than usual)":""]}),!n&&s.jsxs("span",{children:[" · baseline: ",e.baselinePrs," PRs"]})]}),u.length>0&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[r.map((o,p)=>s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-ui bg-ui-raise px-1.5 py-0.5 text-meta text-ui-mute",title:`${o.count>1?`${I(o)} · `:""}${o.from===o.to?x(o.from):`${x(o.from)} – ${x(o.to)}`}`,children:[o.reviews>0&&s.jsx(T,{size:11}),o.comments>0&&s.jsx(C,{size:11}),o.count>1&&s.jsxs("span",{className:"font-medium",children:["×",o.count]}),o.label]},p)),l>0&&s.jsxs("span",{className:"text-meta text-ui-mute",children:["+",l," more touches"]})]})]})}function z({pr:e}){const{data:t,isLoading:i,isError:a}=j(e.id,!0),{data:n}=y(),c=w.useMemo(()=>{var l;return((l=(n??[]).find(m=>m.id===e.repoId))==null?void 0:l.workspaceId)??null},[n,e.repoId]),u=N(c),r=(t==null?void 0:t.bots)??[];return s.jsxs("div",{className:"space-y-3 p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(b,{title:"Bot activity",children:[s.jsx("p",{children:"How each review bot behaved on this pull request, compared with its own usual over the last 84 days. No AI is involved."}),s.jsx("p",{children:"A touch is one review or one comment, so a review submitted with three inline comments counts as four."})]}),s.jsx("span",{className:"text-meta text-ui-mute",children:"Each bot against its own usual"})]}),i?s.jsx("div",{className:"h-24 animate-pulse rounded-ui bg-ui-surface"}):a?s.jsx("div",{className:"text-body text-ui-danger",children:"Couldn’t load bot behaviour for this PR."}):r.length===0?s.jsx("div",{className:"rounded-ui border border-dashed border-ui-line p-6 text-center text-body text-ui-mute",children:"No automated-reviewer activity on this PR."}):r.map(l=>s.jsx(R,{bot:l,color:u({login:l.login,kind:l.kind})},l.key))]})}export{z as PrBotBehaviourTab};