@staff0rd/assist 0.1135.1 → 0.1136.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/dist/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +191 -162
- package/package.json +1 -1
package/dist/built-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.1136.0
|
|
@@ -4124,7 +4124,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4124
4124
|
`)){let n=t[t.length-1];r.startsWith("@@")||n===void 0?t.push(r):t[t.length-1]=`${n}
|
|
4125
4125
|
${r}`}return t}function XUr(e){return KUr(e??"").filter(t=>t.startsWith("@@"))}function e9o(e){return Number(/^@@ -(\d+)/.exec(e)?.[1]??1)}function t9o(e){return/^@@[^@]*@@/.exec(e)?.[0]??e.split(`
|
|
4126
4126
|
`)[0]??""}function ZUr(e,t){return e.reduce((r,n)=>r+YUr(n,t),0)}function QUr(e,t,r){let n=XUr(e.patch),o=[],i=[];return n.forEach((a,s)=>{let l=r.get(`${e.path}#${s}`)??[];l.includes(t)?o.push(a):i.push({oldStart:e9o(a),header:t9o(a),slice:l[0]??0})}),o.length===0||i.length===0?e:{...e,patch:o.join(`
|
|
4127
|
-
`),additions:ZUr(o,"+"),deletions:ZUr(o,"-"),split:{hunks:o.length,of:n.length,elsewhere:i}}}function JUr(e){return e.flatMap(t=>{if(t.kind==="dir")return JUr(t.children);let{kind:r,name:n,...o}=t;return[o]})}function r9o(e){let t=new Map;return e.forEach((r,n)=>{for(let o of r.hunks)t.set(o,[...t.get(o)??[],n+1])}),t}function eVr(e,t,r=new Set,n=new Set){let o=JUr(e.tree).filter(a=>!r.has(a.path)).map(a=>n.has(a.path)?{...a,critical:!0}:a),i=r9o(t);return t.map((a,s)=>{let l=new Set(a.hunks.map(_q));return jUr(o.filter(u=>l.has(u.path)).map(u=>QUr(u,s+1,i)))})}function n9o(e,t){let r=-1,n=0;return t.forEach((o,i)=>{let a=o.hunks.filter(s=>_q(s)===e).length;a>n&&(r=i,n=a)}),r}function tVr(e,t){let r=t.map(()=>[]);for(let n of e)r[n9o(n.path,t)]?.push(n);return r}function rVr(e,t){let r=eVr(e.structure,t,new Set(e.tests.map(i=>i.path)),new Set(e.criticalDiffs.map(i=>i.path))),n=tVr(e.tests,t),o=X5e(t);return t.map((i,a)=>{let s=a+1;return{number:s,slice:i,structure:r[a]??e.structure,tests:n[a]??[],critical:e.criticalDiffs.filter(l=>o.get(l.path)?.some(u=>u.number===s))}})}function nVr(e){if(!e.slices)return;let t=rVr(e,e.slices);return{entries:FUr(e,t),slicing:{count:t.length,noCritical:new Set(t.filter(r=>r.critical.length===0).map(r=>r.number))}}}function oVr(e){if(!(!e.repo||!e.headSha))return`${e.repo}#${e.prNumber}@${e.headSha}`}var Wft="assist:high-level-progress:",o9o=`${Wft}head:`,i9o=720*60*60*1e3,bae=e=>`${Wft}${e}`,Gft=e=>`${o9o}${e}`,Vft=e=>ll(e)[0];function a9o(e,t){let r=e?Vft(bae(e)):void 0;return e&&Rv(bae(e)),r??(t?Vft(Gft(t)):void 0)}function iVr(e,t,r){return _x(Wft,i9o),Vft(bae(e))??a9o(t,r)}function aVr(e,t,r){Rl(bae(e),[r]),t&&Rl(Gft(t),[r])}function sVr(e,t){Rv(bae(e)),t&&Rv(Gft(t))}function lVr(e){let t=e;return typeof t?.id=="string"&&typeof t.title=="string"&&typeof t.reason=="string"&&(t.kind==="deterministic"||t.kind==="manual")&&["pass","fail","manual"].includes(t.status)}function vM(e,t){return Array.isArray(e)?t?e.filter(t):e:[]}var Nq={repo:"",prNumber:0,headSha:"",checks:[],structure:{tree:[],added:0,removed:0,modified:0,additions:0,deletions:0},criticalDiffs:[],criticalPaths:[],tests:[],testPaths:[],collapsedPaths:[]};function cVr(e){let t;try{t=JSON.parse(e)}catch{return Nq}return typeof t!="object"||t===null?Nq:{repo:typeof t.repo=="string"?t.repo:Nq.repo,prNumber:typeof t.prNumber=="number"?t.prNumber:Nq.prNumber,headSha:typeof t.headSha=="string"?t.headSha:Nq.headSha,checks:vM(t.checks,lVr),structure:{...Nq.structure,...t.structure},criticalDiffs:vM(t.criticalDiffs),criticalPaths:vM(t.criticalPaths),tests:vM(t.tests),testPaths:vM(t.testPaths),collapsedPaths:vM(t.collapsedPaths),...Array.isArray(t.slices)?{slices:t.slices}:{},...t.manualTesting?{manualTesting:t.manualTesting}:{},...t.saved?{saved:t.saved}:{},...t.draft?{draft:t.draft}:{}}}function uVr(e){let t=(0,vRe.useMemo)(()=>cVr(e.body),[e.body]),r=(0,vRe.useMemo)(()=>nVr(t),[t]),n=oVr(t),o=(0,vRe.useMemo)(()=>iVr(e.requestId,e.supersedes,n)??t.draft??t.saved,[e.requestId,e.supersedes,n,t]);return{payload:t,sliced:r,progress:o,head:n}}var dVr=S(oe(),1);function fVr(e){let[t,r]=(0,dVr.useState)(()=>e?.reviewComments??[]);return{queued:t,onQueue:n=>r(o=>[...o,n]),onRemove:n=>r(o=>o.filter((i,a)=>a!==n)),onEdit:(n,o)=>r(i=>i.map((a,s)=>s===n?{...a,note:o}:a))}}var pVr=S(oe(),1);function hVr(e,t,r,n){(0,pVr.useEffect)(()=>{aVr(e,t,{items:r,reviewComments:n})},[e,t,r,n])}function gVr(e,t,r){let{payload:n,sliced:o,progress:i,head:a}=uVr(e),s=$Ur(n.checks,i,o?.slicing),l=fVr(i),u=RUr(o?.entries??[]),{comments:d,sentTo:f,clearSent:p}=L5e(t,r),h={...d,onQueue:l.onQueue};hVr(e.requestId,a,s.items,l.queued);let m=(0,mVr.useMemo)(()=>DUr(n),[n]);return{payload:n,checklist:s,queue:l,details:IUr(n,h),counts:m,sentTo:f,clearSent:p,sliced:o,nav:u,diffComments:h,head:a}}var uS=S(R(),1);function yVr({preview:e,session:t,sendInput:r,onDecision:n}){let o=gVr(e,t,r);return(0,uS.jsxs)(H,{sx:jy,children:[(0,uS.jsx)(Th,{preview:e,draft:!1}),(0,uS.jsx)(Dq,{items:e.metadata??[]}),(0,uS.jsx)(qn,{}),(0,uS.jsx)(pUr,{payload:o.payload,checklist:o.checklist,details:o.details,counts:o.counts,sliced:o.sliced,nav:o.nav,comments:o.diffComments}),(0,uS.jsx)(qn,{}),(0,uS.jsx)(_Ur,{pane:o,onDecision:(i,a)=>{sVr(e.requestId,o.head),n(i,a)}}),(0,uS.jsx)(Ay,{sessionName:o.sentTo,onClose:o.clearSent})]})}var kVr=S(oe(),1);var bM=S(R(),1);function s9o(e){return e.topLeft===null?"Click the top-left box":e.bottomRight===null?"Now click the bottom-right box":"Both anchors picked"}function vVr({selection:e,onConfirm:t,onReject:r}){let n=e.topLeft!==null&&e.bottomRight!==null;return(0,bM.jsxs)(St,{direction:"row",spacing:1,sx:{p:2,alignItems:"center",justifyContent:"flex-end"},children:[(0,bM.jsx)(Se,{variant:"body2",sx:{flex:1,color:"text.secondary"},children:s9o(e)}),(0,bM.jsx)(it,{color:"error",variant:"outlined",onClick:r,children:"Cancel"}),(0,bM.jsx)(it,{variant:"outlined",onClick:e.reset,children:"Start over"}),(0,bM.jsx)(it,{color:"success",variant:"contained",disabled:!n,onClick:t,children:"Extract boxes"})]})}var l9o={"top-left":tc.miro.topLeft,"bottom-right":tc.miro.bottomRight};function bVr(e,t){let r=e.right-e.left,n=e.bottom-e.top;return{width:r,height:n,fontSize:Math.max(6,Math.min(n*.3,r/6,28)),radius:Math.min(8,n/4),colour:t?l9o[t]:tc.miro.box,opacity:t?.75:.35,strokeWidth:Math.max(1,r*.004)}}var xae=S(R(),1);function xVr({box:e,role:t,onSelect:r}){let n=bVr(e,t);return(0,xae.jsxs)("g",{role:"button",tabIndex:0,"aria-label":t?`${e.text} (${t})`:e.text,onClick:()=>r(e.id),onKeyDown:o=>{o.key==="Enter"&&r(e.id)},style:{cursor:"pointer"},children:[(0,xae.jsx)("rect",{x:e.left,y:e.top,width:n.width,height:n.height,rx:n.radius,fill:n.colour,fillOpacity:n.opacity,stroke:n.colour,strokeWidth:n.strokeWidth}),(0,xae.jsx)("text",{x:e.left+n.width/2,y:e.top+n.height/2,textAnchor:"middle",dominantBaseline:"central",fontSize:n.fontSize,fill:tc.miro.text,children:e.text})]})}function SVr(e){if(e.length===0)return"0 0 100 100";let t=Math.min(...e.map(a=>a.left)),r=Math.min(...e.map(a=>a.top)),n=Math.max(...e.map(a=>a.right))-t,o=Math.max(...e.map(a=>a.bottom))-r,i=Math.max(n*.02,8);return`${t-i} ${r-i} ${n+i*2} ${o+i*2}`}var bRe=S(R(),1);function TVr({boxes:e,selection:t}){return(0,bRe.jsx)(H,{sx:{flex:1,minHeight:0,overflow:"auto",p:2},children:(0,bRe.jsx)("svg",{role:"img","aria-label":"Miro board boxes",viewBox:SVr(e),preserveAspectRatio:"xMidYMid meet",style:{width:"100%",height:"100%"},children:e.map(r=>(0,bRe.jsx)(xVr,{box:r,role:t.roleOf(r.id),onSelect:t.choose},r.id))})})}function c9o(e){return typeof e?.id=="string"&&typeof e.text=="string"&&[e.left,e.top,e.right,e.bottom].every(t=>typeof t=="number"&&Number.isFinite(t))}function wVr(e){try{let t=JSON.parse(e);return Array.isArray(t?.boxes)?t.boxes.filter(c9o):[]}catch{return[]}}var qft=S(oe(),1);function CVr(){let[e,t]=(0,qft.useState)(null),[r,n]=(0,qft.useState)(null);return{topLeft:e,bottomRight:r,choose:s=>{if(e===null||r!==null){t(s),n(null);return}n(s)},reset:()=>{t(null),n(null)},roleOf:s=>s===e?"top-left":s===r?"bottom-right":null}}var o3=S(R(),1);function _Vr({preview:e,onDecision:t}){let r=(0,kVr.useMemo)(()=>wVr(e.body),[e.body]),n=CVr();return(0,o3.jsxs)(H,{sx:jy,children:[(0,o3.jsx)(Th,{preview:e,draft:!1}),(0,o3.jsx)(qn,{}),(0,o3.jsx)(TVr,{boxes:r,selection:n}),(0,o3.jsx)(qn,{}),(0,o3.jsx)(vVr,{selection:n,onConfirm:()=>{let{topLeft:i,bottomRight:a}=n;i===null||a===null||t("approve",Fc({topLeft:i,bottomRight:a}))},onReject:()=>t("reject",Fc())})]})}var nWr=S(oe(),1);function EVr(e){let t=[];return e.map(r=>(t.length=r+1,t[r]=(t[r]??0)+1,t.map(n=>n??1).join(".")))}function xRe(e){return e*22}function RVr(e){return Math.round(e/22)}var PVr={display:"flex",alignItems:"flex-start",gap:.25,"& .criterion-action":{opacity:0,transition:"opacity 120ms"},"&:hover .criterion-action":{opacity:1},"&:focus-within .criterion-action":{opacity:1},"& .criterion-action:focus-visible":{opacity:1}},AVr={p:.25,mt:"2px",color:"text.disabled",cursor:"grab",touchAction:"none","&:active":{cursor:"grabbing"}},LVr={fontFamily:"fontFamilyMono",fontSize:"0.8rem",color:"text.secondary",minWidth:32,pt:"5px",textAlign:"right",userSelect:"none",whiteSpace:"nowrap"},IVr={flex:1,fontSize:"inherit",lineHeight:1.5,px:.75,py:0,borderRadius:1,"&:hover":{bgcolor:"action.hover"},"&.Mui-focused":{bgcolor:"action.selected"}},jft={p:.25,mt:"2px"},DVr={position:"absolute",right:8,height:2,borderRadius:1,bgcolor:"primary.main",pointerEvents:"none"};var NVr=S(R(),1),u9o=8;function MVr({drag:e}){return e?(0,NVr.jsx)(H,{sx:DVr,style:{top:e.top-1,left:u9o+xRe(e.depth)}}):null}var OVr=S(R(),1),BVr=ot((0,OVr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");var Yft=S(R(),1);function $Vr({number:e,onGrip:t}){return(0,Yft.jsx)(Ht,{size:"small",className:"criterion-action",sx:AVr,"aria-label":`Reorder criterion ${e}`,onPointerDown:t,children:(0,Yft.jsx)(BVr,{fontSize:"inherit"})})}var $C=S(R(),1);function FVr({number:e,onAdd:t,onDelete:r}){return(0,$C.jsxs)($C.Fragment,{children:[(0,$C.jsx)(Ht,{size:"small",className:"criterion-action",sx:jft,"aria-label":`Add criterion after ${e}`,onClick:t,children:(0,$C.jsx)(Wd,{fontSize:"inherit"})}),(0,$C.jsx)(Ht,{size:"small",className:"criterion-action",sx:jft,"aria-label":`Delete criterion ${e}`,onClick:r,children:(0,$C.jsx)(Bo,{fontSize:"inherit"})})]})}var SRe=S(oe(),1);function zVr(e,t){return e==="start"?0:e==="end"?t:Math.min(Math.max(e,0),t)}function HVr(e){let t=(0,SRe.useRef)(null);return(0,SRe.useEffect)(()=>{let r=t.current;if(!e||!r)return;r.focus();let n=zVr(e.caret,r.value.length);r.setSelectionRange(n,n)},[e]),t}var xM=S(R(),1);function UVr({index:e,number:t,item:r,outline:n,dragging:o,onGrip:i}){let a=HVr(n.focus?.index===e?n.focus:null),s={marginLeft:xRe(r.depth),opacity:o?.4:1};return(0,xM.jsxs)(H,{sx:PVr,"data-criterion-row":!0,style:s,children:[(0,xM.jsx)($Vr,{number:t,onGrip:i}),(0,xM.jsx)(H,{component:"span",sx:LVr,"aria-hidden":"true",children:`${t}.`}),(0,xM.jsx)(Bi,{multiline:!0,value:r.text,sx:IVr,inputRef:a,inputProps:{"aria-label":`Criterion ${t}`},onChange:l=>n.onText(e,l.target.value),onKeyDown:l=>n.onKeyDown(e,l)}),(0,xM.jsx)(FVr,{number:t,onAdd:()=>n.onAdd(e),onDelete:()=>n.onDelete(e)})]})}var KVr=S(oe(),1);function VVr(e,t,{key:r,shift:n,alt:o,caret:i,text:a}){return o||n?null:r==="ArrowUp"&&i===0&&t>0?{kind:"focus",index:t-1}:r==="ArrowDown"&&i===a.length&&t<e.length-1?{kind:"focus",index:t+1}:null}function i3(e){if(e.length===0)return[{text:"",depth:0}];let t=-1;return e.map(r=>{let n=Math.min(Math.max(r.depth,0),t+1);return t=n,r.depth===n?r:{...r,depth:n}})}function TRe(e,t,r,n){let o=e[t]?.depth??0,i=e.map((a,s)=>s===t?{...a,text:r}:a);return{items:i3([...i.slice(0,t+1),{text:n,depth:o},...i.slice(t+1)]),index:t+1}}function Zm(e,t){let r=t+1;for(;r<e.length&&e[r].depth>e[t].depth;)r+=1;return r}function wRe(e,t){let r=e[t].depth;for(let n=t-1;n>=0;n-=1){if(e[n].depth<r)return-1;if(e[n].depth===r)return n}return-1}function WVr(e,t){let r=Zm(e,t);return r<e.length&&e[r].depth===e[t].depth?r:-1}function GVr(e,t,r){let n=r<0?wRe(e,t):WVr(e,t);if(n<0)return null;let o=Zm(e,t),i=e.slice(t,o),a=[...e.slice(0,t),...e.slice(o)],s=r<0?n:Zm(e,n)-(o-t);return{items:[...a.slice(0,s),...i,...a.slice(s)],index:s}}function CRe(e,t){let r=Zm(e,t),n=e.map((o,i)=>i>t&&i<r?{...o,depth:o.depth-1}:o).filter((o,i)=>i!==t);return{items:i3(n),index:Math.max(0,t-1)}}function qVr(e,t,r){if(r<0&&e[t].depth===0||r>0&&wRe(e,t)<0)return null;let n=Zm(e,t);return e.map((o,i)=>i>=t&&i<n?{...o,depth:o.depth+r}:o)}function kRe(e,t){return e?{kind:"edit",edit:e,caret:t}:null}function d9o(e,t,{caret:r,text:n}){let o=n.slice(0,r);return kRe(TRe(e,t,o,n.slice(r)),"start")}function f9o(e,t,{shift:r,caret:n}){let o=qVr(e,t,r?-1:1);return kRe(o?{items:o,index:t}:null,n)}function jVr(e,t,r){let{key:n,shift:o,alt:i,caret:a,text:s}=r;return n==="Enter"&&!o?d9o(e,t,r):n==="Tab"?f9o(e,t,r):i&&(n==="ArrowUp"||n==="ArrowDown")?kRe(GVr(e,t,n==="ArrowUp"?-1:1),a):n==="Backspace"&&a===0&&s===""?kRe(CRe(e,t),"end"):null}function YVr(e,t,r){return jVr(e,t,r)??VVr(e,t,r)}function XVr(e,t){let[r,n]=(0,KVr.useState)(null),o=(a,s)=>{a&&(t(a.items),n({index:a.index,caret:s}))};return{focus:r,onKeyDown:(a,s)=>{let l=s.currentTarget;(s.key==="Enter"||s.key==="Tab")&&s.preventDefault();let u=YVr(e,a,{key:s.key,shift:s.shiftKey,alt:s.altKey,caret:l.selectionStart??0,text:l.value});u&&(s.preventDefault(),u.kind==="focus"?n({index:u.index,caret:"end"}):o(u.edit,u.caret))},onDrop:a=>o(a,"end"),onText:(a,s)=>t(e.map((l,u)=>u===a?{...l,text:s}:l)),onAdd:a=>o(TRe(e,a,e[a].text,""),"start"),onDelete:a=>o(CRe(e,a),"end")}}var tWr=S(oe(),1);function p9o(e,t,r,n){let o=t.length;for(let a=0;a<e.length;a+=1)if(n<e[a].top+e[a].height/2){o=a;break}let i=Zm(t,r);return o>r&&o<i?r:o}function h9o(e,t,r,n){let o=Zm(e,t),i=r-1,a=i>=t&&i<o?t-1:i,s=a>=0?e[a].depth+1:0;return Math.max(0,Math.min(e[t].depth+RVr(n),s))}function m9o(e,t){if(t<e.length)return e[t].top;let r=e[e.length-1];return r?r.top+r.height:0}function ZVr(e,t,r,n,o){let i=p9o(e,t,r,o);return{target:i,depth:h9o(t,r,i,n),top:m9o(e,i)}}function g9o(e){let t=e.getBoundingClientRect().top;return{boxes:Array.from(e.querySelectorAll("[data-criterion-row]")).map(n=>{let o=n.getBoundingClientRect();return{top:o.top-t,height:o.height}}),origin:t}}function QVr(e,t,r,n){return o=>{let{boxes:i,origin:a}=g9o(t);return ZVr(i,e,r,o.clientX-n,o.clientY-a)}}function JVr(e,t,r,n,o){let i=new AbortController,a=null,s=d=>{a=r(d),n(a)},l=()=>{i.abort(),a&&o(a)},u={signal:i.signal};return e.setPointerCapture(t),e.addEventListener("pointermove",s,u),e.addEventListener("pointerup",l,u),e.addEventListener("pointercancel",l,u),s}function eWr(e,t,r,n){let o=Zm(e,t),i=n-e[t].depth,a=e.slice(t,o).map(u=>({...u,depth:Math.max(0,u.depth+i)})),s=[...e.slice(0,t),...e.slice(o)],l=r>t?r-a.length:r;return{items:i3([...s.slice(0,l),...a,...s.slice(l)]),index:l}}function rWr(e,t,r){let[n,o]=(0,tWr.useState)(null);return{drag:n,onGrip:a=>s=>{let l=t.current;if(!l||s.pointerType==="mouse"&&s.button!==0)return;s.preventDefault(),JVr(s.currentTarget,s.pointerId,QVr(e,l,a,s.clientX),d=>o({from:a,depth:d.depth,top:d.top}),d=>{o(null),r(eWr(e,a,d.target,d.depth))})(s)}}}var Sae=S(R(),1),y9o={my:1,px:1,py:.5,border:1,borderColor:"divider",borderRadius:1,position:"relative",userSelect:"text",cursor:"auto"},v9o=[{text:"",depth:0}];function oWr({items:e,onChange:t}){let r=(0,nWr.useRef)(null),n=e.length>0?e:v9o,o=XVr(n,t),{drag:i,onGrip:a}=rWr(n,r,o.onDrop),s=EVr(n.map(l=>l.depth));return(0,Sae.jsxs)(H,{sx:y9o,ref:r,"data-preview-skip":!0,"aria-label":"Acceptance criteria",children:[n.map((l,u)=>(0,Sae.jsx)(UVr,{index:u,number:s[u],item:l,outline:o,dragging:i?.from===u,onGrip:a(u)},`criterion-${u}`)),(0,Sae.jsx)(MVr,{drag:i})]})}var iWr=S(R(),1),aWr=ot((0,iWr.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered");var Tae=S(R(),1),b9o={insert:"Add acceptance criteria",convert:"Convert to outline"};function sWr({kind:e,onClick:t}){return(0,Tae.jsx)(H,{sx:{my:1},"data-preview-skip":!0,children:(0,Tae.jsx)(it,{size:"small",variant:"outlined",startIcon:e==="insert"?(0,Tae.jsx)(Wd,{}):(0,Tae.jsx)(aWr,{}),onClick:t,children:b9o[e]})})}var wae=S(oe(),1);function lWr(e,t,{color:r,pin:n}){let o=qA(e),i=[],a=o.nextNode();for(;a;){let u=a;if(t.intersectsNode(u)){let d=u===t.startContainer?t.startOffset:0,f=u===t.endContainer?t.endOffset:u.length;d<f&&i.push({node:u,start:d,end:f})}a=o.nextNode()}let l=i.map(u=>x9o(u.node,u.start,u.end,r)).at(-1);l&&n&&(l.dataset.pin=n)}function x9o(e,t,r,n){let o=document.createRange();o.setStart(e,t),o.setEnd(e,r);let i=document.createElement("mark");return i.className="pr-comment",i.style.backgroundColor=n,o.surroundContents(i),i}function cWr(e){for(let t of e.querySelectorAll("mark.pr-comment"))if(t.parentNode){for(;t.firstChild;)t.before(t.firstChild);t.remove()}}function uWr(e,t){for(let r of t){let n=hLt(e,r);n&&lWr(e,n,r)}}var Cae=S(R(),1);function dWr({content:e,control:t,trailing:r,ranges:n,contentRef:o}){let i=(0,wae.useMemo)(()=>KI(e),[e]),a=(0,wae.useMemo)(()=>KI(r??""),[r]);return(0,wae.useLayoutEffect)(()=>{let s=o.current;s&&(cWr(s),uWr(s,n))},[i,a,n,o]),(0,Cae.jsxs)(H,{ref:o,children:[(0,Cae.jsx)(qI,{segments:i,skipDiagramText:!0}),t,t?(0,Cae.jsx)(qI,{segments:a,skipDiagramText:!0}):null]})}var SM=e=>e.split(",").map(t=>`&& .markdown ${t.trim()}`).join(", ");function _Re(e){let{color:t,radius:r}=e.tokens;return{px:2.5,py:2,fontSize:14,lineHeight:1.6,[SM("")]:{lineHeight:1.6},[SM("h1, h2, h3, h4, h5, h6")]:{fontSize:15,fontWeight:600,lineHeight:1.4,mt:2,mb:1},[SM("ul, ol")]:{pl:2.5,mb:2},[SM("li")]:{mb:"6px"},[SM("code")]:{fontFamily:e.typography.fontFamilyMono,fontSize:"0.86em",px:"5px",py:0,bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:"4px"},[SM("pre")]:{bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:`${r.sm}px`},[SM("pre code")]:{border:0,px:0,bgcolor:"transparent"}}}var fWr=e=>({flex:1,overflow:"auto",position:"relative",userSelect:"none",cursor:"text",wordBreak:"break-word","& .markdown":{...Xme(e),maxWidth:"none"},"& a":{color:"primary.main"},"& mark.pr-comment":{color:"inherit",borderRadius:"2px"},..._Re(e)});var Oq=S(R(),1);function pWr({content:e,control:t,trailing:r,ranges:n,wrapperRef:o,contentRef:i,dragRects:a,dragColor:s,onMouseDown:l,footer:u}){return(0,Oq.jsxs)(H,{ref:o,onMouseDown:l,sx:fWr,children:[(0,Oq.jsx)(dWr,{content:e,control:t,trailing:r,ranges:n,contentRef:i}),u&&(0,Oq.jsx)(H,{sx:{userSelect:"text"},children:u}),(0,Oq.jsx)(RB,{rects:a,color:s})]})}function hWr(e){let t=new Map,r=[];for(let n of e){if(!n.group){r.push(n);continue}t.set(n.group,[...t.get(n.group)??[],n])}return{groups:[...t],ungrouped:r}}var ERe=S(oe(),1),mWr=S(R(),1);function Kft({label:e,value:t,onCommit:r,listId:n}){let[o,i]=(0,ERe.useState)(t);return(0,ERe.useEffect)(()=>i(t),[t]),(0,mWr.jsx)(sn,{size:"small",variant:"standard",fullWidth:!0,label:e,value:o,onChange:s=>i(s.target.value),onBlur:()=>{let s=o.trim();i(t),s!==t&&r(s)},onKeyDown:s=>{s.key==="Enter"&&s.target.blur()},onMouseDown:s=>s.stopPropagation(),slotProps:{htmlInput:{list:n}}})}var kae=S(R(),1),Xft="screenshot-groups";function S9o(e){return(e.split(/[\\/]/).pop()??e).replace(/\.[^.]+$/,"")}function gWr({screenshot:e,onUpdate:t}){return(0,kae.jsxs)(St,{direction:"row",spacing:1,sx:{mt:.5},children:[(0,kae.jsx)(Kft,{label:"Caption",value:e.alt,onCommit:r=>t(e.id,{alt:r||S9o(e.path)})}),(0,kae.jsx)(Kft,{label:"Group",value:e.group??"",listId:Xft,onCommit:r=>t(e.id,{group:r})})]})}var a3=S(R(),1),yWr={display:"block",maxWidth:"100%",borderRadius:1,border:1,borderColor:"divider"},T9o={position:"absolute",top:4,right:4,bgcolor:"background.paper","&:hover":{bgcolor:"background.paper"}};function vWr({screenshot:e,onRemove:t,onUpdate:r}){let n=e.contentType.startsWith("video/");return(0,a3.jsxs)(H,{sx:{position:"relative"},children:[n?(0,a3.jsx)(H,{component:"video",controls:!0,src:e.url,"aria-label":"screenshot",sx:yWr}):(0,a3.jsx)(H,{component:"img",src:e.url,alt:"screenshot",sx:yWr}),(0,a3.jsx)(Ht,{size:"small","aria-label":"Remove screenshot",sx:T9o,onMouseDown:o=>o.stopPropagation(),onClick:()=>t(e.id),children:(0,a3.jsx)(Bo,{fontSize:"small"})}),(0,a3.jsx)(gWr,{screenshot:e,onUpdate:r})]})}var t0=S(R(),1);function w9o(){return(0,t0.jsxs)(St,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,t0.jsx)(oo,{size:16}),(0,t0.jsx)(Se,{variant:"caption",color:"text.secondary",children:"Attaching screenshot or video\u2026"})]})}function C9o({error:e}){return(0,t0.jsx)(Se,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:e})}function bWr({uploads:e,empty:t}){return e.length>0?(0,t0.jsx)(t0.Fragment,{children:e.map(r=>r.error?(0,t0.jsx)(C9o,{error:r.error},r.id):(0,t0.jsx)(w9o,{},r.id))}):t?(0,t0.jsx)(Se,{variant:"caption",color:"text.secondary",children:"Drop or paste an image or video to attach"}):null}var r0=S(R(),1),k9o={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:1};function xWr({screenshots:e,uploads:t,onRemove:r,onUpdate:n}){let{groups:o,ungrouped:i}=hWr(e),a=s=>(0,r0.jsx)(vWr,{screenshot:s,onRemove:r,onUpdate:n},s.id);return(0,r0.jsxs)(H,{sx:{mt:3},children:[e.length>0&&(0,r0.jsx)(H,{component:"h2",children:"Screenshots"}),(0,r0.jsx)("datalist",{id:Xft,children:o.map(([s])=>(0,r0.jsx)("option",{value:s},s))}),o.map(([s,l])=>(0,r0.jsxs)(H,{sx:{mb:2},children:[(0,r0.jsx)(H,{component:"h3",children:s}),(0,r0.jsx)(H,{sx:k9o,children:l.map(a)})]},s)),(0,r0.jsxs)(St,{spacing:1,children:[i.map(a),(0,r0.jsx)(bWr,{uploads:t,empty:e.length===0})]})]})}var _ae=S(R(),1);function _9o(e){let t=e.criteria;if(!t)return{content:e.body};let r={content:t.before,trailing:t.after};return t.kind==="outline"?{...r,control:(0,_ae.jsx)(oWr,{items:t.items,onChange:e.onCriteriaChange})}:{...r,control:(0,_ae.jsx)(sWr,{kind:t.kind,onClick:t.kind==="insert"?e.onCriteriaInsert:e.onCriteriaConvert})}}function RRe({pane:e,screenshots:t}){return(0,_ae.jsx)(pWr,{..._9o(e),ranges:e.ranges,wrapperRef:e.wrapperRef,contentRef:e.contentRef,dragRects:e.dragRects,dragColor:e.dragColor,onMouseDown:e.onMouseDown,footer:t?(0,_ae.jsx)(xWr,{screenshots:e.screenshots,uploads:e.uploads,onRemove:e.removeScreenshot,onUpdate:e.updateScreenshot}):void 0})}var SWr=e=>({display:"grid",gap:1,maxHeight:220,overflow:"auto",px:2,py:1.25,borderTop:1,borderColor:e.tokens.color.lineSoft}),TWr={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"text.secondary"},wWr=e=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:"4px 8px",px:1.25,py:1,borderRadius:`${e.tokens.radius.sm}px`,bgcolor:e.tokens.color.raised,border:1,borderColor:e.tokens.color.lineSoft,fontSize:12.5}),CWr={gridColumn:2,gridRow:1,width:20,height:20,color:"text.disabled","& .MuiSvgIcon-root":{fontSize:14}};var FC=S(R(),1);function kWr({comments:e,colors:t,onRemove:r}){return(0,FC.jsxs)(H,{sx:SWr,children:[(0,FC.jsxs)(Se,{sx:TWr,children:["Comments (",e.length,")"]}),e.map((n,o)=>(0,FC.jsxs)(H,{sx:wWr,children:[(0,FC.jsx)(CB,{text:n.quote,sx:{gridColumn:1,borderLeft:2,pl:1,borderColor:t[o]}}),(0,FC.jsx)(H,{sx:{gridColumn:1,wordBreak:"break-word"},children:n.note}),(0,FC.jsx)(Ht,{"aria-label":"Remove comment",onClick:()=>r(n.id),sx:CWr,children:(0,FC.jsx)(Bo,{})})]},n.id))]})}var EWr=S(R(),1);function _Wr(e){return e.comments.length===0?null:(0,EWr.jsx)(kWr,{...e})}var RWr=S(R(),1),PRe=ot((0,RWr.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"}),"Computer");var MWr=S(oe(),1);var PWr=S(R(),1),AWr=ot((0,PWr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var n0="0.1135.1";var E9o={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function LWr(e){return e?E9o[e]:"success.main"}function IWr(e){return e.split("-")[0].split(".").map(Number)}function DWr(e,t){if(!e||!t||e===t)return;let r=IWr(e),n=IWr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var ARe=S(oe(),1),Zft=(0,ARe.createContext)(null);function LRe(){return(0,ARe.useContext)(Zft)}var TM=S(R(),1),R9o={height:16,fontSize:10},P9o={opacity:.6,fontSize:"0.85em"};function A9o(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function s3({nodes:e,name:t,showVersion:r=!1}){let n=LRe()??n0,o=e.links.find(a=>a.name===t),i=DWr(o?.peerVersion,n);return(0,TM.jsx)(pr,{title:A9o(e,t),placement:"right",children:(0,TM.jsxs)(H,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,TM.jsx)(AWr,{sx:{fontSize:8,color:LWr(o?.state)}}),t,r&&o?.peerVersion&&(0,TM.jsxs)(H,{component:"span",sx:P9o,children:["v",o.peerVersion]}),i&&(0,TM.jsx)(Sn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:R9o})]})})}var o0=S(R(),1),L9o={textTransform:"none"};function IRe({nodes:e,options:t,target:r,onPick:n}){let[o,i]=(0,MWr.useState)(null);return(0,o0.jsxs)(o0.Fragment,{children:[(0,o0.jsx)(it,{size:"small",color:"inherit",startIcon:(0,o0.jsx)(PRe,{fontSize:"small"}),"aria-label":"Start on node","aria-haspopup":"menu",onClick:a=>i(a.currentTarget),sx:L9o,children:(0,o0.jsx)(s3,{nodes:e,name:r.node})}),(0,o0.jsx)($i,{anchorEl:o,open:!!o,onClose:()=>i(null),children:t.map(({name:a,cwd:s})=>(0,o0.jsx)(Hr,{disabled:!s,selected:a===r.node,onClick:()=>{n(a),i(null)},children:(0,o0.jsx)(Fu,{primary:(0,o0.jsx)(s3,{nodes:e,name:a}),secondary:s?void 0:"no clone"})},a))})]})}var NWr=S(oe(),1);function I9o(e,t){return e?.toLowerCase()===t.toLowerCase()}function DRe(e,t){let{nodes:r,names:n,visible:o}=cs(),{repos:i,selectedCwd:a,selectedNode:s,cloneOn:l,originOf:u}=In(),[d,f]=(0,NWr.useState)(),p=e&&u(e)?e:a,h=t?i.find(b=>I9o(u(b),t)):p,m=n.map(b=>({name:b,cwd:h?l(h,b):void 0})),g=b=>m.find(x=>x.name===b&&x.cwd),y=g(d)??g(s??r?.local)??m.find(b=>b.cwd),v=o&&y?.cwd?{node:y.name,cwd:y.cwd}:void 0;return{nodes:r,visible:o,options:m,target:v,pick:f}}var l3=S(R(),1);function OWr({canStart:e,startOrigin:t,cwd:r,onApprove:n,onApproveAndStart:o}){let i=ahe(),a=DRe(r,t);return(0,l3.jsxs)(l3.Fragment,{children:[(0,l3.jsx)(it,{color:"primary",variant:e?"tonal":"contained",onClick:n,...e?{}:i,children:"Approve"}),e&&a.nodes&&a.target&&(0,l3.jsx)(IRe,{nodes:a.nodes,options:a.options,target:a.target,onPick:a.pick}),e&&(0,l3.jsx)(it,{color:"primary",variant:"contained",onClick:()=>o(a.target),...i,children:"Approve & start"})]})}var Qft=S(R(),1),D9o={"& .MuiFormControlLabel-label":{fontSize:12}};function Eae({label:e,title:t,checked:r,onChange:n}){return(0,Qft.jsx)(Id,{control:(0,Qft.jsx)(Ep,{size:"small",checked:r,onChange:o=>n(o.target.checked)}),label:e,title:t,sx:D9o})}var wM=S(R(),1);function MRe({chain:e,newPr:t,onChange:r}){return(0,wM.jsxs)(St,{direction:"row",sx:{mr:"auto"},children:[t&&(0,wM.jsx)(Eae,{label:"Draft",title:"Create the PR as a draft rather than ready for review",checked:e.draft,onChange:n=>r({...e,draft:n,autoMerge:n?!1:e.autoMerge})}),(0,wM.jsx)(Eae,{label:"Auto-merge (squash)",title:"Squash-merge the PR automatically once its required checks pass",checked:e.autoMerge,onChange:n=>r({...e,autoMerge:n,draft:n?!1:e.draft})}),(0,wM.jsx)(Eae,{label:"Review PR",title:"After raising, run a review that posts its findings and then addresses them",checked:e.reviewAfter,onChange:n=>r({...e,reviewAfter:n})}),(0,wM.jsx)(Eae,{label:"Post to Slack",title:"Announce the PR in Slack at the tail of the chain",checked:e.announceAfter,onChange:n=>r({...e,announceAfter:n})})]})}var CM=S(R(),1);function BWr({commentCount:e,chain:t,newPr:r,canStart:n,startOrigin:o,onChainChange:i,onApprove:a,cwd:s,onApproveAndStart:l,onReject:u,onRequestChanges:d}){return(0,CM.jsxs)(St,{direction:"row",spacing:1,sx:{px:2,py:1.5,alignItems:"center",justifyContent:"flex-end"},children:[t&&(0,CM.jsx)(MRe,{chain:t,newPr:r,onChange:i}),(0,CM.jsx)(it,{color:"error",variant:"outlined",onClick:u,children:"Reject"}),e>0&&(0,CM.jsxs)(it,{color:"warning",variant:"tonal",onClick:d,children:["Request changes (",e,")"]}),(0,CM.jsx)(OWr,{canStart:n,startOrigin:o,cwd:s,onApprove:a,onApproveAndStart:l})]})}var FWr=S(R(),1);function $Wr({comments:e,cwd:t,onDecision:r,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s}){let l=()=>e.map(u=>({quote:u.quote,note:u.note}));return(0,FWr.jsx)(BWr,{commentCount:e.length,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s,onApprove:()=>r("approve",l()),cwd:t,onApproveAndStart:u=>r("approve",l(),u??!0),onReject:()=>r("reject",[]),onRequestChanges:()=>r("reject",l())})}var zC=S(R(),1);function zWr(e){let{comments:t,commentColors:r,pending:n,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onRemove:d,onCancel:f,onCollapse:p,editable:h}=e;return(0,zC.jsxs)(zC.Fragment,{children:[(0,zC.jsx)(_Wr,{comments:t,colors:r,onRemove:d}),(0,zC.jsx)(qn,{}),(0,zC.jsx)($Wr,{...e}),(0,zC.jsx)(yme,{pending:n,editable:h,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onCancel:f,onCollapse:p})]})}var Rae=S(R(),1),M9o={px:2,pb:2,display:"flex",alignItems:"center",gap:1.5,minWidth:0},N9o={color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function HWr({url:e}){return(0,Rae.jsxs)(H,{sx:M9o,children:[(0,Rae.jsx)(it,{variant:"contained",href:e,target:"_blank",rel:"noopener noreferrer",sx:{flexShrink:0},children:"Open design \u2197"}),(0,Rae.jsx)(Se,{variant:"body2",sx:N9o,title:e,children:e})]})}var Jft=S(R(),1);function UWr({preview:e}){let t=e.kind==="design"?e.metadata?.[0]?.url:void 0;return t?(0,Jft.jsx)(HWr,{url:t}):(0,Jft.jsx)(Dq,{items:e.metadata??[]})}function VWr({preview:e,pane:t,cwd:r,isPr:n,editable:o,sender:i,onCite:a,onAddRule:s}){return{comments:t.comments,commentColors:t.commentColors,pending:t.pending,cwd:r,unavailable:i.unavailable,onAdd:i.onSend,onQueue:t.onAdd,onCite:a,onAddRule:s,onRemove:t.remove,onCancel:t.onCancel,onCollapse:t.onCollapse,onDecision:t.onDecide,chain:n?t.chain:void 0,editable:o,newPr:n&&e.prNumber===null,canStart:e.kind==="backlog-item"&&e.canStart===!0,startOrigin:e.startOrigin,onChainChange:t.setChain}}function Bq(e){let t=e??"pr";return{isPr:t==="pr",screenshots:t==="pr"||t==="github-issue",editable:t==="github-issue-edit",closeOnly:t==="show"}}function WWr(e,t){return e?`${e}:${t??"pr"}`:void 0}function NRe(e,t,r,n){return{...Bq(e.kind),requestId:e.requestId,supersedes:e.supersedes,sessionId:t,cwd:r,onDecision:n,screenshotScope:WWr(t,e.kind),seededScreenshots:e.screenshots??[],chainDefaults:{draft:e.draft===!0,reviewAfter:e.reviewAfter??!0},initialBody:e.body}}function GWr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&cf(t,e,aCe({quote:r,note:o})),n()}}function qWr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&cf(t,e,kx(r,cme(o))),n()}}function ORe(e,t,r,n){return{onCite:qWr(e,t,r,n),onAddRule:GWr(e,t,r,n)}}function jWr(e){return{criteria:e.criteria,onCriteriaChange:e.writeCriteria,onCriteriaInsert:e.insertCriteria,onCriteriaConvert:e.convertCriteria}}var rGr=S(oe(),1);var HC=S(oe(),1);var YWr="assist:pr-preview-comments:",ept=e=>`${YWr}${e}`;function tpt(e){return ll(ept(e))}function Pae(e,t){Rl(ept(e),t)}function BRe(e){Rv(ept(e))}function KWr(){_x(YWr)}function XWr(e){let t=qA(e),r="";for(let n=t.nextNode();n;n=t.nextNode())r+=n.textContent??"";return r}function O9o(e,t,r){let n=-1;for(let o=e.indexOf(t);o!==-1;o=e.indexOf(t,o+1))(n===-1||Math.abs(o-r)<Math.abs(n-r))&&(n=o);return n}function ZWr(e,t){return e.flatMap(r=>{let n=O9o(t,r.quote,r.start);return n===-1?[]:[{...r,start:n,end:n+r.quote.length}]})}function QWr(e,t,r){let n=tpt(e);if(n.length>0||!t||!r)return n;let o=ZWr(tpt(t),XWr(r));return Pae(e,o),BRe(t),o}function JWr(e,t,r){let[n,o]=(0,HC.useState)([]),i=(0,HC.useRef)(0);(0,HC.useEffect)(()=>{KWr(),o(QWr(e,t,r.current).map(l=>({...l,id:i.current++})))},[e,t,r]);let a=(0,HC.useCallback)(l=>{o(u=>{let d=[...u,{...l,id:i.current++}];return Pae(e,d),d})},[e]),s=(0,HC.useCallback)(l=>{o(u=>{let d=u.filter(f=>f.id!==l);return Pae(e,d),d})},[e]);return{comments:n,add:a,remove:s}}function eGr(e,t){let r=e.map((i,a)=>lW(a).solid),n=lW(e.length).fill,o=e.map((i,a)=>({start:i.start,end:i.end,color:lW(a).fill,pin:String(a+1)}));return t&&o.push({start:t.start,end:t.end,color:n}),{commentColors:r,dragColor:n,ranges:o}}function tGr(e,t,r,n){return{onAdd:o=>{e&&t({quote:e.quote,note:o,start:e.start,end:e.end}),n()},onCollapse:()=>{e&&r(e.quote),n()}}}function nGr(e,t,r){let{wrapperRef:n,contentRef:o,pending:i,dragRects:a,onMouseDown:s,clear:l,select:u}=N5(),{comments:d,add:f,remove:p}=JWr(e,t,o),{commentColors:h,dragColor:m,ranges:g}=(0,rGr.useMemo)(()=>eGr(d,i),[d,i]),{onAdd:y,onCollapse:v}=tGr(i,f,r,l);return{wrapperRef:n,contentRef:o,onMouseDown:s,comments:d,commentColors:h,remove:p,pending:i,ranges:g,dragRects:a,dragColor:m,onAdd:y,onCollapse:v,onCancel:l,onSelect:u}}var FRe=S(oe(),1);var rpt="assist:preview-screenshots:",npt=e=>`${rpt}${e}`,$Re=e=>`${rpt}seeded:${e}`;function oGr(e){return e?(_x(rpt),ll(npt(e)).filter(t=>typeof t.path=="string")):[]}function kM(e,t){e&&Rl(npt(e),t.map(({path:r,alt:n,group:o,contentType:i,seeded:a})=>({path:r,alt:n,group:o,contentType:i,seeded:a})))}function iGr(e){e&&(Rv(npt(e)),Rv($Re(e)))}var _M=S(oe(),1);var aGr={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","video/mp4":"mp4","video/webm":"webm","video/quicktime":"mov"};function B9o(e){let t=e.split(".").pop()?.toLowerCase();return Object.entries(aGr).find(([,n])=>n===t)?.[0]??"application/octet-stream"}function sGr(e){return e.map(t=>({...t,contentType:B9o(t.path),seeded:!0}))}function lGr(e,t,r){if(!e)return sGr(r);let n=oGr(e);if(ll($Re(e))[0]===t)return n;let o=[...sGr(r),...n.filter(i=>!i.seeded)];return kM(e,o),Rl($Re(e),[t]),o}function cGr(e,t){let r=new URLSearchParams({path:e});return t&&r.set("node",t),Z2(`/api/pr-preview/image?${r}`)}function uGr(e,t,r){let[n,o]=(0,_M.useState)([]),i=(0,_M.useRef)(0),a=hr(),s=(0,_M.useRef)(r);return s.current=r,(0,_M.useEffect)(()=>{o(lGr(e,t,s.current).map(l=>({...l,url:cGr(l.path,a),id:i.current++})))},[e,t,a]),{screenshots:n,setScreenshots:o,nextId:i}}var dGr=S(oe(),1);function fGr(e,t){return(0,dGr.useCallback)((r,n)=>{t(o=>{let i=o.map(a=>a.id===r?{...a,...n}:a);return kM(e,i),i})},[e,t])}function pGr(e,t,r){let{screenshots:n,setScreenshots:o,nextId:i}=uGr(e,t,r),a=(0,FRe.useCallback)(d=>{o(f=>{let p=[...f,{...d,id:i.current++}];return kM(e,p),p})},[e,o,i]),s=(0,FRe.useCallback)(d=>{o(f=>{let p=f.find(m=>m.id===d);p?.url.startsWith("blob:")&&URL.revokeObjectURL(p.url);let h=f.filter(m=>m.id!==d);return kM(e,h),h})},[e,o]),l=fGr(e,o),u=(0,FRe.useCallback)(()=>iGr(e),[e]);return{screenshots:n,add:a,remove:s,update:l,clearPersisted:u}}var $q=S(oe(),1);async function hGr(e,t,r){let n=new URLSearchParams;t&&n.set("cwd",t),r&&n.set("node",r),e instanceof File&&e.name&&n.set("name",e.name);let o=await Wt(`/api/pr-preview/upload-image?${n}`,{method:"POST",headers:{"Content-Type":e.type||"application/octet-stream"},body:e,timeoutMs:12e4}),i=await o.json().catch(()=>null);if(!o.ok||!i?.path)throw new Error(i?.error??"Failed to attach file");return{path:i.path,alt:i.alt??"screenshot"}}var vGr=S(oe(),1);function mGr(e){return e.startsWith("image/")||e.startsWith("video/")}function gGr(e){if(!e)return null;for(let t of e.items)if(t.kind==="file"&&mGr(t.type)){let r=t.getAsFile();if(r)return r}return null}function yGr(e){return e?Array.from(e.files).find(t=>mGr(t.type))??null:null}function bGr(e,t){return(0,vGr.useEffect)(()=>{if(!t)return;let o=i=>{let a=gGr(i.clipboardData);a&&(i.preventDefault(),e(a))};return globalThis.addEventListener("paste",o),()=>globalThis.removeEventListener("paste",o)},[e,t]),t?{onDrop:o=>{let i=yGr(o.dataTransfer);i&&(o.preventDefault(),e(i))},onDragOver:o=>{Array.from(o.dataTransfer.items).some(i=>i.kind==="file")&&o.preventDefault()}}:{onDrop:void 0,onDragOver:void 0}}function xGr(e,t,r){let[n,o]=(0,$q.useState)([]),i=(0,$q.useRef)(0),a=hr(),s=(0,$q.useCallback)(async d=>{let f=i.current++;o(p=>[...p.filter(h=>!h.error),{id:f}]);try{let p=await hGr(d,e,a);t({...p,url:URL.createObjectURL(d),contentType:d.type}),o(h=>h.filter(m=>m.id!==f))}catch(p){let h=p instanceof Error?p.message:"Failed to attach file";o(m=>m.map(g=>g.id===f?{id:f,error:h}:g))}},[e,a,t]),{onDrop:l,onDragOver:u}=bGr(s,r);return{uploads:n,onDrop:l,onDragOver:u}}function SGr({cwd:e,screenshots:t,screenshotScope:r,requestId:n,seededScreenshots:o}){let{screenshots:i,add:a,remove:s,update:l,clearPersisted:u}=pGr(t?r:void 0,n,t?o:[]),{uploads:d,onDrop:f,onDragOver:p}=xGr(e,a,t);return{screenshots:i,removeScreenshot:s,updateScreenshot:l,decision:{attachments:()=>i.map(({path:h,alt:m,group:g})=>g?{path:h,alt:m,group:g}:{path:h,alt:m}),clearPersisted:u},uploads:d,onDrop:f,onDragOver:p}}var AGr=S(oe(),1);var TGr="assist:pr-preview-chain:",opt=e=>`${TGr}${e}`;function wGr(e){if(e)return ll(opt(e))[0]}function CGr(e,t){e&&Rl(opt(e),[t])}function kGr(e){e&&Rv(opt(e))}function _Gr(){_x(TGr)}function EGr(e,t,r){if(!e)return{reviewAfter:!1,announceAfter:!1,draft:!1,autoMerge:!1};_Gr();let n=wGr(t);return{reviewAfter:n?.reviewAfter??r.reviewAfter,announceAfter:n?.announceAfter??!0,draft:n?.draft??r.draft,autoMerge:n?.autoMerge??!1}}function RGr(e,t,r,n,o){return{comments:t,screenshots:n,reviewAfter:e&&r.reviewAfter,announceAfter:e&&r.announceAfter,draft:r.draft,autoMerge:e&&r.autoMerge,...o===void 0?{}:{body:o}}}function PGr(e,t){return!e||t===!1?{}:t===!0?{autostart:!0}:{autostart:!0,startOn:t}}function LGr(e,t,r,n,o,i,a){let[s,l]=(0,AGr.useState)(()=>EGr(n,t,o));return{chain:s,setChain:f=>{l(f),CGr(t,f)},onDecide:(f,p,h=!1)=>{let m=f==="approve";r(f,{...RGr(m,p,s,m?i.attachments():[],a()),...PGr(m,h)}),BRe(e),m&&(kGr(t),i.clearPersisted())}}}var HGr=S(oe(),1);var $9o=/^ {0,3}#{1,6}[ \t]+acceptance criteria[ \t]*$/i,F9o=/^ {0,3}#{1,6}[ \t]/;function c3(e){let t=e.split(`
|
|
4127
|
+
`),additions:ZUr(o,"+"),deletions:ZUr(o,"-"),split:{hunks:o.length,of:n.length,elsewhere:i}}}function JUr(e){return e.flatMap(t=>{if(t.kind==="dir")return JUr(t.children);let{kind:r,name:n,...o}=t;return[o]})}function r9o(e){let t=new Map;return e.forEach((r,n)=>{for(let o of r.hunks)t.set(o,[...t.get(o)??[],n+1])}),t}function eVr(e,t,r=new Set,n=new Set){let o=JUr(e.tree).filter(a=>!r.has(a.path)).map(a=>n.has(a.path)?{...a,critical:!0}:a),i=r9o(t);return t.map((a,s)=>{let l=new Set(a.hunks.map(_q));return jUr(o.filter(u=>l.has(u.path)).map(u=>QUr(u,s+1,i)))})}function n9o(e,t){let r=-1,n=0;return t.forEach((o,i)=>{let a=o.hunks.filter(s=>_q(s)===e).length;a>n&&(r=i,n=a)}),r}function tVr(e,t){let r=t.map(()=>[]);for(let n of e)r[n9o(n.path,t)]?.push(n);return r}function rVr(e,t){let r=eVr(e.structure,t,new Set(e.tests.map(i=>i.path)),new Set(e.criticalDiffs.map(i=>i.path))),n=tVr(e.tests,t),o=X5e(t);return t.map((i,a)=>{let s=a+1;return{number:s,slice:i,structure:r[a]??e.structure,tests:n[a]??[],critical:e.criticalDiffs.filter(l=>o.get(l.path)?.some(u=>u.number===s))}})}function nVr(e){if(!e.slices)return;let t=rVr(e,e.slices);return{entries:FUr(e,t),slicing:{count:t.length,noCritical:new Set(t.filter(r=>r.critical.length===0).map(r=>r.number))}}}function oVr(e){if(!(!e.repo||!e.headSha))return`${e.repo}#${e.prNumber}@${e.headSha}`}var Wft="assist:high-level-progress:",o9o=`${Wft}head:`,i9o=720*60*60*1e3,bae=e=>`${Wft}${e}`,Gft=e=>`${o9o}${e}`,Vft=e=>ll(e)[0];function a9o(e,t){let r=e?Vft(bae(e)):void 0;return e&&Rv(bae(e)),r??(t?Vft(Gft(t)):void 0)}function iVr(e,t,r){return _x(Wft,i9o),Vft(bae(e))??a9o(t,r)}function aVr(e,t,r){Rl(bae(e),[r]),t&&Rl(Gft(t),[r])}function sVr(e,t){Rv(bae(e)),t&&Rv(Gft(t))}function lVr(e){let t=e;return typeof t?.id=="string"&&typeof t.title=="string"&&typeof t.reason=="string"&&(t.kind==="deterministic"||t.kind==="manual")&&["pass","fail","manual"].includes(t.status)}function vM(e,t){return Array.isArray(e)?t?e.filter(t):e:[]}var Nq={repo:"",prNumber:0,headSha:"",checks:[],structure:{tree:[],added:0,removed:0,modified:0,additions:0,deletions:0},criticalDiffs:[],criticalPaths:[],tests:[],testPaths:[],collapsedPaths:[]};function cVr(e){let t;try{t=JSON.parse(e)}catch{return Nq}return typeof t!="object"||t===null?Nq:{repo:typeof t.repo=="string"?t.repo:Nq.repo,prNumber:typeof t.prNumber=="number"?t.prNumber:Nq.prNumber,headSha:typeof t.headSha=="string"?t.headSha:Nq.headSha,checks:vM(t.checks,lVr),structure:{...Nq.structure,...t.structure},criticalDiffs:vM(t.criticalDiffs),criticalPaths:vM(t.criticalPaths),tests:vM(t.tests),testPaths:vM(t.testPaths),collapsedPaths:vM(t.collapsedPaths),...Array.isArray(t.slices)?{slices:t.slices}:{},...t.manualTesting?{manualTesting:t.manualTesting}:{},...t.saved?{saved:t.saved}:{},...t.draft?{draft:t.draft}:{}}}function uVr(e){let t=(0,vRe.useMemo)(()=>cVr(e.body),[e.body]),r=(0,vRe.useMemo)(()=>nVr(t),[t]),n=oVr(t),o=(0,vRe.useMemo)(()=>iVr(e.requestId,e.supersedes,n)??t.draft??t.saved,[e.requestId,e.supersedes,n,t]);return{payload:t,sliced:r,progress:o,head:n}}var dVr=S(oe(),1);function fVr(e){let[t,r]=(0,dVr.useState)(()=>e?.reviewComments??[]);return{queued:t,onQueue:n=>r(o=>[...o,n]),onRemove:n=>r(o=>o.filter((i,a)=>a!==n)),onEdit:(n,o)=>r(i=>i.map((a,s)=>s===n?{...a,note:o}:a))}}var pVr=S(oe(),1);function hVr(e,t,r,n){(0,pVr.useEffect)(()=>{aVr(e,t,{items:r,reviewComments:n})},[e,t,r,n])}function gVr(e,t,r){let{payload:n,sliced:o,progress:i,head:a}=uVr(e),s=$Ur(n.checks,i,o?.slicing),l=fVr(i),u=RUr(o?.entries??[]),{comments:d,sentTo:f,clearSent:p}=L5e(t,r),h={...d,onQueue:l.onQueue};hVr(e.requestId,a,s.items,l.queued);let m=(0,mVr.useMemo)(()=>DUr(n),[n]);return{payload:n,checklist:s,queue:l,details:IUr(n,h),counts:m,sentTo:f,clearSent:p,sliced:o,nav:u,diffComments:h,head:a}}var uS=S(R(),1);function yVr({preview:e,session:t,sendInput:r,onDecision:n}){let o=gVr(e,t,r);return(0,uS.jsxs)(H,{sx:jy,children:[(0,uS.jsx)(Th,{preview:e,draft:!1}),(0,uS.jsx)(Dq,{items:e.metadata??[]}),(0,uS.jsx)(qn,{}),(0,uS.jsx)(pUr,{payload:o.payload,checklist:o.checklist,details:o.details,counts:o.counts,sliced:o.sliced,nav:o.nav,comments:o.diffComments}),(0,uS.jsx)(qn,{}),(0,uS.jsx)(_Ur,{pane:o,onDecision:(i,a)=>{sVr(e.requestId,o.head),n(i,a)}}),(0,uS.jsx)(Ay,{sessionName:o.sentTo,onClose:o.clearSent})]})}var kVr=S(oe(),1);var bM=S(R(),1);function s9o(e){return e.topLeft===null?"Click the top-left box":e.bottomRight===null?"Now click the bottom-right box":"Both anchors picked"}function vVr({selection:e,onConfirm:t,onReject:r}){let n=e.topLeft!==null&&e.bottomRight!==null;return(0,bM.jsxs)(St,{direction:"row",spacing:1,sx:{p:2,alignItems:"center",justifyContent:"flex-end"},children:[(0,bM.jsx)(Se,{variant:"body2",sx:{flex:1,color:"text.secondary"},children:s9o(e)}),(0,bM.jsx)(it,{color:"error",variant:"outlined",onClick:r,children:"Cancel"}),(0,bM.jsx)(it,{variant:"outlined",onClick:e.reset,children:"Start over"}),(0,bM.jsx)(it,{color:"success",variant:"contained",disabled:!n,onClick:t,children:"Extract boxes"})]})}var l9o={"top-left":tc.miro.topLeft,"bottom-right":tc.miro.bottomRight};function bVr(e,t){let r=e.right-e.left,n=e.bottom-e.top;return{width:r,height:n,fontSize:Math.max(6,Math.min(n*.3,r/6,28)),radius:Math.min(8,n/4),colour:t?l9o[t]:tc.miro.box,opacity:t?.75:.35,strokeWidth:Math.max(1,r*.004)}}var xae=S(R(),1);function xVr({box:e,role:t,onSelect:r}){let n=bVr(e,t);return(0,xae.jsxs)("g",{role:"button",tabIndex:0,"aria-label":t?`${e.text} (${t})`:e.text,onClick:()=>r(e.id),onKeyDown:o=>{o.key==="Enter"&&r(e.id)},style:{cursor:"pointer"},children:[(0,xae.jsx)("rect",{x:e.left,y:e.top,width:n.width,height:n.height,rx:n.radius,fill:n.colour,fillOpacity:n.opacity,stroke:n.colour,strokeWidth:n.strokeWidth}),(0,xae.jsx)("text",{x:e.left+n.width/2,y:e.top+n.height/2,textAnchor:"middle",dominantBaseline:"central",fontSize:n.fontSize,fill:tc.miro.text,children:e.text})]})}function SVr(e){if(e.length===0)return"0 0 100 100";let t=Math.min(...e.map(a=>a.left)),r=Math.min(...e.map(a=>a.top)),n=Math.max(...e.map(a=>a.right))-t,o=Math.max(...e.map(a=>a.bottom))-r,i=Math.max(n*.02,8);return`${t-i} ${r-i} ${n+i*2} ${o+i*2}`}var bRe=S(R(),1);function TVr({boxes:e,selection:t}){return(0,bRe.jsx)(H,{sx:{flex:1,minHeight:0,overflow:"auto",p:2},children:(0,bRe.jsx)("svg",{role:"img","aria-label":"Miro board boxes",viewBox:SVr(e),preserveAspectRatio:"xMidYMid meet",style:{width:"100%",height:"100%"},children:e.map(r=>(0,bRe.jsx)(xVr,{box:r,role:t.roleOf(r.id),onSelect:t.choose},r.id))})})}function c9o(e){return typeof e?.id=="string"&&typeof e.text=="string"&&[e.left,e.top,e.right,e.bottom].every(t=>typeof t=="number"&&Number.isFinite(t))}function wVr(e){try{let t=JSON.parse(e);return Array.isArray(t?.boxes)?t.boxes.filter(c9o):[]}catch{return[]}}var qft=S(oe(),1);function CVr(){let[e,t]=(0,qft.useState)(null),[r,n]=(0,qft.useState)(null);return{topLeft:e,bottomRight:r,choose:s=>{if(e===null||r!==null){t(s),n(null);return}n(s)},reset:()=>{t(null),n(null)},roleOf:s=>s===e?"top-left":s===r?"bottom-right":null}}var o3=S(R(),1);function _Vr({preview:e,onDecision:t}){let r=(0,kVr.useMemo)(()=>wVr(e.body),[e.body]),n=CVr();return(0,o3.jsxs)(H,{sx:jy,children:[(0,o3.jsx)(Th,{preview:e,draft:!1}),(0,o3.jsx)(qn,{}),(0,o3.jsx)(TVr,{boxes:r,selection:n}),(0,o3.jsx)(qn,{}),(0,o3.jsx)(vVr,{selection:n,onConfirm:()=>{let{topLeft:i,bottomRight:a}=n;i===null||a===null||t("approve",Fc({topLeft:i,bottomRight:a}))},onReject:()=>t("reject",Fc())})]})}var nWr=S(oe(),1);function EVr(e){let t=[];return e.map(r=>(t.length=r+1,t[r]=(t[r]??0)+1,t.map(n=>n??1).join(".")))}function xRe(e){return e*22}function RVr(e){return Math.round(e/22)}var PVr={display:"flex",alignItems:"flex-start",gap:.25,"& .criterion-action":{opacity:0,transition:"opacity 120ms"},"&:hover .criterion-action":{opacity:1},"&:focus-within .criterion-action":{opacity:1},"& .criterion-action:focus-visible":{opacity:1}},AVr={p:.25,mt:"2px",color:"text.disabled",cursor:"grab",touchAction:"none","&:active":{cursor:"grabbing"}},LVr={fontFamily:"fontFamilyMono",fontSize:"0.8rem",color:"text.secondary",minWidth:32,pt:"5px",textAlign:"right",userSelect:"none",whiteSpace:"nowrap"},IVr={flex:1,fontSize:"inherit",lineHeight:1.5,px:.75,py:0,borderRadius:1,"&:hover":{bgcolor:"action.hover"},"&.Mui-focused":{bgcolor:"action.selected"}},jft={p:.25,mt:"2px"},DVr={position:"absolute",right:8,height:2,borderRadius:1,bgcolor:"primary.main",pointerEvents:"none"};var NVr=S(R(),1),u9o=8;function MVr({drag:e}){return e?(0,NVr.jsx)(H,{sx:DVr,style:{top:e.top-1,left:u9o+xRe(e.depth)}}):null}var OVr=S(R(),1),BVr=ot((0,OVr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");var Yft=S(R(),1);function $Vr({number:e,onGrip:t}){return(0,Yft.jsx)(Ht,{size:"small",className:"criterion-action",sx:AVr,"aria-label":`Reorder criterion ${e}`,onPointerDown:t,children:(0,Yft.jsx)(BVr,{fontSize:"inherit"})})}var $C=S(R(),1);function FVr({number:e,onAdd:t,onDelete:r}){return(0,$C.jsxs)($C.Fragment,{children:[(0,$C.jsx)(Ht,{size:"small",className:"criterion-action",sx:jft,"aria-label":`Add criterion after ${e}`,onClick:t,children:(0,$C.jsx)(Wd,{fontSize:"inherit"})}),(0,$C.jsx)(Ht,{size:"small",className:"criterion-action",sx:jft,"aria-label":`Delete criterion ${e}`,onClick:r,children:(0,$C.jsx)(Bo,{fontSize:"inherit"})})]})}var SRe=S(oe(),1);function zVr(e,t){return e==="start"?0:e==="end"?t:Math.min(Math.max(e,0),t)}function HVr(e){let t=(0,SRe.useRef)(null);return(0,SRe.useEffect)(()=>{let r=t.current;if(!e||!r)return;r.focus();let n=zVr(e.caret,r.value.length);r.setSelectionRange(n,n)},[e]),t}var xM=S(R(),1);function UVr({index:e,number:t,item:r,outline:n,dragging:o,onGrip:i}){let a=HVr(n.focus?.index===e?n.focus:null),s={marginLeft:xRe(r.depth),opacity:o?.4:1};return(0,xM.jsxs)(H,{sx:PVr,"data-criterion-row":!0,style:s,children:[(0,xM.jsx)($Vr,{number:t,onGrip:i}),(0,xM.jsx)(H,{component:"span",sx:LVr,"aria-hidden":"true",children:`${t}.`}),(0,xM.jsx)(Bi,{multiline:!0,value:r.text,sx:IVr,inputRef:a,inputProps:{"aria-label":`Criterion ${t}`},onChange:l=>n.onText(e,l.target.value),onKeyDown:l=>n.onKeyDown(e,l)}),(0,xM.jsx)(FVr,{number:t,onAdd:()=>n.onAdd(e),onDelete:()=>n.onDelete(e)})]})}var KVr=S(oe(),1);function VVr(e,t,{key:r,shift:n,alt:o,caret:i,text:a}){return o||n?null:r==="ArrowUp"&&i===0&&t>0?{kind:"focus",index:t-1}:r==="ArrowDown"&&i===a.length&&t<e.length-1?{kind:"focus",index:t+1}:null}function i3(e){if(e.length===0)return[{text:"",depth:0}];let t=-1;return e.map(r=>{let n=Math.min(Math.max(r.depth,0),t+1);return t=n,r.depth===n?r:{...r,depth:n}})}function TRe(e,t,r,n){let o=e[t]?.depth??0,i=e.map((a,s)=>s===t?{...a,text:r}:a);return{items:i3([...i.slice(0,t+1),{text:n,depth:o},...i.slice(t+1)]),index:t+1}}function Zm(e,t){let r=t+1;for(;r<e.length&&e[r].depth>e[t].depth;)r+=1;return r}function wRe(e,t){let r=e[t].depth;for(let n=t-1;n>=0;n-=1){if(e[n].depth<r)return-1;if(e[n].depth===r)return n}return-1}function WVr(e,t){let r=Zm(e,t);return r<e.length&&e[r].depth===e[t].depth?r:-1}function GVr(e,t,r){let n=r<0?wRe(e,t):WVr(e,t);if(n<0)return null;let o=Zm(e,t),i=e.slice(t,o),a=[...e.slice(0,t),...e.slice(o)],s=r<0?n:Zm(e,n)-(o-t);return{items:[...a.slice(0,s),...i,...a.slice(s)],index:s}}function CRe(e,t){let r=Zm(e,t),n=e.map((o,i)=>i>t&&i<r?{...o,depth:o.depth-1}:o).filter((o,i)=>i!==t);return{items:i3(n),index:Math.max(0,t-1)}}function qVr(e,t,r){if(r<0&&e[t].depth===0||r>0&&wRe(e,t)<0)return null;let n=Zm(e,t);return e.map((o,i)=>i>=t&&i<n?{...o,depth:o.depth+r}:o)}function kRe(e,t){return e?{kind:"edit",edit:e,caret:t}:null}function d9o(e,t,{caret:r,text:n}){let o=n.slice(0,r);return kRe(TRe(e,t,o,n.slice(r)),"start")}function f9o(e,t,{shift:r,caret:n}){let o=qVr(e,t,r?-1:1);return kRe(o?{items:o,index:t}:null,n)}function jVr(e,t,r){let{key:n,shift:o,alt:i,caret:a,text:s}=r;return n==="Enter"&&!o?d9o(e,t,r):n==="Tab"?f9o(e,t,r):i&&(n==="ArrowUp"||n==="ArrowDown")?kRe(GVr(e,t,n==="ArrowUp"?-1:1),a):n==="Backspace"&&a===0&&s===""?kRe(CRe(e,t),"end"):null}function YVr(e,t,r){return jVr(e,t,r)??VVr(e,t,r)}function XVr(e,t){let[r,n]=(0,KVr.useState)(null),o=(a,s)=>{a&&(t(a.items),n({index:a.index,caret:s}))};return{focus:r,onKeyDown:(a,s)=>{let l=s.currentTarget;(s.key==="Enter"||s.key==="Tab")&&s.preventDefault();let u=YVr(e,a,{key:s.key,shift:s.shiftKey,alt:s.altKey,caret:l.selectionStart??0,text:l.value});u&&(s.preventDefault(),u.kind==="focus"?n({index:u.index,caret:"end"}):o(u.edit,u.caret))},onDrop:a=>o(a,"end"),onText:(a,s)=>t(e.map((l,u)=>u===a?{...l,text:s}:l)),onAdd:a=>o(TRe(e,a,e[a].text,""),"start"),onDelete:a=>o(CRe(e,a),"end")}}var tWr=S(oe(),1);function p9o(e,t,r,n){let o=t.length;for(let a=0;a<e.length;a+=1)if(n<e[a].top+e[a].height/2){o=a;break}let i=Zm(t,r);return o>r&&o<i?r:o}function h9o(e,t,r,n){let o=Zm(e,t),i=r-1,a=i>=t&&i<o?t-1:i,s=a>=0?e[a].depth+1:0;return Math.max(0,Math.min(e[t].depth+RVr(n),s))}function m9o(e,t){if(t<e.length)return e[t].top;let r=e[e.length-1];return r?r.top+r.height:0}function ZVr(e,t,r,n,o){let i=p9o(e,t,r,o);return{target:i,depth:h9o(t,r,i,n),top:m9o(e,i)}}function g9o(e){let t=e.getBoundingClientRect().top;return{boxes:Array.from(e.querySelectorAll("[data-criterion-row]")).map(n=>{let o=n.getBoundingClientRect();return{top:o.top-t,height:o.height}}),origin:t}}function QVr(e,t,r,n){return o=>{let{boxes:i,origin:a}=g9o(t);return ZVr(i,e,r,o.clientX-n,o.clientY-a)}}function JVr(e,t,r,n,o){let i=new AbortController,a=null,s=d=>{a=r(d),n(a)},l=()=>{i.abort(),a&&o(a)},u={signal:i.signal};return e.setPointerCapture(t),e.addEventListener("pointermove",s,u),e.addEventListener("pointerup",l,u),e.addEventListener("pointercancel",l,u),s}function eWr(e,t,r,n){let o=Zm(e,t),i=n-e[t].depth,a=e.slice(t,o).map(u=>({...u,depth:Math.max(0,u.depth+i)})),s=[...e.slice(0,t),...e.slice(o)],l=r>t?r-a.length:r;return{items:i3([...s.slice(0,l),...a,...s.slice(l)]),index:l}}function rWr(e,t,r){let[n,o]=(0,tWr.useState)(null);return{drag:n,onGrip:a=>s=>{let l=t.current;if(!l||s.pointerType==="mouse"&&s.button!==0)return;s.preventDefault(),JVr(s.currentTarget,s.pointerId,QVr(e,l,a,s.clientX),d=>o({from:a,depth:d.depth,top:d.top}),d=>{o(null),r(eWr(e,a,d.target,d.depth))})(s)}}}var Sae=S(R(),1),y9o={my:1,px:1,py:.5,border:1,borderColor:"divider",borderRadius:1,position:"relative",userSelect:"text",cursor:"auto"},v9o=[{text:"",depth:0}];function oWr({items:e,onChange:t}){let r=(0,nWr.useRef)(null),n=e.length>0?e:v9o,o=XVr(n,t),{drag:i,onGrip:a}=rWr(n,r,o.onDrop),s=EVr(n.map(l=>l.depth));return(0,Sae.jsxs)(H,{sx:y9o,ref:r,"data-preview-skip":!0,"aria-label":"Acceptance criteria",children:[n.map((l,u)=>(0,Sae.jsx)(UVr,{index:u,number:s[u],item:l,outline:o,dragging:i?.from===u,onGrip:a(u)},`criterion-${u}`)),(0,Sae.jsx)(MVr,{drag:i})]})}var iWr=S(R(),1),aWr=ot((0,iWr.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered");var Tae=S(R(),1),b9o={insert:"Add acceptance criteria",convert:"Convert to outline"};function sWr({kind:e,onClick:t}){return(0,Tae.jsx)(H,{sx:{my:1},"data-preview-skip":!0,children:(0,Tae.jsx)(it,{size:"small",variant:"outlined",startIcon:e==="insert"?(0,Tae.jsx)(Wd,{}):(0,Tae.jsx)(aWr,{}),onClick:t,children:b9o[e]})})}var wae=S(oe(),1);function lWr(e,t,{color:r,pin:n}){let o=qA(e),i=[],a=o.nextNode();for(;a;){let u=a;if(t.intersectsNode(u)){let d=u===t.startContainer?t.startOffset:0,f=u===t.endContainer?t.endOffset:u.length;d<f&&i.push({node:u,start:d,end:f})}a=o.nextNode()}let l=i.map(u=>x9o(u.node,u.start,u.end,r)).at(-1);l&&n&&(l.dataset.pin=n)}function x9o(e,t,r,n){let o=document.createRange();o.setStart(e,t),o.setEnd(e,r);let i=document.createElement("mark");return i.className="pr-comment",i.style.backgroundColor=n,o.surroundContents(i),i}function cWr(e){for(let t of e.querySelectorAll("mark.pr-comment"))if(t.parentNode){for(;t.firstChild;)t.before(t.firstChild);t.remove()}}function uWr(e,t){for(let r of t){let n=hLt(e,r);n&&lWr(e,n,r)}}var Cae=S(R(),1);function dWr({content:e,control:t,trailing:r,ranges:n,contentRef:o}){let i=(0,wae.useMemo)(()=>KI(e),[e]),a=(0,wae.useMemo)(()=>KI(r??""),[r]);return(0,wae.useLayoutEffect)(()=>{let s=o.current;s&&(cWr(s),uWr(s,n))},[i,a,n,o]),(0,Cae.jsxs)(H,{ref:o,children:[(0,Cae.jsx)(qI,{segments:i,skipDiagramText:!0}),t,t?(0,Cae.jsx)(qI,{segments:a,skipDiagramText:!0}):null]})}var SM=e=>e.split(",").map(t=>`&& .markdown ${t.trim()}`).join(", ");function _Re(e){let{color:t,radius:r}=e.tokens;return{px:2.5,py:2,fontSize:14,lineHeight:1.6,[SM("")]:{lineHeight:1.6},[SM("h1, h2, h3, h4, h5, h6")]:{fontSize:15,fontWeight:600,lineHeight:1.4,mt:2,mb:1},[SM("ul, ol")]:{pl:2.5,mb:2},[SM("li")]:{mb:"6px"},[SM("code")]:{fontFamily:e.typography.fontFamilyMono,fontSize:"0.86em",px:"5px",py:0,bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:"4px"},[SM("pre")]:{bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:`${r.sm}px`},[SM("pre code")]:{border:0,px:0,bgcolor:"transparent"}}}var fWr=e=>({flex:1,overflow:"auto",position:"relative",userSelect:"none",cursor:"text",wordBreak:"break-word","& .markdown":{...Xme(e),maxWidth:"none"},"& a":{color:"primary.main"},"& mark.pr-comment":{color:"inherit",borderRadius:"2px"},..._Re(e)});var Oq=S(R(),1);function pWr({content:e,control:t,trailing:r,ranges:n,wrapperRef:o,contentRef:i,dragRects:a,dragColor:s,onMouseDown:l,footer:u}){return(0,Oq.jsxs)(H,{ref:o,onMouseDown:l,sx:fWr,children:[(0,Oq.jsx)(dWr,{content:e,control:t,trailing:r,ranges:n,contentRef:i}),u&&(0,Oq.jsx)(H,{sx:{userSelect:"text"},children:u}),(0,Oq.jsx)(RB,{rects:a,color:s})]})}function hWr(e){let t=new Map,r=[];for(let n of e){if(!n.group){r.push(n);continue}t.set(n.group,[...t.get(n.group)??[],n])}return{groups:[...t],ungrouped:r}}var ERe=S(oe(),1),mWr=S(R(),1);function Kft({label:e,value:t,onCommit:r,listId:n}){let[o,i]=(0,ERe.useState)(t);return(0,ERe.useEffect)(()=>i(t),[t]),(0,mWr.jsx)(sn,{size:"small",variant:"standard",fullWidth:!0,label:e,value:o,onChange:s=>i(s.target.value),onBlur:()=>{let s=o.trim();i(t),s!==t&&r(s)},onKeyDown:s=>{s.key==="Enter"&&s.target.blur()},onMouseDown:s=>s.stopPropagation(),slotProps:{htmlInput:{list:n}}})}var kae=S(R(),1),Xft="screenshot-groups";function S9o(e){return(e.split(/[\\/]/).pop()??e).replace(/\.[^.]+$/,"")}function gWr({screenshot:e,onUpdate:t}){return(0,kae.jsxs)(St,{direction:"row",spacing:1,sx:{mt:.5},children:[(0,kae.jsx)(Kft,{label:"Caption",value:e.alt,onCommit:r=>t(e.id,{alt:r||S9o(e.path)})}),(0,kae.jsx)(Kft,{label:"Group",value:e.group??"",listId:Xft,onCommit:r=>t(e.id,{group:r})})]})}var a3=S(R(),1),yWr={display:"block",maxWidth:"100%",borderRadius:1,border:1,borderColor:"divider"},T9o={position:"absolute",top:4,right:4,bgcolor:"background.paper","&:hover":{bgcolor:"background.paper"}};function vWr({screenshot:e,onRemove:t,onUpdate:r}){let n=e.contentType.startsWith("video/");return(0,a3.jsxs)(H,{sx:{position:"relative"},children:[n?(0,a3.jsx)(H,{component:"video",controls:!0,src:e.url,"aria-label":"screenshot",sx:yWr}):(0,a3.jsx)(H,{component:"img",src:e.url,alt:"screenshot",sx:yWr}),(0,a3.jsx)(Ht,{size:"small","aria-label":"Remove screenshot",sx:T9o,onMouseDown:o=>o.stopPropagation(),onClick:()=>t(e.id),children:(0,a3.jsx)(Bo,{fontSize:"small"})}),(0,a3.jsx)(gWr,{screenshot:e,onUpdate:r})]})}var t0=S(R(),1);function w9o(){return(0,t0.jsxs)(St,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,t0.jsx)(oo,{size:16}),(0,t0.jsx)(Se,{variant:"caption",color:"text.secondary",children:"Attaching screenshot or video\u2026"})]})}function C9o({error:e}){return(0,t0.jsx)(Se,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:e})}function bWr({uploads:e,empty:t}){return e.length>0?(0,t0.jsx)(t0.Fragment,{children:e.map(r=>r.error?(0,t0.jsx)(C9o,{error:r.error},r.id):(0,t0.jsx)(w9o,{},r.id))}):t?(0,t0.jsx)(Se,{variant:"caption",color:"text.secondary",children:"Drop or paste an image or video to attach"}):null}var r0=S(R(),1),k9o={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:1};function xWr({screenshots:e,uploads:t,onRemove:r,onUpdate:n}){let{groups:o,ungrouped:i}=hWr(e),a=s=>(0,r0.jsx)(vWr,{screenshot:s,onRemove:r,onUpdate:n},s.id);return(0,r0.jsxs)(H,{sx:{mt:3},children:[e.length>0&&(0,r0.jsx)(H,{component:"h2",children:"Screenshots"}),(0,r0.jsx)("datalist",{id:Xft,children:o.map(([s])=>(0,r0.jsx)("option",{value:s},s))}),o.map(([s,l])=>(0,r0.jsxs)(H,{sx:{mb:2},children:[(0,r0.jsx)(H,{component:"h3",children:s}),(0,r0.jsx)(H,{sx:k9o,children:l.map(a)})]},s)),(0,r0.jsxs)(St,{spacing:1,children:[i.map(a),(0,r0.jsx)(bWr,{uploads:t,empty:e.length===0})]})]})}var _ae=S(R(),1);function _9o(e){let t=e.criteria;if(!t)return{content:e.body};let r={content:t.before,trailing:t.after};return t.kind==="outline"?{...r,control:(0,_ae.jsx)(oWr,{items:t.items,onChange:e.onCriteriaChange})}:{...r,control:(0,_ae.jsx)(sWr,{kind:t.kind,onClick:t.kind==="insert"?e.onCriteriaInsert:e.onCriteriaConvert})}}function RRe({pane:e,screenshots:t}){return(0,_ae.jsx)(pWr,{..._9o(e),ranges:e.ranges,wrapperRef:e.wrapperRef,contentRef:e.contentRef,dragRects:e.dragRects,dragColor:e.dragColor,onMouseDown:e.onMouseDown,footer:t?(0,_ae.jsx)(xWr,{screenshots:e.screenshots,uploads:e.uploads,onRemove:e.removeScreenshot,onUpdate:e.updateScreenshot}):void 0})}var SWr=e=>({display:"grid",gap:1,maxHeight:220,overflow:"auto",px:2,py:1.25,borderTop:1,borderColor:e.tokens.color.lineSoft}),TWr={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"text.secondary"},wWr=e=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:"4px 8px",px:1.25,py:1,borderRadius:`${e.tokens.radius.sm}px`,bgcolor:e.tokens.color.raised,border:1,borderColor:e.tokens.color.lineSoft,fontSize:12.5}),CWr={gridColumn:2,gridRow:1,width:20,height:20,color:"text.disabled","& .MuiSvgIcon-root":{fontSize:14}};var FC=S(R(),1);function kWr({comments:e,colors:t,onRemove:r}){return(0,FC.jsxs)(H,{sx:SWr,children:[(0,FC.jsxs)(Se,{sx:TWr,children:["Comments (",e.length,")"]}),e.map((n,o)=>(0,FC.jsxs)(H,{sx:wWr,children:[(0,FC.jsx)(CB,{text:n.quote,sx:{gridColumn:1,borderLeft:2,pl:1,borderColor:t[o]}}),(0,FC.jsx)(H,{sx:{gridColumn:1,wordBreak:"break-word"},children:n.note}),(0,FC.jsx)(Ht,{"aria-label":"Remove comment",onClick:()=>r(n.id),sx:CWr,children:(0,FC.jsx)(Bo,{})})]},n.id))]})}var EWr=S(R(),1);function _Wr(e){return e.comments.length===0?null:(0,EWr.jsx)(kWr,{...e})}var RWr=S(R(),1),PRe=ot((0,RWr.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"}),"Computer");var MWr=S(oe(),1);var PWr=S(R(),1),AWr=ot((0,PWr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var n0="0.1136.0";var E9o={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function LWr(e){return e?E9o[e]:"success.main"}function IWr(e){return e.split("-")[0].split(".").map(Number)}function DWr(e,t){if(!e||!t||e===t)return;let r=IWr(e),n=IWr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var ARe=S(oe(),1),Zft=(0,ARe.createContext)(null);function LRe(){return(0,ARe.useContext)(Zft)}var TM=S(R(),1),R9o={height:16,fontSize:10},P9o={opacity:.6,fontSize:"0.85em"};function A9o(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function s3({nodes:e,name:t,showVersion:r=!1}){let n=LRe()??n0,o=e.links.find(a=>a.name===t),i=DWr(o?.peerVersion,n);return(0,TM.jsx)(pr,{title:A9o(e,t),placement:"right",children:(0,TM.jsxs)(H,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,TM.jsx)(AWr,{sx:{fontSize:8,color:LWr(o?.state)}}),t,r&&o?.peerVersion&&(0,TM.jsxs)(H,{component:"span",sx:P9o,children:["v",o.peerVersion]}),i&&(0,TM.jsx)(Sn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:R9o})]})})}var o0=S(R(),1),L9o={textTransform:"none"};function IRe({nodes:e,options:t,target:r,onPick:n}){let[o,i]=(0,MWr.useState)(null);return(0,o0.jsxs)(o0.Fragment,{children:[(0,o0.jsx)(it,{size:"small",color:"inherit",startIcon:(0,o0.jsx)(PRe,{fontSize:"small"}),"aria-label":"Start on node","aria-haspopup":"menu",onClick:a=>i(a.currentTarget),sx:L9o,children:(0,o0.jsx)(s3,{nodes:e,name:r.node})}),(0,o0.jsx)($i,{anchorEl:o,open:!!o,onClose:()=>i(null),children:t.map(({name:a,cwd:s})=>(0,o0.jsx)(Hr,{disabled:!s,selected:a===r.node,onClick:()=>{n(a),i(null)},children:(0,o0.jsx)(Fu,{primary:(0,o0.jsx)(s3,{nodes:e,name:a}),secondary:s?void 0:"no clone"})},a))})]})}var NWr=S(oe(),1);function I9o(e,t){return e?.toLowerCase()===t.toLowerCase()}function DRe(e,t){let{nodes:r,names:n,visible:o}=cs(),{repos:i,selectedCwd:a,selectedNode:s,cloneOn:l,originOf:u}=In(),[d,f]=(0,NWr.useState)(),p=e&&u(e)?e:a,h=t?i.find(b=>I9o(u(b),t)):p,m=n.map(b=>({name:b,cwd:h?l(h,b):void 0})),g=b=>m.find(x=>x.name===b&&x.cwd),y=g(d)??g(s??r?.local)??m.find(b=>b.cwd),v=o&&y?.cwd?{node:y.name,cwd:y.cwd}:void 0;return{nodes:r,visible:o,options:m,target:v,pick:f}}var l3=S(R(),1);function OWr({canStart:e,startOrigin:t,cwd:r,onApprove:n,onApproveAndStart:o}){let i=ahe(),a=DRe(r,t);return(0,l3.jsxs)(l3.Fragment,{children:[(0,l3.jsx)(it,{color:"primary",variant:e?"tonal":"contained",onClick:n,...e?{}:i,children:"Approve"}),e&&a.nodes&&a.target&&(0,l3.jsx)(IRe,{nodes:a.nodes,options:a.options,target:a.target,onPick:a.pick}),e&&(0,l3.jsx)(it,{color:"primary",variant:"contained",onClick:()=>o(a.target),...i,children:"Approve & start"})]})}var Qft=S(R(),1),D9o={"& .MuiFormControlLabel-label":{fontSize:12}};function Eae({label:e,title:t,checked:r,onChange:n}){return(0,Qft.jsx)(Id,{control:(0,Qft.jsx)(Ep,{size:"small",checked:r,onChange:o=>n(o.target.checked)}),label:e,title:t,sx:D9o})}var wM=S(R(),1);function MRe({chain:e,newPr:t,onChange:r}){return(0,wM.jsxs)(St,{direction:"row",sx:{mr:"auto"},children:[t&&(0,wM.jsx)(Eae,{label:"Draft",title:"Create the PR as a draft rather than ready for review",checked:e.draft,onChange:n=>r({...e,draft:n,autoMerge:n?!1:e.autoMerge})}),(0,wM.jsx)(Eae,{label:"Auto-merge (squash)",title:"Squash-merge the PR automatically once its required checks pass",checked:e.autoMerge,onChange:n=>r({...e,autoMerge:n,draft:n?!1:e.draft})}),(0,wM.jsx)(Eae,{label:"Review PR",title:"After raising, run a review that posts its findings and then addresses them",checked:e.reviewAfter,onChange:n=>r({...e,reviewAfter:n})}),(0,wM.jsx)(Eae,{label:"Post to Slack",title:"Announce the PR in Slack at the tail of the chain",checked:e.announceAfter,onChange:n=>r({...e,announceAfter:n})})]})}var CM=S(R(),1);function BWr({commentCount:e,chain:t,newPr:r,canStart:n,startOrigin:o,onChainChange:i,onApprove:a,cwd:s,onApproveAndStart:l,onReject:u,onRequestChanges:d}){return(0,CM.jsxs)(St,{direction:"row",spacing:1,sx:{px:2,py:1.5,alignItems:"center",justifyContent:"flex-end"},children:[t&&(0,CM.jsx)(MRe,{chain:t,newPr:r,onChange:i}),(0,CM.jsx)(it,{color:"error",variant:"outlined",onClick:u,children:"Reject"}),e>0&&(0,CM.jsxs)(it,{color:"warning",variant:"tonal",onClick:d,children:["Request changes (",e,")"]}),(0,CM.jsx)(OWr,{canStart:n,startOrigin:o,cwd:s,onApprove:a,onApproveAndStart:l})]})}var FWr=S(R(),1);function $Wr({comments:e,cwd:t,onDecision:r,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s}){let l=()=>e.map(u=>({quote:u.quote,note:u.note}));return(0,FWr.jsx)(BWr,{commentCount:e.length,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s,onApprove:()=>r("approve",l()),cwd:t,onApproveAndStart:u=>r("approve",l(),u??!0),onReject:()=>r("reject",[]),onRequestChanges:()=>r("reject",l())})}var zC=S(R(),1);function zWr(e){let{comments:t,commentColors:r,pending:n,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onRemove:d,onCancel:f,onCollapse:p,editable:h}=e;return(0,zC.jsxs)(zC.Fragment,{children:[(0,zC.jsx)(_Wr,{comments:t,colors:r,onRemove:d}),(0,zC.jsx)(qn,{}),(0,zC.jsx)($Wr,{...e}),(0,zC.jsx)(yme,{pending:n,editable:h,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onCancel:f,onCollapse:p})]})}var Rae=S(R(),1),M9o={px:2,pb:2,display:"flex",alignItems:"center",gap:1.5,minWidth:0},N9o={color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function HWr({url:e}){return(0,Rae.jsxs)(H,{sx:M9o,children:[(0,Rae.jsx)(it,{variant:"contained",href:e,target:"_blank",rel:"noopener noreferrer",sx:{flexShrink:0},children:"Open design \u2197"}),(0,Rae.jsx)(Se,{variant:"body2",sx:N9o,title:e,children:e})]})}var Jft=S(R(),1);function UWr({preview:e}){let t=e.kind==="design"?e.metadata?.[0]?.url:void 0;return t?(0,Jft.jsx)(HWr,{url:t}):(0,Jft.jsx)(Dq,{items:e.metadata??[]})}function VWr({preview:e,pane:t,cwd:r,isPr:n,editable:o,sender:i,onCite:a,onAddRule:s}){return{comments:t.comments,commentColors:t.commentColors,pending:t.pending,cwd:r,unavailable:i.unavailable,onAdd:i.onSend,onQueue:t.onAdd,onCite:a,onAddRule:s,onRemove:t.remove,onCancel:t.onCancel,onCollapse:t.onCollapse,onDecision:t.onDecide,chain:n?t.chain:void 0,editable:o,newPr:n&&e.prNumber===null,canStart:e.kind==="backlog-item"&&e.canStart===!0,startOrigin:e.startOrigin,onChainChange:t.setChain}}function Bq(e){let t=e??"pr";return{isPr:t==="pr",screenshots:t==="pr"||t==="github-issue",editable:t==="github-issue-edit",closeOnly:t==="show"}}function WWr(e,t){return e?`${e}:${t??"pr"}`:void 0}function NRe(e,t,r,n){return{...Bq(e.kind),requestId:e.requestId,supersedes:e.supersedes,sessionId:t,cwd:r,onDecision:n,screenshotScope:WWr(t,e.kind),seededScreenshots:e.screenshots??[],chainDefaults:{draft:e.draft===!0,reviewAfter:e.reviewAfter??!0},initialBody:e.body}}function GWr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&cf(t,e,aCe({quote:r,note:o})),n()}}function qWr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&cf(t,e,kx(r,cme(o))),n()}}function ORe(e,t,r,n){return{onCite:qWr(e,t,r,n),onAddRule:GWr(e,t,r,n)}}function jWr(e){return{criteria:e.criteria,onCriteriaChange:e.writeCriteria,onCriteriaInsert:e.insertCriteria,onCriteriaConvert:e.convertCriteria}}var rGr=S(oe(),1);var HC=S(oe(),1);var YWr="assist:pr-preview-comments:",ept=e=>`${YWr}${e}`;function tpt(e){return ll(ept(e))}function Pae(e,t){Rl(ept(e),t)}function BRe(e){Rv(ept(e))}function KWr(){_x(YWr)}function XWr(e){let t=qA(e),r="";for(let n=t.nextNode();n;n=t.nextNode())r+=n.textContent??"";return r}function O9o(e,t,r){let n=-1;for(let o=e.indexOf(t);o!==-1;o=e.indexOf(t,o+1))(n===-1||Math.abs(o-r)<Math.abs(n-r))&&(n=o);return n}function ZWr(e,t){return e.flatMap(r=>{let n=O9o(t,r.quote,r.start);return n===-1?[]:[{...r,start:n,end:n+r.quote.length}]})}function QWr(e,t,r){let n=tpt(e);if(n.length>0||!t||!r)return n;let o=ZWr(tpt(t),XWr(r));return Pae(e,o),BRe(t),o}function JWr(e,t,r){let[n,o]=(0,HC.useState)([]),i=(0,HC.useRef)(0);(0,HC.useEffect)(()=>{KWr(),o(QWr(e,t,r.current).map(l=>({...l,id:i.current++})))},[e,t,r]);let a=(0,HC.useCallback)(l=>{o(u=>{let d=[...u,{...l,id:i.current++}];return Pae(e,d),d})},[e]),s=(0,HC.useCallback)(l=>{o(u=>{let d=u.filter(f=>f.id!==l);return Pae(e,d),d})},[e]);return{comments:n,add:a,remove:s}}function eGr(e,t){let r=e.map((i,a)=>lW(a).solid),n=lW(e.length).fill,o=e.map((i,a)=>({start:i.start,end:i.end,color:lW(a).fill,pin:String(a+1)}));return t&&o.push({start:t.start,end:t.end,color:n}),{commentColors:r,dragColor:n,ranges:o}}function tGr(e,t,r,n){return{onAdd:o=>{e&&t({quote:e.quote,note:o,start:e.start,end:e.end}),n()},onCollapse:()=>{e&&r(e.quote),n()}}}function nGr(e,t,r){let{wrapperRef:n,contentRef:o,pending:i,dragRects:a,onMouseDown:s,clear:l,select:u}=N5(),{comments:d,add:f,remove:p}=JWr(e,t,o),{commentColors:h,dragColor:m,ranges:g}=(0,rGr.useMemo)(()=>eGr(d,i),[d,i]),{onAdd:y,onCollapse:v}=tGr(i,f,r,l);return{wrapperRef:n,contentRef:o,onMouseDown:s,comments:d,commentColors:h,remove:p,pending:i,ranges:g,dragRects:a,dragColor:m,onAdd:y,onCollapse:v,onCancel:l,onSelect:u}}var FRe=S(oe(),1);var rpt="assist:preview-screenshots:",npt=e=>`${rpt}${e}`,$Re=e=>`${rpt}seeded:${e}`;function oGr(e){return e?(_x(rpt),ll(npt(e)).filter(t=>typeof t.path=="string")):[]}function kM(e,t){e&&Rl(npt(e),t.map(({path:r,alt:n,group:o,contentType:i,seeded:a})=>({path:r,alt:n,group:o,contentType:i,seeded:a})))}function iGr(e){e&&(Rv(npt(e)),Rv($Re(e)))}var _M=S(oe(),1);var aGr={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","video/mp4":"mp4","video/webm":"webm","video/quicktime":"mov"};function B9o(e){let t=e.split(".").pop()?.toLowerCase();return Object.entries(aGr).find(([,n])=>n===t)?.[0]??"application/octet-stream"}function sGr(e){return e.map(t=>({...t,contentType:B9o(t.path),seeded:!0}))}function lGr(e,t,r){if(!e)return sGr(r);let n=oGr(e);if(ll($Re(e))[0]===t)return n;let o=[...sGr(r),...n.filter(i=>!i.seeded)];return kM(e,o),Rl($Re(e),[t]),o}function cGr(e,t){let r=new URLSearchParams({path:e});return t&&r.set("node",t),Z2(`/api/pr-preview/image?${r}`)}function uGr(e,t,r){let[n,o]=(0,_M.useState)([]),i=(0,_M.useRef)(0),a=hr(),s=(0,_M.useRef)(r);return s.current=r,(0,_M.useEffect)(()=>{o(lGr(e,t,s.current).map(l=>({...l,url:cGr(l.path,a),id:i.current++})))},[e,t,a]),{screenshots:n,setScreenshots:o,nextId:i}}var dGr=S(oe(),1);function fGr(e,t){return(0,dGr.useCallback)((r,n)=>{t(o=>{let i=o.map(a=>a.id===r?{...a,...n}:a);return kM(e,i),i})},[e,t])}function pGr(e,t,r){let{screenshots:n,setScreenshots:o,nextId:i}=uGr(e,t,r),a=(0,FRe.useCallback)(d=>{o(f=>{let p=[...f,{...d,id:i.current++}];return kM(e,p),p})},[e,o,i]),s=(0,FRe.useCallback)(d=>{o(f=>{let p=f.find(m=>m.id===d);p?.url.startsWith("blob:")&&URL.revokeObjectURL(p.url);let h=f.filter(m=>m.id!==d);return kM(e,h),h})},[e,o]),l=fGr(e,o),u=(0,FRe.useCallback)(()=>iGr(e),[e]);return{screenshots:n,add:a,remove:s,update:l,clearPersisted:u}}var $q=S(oe(),1);async function hGr(e,t,r){let n=new URLSearchParams;t&&n.set("cwd",t),r&&n.set("node",r),e instanceof File&&e.name&&n.set("name",e.name);let o=await Wt(`/api/pr-preview/upload-image?${n}`,{method:"POST",headers:{"Content-Type":e.type||"application/octet-stream"},body:e,timeoutMs:12e4}),i=await o.json().catch(()=>null);if(!o.ok||!i?.path)throw new Error(i?.error??"Failed to attach file");return{path:i.path,alt:i.alt??"screenshot"}}var vGr=S(oe(),1);function mGr(e){return e.startsWith("image/")||e.startsWith("video/")}function gGr(e){if(!e)return null;for(let t of e.items)if(t.kind==="file"&&mGr(t.type)){let r=t.getAsFile();if(r)return r}return null}function yGr(e){return e?Array.from(e.files).find(t=>mGr(t.type))??null:null}function bGr(e,t){return(0,vGr.useEffect)(()=>{if(!t)return;let o=i=>{let a=gGr(i.clipboardData);a&&(i.preventDefault(),e(a))};return globalThis.addEventListener("paste",o),()=>globalThis.removeEventListener("paste",o)},[e,t]),t?{onDrop:o=>{let i=yGr(o.dataTransfer);i&&(o.preventDefault(),e(i))},onDragOver:o=>{Array.from(o.dataTransfer.items).some(i=>i.kind==="file")&&o.preventDefault()}}:{onDrop:void 0,onDragOver:void 0}}function xGr(e,t,r){let[n,o]=(0,$q.useState)([]),i=(0,$q.useRef)(0),a=hr(),s=(0,$q.useCallback)(async d=>{let f=i.current++;o(p=>[...p.filter(h=>!h.error),{id:f}]);try{let p=await hGr(d,e,a);t({...p,url:URL.createObjectURL(d),contentType:d.type}),o(h=>h.filter(m=>m.id!==f))}catch(p){let h=p instanceof Error?p.message:"Failed to attach file";o(m=>m.map(g=>g.id===f?{id:f,error:h}:g))}},[e,a,t]),{onDrop:l,onDragOver:u}=bGr(s,r);return{uploads:n,onDrop:l,onDragOver:u}}function SGr({cwd:e,screenshots:t,screenshotScope:r,requestId:n,seededScreenshots:o}){let{screenshots:i,add:a,remove:s,update:l,clearPersisted:u}=pGr(t?r:void 0,n,t?o:[]),{uploads:d,onDrop:f,onDragOver:p}=xGr(e,a,t);return{screenshots:i,removeScreenshot:s,updateScreenshot:l,decision:{attachments:()=>i.map(({path:h,alt:m,group:g})=>g?{path:h,alt:m,group:g}:{path:h,alt:m}),clearPersisted:u},uploads:d,onDrop:f,onDragOver:p}}var AGr=S(oe(),1);var TGr="assist:pr-preview-chain:",opt=e=>`${TGr}${e}`;function wGr(e){if(e)return ll(opt(e))[0]}function CGr(e,t){e&&Rl(opt(e),[t])}function kGr(e){e&&Rv(opt(e))}function _Gr(){_x(TGr)}function EGr(e,t,r){if(!e)return{reviewAfter:!1,announceAfter:!1,draft:!1,autoMerge:!1};_Gr();let n=wGr(t);return{reviewAfter:n?.reviewAfter??r.reviewAfter,announceAfter:n?.announceAfter??!0,draft:n?.draft??r.draft,autoMerge:n?.autoMerge??!1}}function RGr(e,t,r,n,o){return{comments:t,screenshots:n,reviewAfter:e&&r.reviewAfter,announceAfter:e&&r.announceAfter,draft:r.draft,autoMerge:e&&r.autoMerge,...o===void 0?{}:{body:o}}}function PGr(e,t){return!e||t===!1?{}:t===!0?{autostart:!0}:{autostart:!0,startOn:t}}function LGr(e,t,r,n,o,i,a){let[s,l]=(0,AGr.useState)(()=>EGr(n,t,o));return{chain:s,setChain:f=>{l(f),CGr(t,f)},onDecide:(f,p,h=!1)=>{let m=f==="approve";r(f,{...RGr(m,p,s,m?i.attachments():[],a()),...PGr(m,h)}),BRe(e),m&&(kGr(t),i.clearPersisted())}}}var HGr=S(oe(),1);var $9o=/^ {0,3}#{1,6}[ \t]+acceptance criteria[ \t]*$/i,F9o=/^ {0,3}#{1,6}[ \t]/;function c3(e){let t=e.split(`
|
|
4128
4128
|
`),r=t.findIndex(a=>$9o.test(a));if(r===-1)return null;let n=r+1;for(;n<t.length&&!F9o.test(t[n]);)n+=1;let o=r+1;for(;o<n&&t[o].trim()==="";)o+=1;let i=n;for(;i>o&&t[i-1].trim()==="";)i-=1;return o===n&&(o=r+1,i=r+1),{before:t.slice(0,o),lines:t.slice(o,i),after:t.slice(i)}}function zRe(e){let t=0;for(let r of e)t+=r===" "?4:1;return t}function HRe(e){let t=[];return e.map(r=>{for(;t.length>0&&r<t[t.length-1];)t.pop();return(t.length===0||r>t[t.length-1])&&t.push(r),t.length-1})}var z9o=" ";function H9o({text:e,depth:t}){let r=`${z9o.repeat(t)}1.`;return e===""?r:`${r} ${e}`}function URe(e,t){let r=c3(e);return r?[...r.before,...t.map(H9o),...r.after].join(`
|
|
4129
4129
|
`):e}var U9o=/^([ \t]*)(?:[-*+]|\d+[.)])(?:[ \t]+(.*))?$/,V9o=/^\[[ xX]\][ \t]*/;function W9o(e){return e.slice(0,e.length-e.trimStart().length)}function IGr(e){let t=c3(e);if(!t)return e;let r=t.lines.filter(o=>o.trim()!=="").map(o=>{let i=U9o.exec(o);return{width:zRe(i?i[1]:W9o(o)),text:(i?i[2]??"":o.trim()).replace(V9o,"")}}),n=HRe(r.map(o=>o.width));return URe(e,i3(r.map((o,i)=>({text:o.text,depth:n[i]}))))}var DGr=`## Acceptance criteria
|
|
4130
4130
|
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.1136.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5089,7 +5089,8 @@ async function commitBase(cwd, sha) {
|
|
|
5089
5089
|
async function resolveCommit(cwd, sha) {
|
|
5090
5090
|
const base = await commitBase(cwd, sha);
|
|
5091
5091
|
if (!base) return void 0;
|
|
5092
|
-
|
|
5092
|
+
const paths = await commitPaths(cwd, sha);
|
|
5093
|
+
return { base, paths: paths ?? [], pathsListed: paths !== void 0 };
|
|
5093
5094
|
}
|
|
5094
5095
|
async function commitExists(cwd, sha) {
|
|
5095
5096
|
try {
|
|
@@ -5124,8 +5125,28 @@ async function commitPaths(cwd, sha) {
|
|
|
5124
5125
|
]);
|
|
5125
5126
|
return output.split("\n").filter(Boolean);
|
|
5126
5127
|
} catch {
|
|
5127
|
-
return
|
|
5128
|
+
return void 0;
|
|
5129
|
+
}
|
|
5130
|
+
}
|
|
5131
|
+
|
|
5132
|
+
// src/commands/sessions/web/resolveCommitCached.ts
|
|
5133
|
+
var REVALIDATE_AFTER_MS = 10 * 6e4;
|
|
5134
|
+
var resolved = /* @__PURE__ */ new Map();
|
|
5135
|
+
async function resolveCommitCached(scope, cwd, sha) {
|
|
5136
|
+
const key = `${scope} ${sha}`;
|
|
5137
|
+
const known = resolved.get(key);
|
|
5138
|
+
if (known && known.expiresAt > Date.now()) return known.commit;
|
|
5139
|
+
const found = await resolveCommit(cwd, sha);
|
|
5140
|
+
if (found?.pathsListed) remember(key, found);
|
|
5141
|
+
else resolved.delete(key);
|
|
5142
|
+
return found;
|
|
5143
|
+
}
|
|
5144
|
+
function remember(key, commit2) {
|
|
5145
|
+
const now = Date.now();
|
|
5146
|
+
for (const [other, entry] of resolved) {
|
|
5147
|
+
if (entry.expiresAt <= now) resolved.delete(other);
|
|
5128
5148
|
}
|
|
5149
|
+
resolved.set(key, { commit: commit2, expiresAt: now + REVALIDATE_AFTER_MS });
|
|
5129
5150
|
}
|
|
5130
5151
|
|
|
5131
5152
|
// src/shared/harnessAdapters/harnessLabel.ts
|
|
@@ -5880,9 +5901,9 @@ var ASK_USER_QUESTION2 = "AskUserQuestion";
|
|
|
5880
5901
|
function hasPendingAskUserQuestion(events, idx) {
|
|
5881
5902
|
const ev = events[idx];
|
|
5882
5903
|
if (ev?.kind !== "assistant") return false;
|
|
5883
|
-
const
|
|
5904
|
+
const resolved2 = resolvedToolUseIds(events, idx);
|
|
5884
5905
|
return ev.toolUses.some(
|
|
5885
|
-
(tool) => tool.name === ASK_USER_QUESTION2 && !
|
|
5906
|
+
(tool) => tool.name === ASK_USER_QUESTION2 && !resolved2.has(tool.id)
|
|
5886
5907
|
);
|
|
5887
5908
|
}
|
|
5888
5909
|
function resolvedToolUseIds(events, afterIdx) {
|
|
@@ -7821,6 +7842,14 @@ var claudeSdkAdapter = {
|
|
|
7821
7842
|
})
|
|
7822
7843
|
};
|
|
7823
7844
|
|
|
7845
|
+
// src/shared/resolveCodexModel.ts
|
|
7846
|
+
var CODEX_DEFAULT_MODEL = "codex-default";
|
|
7847
|
+
function resolveCodexModel(raw) {
|
|
7848
|
+
const model = raw?.trim();
|
|
7849
|
+
if (!model || model === CODEX_DEFAULT_MODEL) return void 0;
|
|
7850
|
+
return model;
|
|
7851
|
+
}
|
|
7852
|
+
|
|
7824
7853
|
// src/commands/litellm/buildCodexProviderArgs.ts
|
|
7825
7854
|
var API_KEY_ENV = "ASSIST_LITELLM_API_KEY";
|
|
7826
7855
|
function buildCodexProviderArgs(responsesBaseUrl, apiKey, model) {
|
|
@@ -7859,7 +7888,7 @@ function readLitellmConfig() {
|
|
|
7859
7888
|
|
|
7860
7889
|
// src/commands/litellm/buildLitellmCodexArgs.ts
|
|
7861
7890
|
function buildLitellmCodexArgs(rawModel) {
|
|
7862
|
-
const model = rawModel
|
|
7891
|
+
const model = resolveCodexModel(rawModel);
|
|
7863
7892
|
if (!model) return { args: [], env: {} };
|
|
7864
7893
|
const { config } = readLitellmConfig();
|
|
7865
7894
|
if (!config) return { args: [], env: {} };
|
|
@@ -9485,22 +9514,22 @@ async function committedPaths(cwd, session) {
|
|
|
9485
9514
|
if (cached3 && cached3.expiresAt > Date.now()) return cached3.value;
|
|
9486
9515
|
const pending = inFlight.get(key);
|
|
9487
9516
|
if (pending) return pending;
|
|
9488
|
-
const lookup = loadCommittedPaths(cwd, session).then((value) => {
|
|
9517
|
+
const lookup = loadCommittedPaths(key, cwd, session).then((value) => {
|
|
9489
9518
|
cache.set(key, { value, expiresAt: Date.now() + CACHE_TTL_MS });
|
|
9490
9519
|
return value;
|
|
9491
9520
|
}).finally(() => inFlight.delete(key));
|
|
9492
9521
|
inFlight.set(key, lookup);
|
|
9493
9522
|
return lookup;
|
|
9494
9523
|
}
|
|
9495
|
-
async function loadCommittedPaths(cwd, session) {
|
|
9524
|
+
async function loadCommittedPaths(key, cwd, session) {
|
|
9496
9525
|
const itemCommitRefs = await itemCommits(session.conversationId);
|
|
9497
9526
|
const commits2 = itemCommitRefs.length > 0 ? itemCommitRefs : await transcriptCommits(cwd, session);
|
|
9498
9527
|
const bases = /* @__PURE__ */ new Map();
|
|
9499
9528
|
for (const commit2 of commits2) {
|
|
9500
|
-
const
|
|
9501
|
-
if (!
|
|
9502
|
-
for (const path128 of
|
|
9503
|
-
if (!bases.has(path128)) bases.set(path128,
|
|
9529
|
+
const resolved2 = await resolveCommitCached(key, cwd, commit2.sha);
|
|
9530
|
+
if (!resolved2) continue;
|
|
9531
|
+
for (const path128 of resolved2.paths) {
|
|
9532
|
+
if (!bases.has(path128)) bases.set(path128, resolved2.base);
|
|
9504
9533
|
}
|
|
9505
9534
|
}
|
|
9506
9535
|
return { commits: commits2, bases };
|
|
@@ -9857,17 +9886,17 @@ function getFileTarget(req, res) {
|
|
|
9857
9886
|
|
|
9858
9887
|
// src/commands/sessions/web/fileContent.ts
|
|
9859
9888
|
async function fileContent(req, res) {
|
|
9860
|
-
const
|
|
9861
|
-
if (!
|
|
9889
|
+
const resolved2 = getFileTarget(req, res);
|
|
9890
|
+
if (!resolved2) return;
|
|
9862
9891
|
const commit2 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
9863
9892
|
"commit"
|
|
9864
9893
|
);
|
|
9865
9894
|
if (commit2) {
|
|
9866
|
-
await respondCommitFile(req, res,
|
|
9895
|
+
await respondCommitFile(req, res, resolved2, commit2);
|
|
9867
9896
|
return;
|
|
9868
9897
|
}
|
|
9869
9898
|
try {
|
|
9870
|
-
const info = await stat(
|
|
9899
|
+
const info = await stat(resolved2.target);
|
|
9871
9900
|
if (!info.isFile()) {
|
|
9872
9901
|
respondJson(res, 404, { error: "File not found" });
|
|
9873
9902
|
return;
|
|
@@ -9877,7 +9906,7 @@ async function fileContent(req, res) {
|
|
|
9877
9906
|
return;
|
|
9878
9907
|
}
|
|
9879
9908
|
respondJson(res, 200, {
|
|
9880
|
-
content: await readFile(
|
|
9909
|
+
content: await readFile(resolved2.target, "utf8"),
|
|
9881
9910
|
mtimeMs: info.mtimeMs
|
|
9882
9911
|
});
|
|
9883
9912
|
} catch {
|
|
@@ -10960,7 +10989,7 @@ var harnessConfigHelp = [
|
|
|
10960
10989
|
{
|
|
10961
10990
|
key: "harness.codexModel",
|
|
10962
10991
|
setter: "assist config set harness.codexModel <model>",
|
|
10963
|
-
note: "
|
|
10992
|
+
note: "a value routes non-review Codex launches through the LiteLLM proxy with that model (needs litellm.baseUrl and litellm.apiKey); unset, empty or codex-default uses codex's own configured provider and model, and codex-default overrides a value inherited from user or global config"
|
|
10964
10993
|
}
|
|
10965
10994
|
];
|
|
10966
10995
|
|
|
@@ -11314,7 +11343,7 @@ var reviewConfigHelp = [
|
|
|
11314
11343
|
{
|
|
11315
11344
|
key: "review.codexModel",
|
|
11316
11345
|
setter: "assist config set review.codexModel gpt-5-codex",
|
|
11317
|
-
note: "optional; runs the codex reviewer on this model via the LiteLLM proxy (needs litellm.baseUrl and litellm.apiKey)"
|
|
11346
|
+
note: "optional; runs the codex reviewer on this model via the LiteLLM proxy (needs litellm.baseUrl and litellm.apiKey); codex-default runs it on codex's own configured model, overriding a value inherited from user or global config"
|
|
11318
11347
|
},
|
|
11319
11348
|
{
|
|
11320
11349
|
key: "review.synthesisHarness",
|
|
@@ -11853,11 +11882,11 @@ function ensureObject(container, key) {
|
|
|
11853
11882
|
return obj;
|
|
11854
11883
|
}
|
|
11855
11884
|
function stepIntoNested(container, key, nextKey) {
|
|
11856
|
-
const
|
|
11885
|
+
const resolved2 = resolveKey(key);
|
|
11857
11886
|
if (nextKey !== void 0 && isNumericKey(nextKey)) {
|
|
11858
|
-
return ensureArray(container,
|
|
11887
|
+
return ensureArray(container, resolved2);
|
|
11859
11888
|
}
|
|
11860
|
-
return ensureObject(container,
|
|
11889
|
+
return ensureObject(container, resolved2);
|
|
11861
11890
|
}
|
|
11862
11891
|
function setNestedValue(obj, path128, value) {
|
|
11863
11892
|
const keys = path128.split(".");
|
|
@@ -11990,12 +12019,12 @@ function assertNoDuplicateRunNames(configs) {
|
|
|
11990
12019
|
import { existsSync as existsSync24 } from "fs";
|
|
11991
12020
|
import { join as join31, resolve as resolve5 } from "path";
|
|
11992
12021
|
function findLinkedConfigPath(linkPath, fromDir) {
|
|
11993
|
-
const
|
|
11994
|
-
const claudePath = join31(
|
|
12022
|
+
const resolved2 = resolve5(fromDir, linkPath);
|
|
12023
|
+
const claudePath = join31(resolved2, ".claude", "assist.yml");
|
|
11995
12024
|
if (existsSync24(claudePath)) return claudePath;
|
|
11996
|
-
const rootPath = join31(
|
|
12025
|
+
const rootPath = join31(resolved2, "assist.yml");
|
|
11997
12026
|
if (existsSync24(rootPath)) return rootPath;
|
|
11998
|
-
throw new Error(`No assist.yml found in linked project: ${
|
|
12027
|
+
throw new Error(`No assist.yml found in linked project: ${resolved2}`);
|
|
11999
12028
|
}
|
|
12000
12029
|
|
|
12001
12030
|
// src/shared/loadLinkedEntries.ts
|
|
@@ -13883,7 +13912,7 @@ var linkStateCache = {
|
|
|
13883
13912
|
// src/commands/sessions/web/linkStatus/fetchLinkStateChunks.ts
|
|
13884
13913
|
var CHUNK_SIZE = 100;
|
|
13885
13914
|
async function fetchLinkStateChunks(refs, query2) {
|
|
13886
|
-
const
|
|
13915
|
+
const resolved2 = /* @__PURE__ */ new Map();
|
|
13887
13916
|
for (let start2 = 0; start2 < refs.length; start2 += CHUNK_SIZE) {
|
|
13888
13917
|
const chunk2 = refs.slice(start2, start2 + CHUNK_SIZE);
|
|
13889
13918
|
const states2 = await query2(chunk2).catch(() => void 0);
|
|
@@ -13891,11 +13920,11 @@ async function fetchLinkStateChunks(refs, query2) {
|
|
|
13891
13920
|
chunk2.forEach((ref, i) => {
|
|
13892
13921
|
const key = linkRefKey(ref);
|
|
13893
13922
|
const state = states2[i] ?? null;
|
|
13894
|
-
|
|
13923
|
+
resolved2.set(key, state);
|
|
13895
13924
|
linkStateCache.set(key, state);
|
|
13896
13925
|
});
|
|
13897
13926
|
}
|
|
13898
|
-
return
|
|
13927
|
+
return resolved2;
|
|
13899
13928
|
}
|
|
13900
13929
|
|
|
13901
13930
|
// src/commands/sessions/web/linkStatus/queryLinkStates.ts
|
|
@@ -13971,7 +14000,7 @@ function startFetch(refs, query2) {
|
|
|
13971
14000
|
const batch = fetchLinkStateChunks(refs, query2);
|
|
13972
14001
|
for (const ref of refs) {
|
|
13973
14002
|
const key = linkRefKey(ref);
|
|
13974
|
-
const pending = batch.then((
|
|
14003
|
+
const pending = batch.then((resolved2) => resolved2.get(key) ?? null);
|
|
13975
14004
|
inFlight2.set(key, pending);
|
|
13976
14005
|
void pending.finally(() => {
|
|
13977
14006
|
if (inFlight2.get(key) === pending) inFlight2.delete(key);
|
|
@@ -15046,8 +15075,8 @@ function parseRulesSection(content) {
|
|
|
15046
15075
|
import { existsSync as existsSync27, statSync as statSync9 } from "fs";
|
|
15047
15076
|
import path20 from "path";
|
|
15048
15077
|
function scopeDirectory(target) {
|
|
15049
|
-
const
|
|
15050
|
-
return existsSync27(
|
|
15078
|
+
const resolved2 = path20.resolve(target);
|
|
15079
|
+
return existsSync27(resolved2) && statSync9(resolved2).isDirectory() ? resolved2 : path20.dirname(resolved2);
|
|
15051
15080
|
}
|
|
15052
15081
|
|
|
15053
15082
|
// src/commands/rules/readScopedRules.ts
|
|
@@ -16472,11 +16501,11 @@ async function revertPathChanges(cwd, path128) {
|
|
|
16472
16501
|
|
|
16473
16502
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
16474
16503
|
async function revertDiffFile(req, res) {
|
|
16475
|
-
const
|
|
16476
|
-
if (!
|
|
16477
|
-
const path128 = relative5(repoRoot2(
|
|
16504
|
+
const resolved2 = getFileTarget(req, res);
|
|
16505
|
+
if (!resolved2) return;
|
|
16506
|
+
const path128 = relative5(repoRoot2(resolved2.cwd), resolved2.target);
|
|
16478
16507
|
try {
|
|
16479
|
-
await revertPathChanges(
|
|
16508
|
+
await revertPathChanges(resolved2.cwd, path128);
|
|
16480
16509
|
respondJson(res, 200, { reverted: path128 });
|
|
16481
16510
|
} catch (error) {
|
|
16482
16511
|
respondJson(res, 500, {
|
|
@@ -16683,12 +16712,12 @@ function newSessionDefaults(req, res) {
|
|
|
16683
16712
|
});
|
|
16684
16713
|
return;
|
|
16685
16714
|
}
|
|
16686
|
-
const
|
|
16687
|
-
if ("error" in
|
|
16688
|
-
respondJson(res, 422, { error: `Invalid config ${
|
|
16715
|
+
const resolved2 = resolveDialogHarnesses(raw);
|
|
16716
|
+
if ("error" in resolved2) {
|
|
16717
|
+
respondJson(res, 422, { error: `Invalid config ${resolved2.error}` });
|
|
16689
16718
|
return;
|
|
16690
16719
|
}
|
|
16691
|
-
respondJson(res, 200, { mode: parsed.data, ...
|
|
16720
|
+
respondJson(res, 200, { mode: parsed.data, ...resolved2 });
|
|
16692
16721
|
}
|
|
16693
16722
|
|
|
16694
16723
|
// src/commands/sessions/nodes/fetchPeerJson.ts
|
|
@@ -19042,20 +19071,20 @@ async function currentMtimeMs(target) {
|
|
|
19042
19071
|
}
|
|
19043
19072
|
}
|
|
19044
19073
|
async function writeFileContent(req, res) {
|
|
19045
|
-
const
|
|
19046
|
-
if (!
|
|
19074
|
+
const resolved2 = getFileTarget(req, res);
|
|
19075
|
+
if (!resolved2) return;
|
|
19047
19076
|
const body = await getFileWriteBody(req, res);
|
|
19048
19077
|
if (!body) return;
|
|
19049
|
-
if (await currentMtimeMs(
|
|
19078
|
+
if (await currentMtimeMs(resolved2.target) !== body.mtimeMs) {
|
|
19050
19079
|
respondJson(res, 409, { error: STALE_MESSAGE });
|
|
19051
19080
|
return;
|
|
19052
19081
|
}
|
|
19053
19082
|
try {
|
|
19054
|
-
await writeFile2(
|
|
19055
|
-
await formatWithOxfmt(
|
|
19083
|
+
await writeFile2(resolved2.target, body.content, "utf8");
|
|
19084
|
+
await formatWithOxfmt(resolved2.target, repoRoot2(resolved2.cwd));
|
|
19056
19085
|
respondJson(res, 200, {
|
|
19057
|
-
content: await readFile3(
|
|
19058
|
-
mtimeMs: await currentMtimeMs(
|
|
19086
|
+
content: await readFile3(resolved2.target, "utf8"),
|
|
19087
|
+
mtimeMs: await currentMtimeMs(resolved2.target)
|
|
19059
19088
|
});
|
|
19060
19089
|
} catch (error) {
|
|
19061
19090
|
respondJson(res, 500, {
|
|
@@ -19105,8 +19134,8 @@ function createCssHandler(packageEntry) {
|
|
|
19105
19134
|
let cache7;
|
|
19106
19135
|
return (req, res) => {
|
|
19107
19136
|
if (!cache7) {
|
|
19108
|
-
const
|
|
19109
|
-
const body = readFileSync20(
|
|
19137
|
+
const resolved2 = require3.resolve(packageEntry);
|
|
19138
|
+
const body = readFileSync20(resolved2, "utf8");
|
|
19110
19139
|
const etag = `"${createHash3("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
19111
19140
|
cache7 = { body, etag };
|
|
19112
19141
|
}
|
|
@@ -19729,9 +19758,9 @@ function originResolutionForCwd(cwd) {
|
|
|
19729
19758
|
if (!cwd) return void 0;
|
|
19730
19759
|
const cached3 = cache5.get(cwd);
|
|
19731
19760
|
if (cached3 !== void 0) return { origin: cached3, stable: true };
|
|
19732
|
-
const
|
|
19733
|
-
if (
|
|
19734
|
-
return
|
|
19761
|
+
const resolved2 = resolveCurrentOrigin(cwd);
|
|
19762
|
+
if (resolved2.stable) cache5.set(cwd, resolved2.origin);
|
|
19763
|
+
return resolved2;
|
|
19735
19764
|
}
|
|
19736
19765
|
function originForCwd(cwd) {
|
|
19737
19766
|
return originResolutionForCwd(cwd)?.origin;
|
|
@@ -24735,9 +24764,9 @@ function fail5(message4) {
|
|
|
24735
24764
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
24736
24765
|
const newOrigin = newOriginRaw ? normalizeOrigin(newOriginRaw) : getOrigin();
|
|
24737
24766
|
const { orm } = await getReady();
|
|
24738
|
-
const
|
|
24739
|
-
if ("error" in
|
|
24740
|
-
const oldOrigin =
|
|
24767
|
+
const resolved2 = await resolveOldOrigin(orm, normalizeOrigin(oldOriginRaw));
|
|
24768
|
+
if ("error" in resolved2) return fail5(resolved2.error);
|
|
24769
|
+
const oldOrigin = resolved2.origin;
|
|
24741
24770
|
if (oldOrigin === newOrigin) {
|
|
24742
24771
|
return fail5(
|
|
24743
24772
|
`Old and new origins both resolve to "${oldOrigin}"; nothing to move.`
|
|
@@ -27058,13 +27087,13 @@ async function updatePhase(id, phase, options2) {
|
|
|
27058
27087
|
const found = await findPhase(id, phase);
|
|
27059
27088
|
if (!found) return;
|
|
27060
27089
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
27061
|
-
const
|
|
27062
|
-
if (!
|
|
27063
|
-
console.log(chalk106.red(
|
|
27090
|
+
const resolved2 = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
27091
|
+
if (!resolved2.ok) {
|
|
27092
|
+
console.log(chalk106.red(resolved2.error));
|
|
27064
27093
|
process.exitCode = 1;
|
|
27065
27094
|
return;
|
|
27066
27095
|
}
|
|
27067
|
-
const { name: name2, task, manualCheck } =
|
|
27096
|
+
const { name: name2, task, manualCheck } = resolved2.fields;
|
|
27068
27097
|
await applyPhaseUpdate(orm, itemId2, phaseIdx, { name: name2, task, manualCheck });
|
|
27069
27098
|
const fields = [
|
|
27070
27099
|
name2 && "name",
|
|
@@ -28748,8 +28777,8 @@ function isCdToCwd(command) {
|
|
|
28748
28777
|
const parts2 = command.split(/\s+/);
|
|
28749
28778
|
if (parts2[0] !== "cd" || parts2.length > 2) return false;
|
|
28750
28779
|
if (parts2.length === 1) return false;
|
|
28751
|
-
const
|
|
28752
|
-
return
|
|
28780
|
+
const resolved2 = resolve19(normalizeMsysPath(parts2[1]));
|
|
28781
|
+
return resolved2 === resolve19(process.cwd());
|
|
28753
28782
|
}
|
|
28754
28783
|
function isCdToReadAllowedDir(command) {
|
|
28755
28784
|
const parts2 = command.split(/\s+/);
|
|
@@ -28760,8 +28789,8 @@ function isCdToReadAllowedDir(command) {
|
|
|
28760
28789
|
if (!m) continue;
|
|
28761
28790
|
const base = globBaseDir(m[1]);
|
|
28762
28791
|
if (!base) continue;
|
|
28763
|
-
const
|
|
28764
|
-
if (target ===
|
|
28792
|
+
const resolved2 = resolve19(normalizeMsysPath(base));
|
|
28793
|
+
if (target === resolved2 || target.startsWith(resolved2 + sep3)) {
|
|
28765
28794
|
return `cd to Read-allowed directory: ${entry}`;
|
|
28766
28795
|
}
|
|
28767
28796
|
}
|
|
@@ -29391,7 +29420,7 @@ async function discoverAll(cli, prefixPath = []) {
|
|
|
29391
29420
|
const p = { done: 0, total: topLevel.length };
|
|
29392
29421
|
const results = await mapAsync(topLevel, CONCURRENCY, async (cmd) => {
|
|
29393
29422
|
showProgress(p, cmd.name);
|
|
29394
|
-
const
|
|
29423
|
+
const resolved2 = await resolveCommand2(
|
|
29395
29424
|
cli,
|
|
29396
29425
|
[...prefixPath, cmd.name],
|
|
29397
29426
|
cmd.description,
|
|
@@ -29400,7 +29429,7 @@ async function discoverAll(cli, prefixPath = []) {
|
|
|
29400
29429
|
);
|
|
29401
29430
|
p.done++;
|
|
29402
29431
|
showProgress(p, cmd.name);
|
|
29403
|
-
return
|
|
29432
|
+
return resolved2;
|
|
29404
29433
|
});
|
|
29405
29434
|
if (interactive) process.stderr.write("\r\x1B[K");
|
|
29406
29435
|
return results.flat();
|
|
@@ -32006,19 +32035,19 @@ function scopeOptionsError(options2) {
|
|
|
32006
32035
|
async function configSet(key, value, options2 = {}) {
|
|
32007
32036
|
const scopeError = scopeOptionsError(options2);
|
|
32008
32037
|
if (scopeError) exitWithConfigErrors([scopeError]);
|
|
32009
|
-
const
|
|
32010
|
-
if (
|
|
32011
|
-
console.error(chalk148.red(`Missing required argument for '${
|
|
32038
|
+
const resolved2 = resolveRepoTarget(key, value, options2.repo);
|
|
32039
|
+
if (resolved2.value === void 0) {
|
|
32040
|
+
console.error(chalk148.red(`Missing required argument for '${resolved2.key}'`));
|
|
32012
32041
|
process.exit(1);
|
|
32013
32042
|
}
|
|
32014
|
-
const coercion = coerceCliConfigValue(
|
|
32043
|
+
const coercion = coerceCliConfigValue(resolved2.key, resolved2.value);
|
|
32015
32044
|
if (!coercion.ok) exitWithConfigErrors([coercion.error]);
|
|
32016
|
-
if (isDbBackedConfigKey(
|
|
32017
|
-
return setDbBackedConfigKey(
|
|
32045
|
+
if (isDbBackedConfigKey(resolved2.key))
|
|
32046
|
+
return setDbBackedConfigKey(resolved2.key, coercion.value, resolved2.useRepo);
|
|
32018
32047
|
await setFileConfigKey(
|
|
32019
32048
|
{
|
|
32020
|
-
...
|
|
32021
|
-
node: defaultsToNode(
|
|
32049
|
+
...resolved2,
|
|
32050
|
+
node: defaultsToNode(resolved2.key, options2),
|
|
32022
32051
|
user: options2.user ?? false
|
|
32023
32052
|
},
|
|
32024
32053
|
coercion.value
|
|
@@ -32075,19 +32104,19 @@ function targetLabel(result) {
|
|
|
32075
32104
|
async function configUnset(key, options2 = {}) {
|
|
32076
32105
|
const scopeError = scopeOptionsError(options2);
|
|
32077
32106
|
if (scopeError) exitWithConfigErrors([scopeError]);
|
|
32078
|
-
const
|
|
32079
|
-
if (
|
|
32107
|
+
const resolved2 = resolveRepoUnsetTarget(key, options2.repo);
|
|
32108
|
+
if (resolved2.key === void 0) {
|
|
32080
32109
|
console.error(chalk151.red("Missing required argument 'key'"));
|
|
32081
32110
|
process.exit(1);
|
|
32082
32111
|
return;
|
|
32083
32112
|
}
|
|
32084
|
-
if (isDbBackedConfigKey(
|
|
32085
|
-
return unsetDbBackedConfigKey(
|
|
32113
|
+
if (isDbBackedConfigKey(resolved2.key))
|
|
32114
|
+
return unsetDbBackedConfigKey(resolved2.key, resolved2.useRepo);
|
|
32086
32115
|
await unsetFileConfigKey({
|
|
32087
|
-
key:
|
|
32088
|
-
useRepo:
|
|
32089
|
-
repoName:
|
|
32090
|
-
node: defaultsToNode(
|
|
32116
|
+
key: resolved2.key,
|
|
32117
|
+
useRepo: resolved2.useRepo,
|
|
32118
|
+
repoName: resolved2.repoName,
|
|
32119
|
+
node: defaultsToNode(resolved2.key, options2),
|
|
32091
32120
|
user: options2.user ?? false
|
|
32092
32121
|
});
|
|
32093
32122
|
}
|
|
@@ -34536,25 +34565,25 @@ import { existsSync as existsSync68 } from "fs";
|
|
|
34536
34565
|
import path50 from "path";
|
|
34537
34566
|
import chalk184 from "chalk";
|
|
34538
34567
|
function resolveCsproj(csprojPath) {
|
|
34539
|
-
const
|
|
34540
|
-
if (!existsSync68(
|
|
34541
|
-
console.error(chalk184.red(`File not found: ${
|
|
34568
|
+
const resolved2 = path50.resolve(csprojPath);
|
|
34569
|
+
if (!existsSync68(resolved2)) {
|
|
34570
|
+
console.error(chalk184.red(`File not found: ${resolved2}`));
|
|
34542
34571
|
process.exit(1);
|
|
34543
34572
|
}
|
|
34544
|
-
const repoRoot3 = findRepoRoot(path50.dirname(
|
|
34573
|
+
const repoRoot3 = findRepoRoot(path50.dirname(resolved2));
|
|
34545
34574
|
if (!repoRoot3) {
|
|
34546
34575
|
console.error(chalk184.red("Could not find git repository root"));
|
|
34547
34576
|
process.exit(1);
|
|
34548
34577
|
}
|
|
34549
|
-
return { resolved, repoRoot: repoRoot3 };
|
|
34578
|
+
return { resolved: resolved2, repoRoot: repoRoot3 };
|
|
34550
34579
|
}
|
|
34551
34580
|
|
|
34552
34581
|
// src/commands/dotnet/deps.ts
|
|
34553
34582
|
async function deps(csprojPath, options2) {
|
|
34554
|
-
const { resolved, repoRoot: repoRoot3 } = resolveCsproj(csprojPath);
|
|
34555
|
-
const tree = buildTree(
|
|
34583
|
+
const { resolved: resolved2, repoRoot: repoRoot3 } = resolveCsproj(csprojPath);
|
|
34584
|
+
const tree = buildTree(resolved2, repoRoot3);
|
|
34556
34585
|
const totalCount = collectAllDeps(tree).size + 1;
|
|
34557
|
-
const solutions = findContainingSolutions(
|
|
34586
|
+
const solutions = findContainingSolutions(resolved2, repoRoot3);
|
|
34558
34587
|
if (options2.json) {
|
|
34559
34588
|
printJson(tree, totalCount, solutions);
|
|
34560
34589
|
} else {
|
|
@@ -34595,8 +34624,8 @@ function getChangedCsFiles(scope) {
|
|
|
34595
34624
|
// src/commands/dotnet/inSln.ts
|
|
34596
34625
|
import chalk185 from "chalk";
|
|
34597
34626
|
async function inSln(csprojPath) {
|
|
34598
|
-
const { resolved, repoRoot: repoRoot3 } = resolveCsproj(csprojPath);
|
|
34599
|
-
const solutions = findContainingSolutions(
|
|
34627
|
+
const { resolved: resolved2, repoRoot: repoRoot3 } = resolveCsproj(csprojPath);
|
|
34628
|
+
const solutions = findContainingSolutions(resolved2, repoRoot3);
|
|
34600
34629
|
if (solutions.length === 0) {
|
|
34601
34630
|
console.log(chalk185.yellow("Not found in any .sln file"));
|
|
34602
34631
|
process.exit(1);
|
|
@@ -34745,12 +34774,12 @@ function findSolution() {
|
|
|
34745
34774
|
// src/commands/dotnet/resolveSolution.ts
|
|
34746
34775
|
function resolveSolution(sln) {
|
|
34747
34776
|
if (sln) {
|
|
34748
|
-
const
|
|
34749
|
-
if (!existsSync69(
|
|
34750
|
-
console.error(chalk188.red(`Solution file not found: ${
|
|
34777
|
+
const resolved2 = path51.resolve(sln);
|
|
34778
|
+
if (!existsSync69(resolved2)) {
|
|
34779
|
+
console.error(chalk188.red(`Solution file not found: ${resolved2}`));
|
|
34751
34780
|
process.exit(1);
|
|
34752
34781
|
}
|
|
34753
|
-
return
|
|
34782
|
+
return resolved2;
|
|
34754
34783
|
}
|
|
34755
34784
|
return findSolution();
|
|
34756
34785
|
}
|
|
@@ -34876,13 +34905,13 @@ function runRoslynInspect(slnPath) {
|
|
|
34876
34905
|
}
|
|
34877
34906
|
|
|
34878
34907
|
// src/commands/dotnet/runEngine.ts
|
|
34879
|
-
function runEngine(
|
|
34908
|
+
function runEngine(resolved2, changedFiles2, options2) {
|
|
34880
34909
|
if (options2.roslyn) {
|
|
34881
|
-
const issues = runRoslynInspect(
|
|
34910
|
+
const issues = runRoslynInspect(resolved2);
|
|
34882
34911
|
return changedFiles2 ? filterToChangedFiles(issues, changedFiles2) : issues;
|
|
34883
34912
|
}
|
|
34884
34913
|
return parseInspectReport(
|
|
34885
|
-
runInspectCode(
|
|
34914
|
+
runInspectCode(resolved2, changedFiles2?.join(";") ?? null, !!options2.swea)
|
|
34886
34915
|
);
|
|
34887
34916
|
}
|
|
34888
34917
|
|
|
@@ -34903,7 +34932,7 @@ function reportResults(issues, elapsed) {
|
|
|
34903
34932
|
if (issues.length > 0) process.exit(1);
|
|
34904
34933
|
}
|
|
34905
34934
|
async function inspect(sln, options2) {
|
|
34906
|
-
const
|
|
34935
|
+
const resolved2 = resolveSolution(sln);
|
|
34907
34936
|
checkBuildLocks();
|
|
34908
34937
|
if (options2.roslyn) assertMsbuildInstalled();
|
|
34909
34938
|
else assertJbInstalled();
|
|
@@ -34915,7 +34944,7 @@ async function inspect(sln, options2) {
|
|
|
34915
34944
|
}
|
|
34916
34945
|
logScope(changedFiles2);
|
|
34917
34946
|
const start2 = Date.now();
|
|
34918
|
-
const issues = runEngine(
|
|
34947
|
+
const issues = runEngine(resolved2, changedFiles2, options2);
|
|
34919
34948
|
const elapsed = Date.now() - start2;
|
|
34920
34949
|
const { all = false, only = [], suppress = [] } = options2;
|
|
34921
34950
|
reportResults(filterIssues(issues, all, only, suppress), elapsed);
|
|
@@ -36410,10 +36439,10 @@ var defaultTypeChain = ["Epic", "Story", "Subtask"];
|
|
|
36410
36439
|
function fixStructure(target, options2) {
|
|
36411
36440
|
try {
|
|
36412
36441
|
const chain2 = options2.typeChain ? parseTypeChain(options2.typeChain) : defaultTypeChain;
|
|
36413
|
-
const
|
|
36414
|
-
const issueTypes = resolveOrgIssueTypes(
|
|
36442
|
+
const resolved2 = resolveFixStructureTarget(target, options2.repo);
|
|
36443
|
+
const issueTypes = resolveOrgIssueTypes(resolved2.owner);
|
|
36415
36444
|
assertChainTypesExist(chain2, issueTypes);
|
|
36416
|
-
const root2 = fetchRootIssue(
|
|
36445
|
+
const root2 = fetchRootIssue(resolved2);
|
|
36417
36446
|
const { index: index3, asserted } = resolveRootLevelIndex(
|
|
36418
36447
|
chain2,
|
|
36419
36448
|
root2.typeName,
|
|
@@ -36429,7 +36458,7 @@ function fixStructure(target, options2) {
|
|
|
36429
36458
|
const plan2 = planSubtree(root2, context);
|
|
36430
36459
|
printFixStructurePlan(plan2, chain2, options2.apply === true);
|
|
36431
36460
|
assertNothingTooDeep(plan2.tooDeep, chain2);
|
|
36432
|
-
if (options2.apply) applyAndVerifySubtree(
|
|
36461
|
+
if (options2.apply) applyAndVerifySubtree(resolved2, plan2, context);
|
|
36433
36462
|
} catch (error) {
|
|
36434
36463
|
console.error(error instanceof Error ? error.message : String(error));
|
|
36435
36464
|
process.exit(1);
|
|
@@ -36744,9 +36773,9 @@ function applyCreatedIssueMetadata(createOutput, metadata2) {
|
|
|
36744
36773
|
}
|
|
36745
36774
|
|
|
36746
36775
|
// src/commands/github/issue/issuePreviewMetadata.ts
|
|
36747
|
-
function issuePreviewMetadata(
|
|
36748
|
-
if (!
|
|
36749
|
-
const { target, issueType, parent, project, labels, milestone } =
|
|
36776
|
+
function issuePreviewMetadata(resolved2) {
|
|
36777
|
+
if (!resolved2) return [];
|
|
36778
|
+
const { target, issueType, parent, project, labels, milestone } = resolved2;
|
|
36750
36779
|
const items3 = [
|
|
36751
36780
|
{ label: "Repository", value: `${target.owner}/${target.repo}` }
|
|
36752
36781
|
];
|
|
@@ -37154,22 +37183,22 @@ async function createIssue(options2) {
|
|
|
37154
37183
|
title,
|
|
37155
37184
|
body
|
|
37156
37185
|
);
|
|
37157
|
-
const
|
|
37186
|
+
const resolved2 = preflight(options2);
|
|
37158
37187
|
const decision = await reviewProposedIssue(
|
|
37159
37188
|
title,
|
|
37160
37189
|
body,
|
|
37161
|
-
issuePreviewMetadata(
|
|
37190
|
+
issuePreviewMetadata(resolved2)
|
|
37162
37191
|
);
|
|
37163
37192
|
const attachments = decision?.screenshots ?? [];
|
|
37164
37193
|
const output = runGhIssueCreate(
|
|
37165
37194
|
title,
|
|
37166
37195
|
appendScreenshots(body, attachments),
|
|
37167
37196
|
options2.repo,
|
|
37168
|
-
|
|
37197
|
+
resolved2,
|
|
37169
37198
|
attachments
|
|
37170
37199
|
);
|
|
37171
37200
|
console.log(output.trim());
|
|
37172
|
-
if (
|
|
37201
|
+
if (resolved2) applyCreatedIssueMetadata(output, resolved2);
|
|
37173
37202
|
}
|
|
37174
37203
|
|
|
37175
37204
|
// src/commands/github/issue/registerCreateIssue.ts
|
|
@@ -39798,7 +39827,7 @@ async function saveToRepo(key, extract2, repo, cwd) {
|
|
|
39798
39827
|
return `${SHARED_REPO_CONFIG_SOURCE} under repos.${result.label}`;
|
|
39799
39828
|
}
|
|
39800
39829
|
async function saveMiroExtract(name2, extract2, options2, paths = {}) {
|
|
39801
|
-
const
|
|
39830
|
+
const resolved2 = {
|
|
39802
39831
|
cwd: paths.cwd ?? process.cwd(),
|
|
39803
39832
|
globalConfigPath: paths.globalConfigPath ?? getGlobalConfigPath()
|
|
39804
39833
|
};
|
|
@@ -39808,16 +39837,16 @@ async function saveMiroExtract(name2, extract2, options2, paths = {}) {
|
|
|
39808
39837
|
);
|
|
39809
39838
|
const key = `miro.extracts.${name2}`;
|
|
39810
39839
|
if (options2.repo !== void 0)
|
|
39811
|
-
return saveToRepo(key, extract2, options2.repo,
|
|
39840
|
+
return saveToRepo(key, extract2, options2.repo, resolved2.cwd);
|
|
39812
39841
|
const result = applyConfigSet(
|
|
39813
39842
|
key,
|
|
39814
39843
|
extract2,
|
|
39815
39844
|
options2.node ?? false,
|
|
39816
|
-
|
|
39817
|
-
|
|
39845
|
+
resolved2.cwd,
|
|
39846
|
+
resolved2.globalConfigPath
|
|
39818
39847
|
);
|
|
39819
39848
|
if (!result.ok) throw new MiroExtractError(result.errors.join("\n"));
|
|
39820
|
-
return result.target === "global" ? globalConfigFileLabel(
|
|
39849
|
+
return result.target === "global" ? globalConfigFileLabel(resolved2.globalConfigPath) : projectConfigPathFrom(resolved2.cwd);
|
|
39821
39850
|
}
|
|
39822
39851
|
|
|
39823
39852
|
// src/commands/miro/offerSaveExtract.ts
|
|
@@ -39988,14 +40017,14 @@ function resolveMiroExtract(name2, options2, cwd = process.cwd(), globalConfigPa
|
|
|
39988
40017
|
// src/commands/miro/resolveExtractOptions.ts
|
|
39989
40018
|
function resolveExtractOptions(name2, options2, paths) {
|
|
39990
40019
|
if (!name2) return options2;
|
|
39991
|
-
const
|
|
40020
|
+
const resolved2 = resolveMiroExtract(
|
|
39992
40021
|
name2,
|
|
39993
40022
|
options2,
|
|
39994
40023
|
paths.cwd,
|
|
39995
40024
|
paths.globalConfigPath
|
|
39996
40025
|
);
|
|
39997
|
-
console.error(chalk209.dim(`Extract "${name2}" from ${
|
|
39998
|
-
return
|
|
40026
|
+
console.error(chalk209.dim(`Extract "${name2}" from ${resolved2.from}`));
|
|
40027
|
+
return resolved2.options;
|
|
39999
40028
|
}
|
|
40000
40029
|
|
|
40001
40030
|
// src/commands/miro/selectBoxes.ts
|
|
@@ -40034,26 +40063,26 @@ function requireItems(file) {
|
|
|
40034
40063
|
return file;
|
|
40035
40064
|
}
|
|
40036
40065
|
async function runExtract(name2, options2, paths = {}) {
|
|
40037
|
-
const
|
|
40038
|
-
const source = anchorSource(
|
|
40039
|
-
const itemsFile = requireItems(
|
|
40066
|
+
const resolved2 = resolveExtractOptions(name2, options2, paths);
|
|
40067
|
+
const source = anchorSource(resolved2);
|
|
40068
|
+
const itemsFile = requireItems(resolved2.items);
|
|
40040
40069
|
const raw = readMiroItems(itemsFile);
|
|
40041
40070
|
const items3 = normaliseItems(raw);
|
|
40042
40071
|
const [topLeft, bottomRight] = source.pick ? await pickAnchors(source.sessionId, items3) : [source.topLeft, source.bottomRight];
|
|
40043
40072
|
const selection = selectBoxes(items3, topLeft, bottomRight);
|
|
40044
|
-
const board = boardSource(raw, topLeft,
|
|
40073
|
+
const board = boardSource(raw, topLeft, resolved2);
|
|
40045
40074
|
emitExtract(
|
|
40046
|
-
|
|
40075
|
+
resolved2.out,
|
|
40047
40076
|
{ ...board, topLeft, bottomRight, rect: selection.rect },
|
|
40048
|
-
keptTexts(
|
|
40077
|
+
keptTexts(resolved2, selection.boxes)
|
|
40049
40078
|
);
|
|
40050
|
-
if (source.pick ||
|
|
40079
|
+
if (source.pick || resolved2.save)
|
|
40051
40080
|
await offerSaveExtract(
|
|
40052
40081
|
extractToSave(
|
|
40053
|
-
{ options:
|
|
40082
|
+
{ options: resolved2, items: itemsFile, topLeft, bottomRight, ...board },
|
|
40054
40083
|
paths.cwd
|
|
40055
40084
|
),
|
|
40056
|
-
|
|
40085
|
+
resolved2,
|
|
40057
40086
|
paths
|
|
40058
40087
|
);
|
|
40059
40088
|
}
|
|
@@ -41635,8 +41664,8 @@ function renderReview(comment3, style) {
|
|
|
41635
41664
|
}
|
|
41636
41665
|
|
|
41637
41666
|
// src/commands/prs/listComments/summarise.ts
|
|
41638
|
-
function summarise(reviewCount, unresolved,
|
|
41639
|
-
const threadCounts = `${unresolved.length} unresolved and ${
|
|
41667
|
+
function summarise(reviewCount, unresolved, resolved2) {
|
|
41668
|
+
const threadCounts = `${unresolved.length} unresolved and ${resolved2.length} resolved threads.`;
|
|
41640
41669
|
if (reviewCount === 0) return `Found ${threadCounts}`;
|
|
41641
41670
|
const reviews = `${reviewCount} review comment${reviewCount === 1 ? "" : "s"}`;
|
|
41642
41671
|
return `Found ${reviews}, ${threadCounts}`;
|
|
@@ -41657,7 +41686,7 @@ function printComments2(result) {
|
|
|
41657
41686
|
comments3.filter((c) => c.type === "line")
|
|
41658
41687
|
);
|
|
41659
41688
|
const unresolved = threads.filter((t) => !t.resolved);
|
|
41660
|
-
const
|
|
41689
|
+
const resolved2 = threads.filter((t) => t.resolved);
|
|
41661
41690
|
for (const review2 of reviews) {
|
|
41662
41691
|
console.log(renderReview(review2, style));
|
|
41663
41692
|
}
|
|
@@ -41668,10 +41697,10 @@ function printComments2(result) {
|
|
|
41668
41697
|
console.log(renderThreadBlock(thread, style));
|
|
41669
41698
|
}
|
|
41670
41699
|
}
|
|
41671
|
-
if (
|
|
41672
|
-
console.log(renderResolvedIndex(
|
|
41700
|
+
if (resolved2.length > 0) {
|
|
41701
|
+
console.log(renderResolvedIndex(resolved2, style));
|
|
41673
41702
|
}
|
|
41674
|
-
console.log(summarise(reviews.length, unresolved,
|
|
41703
|
+
console.log(summarise(reviews.length, unresolved, resolved2));
|
|
41675
41704
|
if (style.agent) {
|
|
41676
41705
|
console.log(agentFooter(unresolved.length));
|
|
41677
41706
|
return;
|
|
@@ -42591,7 +42620,7 @@ var USAGE8 = "Usage: assist prs raise --title <title> --what <what> --why <why>
|
|
|
42591
42620
|
async function raise(options2, command) {
|
|
42592
42621
|
const screenshots = parseScreenshotSpecs(options2.screenshot);
|
|
42593
42622
|
const { title, body } = buildValidatedBody(options2, USAGE8);
|
|
42594
|
-
const
|
|
42623
|
+
const resolved2 = { ...options2, draft: resolveDraftState(options2, command) };
|
|
42595
42624
|
const existing = findOpenPrNumber();
|
|
42596
42625
|
const sessionId2 = process.env.ASSIST_SESSION_ID;
|
|
42597
42626
|
if (process.env.ASSIST_SESSION === "1" && sessionId2) {
|
|
@@ -42600,7 +42629,7 @@ async function raise(options2, command) {
|
|
|
42600
42629
|
title,
|
|
42601
42630
|
body,
|
|
42602
42631
|
prNumber: existing,
|
|
42603
|
-
options:
|
|
42632
|
+
options: resolved2,
|
|
42604
42633
|
reviewAfter: loadConfig().prs?.reviewAfterRaise ?? true,
|
|
42605
42634
|
screenshots
|
|
42606
42635
|
});
|
|
@@ -42616,7 +42645,7 @@ async function raise(options2, command) {
|
|
|
42616
42645
|
existing,
|
|
42617
42646
|
title,
|
|
42618
42647
|
appendScreenshots(body, screenshots),
|
|
42619
|
-
|
|
42648
|
+
resolved2,
|
|
42620
42649
|
screenshots
|
|
42621
42650
|
);
|
|
42622
42651
|
}
|
|
@@ -43714,13 +43743,13 @@ async function fetchAllPages(connection, opts2) {
|
|
|
43714
43743
|
|
|
43715
43744
|
// src/commands/ravendb/ravendbQuery.ts
|
|
43716
43745
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
43717
|
-
const
|
|
43718
|
-
if (!
|
|
43746
|
+
const resolved2 = resolveArgs(connectionName, collection);
|
|
43747
|
+
if (!resolved2.collection && !options2.query) {
|
|
43719
43748
|
console.error(chalk232.red("Provide a collection name or --query filter."));
|
|
43720
43749
|
process.exit(1);
|
|
43721
43750
|
}
|
|
43722
|
-
const { collection: col } =
|
|
43723
|
-
const connection =
|
|
43751
|
+
const { collection: col } = resolved2;
|
|
43752
|
+
const connection = resolved2.connection;
|
|
43724
43753
|
const allResults = await fetchAllPages(connection, {
|
|
43725
43754
|
collection: col,
|
|
43726
43755
|
pageSize: Number.parseInt(options2.pageSize ?? "25", 10),
|
|
@@ -44855,12 +44884,12 @@ async function restartDaemonAfterUpdate() {
|
|
|
44855
44884
|
// src/commands/update.ts
|
|
44856
44885
|
function isGlobalNpmInstall(dir) {
|
|
44857
44886
|
try {
|
|
44858
|
-
const
|
|
44859
|
-
if (
|
|
44887
|
+
const resolved2 = path61.resolve(dir);
|
|
44888
|
+
if (resolved2.split(path61.sep).includes("node_modules")) {
|
|
44860
44889
|
return true;
|
|
44861
44890
|
}
|
|
44862
44891
|
const globalPrefix = execSync55("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
44863
|
-
return
|
|
44892
|
+
return resolved2.toLowerCase().startsWith(path61.resolve(globalPrefix).toLowerCase());
|
|
44864
44893
|
} catch {
|
|
44865
44894
|
return false;
|
|
44866
44895
|
}
|
|
@@ -46138,8 +46167,8 @@ function specifiersOf(sourceFile, includeMocks) {
|
|
|
46138
46167
|
// src/commands/refactor/restructure/buildImportGraph/collectSourceFileEdges.ts
|
|
46139
46168
|
function resolveImport(specifier, filePath, options2) {
|
|
46140
46169
|
if (!specifier.startsWith(".")) return null;
|
|
46141
|
-
const
|
|
46142
|
-
const resolvedPath =
|
|
46170
|
+
const resolved2 = ts8.resolveModuleName(specifier, filePath, options2, ts8.sys);
|
|
46171
|
+
const resolvedPath = resolved2.resolvedModule?.resolvedFileName;
|
|
46143
46172
|
if (!resolvedPath || resolvedPath.includes("node_modules")) return null;
|
|
46144
46173
|
return path73.resolve(resolvedPath);
|
|
46145
46174
|
}
|
|
@@ -49021,7 +49050,7 @@ function resolveSynthesisHarness() {
|
|
|
49021
49050
|
// src/commands/review/reviewModel.ts
|
|
49022
49051
|
function reviewModel(harness) {
|
|
49023
49052
|
const models = {
|
|
49024
|
-
codex: loadConfig().review?.codexModel
|
|
49053
|
+
codex: resolveCodexModel(loadConfig().review?.codexModel)
|
|
49025
49054
|
};
|
|
49026
49055
|
return models[harness];
|
|
49027
49056
|
}
|
|
@@ -50847,7 +50876,7 @@ function registerReview(program) {
|
|
|
50847
50876
|
configHelp(
|
|
50848
50877
|
reviewCommand,
|
|
50849
50878
|
reviewConfigHelp,
|
|
50850
|
-
"With review.codexModel unset the codex reviewer runs on the user's own codex auth; when it is set but the LiteLLM proxy is not configured, the reviewer falls back to that plain codex run. A reviewer whose harness is unavailable is skipped with its reason, and the review stops before reviewing when the review.synthesisHarness cannot synthesise."
|
|
50879
|
+
"With review.codexModel unset or codex-default the codex reviewer runs on the user's own codex auth and configured model (set codex-default in a repo to override an inherited value); when it is set but the LiteLLM proxy is not configured, the reviewer falls back to that plain codex run. A reviewer whose harness is unavailable is skipped with its reason, and the review stops before reviewing when the review.synthesisHarness cannot synthesise."
|
|
50851
50880
|
);
|
|
50852
50881
|
}
|
|
50853
50882
|
|
|
@@ -50953,14 +50982,14 @@ function indexRules() {
|
|
|
50953
50982
|
import path102 from "path";
|
|
50954
50983
|
import chalk277 from "chalk";
|
|
50955
50984
|
function listRules(target, options2 = {}) {
|
|
50956
|
-
const
|
|
50957
|
-
const rules2 = readScopedRules(
|
|
50985
|
+
const resolved2 = path102.resolve(target ?? process.cwd());
|
|
50986
|
+
const rules2 = readScopedRules(resolved2);
|
|
50958
50987
|
if (rules2.length === 0) {
|
|
50959
|
-
const label = path102.relative(process.cwd(),
|
|
50988
|
+
const label = path102.relative(process.cwd(), resolved2) || ".";
|
|
50960
50989
|
console.log(chalk277.gray(`No rules in scope for ${label}`));
|
|
50961
50990
|
return;
|
|
50962
50991
|
}
|
|
50963
|
-
const base = findRepoRoot(scopeDirectory(
|
|
50992
|
+
const base = findRepoRoot(scopeDirectory(resolved2));
|
|
50964
50993
|
const width2 = Math.max(...rules2.map((rule) => rule.code.length));
|
|
50965
50994
|
let shown;
|
|
50966
50995
|
for (const rule of rules2) {
|
|
@@ -51019,9 +51048,9 @@ function nextRuleCode(root2) {
|
|
|
51019
51048
|
import { existsSync as existsSync82 } from "fs";
|
|
51020
51049
|
import path103 from "path";
|
|
51021
51050
|
function resolveRuleScope(target) {
|
|
51022
|
-
const
|
|
51023
|
-
if (path103.basename(
|
|
51024
|
-
const startDir = scopeDirectory(
|
|
51051
|
+
const resolved2 = path103.resolve(target);
|
|
51052
|
+
if (path103.basename(resolved2) === "CLAUDE.md") return resolved2;
|
|
51053
|
+
const startDir = scopeDirectory(resolved2);
|
|
51025
51054
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
51026
51055
|
let current2 = startDir;
|
|
51027
51056
|
while (true) {
|
|
@@ -54490,13 +54519,13 @@ function findRunConfig(name2) {
|
|
|
54490
54519
|
// src/commands/run/resolveParams.ts
|
|
54491
54520
|
function resolveParams(params, cliArgs) {
|
|
54492
54521
|
if (!params || params.length === 0) return cliArgs;
|
|
54493
|
-
const
|
|
54522
|
+
const resolved2 = [];
|
|
54494
54523
|
const missing = [];
|
|
54495
54524
|
for (let i = 0; i < params.length; i++) {
|
|
54496
54525
|
const param = params[i];
|
|
54497
54526
|
const value = cliArgs[i] ?? param.default;
|
|
54498
54527
|
if (value !== void 0) {
|
|
54499
|
-
|
|
54528
|
+
resolved2.push(value);
|
|
54500
54529
|
} else if (param.required) {
|
|
54501
54530
|
missing.push(param.name);
|
|
54502
54531
|
}
|
|
@@ -54507,8 +54536,8 @@ function resolveParams(params, cliArgs) {
|
|
|
54507
54536
|
console.error(`Missing required param${s}: ${names}`);
|
|
54508
54537
|
process.exit(1);
|
|
54509
54538
|
}
|
|
54510
|
-
|
|
54511
|
-
return
|
|
54539
|
+
resolved2.push(...cliArgs.slice(params.length));
|
|
54540
|
+
return resolved2;
|
|
54512
54541
|
}
|
|
54513
54542
|
|
|
54514
54543
|
// src/commands/run/resolveRunCwd.ts
|
|
@@ -55283,10 +55312,10 @@ function listRunConfigs(verbose) {
|
|
|
55283
55312
|
function execRunConfig(config, args) {
|
|
55284
55313
|
const cwd = resolveRunCwd(config);
|
|
55285
55314
|
if (config.pre) runPreCommands(config.pre, cwd);
|
|
55286
|
-
const
|
|
55315
|
+
const resolved2 = resolveParams(config.params, args);
|
|
55287
55316
|
spawnRunCommand(
|
|
55288
55317
|
config.command,
|
|
55289
|
-
[...config.args ?? [], ...
|
|
55318
|
+
[...config.args ?? [], ...resolved2],
|
|
55290
55319
|
config.env,
|
|
55291
55320
|
cwd,
|
|
55292
55321
|
config.quiet
|
|
@@ -63737,7 +63766,7 @@ function creator(isNew, spawn15) {
|
|
|
63737
63766
|
}
|
|
63738
63767
|
if (result instanceof Promise)
|
|
63739
63768
|
result.then(
|
|
63740
|
-
(
|
|
63769
|
+
(resolved2) => reply2(client, d, resolved2),
|
|
63741
63770
|
(error) => fail14(client, d, error)
|
|
63742
63771
|
);
|
|
63743
63772
|
else reply2(client, d, result);
|