coder-config 0.43.25 → 0.43.26

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/lib/constants.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Constants and tool path configurations
3
3
  */
4
4
 
5
- const VERSION = '0.43.25';
5
+ const VERSION = '0.43.26';
6
6
 
7
7
  // Tool-specific path configurations
8
8
  const TOOL_PATHS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coder-config",
3
- "version": "0.43.25",
3
+ "version": "0.43.26",
4
4
  "description": "Configuration manager for AI coding tools - Claude Code, Gemini CLI, Codex CLI, Antigravity. Manage MCPs, rules, permissions, memory, and workstreams.",
5
5
  "author": "regression.io",
6
6
  "main": "config-loader.js",
@@ -580,7 +580,7 @@ WARNING: This link could potentially be dangerous`)){const v=window.open();if(v)
580
580
  `)},N.onerror=M=>{console.error("Terminal WebSocket error:",M),g.write(`\r
581
581
  \x1B[31m[Connection error]\x1B[0m\r
582
582
  `)},g.onData(M=>{N.readyState===WebSocket.OPEN&&N.send(JSON.stringify({type:"input",data:M}))}),g.onResize(({cols:M,rows:I})=>{N.readyState===WebSocket.OPEN&&N.send(JSON.stringify({type:"resize",cols:M,rows:I}))})},[e,t,n,o,s]);C.useEffect(()=>{const g=()=>{f.current&&c.current&&f.current.fit()};window.addEventListener("resize",g);const y=new ResizeObserver(g);return l.current&&y.observe(l.current),()=>{window.removeEventListener("resize",g),y.disconnect()}},[]),C.useCallback(g=>{m.current&&m.current.readyState===WebSocket.OPEN&&m.current.send(JSON.stringify({type:"input",data:g+"\r"}))},[]),C.useCallback(()=>{m.current&&m.current.readyState===WebSocket.OPEN&&m.current.send(JSON.stringify({type:"kill"}))},[]);const b=C.useCallback(()=>{c.current&&c.current.focus()},[]);C.useCallback(()=>{c.current&&c.current.clear()},[]);const v=C.useCallback(()=>{if(c.current){const y=c.current.buffer.active;let k="";for(let E=0;E<y.length;E++){const P=y.getLine(E);P&&(k+=P.translateToString(!0)+`
583
- `)}navigator.clipboard.writeText(k.trim()).then(()=>{const E=document.getElementById("terminal-copy-btn");E&&(E.classList.add("bg-green-600"),setTimeout(()=>E.classList.remove("bg-green-600"),500))})}},[]);return r.jsxs("div",{className:`relative ${d}`,style:{height:u},children:[r.jsxs("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-2",children:[r.jsx("button",{id:"terminal-copy-btn",onClick:v,className:"px-2 py-1 text-xs bg-gray-700 hover:bg-gray-600 text-gray-300 rounded transition-colors",title:"Copy terminal output",children:"Copy"}),r.jsx("div",{className:`w-2 h-2 rounded-full ${h?"bg-green-500":"bg-red-500"}`}),r.jsx("span",{className:"text-xs text-gray-400",children:h?"Connected":"Disconnected"})]}),r.jsx("div",{ref:l,className:"w-full h-full rounded-lg overflow-hidden",style:{backgroundColor:"#1e1e1e"},onClick:b})]})}Vu.sendCommand=(e,t)=>{e&&e.sendCommand&&e.sendCommand(t)};function yj({open:e,onOpenChange:t,title:n="Terminal",description:s,cwd:o,initialCommand:d,env:u={},onExit:l,autoCloseOnExit:c=!1,autoCloseDelay:f=1500}){const m=C.useRef(null),[h,x]=C.useState(!1);C.useEffect(()=>{e&&x(!1)},[e]);const w=C.useCallback((v,g)=>{x(!0),l&&l(v,g),c&&setTimeout(()=>{t(!1)},f)},[l,c,f,t]),j=C.useCallback(v=>{v.preventDefault()},[]),_=C.useCallback(v=>{},[]),b=C.useCallback(v=>{v.key!=="Escape"&&v.stopPropagation()},[]);return r.jsx(JS,{open:e,onOpenChange:t,children:r.jsxs(jg,{children:[r.jsx(Eu,{className:"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),r.jsxs(Pu,{className:Te("fixed left-[50%] top-[50%] z-50 translate-x-[-50%] translate-y-[-50%]","max-w-4xl w-full h-[600px] flex flex-col p-0 gap-0","border bg-background shadow-lg sm:rounded-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),onOpenAutoFocus:j,onEscapeKeyDown:_,onKeyDown:b,children:[r.jsx("div",{className:"px-4 py-3 border-b flex-shrink-0",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Au,{className:"text-lg font-semibold leading-none tracking-tight",children:n}),s&&r.jsx(Tu,{className:"text-sm text-muted-foreground mt-1",children:s})]}),r.jsx(se,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>t(!1),tabIndex:-1,children:r.jsx($s,{className:"h-4 w-4"})})]})}),r.jsx("div",{ref:m,className:"flex-1 p-2 min-h-0",children:e&&r.jsx(Vu,{cwd:o,initialCommand:d,env:u,onExit:w,height:"100%",className:"h-full"})})]})]})})}const Dl={mcps:{icon:kn,color:"text-blue-600",bgColor:"bg-blue-50",label:"MCP Servers"},settings:{icon:zn,color:"text-gray-600 dark:text-slate-400",bgColor:"bg-gray-50 dark:bg-slate-800",label:"Settings"},command:{icon:Ft,color:"text-green-600",bgColor:"bg-green-50",label:"Command"},rule:{icon:Xi,color:"text-purple-600",bgColor:"bg-purple-50",label:"Rule"},workflow:{icon:BC,color:"text-cyan-600",bgColor:"bg-cyan-50",label:"Workflow"},claudemd:{icon:Er,color:"text-orange-600",bgColor:"bg-orange-50",label:"CLAUDE.md"},geminimd:{icon:Er,color:"text-blue-600",bgColor:"bg-blue-50",label:"GEMINI.md"},env:{icon:vu,color:"text-yellow-600",bgColor:"bg-yellow-50",label:".env"},memory:{icon:Ji,color:"text-pink-600",bgColor:"bg-pink-50",label:"Memory"},folder:{icon:Dr,color:"text-yellow-600",bgColor:"bg-yellow-50",label:"Folder"}};function Bd({item:e,level:t=0,selectedPath:n,onSelect:s,onContextMenu:o,expandedFolders:d,onToggleFolder:u}){const l=Dl[e.type]||Dl.folder,c=l.icon,f=n===e.path,m=e.type==="folder",h=d[e.path];return r.jsxs("div",{children:[r.jsxs("div",{className:Te("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm","hover:bg-gray-100 dark:hover:bg-slate-700 transition-colors",f&&"bg-blue-100 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/30"),style:{paddingLeft:`${t*16+8}px`},onClick:()=>m?u(e.path):s(e),onContextMenu:x=>o(x,e),children:[m&&r.jsx("span",{className:"w-4 h-4 flex items-center justify-center",children:h?r.jsx(pr,{className:"w-3 h-3"}):r.jsx(Xr,{className:"w-3 h-3"})}),!m&&r.jsx("span",{className:"w-4"}),r.jsx(c,{className:Te("w-4 h-4",l.color)}),r.jsx("span",{className:"flex-1 truncate",children:e.name}),e.mcpCount>0&&r.jsx(Ze,{variant:"secondary",className:"text-xs px-1.5 py-0",children:e.mcpCount})]}),m&&h&&e.children&&r.jsx("div",{children:e.children.map(x=>r.jsx(Bd,{item:x,level:t+1,selectedPath:n,onSelect:s,onContextMenu:o,expandedFolders:d,onToggleFolder:u},x.path))})]})}function QF({folder:e,isExpanded:t,isHome:n,isProject:s,isSubproject:o,depth:d=0,onToggle:u,onCreateFile:l,onInstallPlugin:c,onSelectItem:f,selectedPath:m,onContextMenu:h,expandedFolders:x,onToggleFolder:w,hasSubprojects:j,onAddSubproject:_,onRemoveSubproject:b,onHideSubproject:v,enabledTools:g=["claude"]}){var z,q,H,G,J,K,F;const y=(z=e.files)==null?void 0:z.some(R=>R.name==="mcps.json"),k=(q=e.files)==null?void 0:q.some(R=>R.name==="settings.json"),E=(H=e.files)==null?void 0:H.some(R=>R.name==="CLAUDE.md"||R.name==="CLAUDE.md (root)"),P=(G=e.files)==null?void 0:G.some(R=>R.name===".env"),T=()=>n?"bg-indigo-50 dark:bg-indigo-900/20 hover:bg-indigo-100 dark:hover:bg-indigo-900/30":o&&d>1?"bg-gray-50 dark:bg-slate-800 hover:bg-gray-100 dark:hover:bg-slate-700":o?"bg-amber-50 dark:bg-amber-900/20 hover:bg-amber-100 dark:hover:bg-amber-900/30":s?"bg-green-50 dark:bg-green-900/20 hover:bg-green-100 dark:hover:bg-green-900/30":"bg-gray-50 dark:bg-slate-800 hover:bg-gray-100 dark:hover:bg-slate-700",N=()=>n?"text-indigo-700 dark:text-indigo-400":o&&d>1?"text-gray-600 dark:text-slate-400":o?"text-amber-700 dark:text-amber-400":s?"text-green-700 dark:text-green-400":"text-gray-700 dark:text-slate-300",I=n?fg:t?_i:Dr,O=n?"Home":e.label,B=(g.includes("claude")&&((J=e.files)==null?void 0:J.length)||0)+(g.includes("gemini")&&((K=e.geminiFiles)==null?void 0:K.length)||0)+(g.includes("antigravity")&&((F=e.agentFiles)==null?void 0:F.length)||0);return r.jsxs("div",{className:"border-b border-gray-200 dark:border-slate-700",children:[r.jsxs("div",{className:Te("flex items-center gap-2 py-2 cursor-pointer transition-colors",T()),style:{paddingLeft:`${12+d*16}px`,paddingRight:"24px"},onClick:u,children:[r.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-gray-500",children:t?r.jsx(pr,{className:"w-4 h-4"}):r.jsx(Xr,{className:"w-4 h-4"})}),r.jsx(I,{className:Te("w-4 h-4",N())}),r.jsx("span",{className:Te("flex-1 min-w-0 font-medium text-sm truncate",N()),children:O}),r.jsxs(Ks,{children:[r.jsx(qs,{asChild:!0,onClick:R=>R.stopPropagation(),children:r.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 flex-shrink-0 mr-1 hover:bg-white/50 dark:hover:bg-slate-900/50",children:r.jsx(kt,{className:"w-4 h-4"})})}),r.jsxs(Cs,{align:"end",className:"w-48",children:[r.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b mb-1",children:[s&&j&&r.jsx(Ze,{variant:"outline",className:"text-[10px] px-1 py-0 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 border-green-300 dark:border-green-700",children:"root"}),!e.exists&&!n&&r.jsx(Ze,{variant:"outline",className:"text-[10px] px-1 py-0",children:"no config"}),!o&&e.exists&&B===0&&r.jsx("span",{className:"text-[10px] text-muted-foreground",children:"configured"})]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"mcps")},disabled:y,className:y?"opacity-50":"",children:[r.jsx(kn,{className:"w-4 h-4 mr-2"}),"mcps.json",y&&r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"settings")},disabled:k,className:k?"opacity-50":"",children:[r.jsx(zn,{className:"w-4 h-4 mr-2"}),"settings.json",k&&r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"env")},disabled:P,className:P?"opacity-50":"",children:[r.jsx(vu,{className:"w-4 h-4 mr-2"}),".env",P&&r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),r.jsx(Yr,{}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"command")},children:[r.jsx(Ft,{className:"w-4 h-4 mr-2"}),"New Command"]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"rule")},children:[r.jsx(Xi,{className:"w-4 h-4 mr-2"}),"New Rule"]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"workflow")},children:[r.jsx(BC,{className:"w-4 h-4 mr-2"}),"New Workflow"]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"memory")},children:[r.jsx(Ji,{className:"w-4 h-4 mr-2"}),"New Memory"]}),r.jsx(Yr,{}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),c(e.dir,e.name||e.dir.split("/").pop())},children:[r.jsx(eo,{className:"w-4 h-4 mr-2"}),"Install Plugins"]}),r.jsx(Yr,{}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"claudemd")},disabled:E,className:E?"opacity-50":"",children:[r.jsx(Er,{className:"w-4 h-4 mr-2"}),"CLAUDE.md",E&&r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),(s||o)&&_&&r.jsxs(r.Fragment,{children:[r.jsx(Yr,{}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),_(e.dir)},children:[r.jsx(Bs,{className:"w-4 h-4 mr-2"}),"Add Sub-project"]})]}),o&&v&&r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),v(e.dir)},children:[r.jsx(FC,{className:"w-4 h-4 mr-2"}),"Hide"]}),e.isManual&&b&&r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),b(e.dir)},className:"text-destructive focus:text-destructive",children:[r.jsx(un,{className:"w-4 h-4 mr-2"}),"Remove"]})]})]})]}),t&&r.jsxs("div",{className:"bg-white dark:bg-slate-950 py-1",children:[g.includes("claude")&&e.files&&e.files.length>0&&r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-orange-600 dark:text-orange-400 uppercase tracking-wide flex items-center gap-1",children:[r.jsx(Yt,{className:"w-3 h-3"}),"Claude Code"]}),e.files.map(R=>r.jsx(Bd,{item:R,selectedPath:m,onSelect:f,onContextMenu:h,expandedFolders:x,onToggleFolder:w},R.path))]}),g.includes("gemini")&&e.geminiFiles&&e.geminiFiles.length>0&&r.jsxs("div",{className:"mb-1 border-t border-dashed border-gray-200 dark:border-slate-700 pt-1",children:[r.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wide flex items-center gap-1",children:[r.jsx(Yt,{className:"w-3 h-3"}),"Gemini CLI"]}),e.geminiFiles.map(R=>r.jsx(Bd,{item:R,selectedPath:m,onSelect:f,onContextMenu:h,expandedFolders:x,onToggleFolder:w},R.path))]}),g.includes("antigravity")&&e.agentFiles&&e.agentFiles.length>0&&r.jsxs("div",{className:"mb-1 border-t border-dashed border-gray-200 dark:border-slate-700 pt-1",children:[r.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-purple-600 dark:text-purple-400 uppercase tracking-wide flex items-center gap-1",children:[r.jsx(Yt,{className:"w-3 h-3"}),"Antigravity"]}),e.agentFiles.map(R=>r.jsx(Bd,{item:R,selectedPath:m,onSelect:f,onContextMenu:h,expandedFolders:x,onToggleFolder:w},R.path))]}),(!g.includes("claude")||!e.files||e.files.length===0)&&(!g.includes("gemini")||!e.geminiFiles||e.geminiFiles.length===0)&&(!g.includes("antigravity")||!e.agentFiles||e.agentFiles.length===0)&&r.jsx("div",{className:"px-4 py-3 text-sm text-gray-400 dark:text-slate-500 italic text-center",children:"No config files. Use + to create."})]})]})}const xt=C.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:Te("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));xt.displayName="Textarea";var Gu="Tabs",[ZF]=hn(Gu,[zu]),bj=zu(),[eB,ex]=ZF(Gu),wj=C.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:d,orientation:u="horizontal",dir:l,activationMode:c="automatic",...f}=e,m=Gl(l),[h,x]=ws({prop:s,onChange:o,defaultProp:d??"",caller:Gu});return r.jsx(eB,{scope:n,baseId:Bn(),value:h,onValueChange:x,orientation:u,dir:m,activationMode:c,children:r.jsx(nt.div,{dir:m,"data-orientation":u,...f,ref:t})})});wj.displayName=Gu;var _j="TabsList",Cj=C.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,d=ex(_j,n),u=bj(n);return r.jsx(Ck,{asChild:!0,...u,orientation:d.orientation,dir:d.dir,loop:s,children:r.jsx(nt.div,{role:"tablist","aria-orientation":d.orientation,...o,ref:t})})});Cj.displayName=_j;var Sj="TabsTrigger",kj=C.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...d}=e,u=ex(Sj,n),l=bj(n),c=Ej(u.baseId,s),f=Pj(u.baseId,s),m=s===u.value;return r.jsx(Sk,{asChild:!0,...l,focusable:!o,active:m,children:r.jsx(nt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":f,"data-state":m?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...d,ref:t,onMouseDown:Oe(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?u.onValueChange(s):h.preventDefault()}),onKeyDown:Oe(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&u.onValueChange(s)}),onFocus:Oe(e.onFocus,()=>{const h=u.activationMode!=="manual";!m&&!o&&h&&u.onValueChange(s)})})})});kj.displayName=Sj;var jj="TabsContent",Nj=C.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:d,...u}=e,l=ex(jj,n),c=Ej(l.baseId,s),f=Pj(l.baseId,s),m=s===l.value,h=C.useRef(m);return C.useEffect(()=>{const x=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(x)},[]),r.jsx(Lr,{present:o||m,children:({present:x})=>r.jsx(nt.div,{"data-state":m?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!x,id:f,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:x&&d})})});Nj.displayName=jj;function Ej(e,t){return`${e}-trigger-${t}`}function Pj(e,t){return`${e}-content-${t}`}var tB=wj,Aj=Cj,Tj=kj,Rj=Nj;const Ku=tB,Zl=C.forwardRef(({className:e,...t},n)=>r.jsx(Aj,{ref:n,className:Te("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Zl.displayName=Aj.displayName;const ts=C.forwardRef(({className:e,...t},n)=>r.jsx(Tj,{ref:n,className:Te("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));ts.displayName=Tj.displayName;const zs=C.forwardRef(({className:e,...t},n)=>r.jsx(Rj,{ref:n,className:Te("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));zs.displayName=Rj.displayName;var rB=Symbol("radix.slottable");function nB(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=rB,t}var[qu]=hn("Tooltip",[fa]),Yu=fa(),Mj="TooltipProvider",sB=700,mp="tooltip.open",[iB,tx]=qu(Mj),Dj=e=>{const{__scopeTooltip:t,delayDuration:n=sB,skipDelayDuration:s=300,disableHoverableContent:o=!1,children:d}=e,u=C.useRef(!0),l=C.useRef(!1),c=C.useRef(0);return C.useEffect(()=>{const f=c.current;return()=>window.clearTimeout(f)},[]),r.jsx(iB,{scope:t,isOpenDelayedRef:u,delayDuration:n,onOpen:C.useCallback(()=>{window.clearTimeout(c.current),u.current=!1},[]),onClose:C.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>u.current=!0,s)},[s]),isPointerInTransitRef:l,onPointerInTransitChange:C.useCallback(f=>{l.current=f},[]),disableHoverableContent:o,children:d})};Dj.displayName=Mj;var Il="Tooltip",[oB,ec]=qu(Il),Ij=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:o,onOpenChange:d,disableHoverableContent:u,delayDuration:l}=e,c=tx(Il,e.__scopeTooltip),f=Yu(t),[m,h]=C.useState(null),x=Bn(),w=C.useRef(0),j=u??c.disableHoverableContent,_=l??c.delayDuration,b=C.useRef(!1),[v,g]=ws({prop:s,defaultProp:o??!1,onChange:T=>{T?(c.onOpen(),document.dispatchEvent(new CustomEvent(mp))):c.onClose(),d==null||d(T)},caller:Il}),y=C.useMemo(()=>v?b.current?"delayed-open":"instant-open":"closed",[v]),k=C.useCallback(()=>{window.clearTimeout(w.current),w.current=0,b.current=!1,g(!0)},[g]),E=C.useCallback(()=>{window.clearTimeout(w.current),w.current=0,g(!1)},[g]),P=C.useCallback(()=>{window.clearTimeout(w.current),w.current=window.setTimeout(()=>{b.current=!0,g(!0),w.current=0},_)},[_,g]);return C.useEffect(()=>()=>{w.current&&(window.clearTimeout(w.current),w.current=0)},[]),r.jsx(zg,{...f,children:r.jsx(oB,{scope:t,contentId:x,open:v,stateAttribute:y,trigger:m,onTriggerChange:h,onTriggerEnter:C.useCallback(()=>{c.isOpenDelayedRef.current?P():k()},[c.isOpenDelayedRef,P,k]),onTriggerLeave:C.useCallback(()=>{j?E():(window.clearTimeout(w.current),w.current=0)},[E,j]),onOpen:k,onClose:E,disableHoverableContent:j,children:n})})};Ij.displayName=Il;var pp="TooltipTrigger",Lj=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=ec(pp,n),d=tx(pp,n),u=Yu(n),l=C.useRef(null),c=ut(t,l,o.onTriggerChange),f=C.useRef(!1),m=C.useRef(!1),h=C.useCallback(()=>f.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),r.jsx(Hg,{asChild:!0,...u,children:r.jsx(nt.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...s,ref:c,onPointerMove:Oe(e.onPointerMove,x=>{x.pointerType!=="touch"&&!m.current&&!d.isPointerInTransitRef.current&&(o.onTriggerEnter(),m.current=!0)}),onPointerLeave:Oe(e.onPointerLeave,()=>{o.onTriggerLeave(),m.current=!1}),onPointerDown:Oe(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Oe(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:Oe(e.onBlur,o.onClose),onClick:Oe(e.onClick,o.onClose)})})});Lj.displayName=pp;var rx="TooltipPortal",[aB,lB]=qu(rx,{forceMount:void 0}),Oj=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:o}=e,d=ec(rx,t);return r.jsx(aB,{scope:t,forceMount:n,children:r.jsx(Lr,{present:n||d.open,children:r.jsx(ql,{asChild:!0,container:o,children:s})})})};Oj.displayName=rx;var sa="TooltipContent",Fj=C.forwardRef((e,t)=>{const n=lB(sa,e.__scopeTooltip),{forceMount:s=n.forceMount,side:o="top",...d}=e,u=ec(sa,e.__scopeTooltip);return r.jsx(Lr,{present:s||u.open,children:u.disableHoverableContent?r.jsx(Bj,{side:o,...d,ref:t}):r.jsx(cB,{side:o,...d,ref:t})})}),cB=C.forwardRef((e,t)=>{const n=ec(sa,e.__scopeTooltip),s=tx(sa,e.__scopeTooltip),o=C.useRef(null),d=ut(t,o),[u,l]=C.useState(null),{trigger:c,onClose:f}=n,m=o.current,{onPointerInTransitChange:h}=s,x=C.useCallback(()=>{l(null),h(!1)},[h]),w=C.useCallback((j,_)=>{const b=j.currentTarget,v={x:j.clientX,y:j.clientY},g=mB(v,b.getBoundingClientRect()),y=pB(v,g),k=gB(_.getBoundingClientRect()),E=vB([...y,...k]);l(E),h(!0)},[h]);return C.useEffect(()=>()=>x(),[x]),C.useEffect(()=>{if(c&&m){const j=b=>w(b,m),_=b=>w(b,c);return c.addEventListener("pointerleave",j),m.addEventListener("pointerleave",_),()=>{c.removeEventListener("pointerleave",j),m.removeEventListener("pointerleave",_)}}},[c,m,w,x]),C.useEffect(()=>{if(u){const j=_=>{const b=_.target,v={x:_.clientX,y:_.clientY},g=(c==null?void 0:c.contains(b))||(m==null?void 0:m.contains(b)),y=!xB(v,u);g?x():y&&(x(),f())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[c,m,u,f,x]),r.jsx(Bj,{...e,ref:d})}),[dB,uB]=qu(Il,{isInside:!1}),hB=nB("TooltipContent"),Bj=C.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":o,onEscapeKeyDown:d,onPointerDownOutside:u,...l}=e,c=ec(sa,n),f=Yu(n),{onClose:m}=c;return C.useEffect(()=>(document.addEventListener(mp,m),()=>document.removeEventListener(mp,m)),[m]),C.useEffect(()=>{if(c.trigger){const h=x=>{const w=x.target;w!=null&&w.contains(c.trigger)&&m()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,m]),r.jsx(Kl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:h=>h.preventDefault(),onDismiss:m,children:r.jsxs(Wg,{"data-state":c.stateAttribute,...f,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(hB,{children:s}),r.jsx(dB,{scope:n,isInside:!0,children:r.jsx(MO,{id:c.contentId,role:"tooltip",children:o||s})})]})})});Fj.displayName=sa;var $j="TooltipArrow",fB=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=Yu(n);return uB($j,n).isInside?null:r.jsx(Ug,{...o,...s,ref:t})});fB.displayName=$j;function mB(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),d=Math.abs(t.left-e.x);switch(Math.min(n,s,o,d)){case d:return"left";case o:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function pB(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function gB(e){const{top:t,right:n,bottom:s,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:s},{x:o,y:s}]}function xB(e,t){const{x:n,y:s}=e;let o=!1;for(let d=0,u=t.length-1;d<t.length;u=d++){const l=t[d],c=t[u],f=l.x,m=l.y,h=c.x,x=c.y;m>s!=x>s&&n<(h-f)*(s-m)/(x-m)+f&&(o=!o)}return o}function vB(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),yB(t)}function yB(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const o=e[s];for(;t.length>=2;){const d=t[t.length-1],u=t[t.length-2];if((d.x-u.x)*(o.y-u.y)>=(d.y-u.y)*(o.x-u.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const o=e[s];for(;n.length>=2;){const d=n[n.length-1],u=n[n.length-2];if((d.x-u.x)*(o.y-u.y)>=(d.y-u.y)*(o.x-u.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var bB=Dj,wB=Ij,_B=Lj,CB=Oj,zj=Fj;const kr=bB,Ut=wB,Vt=_B,Bt=C.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(CB,{children:r.jsx(zj,{ref:s,sideOffset:t,className:Te("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Bt.displayName=zj.displayName;function SB({content:e,parsed:t,onSave:n,registry:s,configDir:o}){const[d,u]=C.useState(t||{include:[],exclude:[],mcpServers:{}}),[l,c]=C.useState("rich"),[f,m]=C.useState(JSON.stringify(t||{},null,2)),[h,x]=C.useState(!1),[w,j]=C.useState({open:!1,json:""}),[_,b]=C.useState([]),[v,g]=C.useState(!1),[y,k]=C.useState(!1);C.useEffect(()=>{u(t||{include:[],exclude:[],mcpServers:{}}),m(JSON.stringify(t||{},null,2))},[t]),C.useEffect(()=>{o?ge.getInheritedMcps(o).then(B=>{b(B.inherited||[]),g(B.needsApply||!1)}).catch(()=>{b([]),g(!1)}):(b([]),g(!1))},[o,t]);const E=async B=>{x(!0);try{await n(JSON.stringify(B,null,2))}catch(z){X.error("Failed to save: "+z.message)}finally{x(!1)}},P=B=>{var H;const z=(H=d.include)!=null&&H.includes(B)?d.include.filter(G=>G!==B):[...d.include||[],B],q={...d,include:z};u(q),m(JSON.stringify(q,null,2)),E(q)},T=B=>{const z=d.exclude||[],q=z.includes(B),H=q?z.filter(J=>J!==B):[...z,B],G=H.length>0?{...d,exclude:H}:{...d};H.length===0&&delete G.exclude,u(G),m(JSON.stringify(G,null,2)),E(G),X.success(q?`Unblocked ${B}`:`Blocked ${B}`)},N=()=>{try{const B=JSON.parse(f);u(B),E(B)}catch{X.error("Invalid JSON")}},M=()=>{if(!w.json.trim()){X.error("Please paste the MCP JSON configuration");return}try{let B;try{B=JSON.parse(w.json)}catch{X.error("Invalid JSON format");return}let z={};if(B.mcpServers&&typeof B.mcpServers=="object")z=B.mcpServers;else if(typeof B=="object"&&!Array.isArray(B)){if(Object.keys(B).includes("command")){X.error('JSON is missing the MCP name. Expected: { "name": { "command": "...", "args": [...] } }');return}z=B}if(Object.keys(z).length===0){X.error("No MCP configurations found in the JSON");return}for(const[J,K]of Object.entries(z))if(!K.command){X.error(`MCP "${J}" is missing required "command" field`);return}const q={...d.mcpServers||{},...z},H={...d,mcpServers:q};u(H),m(JSON.stringify(H,null,2)),E(H);const G=Object.keys(z).length;X.success(`Added ${G} MCP${G>1?"s":""}`),j({open:!1,json:""})}catch(B){X.error("Failed to add: "+B.message)}},I=s!=null&&s.mcpServers?Object.keys(s.mcpServers):[],O=async()=>{if(o){k(!0);try{const B=await ge.applyCascade(o);if(B.success){const z=B.applied>1?`Applied to ${B.applied} projects`:"Generated .mcp.json";X.success(z),g(!1)}else B.applied===0&&B.skipped>0?(X.info("No changes needed"),g(!1)):X.error(B.error||"Failed to apply")}catch(B){X.error("Failed to apply: "+B.message)}finally{k(!1)}}};return r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border-b bg-gray-50 dark:bg-slate-800",children:[r.jsx(Ku,{value:l,onValueChange:c,children:r.jsxs(Zl,{className:"h-8",children:[r.jsx(ts,{value:"rich",className:"text-xs px-3",children:"Rich Editor"}),r.jsx(ts,{value:"json",className:"text-xs px-3",children:"JSON"})]})}),r.jsxs("div",{className:"flex gap-2 items-center",children:[h&&r.jsx(Ze,{variant:"outline",className:"text-xs text-blue-600",children:"Saving..."}),r.jsxs(se,{size:"sm",variant:"outline",onClick:()=>j({open:!0,json:""}),children:[r.jsx(kt,{className:"w-4 h-4 mr-1"}),"Add MCP"]}),l==="json"&&r.jsxs(se,{size:"sm",onClick:N,disabled:h,children:[r.jsx(En,{className:"w-4 h-4 mr-1"}),"Apply JSON"]})]})]}),v&&r.jsxs("div",{className:"mx-3 mt-3 p-3 rounded-lg bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Sn,{className:"w-4 h-4 text-amber-600"}),r.jsxs("span",{className:"text-sm text-amber-800 dark:text-amber-200",children:["No ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900 px-1 rounded",children:".mcp.json"})," generated yet. Apply to enable MCPs."]})]}),r.jsx(se,{size:"sm",variant:"outline",onClick:O,disabled:y,className:"border-amber-300 dark:border-amber-700 text-amber-700 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900",children:y?r.jsx("span",{className:"animate-pulse",children:"Applying..."}):r.jsxs(r.Fragment,{children:[r.jsx(Yi,{className:"w-3 h-3 mr-1"}),"Apply"]})})]}),r.jsx(Hn,{className:"flex-1",children:l==="rich"?r.jsx(kr,{children:r.jsxs("div",{className:"p-4 space-y-2",children:[Object.entries(d.mcpServers||{}).map(([B,z])=>{var q;return r.jsxs("div",{className:"p-2 rounded border bg-white dark:bg-slate-950 group",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(kn,{className:"w-4 h-4 text-green-500"}),r.jsx("span",{className:"text-sm font-medium",children:B})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ze,{variant:"outline",className:"text-xs",children:"inline"}),r.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 hover:bg-red-50",onClick:()=>{const{[B]:H,...G}=d.mcpServers,J={...d,mcpServers:G};u(J),m(JSON.stringify(J,null,2)),E(J),X.success(`Removed ${B}`)},children:r.jsx(un,{className:"w-3.5 h-3.5"})})]})]}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1 font-mono",children:[z.command," ",(q=z.args)==null?void 0:q.join(" ")]})]},`inline-${B}`)}),_.map(B=>{var q;const z=(q=d.exclude)==null?void 0:q.includes(B.name);return r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsxs("div",{className:`flex items-center justify-between p-2 rounded border ${z?"bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-800":"bg-gray-50 dark:bg-slate-900 border-gray-200 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(kn,{className:`w-4 h-4 ${z?"text-red-400":"text-gray-400"}`}),r.jsx("span",{className:`text-sm ${z?"text-red-500 line-through":"text-gray-500 dark:text-slate-400"}`,children:B.name}),r.jsxs(Ze,{variant:"outline",className:"text-[10px] text-gray-400 border-gray-300 dark:border-slate-600",children:["from ",B.source]})]}),r.jsx(ft,{checked:!z,onCheckedChange:()=>{z||X.warning(`Blocking "${B.name}" inherited from ${B.source}`),T(B.name)},className:"data-[state=checked]:bg-gray-400 dark:data-[state=checked]:bg-slate-600"})]})}),r.jsxs(Bt,{children:[r.jsxs("p",{children:["Inherited from ",r.jsx("strong",{children:B.source})]}),r.jsx("p",{className:"text-xs text-gray-400",children:z?"Blocked at this level":"Toggle off to block"})]})]},`inherited-${B.name}`)}),I.map(B=>{var H,G;const z=_.some(J=>J.name===B),q=(H=d.mcpServers)==null?void 0:H[B];return z||q?null:r.jsxs("div",{className:"flex items-center justify-between p-2 rounded border bg-white dark:bg-slate-950",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(kn,{className:"w-4 h-4 text-blue-500"}),r.jsx("span",{className:"text-sm",children:B})]}),r.jsx(ft,{checked:(G=d.include)==null?void 0:G.includes(B),onCheckedChange:()=>P(B)})]},B)}),I.length===0&&_.length===0&&Object.keys(d.mcpServers||{}).length===0&&r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:'No MCPs configured. Click "Add MCP" to add one.'})]})}):r.jsx(xt,{className:"w-full h-full min-h-[400px] font-mono text-sm border-0 rounded-none resize-none",value:f,onChange:B=>m(B.target.value)})}),r.jsx(_t,{open:w.open,onOpenChange:B=>j({...w,open:B}),children:r.jsxs(vt,{className:"bg-white dark:bg-slate-950 max-w-2xl",children:[r.jsxs(yt,{children:[r.jsx(bt,{children:"Add MCP to Config"}),r.jsx(er,{children:"Paste the MCP JSON configuration to add to this config file."})]}),r.jsxs("div",{className:"py-4",children:[r.jsx(xt,{value:w.json,onChange:B=>j({...w,json:B.target.value}),placeholder:`{
583
+ `)}navigator.clipboard.writeText(k.trim()).then(()=>{const E=document.getElementById("terminal-copy-btn");E&&(E.classList.add("bg-green-600"),setTimeout(()=>E.classList.remove("bg-green-600"),500))})}},[]);return r.jsxs("div",{className:`relative ${d}`,style:{height:u},children:[r.jsxs("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-2",children:[r.jsx("button",{id:"terminal-copy-btn",onClick:v,className:"px-2 py-1 text-xs bg-gray-700 hover:bg-gray-600 text-gray-300 rounded transition-colors",title:"Copy terminal output",children:"Copy"}),r.jsx("div",{className:`w-2 h-2 rounded-full ${h?"bg-green-500":"bg-red-500"}`}),r.jsx("span",{className:"text-xs text-gray-400",children:h?"Connected":"Disconnected"})]}),r.jsx("div",{ref:l,className:"w-full h-full rounded-lg overflow-hidden",style:{backgroundColor:"#1e1e1e"},onClick:b})]})}Vu.sendCommand=(e,t)=>{e&&e.sendCommand&&e.sendCommand(t)};function yj({open:e,onOpenChange:t,title:n="Terminal",description:s,cwd:o,initialCommand:d,env:u={},onExit:l,autoCloseOnExit:c=!1,autoCloseDelay:f=1500}){const m=C.useRef(null),[h,x]=C.useState(!1);C.useEffect(()=>{e&&x(!1)},[e]);const w=C.useCallback((v,g)=>{x(!0),l&&l(v,g),c&&setTimeout(()=>{t(!1)},f)},[l,c,f,t]),j=C.useCallback(v=>{v.preventDefault()},[]),_=C.useCallback(v=>{},[]),b=C.useCallback(v=>{v.key!=="Escape"&&v.stopPropagation()},[]);return r.jsx(JS,{open:e,onOpenChange:t,children:r.jsxs(jg,{children:[r.jsx(Eu,{className:"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),r.jsxs(Pu,{className:Te("fixed left-[50%] top-[50%] z-50 translate-x-[-50%] translate-y-[-50%]","max-w-4xl w-full h-[600px] flex flex-col p-0 gap-0","border bg-background shadow-lg sm:rounded-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),onOpenAutoFocus:j,onEscapeKeyDown:_,onKeyDown:b,children:[r.jsx("div",{className:"px-4 py-3 border-b flex-shrink-0",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Au,{className:"text-lg font-semibold leading-none tracking-tight",children:n}),s&&r.jsx(Tu,{className:"text-sm text-muted-foreground mt-1",children:s})]}),r.jsx(se,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>t(!1),tabIndex:-1,children:r.jsx($s,{className:"h-4 w-4"})})]})}),r.jsx("div",{ref:m,className:"flex-1 p-2 min-h-0",children:e&&r.jsx(Vu,{cwd:o,initialCommand:d,env:u,onExit:w,height:"100%",className:"h-full"})})]})]})})}const Dl={mcps:{icon:kn,color:"text-blue-600",bgColor:"bg-blue-50",label:"MCP Servers"},settings:{icon:zn,color:"text-gray-600 dark:text-slate-400",bgColor:"bg-gray-50 dark:bg-slate-800",label:"Settings"},command:{icon:Ft,color:"text-green-600",bgColor:"bg-green-50",label:"Skill"},rule:{icon:Xi,color:"text-purple-600",bgColor:"bg-purple-50",label:"Rule"},workflow:{icon:BC,color:"text-cyan-600",bgColor:"bg-cyan-50",label:"Workflow"},claudemd:{icon:Er,color:"text-orange-600",bgColor:"bg-orange-50",label:"CLAUDE.md"},geminimd:{icon:Er,color:"text-blue-600",bgColor:"bg-blue-50",label:"GEMINI.md"},env:{icon:vu,color:"text-yellow-600",bgColor:"bg-yellow-50",label:".env"},memory:{icon:Ji,color:"text-pink-600",bgColor:"bg-pink-50",label:"Memory"},folder:{icon:Dr,color:"text-yellow-600",bgColor:"bg-yellow-50",label:"Folder"}};function Bd({item:e,level:t=0,selectedPath:n,onSelect:s,onContextMenu:o,expandedFolders:d,onToggleFolder:u}){const l=Dl[e.type]||Dl.folder,c=l.icon,f=n===e.path,m=e.type==="folder",h=d[e.path];return r.jsxs("div",{children:[r.jsxs("div",{className:Te("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm","hover:bg-gray-100 dark:hover:bg-slate-700 transition-colors",f&&"bg-blue-100 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/30"),style:{paddingLeft:`${t*16+8}px`},onClick:()=>m?u(e.path):s(e),onContextMenu:x=>o(x,e),children:[m&&r.jsx("span",{className:"w-4 h-4 flex items-center justify-center",children:h?r.jsx(pr,{className:"w-3 h-3"}):r.jsx(Xr,{className:"w-3 h-3"})}),!m&&r.jsx("span",{className:"w-4"}),r.jsx(c,{className:Te("w-4 h-4",l.color)}),r.jsx("span",{className:"flex-1 truncate",children:e.name}),e.mcpCount>0&&r.jsx(Ze,{variant:"secondary",className:"text-xs px-1.5 py-0",children:e.mcpCount})]}),m&&h&&e.children&&r.jsx("div",{children:e.children.map(x=>r.jsx(Bd,{item:x,level:t+1,selectedPath:n,onSelect:s,onContextMenu:o,expandedFolders:d,onToggleFolder:u},x.path))})]})}function QF({folder:e,isExpanded:t,isHome:n,isProject:s,isSubproject:o,depth:d=0,onToggle:u,onCreateFile:l,onInstallPlugin:c,onSelectItem:f,selectedPath:m,onContextMenu:h,expandedFolders:x,onToggleFolder:w,hasSubprojects:j,onAddSubproject:_,onRemoveSubproject:b,onHideSubproject:v,enabledTools:g=["claude"]}){var z,q,H,G,J,K,F;const y=(z=e.files)==null?void 0:z.some(R=>R.name==="mcps.json"),k=(q=e.files)==null?void 0:q.some(R=>R.name==="settings.json"),E=(H=e.files)==null?void 0:H.some(R=>R.name==="CLAUDE.md"||R.name==="CLAUDE.md (root)"),P=(G=e.files)==null?void 0:G.some(R=>R.name===".env"),T=()=>n?"bg-indigo-50 dark:bg-indigo-900/20 hover:bg-indigo-100 dark:hover:bg-indigo-900/30":o&&d>1?"bg-gray-50 dark:bg-slate-800 hover:bg-gray-100 dark:hover:bg-slate-700":o?"bg-amber-50 dark:bg-amber-900/20 hover:bg-amber-100 dark:hover:bg-amber-900/30":s?"bg-green-50 dark:bg-green-900/20 hover:bg-green-100 dark:hover:bg-green-900/30":"bg-gray-50 dark:bg-slate-800 hover:bg-gray-100 dark:hover:bg-slate-700",N=()=>n?"text-indigo-700 dark:text-indigo-400":o&&d>1?"text-gray-600 dark:text-slate-400":o?"text-amber-700 dark:text-amber-400":s?"text-green-700 dark:text-green-400":"text-gray-700 dark:text-slate-300",I=n?fg:t?_i:Dr,O=n?"Home":e.label,B=(g.includes("claude")&&((J=e.files)==null?void 0:J.length)||0)+(g.includes("gemini")&&((K=e.geminiFiles)==null?void 0:K.length)||0)+(g.includes("antigravity")&&((F=e.agentFiles)==null?void 0:F.length)||0);return r.jsxs("div",{className:"border-b border-gray-200 dark:border-slate-700",children:[r.jsxs("div",{className:Te("flex items-center gap-2 py-2 cursor-pointer transition-colors",T()),style:{paddingLeft:`${12+d*16}px`,paddingRight:"24px"},onClick:u,children:[r.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-gray-500",children:t?r.jsx(pr,{className:"w-4 h-4"}):r.jsx(Xr,{className:"w-4 h-4"})}),r.jsx(I,{className:Te("w-4 h-4",N())}),r.jsx("span",{className:Te("flex-1 min-w-0 font-medium text-sm truncate",N()),children:O}),r.jsxs(Ks,{children:[r.jsx(qs,{asChild:!0,onClick:R=>R.stopPropagation(),children:r.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 flex-shrink-0 mr-1 hover:bg-white/50 dark:hover:bg-slate-900/50",children:r.jsx(kt,{className:"w-4 h-4"})})}),r.jsxs(Cs,{align:"end",className:"w-48",children:[r.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b mb-1",children:[s&&j&&r.jsx(Ze,{variant:"outline",className:"text-[10px] px-1 py-0 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 border-green-300 dark:border-green-700",children:"root"}),!e.exists&&!n&&r.jsx(Ze,{variant:"outline",className:"text-[10px] px-1 py-0",children:"no config"}),!o&&e.exists&&B===0&&r.jsx("span",{className:"text-[10px] text-muted-foreground",children:"configured"})]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"mcps")},disabled:y,className:y?"opacity-50":"",children:[r.jsx(kn,{className:"w-4 h-4 mr-2"}),"mcps.json",y&&r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"settings")},disabled:k,className:k?"opacity-50":"",children:[r.jsx(zn,{className:"w-4 h-4 mr-2"}),"settings.json",k&&r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"env")},disabled:P,className:P?"opacity-50":"",children:[r.jsx(vu,{className:"w-4 h-4 mr-2"}),".env",P&&r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),r.jsx(Yr,{}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"command")},children:[r.jsx(Ft,{className:"w-4 h-4 mr-2"}),"New Skill"]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"rule")},children:[r.jsx(Xi,{className:"w-4 h-4 mr-2"}),"New Rule"]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"workflow")},children:[r.jsx(BC,{className:"w-4 h-4 mr-2"}),"New Workflow"]}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"memory")},children:[r.jsx(Ji,{className:"w-4 h-4 mr-2"}),"New Memory"]}),r.jsx(Yr,{}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),c(e.dir,e.name||e.dir.split("/").pop())},children:[r.jsx(eo,{className:"w-4 h-4 mr-2"}),"Install Plugins"]}),r.jsx(Yr,{}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),l(e.dir,"claudemd")},disabled:E,className:E?"opacity-50":"",children:[r.jsx(Er,{className:"w-4 h-4 mr-2"}),"CLAUDE.md",E&&r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),(s||o)&&_&&r.jsxs(r.Fragment,{children:[r.jsx(Yr,{}),r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),_(e.dir)},children:[r.jsx(Bs,{className:"w-4 h-4 mr-2"}),"Add Sub-project"]})]}),o&&v&&r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),v(e.dir)},children:[r.jsx(FC,{className:"w-4 h-4 mr-2"}),"Hide"]}),e.isManual&&b&&r.jsxs(Mt,{onClick:R=>{R.stopPropagation(),b(e.dir)},className:"text-destructive focus:text-destructive",children:[r.jsx(un,{className:"w-4 h-4 mr-2"}),"Remove"]})]})]})]}),t&&r.jsxs("div",{className:"bg-white dark:bg-slate-950 py-1",children:[g.includes("claude")&&e.files&&e.files.length>0&&r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-orange-600 dark:text-orange-400 uppercase tracking-wide flex items-center gap-1",children:[r.jsx(Yt,{className:"w-3 h-3"}),"Claude Code"]}),e.files.map(R=>r.jsx(Bd,{item:R,selectedPath:m,onSelect:f,onContextMenu:h,expandedFolders:x,onToggleFolder:w},R.path))]}),g.includes("gemini")&&e.geminiFiles&&e.geminiFiles.length>0&&r.jsxs("div",{className:"mb-1 border-t border-dashed border-gray-200 dark:border-slate-700 pt-1",children:[r.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wide flex items-center gap-1",children:[r.jsx(Yt,{className:"w-3 h-3"}),"Gemini CLI"]}),e.geminiFiles.map(R=>r.jsx(Bd,{item:R,selectedPath:m,onSelect:f,onContextMenu:h,expandedFolders:x,onToggleFolder:w},R.path))]}),g.includes("antigravity")&&e.agentFiles&&e.agentFiles.length>0&&r.jsxs("div",{className:"mb-1 border-t border-dashed border-gray-200 dark:border-slate-700 pt-1",children:[r.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-purple-600 dark:text-purple-400 uppercase tracking-wide flex items-center gap-1",children:[r.jsx(Yt,{className:"w-3 h-3"}),"Antigravity"]}),e.agentFiles.map(R=>r.jsx(Bd,{item:R,selectedPath:m,onSelect:f,onContextMenu:h,expandedFolders:x,onToggleFolder:w},R.path))]}),(!g.includes("claude")||!e.files||e.files.length===0)&&(!g.includes("gemini")||!e.geminiFiles||e.geminiFiles.length===0)&&(!g.includes("antigravity")||!e.agentFiles||e.agentFiles.length===0)&&r.jsx("div",{className:"px-4 py-3 text-sm text-gray-400 dark:text-slate-500 italic text-center",children:"No config files. Use + to create."})]})]})}const xt=C.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:Te("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));xt.displayName="Textarea";var Gu="Tabs",[ZF]=hn(Gu,[zu]),bj=zu(),[eB,ex]=ZF(Gu),wj=C.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:d,orientation:u="horizontal",dir:l,activationMode:c="automatic",...f}=e,m=Gl(l),[h,x]=ws({prop:s,onChange:o,defaultProp:d??"",caller:Gu});return r.jsx(eB,{scope:n,baseId:Bn(),value:h,onValueChange:x,orientation:u,dir:m,activationMode:c,children:r.jsx(nt.div,{dir:m,"data-orientation":u,...f,ref:t})})});wj.displayName=Gu;var _j="TabsList",Cj=C.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,d=ex(_j,n),u=bj(n);return r.jsx(Ck,{asChild:!0,...u,orientation:d.orientation,dir:d.dir,loop:s,children:r.jsx(nt.div,{role:"tablist","aria-orientation":d.orientation,...o,ref:t})})});Cj.displayName=_j;var Sj="TabsTrigger",kj=C.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...d}=e,u=ex(Sj,n),l=bj(n),c=Ej(u.baseId,s),f=Pj(u.baseId,s),m=s===u.value;return r.jsx(Sk,{asChild:!0,...l,focusable:!o,active:m,children:r.jsx(nt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":f,"data-state":m?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...d,ref:t,onMouseDown:Oe(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?u.onValueChange(s):h.preventDefault()}),onKeyDown:Oe(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&u.onValueChange(s)}),onFocus:Oe(e.onFocus,()=>{const h=u.activationMode!=="manual";!m&&!o&&h&&u.onValueChange(s)})})})});kj.displayName=Sj;var jj="TabsContent",Nj=C.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:d,...u}=e,l=ex(jj,n),c=Ej(l.baseId,s),f=Pj(l.baseId,s),m=s===l.value,h=C.useRef(m);return C.useEffect(()=>{const x=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(x)},[]),r.jsx(Lr,{present:o||m,children:({present:x})=>r.jsx(nt.div,{"data-state":m?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!x,id:f,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:x&&d})})});Nj.displayName=jj;function Ej(e,t){return`${e}-trigger-${t}`}function Pj(e,t){return`${e}-content-${t}`}var tB=wj,Aj=Cj,Tj=kj,Rj=Nj;const Ku=tB,Zl=C.forwardRef(({className:e,...t},n)=>r.jsx(Aj,{ref:n,className:Te("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Zl.displayName=Aj.displayName;const ts=C.forwardRef(({className:e,...t},n)=>r.jsx(Tj,{ref:n,className:Te("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));ts.displayName=Tj.displayName;const zs=C.forwardRef(({className:e,...t},n)=>r.jsx(Rj,{ref:n,className:Te("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));zs.displayName=Rj.displayName;var rB=Symbol("radix.slottable");function nB(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=rB,t}var[qu]=hn("Tooltip",[fa]),Yu=fa(),Mj="TooltipProvider",sB=700,mp="tooltip.open",[iB,tx]=qu(Mj),Dj=e=>{const{__scopeTooltip:t,delayDuration:n=sB,skipDelayDuration:s=300,disableHoverableContent:o=!1,children:d}=e,u=C.useRef(!0),l=C.useRef(!1),c=C.useRef(0);return C.useEffect(()=>{const f=c.current;return()=>window.clearTimeout(f)},[]),r.jsx(iB,{scope:t,isOpenDelayedRef:u,delayDuration:n,onOpen:C.useCallback(()=>{window.clearTimeout(c.current),u.current=!1},[]),onClose:C.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>u.current=!0,s)},[s]),isPointerInTransitRef:l,onPointerInTransitChange:C.useCallback(f=>{l.current=f},[]),disableHoverableContent:o,children:d})};Dj.displayName=Mj;var Il="Tooltip",[oB,ec]=qu(Il),Ij=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:o,onOpenChange:d,disableHoverableContent:u,delayDuration:l}=e,c=tx(Il,e.__scopeTooltip),f=Yu(t),[m,h]=C.useState(null),x=Bn(),w=C.useRef(0),j=u??c.disableHoverableContent,_=l??c.delayDuration,b=C.useRef(!1),[v,g]=ws({prop:s,defaultProp:o??!1,onChange:T=>{T?(c.onOpen(),document.dispatchEvent(new CustomEvent(mp))):c.onClose(),d==null||d(T)},caller:Il}),y=C.useMemo(()=>v?b.current?"delayed-open":"instant-open":"closed",[v]),k=C.useCallback(()=>{window.clearTimeout(w.current),w.current=0,b.current=!1,g(!0)},[g]),E=C.useCallback(()=>{window.clearTimeout(w.current),w.current=0,g(!1)},[g]),P=C.useCallback(()=>{window.clearTimeout(w.current),w.current=window.setTimeout(()=>{b.current=!0,g(!0),w.current=0},_)},[_,g]);return C.useEffect(()=>()=>{w.current&&(window.clearTimeout(w.current),w.current=0)},[]),r.jsx(zg,{...f,children:r.jsx(oB,{scope:t,contentId:x,open:v,stateAttribute:y,trigger:m,onTriggerChange:h,onTriggerEnter:C.useCallback(()=>{c.isOpenDelayedRef.current?P():k()},[c.isOpenDelayedRef,P,k]),onTriggerLeave:C.useCallback(()=>{j?E():(window.clearTimeout(w.current),w.current=0)},[E,j]),onOpen:k,onClose:E,disableHoverableContent:j,children:n})})};Ij.displayName=Il;var pp="TooltipTrigger",Lj=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=ec(pp,n),d=tx(pp,n),u=Yu(n),l=C.useRef(null),c=ut(t,l,o.onTriggerChange),f=C.useRef(!1),m=C.useRef(!1),h=C.useCallback(()=>f.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),r.jsx(Hg,{asChild:!0,...u,children:r.jsx(nt.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...s,ref:c,onPointerMove:Oe(e.onPointerMove,x=>{x.pointerType!=="touch"&&!m.current&&!d.isPointerInTransitRef.current&&(o.onTriggerEnter(),m.current=!0)}),onPointerLeave:Oe(e.onPointerLeave,()=>{o.onTriggerLeave(),m.current=!1}),onPointerDown:Oe(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Oe(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:Oe(e.onBlur,o.onClose),onClick:Oe(e.onClick,o.onClose)})})});Lj.displayName=pp;var rx="TooltipPortal",[aB,lB]=qu(rx,{forceMount:void 0}),Oj=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:o}=e,d=ec(rx,t);return r.jsx(aB,{scope:t,forceMount:n,children:r.jsx(Lr,{present:n||d.open,children:r.jsx(ql,{asChild:!0,container:o,children:s})})})};Oj.displayName=rx;var sa="TooltipContent",Fj=C.forwardRef((e,t)=>{const n=lB(sa,e.__scopeTooltip),{forceMount:s=n.forceMount,side:o="top",...d}=e,u=ec(sa,e.__scopeTooltip);return r.jsx(Lr,{present:s||u.open,children:u.disableHoverableContent?r.jsx(Bj,{side:o,...d,ref:t}):r.jsx(cB,{side:o,...d,ref:t})})}),cB=C.forwardRef((e,t)=>{const n=ec(sa,e.__scopeTooltip),s=tx(sa,e.__scopeTooltip),o=C.useRef(null),d=ut(t,o),[u,l]=C.useState(null),{trigger:c,onClose:f}=n,m=o.current,{onPointerInTransitChange:h}=s,x=C.useCallback(()=>{l(null),h(!1)},[h]),w=C.useCallback((j,_)=>{const b=j.currentTarget,v={x:j.clientX,y:j.clientY},g=mB(v,b.getBoundingClientRect()),y=pB(v,g),k=gB(_.getBoundingClientRect()),E=vB([...y,...k]);l(E),h(!0)},[h]);return C.useEffect(()=>()=>x(),[x]),C.useEffect(()=>{if(c&&m){const j=b=>w(b,m),_=b=>w(b,c);return c.addEventListener("pointerleave",j),m.addEventListener("pointerleave",_),()=>{c.removeEventListener("pointerleave",j),m.removeEventListener("pointerleave",_)}}},[c,m,w,x]),C.useEffect(()=>{if(u){const j=_=>{const b=_.target,v={x:_.clientX,y:_.clientY},g=(c==null?void 0:c.contains(b))||(m==null?void 0:m.contains(b)),y=!xB(v,u);g?x():y&&(x(),f())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[c,m,u,f,x]),r.jsx(Bj,{...e,ref:d})}),[dB,uB]=qu(Il,{isInside:!1}),hB=nB("TooltipContent"),Bj=C.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":o,onEscapeKeyDown:d,onPointerDownOutside:u,...l}=e,c=ec(sa,n),f=Yu(n),{onClose:m}=c;return C.useEffect(()=>(document.addEventListener(mp,m),()=>document.removeEventListener(mp,m)),[m]),C.useEffect(()=>{if(c.trigger){const h=x=>{const w=x.target;w!=null&&w.contains(c.trigger)&&m()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,m]),r.jsx(Kl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:h=>h.preventDefault(),onDismiss:m,children:r.jsxs(Wg,{"data-state":c.stateAttribute,...f,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(hB,{children:s}),r.jsx(dB,{scope:n,isInside:!0,children:r.jsx(MO,{id:c.contentId,role:"tooltip",children:o||s})})]})})});Fj.displayName=sa;var $j="TooltipArrow",fB=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=Yu(n);return uB($j,n).isInside?null:r.jsx(Ug,{...o,...s,ref:t})});fB.displayName=$j;function mB(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),d=Math.abs(t.left-e.x);switch(Math.min(n,s,o,d)){case d:return"left";case o:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function pB(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function gB(e){const{top:t,right:n,bottom:s,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:s},{x:o,y:s}]}function xB(e,t){const{x:n,y:s}=e;let o=!1;for(let d=0,u=t.length-1;d<t.length;u=d++){const l=t[d],c=t[u],f=l.x,m=l.y,h=c.x,x=c.y;m>s!=x>s&&n<(h-f)*(s-m)/(x-m)+f&&(o=!o)}return o}function vB(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),yB(t)}function yB(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const o=e[s];for(;t.length>=2;){const d=t[t.length-1],u=t[t.length-2];if((d.x-u.x)*(o.y-u.y)>=(d.y-u.y)*(o.x-u.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const o=e[s];for(;n.length>=2;){const d=n[n.length-1],u=n[n.length-2];if((d.x-u.x)*(o.y-u.y)>=(d.y-u.y)*(o.x-u.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var bB=Dj,wB=Ij,_B=Lj,CB=Oj,zj=Fj;const kr=bB,Ut=wB,Vt=_B,Bt=C.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(CB,{children:r.jsx(zj,{ref:s,sideOffset:t,className:Te("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Bt.displayName=zj.displayName;function SB({content:e,parsed:t,onSave:n,registry:s,configDir:o}){const[d,u]=C.useState(t||{include:[],exclude:[],mcpServers:{}}),[l,c]=C.useState("rich"),[f,m]=C.useState(JSON.stringify(t||{},null,2)),[h,x]=C.useState(!1),[w,j]=C.useState({open:!1,json:""}),[_,b]=C.useState([]),[v,g]=C.useState(!1),[y,k]=C.useState(!1);C.useEffect(()=>{u(t||{include:[],exclude:[],mcpServers:{}}),m(JSON.stringify(t||{},null,2))},[t]),C.useEffect(()=>{o?ge.getInheritedMcps(o).then(B=>{b(B.inherited||[]),g(B.needsApply||!1)}).catch(()=>{b([]),g(!1)}):(b([]),g(!1))},[o,t]);const E=async B=>{x(!0);try{await n(JSON.stringify(B,null,2))}catch(z){X.error("Failed to save: "+z.message)}finally{x(!1)}},P=B=>{var H;const z=(H=d.include)!=null&&H.includes(B)?d.include.filter(G=>G!==B):[...d.include||[],B],q={...d,include:z};u(q),m(JSON.stringify(q,null,2)),E(q)},T=B=>{const z=d.exclude||[],q=z.includes(B),H=q?z.filter(J=>J!==B):[...z,B],G=H.length>0?{...d,exclude:H}:{...d};H.length===0&&delete G.exclude,u(G),m(JSON.stringify(G,null,2)),E(G),X.success(q?`Unblocked ${B}`:`Blocked ${B}`)},N=()=>{try{const B=JSON.parse(f);u(B),E(B)}catch{X.error("Invalid JSON")}},M=()=>{if(!w.json.trim()){X.error("Please paste the MCP JSON configuration");return}try{let B;try{B=JSON.parse(w.json)}catch{X.error("Invalid JSON format");return}let z={};if(B.mcpServers&&typeof B.mcpServers=="object")z=B.mcpServers;else if(typeof B=="object"&&!Array.isArray(B)){if(Object.keys(B).includes("command")){X.error('JSON is missing the MCP name. Expected: { "name": { "command": "...", "args": [...] } }');return}z=B}if(Object.keys(z).length===0){X.error("No MCP configurations found in the JSON");return}for(const[J,K]of Object.entries(z))if(!K.command){X.error(`MCP "${J}" is missing required "command" field`);return}const q={...d.mcpServers||{},...z},H={...d,mcpServers:q};u(H),m(JSON.stringify(H,null,2)),E(H);const G=Object.keys(z).length;X.success(`Added ${G} MCP${G>1?"s":""}`),j({open:!1,json:""})}catch(B){X.error("Failed to add: "+B.message)}},I=s!=null&&s.mcpServers?Object.keys(s.mcpServers):[],O=async()=>{if(o){k(!0);try{const B=await ge.applyCascade(o);if(B.success){const z=B.applied>1?`Applied to ${B.applied} projects`:"Generated .mcp.json";X.success(z),g(!1)}else B.applied===0&&B.skipped>0?(X.info("No changes needed"),g(!1)):X.error(B.error||"Failed to apply")}catch(B){X.error("Failed to apply: "+B.message)}finally{k(!1)}}};return r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border-b bg-gray-50 dark:bg-slate-800",children:[r.jsx(Ku,{value:l,onValueChange:c,children:r.jsxs(Zl,{className:"h-8",children:[r.jsx(ts,{value:"rich",className:"text-xs px-3",children:"Rich Editor"}),r.jsx(ts,{value:"json",className:"text-xs px-3",children:"JSON"})]})}),r.jsxs("div",{className:"flex gap-2 items-center",children:[h&&r.jsx(Ze,{variant:"outline",className:"text-xs text-blue-600",children:"Saving..."}),r.jsxs(se,{size:"sm",variant:"outline",onClick:()=>j({open:!0,json:""}),children:[r.jsx(kt,{className:"w-4 h-4 mr-1"}),"Add MCP"]}),l==="json"&&r.jsxs(se,{size:"sm",onClick:N,disabled:h,children:[r.jsx(En,{className:"w-4 h-4 mr-1"}),"Apply JSON"]})]})]}),v&&r.jsxs("div",{className:"mx-3 mt-3 p-3 rounded-lg bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Sn,{className:"w-4 h-4 text-amber-600"}),r.jsxs("span",{className:"text-sm text-amber-800 dark:text-amber-200",children:["No ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900 px-1 rounded",children:".mcp.json"})," generated yet. Apply to enable MCPs."]})]}),r.jsx(se,{size:"sm",variant:"outline",onClick:O,disabled:y,className:"border-amber-300 dark:border-amber-700 text-amber-700 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900",children:y?r.jsx("span",{className:"animate-pulse",children:"Applying..."}):r.jsxs(r.Fragment,{children:[r.jsx(Yi,{className:"w-3 h-3 mr-1"}),"Apply"]})})]}),r.jsx(Hn,{className:"flex-1",children:l==="rich"?r.jsx(kr,{children:r.jsxs("div",{className:"p-4 space-y-2",children:[Object.entries(d.mcpServers||{}).map(([B,z])=>{var q;return r.jsxs("div",{className:"p-2 rounded border bg-white dark:bg-slate-950 group",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(kn,{className:"w-4 h-4 text-green-500"}),r.jsx("span",{className:"text-sm font-medium",children:B})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ze,{variant:"outline",className:"text-xs",children:"inline"}),r.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 hover:bg-red-50",onClick:()=>{const{[B]:H,...G}=d.mcpServers,J={...d,mcpServers:G};u(J),m(JSON.stringify(J,null,2)),E(J),X.success(`Removed ${B}`)},children:r.jsx(un,{className:"w-3.5 h-3.5"})})]})]}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1 font-mono",children:[z.command," ",(q=z.args)==null?void 0:q.join(" ")]})]},`inline-${B}`)}),_.map(B=>{var q;const z=(q=d.exclude)==null?void 0:q.includes(B.name);return r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsxs("div",{className:`flex items-center justify-between p-2 rounded border ${z?"bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-800":"bg-gray-50 dark:bg-slate-900 border-gray-200 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(kn,{className:`w-4 h-4 ${z?"text-red-400":"text-gray-400"}`}),r.jsx("span",{className:`text-sm ${z?"text-red-500 line-through":"text-gray-500 dark:text-slate-400"}`,children:B.name}),r.jsxs(Ze,{variant:"outline",className:"text-[10px] text-gray-400 border-gray-300 dark:border-slate-600",children:["from ",B.source]})]}),r.jsx(ft,{checked:!z,onCheckedChange:()=>{z||X.warning(`Blocking "${B.name}" inherited from ${B.source}`),T(B.name)},className:"data-[state=checked]:bg-gray-400 dark:data-[state=checked]:bg-slate-600"})]})}),r.jsxs(Bt,{children:[r.jsxs("p",{children:["Inherited from ",r.jsx("strong",{children:B.source})]}),r.jsx("p",{className:"text-xs text-gray-400",children:z?"Blocked at this level":"Toggle off to block"})]})]},`inherited-${B.name}`)}),I.map(B=>{var H,G;const z=_.some(J=>J.name===B),q=(H=d.mcpServers)==null?void 0:H[B];return z||q?null:r.jsxs("div",{className:"flex items-center justify-between p-2 rounded border bg-white dark:bg-slate-950",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(kn,{className:"w-4 h-4 text-blue-500"}),r.jsx("span",{className:"text-sm",children:B})]}),r.jsx(ft,{checked:(G=d.include)==null?void 0:G.includes(B),onCheckedChange:()=>P(B)})]},B)}),I.length===0&&_.length===0&&Object.keys(d.mcpServers||{}).length===0&&r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:'No MCPs configured. Click "Add MCP" to add one.'})]})}):r.jsx(xt,{className:"w-full h-full min-h-[400px] font-mono text-sm border-0 rounded-none resize-none",value:f,onChange:B=>m(B.target.value)})}),r.jsx(_t,{open:w.open,onOpenChange:B=>j({...w,open:B}),children:r.jsxs(vt,{className:"bg-white dark:bg-slate-950 max-w-2xl",children:[r.jsxs(yt,{children:[r.jsx(bt,{children:"Add MCP to Config"}),r.jsx(er,{children:"Paste the MCP JSON configuration to add to this config file."})]}),r.jsxs("div",{className:"py-4",children:[r.jsx(xt,{value:w.json,onChange:B=>j({...w,json:B.target.value}),placeholder:`{
584
584
  "my-mcp": {
585
585
  "command": "npx",
586
586
  "args": ["-y", "@example/mcp-server"],
@@ -596,7 +596,7 @@ WARNING: This link could potentially be dangerous`)){const v=window.open();if(v)
596
596
  }`,className:"font-mono text-sm min-h-[100px]"})]})]})]})]})]})}const e8=[{id:"Default",name:"Default"},{id:"GitHub",name:"GitHub"},{id:"Monokai",name:"Monokai"},{id:"SolarizedDark",name:"Solarized Dark"},{id:"SolarizedLight",name:"Solarized Light"}],t8=[{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",description:"Most capable"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",description:"Fast and efficient"},{id:"gemini-2.0-pro",name:"Gemini 2.0 Pro",description:"Previous generation"},{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",description:"Previous generation fast"}];function Yj({settings:e,onSave:t,loading:n,settingsPath:s}){var T,N,M,I;const[o,d]=C.useState(e||{}),[u,l]=C.useState(!1),[c,f]=C.useState("rich"),[m,h]=C.useState(JSON.stringify(e||{},null,2)),[x,w]=C.useState({open:!1,name:"",json:""}),[j,_]=C.useState({}),b=async()=>{l(!0);try{if(c==="json")try{const O=JSON.parse(m);await t(O),d(O)}catch{X.error("Invalid JSON"),l(!1);return}else await t(o),h(JSON.stringify(o,null,2));X.success("Settings saved")}finally{l(!1)}},v=(O,B,z)=>{d(q=>({...q,[O]:{...q[O],[B]:z}}))},g=(O,B,z=!1)=>{var q;return((q=o==null?void 0:o[O])==null?void 0:q[B])??z},y=o.mcpServers||{},k=()=>{const{name:O,json:B}=x;if(!O.trim()){X.error("Please enter a name for the MCP");return}let z;try{z=JSON.parse(B)}catch{X.error("Invalid JSON configuration");return}if(!z.command){X.error('MCP config must have a "command" field');return}d(q=>({...q,mcpServers:{...q.mcpServers,[O.trim()]:z}})),w({open:!1,name:"",json:""}),X.success(`Added MCP: ${O}`)},E=O=>{d(B=>{const{[O]:z,...q}=B.mcpServers||{};return{...B,mcpServers:q}}),X.success(`Removed MCP: ${O}`)},P=O=>{_(B=>({...B,[O]:!B[O]}))};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-blue-500/10 flex items-center justify-center",children:r.jsx(Ft,{className:"w-5 h-5 text-blue-500"})}),r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:["Gemini CLI Settings",r.jsxs(Ze,{variant:"outline",className:"text-xs font-normal text-blue-600 border-blue-300 dark:border-blue-700",children:[r.jsx(Yt,{className:"w-3 h-3 mr-1"}),"Google"]})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",r.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs",children:s})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex bg-muted rounded-lg p-1",children:[r.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="rich"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>f("rich"),children:"Settings"}),r.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="json"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{h(JSON.stringify(o,null,2)),f("json")},children:"JSON"})]}),r.jsxs(se,{onClick:b,disabled:u||n,children:[u?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(En,{className:"w-4 h-4 mr-2"}),"Save"]})]})]}),c==="json"?r.jsx("div",{className:"border border-border rounded-lg bg-card overflow-hidden",children:r.jsx(xt,{value:m,onChange:O=>h(O.target.value),className:"font-mono text-sm min-h-[500px] border-0 rounded-none resize-none",placeholder:"{ }"})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[r.jsx(kn,{className:"w-4 h-4 text-blue-500"}),"MCP Servers",r.jsx(Ze,{variant:"secondary",className:"text-xs",children:Object.keys(y).length})]}),r.jsxs(se,{size:"sm",variant:"outline",onClick:()=>w({open:!0,name:"",json:`{
597
597
  "command": "npx",
598
598
  "args": ["-y", "@example/mcp-server"]
599
- }`}),children:[r.jsx(kt,{className:"w-4 h-4 mr-1"}),"Add MCP"]})]}),r.jsx("div",{className:"space-y-2",children:Object.keys(y).length===0?r.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No MCP servers configured"}):Object.entries(y).map(([O,B])=>r.jsxs(tc,{open:j[O],onOpenChange:()=>P(O),children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-background group",children:[r.jsxs(rc,{className:"flex items-center gap-2 flex-1 text-left",children:[j[O]?r.jsx(pr,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(Xr,{className:"w-4 h-4 text-muted-foreground"}),r.jsx(kn,{className:"w-4 h-4 text-blue-500"}),r.jsx("span",{className:"font-medium text-sm",children:O}),r.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:B.command})]}),r.jsx(se,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 text-destructive hover:text-destructive",onClick:()=>E(O),children:r.jsx(un,{className:"w-4 h-4"})})]}),r.jsx(nc,{children:r.jsx("div",{className:"mt-2 ml-6 p-3 rounded-lg bg-muted/50 border",children:r.jsx("pre",{className:"text-xs font-mono text-muted-foreground overflow-x-auto",children:JSON.stringify(B,null,2)})})})]},O))})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(Yt,{className:"w-4 h-4 text-blue-500"}),"Model"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Model"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Model used for Gemini CLI sessions"})]}),r.jsxs(jr,{value:g("model","name",""),onValueChange:O=>v("model","name",O),children:[r.jsx(gr,{className:"w-48",children:r.jsx(Nr,{placeholder:"Select model"})}),r.jsx(xr,{children:t8.map(O=>r.jsx(Et,{value:O.id,children:r.jsx("div",{className:"flex flex-col",children:r.jsx("span",{children:O.name})})},O.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Preview Features"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable access to experimental models and features"})]}),r.jsx(ft,{checked:g("general","previewFeatures",!1),onCheckedChange:O=>v("general","previewFeatures",O)})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(yM,{className:"w-4 h-4 text-blue-500"}),"Appearance"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Theme"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Color theme for the CLI interface"})]}),r.jsxs(jr,{value:g("ui","theme","Default"),onValueChange:O=>v("ui","theme",O),children:[r.jsx(gr,{className:"w-40",children:r.jsx(Nr,{})}),r.jsx(xr,{children:e8.map(O=>r.jsx(Et,{value:O.id,children:O.name},O.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Format"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Format for CLI output"})]}),r.jsxs(jr,{value:g("output","format","text"),onValueChange:O=>v("output","format",O),children:[r.jsx(gr,{className:"w-40",children:r.jsx(Nr,{})}),r.jsxs(xr,{children:[r.jsx(Et,{value:"text",children:"Text"}),r.jsx(Et,{value:"json",children:"JSON"})]})]})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx($C,{className:"w-4 h-4 text-blue-500"}),"Display Options"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Dynamic Window Title"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Update title with status icons (Ready, Working, etc.)"})]}),r.jsx(ft,{checked:g("ui","dynamicWindowTitle",!0),onCheckedChange:O=>v("ui","dynamicWindowTitle",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Show Line Numbers"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Display line numbers in chat"})]}),r.jsx(ft,{checked:g("ui","showLineNumbers",!0),onCheckedChange:O=>v("ui","showLineNumbers",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Show Citations"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Display citations for generated text"})]}),r.jsx(ft,{checked:g("ui","showCitations",!1),onCheckedChange:O=>v("ui","showCitations",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Hide Context Summary"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Hide GEMINI.md and MCP servers above input"})]}),r.jsx(ft,{checked:g("ui","hideContextSummary",!1),onCheckedChange:O=>v("ui","hideContextSummary",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Hide Footer"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Remove footer entirely from the UI"})]}),r.jsx(ft,{checked:g("ui","hideFooter",!1),onCheckedChange:O=>v("ui","hideFooter",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Screen Reader Mode"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Render output in plain-text for accessibility"})]}),r.jsx(ft,{checked:((N=(T=o==null?void 0:o.ui)==null?void 0:T.accessibility)==null?void 0:N.screenReader)??!1,onCheckedChange:O=>d(B=>{var z;return{...B,ui:{...B.ui,accessibility:{...(z=B.ui)==null?void 0:z.accessibility,screenReader:O}}}})})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(zn,{className:"w-4 h-4 text-blue-500"}),"General"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Vim Mode"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable Vim keybindings in the prompt editor"})]}),r.jsx(ft,{checked:g("general","vimMode",!1),onCheckedChange:O=>v("general","vimMode",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Auto Update"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow automatic updates to Gemini CLI"})]}),r.jsx(ft,{checked:g("general","enableAutoUpdate",!0),onCheckedChange:O=>v("general","enableAutoUpdate",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Checkpointing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable session recovery support"})]}),r.jsx(ft,{checked:((I=(M=o==null?void 0:o.general)==null?void 0:M.checkpointing)==null?void 0:I.enabled)??!1,onCheckedChange:O=>d(B=>{var z;return{...B,general:{...B.general,checkpointing:{...(z=B.general)==null?void 0:z.checkpointing,enabled:O}}}})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Respect .gitignore"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Exclude files matching .gitignore patterns"})]}),r.jsx(ft,{checked:g("general","respectGitignore",!0),onCheckedChange:O=>v("general","respectGitignore",O)})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(ks,{className:"w-4 h-4 text-blue-500"}),"Privacy"]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Usage Statistics"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow collection of anonymous usage data"})]}),r.jsx(ft,{checked:g("privacy","usageStatisticsEnabled",!0),onCheckedChange:O=>v("privacy","usageStatisticsEnabled",O)})]})})]})]}),r.jsx(_t,{open:x.open,onOpenChange:O=>w({...x,open:O}),children:r.jsxs(vt,{className:"bg-card",children:[r.jsxs(yt,{children:[r.jsx(bt,{children:"Add MCP Server"}),r.jsx(er,{children:"Add a new MCP server to Gemini CLI"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name"}),r.jsx(dt,{value:x.name,onChange:O=>w({...x,name:O.target.value}),placeholder:"my-mcp-server",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Configuration (JSON)"}),r.jsx(xt,{value:x.json,onChange:O=>w({...x,json:O.target.value}),className:"mt-1 font-mono text-sm",rows:6})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"ghost",onClick:()=>w({open:!1,name:"",json:""}),children:"Cancel"}),r.jsxs(se,{onClick:k,children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Add MCP"]})]})]})})]})}function r8({content:e,parsed:t,onSave:n,filePath:s}){const o=async l=>{const c=JSON.stringify(l,null,2);n(c)},d=(s==null?void 0:s.includes(".gemini"))||(s==null?void 0:s.includes("/.gemini/")),u=(s==null?void 0:s.includes(".agent"))||(s==null?void 0:s.includes("/antigravity/"));return d&&!u?r.jsx("div",{className:"h-full overflow-auto p-4",children:r.jsx(Yj,{settings:t||{},onSave:o,loading:!1,settingsPath:s||"~/.gemini/settings.json"})}):r.jsx("div",{className:"h-full overflow-auto p-4",children:r.jsx(qj,{settings:t||{},onSave:o,loading:!1,settingsPath:s||"~/.claude/settings.json"})})}function n8({open:e,onClose:t,item:n,intermediatePaths:s,onMove:o}){const[d,u]=C.useState("copy"),[l,c]=C.useState(null),[f,m]=C.useState(""),[h,x]=C.useState(!1),w=()=>{const j=f.trim()||l;if(!j){X.error("Please select or enter a target path");return}o(n.path,j,d,h)};return r.jsx(_t,{open:e,onOpenChange:t,children:r.jsxs(vt,{className:"max-w-md",children:[r.jsxs(yt,{children:[r.jsxs(bt,{children:[d==="copy"?"Copy":"Move"," ",n==null?void 0:n.name]}),r.jsx(er,{children:"Select a destination for this file"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(se,{variant:d==="copy"?"default":"outline",size:"sm",onClick:()=>u("copy"),children:[r.jsx(Nl,{className:"w-4 h-4 mr-1"})," Copy"]}),r.jsxs(se,{variant:d==="move"?"default":"outline",size:"sm",onClick:()=>u("move"),children:[r.jsx(zC,{className:"w-4 h-4 mr-1"})," Move"]})]}),r.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:s==null?void 0:s.map(j=>r.jsxs("div",{className:Te("flex items-center justify-between p-2 rounded border cursor-pointer",l===j.dir?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"hover:bg-gray-50 dark:hover:bg-slate-800"),onClick:()=>{c(j.dir),m("")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[j.isHome?r.jsx(fg,{className:"w-4 h-4"}):r.jsx(Dr,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm",children:j.label})]}),j.hasClaudeFolder?r.jsx(Ze,{variant:"secondary",className:"text-xs",children:"exists"}):r.jsx(Ze,{variant:"outline",className:"text-xs",children:"create"})]},j.dir))}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Or enter custom path:"}),r.jsx(dt,{className:"mt-1 font-mono text-sm",placeholder:"/path/to/directory",value:f,onChange:j=>{m(j.target.value),c(null)}})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ft,{checked:h,onCheckedChange:x}),r.jsx("span",{className:"text-sm",children:"Merge if target exists"})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(se,{onClick:w,children:d==="copy"?"Copy":"Move"})]})]})})}function s8({open:e,onClose:t,item:n,onRename:s}){const[o,d]=C.useState("");C.useEffect(()=>{n!=null&&n.name&&d(n.name.replace(/\.md$/,""))},[n,e]);const u=()=>{if(!o.trim()){X.error("Please enter a name");return}s(n,o.trim())};return r.jsx(_t,{open:e,onOpenChange:t,children:r.jsxs(vt,{className:"sm:max-w-md",children:[r.jsx(yt,{children:r.jsxs(bt,{children:["Rename ",n==null?void 0:n.type]})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"New name"}),r.jsx(dt,{className:"mt-1",placeholder:"new-name",value:o,onChange:l=>d(l.target.value),onKeyDown:l=>l.key==="Enter"&&u()}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:".md extension will be added automatically"})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(se,{onClick:u,children:"Rename"})]})]})})}function i8({open:e,onClose:t,dir:n,type:s,onCreate:o}){const[d,u]=C.useState("");C.useEffect(()=>{u("")},[e]);const l=()=>{if((s==="command"||s==="rule"||s==="workflow"||s==="memory")&&!d.trim()){X.error("Please enter a name");return}const m=s==="command"||s==="rule"||s==="workflow"||s==="memory"?d.endsWith(".md")?d:`${d}.md`:d;o(n,m,s)},c=Dl[s]||{},f=s==="command"||s==="rule"||s==="workflow"||s==="memory";return r.jsx(_t,{open:e,onOpenChange:t,children:r.jsxs(vt,{className:"max-w-sm",children:[r.jsx(yt,{children:r.jsxs(bt,{children:["Create ",c.label||s]})}),f&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name"}),r.jsx(dt,{className:"mt-1",placeholder:s==="command"?"my-command.md":s==="workflow"?"my-workflow.md":s==="memory"?"context.md":"my-rule.md",value:d,onChange:m=>u(m.target.value),onKeyDown:m=>m.key==="Enter"&&l()})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(se,{onClick:l,children:"Create"})]})]})})}function o8({project:e,onRefresh:t}){var Qe,Xe,ct;const[n,s]=C.useState([]),[o,d]=C.useState([]),[u,l]=C.useState(null),[c,f]=C.useState(null),[m,h]=C.useState(null),[x,w]=C.useState(()=>{try{return localStorage.getItem("claude-config-expanded-folder")||null}catch{return null}}),[j,_]=C.useState({}),[b,v]=C.useState(!0),[g,y]=C.useState({open:!1,item:null}),[k,E]=C.useState({open:!1,dir:null,type:null}),[P,T]=C.useState({open:!1,item:null}),[N,M]=C.useState(!1),[I,O]=C.useState({open:!1,projectDir:null}),[B,z]=C.useState({open:!1,dir:null,name:null}),[q,H]=C.useState({open:!1,dir:null}),[G,J]=C.useState({x:0,y:0,item:null}),[K,F]=C.useState(["claude"]),R=C.useCallback(async()=>{var je;try{v(!0);const[we,Le,Se,Ee]=await Promise.all([ge.getClaudeFolders(),ge.getIntermediatePaths(),ge.getRegistry(),ge.getConfig()]);if(s(we),d(Le),l(Se),F(((je=Ee.config)==null?void 0:je.enabledTools)||["claude"]),we.length>0){const ie=localStorage.getItem("claude-config-expanded-folder");if(!ie||!we.find(xe=>xe.dir===ie)){const xe=we.filter(ze=>!ze.isSubproject),Pe=xe.length>1?xe[xe.length-1]:xe[0],$e=(Pe==null?void 0:Pe.dir)||we[0].dir;w($e);try{localStorage.setItem("claude-config-expanded-folder",$e)}catch{}}}}catch(we){X.error("Failed to load data: "+we.message)}finally{v(!1)}},[]);C.useEffect(()=>{R(),f(null),h(null)},[R,e==null?void 0:e.dir]);const L=je=>{const we=x===je?null:je;w(we);try{we?localStorage.setItem("claude-config-expanded-folder",we):localStorage.removeItem("claude-config-expanded-folder")}catch{}},V=async je=>{f(je);try{const we=await ge.getClaudeFile(je.path);h(we)}catch(we){X.error("Failed to load file: "+we.message)}},$=async je=>{if(c)try{await ge.saveClaudeFile(c.path,je),X.success("Saved");const we=await ge.getClaudeFile(c.path);h(we),R()}catch(we){X.error("Failed to save: "+we.message)}},ne=je=>{_(we=>({...we,[je]:!we[je]}))},he=(je,we)=>{je.preventDefault(),J({x:je.clientX,y:je.clientY,item:we})},me=async(je,we)=>{we==="command"||we==="rule"||we==="workflow"||we==="memory"?E({open:!0,dir:je,type:we}):we==="claudemd"?H({open:!0,dir:je}):Y(je,we==="mcps"?"mcps.json":we==="settings"?"settings.json":we==="env"?".env":"CLAUDE.md",we)},Y=async(je,we,Le)=>{try{const Se=await ge.createClaudeFile(je,we,Le);if(X.success("Created"),E({open:!1,dir:null,type:null}),await R(),Se.path){const Ee={path:Se.path,name:we,type:["command","rule","workflow","env","mcps","settings","claudemd","memory"].includes(Le)?Le:"file"};f(Ee),h({content:Se.content||"",parsed:null})}}catch(Se){X.error("Failed to create: "+Se.message)}},W=async(je,we)=>{try{const Le=await ge.renameClaudeFile(je.path,we);Le.success?(X.success("Renamed"),T({open:!1,item:null}),await R(),f({...je,path:Le.newPath,name:we.endsWith(".md")?we:`${we}.md`})):X.error(Le.error||"Failed to rename")}catch(Le){X.error("Failed to rename: "+Le.message)}},le=async je=>{if(confirm(`Delete ${je.name}?`))try{await ge.deleteClaudeFile(je.path),X.success("Deleted"),(c==null?void 0:c.path)===je.path&&(f(null),h(null)),R()}catch(we){X.error("Failed to delete: "+we.message)}},te=async(je,we,Le,Se)=>{try{await ge.moveClaudeItem(je,we,Le,Se),X.success(Le==="copy"?"Copied":"Moved"),y({open:!1,item:null}),R()}catch(Ee){X.error("Failed: "+Ee.message)}},Q=async je=>{if(je)try{const we=await ge.addManualSubproject(I.projectDir,je);we.success?(X.success(`Added sub-project: ${je.split("/").pop()}`),O({open:!1,projectDir:null}),R()):X.error(we.error||"Failed to add sub-project")}catch(we){X.error("Failed to add sub-project: "+we.message)}},oe=async je=>{const we=n.find(Le=>!Le.isSubproject&&!Le.isHome);if(we)try{const Le=await ge.removeManualSubproject(we.dir,je);Le.success?(X.success("Removed sub-project"),R()):X.error(Le.error||"Failed to remove sub-project")}catch(Le){X.error("Failed to remove sub-project: "+Le.message)}},ye=async je=>{const we=n.find(Le=>!Le.isSubproject&&!Le.isHome);if(we)try{const Le=await ge.hideSubproject(we.dir,je);Le.success?(X.success("Sub-project hidden"),R()):X.error(Le.error||"Failed to hide sub-project")}catch(Le){X.error("Failed to hide sub-project: "+Le.message)}},Be=()=>{if(!c||!m)return r.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-slate-400",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Jm,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"Select a file to edit"})]})});const je=c.path?c.path.replace(/\/.claude\/mcps\.json$/,""):null;switch(c.type){case"mcps":return r.jsx(SB,{content:m.content,parsed:m.parsed,onSave:$,registry:u,configDir:je});case"settings":return r.jsx(r8,{content:m.content,parsed:m.parsed,onSave:$,filePath:c==null?void 0:c.path});case"command":case"rule":case"workflow":case"claudemd":case"env":return r.jsx(ow,{content:m.content,onSave:$,fileType:c.type});default:return r.jsx(ow,{content:m.content,onSave:$,fileType:"claudemd"})}};if(b)return r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(vr,{className:"w-6 h-6 animate-spin text-gray-400"})});const Ke=n.some(je=>je.isSubproject),ce=(je,we)=>we===0,be=(je,we)=>{const Le=n.findIndex(Se=>Se.isSubproject);return!je.isSubproject&&(Le>=0?we===Le-1:we===n.length-1)};return r.jsxs("div",{className:"h-full flex",children:[r.jsxs("div",{className:"w-76 border-r flex flex-col bg-white dark:bg-slate-950",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[r.jsx("h2",{className:"font-semibold text-sm",children:"Project Config"}),r.jsxs("div",{className:"flex gap-1",children:[K.includes("claude")&&K.includes("antigravity")&&r.jsxs(se,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>M(!0),title:"Sync rules between tools",children:[r.jsx(o5,{className:"w-4 h-4 mr-1"}),"Sync"]}),r.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:R,children:r.jsx(vr,{className:"w-4 h-4"})})]})]}),r.jsx(Hn,{className:"flex-1",children:n.map((je,we)=>r.jsx(QF,{folder:je,isExpanded:x===je.dir,isHome:ce(je,we),isProject:be(je,we),isSubproject:je.isSubproject,depth:je.depth||0,onToggle:()=>L(je.dir),onCreateFile:me,onInstallPlugin:(Le,Se)=>z({open:!0,dir:Le,name:Se}),onSelectItem:V,selectedPath:c==null?void 0:c.path,onContextMenu:he,expandedFolders:j,onToggleFolder:ne,hasSubprojects:Ke,onAddSubproject:Le=>O({open:!0,projectDir:Le}),onRemoveSubproject:oe,onHideSubproject:ye,enabledTools:K},je.dir))})]}),r.jsxs("div",{className:"flex-1 flex flex-col bg-gray-50 dark:bg-slate-900",children:[c&&r.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-white dark:bg-slate-950",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm",children:r.jsx("span",{className:"text-gray-500 dark:text-slate-400 font-mono truncate max-w-md",children:c.path})}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>y({open:!0,item:c}),children:r.jsx(Nl,{className:"w-4 h-4"})}),r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>le(c),children:r.jsx(un,{className:"w-4 h-4"})})]})]}),r.jsx("div",{className:"flex-1",children:Be()})]}),G.item&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>J({x:0,y:0,item:null})}),r.jsxs("div",{className:"fixed z-50 bg-white dark:bg-slate-950 rounded-md shadow-lg border py-1 min-w-[160px]",style:{left:G.x,top:G.y},children:[(((Qe=G.item)==null?void 0:Qe.type)==="rule"||((Xe=G.item)==null?void 0:Xe.type)==="command"||((ct=G.item)==null?void 0:ct.type)==="workflow")&&r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{T({open:!0,item:G.item}),J({x:0,y:0,item:null})},children:[r.jsx(WC,{className:"w-4 h-4 mr-2"})," Rename"]}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{y({open:!0,item:G.item}),J({x:0,y:0,item:null})},children:[r.jsx(Nl,{className:"w-4 h-4 mr-2"})," Copy to..."]}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{y({open:!0,item:G.item}),J({x:0,y:0,item:null})},children:[r.jsx(zC,{className:"w-4 h-4 mr-2"})," Move to..."]}),r.jsx("div",{className:"border-t my-1"}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center text-red-600",onClick:()=>{le(G.item),J({x:0,y:0,item:null})},children:[r.jsx(un,{className:"w-4 h-4 mr-2"})," Delete"]})]})]}),r.jsx(n8,{open:g.open,onClose:()=>y({open:!1,item:null}),item:g.item,intermediatePaths:o,onMove:te}),r.jsx(i8,{open:k.open,onClose:()=>E({open:!1,dir:null,type:null}),dir:k.dir,type:k.type,onCreate:Y}),r.jsx(s8,{open:P.open,onClose:()=>T({open:!1,item:null}),item:P.item,onRename:W}),r.jsx(d6,{open:N,onOpenChange:M,projectDir:e==null?void 0:e.dir,onSynced:R}),r.jsx(VF,{open:B.open,onOpenChange:je=>z({...B,open:je}),projectDir:B.dir,projectName:B.name}),r.jsx(Gg,{open:I.open,onOpenChange:je=>O({...I,open:je}),onSelect:Q,type:"directory",title:"Add Sub-project",initialPath:I.projectDir||"~"}),r.jsx(yj,{open:q.open,onOpenChange:je=>{H({...q,open:je}),je||R()},title:"Initialize CLAUDE.md",description:"Running claude -p /init to generate project-aware CLAUDE.md",cwd:q.dir,initialCommand:"claude -p /init; exit",autoCloseOnExit:!0,autoCloseDelay:2e3})]})}function a8({projects:e=[],activeProject:t=null,onSwitch:n,onAddClick:s,onManageClick:o,disabled:d=!1}){const u=(t==null?void 0:t.name)||"No Project";return r.jsxs(Ks,{children:[r.jsx(qs,{asChild:!0,children:r.jsxs(se,{variant:"outline",className:"gap-2 max-w-[220px] h-9",disabled:d,children:[r.jsx(_i,{className:"w-4 h-4 text-indigo-500 flex-shrink-0"}),r.jsx("span",{className:"truncate font-medium",children:u}),r.jsx(pr,{className:"w-4 h-4 opacity-50 flex-shrink-0"})]})}),r.jsxs(Cs,{align:"start",className:"w-72",children:[r.jsx(Ml,{className:"text-xs text-gray-500 font-normal",children:"Projects"}),r.jsx(Yr,{}),e.length===0?r.jsxs("div",{className:"px-3 py-6 text-sm text-gray-500 text-center",children:[r.jsx(Dr,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),r.jsx("p",{children:"No projects registered"}),r.jsx("p",{className:"text-xs mt-1",children:"Add a project to get started"})]}):r.jsx("div",{className:"max-h-64 overflow-y-auto",children:e.map(l=>r.jsxs(Mt,{onClick:()=>!l.isActive&&n(l.id),className:`flex items-start gap-2 py-2 cursor-pointer ${l.isActive?"bg-indigo-50":""}`,disabled:l.isActive,children:[r.jsx("div",{className:"mt-0.5 flex-shrink-0",children:l.isActive?r.jsx(Dt,{className:"w-4 h-4 text-indigo-600"}):l.exists?r.jsx(Dr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Vl,{className:"w-4 h-4 text-amber-500"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:`truncate font-medium ${l.isActive?"text-indigo-700":""}`,children:l.name}),r.jsx("div",{className:"truncate text-xs text-gray-400 font-mono",children:l.path.replace(/^\/Users\/[^/]+/,"~")}),!l.exists&&r.jsx("div",{className:"text-xs text-amber-600 mt-0.5",children:"Path not found"})]}),l.hasClaudeConfig&&r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-2 h-2 rounded-full bg-green-400",title:"Has .claude config"})})]},l.id))}),r.jsx(Yr,{}),r.jsxs(Mt,{onClick:s,className:"gap-2 cursor-pointer",children:[r.jsx(kt,{className:"w-4 h-4"}),"Add Project"]}),e.length>0&&r.jsxs(Mt,{onClick:o,className:"gap-2 cursor-pointer",children:[r.jsx(Qm,{className:"w-4 h-4"}),"Manage Projects"]})]})]})}const ym="claude-config-welcome-seen";function l8({onStartTutorial:e}){const[t,n]=C.useState(!1),[s,o]=C.useState(!0);C.useEffect(()=>{if(!localStorage.getItem(ym)){const c=setTimeout(()=>n(!0),500);return()=>clearTimeout(c)}},[]);const d=()=>{s&&localStorage.setItem(ym,"true"),n(!1)},u=()=>{s&&localStorage.setItem(ym,"true"),n(!1),e==null||e()};return r.jsx(_t,{open:t,onOpenChange:n,children:r.jsxs(vt,{className:"sm:max-w-lg",children:[r.jsxs(yt,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg",children:r.jsx(zn,{className:"w-6 h-6 text-white"})}),r.jsx(bt,{className:"text-2xl",children:"Welcome to Coder Config"})]}),r.jsx(er,{className:"text-base pt-2",children:"Your control center for Claude Code and AI coding tools."})]}),r.jsxs("div",{className:"py-4 space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"We built Coder Config because managing AI coding assistants shouldn't require editing JSON files or memorizing command-line flags. You deserve a visual interface that makes configuration easy."}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 py-2",children:[r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(bs,{className:"w-5 h-5 mx-auto mb-2 text-indigo-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"MCP Servers"})]}),r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(ks,{className:"w-5 h-5 mx-auto mb-2 text-green-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Permissions"})]}),r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(Yt,{className:"w-5 h-5 mx-auto mb-2 text-amber-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Rules & Memory"})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Take our guided tutorial to learn the basics, or dive in and explore on your own."}),r.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[r.jsx(ro,{id:"dont-ask",checked:s,onCheckedChange:o}),r.jsx(qt,{htmlFor:"dont-ask",className:"text-sm text-muted-foreground cursor-pointer",children:"Don't show this again"})]})]}),r.jsxs(At,{className:"flex gap-2 sm:gap-2",children:[r.jsx(se,{variant:"ghost",onClick:d,children:"Skip for now"}),r.jsxs(se,{onClick:u,className:"gap-2",children:[r.jsx(Yd,{className:"w-4 h-4"}),"Start Tutorial",r.jsx(cg,{className:"w-4 h-4"})]})]})]})})}const bm="claude-config:claude-init-preference";function Xj({open:e,onOpenChange:t,onAdded:n}){const[s,o]=C.useState(""),[d,u]=C.useState(""),[l,c]=C.useState(!1),[f,m]=C.useState(!1),[h,x]=C.useState(!0),[w,j]=C.useState([]),[_,b]=C.useState(null),v=C.useRef(null);C.useEffect(()=>{const E=localStorage.getItem(bm);E==="never"?x(!1):E==="always"&&x(!0)},[]),C.useEffect(()=>{if(e){o(""),u(""),j([]),b(null);const E=localStorage.getItem(bm);x(E!=="never")}},[e]),C.useEffect(()=>{v.current&&(v.current.scrollTop=v.current.scrollHeight)},[w]),C.useEffect(()=>{if(s&&!d){const E=s.split("/").pop();u(E||"")}},[s]);const g=E=>{o(E),c(!1)},y=async()=>{if(!s){X.error("Please select a project path");return}m(!0),j([]),b(null);try{if(h){b("running");const P=await new Promise(T=>{const N=new EventSource(`/api/projects/init-stream?path=${encodeURIComponent(s)}`);N.onmessage=M=>{const I=JSON.parse(M.data);I.type==="output"?j(O=>[...O,I.text]):I.type==="status"?j(O=>[...O,I.message+`
599
+ }`}),children:[r.jsx(kt,{className:"w-4 h-4 mr-1"}),"Add MCP"]})]}),r.jsx("div",{className:"space-y-2",children:Object.keys(y).length===0?r.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No MCP servers configured"}):Object.entries(y).map(([O,B])=>r.jsxs(tc,{open:j[O],onOpenChange:()=>P(O),children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-background group",children:[r.jsxs(rc,{className:"flex items-center gap-2 flex-1 text-left",children:[j[O]?r.jsx(pr,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(Xr,{className:"w-4 h-4 text-muted-foreground"}),r.jsx(kn,{className:"w-4 h-4 text-blue-500"}),r.jsx("span",{className:"font-medium text-sm",children:O}),r.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:B.command})]}),r.jsx(se,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 text-destructive hover:text-destructive",onClick:()=>E(O),children:r.jsx(un,{className:"w-4 h-4"})})]}),r.jsx(nc,{children:r.jsx("div",{className:"mt-2 ml-6 p-3 rounded-lg bg-muted/50 border",children:r.jsx("pre",{className:"text-xs font-mono text-muted-foreground overflow-x-auto",children:JSON.stringify(B,null,2)})})})]},O))})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(Yt,{className:"w-4 h-4 text-blue-500"}),"Model"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Model"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Model used for Gemini CLI sessions"})]}),r.jsxs(jr,{value:g("model","name",""),onValueChange:O=>v("model","name",O),children:[r.jsx(gr,{className:"w-48",children:r.jsx(Nr,{placeholder:"Select model"})}),r.jsx(xr,{children:t8.map(O=>r.jsx(Et,{value:O.id,children:r.jsx("div",{className:"flex flex-col",children:r.jsx("span",{children:O.name})})},O.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Preview Features"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable access to experimental models and features"})]}),r.jsx(ft,{checked:g("general","previewFeatures",!1),onCheckedChange:O=>v("general","previewFeatures",O)})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(yM,{className:"w-4 h-4 text-blue-500"}),"Appearance"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Theme"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Color theme for the CLI interface"})]}),r.jsxs(jr,{value:g("ui","theme","Default"),onValueChange:O=>v("ui","theme",O),children:[r.jsx(gr,{className:"w-40",children:r.jsx(Nr,{})}),r.jsx(xr,{children:e8.map(O=>r.jsx(Et,{value:O.id,children:O.name},O.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Format"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Format for CLI output"})]}),r.jsxs(jr,{value:g("output","format","text"),onValueChange:O=>v("output","format",O),children:[r.jsx(gr,{className:"w-40",children:r.jsx(Nr,{})}),r.jsxs(xr,{children:[r.jsx(Et,{value:"text",children:"Text"}),r.jsx(Et,{value:"json",children:"JSON"})]})]})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx($C,{className:"w-4 h-4 text-blue-500"}),"Display Options"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Dynamic Window Title"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Update title with status icons (Ready, Working, etc.)"})]}),r.jsx(ft,{checked:g("ui","dynamicWindowTitle",!0),onCheckedChange:O=>v("ui","dynamicWindowTitle",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Show Line Numbers"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Display line numbers in chat"})]}),r.jsx(ft,{checked:g("ui","showLineNumbers",!0),onCheckedChange:O=>v("ui","showLineNumbers",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Show Citations"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Display citations for generated text"})]}),r.jsx(ft,{checked:g("ui","showCitations",!1),onCheckedChange:O=>v("ui","showCitations",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Hide Context Summary"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Hide GEMINI.md and MCP servers above input"})]}),r.jsx(ft,{checked:g("ui","hideContextSummary",!1),onCheckedChange:O=>v("ui","hideContextSummary",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Hide Footer"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Remove footer entirely from the UI"})]}),r.jsx(ft,{checked:g("ui","hideFooter",!1),onCheckedChange:O=>v("ui","hideFooter",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Screen Reader Mode"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Render output in plain-text for accessibility"})]}),r.jsx(ft,{checked:((N=(T=o==null?void 0:o.ui)==null?void 0:T.accessibility)==null?void 0:N.screenReader)??!1,onCheckedChange:O=>d(B=>{var z;return{...B,ui:{...B.ui,accessibility:{...(z=B.ui)==null?void 0:z.accessibility,screenReader:O}}}})})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(zn,{className:"w-4 h-4 text-blue-500"}),"General"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Vim Mode"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable Vim keybindings in the prompt editor"})]}),r.jsx(ft,{checked:g("general","vimMode",!1),onCheckedChange:O=>v("general","vimMode",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Auto Update"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow automatic updates to Gemini CLI"})]}),r.jsx(ft,{checked:g("general","enableAutoUpdate",!0),onCheckedChange:O=>v("general","enableAutoUpdate",O)})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Checkpointing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable session recovery support"})]}),r.jsx(ft,{checked:((I=(M=o==null?void 0:o.general)==null?void 0:M.checkpointing)==null?void 0:I.enabled)??!1,onCheckedChange:O=>d(B=>{var z;return{...B,general:{...B.general,checkpointing:{...(z=B.general)==null?void 0:z.checkpointing,enabled:O}}}})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Respect .gitignore"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Exclude files matching .gitignore patterns"})]}),r.jsx(ft,{checked:g("general","respectGitignore",!0),onCheckedChange:O=>v("general","respectGitignore",O)})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(ks,{className:"w-4 h-4 text-blue-500"}),"Privacy"]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Usage Statistics"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow collection of anonymous usage data"})]}),r.jsx(ft,{checked:g("privacy","usageStatisticsEnabled",!0),onCheckedChange:O=>v("privacy","usageStatisticsEnabled",O)})]})})]})]}),r.jsx(_t,{open:x.open,onOpenChange:O=>w({...x,open:O}),children:r.jsxs(vt,{className:"bg-card",children:[r.jsxs(yt,{children:[r.jsx(bt,{children:"Add MCP Server"}),r.jsx(er,{children:"Add a new MCP server to Gemini CLI"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name"}),r.jsx(dt,{value:x.name,onChange:O=>w({...x,name:O.target.value}),placeholder:"my-mcp-server",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Configuration (JSON)"}),r.jsx(xt,{value:x.json,onChange:O=>w({...x,json:O.target.value}),className:"mt-1 font-mono text-sm",rows:6})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"ghost",onClick:()=>w({open:!1,name:"",json:""}),children:"Cancel"}),r.jsxs(se,{onClick:k,children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Add MCP"]})]})]})})]})}function r8({content:e,parsed:t,onSave:n,filePath:s}){const o=async l=>{const c=JSON.stringify(l,null,2);n(c)},d=(s==null?void 0:s.includes(".gemini"))||(s==null?void 0:s.includes("/.gemini/")),u=(s==null?void 0:s.includes(".agent"))||(s==null?void 0:s.includes("/antigravity/"));return d&&!u?r.jsx("div",{className:"h-full overflow-auto p-4",children:r.jsx(Yj,{settings:t||{},onSave:o,loading:!1,settingsPath:s||"~/.gemini/settings.json"})}):r.jsx("div",{className:"h-full overflow-auto p-4",children:r.jsx(qj,{settings:t||{},onSave:o,loading:!1,settingsPath:s||"~/.claude/settings.json"})})}function n8({open:e,onClose:t,item:n,intermediatePaths:s,onMove:o}){const[d,u]=C.useState("copy"),[l,c]=C.useState(null),[f,m]=C.useState(""),[h,x]=C.useState(!1),w=()=>{const j=f.trim()||l;if(!j){X.error("Please select or enter a target path");return}o(n.path,j,d,h)};return r.jsx(_t,{open:e,onOpenChange:t,children:r.jsxs(vt,{className:"max-w-md",children:[r.jsxs(yt,{children:[r.jsxs(bt,{children:[d==="copy"?"Copy":"Move"," ",n==null?void 0:n.name]}),r.jsx(er,{children:"Select a destination for this file"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(se,{variant:d==="copy"?"default":"outline",size:"sm",onClick:()=>u("copy"),children:[r.jsx(Nl,{className:"w-4 h-4 mr-1"})," Copy"]}),r.jsxs(se,{variant:d==="move"?"default":"outline",size:"sm",onClick:()=>u("move"),children:[r.jsx(zC,{className:"w-4 h-4 mr-1"})," Move"]})]}),r.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:s==null?void 0:s.map(j=>r.jsxs("div",{className:Te("flex items-center justify-between p-2 rounded border cursor-pointer",l===j.dir?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"hover:bg-gray-50 dark:hover:bg-slate-800"),onClick:()=>{c(j.dir),m("")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[j.isHome?r.jsx(fg,{className:"w-4 h-4"}):r.jsx(Dr,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm",children:j.label})]}),j.hasClaudeFolder?r.jsx(Ze,{variant:"secondary",className:"text-xs",children:"exists"}):r.jsx(Ze,{variant:"outline",className:"text-xs",children:"create"})]},j.dir))}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Or enter custom path:"}),r.jsx(dt,{className:"mt-1 font-mono text-sm",placeholder:"/path/to/directory",value:f,onChange:j=>{m(j.target.value),c(null)}})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ft,{checked:h,onCheckedChange:x}),r.jsx("span",{className:"text-sm",children:"Merge if target exists"})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(se,{onClick:w,children:d==="copy"?"Copy":"Move"})]})]})})}function s8({open:e,onClose:t,item:n,onRename:s}){const[o,d]=C.useState("");C.useEffect(()=>{n!=null&&n.name&&d(n.name.replace(/\.md$/,""))},[n,e]);const u=()=>{if(!o.trim()){X.error("Please enter a name");return}s(n,o.trim())};return r.jsx(_t,{open:e,onOpenChange:t,children:r.jsxs(vt,{className:"sm:max-w-md",children:[r.jsx(yt,{children:r.jsxs(bt,{children:["Rename ",n==null?void 0:n.type]})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"New name"}),r.jsx(dt,{className:"mt-1",placeholder:"new-name",value:o,onChange:l=>d(l.target.value),onKeyDown:l=>l.key==="Enter"&&u()}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:".md extension will be added automatically"})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(se,{onClick:u,children:"Rename"})]})]})})}function i8({open:e,onClose:t,dir:n,type:s,onCreate:o}){const[d,u]=C.useState("");C.useEffect(()=>{u("")},[e]);const l=()=>{if((s==="command"||s==="rule"||s==="workflow"||s==="memory")&&!d.trim()){X.error("Please enter a name");return}const m=s==="command"||s==="rule"||s==="workflow"||s==="memory"?d.endsWith(".md")?d:`${d}.md`:d;o(n,m,s)},c=Dl[s]||{},f=s==="command"||s==="rule"||s==="workflow"||s==="memory";return r.jsx(_t,{open:e,onOpenChange:t,children:r.jsxs(vt,{className:"max-w-sm",children:[r.jsx(yt,{children:r.jsxs(bt,{children:["Create ",c.label||s]})}),f&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name"}),r.jsx(dt,{className:"mt-1",placeholder:s==="command"?"my-skill.md":s==="workflow"?"my-workflow.md":s==="memory"?"context.md":"my-rule.md",value:d,onChange:m=>u(m.target.value),onKeyDown:m=>m.key==="Enter"&&l()})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(se,{onClick:l,children:"Create"})]})]})})}function o8({project:e,onRefresh:t}){var Qe,Xe,ct;const[n,s]=C.useState([]),[o,d]=C.useState([]),[u,l]=C.useState(null),[c,f]=C.useState(null),[m,h]=C.useState(null),[x,w]=C.useState(()=>{try{return localStorage.getItem("claude-config-expanded-folder")||null}catch{return null}}),[j,_]=C.useState({}),[b,v]=C.useState(!0),[g,y]=C.useState({open:!1,item:null}),[k,E]=C.useState({open:!1,dir:null,type:null}),[P,T]=C.useState({open:!1,item:null}),[N,M]=C.useState(!1),[I,O]=C.useState({open:!1,projectDir:null}),[B,z]=C.useState({open:!1,dir:null,name:null}),[q,H]=C.useState({open:!1,dir:null}),[G,J]=C.useState({x:0,y:0,item:null}),[K,F]=C.useState(["claude"]),R=C.useCallback(async()=>{var je;try{v(!0);const[we,Le,Se,Ee]=await Promise.all([ge.getClaudeFolders(),ge.getIntermediatePaths(),ge.getRegistry(),ge.getConfig()]);if(s(we),d(Le),l(Se),F(((je=Ee.config)==null?void 0:je.enabledTools)||["claude"]),we.length>0){const ie=localStorage.getItem("claude-config-expanded-folder");if(!ie||!we.find(xe=>xe.dir===ie)){const xe=we.filter(ze=>!ze.isSubproject),Pe=xe.length>1?xe[xe.length-1]:xe[0],$e=(Pe==null?void 0:Pe.dir)||we[0].dir;w($e);try{localStorage.setItem("claude-config-expanded-folder",$e)}catch{}}}}catch(we){X.error("Failed to load data: "+we.message)}finally{v(!1)}},[]);C.useEffect(()=>{R(),f(null),h(null)},[R,e==null?void 0:e.dir]);const L=je=>{const we=x===je?null:je;w(we);try{we?localStorage.setItem("claude-config-expanded-folder",we):localStorage.removeItem("claude-config-expanded-folder")}catch{}},V=async je=>{f(je);try{const we=await ge.getClaudeFile(je.path);h(we)}catch(we){X.error("Failed to load file: "+we.message)}},$=async je=>{if(c)try{await ge.saveClaudeFile(c.path,je),X.success("Saved");const we=await ge.getClaudeFile(c.path);h(we),R()}catch(we){X.error("Failed to save: "+we.message)}},ne=je=>{_(we=>({...we,[je]:!we[je]}))},he=(je,we)=>{je.preventDefault(),J({x:je.clientX,y:je.clientY,item:we})},me=async(je,we)=>{we==="command"||we==="rule"||we==="workflow"||we==="memory"?E({open:!0,dir:je,type:we}):we==="claudemd"?H({open:!0,dir:je}):Y(je,we==="mcps"?"mcps.json":we==="settings"?"settings.json":we==="env"?".env":"CLAUDE.md",we)},Y=async(je,we,Le)=>{try{const Se=await ge.createClaudeFile(je,we,Le);if(X.success("Created"),E({open:!1,dir:null,type:null}),await R(),Se.path){const Ee={path:Se.path,name:we,type:["command","rule","workflow","env","mcps","settings","claudemd","memory"].includes(Le)?Le:"file"};f(Ee),h({content:Se.content||"",parsed:null})}}catch(Se){X.error("Failed to create: "+Se.message)}},W=async(je,we)=>{try{const Le=await ge.renameClaudeFile(je.path,we);Le.success?(X.success("Renamed"),T({open:!1,item:null}),await R(),f({...je,path:Le.newPath,name:we.endsWith(".md")?we:`${we}.md`})):X.error(Le.error||"Failed to rename")}catch(Le){X.error("Failed to rename: "+Le.message)}},le=async je=>{if(confirm(`Delete ${je.name}?`))try{await ge.deleteClaudeFile(je.path),X.success("Deleted"),(c==null?void 0:c.path)===je.path&&(f(null),h(null)),R()}catch(we){X.error("Failed to delete: "+we.message)}},te=async(je,we,Le,Se)=>{try{await ge.moveClaudeItem(je,we,Le,Se),X.success(Le==="copy"?"Copied":"Moved"),y({open:!1,item:null}),R()}catch(Ee){X.error("Failed: "+Ee.message)}},Q=async je=>{if(je)try{const we=await ge.addManualSubproject(I.projectDir,je);we.success?(X.success(`Added sub-project: ${je.split("/").pop()}`),O({open:!1,projectDir:null}),R()):X.error(we.error||"Failed to add sub-project")}catch(we){X.error("Failed to add sub-project: "+we.message)}},oe=async je=>{const we=n.find(Le=>!Le.isSubproject&&!Le.isHome);if(we)try{const Le=await ge.removeManualSubproject(we.dir,je);Le.success?(X.success("Removed sub-project"),R()):X.error(Le.error||"Failed to remove sub-project")}catch(Le){X.error("Failed to remove sub-project: "+Le.message)}},ye=async je=>{const we=n.find(Le=>!Le.isSubproject&&!Le.isHome);if(we)try{const Le=await ge.hideSubproject(we.dir,je);Le.success?(X.success("Sub-project hidden"),R()):X.error(Le.error||"Failed to hide sub-project")}catch(Le){X.error("Failed to hide sub-project: "+Le.message)}},Be=()=>{if(!c||!m)return r.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-slate-400",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Jm,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"Select a file to edit"})]})});const je=c.path?c.path.replace(/\/.claude\/mcps\.json$/,""):null;switch(c.type){case"mcps":return r.jsx(SB,{content:m.content,parsed:m.parsed,onSave:$,registry:u,configDir:je});case"settings":return r.jsx(r8,{content:m.content,parsed:m.parsed,onSave:$,filePath:c==null?void 0:c.path});case"command":case"rule":case"workflow":case"claudemd":case"env":return r.jsx(ow,{content:m.content,onSave:$,fileType:c.type});default:return r.jsx(ow,{content:m.content,onSave:$,fileType:"claudemd"})}};if(b)return r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(vr,{className:"w-6 h-6 animate-spin text-gray-400"})});const Ke=n.some(je=>je.isSubproject),ce=(je,we)=>we===0,be=(je,we)=>{const Le=n.findIndex(Se=>Se.isSubproject);return!je.isSubproject&&(Le>=0?we===Le-1:we===n.length-1)};return r.jsxs("div",{className:"h-full flex",children:[r.jsxs("div",{className:"w-76 border-r flex flex-col bg-white dark:bg-slate-950",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[r.jsx("h2",{className:"font-semibold text-sm",children:"Project Config"}),r.jsxs("div",{className:"flex gap-1",children:[K.includes("claude")&&K.includes("antigravity")&&r.jsxs(se,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>M(!0),title:"Sync rules between tools",children:[r.jsx(o5,{className:"w-4 h-4 mr-1"}),"Sync"]}),r.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:R,children:r.jsx(vr,{className:"w-4 h-4"})})]})]}),r.jsx(Hn,{className:"flex-1",children:n.map((je,we)=>r.jsx(QF,{folder:je,isExpanded:x===je.dir,isHome:ce(je,we),isProject:be(je,we),isSubproject:je.isSubproject,depth:je.depth||0,onToggle:()=>L(je.dir),onCreateFile:me,onInstallPlugin:(Le,Se)=>z({open:!0,dir:Le,name:Se}),onSelectItem:V,selectedPath:c==null?void 0:c.path,onContextMenu:he,expandedFolders:j,onToggleFolder:ne,hasSubprojects:Ke,onAddSubproject:Le=>O({open:!0,projectDir:Le}),onRemoveSubproject:oe,onHideSubproject:ye,enabledTools:K},je.dir))})]}),r.jsxs("div",{className:"flex-1 flex flex-col bg-gray-50 dark:bg-slate-900",children:[c&&r.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-white dark:bg-slate-950",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm",children:r.jsx("span",{className:"text-gray-500 dark:text-slate-400 font-mono truncate max-w-md",children:c.path})}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>y({open:!0,item:c}),children:r.jsx(Nl,{className:"w-4 h-4"})}),r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>le(c),children:r.jsx(un,{className:"w-4 h-4"})})]})]}),r.jsx("div",{className:"flex-1",children:Be()})]}),G.item&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>J({x:0,y:0,item:null})}),r.jsxs("div",{className:"fixed z-50 bg-white dark:bg-slate-950 rounded-md shadow-lg border py-1 min-w-[160px]",style:{left:G.x,top:G.y},children:[(((Qe=G.item)==null?void 0:Qe.type)==="rule"||((Xe=G.item)==null?void 0:Xe.type)==="command"||((ct=G.item)==null?void 0:ct.type)==="workflow")&&r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{T({open:!0,item:G.item}),J({x:0,y:0,item:null})},children:[r.jsx(WC,{className:"w-4 h-4 mr-2"})," Rename"]}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{y({open:!0,item:G.item}),J({x:0,y:0,item:null})},children:[r.jsx(Nl,{className:"w-4 h-4 mr-2"})," Copy to..."]}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{y({open:!0,item:G.item}),J({x:0,y:0,item:null})},children:[r.jsx(zC,{className:"w-4 h-4 mr-2"})," Move to..."]}),r.jsx("div",{className:"border-t my-1"}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center text-red-600",onClick:()=>{le(G.item),J({x:0,y:0,item:null})},children:[r.jsx(un,{className:"w-4 h-4 mr-2"})," Delete"]})]})]}),r.jsx(n8,{open:g.open,onClose:()=>y({open:!1,item:null}),item:g.item,intermediatePaths:o,onMove:te}),r.jsx(i8,{open:k.open,onClose:()=>E({open:!1,dir:null,type:null}),dir:k.dir,type:k.type,onCreate:Y}),r.jsx(s8,{open:P.open,onClose:()=>T({open:!1,item:null}),item:P.item,onRename:W}),r.jsx(d6,{open:N,onOpenChange:M,projectDir:e==null?void 0:e.dir,onSynced:R}),r.jsx(VF,{open:B.open,onOpenChange:je=>z({...B,open:je}),projectDir:B.dir,projectName:B.name}),r.jsx(Gg,{open:I.open,onOpenChange:je=>O({...I,open:je}),onSelect:Q,type:"directory",title:"Add Sub-project",initialPath:I.projectDir||"~"}),r.jsx(yj,{open:q.open,onOpenChange:je=>{H({...q,open:je}),je||R()},title:"Initialize CLAUDE.md",description:"Running claude -p /init to generate project-aware CLAUDE.md",cwd:q.dir,initialCommand:"claude -p /init; exit",autoCloseOnExit:!0,autoCloseDelay:2e3})]})}function a8({projects:e=[],activeProject:t=null,onSwitch:n,onAddClick:s,onManageClick:o,disabled:d=!1}){const u=(t==null?void 0:t.name)||"No Project";return r.jsxs(Ks,{children:[r.jsx(qs,{asChild:!0,children:r.jsxs(se,{variant:"outline",className:"gap-2 max-w-[220px] h-9",disabled:d,children:[r.jsx(_i,{className:"w-4 h-4 text-indigo-500 flex-shrink-0"}),r.jsx("span",{className:"truncate font-medium",children:u}),r.jsx(pr,{className:"w-4 h-4 opacity-50 flex-shrink-0"})]})}),r.jsxs(Cs,{align:"start",className:"w-72",children:[r.jsx(Ml,{className:"text-xs text-gray-500 font-normal",children:"Projects"}),r.jsx(Yr,{}),e.length===0?r.jsxs("div",{className:"px-3 py-6 text-sm text-gray-500 text-center",children:[r.jsx(Dr,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),r.jsx("p",{children:"No projects registered"}),r.jsx("p",{className:"text-xs mt-1",children:"Add a project to get started"})]}):r.jsx("div",{className:"max-h-64 overflow-y-auto",children:e.map(l=>r.jsxs(Mt,{onClick:()=>!l.isActive&&n(l.id),className:`flex items-start gap-2 py-2 cursor-pointer ${l.isActive?"bg-indigo-50":""}`,disabled:l.isActive,children:[r.jsx("div",{className:"mt-0.5 flex-shrink-0",children:l.isActive?r.jsx(Dt,{className:"w-4 h-4 text-indigo-600"}):l.exists?r.jsx(Dr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Vl,{className:"w-4 h-4 text-amber-500"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:`truncate font-medium ${l.isActive?"text-indigo-700":""}`,children:l.name}),r.jsx("div",{className:"truncate text-xs text-gray-400 font-mono",children:l.path.replace(/^\/Users\/[^/]+/,"~")}),!l.exists&&r.jsx("div",{className:"text-xs text-amber-600 mt-0.5",children:"Path not found"})]}),l.hasClaudeConfig&&r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-2 h-2 rounded-full bg-green-400",title:"Has .claude config"})})]},l.id))}),r.jsx(Yr,{}),r.jsxs(Mt,{onClick:s,className:"gap-2 cursor-pointer",children:[r.jsx(kt,{className:"w-4 h-4"}),"Add Project"]}),e.length>0&&r.jsxs(Mt,{onClick:o,className:"gap-2 cursor-pointer",children:[r.jsx(Qm,{className:"w-4 h-4"}),"Manage Projects"]})]})]})}const ym="claude-config-welcome-seen";function l8({onStartTutorial:e}){const[t,n]=C.useState(!1),[s,o]=C.useState(!0);C.useEffect(()=>{if(!localStorage.getItem(ym)){const c=setTimeout(()=>n(!0),500);return()=>clearTimeout(c)}},[]);const d=()=>{s&&localStorage.setItem(ym,"true"),n(!1)},u=()=>{s&&localStorage.setItem(ym,"true"),n(!1),e==null||e()};return r.jsx(_t,{open:t,onOpenChange:n,children:r.jsxs(vt,{className:"sm:max-w-lg",children:[r.jsxs(yt,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg",children:r.jsx(zn,{className:"w-6 h-6 text-white"})}),r.jsx(bt,{className:"text-2xl",children:"Welcome to Coder Config"})]}),r.jsx(er,{className:"text-base pt-2",children:"Your control center for Claude Code and AI coding tools."})]}),r.jsxs("div",{className:"py-4 space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"We built Coder Config because managing AI coding assistants shouldn't require editing JSON files or memorizing command-line flags. You deserve a visual interface that makes configuration easy."}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 py-2",children:[r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(bs,{className:"w-5 h-5 mx-auto mb-2 text-indigo-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"MCP Servers"})]}),r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(ks,{className:"w-5 h-5 mx-auto mb-2 text-green-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Permissions"})]}),r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(Yt,{className:"w-5 h-5 mx-auto mb-2 text-amber-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Rules & Memory"})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Take our guided tutorial to learn the basics, or dive in and explore on your own."}),r.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[r.jsx(ro,{id:"dont-ask",checked:s,onCheckedChange:o}),r.jsx(qt,{htmlFor:"dont-ask",className:"text-sm text-muted-foreground cursor-pointer",children:"Don't show this again"})]})]}),r.jsxs(At,{className:"flex gap-2 sm:gap-2",children:[r.jsx(se,{variant:"ghost",onClick:d,children:"Skip for now"}),r.jsxs(se,{onClick:u,className:"gap-2",children:[r.jsx(Yd,{className:"w-4 h-4"}),"Start Tutorial",r.jsx(cg,{className:"w-4 h-4"})]})]})]})})}const bm="claude-config:claude-init-preference";function Xj({open:e,onOpenChange:t,onAdded:n}){const[s,o]=C.useState(""),[d,u]=C.useState(""),[l,c]=C.useState(!1),[f,m]=C.useState(!1),[h,x]=C.useState(!0),[w,j]=C.useState([]),[_,b]=C.useState(null),v=C.useRef(null);C.useEffect(()=>{const E=localStorage.getItem(bm);E==="never"?x(!1):E==="always"&&x(!0)},[]),C.useEffect(()=>{if(e){o(""),u(""),j([]),b(null);const E=localStorage.getItem(bm);x(E!=="never")}},[e]),C.useEffect(()=>{v.current&&(v.current.scrollTop=v.current.scrollHeight)},[w]),C.useEffect(()=>{if(s&&!d){const E=s.split("/").pop();u(E||"")}},[s]);const g=E=>{o(E),c(!1)},y=async()=>{if(!s){X.error("Please select a project path");return}m(!0),j([]),b(null);try{if(h){b("running");const P=await new Promise(T=>{const N=new EventSource(`/api/projects/init-stream?path=${encodeURIComponent(s)}`);N.onmessage=M=>{const I=JSON.parse(M.data);I.type==="output"?j(O=>[...O,I.text]):I.type==="status"?j(O=>[...O,I.message+`
600
600
  `]):I.type==="skip"?j(O=>[...O,I.message+`
601
601
  `]):I.type==="done"?(N.close(),b(I.success?"success":"error"),T(I.success)):I.type==="error"&&(j(O=>[...O,`Error: ${I.message}
602
602
  `]),N.close(),b("error"),T(!1))},N.onerror=()=>{N.close(),j(M=>[...M,`Connection error - is Claude Code installed?
@@ -661,7 +661,7 @@ ${g.description}`;break;case"decision":if(!g.title.trim()){X.error("Title requir
661
661
 
662
662
  ${g.description}`;break;case"history":case"context":default:if(!g.content.trim()){X.error("Content required");return}H=g.content;break}try{const J=["pattern","decision","issue","history","context"].includes(G)?"project":"global";await ge.addMemoryEntry(G,H,J),X.success(`Added ${G} entry`),y({open:!1,type:"preference",name:"",description:"",wrong:"",right:"",category:"",details:"",title:"",context:"",decision:"",rationale:"",content:""}),k()}catch{X.error("Failed to add entry")}},M=async()=>{try{await ge.initProjectMemory(e.dir),X.success("Project memory initialized!"),k()}catch(H){X.error(H.message||"Failed to initialize")}};if(o)return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-indigo-600"})});const I={global:[{id:"preference",label:"Preference",icon:zn,desc:"User preferences (tools, style, etc.)"},{id:"correction",label:"Correction",icon:Sn,desc:"Mistakes to avoid"},{id:"fact",label:"Fact",icon:Xi,desc:"Facts about your environment"}],project:[{id:"context",label:"Context",icon:Er,desc:"Project overview and conventions"},{id:"pattern",label:"Pattern",icon:vu,desc:"Code patterns in this project"},{id:"decision",label:"Decision",icon:Yi,desc:"Architecture decisions"},{id:"issue",label:"Issue",icon:Sn,desc:"Known issues and workarounds"},{id:"history",label:"History",icon:vl,desc:"Session work log"}]};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-5 shadow-sm",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[r.jsx(Ji,{className:"w-5 h-5 text-purple-600"}),"Memory System"]}),r.jsx("div",{className:"flex gap-2",children:r.jsxs(se,{variant:"outline",size:"sm",onClick:()=>y({open:!0,type:"preference",name:"",description:"",wrong:"",right:"",category:"",details:"",title:"",context:"",decision:"",rationale:"",content:""}),children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Add Entry"]})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Search memory...",value:j,onChange:H=>_(H.target.value),onKeyDown:H=>H.key==="Enter"&&T(),className:"flex-1"}),r.jsx(se,{variant:"outline",onClick:T,children:r.jsx(Ul,{className:"w-4 h-4"})})]}),b.length>0&&r.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-slate-900 rounded-lg",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Search Results"}),r.jsx("div",{className:"space-y-2",children:b.map((H,G)=>r.jsxs("div",{className:"text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ze,{variant:H.scope==="global"?"default":"secondary",children:H.scope}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:H.file})]}),H.matches.map((J,K)=>r.jsxs("div",{className:"ml-4 text-gray-600 dark:text-slate-400 text-xs mt-1",children:["Line ",J.line,": ",J.text]},K))]},G))})]})]}),r.jsx("div",{className:"flex gap-2 border-b border-gray-200 dark:border-slate-700 pb-2",children:["global","project","sync"].map(H=>r.jsxs("button",{onClick:()=>w(H),className:`px-4 py-2 text-sm font-medium rounded-t-lg transition-colors ${x===H?"bg-white dark:bg-slate-950 border border-b-white dark:border-b-slate-950 border-gray-200 dark:border-slate-700 -mb-[1px] text-indigo-600 dark:text-indigo-400":"text-gray-600 dark:text-slate-400 hover:text-gray-900 dark:hover:text-white"}`,children:[H.charAt(0).toUpperCase()+H.slice(1)," Memory"]},H))}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:[r.jsxs("h3",{className:"font-medium text-gray-900 dark:text-white",children:[x==="global"&&"Global Memory Files",x==="project"&&"Project Memory Files",x==="sync"&&"Sync State"]}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:[x==="global"&&"~/.claude/memory/",x==="project"&&`${e.dir}/.claude/memory/`,x==="sync"&&"~/.claude/sync/"]})]}),r.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:[x==="global"&&((O=n==null?void 0:n.global)==null?void 0:O.files.map(H=>r.jsxs("button",{onClick:()=>H.exists&&l(H),className:`w-full px-4 py-3 flex items-center gap-3 text-left hover:bg-gray-50 dark:hover:bg-slate-900 transition-colors ${(u==null?void 0:u.path)===H.path?"bg-indigo-50 dark:bg-indigo-950/30":""} ${H.exists?"":"opacity-50"}`,children:[r.jsx(Er,{className:"w-4 h-4 text-gray-400 dark:text-slate-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:H.name}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:H.type})]}),H.exists?r.jsx(Dt,{className:"w-4 h-4 text-green-500"}):r.jsx("span",{className:"text-xs text-gray-400 dark:text-slate-500",children:"Not created"})]},H.name))),x==="project"&&r.jsx(r.Fragment,{children:(B=n==null?void 0:n.project)!=null&&B.initialized?(z=n==null?void 0:n.project)==null?void 0:z.files.map(H=>r.jsxs("button",{onClick:()=>H.exists&&l(H),className:`w-full px-4 py-3 flex items-center gap-3 text-left hover:bg-gray-50 dark:hover:bg-slate-900 transition-colors ${(u==null?void 0:u.path)===H.path?"bg-indigo-50 dark:bg-indigo-950/30":""} ${H.exists?"":"opacity-50"}`,children:[r.jsx(Er,{className:"w-4 h-4 text-gray-400 dark:text-slate-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:H.name}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:H.type})]}),H.exists?r.jsx(Dt,{className:"w-4 h-4 text-green-500"}):r.jsx("span",{className:"text-xs text-gray-400 dark:text-slate-500",children:"Not created"})]},H.name)):r.jsxs("div",{className:"p-6 text-center",children:[r.jsx(Ji,{className:"w-12 h-12 text-gray-300 dark:text-slate-600 mx-auto mb-3"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-4",children:"Project memory not initialized"}),r.jsxs(se,{onClick:M,className:"bg-purple-600 hover:bg-purple-700 text-white",children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Initialize Project Memory"]})]})}),x==="sync"&&r.jsx("div",{className:"p-4",children:(q=n==null?void 0:n.sync)!=null&&q.state?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Current State"}),r.jsx("pre",{className:"text-xs bg-gray-50 dark:bg-slate-900 p-3 rounded overflow-auto max-h-48 text-gray-800 dark:text-slate-300",children:JSON.stringify(n.sync.state,null,2)})]}),n.sync.history.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:["History (",n.sync.history.length,")"]}),r.jsx("div",{className:"space-y-1",children:n.sync.history.map((H,G)=>r.jsxs("div",{className:"text-xs text-gray-600 dark:text-slate-400 flex items-center gap-2",children:[r.jsx(vl,{className:"w-3 h-3"}),H.name]},G))})]})]}):r.jsxs("div",{className:"text-center py-6",children:[r.jsx(vl,{className:"w-12 h-12 text-gray-300 dark:text-slate-600 mx-auto mb-3"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:"No sync state"}),r.jsx("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-1",children:"State is created by session hooks"})]})})]})]}),r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700 flex items-center justify-between",children:[r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:u?u.name:"Select a file"}),u&&r.jsxs(se,{size:"sm",onClick:P,disabled:m,className:"bg-indigo-600 hover:bg-indigo-700 text-white",children:[m?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(En,{className:"w-4 h-4 mr-2"}),"Save"]})]}),r.jsx("div",{className:"p-4",children:u?r.jsx(xt,{value:c,onChange:H=>f(H.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"File content..."}):r.jsx("div",{className:"flex items-center justify-center h-[400px] text-gray-400 dark:text-slate-500",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Er,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),r.jsx("p",{children:"Select a file to edit"})]})})})]})]}),r.jsx(_t,{open:g.open,onOpenChange:H=>y({...g,open:H}),children:r.jsxs(vt,{className:"max-w-lg",children:[r.jsxs(yt,{children:[r.jsx(bt,{children:"Add Memory Entry"}),r.jsx(er,{children:"Add a new entry to the appropriate memory file."})]}),r.jsxs("div",{className:"py-4 space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Entry Type"}),r.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[...I.global,...I.project].map(H=>{const G=H.icon,J=I.global.some(K=>K.id===H.id);return r.jsxs("button",{onClick:()=>y({...g,type:H.id}),className:`p-2 rounded-lg border text-left transition-colors ${g.type===H.id?"border-indigo-500 bg-indigo-50 dark:bg-indigo-950/30":"border-gray-200 dark:border-slate-700 hover:border-gray-300 dark:hover:border-slate-600"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(G,{className:"w-4 h-4 text-gray-500 dark:text-slate-400"}),r.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:H.label})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:J?"Global":"Project"})]},H.id)})})]}),g.type==="preference"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Name"}),r.jsx(dt,{value:g.name,onChange:H=>y({...g,name:H.target.value}),placeholder:"e.g., package-manager",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Description"}),r.jsx(dt,{value:g.description,onChange:H=>y({...g,description:H.target.value}),placeholder:"e.g., Always use pnpm instead of npm",className:"mt-1"})]})]}),g.type==="correction"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Wrong (what to avoid)"}),r.jsx(xt,{value:g.wrong,onChange:H=>y({...g,wrong:H.target.value}),placeholder:"e.g., Using npm install",className:"mt-1",rows:2})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Right (what to do instead)"}),r.jsx(xt,{value:g.right,onChange:H=>y({...g,right:H.target.value}),placeholder:"e.g., Use pnpm install",className:"mt-1",rows:2})]})]}),g.type==="fact"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Category"}),r.jsx(dt,{value:g.category,onChange:H=>y({...g,category:H.target.value}),placeholder:"e.g., shell, editor, system",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Details"}),r.jsx(xt,{value:g.details,onChange:H=>y({...g,details:H.target.value}),placeholder:"e.g., Using zsh with oh-my-zsh",className:"mt-1",rows:2})]})]}),g.type==="pattern"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Pattern Name"}),r.jsx(dt,{value:g.name,onChange:H=>y({...g,name:H.target.value}),placeholder:"e.g., API Response Format",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Description"}),r.jsx(xt,{value:g.description,onChange:H=>y({...g,description:H.target.value}),placeholder:"Describe the pattern and when to use it...",className:"mt-1",rows:3})]})]}),g.type==="decision"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Title"}),r.jsx(dt,{value:g.title,onChange:H=>y({...g,title:H.target.value}),placeholder:"e.g., Use React Query for data fetching",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Context"}),r.jsx(xt,{value:g.context,onChange:H=>y({...g,context:H.target.value}),placeholder:"What problem were we solving?",className:"mt-1",rows:2})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Decision"}),r.jsx(xt,{value:g.decision,onChange:H=>y({...g,decision:H.target.value}),placeholder:"What did we decide?",className:"mt-1",rows:2})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rationale"}),r.jsx(xt,{value:g.rationale,onChange:H=>y({...g,rationale:H.target.value}),placeholder:"Why this choice over alternatives?",className:"mt-1",rows:2})]})]}),g.type==="issue"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Issue Title"}),r.jsx(dt,{value:g.title,onChange:H=>y({...g,title:H.target.value}),placeholder:"e.g., Memory leak in useEffect",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Description / Workaround"}),r.jsx(xt,{value:g.description,onChange:H=>y({...g,description:H.target.value}),placeholder:"Describe the issue and any workarounds...",className:"mt-1",rows:3})]})]}),(g.type==="history"||g.type==="context")&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Content"}),r.jsx(xt,{value:g.content,onChange:H=>y({...g,content:H.target.value}),placeholder:g.type==="history"?"What work was done this session?":"Project context and overview...",className:"mt-1",rows:4})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"ghost",onClick:()=>y({...g,open:!1}),children:"Cancel"}),r.jsxs(se,{onClick:N,className:"bg-purple-600 hover:bg-purple-700 text-white",children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Add Entry"]})]})]})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config memory # Show memory status"}),r.jsx("p",{children:"coder-config memory init # Initialize project memory"}),r.jsx("p",{children:'coder-config memory add <type> "<content>" # Add entry'}),r.jsx("p",{children:"coder-config memory search <query> # Search all memory"}),r.jsx("p",{className:"text-gray-400 dark:text-slate-500 text-xs mt-2",children:"# Types: preference, correction, fact (global) | context, pattern, decision, issue, history (project)"})]})]})]})}function SH({onProjectSwitch:e}){const[t,n]=C.useState([]),[s,o]=C.useState(null),[d,u]=C.useState(!0),[l,c]=C.useState(!1),[f,m]=C.useState({open:!1,project:null,name:""}),[h,x]=C.useState(!1);C.useEffect(()=>{w()},[]);const w=async()=>{try{u(!0);const g=await ge.getProjects();n(g.projects||[]),o(g.activeProjectId)}catch{X.error("Failed to load projects")}finally{u(!1)}},j=g=>{m({open:!0,project:g,name:g.name})},_=async()=>{if(!(!f.project||!f.name.trim())){x(!0);try{const g=await ge.updateProject(f.project.id,{name:f.name.trim()});g.success?(n(y=>y.map(k=>k.id===f.project.id?{...k,name:g.project.name}:k)),X.success("Project updated"),m({open:!1,project:null,name:""})):X.error(g.error||"Failed to update project")}catch(g){X.error("Failed to update project: "+g.message)}finally{x(!1)}}},b=async g=>{if(confirm(`Remove "${g.name}" from the registry?
663
663
 
664
- This won't delete any files.`))try{const y=await ge.removeProject(g.id);y.success?(n(k=>k.filter(E=>E.id!==g.id)),X.success(`Removed project: ${g.name}`)):X.error(y.error||"Failed to remove project")}catch(y){X.error("Failed to remove project: "+y.message)}},v=g=>{n(y=>[...y,{...g,exists:!0,hasClaudeConfig:!1}])};return d?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-indigo-100 dark:bg-indigo-900/30 flex items-center justify-center",children:r.jsx(_i,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Projects"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Registered projects for quick switching"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(se,{variant:"outline",onClick:w,size:"sm",children:[r.jsx(vr,{className:"w-4 h-4 mr-2"}),"Refresh"]}),r.jsxs(se,{onClick:()=>c(!0),className:"bg-indigo-600 hover:bg-indigo-700",children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Add Project"]})]})]}),r.jsx("div",{className:"bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 rounded-lg p-4 text-sm text-blue-700 dark:text-blue-400",children:r.jsx("p",{children:"Projects registered here can be quickly switched in the header dropdown. The UI will update to show the selected project's configuration."})}),r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:t.length===0?r.jsxs("div",{className:"p-12 text-center",children:[r.jsx(Dr,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Projects Yet"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Add your first project to get started with quick switching."}),r.jsxs(se,{onClick:()=>c(!0),children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Add Your First Project"]})]}):r.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:t.map(g=>r.jsxs("div",{className:`p-4 flex items-center gap-4 transition-colors ${g.isActive?"bg-indigo-50 dark:bg-indigo-950/30":"hover:bg-gray-50 dark:hover:bg-slate-900"}`,children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${g.isActive?"bg-indigo-100 dark:bg-indigo-900/50":g.exists?"bg-gray-100 dark:bg-slate-800":"bg-amber-100 dark:bg-amber-900/30"}`,children:g.isActive?r.jsx(Dt,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}):g.exists?r.jsx(Dr,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"}):r.jsx(Vl,{className:"w-5 h-5 text-amber-600 dark:text-amber-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:`font-medium truncate ${g.isActive?"text-indigo-700 dark:text-indigo-400":"text-gray-900 dark:text-white"}`,children:g.name}),g.hasClaudeConfig&&r.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-1.5 py-0.5 rounded",children:".claude"}),g.isActive&&r.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-700 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Active"})]}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 font-mono truncate",children:g.path.replace(/^\/Users\/[^/]+/,"~")}),!g.exists&&r.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 mt-1",children:"Path not found - the directory may have been moved or deleted"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>j(g),className:"text-gray-500 dark:text-slate-400 hover:text-indigo-600 dark:hover:text-indigo-400",title:"Edit project name",children:r.jsx(mg,{className:"w-4 h-4"})}),r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>b(g),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Remove from registry",children:r.jsx(un,{className:"w-4 h-4"})})]})]},g.id))})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config project add [path] # Add project"}),r.jsx("p",{children:"coder-config project remove <name> # Remove project"}),r.jsx("p",{children:"coder-config project # List projects"})]})]}),r.jsx(Xj,{open:l,onOpenChange:c,onAdded:v}),r.jsx(_t,{open:f.open,onOpenChange:g=>!g&&m({open:!1,project:null,name:""}),children:r.jsxs(vt,{className:"bg-card",children:[r.jsxs(yt,{children:[r.jsx(bt,{children:"Edit Project"}),r.jsx(er,{children:"Update the project name displayed in the registry."})]}),r.jsxs("div",{className:"py-4",children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Project Name"}),r.jsx(dt,{value:f.name,onChange:g=>m(y=>({...y,name:g.target.value})),placeholder:"My Project",className:"mt-1",onKeyDown:g=>g.key==="Enter"&&_()}),f.project&&r.jsx("p",{className:"text-xs text-muted-foreground mt-2 font-mono",children:f.project.path.replace(/^\/Users\/[^/]+/,"~")})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"ghost",onClick:()=>m({open:!1,project:null,name:""}),children:"Cancel"}),r.jsxs(se,{onClick:_,disabled:h||!f.name.trim(),children:[h?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):null,"Save"]})]})]})})]})}const kH=[{id:"getting-started",title:"Getting Started",icon:Xi,subsections:[{id:"installation",title:"Installation"},{id:"quick-start",title:"Quick Start"},{id:"updating",title:"Updating"}]},{id:"projects",title:"Project Management",icon:fs,subsections:[{id:"project-registry",title:"Project Registry"},{id:"project-switching",title:"Switching Projects"},{id:"project-structure",title:"Project Structure"}]},{id:"file-explorer",title:"Project Explorer",icon:Dr,subsections:[{id:"claude-folders",title:".claude Folders"},{id:"rules",title:"Rules"},{id:"commands",title:"Commands"},{id:"workflows",title:"Workflows"},{id:"hierarchy",title:"Configuration Hierarchy"},{id:"subprojects",title:"Sub-Projects"}]},{id:"workstreams",title:"Workstreams",icon:fs,subsections:[{id:"workstreams-overview",title:"Overview"},{id:"creating-workstreams",title:"Creating Workstreams"},{id:"workstream-hooks",title:"Hook Integration"},{id:"activity-tracking",title:"Activity Tracking"}]},{id:"loops",title:"Ralph Loops",icon:El,isExperimental:!0,subsections:[{id:"loops-overview",title:"Overview"},{id:"creating-loops",title:"Creating Loops"},{id:"loop-phases",title:"Loop Phases"},{id:"loop-controls",title:"Controls"},{id:"loop-configuration",title:"Configuration"}]},{id:"plugins",title:"Plugins",icon:bs,subsections:[{id:"plugins-overview",title:"Overview"},{id:"installing-plugins",title:"Installing Plugins"},{id:"plugin-marketplaces",title:"Marketplaces"}]},{id:"mcp-registry",title:"MCP Registry",icon:bs,subsections:[{id:"mcp-overview",title:"Overview"},{id:"adding-mcps",title:"Adding MCPs"},{id:"configuring-mcps",title:"Configuring MCPs"},{id:"environment-vars",title:"Environment Variables"}]},{id:"memory",title:"Memory System",icon:Ji,subsections:[{id:"memory-overview",title:"Overview"},{id:"global-memory",title:"Global Memory"},{id:"project-memory",title:"Project Memory"},{id:"memory-entries",title:"Memory Entry Types"}]},{id:"sessions",title:"Session Persistence",icon:En,isNew:!0,subsections:[{id:"sessions-overview",title:"Overview"},{id:"sessions-usage",title:"Using Sessions"},{id:"sessions-storage",title:"Storage"}]},{id:"claude-settings",title:"Claude Code Settings",icon:ks,subsections:[{id:"permissions",title:"Permissions"},{id:"model-selection",title:"Model Selection"},{id:"behavior",title:"Behavior Settings"},{id:"hooks",title:"Hooks"}]},{id:"gemini-settings",title:"Gemini CLI Settings",icon:Ft,subsections:[{id:"gemini-model",title:"Model Selection"},{id:"gemini-display",title:"Display Options"},{id:"gemini-general",title:"General Settings"},{id:"gemini-sandbox",title:"Sandbox Mode"}]},{id:"codex-settings",title:"Codex CLI Settings",icon:Ft,subsections:[{id:"codex-overview",title:"Overview"},{id:"codex-model",title:"Model Selection"},{id:"codex-security",title:"Security Settings"},{id:"codex-mcp",title:"MCP Servers"},{id:"codex-features",title:"Features & Display"}]},{id:"antigravity-settings",title:"Antigravity Settings",icon:Wl,subsections:[{id:"antigravity-security",title:"Security Policies"},{id:"antigravity-mcp",title:"MCP Servers"},{id:"antigravity-browser",title:"Browser Allowlist"},{id:"antigravity-agent",title:"Agent Mode"}]},{id:"cli",title:"CLI Reference",icon:Ft,subsections:[{id:"cli-overview",title:"Overview"},{id:"cli-commands",title:"All Commands"},{id:"daemon-mode",title:"Daemon Mode"}]},{id:"multi-tool",title:"Multi-Tool Support",icon:Yt,subsections:[{id:"supported-tools",title:"Supported Tools"},{id:"gemini-cli",title:"Gemini CLI"},{id:"antigravity",title:"Antigravity"},{id:"tool-differences",title:"Tool Differences"},{id:"enabling-tools",title:"Enabling Tools"},{id:"syncing-rules",title:"Syncing Rules"}]},{id:"keyboard",title:"Keyboard Shortcuts",icon:cM,subsections:[]},{id:"troubleshooting",title:"Troubleshooting",icon:Vo,subsections:[{id:"common-issues",title:"Common Issues"},{id:"getting-help",title:"Getting Help"}]}],jH={installation:{title:"Installation",content:`
664
+ This won't delete any files.`))try{const y=await ge.removeProject(g.id);y.success?(n(k=>k.filter(E=>E.id!==g.id)),X.success(`Removed project: ${g.name}`)):X.error(y.error||"Failed to remove project")}catch(y){X.error("Failed to remove project: "+y.message)}},v=g=>{n(y=>[...y,{...g,exists:!0,hasClaudeConfig:!1}])};return d?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-indigo-100 dark:bg-indigo-900/30 flex items-center justify-center",children:r.jsx(_i,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Projects"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Registered projects for quick switching"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(se,{variant:"outline",onClick:w,size:"sm",children:[r.jsx(vr,{className:"w-4 h-4 mr-2"}),"Refresh"]}),r.jsxs(se,{onClick:()=>c(!0),className:"bg-indigo-600 hover:bg-indigo-700",children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Add Project"]})]})]}),r.jsx("div",{className:"bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 rounded-lg p-4 text-sm text-blue-700 dark:text-blue-400",children:r.jsx("p",{children:"Projects registered here can be quickly switched in the header dropdown. The UI will update to show the selected project's configuration."})}),r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:t.length===0?r.jsxs("div",{className:"p-12 text-center",children:[r.jsx(Dr,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Projects Yet"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Add your first project to get started with quick switching."}),r.jsxs(se,{onClick:()=>c(!0),children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Add Your First Project"]})]}):r.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:t.map(g=>r.jsxs("div",{className:`p-4 flex items-center gap-4 transition-colors ${g.isActive?"bg-indigo-50 dark:bg-indigo-950/30":"hover:bg-gray-50 dark:hover:bg-slate-900"}`,children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${g.isActive?"bg-indigo-100 dark:bg-indigo-900/50":g.exists?"bg-gray-100 dark:bg-slate-800":"bg-amber-100 dark:bg-amber-900/30"}`,children:g.isActive?r.jsx(Dt,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}):g.exists?r.jsx(Dr,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"}):r.jsx(Vl,{className:"w-5 h-5 text-amber-600 dark:text-amber-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:`font-medium truncate ${g.isActive?"text-indigo-700 dark:text-indigo-400":"text-gray-900 dark:text-white"}`,children:g.name}),g.hasClaudeConfig&&r.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-1.5 py-0.5 rounded",children:".claude"}),g.isActive&&r.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-700 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Active"})]}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 font-mono truncate",children:g.path.replace(/^\/Users\/[^/]+/,"~")}),!g.exists&&r.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 mt-1",children:"Path not found - the directory may have been moved or deleted"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>j(g),className:"text-gray-500 dark:text-slate-400 hover:text-indigo-600 dark:hover:text-indigo-400",title:"Edit project name",children:r.jsx(mg,{className:"w-4 h-4"})}),r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>b(g),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Remove from registry",children:r.jsx(un,{className:"w-4 h-4"})})]})]},g.id))})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config project add [path] # Add project"}),r.jsx("p",{children:"coder-config project remove <name> # Remove project"}),r.jsx("p",{children:"coder-config project # List projects"})]})]}),r.jsx(Xj,{open:l,onOpenChange:c,onAdded:v}),r.jsx(_t,{open:f.open,onOpenChange:g=>!g&&m({open:!1,project:null,name:""}),children:r.jsxs(vt,{className:"bg-card",children:[r.jsxs(yt,{children:[r.jsx(bt,{children:"Edit Project"}),r.jsx(er,{children:"Update the project name displayed in the registry."})]}),r.jsxs("div",{className:"py-4",children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Project Name"}),r.jsx(dt,{value:f.name,onChange:g=>m(y=>({...y,name:g.target.value})),placeholder:"My Project",className:"mt-1",onKeyDown:g=>g.key==="Enter"&&_()}),f.project&&r.jsx("p",{className:"text-xs text-muted-foreground mt-2 font-mono",children:f.project.path.replace(/^\/Users\/[^/]+/,"~")})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"ghost",onClick:()=>m({open:!1,project:null,name:""}),children:"Cancel"}),r.jsxs(se,{onClick:_,disabled:h||!f.name.trim(),children:[h?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):null,"Save"]})]})]})})]})}const kH=[{id:"getting-started",title:"Getting Started",icon:Xi,subsections:[{id:"installation",title:"Installation"},{id:"quick-start",title:"Quick Start"},{id:"updating",title:"Updating"}]},{id:"projects",title:"Project Management",icon:fs,subsections:[{id:"project-registry",title:"Project Registry"},{id:"project-switching",title:"Switching Projects"},{id:"project-structure",title:"Project Structure"}]},{id:"file-explorer",title:"Project Explorer",icon:Dr,subsections:[{id:"claude-folders",title:".claude Folders"},{id:"rules",title:"Rules"},{id:"skills",title:"Skills"},{id:"workflows",title:"Workflows"},{id:"hierarchy",title:"Configuration Hierarchy"},{id:"subprojects",title:"Sub-Projects"}]},{id:"workstreams",title:"Workstreams",icon:fs,subsections:[{id:"workstreams-overview",title:"Overview"},{id:"creating-workstreams",title:"Creating Workstreams"},{id:"workstream-hooks",title:"Hook Integration"},{id:"activity-tracking",title:"Activity Tracking"}]},{id:"loops",title:"Ralph Loops",icon:El,isExperimental:!0,subsections:[{id:"loops-overview",title:"Overview"},{id:"creating-loops",title:"Creating Loops"},{id:"loop-phases",title:"Loop Phases"},{id:"loop-controls",title:"Controls"},{id:"loop-configuration",title:"Configuration"}]},{id:"plugins",title:"Plugins",icon:bs,subsections:[{id:"plugins-overview",title:"Overview"},{id:"installing-plugins",title:"Installing Plugins"},{id:"plugin-marketplaces",title:"Marketplaces"}]},{id:"mcp-registry",title:"MCP Registry",icon:bs,subsections:[{id:"mcp-overview",title:"Overview"},{id:"adding-mcps",title:"Adding MCPs"},{id:"configuring-mcps",title:"Configuring MCPs"},{id:"environment-vars",title:"Environment Variables"}]},{id:"memory",title:"Memory System",icon:Ji,subsections:[{id:"memory-overview",title:"Overview"},{id:"global-memory",title:"Global Memory"},{id:"project-memory",title:"Project Memory"},{id:"memory-entries",title:"Memory Entry Types"}]},{id:"sessions",title:"Session Persistence",icon:En,isNew:!0,subsections:[{id:"sessions-overview",title:"Overview"},{id:"sessions-usage",title:"Using Sessions"},{id:"sessions-storage",title:"Storage"}]},{id:"claude-settings",title:"Claude Code Settings",icon:ks,subsections:[{id:"permissions",title:"Permissions"},{id:"model-selection",title:"Model Selection"},{id:"behavior",title:"Behavior Settings"},{id:"hooks",title:"Hooks"}]},{id:"gemini-settings",title:"Gemini CLI Settings",icon:Ft,subsections:[{id:"gemini-model",title:"Model Selection"},{id:"gemini-display",title:"Display Options"},{id:"gemini-general",title:"General Settings"},{id:"gemini-sandbox",title:"Sandbox Mode"}]},{id:"codex-settings",title:"Codex CLI Settings",icon:Ft,subsections:[{id:"codex-overview",title:"Overview"},{id:"codex-model",title:"Model Selection"},{id:"codex-security",title:"Security Settings"},{id:"codex-mcp",title:"MCP Servers"},{id:"codex-features",title:"Features & Display"}]},{id:"antigravity-settings",title:"Antigravity Settings",icon:Wl,subsections:[{id:"antigravity-security",title:"Security Policies"},{id:"antigravity-mcp",title:"MCP Servers"},{id:"antigravity-browser",title:"Browser Allowlist"},{id:"antigravity-agent",title:"Agent Mode"}]},{id:"cli",title:"CLI Reference",icon:Ft,subsections:[{id:"cli-overview",title:"Overview"},{id:"cli-commands",title:"All Commands"},{id:"daemon-mode",title:"Daemon Mode"}]},{id:"multi-tool",title:"Multi-Tool Support",icon:Yt,subsections:[{id:"supported-tools",title:"Supported Tools"},{id:"gemini-cli",title:"Gemini CLI"},{id:"antigravity",title:"Antigravity"},{id:"tool-differences",title:"Tool Differences"},{id:"enabling-tools",title:"Enabling Tools"},{id:"syncing-rules",title:"Syncing Rules"}]},{id:"keyboard",title:"Keyboard Shortcuts",icon:cM,subsections:[]},{id:"troubleshooting",title:"Troubleshooting",icon:Vo,subsections:[{id:"common-issues",title:"Common Issues"},{id:"getting-help",title:"Getting Help"}]}],jH={installation:{title:"Installation",content:`
665
665
  ## Installation
666
666
 
667
667
  Choose your preferred installation method:
@@ -720,7 +720,7 @@ Click "Add Project" to register directories where you use Claude Code.
720
720
  | Feature | Description |
721
721
  |---------|-------------|
722
722
  | **Rules** | Guidelines Claude follows in this project |
723
- | **Commands** | Reusable prompts (slash commands) |
723
+ | **Skills** | Reusable prompts (slash commands) |
724
724
  | **MCPs** | External tools Claude can use |
725
725
  | **Permissions** | What Claude can do automatically |
726
726
 
@@ -828,7 +828,7 @@ your-project/
828
828
  │ ├── rules/ # Rule files (*.md)
829
829
  │ │ ├── style.md
830
830
  │ │ └── patterns.md
831
- │ ├── commands/ # Command files (*.md)
831
+ │ ├── commands/ # Skill files (*.md)
832
832
  │ │ ├── review.md
833
833
  │ │ └── test.md
834
834
  │ ├── workflows/ # Workflow files (*.md)
@@ -900,25 +900,25 @@ Rules should be written in markdown and contain:
900
900
  ### Rule Priority
901
901
 
902
902
  Rules are loaded in order from global to project. Project rules can override global rules.
903
- `},commands:{title:"Commands",content:`
904
- ## Commands
903
+ `},skills:{title:"Skills",content:`
904
+ ## Skills
905
905
 
906
- Commands are reusable prompts that can be invoked in Claude Code.
906
+ Skills are reusable prompts that can be invoked in Claude Code via slash commands.
907
907
 
908
- ### Creating Commands
908
+ ### Creating Skills
909
909
 
910
910
  1. Navigate to a \`.claude\` folder in the Project Explorer
911
- 2. Click the "+" button next to "commands"
911
+ 2. Click the "+" button and select "New Skill"
912
912
  3. Enter a name (e.g., "review")
913
913
 
914
- ### Command Content
914
+ ### Skill Content
915
915
 
916
- Commands are markdown files containing a prompt template. They can include:
916
+ Skills are markdown files containing a prompt template. They can include:
917
917
  - Instructions for Claude
918
918
  - Templates with placeholders
919
919
  - Multi-step workflows
920
920
 
921
- ### Example Command
921
+ ### Example Skill
922
922
 
923
923
  \`\`\`markdown
924
924
  # Code Review
@@ -933,9 +933,13 @@ Review the selected code for:
933
933
  Provide specific suggestions with code examples.
934
934
  \`\`\`
935
935
 
936
- ### Using Commands
936
+ ### Using Skills
937
937
 
938
- In Claude Code, use \`/command-name\` to invoke a command.
938
+ In Claude Code, use \`/skill-name\` to invoke a skill.
939
+
940
+ ### Note on Commands
941
+
942
+ Claude Code previously called these "commands" and stored them in \`.claude/commands/\`. Both locations still work - skills and commands have been merged into one system.
939
943
  `},workflows:{title:"Workflows",content:`
940
944
  ## Workflows
941
945
 
@@ -1030,7 +1034,7 @@ Coder Config uses a hierarchical configuration system where settings cascade fro
1030
1034
 
1031
1035
  - **MCPs**: Merged, with local configs overriding global
1032
1036
  - **Rules**: All rules are loaded, local rules can override
1033
- - **Commands**: All commands are available, local takes precedence
1037
+ - **Skills**: All skills are available, local takes precedence
1034
1038
  - **Settings**: Deep merged, local values override
1035
1039
 
1036
1040
  ### Viewing the Hierarchy
@@ -1494,7 +1498,7 @@ Loop data is stored in:
1494
1498
  `}},TH={"plugins-overview":{title:"Plugins Overview",content:`
1495
1499
  ## Plugins
1496
1500
 
1497
- Claude Code plugins extend functionality with LSP servers, MCP servers, and commands.
1501
+ Claude Code plugins extend functionality with LSP servers, MCP servers, and skills.
1498
1502
 
1499
1503
  ### What Are Plugins?
1500
1504
 
@@ -1502,7 +1506,7 @@ Plugins are packages that add capabilities to Claude Code:
1502
1506
 
1503
1507
  - **LSP Servers** - Language Server Protocol servers for code intelligence
1504
1508
  - **MCP Servers** - Model Context Protocol servers for additional tools
1505
- - **Commands** - Reusable prompts and workflows
1509
+ - **Skills** - Reusable prompts and workflows
1506
1510
 
1507
1511
  ### Plugin Directory
1508
1512
 
@@ -1519,7 +1523,7 @@ The **Plugins** page shows all available plugins with:
1519
1523
  |------|-------|-------------|
1520
1524
  | LSP | \`LSP\` | Language server providing code intelligence |
1521
1525
  | MCP | \`MCP\` | Model context protocol server |
1522
- | Commands | \`CMD\` | Custom commands and prompts |
1526
+ | Skills | \`CMD\` | Custom skills and prompts |
1523
1527
  `},"installing-plugins":{title:"Installing Plugins",content:`
1524
1528
  ## Installing Plugins
1525
1529
 
@@ -2712,7 +2716,7 @@ When you apply config, both files are generated:
2712
2716
  | MCP Config | Separate \`.mcp.json\` | Embedded in settings.json |
2713
2717
  | Global Instructions | \`~/.claude/CLAUDE.md\` | \`~/.gemini/GEMINI.md\` |
2714
2718
  | Project Instructions | \`CLAUDE.md\` | \`GEMINI.md\` |
2715
- | Commands | \`.claude/commands/\` | \`.gemini/commands/\` (TOML) |
2719
+ | Skills | \`.claude/commands/\` | \`.gemini/commands/\` (TOML) |
2716
2720
 
2717
2721
  ### Gemini Settings Editor
2718
2722
 
@@ -2727,7 +2731,7 @@ Access via **Gemini CLI** in the sidebar to:
2727
2731
  | Purpose | File |
2728
2732
  |---------|------|
2729
2733
  | Project instructions | \`GEMINI.md\` or \`.gemini/GEMINI.md\` |
2730
- | Commands | \`.gemini/commands/*.toml\` |
2734
+ | Skills | \`.gemini/commands/*.toml\` |
2731
2735
  | Config folder | \`.gemini/\` |
2732
2736
  `},antigravity:{title:"Antigravity Support",content:`
2733
2737
  ## Antigravity Support
@@ -2797,7 +2801,7 @@ All tools use identical JSON format for MCP server definitions:
2797
2801
  | MCP Config | \`.mcp.json\` | \`.gemini/settings.json\` | \`~/.codex/config.toml\` | \`~/.gemini/antigravity/\` |
2798
2802
  | Config Format | JSON | JSON | TOML | JSON |
2799
2803
  | Env Interpolation | Yes (\`\${VAR}\`) | Yes | Yes | No |
2800
- | Commands | \`.claude/commands/\` | \`.gemini/commands/\` | N/A | Unknown |
2804
+ | Skills | \`.claude/commands/\` | \`.gemini/commands/\` | N/A | Unknown |
2801
2805
  | Rules | \`.claude/rules/\` | \`.gemini/rules/\` | N/A | \`.agent/rules/\` |
2802
2806
  | Instructions | \`CLAUDE.md\` | \`GEMINI.md\` | N/A | \`GEMINI.md\` |
2803
2807
 
@@ -2876,7 +2880,7 @@ Rules can be synced in any direction between these three tools.
2876
2880
  - Syncing **copies** files (doesn't move them)
2877
2881
  - Target files are **overwritten** if they exist
2878
2882
  - Instructions files (CLAUDE.md / GEMINI.md) are not synced
2879
- - Commands and workflows are Claude-specific (not synced)
2883
+ - Skills and workflows are Claude-specific (not synced)
2880
2884
  `}},zH={keyboard:{title:"Keyboard Shortcuts",content:`
2881
2885
  ## Keyboard Shortcuts
2882
2886
 
@@ -3037,7 +3041,7 @@ With a project added, let's look at what you can do with it.
3037
3041
 
3038
3042
  Click **Project Explorer** in the sidebar. This is your window into your project's Claude configuration. If the project has a \`.claude\` folder, you'll see its contents laid out as a file tree. If there's no \`.claude\` folder yet, you'll see a prompt to create one.
3039
3043
 
3040
- The explorer shows the files Claude cares about: rules in the \`rules/\` folder, custom commands in \`commands/\`, MCP configurations, and local settings. You can click any file to view or edit it right in the browser. Right-click for more options—rename, duplicate, delete.
3044
+ The explorer shows the files Claude cares about: rules in the \`rules/\` folder, skills in \`commands/\`, MCP configurations, and local settings. You can click any file to view or edit it right in the browser. Right-click for more options—rename, duplicate, delete.
3041
3045
 
3042
3046
  ### Project Information
3043
3047
 
@@ -3062,7 +3066,7 @@ If your project doesn't have a \`.claude\` folder yet, go to Project Explorer an
3062
3066
  \`\`\`
3063
3067
  .claude/
3064
3068
  ├── rules/ # Markdown files with guidelines
3065
- ├── commands/ # Reusable prompt templates
3069
+ ├── commands/ # Skills (reusable prompts)
3066
3070
  ├── settings.local.json # Project-specific settings
3067
3071
  └── mcps.json # MCP server configurations
3068
3072
  \`\`\`
@@ -3073,7 +3077,7 @@ You can also create this manually if you prefer—it's just regular folders and
3073
3077
 
3074
3078
  The \`rules/\` folder contains markdown files that tell Claude about your project. These are instructions, conventions, things to avoid—any guidance you'd give a new team member. Claude reads them at the start of every session.
3075
3079
 
3076
- The \`commands/\` folder holds reusable prompts. If you find yourself typing the same instructions over and over, turn them into a command.
3080
+ The \`commands/\` folder holds skills—reusable prompts you can invoke with slash commands. If you find yourself typing the same instructions over and over, turn them into a skill.
3077
3081
 
3078
3082
  The \`settings.local.json\` file stores project-specific settings that override global defaults. And \`mcps.json\` defines which MCP servers this project uses.
3079
3083
 
@@ -3427,7 +3431,7 @@ Plugins are pre-packaged configurations you can install with a click. Instead of
3427
3431
 
3428
3432
  ### What's Inside a Plugin
3429
3433
 
3430
- A plugin can include any combination of configuration elements. It might have **rules**—markdown files with guidelines for Claude, like a React plugin that includes rules about hooks, component structure, and testing patterns. It might have **commands**—reusable prompts, like a testing plugin with commands for generating unit tests, integration tests, and test data. It might configure **MCPs**—server connections, like a database plugin with pre-configured connections for PostgreSQL, MySQL, and SQLite. And it might provide **skills**—workflows discoverable by Claude, like the coder-config plugin's /flush command for saving session context.
3434
+ A plugin can include any combination of configuration elements. It might have **rules**—markdown files with guidelines for Claude, like a React plugin that includes rules about hooks, component structure, and testing patterns. It might have **skills**—reusable prompts invoked via slash commands, like a testing plugin with skills for generating unit tests, integration tests, and test data. It might configure **MCPs**—server connections, like a database plugin with pre-configured connections for PostgreSQL, MySQL, and SQLite.
3431
3435
 
3432
3436
  ### Why Use Plugins
3433
3437
 
@@ -3463,7 +3467,7 @@ Choosing **user scope** installs to your global \`~/.claude/\` folder. All your
3463
3467
 
3464
3468
  ### What Happens After Installing
3465
3469
 
3466
- The plugin's files are copied to your chosen location. Rules become active immediately—Claude reads them on the next session. Commands appear in your available commands list. MCPs might need additional setup; check the plugin's documentation for any environment variables or configuration needed.
3470
+ The plugin's files are copied to your chosen location. Rules become active immediately—Claude reads them on the next session. Skills appear in your available slash commands list. MCPs might need additional setup; check the plugin's documentation for any environment variables or configuration needed.
3467
3471
 
3468
3472
  ### Managing Installed Plugins
3469
3473
 
@@ -19,7 +19,7 @@
19
19
 
20
20
  <!-- PWA Manifest -->
21
21
  <link rel="manifest" href="/manifest.json">
22
- <script type="module" crossorigin src="/assets/index-BfJBU449.js"></script>
22
+ <script type="module" crossorigin src="/assets/index-CSVXtaJi.js"></script>
23
23
  <link rel="stylesheet" crossorigin href="/assets/index-CiegY6vS.css">
24
24
  </head>
25
25
  <body>