@knowsuchagency/fulcrum 1.4.0 → 1.6.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/bin/fulcrum.js +3207 -3595
- package/dist/assets/{index-J3L6hPet.js → index-fIJu9jIH.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -122,7 +122,7 @@ ${n.map(([a,s])=>{const o=s.theme?.[r]||s.color;return o?` --color-${a}: ${o};`
|
|
|
122
122
|
|
|
123
123
|
${e}`,d=Cp(u);return`opencode --agent ${bgt(o)} --prompt ${d}${l}`},notFoundPatterns:[/opencode: command not found/,/opencode: not found/,/'opencode' is not recognized/,/command not found: opencode/],processPattern:/\bopencode\b/i},d6={claude:ygt,opencode:vgt};function xgt(e,t){return d6[e].buildCommand(t)}function _gt(e,t){if(t)return d6[t].notFoundPatterns.some(r=>r.test(e))?t:null;for(const[n,r]of Object.entries(d6))if(r.notFoundPatterns.some(i=>i.test(e)))return n;return null}function Kae({taskName:e,cwd:t,taskId:n,className:r,agent:i="claude",aiMode:a,description:s,startupScript:o,agentOptions:l,opencodeModel:u,serverPort:d=7777,autoFocus:c=!1}){const p=w.useRef(null),m=w.useRef(null),x=w.useRef(!1),_=w.useRef(c),b=w.useRef(null),v=w.useRef(!1),y=w.useRef(!1),[E,T]=w.useState(null),[k,C]=w.useState(!1),[O,A]=w.useState(!1),[N,I]=w.useState(!1),[D,P]=w.useState(null),{resolvedTheme:L}=Wf(),j=L==="dark",F=j?dme:cme,{data:$}=gfe(),{data:V}=bfe(),Y=w.useRef($),B=w.useRef(V);w.useEffect(()=>{Y.current=$},[$]),w.useEffect(()=>{B.current=V},[V]),w.useEffect(()=>{Mt.taskTerminal.debug("cwd changed, resetting refs",{cwd:t}),v.current=!1,y.current=!1,x.current=!1,T(null),C(!1)},[t]);const{setTerminalFocused:z}=U8(),{terminals:H,terminalsLoaded:q,connected:U,createTerminal:X,attachXterm:J,resizeTerminal:ne,setupImagePaste:Z,writeToTerminal:K,consumePendingStartup:ee,clearStartingUp:ae}=wB(),se=w.useRef(J),ie=w.useRef(Z),me=w.useRef(K),ye=w.useRef(ee),ue=w.useRef(ae);w.useEffect(()=>{se.current=J},[J]),w.useEffect(()=>{ie.current=Z},[Z]),w.useEffect(()=>{me.current=K},[K]),w.useEffect(()=>{ye.current=ee},[ee]),w.useEffect(()=>{ue.current=ae},[ae]),w.useEffect(()=>{_.current=c},[c]);const Ee=E?H.find(Le=>Le.id===E):null,be=Ee?.status;w.useEffect(()=>{if(!p.current||m.current)return;const Le=new sme.Terminal({cursorBlink:!0,fontSize:14,fontFamily:"monospace",theme:F,scrollback:1e4,rightClickSelectsWord:!0,scrollOnUserInput:!1}),Ce=new ome.FitAddon,Pe=new lme.WebLinksAddon;Le.loadAddon(Ce),Le.loadAddon(Pe),Le.open(p.current);const xe=ume(Le);m.current=Le,b.current=Ce,I(!0),requestAnimationFrame(()=>{Ce.fit()});const _e=setTimeout(()=>{Ce.fit(),Le.refresh(0,Le.rows-1)},100),Ae=()=>z(!0),pe=()=>z(!1);return Le.textarea&&(Le.textarea.addEventListener("focus",Ae),Le.textarea.addEventListener("blur",pe)),()=>{clearTimeout(_e),xe(),Le.textarea&&(Le.textarea.removeEventListener("focus",Ae),Le.textarea.removeEventListener("blur",pe)),z(!1),Le.dispose(),m.current=null,b.current=null,I(!1)}},[z]);const Oe=w.useCallback(()=>{if(!b.current||!m.current)return;b.current.fit();const{cols:Le,rows:Ce}=m.current;E&&ne(E,Le,Ce)},[E,ne]);w.useEffect(()=>{if(!p.current)return;const Le=()=>{requestAnimationFrame(Oe)};window.addEventListener("resize",Le);const Ce=()=>{document.visibilityState==="visible"&&requestAnimationFrame(()=>{Oe(),m.current&&m.current.refresh(0,m.current.rows-1)})};document.addEventListener("visibilitychange",Ce);const Pe=new ResizeObserver(Le);Pe.observe(p.current);const xe=new IntersectionObserver(_e=>{_e[0]?.isIntersecting&&requestAnimationFrame(()=>{Oe(),m.current&&m.current.refresh(0,m.current.rows-1)})},{threshold:.1});return xe.observe(p.current),()=>{window.removeEventListener("resize",Le),document.removeEventListener("visibilitychange",Ce),Pe.disconnect(),xe.disconnect()}},[Oe]),w.useEffect(()=>{if(!U||!t||!N||!q){Mt.taskTerminal.debug("Terminal effect: waiting for conditions",{connected:U,cwd:t,xtermOpened:N,terminalsLoaded:q});return}Mt.taskTerminal.info("Looking for terminal",{cwd:t,terminalCount:H.length,availableTerminals:H.map(Ce=>({id:Ce.id,name:Ce.name,cwd:Ce.cwd,tabId:Ce.tabId}))});const Le=H.find(Ce=>Ce.cwd===t);if(Le){Mt.taskTerminal.info("Found existing terminal",{terminalId:Le.id,name:Le.name,cwd:t}),T(Le.id);return}if(!v.current&&m.current){Mt.taskTerminal.info("Creating new terminal",{reason:"no_existing_terminal_for_cwd",cwd:t,taskName:e,taskId:n,agent:i}),v.current=!0,C(!0);const{cols:Ce,rows:Pe}=m.current;X({name:e,cols:Ce,rows:Pe,cwd:t,taskId:n,startup:{startupScript:o,agent:i,agentOptions:l,opencodeModel:u,aiMode:a,description:s,taskName:e,serverPort:d}})}else v.current&&Mt.taskTerminal.debug("Terminal creation already in progress",{cwd:t,createdTerminalRef:v.current})},[U,t,N,q,H,e,X]),w.useEffect(()=>{if(!t)return;const Le=H.find(Pe=>Pe.cwd===t);if(!Le)return;const Ce=E&&H.some(Pe=>Pe.id===E);(!E||!Ce)&&(Mt.taskTerminal.debug("setting terminalId",{newId:Le.id,prevId:E,reason:E?"tempId replaced":"initial",cwd:t,terminalCount:H.length}),T(Le.id),C(!1),E&&!Ce&&(y.current=!1))},[H,t,E]),w.useEffect(()=>{if(Mt.taskTerminal.debug("attach effect",{terminalId:E,hasTermRef:!!m.current,hasContainerRef:!!p.current,attachedRef:y.current}),!E||!m.current||!p.current||y.current)return;Mt.taskTerminal.debug("attach effect passed guards, calling attachXterm",{terminalId:E});const Le=xe=>{requestAnimationFrame(Oe);const _e=ye.current(xe);if(Mt.taskTerminal.debug("onAttached checking pending startup",{terminalId:xe,hasPendingStartup:!!_e}),!_e){if(_.current&&!x.current&&m.current){const fe=()=>{const ge=m.current;!x.current&&ge&&(ge.focus(),ge.textarea===document.activeElement&&(x.current=!0))};setTimeout(fe,50),setTimeout(fe,200),setTimeout(fe,500)}return}Mt.taskTerminal.info("onAttached: running startup commands",{terminalId:xe}),A(!0);const{startupScript:Ae,agent:pe="claude",agentOptions:Me,opencodeModel:we,aiMode:Ve,description:Xe,taskName:ht,serverPort:ot}=_e;Ae&&setTimeout(()=>{const fe="FULCRUM_STARTUP_"+Date.now(),ge=`source /dev/stdin <<'${fe}'
|
|
124
124
|
${Ae}
|
|
125
|
-
${fe}`;me.current(xe,ge+"\r")},100);const lt=ot??7777,ze=lt!==7777?` --port=${lt}`:"",yt=`You are working in a Fulcrum task worktree. Commit after completing each logical unit of work (feature, fix, refactor) to preserve progress. When you finish working and need user input, run: fulcrum current-task review${ze}. When linking a PR: fulcrum current-task pr <url>${ze}. When linking a URL: fulcrum current-task link <url>${ze}. For notifications: fulcrum notify "Title" "Message"${ze}.`,Ie=Xe?`${ht}: ${Xe}`:ht,Ue=xgt(pe,{prompt:Ie,systemPrompt:yt,mode:Ve==="plan"?"plan":"default",additionalOptions:Me??{},opencodeModel:we,opencodeDefaultAgent:Y.current,opencodePlanAgent:B.current});setTimeout(()=>{if(me.current(xe,Ue+"\r"),A(!1),ue.current(xe),_.current&&!x.current&&m.current){const fe=()=>{const ge=m.current;!x.current&&ge&&(ge.focus(),ge.textarea===document.activeElement&&(x.current=!0))};setTimeout(fe,50),setTimeout(fe,200),setTimeout(fe,500)}},Ae?5e3:100)},Ce=se.current(E,m.current,{onAttached:Le}),Pe=ie.current(p.current,E);return y.current=!0,Mt.taskTerminal.debug("attachedRef set to true",{terminalId:E}),()=>{Mt.taskTerminal.debug("cleanup running, setting attachedRef to false",{terminalId:E}),Ce(),Pe(),y.current=!1}},[E,Oe]),w.useEffect(()=>{m.current&&(m.current.options.theme=F,m.current.refresh(0,m.current.rows-1))},[F]),w.useEffect(()=>{if(!c||x.current||!m.current||!E||k||O)return;const Le=[0,50,150,300,500],Ce=[];return Le.forEach(Pe=>{const xe=setTimeout(()=>{const _e=m.current;!x.current&&_e&&(_e.focus(),_e.textarea===document.activeElement&&(x.current=!0))},Pe);Ce.push(xe)}),()=>{Ce.forEach(clearTimeout)}},[c,k,O,E]),w.useEffect(()=>{if(!m.current||D)return;const Le=m.current,Ce=()=>{const xe=Le.buffer.active;for(let _e=Math.max(0,xe.cursorY-3);_e<=xe.cursorY;_e++){const Ae=xe.getLine(_e);if(Ae){const pe=Ae.translateToString(),Me=_gt(pe,i);if(Me){P(Me);return}}}},Pe=Le.onLineFeed(Ce);return()=>{Pe.dispose()}},[D,i]);const je=w.useCallback(Le=>{E&&me.current(E,Le)},[E]);return t?f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!U&&f.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:"Connecting to terminal server..."}),be==="error"&&f.jsx("div",{className:"shrink-0 px-2 py-1 bg-destructive/20 text-destructive text-xs",children:"Terminal failed to start. The worktree directory may not exist."}),be==="exited"&&f.jsxs("div",{className:"shrink-0 px-2 py-1 bg-muted text-muted-foreground text-xs",children:["Terminal exited (code: ",Ee?.exitCode,")"]}),f.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[f.jsx("div",{ref:p,className:Ne("h-full w-full overflow-hidden p-2 bg-terminal-background",r)}),k&&!E&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-terminal-background",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f.jsx(re,{icon:Ot,size:24,strokeWidth:2,className:Ne("animate-spin",j?"text-white/50":"text-black/50")}),f.jsx("span",{className:Ne("font-mono text-sm",j?"text-white/50":"text-black/50"),children:"Initializing terminal..."})]})}),O&&f.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-terminal-background/90",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f.jsx(re,{icon:Ot,size:24,strokeWidth:2,className:Ne("animate-spin",j?"text-white/60":"text-black/60")}),f.jsxs("span",{className:Ne("font-mono text-sm",j?"text-white/60":"text-black/60"),children:["Starting ",bo[i],"..."]})]})}),D&&f.jsx("div",{className:"pointer-events-none absolute bottom-4 left-4 right-4 z-10",children:f.jsxs("div",{className:Ne("pointer-events-auto flex items-start gap-3 rounded-lg border p-4","bg-amber-500/10 border-amber-500/30"),children:[f.jsx(re,{icon:fr,size:18,strokeWidth:2,className:"shrink-0 mt-0.5 text-amber-600 dark:text-amber-400"}),f.jsxs("div",{className:"flex-1 space-y-2",children:[f.jsxs("p",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:[bo[D]," CLI not found"]}),f.jsxs("p",{className:"text-xs text-amber-600/80 dark:text-amber-400/80",children:["Install it with:"," ",f.jsx("code",{className:"rounded bg-amber-500/20 px-1.5 py-0.5 font-mono",children:Efe[D]})]}),f.jsx("a",{href:Sfe[D],target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs font-medium text-amber-600 hover:text-amber-700 dark:text-amber-400 dark:hover:text-amber-300 underline",children:"View documentation"})]}),f.jsx("button",{onClick:()=>P(null),className:"shrink-0 p-1 rounded text-amber-600 hover:text-amber-700 hover:bg-amber-500/20 dark:text-amber-400 dark:hover:text-amber-300",children:f.jsx(re,{icon:Bn,size:14,strokeWidth:2})})]})}),f.jsx("button",{onClick:()=>m.current?.scrollToBottom(),className:Ne("absolute top-2 right-5 p-1 transition-colors",j?"text-white/50 hover:text-white/80":"text-black/50 hover:text-black/80"),children:f.jsx(re,{icon:Tce,size:20,strokeWidth:2})})]}),f.jsx("div",{className:"h-2 shrink-0 bg-terminal-background"}),f.jsx(HC,{onSend:je})]}):f.jsx("div",{className:Ne("flex h-full items-center justify-center text-muted-foreground text-sm bg-terminal-background",r),children:"No worktree path configured for this task"})}function Egt(e){const{viewState:t,setDiffOptions:n}=SB(e),{collapsedFiles:r}=t.diffOptions,i=w.useCallback(l=>{const u=r.includes(l);n({collapsedFiles:u?r.filter(d=>d!==l):[...r,l]})},[r,n]),a=w.useCallback(l=>{n({collapsedFiles:l})},[n]),s=w.useCallback(()=>{n({collapsedFiles:[]})},[n]),o=w.useCallback(l=>r.includes(l),[r]);return{options:t.diffOptions,setOption:(l,u)=>{n({[l]:u})},setOptions:n,toggleFileCollapse:i,collapseAll:a,expandAll:s,isFileCollapsed:o}}function Sgt(e){const t=[];let n=null,r=0,i=0;for(const a of e.split(`
|
|
125
|
+
${fe}`;me.current(xe,ge+"\r")},100);const lt=ot??7777,ze=lt!==7777?` --port=${lt}`:"",yt=`You are working in a Fulcrum task worktree. Reference the fulcrum skill for complete CLI documentation (attachments, dependencies, notifications, etc.). Commit after completing each logical unit of work (feature, fix, refactor) to preserve progress. When you finish working and need user input, run: fulcrum current-task review${ze}. When linking a PR: fulcrum current-task pr <url>${ze}. When linking a URL: fulcrum current-task link <url>${ze}. For notifications: fulcrum notify "Title" "Message"${ze}.`,Ie=Xe?`${ht}: ${Xe}`:ht,Ue=xgt(pe,{prompt:Ie,systemPrompt:yt,mode:Ve==="plan"?"plan":"default",additionalOptions:Me??{},opencodeModel:we,opencodeDefaultAgent:Y.current,opencodePlanAgent:B.current});setTimeout(()=>{if(me.current(xe,Ue+"\r"),A(!1),ue.current(xe),_.current&&!x.current&&m.current){const fe=()=>{const ge=m.current;!x.current&&ge&&(ge.focus(),ge.textarea===document.activeElement&&(x.current=!0))};setTimeout(fe,50),setTimeout(fe,200),setTimeout(fe,500)}},Ae?5e3:100)},Ce=se.current(E,m.current,{onAttached:Le}),Pe=ie.current(p.current,E);return y.current=!0,Mt.taskTerminal.debug("attachedRef set to true",{terminalId:E}),()=>{Mt.taskTerminal.debug("cleanup running, setting attachedRef to false",{terminalId:E}),Ce(),Pe(),y.current=!1}},[E,Oe]),w.useEffect(()=>{m.current&&(m.current.options.theme=F,m.current.refresh(0,m.current.rows-1))},[F]),w.useEffect(()=>{if(!c||x.current||!m.current||!E||k||O)return;const Le=[0,50,150,300,500],Ce=[];return Le.forEach(Pe=>{const xe=setTimeout(()=>{const _e=m.current;!x.current&&_e&&(_e.focus(),_e.textarea===document.activeElement&&(x.current=!0))},Pe);Ce.push(xe)}),()=>{Ce.forEach(clearTimeout)}},[c,k,O,E]),w.useEffect(()=>{if(!m.current||D)return;const Le=m.current,Ce=()=>{const xe=Le.buffer.active;for(let _e=Math.max(0,xe.cursorY-3);_e<=xe.cursorY;_e++){const Ae=xe.getLine(_e);if(Ae){const pe=Ae.translateToString(),Me=_gt(pe,i);if(Me){P(Me);return}}}},Pe=Le.onLineFeed(Ce);return()=>{Pe.dispose()}},[D,i]);const je=w.useCallback(Le=>{E&&me.current(E,Le)},[E]);return t?f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!U&&f.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:"Connecting to terminal server..."}),be==="error"&&f.jsx("div",{className:"shrink-0 px-2 py-1 bg-destructive/20 text-destructive text-xs",children:"Terminal failed to start. The worktree directory may not exist."}),be==="exited"&&f.jsxs("div",{className:"shrink-0 px-2 py-1 bg-muted text-muted-foreground text-xs",children:["Terminal exited (code: ",Ee?.exitCode,")"]}),f.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[f.jsx("div",{ref:p,className:Ne("h-full w-full overflow-hidden p-2 bg-terminal-background",r)}),k&&!E&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-terminal-background",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f.jsx(re,{icon:Ot,size:24,strokeWidth:2,className:Ne("animate-spin",j?"text-white/50":"text-black/50")}),f.jsx("span",{className:Ne("font-mono text-sm",j?"text-white/50":"text-black/50"),children:"Initializing terminal..."})]})}),O&&f.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-terminal-background/90",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f.jsx(re,{icon:Ot,size:24,strokeWidth:2,className:Ne("animate-spin",j?"text-white/60":"text-black/60")}),f.jsxs("span",{className:Ne("font-mono text-sm",j?"text-white/60":"text-black/60"),children:["Starting ",bo[i],"..."]})]})}),D&&f.jsx("div",{className:"pointer-events-none absolute bottom-4 left-4 right-4 z-10",children:f.jsxs("div",{className:Ne("pointer-events-auto flex items-start gap-3 rounded-lg border p-4","bg-amber-500/10 border-amber-500/30"),children:[f.jsx(re,{icon:fr,size:18,strokeWidth:2,className:"shrink-0 mt-0.5 text-amber-600 dark:text-amber-400"}),f.jsxs("div",{className:"flex-1 space-y-2",children:[f.jsxs("p",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:[bo[D]," CLI not found"]}),f.jsxs("p",{className:"text-xs text-amber-600/80 dark:text-amber-400/80",children:["Install it with:"," ",f.jsx("code",{className:"rounded bg-amber-500/20 px-1.5 py-0.5 font-mono",children:Efe[D]})]}),f.jsx("a",{href:Sfe[D],target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs font-medium text-amber-600 hover:text-amber-700 dark:text-amber-400 dark:hover:text-amber-300 underline",children:"View documentation"})]}),f.jsx("button",{onClick:()=>P(null),className:"shrink-0 p-1 rounded text-amber-600 hover:text-amber-700 hover:bg-amber-500/20 dark:text-amber-400 dark:hover:text-amber-300",children:f.jsx(re,{icon:Bn,size:14,strokeWidth:2})})]})}),f.jsx("button",{onClick:()=>m.current?.scrollToBottom(),className:Ne("absolute top-2 right-5 p-1 transition-colors",j?"text-white/50 hover:text-white/80":"text-black/50 hover:text-black/80"),children:f.jsx(re,{icon:Tce,size:20,strokeWidth:2})})]}),f.jsx("div",{className:"h-2 shrink-0 bg-terminal-background"}),f.jsx(HC,{onSend:je})]}):f.jsx("div",{className:Ne("flex h-full items-center justify-center text-muted-foreground text-sm bg-terminal-background",r),children:"No worktree path configured for this task"})}function Egt(e){const{viewState:t,setDiffOptions:n}=SB(e),{collapsedFiles:r}=t.diffOptions,i=w.useCallback(l=>{const u=r.includes(l);n({collapsedFiles:u?r.filter(d=>d!==l):[...r,l]})},[r,n]),a=w.useCallback(l=>{n({collapsedFiles:l})},[n]),s=w.useCallback(()=>{n({collapsedFiles:[]})},[n]),o=w.useCallback(l=>r.includes(l),[r]);return{options:t.diffOptions,setOption:(l,u)=>{n({[l]:u})},setOptions:n,toggleFileCollapse:i,collapseAll:a,expandAll:s,isFileCollapsed:o}}function Sgt(e){const t=[];let n=null,r=0,i=0;for(const a of e.split(`
|
|
126
126
|
`))if(a.startsWith("diff --git"))n={path:a.match(/diff --git a\/(.+?) b\//)?.[1]??"unknown",lines:[],additions:0,deletions:0},t.push(n),n.lines.push({type:"header",content:a});else if(a.startsWith("index ")||a.startsWith("---")||a.startsWith("+++"))n?.lines.push({type:"header",content:a});else if(a.startsWith("@@")){const s=a.match(/@@ -(\d+),?\d* \+(\d+),?\d* @@/);s&&(r=parseInt(s[1],10),i=parseInt(s[2],10)),n?.lines.push({type:"hunk",content:a})}else a.startsWith("+")?n&&(n.additions++,n.lines.push({type:"added",content:a.slice(1),newLineNumber:i++})):a.startsWith("-")?n&&(n.deletions++,n.lines.push({type:"removed",content:a.slice(1),oldLineNumber:r++})):a.startsWith(" ")&&n?.lines.push({type:"context",content:a.slice(1),oldLineNumber:r++,newLineNumber:i++});return t}function wgt({file:e,wrap:t,isCollapsed:n,onToggle:r}){return f.jsxs(g9,{open:!n,onOpenChange:()=>r(),children:[f.jsx(b9,{asChild:!0,children:f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-card border-b border-border cursor-pointer hover:bg-muted select-none",children:[f.jsx(re,{icon:n?$u:gd,size:12,strokeWidth:2,className:"text-muted-foreground shrink-0"}),f.jsx("span",{className:"font-mono text-xs text-foreground truncate flex-1",children:e.path}),f.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[e.additions>0&&f.jsxs("span",{className:"text-accent",children:["+",e.additions]}),e.additions>0&&e.deletions>0&&" ",e.deletions>0&&f.jsxs("span",{className:"text-destructive",children:["-",e.deletions]})]})]})}),f.jsx(y9,{children:f.jsx("div",{className:"font-mono text-xs",children:e.lines.slice(1).map((i,a)=>f.jsxs("div",{className:Ne("flex px-2 py-0.5",i.type==="added"&&"bg-accent/10",i.type==="removed"&&"bg-destructive/10",i.type==="header"&&"bg-muted/50 text-muted-foreground",i.type==="hunk"&&"bg-accent/10 text-accent"),children:[(i.type==="added"||i.type==="removed"||i.type==="context")&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"w-10 shrink-0 select-none pr-2 text-right text-muted-foreground",children:i.oldLineNumber??""}),f.jsx("span",{className:"w-10 shrink-0 select-none pr-2 text-right text-muted-foreground",children:i.newLineNumber??""})]}),f.jsxs("span",{className:Ne("w-4 shrink-0 select-none text-center",i.type==="added"&&"text-accent",i.type==="removed"&&"text-destructive"),children:[i.type==="added"&&"+",i.type==="removed"&&"-"]}),f.jsx("span",{className:Ne("flex-1",t?"whitespace-pre-wrap break-all":"whitespace-pre",i.type==="added"&&"text-accent",i.type==="removed"&&"text-destructive"),children:i.content})]},a))})})]})}function Xae({taskId:e,worktreePath:t,baseBranch:n}){const{options:r,setOption:i,toggleFileCollapse:a,collapseAll:s,expandAll:o,isFileCollapsed:l}=Egt(e),{wrap:u,ignoreWhitespace:d,includeUntracked:c,collapsedFiles:p}=r,{data:m,isLoading:x,error:_}=cMe(t,{ignoreWhitespace:d,includeUntracked:c,baseBranch:n}),b=w.useMemo(()=>m?.diff?Sgt(m.diff):[],[m?.diff]),v=w.useMemo(()=>b.map(C=>C.path),[b]),y=b.length>0&&p.length===b.length,E=w.useMemo(()=>b.reduce((C,O)=>C+O.additions,0),[b]),T=w.useMemo(()=>b.reduce((C,O)=>C+O.deletions,0),[b]);if(w.useEffect(()=>{const C=O=>{if(O.shiftKey&&O.key==="C"&&!O.ctrlKey&&!O.metaKey&&!O.altKey){const A=O.target;if(A.tagName==="INPUT"||A.tagName==="TEXTAREA"||A.isContentEditable)return;O.preventDefault(),y?o():s(v)}};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[y,v,s,o]),!t)return f.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"No worktree selected"});if(x)return f.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Loading diff..."});if(_)return f.jsx("div",{className:"flex h-full items-center justify-center text-destructive text-sm",children:_.message});const k=m?.files?.some(C=>C.status==="untracked")??!1;return b.length===0?f.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-muted-foreground text-sm gap-2",children:[f.jsx("p",{children:"No changes detected"}),m?.files&&m.files.length>0&&f.jsxs("div",{className:"text-xs",children:[f.jsx("p",{className:"text-center mb-2",children:"Modified files:"}),f.jsxs("div",{className:"flex flex-col gap-1",children:[m.files.map(C=>f.jsxs("div",{className:"flex gap-2",children:[f.jsxs("span",{className:Ne("w-4 text-center",C.status==="added"&&"text-accent",C.status==="deleted"&&"text-destructive",C.status==="modified"&&"text-muted-foreground",C.status==="untracked"&&"text-muted-foreground"),children:[C.status==="added"&&"A",C.status==="deleted"&&"D",C.status==="modified"&&"M",C.status==="untracked"&&"?"]}),f.jsx("span",{children:C.path})]},C.path)),k&&f.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-muted-foreground hover:text-foreground mt-1",children:[f.jsx("input",{type:"checkbox",checked:c,onChange:C=>i("includeUntracked",C.target.checked),className:"w-4 h-3"}),f.jsx("span",{children:"Show untracked files"})]})]})]})]}):f.jsxs("div",{className:"flex flex-col h-full bg-background",children:[f.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-card border-b border-border text-xs",children:[m?.branch&&f.jsxs("span",{className:"text-muted-foreground",children:[m.branch,m.isBranchDiff&&m.baseBranch&&f.jsxs("span",{className:"opacity-70",children:[" (vs ",m.baseBranch,")"]})]}),(E>0||T>0)&&f.jsxs("span",{className:"text-muted-foreground",children:[f.jsxs("span",{className:"text-accent",children:["+",E]})," ",f.jsxs("span",{className:"text-destructive",children:["-",T]})]}),f.jsx("div",{className:"flex-1"}),f.jsxs("button",{onClick:()=>y?o():s(v),className:"flex items-center gap-1 px-1.5 py-0.5 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:y?"Expand all (Shift+C)":"Collapse all (Shift+C)",children:[f.jsx(re,{icon:y?Hce:Fce,size:12,strokeWidth:2}),f.jsx("span",{className:"hidden sm:inline",children:y?"Expand":"Collapse"})]}),f.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[f.jsx("input",{type:"checkbox",checked:u,onChange:C=>i("wrap",C.target.checked),className:"w-3 h-3"}),"Wrap"]}),f.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[f.jsx("input",{type:"checkbox",checked:d,onChange:C=>i("ignoreWhitespace",C.target.checked),className:"w-3 h-3"}),"Ignore whitespace"]}),f.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[f.jsx("input",{type:"checkbox",checked:c,onChange:C=>i("includeUntracked",C.target.checked),className:"w-3 h-3"}),"Untracked"]})]}),f.jsx(sm,{className:"flex-1 min-h-0",children:b.map(C=>f.jsx(wgt,{file:C,wrap:u,isCollapsed:l(C.path),onToggle:()=>a(C.path)},C.path))})]})}function Cgt(e){const{viewState:t,setBrowserUrl:n}=SB(e);return{url:t.browserUrl,setUrl:n}}function Zae({taskId:e}){const{url:t,setUrl:n}=Cgt(e),[r,i]=w.useState(t),[a,s]=w.useState(0);w.useEffect(()=>{i(t)},[t]);const o=w.useCallback(()=>{s(u=>u+1)},[]),l=w.useCallback(u=>{u.preventDefault();let d=r.trim();!d.startsWith("http://")&&!d.startsWith("https://")&&(d=`http://${d}`),n(d),s(c=>c+1)},[r,n]);return f.jsxs("div",{className:"flex h-full flex-col bg-background",children:[f.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card px-2 py-1.5",children:[f.jsx(Te,{variant:"ghost",size:"icon-xs",disabled:!0,children:f.jsx(re,{icon:rd,size:14,strokeWidth:2})}),f.jsx(Te,{variant:"ghost",size:"icon-xs",disabled:!0,children:f.jsx(re,{icon:$u,size:14,strokeWidth:2})}),f.jsx(Te,{variant:"ghost",size:"icon-xs",onClick:o,children:f.jsx(re,{icon:iA,size:14,strokeWidth:2})}),f.jsx("form",{onSubmit:l,className:"flex-1",children:f.jsx($t,{value:r,onChange:u=>i(u.target.value),className:"h-7 bg-background text-xs",placeholder:"Enter URL..."})})]}),f.jsx("div",{className:"flex-1 overflow-hidden bg-card",children:f.jsx("iframe",{src:t,className:"h-full w-full border-0",title:"Browser Preview",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups"},a)})]})}const Tgt="";function Qae(e){const t=[];function n(r){for(const i of r)t.push(`${i.type}:${i.path}`),i.children&&n(i.children)}return n(e),t.sort().join("|")}function kgt({worktreePath:e,currentTree:t,onTreeChanged:n,pollInterval:r=5e3,enabled:i=!0}){const a=w.useRef(null),s=w.useRef(null),o=w.useRef(n);w.useEffect(()=>{o.current=n},[n]),w.useEffect(()=>{t&&(s.current=Qae(t))},[t]);const l=w.useCallback(async()=>{if(e)try{const u=await ft(`${Tgt}/api/fs/tree?root=${encodeURIComponent(e)}`),d=Qae(u.entries);s.current!==null&&d!==s.current&&(s.current=d,o.current(u.entries))}catch{}},[e]);w.useEffect(()=>{if(!i||!e||!t){a.current&&(clearInterval(a.current),a.current=null);return}return a.current=setInterval(l,r),()=>{a.current&&(clearInterval(a.current),a.current=null)}},[i,e,t,r,l]),w.useEffect(()=>{s.current=null},[e])}function Agt(e){const t=[];function n(r){for(const i of r)i.type==="file"?t.push({name:i.name,path:i.path}):i.children&&n(i.children)}return n(e),t}function r1e(e){const t=e.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","svg","webp","ico"].includes(t)?NNe:["ts","tsx","js","jsx","json","css","html","md","yaml","yml","toml","sh","py","rs","go","sql"].includes(t)?ENe:Dce}function i1e({entry:e,depth:t,selectedFile:n,expandedDirs:r,onSelectFile:i,onToggleDir:a}){const s=r.includes(e.path),o=n===e.path,l=e.type==="directory",u=w.useCallback(()=>{l?a(e.path):i(e.path)},[l,e.path,i,a]);return f.jsxs("div",{children:[f.jsxs("div",{className:Ne("flex items-center gap-1.5 px-2 py-0.5 cursor-pointer text-sm hover:bg-muted/50",o&&"bg-primary/10 text-primary"),style:{paddingLeft:`${t*12+8}px`},onClick:u,children:[f.jsx(re,{icon:l?s?Kj:Ya:r1e(e.name),size:14,strokeWidth:2,className:Ne("shrink-0",l?"text-accent":"text-muted-foreground")}),f.jsx("span",{className:"break-all",children:e.name})]}),l&&s&&e.children&&f.jsx("div",{children:e.children.map(d=>f.jsx(i1e,{entry:d,depth:t+1,selectedFile:n,expandedDirs:r,onSelectFile:i,onToggleDir:a},d.path))})]})}function Ogt({entries:e,selectedFile:t,expandedDirs:n,onSelectFile:r,onToggleDir:i,onCollapseAll:a}){const{t:s}=Nt("repositories"),[o,l]=w.useState(""),u=w.useMemo(()=>Agt(e),[e]),d=w.useMemo(()=>{if(!o.trim())return null;const p=o.trim();return u.map(m=>({...m,score:Math.max(Cs(m.name,p),Cs(m.path,p))})).filter(m=>m.score>0).sort((m,x)=>x.score-m.score)},[u,o]),c=w.useCallback(()=>{l("")},[]);return e.length===0?f.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:s("detailView.fileTree.noFiles")}):f.jsxs("div",{className:"flex flex-col h-full bg-background",children:[f.jsxs("div",{className:"flex shrink-0 items-center justify-between px-2 py-1 border-b border-border bg-card",children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:s("detailView.fileTree.title")}),f.jsx("button",{onClick:a,className:"p-1 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:s("detailView.fileTree.collapseAll"),children:f.jsx(re,{icon:Fce,size:14,strokeWidth:2})})]}),f.jsx("div",{className:"shrink-0 px-2 py-1.5 border-b border-border bg-card",children:f.jsxs("div",{className:"relative",children:[f.jsx("input",{type:"text",value:o,onChange:p=>l(p.target.value),placeholder:s("detailView.fileTree.searchPlaceholder"),className:"w-full text-sm bg-muted/50 border border-border rounded px-2 py-1 pr-7 placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),o&&f.jsx("button",{onClick:c,className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-muted-foreground hover:text-foreground rounded hover:bg-muted",children:f.jsx(re,{icon:Bn,size:12,strokeWidth:2})})]})}),f.jsx("div",{className:"py-1 flex-1 overflow-auto",children:d?d.length>0?d.map(p=>f.jsxs("div",{className:Ne("flex items-center gap-1.5 px-2 py-0.5 cursor-pointer text-sm hover:bg-muted/50",t===p.path&&"bg-primary/10 text-primary"),onClick:()=>r(p.path),children:[f.jsx(re,{icon:r1e(p.name),size:14,strokeWidth:2,className:"shrink-0 text-muted-foreground"}),f.jsx("span",{className:"truncate",title:p.path,children:p.name}),f.jsx("span",{className:"text-xs text-muted-foreground truncate ml-auto",children:p.path.split("/").slice(0,-1).join("/")})]},p.path)):f.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No matching files"}):e.map(p=>f.jsx(i1e,{entry:p,depth:0,selectedFile:t,expandedDirs:n,onSelectFile:r,onToggleDir:i},p.path))})]})}const Rgt="";function Ngt({worktreePath:e,filePath:t,currentMtime:n,isDirty:r,pollInterval:i=3e3,enabled:a=!0}){const[s,o]=w.useState(!1),l=w.useRef(null),u=w.useRef(null),d=w.useCallback(async()=>{if(!(!e||!t||!n))try{const p=new URLSearchParams({path:t,root:e}),m=await ft(`${Rgt}/api/fs/file-stat?${p}`);m.exists&&m.mtime!==n&&u.current!==m.mtime&&(u.current=m.mtime,o(!0))}catch{}},[e,t,n]);w.useEffect(()=>{if(!a||!t||!n){l.current&&(clearInterval(l.current),l.current=null);return}u.current=null;const p=setTimeout(d,500);return l.current=setInterval(d,i),()=>{clearTimeout(p),l.current&&(clearInterval(l.current),l.current=null)}},[a,t,n,i,d]),w.useEffect(()=>{o(!1),u.current=null},[t]);const c=w.useCallback(()=>{o(!1)},[]);return{hasExternalChange:s,isConflict:s&&r,resetExternalChange:c}}function Jae(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Igt(e){if(Array.isArray(e))return e}function Dgt(e,t,n){return(t=$gt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lgt(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,s,o=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(l=(r=a.call(n)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function Pgt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
127
127
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ese(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tse(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ese(Object(n),!0).forEach(function(r){Dgt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ese(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Mgt(e,t){if(e==null)return{};var n,r,i=jgt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function jgt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Fgt(e,t){return Igt(e)||Lgt(e,t)||Ugt(e,t)||Pgt()}function Bgt(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $gt(e){var t=Bgt(e,"string");return typeof t=="symbol"?t:t+""}function Ugt(e,t){if(e){if(typeof e=="string")return Jae(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jae(e,t):void 0}}function zgt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nse(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rse(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nse(Object(n),!0).forEach(function(r){zgt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nse(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Hgt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(i,a){return a(i)},r)}}function R0(e){return function t(){for(var n=this,r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return i.length>=e.length?e.apply(this,i):function(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];return t.apply(n,[].concat(i,o))}}}function ek(e){return{}.toString.call(e).includes("Object")}function Wgt(e){return!Object.keys(e).length}function Dx(e){return typeof e=="function"}function Vgt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function qgt(e,t){return ek(t)||jf("changeType"),Object.keys(t).some(function(n){return!Vgt(e,n)})&&jf("changeField"),t}function Ggt(e){Dx(e)||jf("selectorType")}function Ygt(e){Dx(e)||ek(e)||jf("handlerType"),ek(e)&&Object.values(e).some(function(t){return!Dx(t)})&&jf("handlersType")}function Kgt(e){e||jf("initialIsRequired"),ek(e)||jf("initialType"),Wgt(e)&&jf("initialContent")}function Xgt(e,t){throw new Error(e[t]||e.default)}var Zgt={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},jf=R0(Xgt)(Zgt),dw={changes:qgt,selector:Ggt,handler:Ygt,initial:Kgt};function Qgt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};dw.initial(e),dw.handler(t);var n={current:e},r=R0(tbt)(n,t),i=R0(ebt)(n),a=R0(dw.changes)(e),s=R0(Jgt)(n);function o(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return dw.selector(u),u(n.current)}function l(u){Hgt(r,i,a,s)(u)}return[o,l]}function Jgt(e,t){return Dx(t)?t(e.current):t}function ebt(e,t){return e.current=rse(rse({},e.current),t),t}function tbt(e,t,n){return Dx(t)?t(e.current):Object.keys(n).forEach(function(r){var i;return(i=t[r])===null||i===void 0?void 0:i.call(t,e.current[r])}),n}var nbt={create:Qgt},rbt={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function ibt(e){return function t(){for(var n=this,r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return i.length>=e.length?e.apply(this,i):function(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];return t.apply(n,[].concat(i,o))}}}function abt(e){return{}.toString.call(e).includes("Object")}function sbt(e){return e||ise("configIsRequired"),abt(e)||ise("configType"),e.urls?(obt(),{paths:{vs:e.urls.monacoBase}}):e}function obt(){console.warn(a1e.deprecation)}function lbt(e,t){throw new Error(e[t]||e.default)}var a1e={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
128
128
|
You are using deprecated way of configuration.
|
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/png" href="/logo.png" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Project Fulcrum</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-fIJu9jIH.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-_aUlx8a1.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|