coder-config 0.43.4 → 0.43.5

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.4';
5
+ const VERSION = '0.43.5';
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.4",
3
+ "version": "0.43.5",
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",
@@ -3957,4 +3957,4 @@ coder-config --help # See all commands
3957
3957
  Thanks for using Coder Config. We built this to make working with AI coding tools easier and more powerful.
3958
3958
 
3959
3959
  Happy coding!
3960
- `}},gW={...iW,...oW,...aW,...lW,...cW,...dW,...uW,...hW,...fW,...mW,...pW},Ed={welcome:{bg:"bg-violet-500",light:"bg-violet-100 dark:bg-violet-950",text:"text-violet-600 dark:text-violet-400"},"first-project":{bg:"bg-blue-500",light:"bg-blue-100 dark:bg-blue-950",text:"text-blue-600 dark:text-blue-400"},"rules-guide":{bg:"bg-emerald-500",light:"bg-emerald-100 dark:bg-emerald-950",text:"text-emerald-600 dark:text-emerald-400"},"mcp-guide":{bg:"bg-orange-500",light:"bg-orange-100 dark:bg-orange-950",text:"text-orange-600 dark:text-orange-400"},"permissions-guide":{bg:"bg-green-500",light:"bg-green-100 dark:bg-green-950",text:"text-green-600 dark:text-green-400"},"memory-guide":{bg:"bg-pink-500",light:"bg-pink-100 dark:bg-pink-950",text:"text-pink-600 dark:text-pink-400"},"plugins-guide":{bg:"bg-purple-500",light:"bg-purple-100 dark:bg-purple-950",text:"text-purple-600 dark:text-purple-400"},"workstreams-guide":{bg:"bg-cyan-500",light:"bg-cyan-100 dark:bg-cyan-950",text:"text-cyan-600 dark:text-cyan-400"},"loops-guide":{bg:"bg-teal-500",light:"bg-teal-100 dark:bg-teal-950",text:"text-teal-600 dark:text-teal-400"},"multi-tool-guide":{bg:"bg-amber-500",light:"bg-amber-100 dark:bg-amber-950",text:"text-amber-600 dark:text-amber-400"},"next-steps":{bg:"bg-rose-500",light:"bg-rose-100 dark:bg-rose-950",text:"text-rose-600 dark:text-rose-400"}},Zw="claude-config-tutorial-visited";function xW(){const[e,t]=C.useState("intro"),[n,s]=C.useState({welcome:!0}),[o,d]=C.useState(()=>{try{return JSON.parse(localStorage.getItem(Zw)||"[]")}catch{return[]}}),u=C.useRef(null);C.useEffect(()=>{if(u.current){const b=u.current.querySelector("[data-radix-scroll-area-viewport]");b&&(b.scrollTop=0)}},[e]),C.useEffect(()=>{if(e&&!o.includes(e)){const b=[...o,e];d(b),localStorage.setItem(Zw,JSON.stringify(b))}},[e,o]);const l=b=>{s(j=>({...j,[b]:!j[b]}))},c=gW[e],f=il.flatMap(b=>b.subsections.length>0?b.subsections.map(j=>j.id):[b.id]),m=f.indexOf(e),h=m>0?f[m-1]:null,x=m<f.length-1?f[m+1]:null,w=Math.round(o.length/f.length*100),_=(()=>{for(const b of il)if(b.id===e||b.subsections.some(j=>j.id===e))return b;return il[0]})(),y=Ed[_.id]||Ed.welcome,v=b=>{for(const j of il){if(j.id===b)return j.title;const E=j.subsections.find(P=>P.id===b);if(E)return E.title}return""},g=b=>({__html:JN(b)});return r.jsxs("div",{className:"flex h-full",children:[r.jsxs("div",{className:"w-72 border-r border-border bg-muted/30 flex flex-col",children:[r.jsxs("div",{className:"p-4 border-b border-border bg-gradient-to-r from-indigo-500/10 to-purple-500/10",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg",children:r.jsx(Gd,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-foreground",children:"Tutorial"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Step-by-step guide"})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1",children:[r.jsx("span",{children:"Progress"}),r.jsxs("span",{children:[w,"% complete"]})]}),r.jsx(s2,{value:w,className:"h-2"})]})]}),r.jsx(Wn,{className:"flex-1",children:r.jsx("div",{className:"p-2",children:il.map((b,j)=>{const E=b.icon,P=Ed[b.id]||Ed.welcome,T=e===b.id||b.subsections.some(M=>M.id===e),N=b.subsections.length>0?b.subsections.every(M=>o.includes(M.id)):o.includes(b.id);return r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{className:Ae("w-full flex items-center gap-2 px-3 py-2.5 text-sm rounded-lg hover:bg-accent text-left transition-all",T&&"bg-accent"),onClick:()=>{b.subsections.length>0?(l(b.id),n[b.id]||t(b.subsections[0].id)):t(b.id)},children:[r.jsx("span",{className:Ae("w-7 h-7 rounded-lg flex items-center justify-center transition-colors",T?P.bg+" text-white":P.light),children:N?r.jsx(ta,{className:"w-4 h-4"}):r.jsx(E,{className:Ae("w-4 h-4",!T&&P.text)})}),r.jsx("span",{className:Ae("flex-1",T&&"font-medium"),children:b.title}),b.subsections.length>0&&r.jsx(Qr,{className:Ae("w-4 h-4 text-muted-foreground transition-transform",n[b.id]&&"rotate-90")})]}),b.subsections.length>0&&n[b.id]&&r.jsx("div",{className:"ml-4 mt-1 space-y-0.5 border-l-2 border-border pl-3",children:b.subsections.map(M=>{const I=e===M.id,O=o.includes(M.id);return r.jsxs("button",{className:Ae("w-full text-left px-3 py-1.5 text-sm rounded-md hover:bg-accent text-foreground flex items-center gap-2",I&&"bg-accent font-medium",I&&P.text),onClick:()=>t(M.id),children:[O&&!I&&r.jsx(ta,{className:"w-3 h-3 text-green-500"}),r.jsx("span",{className:Ae(!O&&!I&&"ml-5"),children:M.title})]},M.id)})})]},b.id)})})})]}),r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[r.jsx("div",{className:Ae("px-8 py-4 border-b border-border",y.light),children:r.jsxs("div",{className:"max-w-3xl mx-auto flex items-center gap-3",children:[r.jsx("div",{className:Ae("w-10 h-10 rounded-xl flex items-center justify-center",y.bg,"text-white"),children:r.jsx(_.icon,{className:"w-5 h-5"})}),r.jsxs("div",{children:[r.jsx("p",{className:Ae("text-sm font-medium",y.text),children:_.title}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:(c==null?void 0:c.title)||v(e)})]})]})}),r.jsx(Wn,{className:"flex-1",ref:u,children:r.jsx("div",{className:"max-w-3xl mx-auto p-8",children:c?r.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert prose-headings:text-foreground prose-p:text-muted-foreground prose-strong:text-foreground prose-code:text-primary prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-pre:bg-muted prose-pre:border prose-pre:border-border",dangerouslySetInnerHTML:g(c.content)}):r.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[r.jsx(Gd,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a topic from the sidebar"})]})})}),r.jsx("div",{className:"border-t border-border p-4 bg-muted/30",children:r.jsxs("div",{className:"max-w-3xl mx-auto flex items-center justify-between",children:[h?r.jsxs(se,{variant:"ghost",onClick:()=>t(h),className:"flex items-center gap-2",children:[r.jsx(v5,{className:"w-4 h-4"}),r.jsx("span",{className:"max-w-[150px] truncate",children:v(h)})]}):r.jsx("div",{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[m+1," of ",f.length]}),x?r.jsxs(se,{onClick:()=>t(x),className:Ae("flex items-center gap-2",y.bg,"hover:opacity-90"),children:[r.jsx("span",{className:"max-w-[150px] truncate",children:v(x)}),r.jsx(sg,{className:"w-4 h-4"})]}):r.jsx(se,{variant:"outline",onClick:()=>t("intro"),className:"flex items-center gap-2",children:"Start Over"})]})})]})]})}function vW(){const[e,t]=C.useState(null),[n,s]=C.useState(!0),[o,d]=C.useState(!1),[u,l]=C.useState(!1),[c,f]=C.useState(!1),[m,h]=C.useState(null);C.useEffect(()=>{x()},[]);const x=async()=>{try{s(!0);const j=await xe.getSessionStatus();t(j)}catch{J.error("Failed to load session status")}finally{s(!1)}},w=async()=>{var j,E;d(!0);try{const P=await xe.installSessionAll();P.success?(J.success("Session persistence installed!"),x()):J.error(((j=P.hooks)==null?void 0:j.error)||((E=P.command)==null?void 0:E.error)||"Installation failed")}catch{J.error("Installation failed")}finally{d(!1)}},k=async()=>{d(!0);try{const j=await xe.installSessionHooks();j.success?(J.success("Session hooks installed!"),x()):J.error(j.error||"Failed to install hooks")}catch{J.error("Failed to install hooks")}finally{d(!1)}},_=async()=>{d(!0);try{const j=await xe.installFlushCommand();j.success?(J.success(j.alreadyInstalled?"/flush command already installed":"/flush command installed!"),x()):J.error(j.error||"Failed to install command")}catch{J.error("Failed to install command")}finally{d(!1)}},y=async()=>{l(!0);try{const j=await xe.clearSessionContext();j.success?(J.success(j.cleared?"Session context cleared":"No context to clear"),x()):J.error("Failed to clear context")}catch{J.error("Failed to clear context")}finally{l(!1)}},v=async()=>{try{const j=await xe.getSessionContext();h(j.content),f(!0)}catch{J.error("Failed to load context")}},g=j=>j===null?"Unknown":j<60?`${j} minutes ago`:j<1440?`${Math.floor(j/60)} hours ago`:`${Math.floor(j/1440)} days ago`;if(n)return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(tt,{className:"w-8 h-8 animate-spin text-indigo-600"})});const b=(e==null?void 0:e.hooksInstalled)&&(e==null?void 0:e.flushCommandInstalled)&&(e==null?void 0:e.permissionInstalled);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("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-lg bg-indigo-100 dark:bg-indigo-950",children:r.jsx(Hn,{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:"Session Persistence"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Save and restore Claude Code session context"})]})]}),r.jsx(se,{variant:"ghost",size:"sm",onClick:x,children:r.jsx(yr,{className:"w-4 h-4"})})]}),r.jsxs("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:["Session persistence allows you to save your current Claude Code context using the ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1.5 py-0.5 rounded text-indigo-600 dark:text-indigo-400",children:"/flush"})," command, and automatically restore it when you start a new session."]})]}),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.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Installation Status"})}),r.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:[r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.hooksInstalled?r.jsx(Mt,{className:"w-5 h-5 text-green-500"}):r.jsx(Sn,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Session Hooks"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Auto-restore context on session start, preserve on session end"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qe,{variant:e!=null&&e.hooksInstalled?"default":"secondary",children:e!=null&&e.hooksInstalled?"Installed":"Not Installed"}),!(e!=null&&e.hooksInstalled)&&r.jsx(se,{variant:"outline",size:"sm",onClick:k,disabled:o,children:o?r.jsx(tt,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.flushCommandInstalled?r.jsx(Mt,{className:"w-5 h-5 text-green-500"}):r.jsx(Sn,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"/flush Command"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Adds the /flush command to save session context"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qe,{variant:e!=null&&e.flushCommandInstalled?"default":"secondary",children:e!=null&&e.flushCommandInstalled?"Installed":"Not Installed"}),!(e!=null&&e.flushCommandInstalled)&&r.jsx(se,{variant:"outline",size:"sm",onClick:_,disabled:o,children:o?r.jsx(tt,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.permissionInstalled?r.jsx(Mt,{className:"w-5 h-5 text-green-500"}):r.jsx(Sn,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Write Permission"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Allows Claude to write session context without prompting"})]})]}),r.jsx(Qe,{variant:e!=null&&e.permissionInstalled?"default":"secondary",children:e!=null&&e.permissionInstalled?"Granted":"Not Granted"})]})]}),!b&&r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-slate-900 border-t border-gray-200 dark:border-slate-800",children:r.jsxs(se,{onClick:w,disabled:o,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white",children:[o?r.jsx(tt,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(Qi,{className:"w-4 h-4 mr-2"}),"Install All"]})})]}),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:"Saved Context"}),(e==null?void 0:e.hasSavedContext)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(se,{variant:"outline",size:"sm",onClick:v,children:[r.jsx(Er,{className:"w-4 h-4 mr-2"}),"View"]}),r.jsx(se,{variant:"outline",size:"sm",onClick:y,disabled:u,className:"text-red-600 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950",children:u?r.jsx(tt,{className:"w-4 h-4 animate-spin"}):r.jsx(un,{className:"w-4 h-4"})})]})]}),r.jsx("div",{className:"p-4",children:e!=null&&e.hasSavedContext?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(pl,{className:"w-4 h-4 text-gray-400"}),r.jsx("span",{className:"text-gray-600 dark:text-slate-400",children:"Last saved:"}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:g(e.contextAge)})]}),e.contextPreview&&r.jsx("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:r.jsx("pre",{className:"text-xs text-gray-600 dark:text-slate-400 whitespace-pre-wrap overflow-hidden",children:e.contextPreview})}),r.jsxs("div",{className:"text-xs text-gray-500 dark:text-slate-500",children:["Storage: ",e.sessionDir]})]}):r.jsxs("div",{className:"text-center py-6",children:[r.jsx(Hn,{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 saved context"}),r.jsxs("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-1",children:["Use ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1 rounded",children:"/flush"})," in Claude Code to save your session"]})]})})]}),(e==null?void 0:e.lastSession)&&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.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Last Session"})}),r.jsxs("div",{className:"p-4 space-y-2",children:[e.lastSession.session_id&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"ID:"}),r.jsx("code",{className:"text-xs bg-gray-100 dark:bg-slate-800 px-2 py-0.5 rounded",children:e.lastSession.session_id})]}),e.lastSession.cwd&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Directory:"}),r.jsx("span",{className:"text-gray-900 dark:text-white font-mono text-xs",children:e.lastSession.cwd})]}),e.lastSession.timestamp&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Ended:"}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:e.lastSession.timestamp})]}),e.lastSession.reason&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Reason:"}),r.jsx(Qe,{variant:"secondary",children:e.lastSession.reason})]})]})]}),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:"How to Use"}),r.jsxs("ol",{className:"space-y-2 text-sm text-gray-600 dark:text-slate-400",children:[r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"1."}),"Install session hooks and the /flush command above"]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"2."}),"Use ",r.jsx("code",{className:"bg-white dark:bg-slate-800 px-1.5 py-0.5 rounded",children:"/flush"})," in Claude Code before ending a session"]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"3."}),"Your context is automatically restored when you start a new session"]})]})]}),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 session # Show session status"}),r.jsx("p",{children:"coder-config session install-hooks # Install session hooks"}),r.jsx("p",{children:"coder-config session clear # Clear saved context"})]})]}),r.jsx(wt,{open:c,onOpenChange:f,children:r.jsxs(gt,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(xt,{children:[r.jsx(vt,{children:"Saved Context"}),r.jsx(er,{children:"This context will be restored on your next Claude Code session"})]}),r.jsx("div",{className:"flex-1 overflow-auto py-4",children:r.jsx("pre",{className:"text-sm text-gray-700 dark:text-slate-300 whitespace-pre-wrap bg-gray-50 dark:bg-slate-900 p-4 rounded-lg",children:m||"No content"})}),r.jsx(Pt,{children:r.jsx(se,{variant:"ghost",onClick:()=>f(!1),children:"Close"})})]})})]})}const yW=[{id:"projects",label:"All Projects",icon:fs,section:"Projects"},{id:"explorer",label:"Project Explorer",icon:Ci,section:"Projects"},{id:"workstreams",label:"Workstreams",icon:WC,section:"Projects"},{id:"registry",label:"MCP Registry",icon:bs,section:"Tools"},{id:"plugins",label:"Plugins",icon:eo,section:"Tools"},{id:"memory",label:"Memory",icon:Ji,section:"Tools"},{id:"claude-settings",label:"Claude Code",icon:ks,section:"Configuration",tool:"claude"},{id:"gemini-settings",label:"Gemini CLI",icon:Ft,section:"Configuration",tool:"gemini"},{id:"codex-settings",label:"Codex CLI",icon:Ft,section:"Configuration",isNew:!0,tool:"codex"},{id:"antigravity-settings",label:"Antigravity",icon:Hl,section:"Configuration",tool:"antigravity"},{id:"create-mcp",label:"Create MCP",icon:Fn,section:"Developer"},{id:"loops",label:"Ralph Loops",icon:kl,section:"Developer",isNew:!0},{id:"sessions",label:"Sessions",icon:Hn,section:"System"},{id:"preferences",label:"Preferences",icon:VC,section:"System"},{id:"tutorial",label:"Tutorial",icon:Gd,section:"Help"},{id:"docs",label:"Docs & Help",icon:Xi,section:"Help"}],e_=(e,t)=>{try{const n=localStorage.getItem(`claude-config-${e}`);return n?JSON.parse(n):t}catch{return t}},bW=(e,t)=>{try{localStorage.setItem(`claude-config-${e}`,JSON.stringify(t))}catch{}};function wW(){const[e,t]=C.useState(()=>e_("currentView","explorer")),[n,s]=C.useState(!0),[o,d]=C.useState({dir:"",subprojects:[],hierarchy:[]}),[u,l]=C.useState([]),[c,f]=C.useState({mcpServers:{}}),[m,h]=C.useState([]),[x,w]=C.useState([]),[k,_]=C.useState(null),[y,v]=C.useState(null),[g,b]=C.useState(!1),[j,E]=C.useState({title:"",type:""}),[P,T]=C.useState(""),[N,M]=C.useState(""),[I,O]=C.useState({}),[B,H]=C.useState(null),[q,z]=C.useState(null),[G,X]=C.useState(!1),[K,F]=C.useState([]),[R,L]=C.useState(null),[U,$]=C.useState(!1),[ne,he]=C.useState(null),[pe,Y]=C.useState(null),[W,ae]=C.useState(!1),te=C.useRef(null);C.useEffect(()=>{bW("currentView",e)},[e]);const Q=C.useCallback(async()=>{try{const[ce,ye,Ne,Ke,me]=await Promise.all([xe.getProject(),xe.getConfigs(),xe.getRegistry(),xe.getRules(),xe.getCommands()]);d(ce),l(ye),f(Ne),h(Ke),w(me),ye.length>0&&!k&&_(ye[ye.length-1])}catch(ce){J.error("Failed to load data: "+ce.message)}finally{s(!1)}},[k]),ie=C.useCallback(async(ce=!1)=>{var ye;try{const Ne=await xe.getProjects();F(Ne.projects||[]);const Ke=(ye=Ne.projects)==null?void 0:ye.find(me=>me.isActive);if(L(Ke||null),ce&&Ke){const me=await xe.getSubprojects(Ke.path);he({dir:Ke.path,subprojects:me.subprojects||[]})}ce&&!Ke&&(e_("currentView",null)||t("projects"))}catch{console.log("Projects API not available")}},[]),be=async ce=>{try{const ye=await xe.setActiveProject(ce);ye.success?(d({dir:ye.dir,hierarchy:ye.hierarchy,subprojects:ye.subprojects}),he({dir:ye.dir,subprojects:ye.subprojects}),L(ye.project),F(Ne=>Ne.map(Ke=>({...Ke,isActive:Ke.id===ce}))),await Q(),J.success(`Switched to ${ye.project.name}`)):J.error(ye.error||"Failed to switch project")}catch(ye){J.error("Failed to switch project: "+ye.message)}},Fe=ce=>{F(ye=>[...ye,{...ce,exists:!0,hasClaudeConfig:!1}])};C.useEffect(()=>{Q(),ie(!0),(async()=>{var ye;try{const[Ne,Ke]=await Promise.all([xe.checkVersion(),xe.getConfig()]);if(H(Ne==null?void 0:Ne.installedVersion),Y((Ke==null?void 0:Ke.config)||{}),!te.current&&(Ne!=null&&Ne.installedVersion)&&(te.current=Ne.installedVersion),Ne!=null&&Ne.updateAvailable&&(Ne==null?void 0:Ne.updateMethod)==="npm")if((ye=Ke==null?void 0:Ke.config)!=null&&ye.autoUpdate){J.info(`Auto-updating to v${Ne.latestVersion}...`),X(!0);const me=await xe.performUpdate({updateMethod:Ne.updateMethod,targetVersion:Ne.latestVersion});if(me.success){J.success(`Updated to v${me.newVersion}! Restarting server...`);try{await xe.restartServer()}catch{}let _e=0;const Ie=setInterval(async()=>{_e++;try{await xe.checkVersion(),clearInterval(Ie),J.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{_e>30&&(clearInterval(Ie),J.info("Server restarting. Please refresh the page."),X(!1))}},500)}else J.error("Auto-update failed: "+me.error),X(!1),z(Ne)}else z(Ne)}catch{}})()},[]),C.useEffect(()=>{const ye=setInterval(async()=>{if(te.current)try{const Ne=await xe.checkVersion();Ne!=null&&Ne.installedVersion&&Ne.installedVersion!==te.current&&(console.log(`[stale-ui] Server updated to v${Ne.installedVersion}, refreshing...`),window.location.reload())}catch{}},3e4);return()=>clearInterval(ye)},[]);const Ve=async()=>{ae(!0);try{const ce=await xe.checkVersion();if(ce!=null&&ce.installedVersion&&te.current&&ce.installedVersion!==te.current){J.info(`Refreshing to v${ce.installedVersion}...`),setTimeout(()=>window.location.reload(),500);return}else ce!=null&&ce.updateAvailable?(z(ce),J.info(`Update available: v${ce.latestVersion}`)):J.success("You're on the latest version")}catch{J.error("Failed to check for updates")}finally{ae(!1)}},le=async()=>{if(q!=null&&q.updateAvailable){X(!0);try{const ce=await xe.performUpdate({updateMethod:q.updateMethod,sourcePath:q.sourcePath,targetVersion:q.latestVersion});if(ce.success){J.success(`Updated to v${ce.newVersion}! Restarting server...`),z(null),H(ce.newVersion);try{await xe.restartServer()}catch{}let ye=0;const Ne=setInterval(async()=>{ye++;try{await xe.checkVersion(),clearInterval(Ne),J.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{ye>30&&(clearInterval(Ne),J.info("Server restarting. Please refresh the page."),X(!1))}},500)}else J.error("Update failed: "+ce.error),X(!1)}catch(ce){J.error("Update failed: "+ce.message),X(!1)}}};C.useEffect(()=>{const ce=async()=>{try{const{hashes:Ne}=await xe.getFileHashes(),Ke=I,me=Object.keys(Ne).some(Ie=>Ke[Ie]!==Ne[Ie])||Object.keys(Ke).some(Ie=>!Ne[Ie]),_e=Ke.__subprojects__!==Ne.__subprojects__;if(me&&Object.keys(Ke).length>0&&(J.info("Files changed externally, reloading..."),await Q(),_e&&ne))try{const Ie=await xe.getSubprojects(ne.dir);he(Xe=>({...Xe,subprojects:Ie.subprojects||[]}))}catch{}O(Ne)}catch{}},ye=setInterval(ce,2e3);return ce(),()=>clearInterval(ye)},[I,Q,ne]);const we=new Set;u.forEach(ce=>{var ye,Ne;(((ye=ce.config)==null?void 0:ye.include)||[]).forEach(Ke=>we.add(Ke)),Object.keys(((Ne=ce.config)==null?void 0:Ne.mcpServers)||{}).forEach(Ke=>we.add(Ke))});const Ye={mcps:we.size,rules:m.length,commands:x.length},Ge=async()=>{try{const ce=await xe.applyConfig(o.dir);if(ce.tools){const ye=Object.entries(ce.tools).filter(([,Ne])=>Ne).map(([Ne])=>Ne==="claude"?"Claude Code":"Antigravity");ye.length>0?J.success(`Config applied to: ${ye.join(", ")}`):J.warning("No tools were updated")}else J.success("Configuration applied successfully!")}catch(ce){J.error("Failed to apply config: "+ce.message)}},ct=async()=>{s(!0),await Q(),J.success("Data refreshed")};if(n)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(tt,{className:"w-8 h-8 animate-spin text-primary"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading configuration..."})]})});const ke=()=>{switch(e){case"explorer":return r.jsx(o8,{project:o,onRefresh:Q});case"registry":return r.jsx(_z,{registry:c,searchQuery:P,setSearchQuery:T,onUpdate:Q});case"plugins":return r.jsx(Gz,{});case"memory":return r.jsx(Cz,{project:o,onUpdate:Q});case"create-mcp":return r.jsx(ZH,{project:o});case"claude-settings":return r.jsx(FH,{});case"gemini-settings":return r.jsx(BH,{});case"codex-settings":return r.jsx(JH,{});case"antigravity-settings":return r.jsx(VH,{});case"sessions":return r.jsx(vW,{});case"preferences":return r.jsx(OH,{onConfigChange:ce=>Y(ce)});case"projects":return r.jsx(Sz,{onProjectSwitch:ce=>{d({dir:ce.dir,hierarchy:ce.hierarchy,subprojects:ce.subprojects}),he({dir:ce.dir,subprojects:ce.subprojects}),Q(),ie()}});case"workstreams":return r.jsx(Kz,{projects:K,onWorkstreamChange:ce=>{J.success(`Switched to workstream: ${ce.name}`)}});case"loops":return r.jsx(qz,{activeProject:R});case"docs":return r.jsx(Vz,{});case"tutorial":return r.jsx(xW,{});default:return null}};return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"h-16 bg-card border-b border-border sticky top-0 z-50 shadow-sm",children:r.jsxs("div",{className:"h-full px-6 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg shadow-indigo-500/20",children:r.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 128 128",children:[r.jsx("circle",{cx:"64",cy:"64",r:"52",fill:"none",stroke:"white",strokeWidth:"10",strokeDasharray:"24 12"}),r.jsx("circle",{cx:"64",cy:"64",r:"28",fill:"white"}),r.jsx("circle",{cx:"64",cy:"64",r:"12",fill:"#7c3aed"})]})}),r.jsx("div",{children:r.jsxs("h1",{className:"text-xl font-bold text-foreground",children:["Coder ",r.jsx("span",{className:"text-primary",children:"Config"})]})}),q&&r.jsxs("button",{onClick:le,disabled:G,className:"ml-3 px-2.5 py-1 text-xs font-medium bg-green-100 text-green-700 hover:bg-green-200 rounded-full flex items-center gap-1.5 transition-colors disabled:opacity-50",children:[G?r.jsx(tt,{className:"w-3 h-3 animate-spin"}):r.jsx(Qi,{className:"w-3 h-3"}),G?"Updating...":`Update to v${q.latestVersion}`]})]}),r.jsx(Qj,{orientation:"vertical",className:"h-6"}),r.jsx(a8,{projects:K,activeProject:R,onSwitch:be,onAddClick:()=>$(!0),onManageClick:()=>t("projects")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(u8,{}),r.jsx(se,{variant:"ghost",size:"sm",onClick:ct,children:r.jsx(yr,{className:"w-4 h-4"})}),r.jsxs(se,{onClick:Ge,variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",title:"Config auto-applies on save. Click to manually re-apply.",children:[r.jsx(Hl,{className:"w-4 h-4"}),"Re-apply"]})]})]})}),r.jsxs("div",{className:"flex",children:[r.jsxs("aside",{className:"w-64 h-[calc(100vh-64px)] border-r border-border bg-card sticky top-16 flex flex-col",children:[r.jsx(Wn,{className:"flex-1 py-4",children:["Projects","Tools","Configuration","Developer","System","Help"].map(ce=>r.jsxs("div",{className:"mb-6",children:[r.jsx("h3",{className:"px-4 mb-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:ce}),r.jsx("div",{className:"space-y-0.5",children:yW.filter(ye=>ye.section===ce).filter(ye=>{var Ne;return ye.id!=="loops"||((Ne=pe==null?void 0:pe.experimental)==null?void 0:Ne.ralphLoops)}).filter(ye=>!ye.tool||((pe==null?void 0:pe.enabledTools)||["claude"]).includes(ye.tool)).map(ye=>{const Ne=ye.icon,Ke=e===ye.id;return r.jsxs("button",{onClick:()=>t(ye.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-all duration-200 border-l-2 ${Ke?"bg-accent border-primary text-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:[r.jsx(Ne,{className:"w-4 h-4"}),r.jsx("span",{className:"flex-1 text-left",children:ye.label}),ye.badge&&r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${Ke?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:Ye[ye.badge]}),ye.isNew&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-green-500/20 text-green-600 dark:text-green-400",children:"new"})]},ye.id)})})]},ce))}),r.jsx("div",{className:"px-4 py-3 border-t border-border",children:r.jsxs("button",{onClick:Ve,disabled:W,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",title:"Check for updates",children:[W?r.jsx(tt,{className:"w-3 h-3 animate-spin"}):null,B?`v${B}`:""]})})]}),r.jsx("main",{className:Ae("flex-1 overflow-auto",["explorer","docs","tutorial"].includes(e)?"h-[calc(100vh-64px)]":"p-6"),children:r.jsx(i_,{mode:"wait",children:r.jsx(Uo.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},className:["explorer","docs","tutorial"].includes(e)?"h-full":"",children:ke()},e)})})]}),r.jsx(qj,{open:U,onOpenChange:$,onAdded:Fe}),r.jsx(l8,{onStartTutorial:()=>t("tutorial")})]})}function _W(){const[e,t]=C.useState(!1),[n,s]=C.useState(!1),[o,d]=C.useState(!1),u=C.useCallback(async()=>{s(!0);try{await xe.restartServer(),J.info("Server restarting... page will reload."),setTimeout(()=>{window.location.reload()},2e3)}catch(c){J.error("Failed to restart: "+c.message),s(!1)}},[]),l=C.useCallback(()=>{d(!0),t(!1),J.dismiss("update-available")},[]);return C.useEffect(()=>{let c;const f=async()=>{try{const m=await xe.getVersion();console.log("[Update Check]",m),m.needsRestart&&!o&&t(!0)}catch{}};return f(),c=setInterval(f,3e4),()=>clearInterval(c)},[o]),r.jsx(c8,{children:r.jsxs("div",{className:"min-h-screen bg-background",children:[e&&!n&&r.jsxs("div",{className:"fixed top-0 left-0 right-0 z-50 bg-blue-600 text-white px-4 py-2 flex items-center justify-center gap-2 shadow-lg cursor-pointer hover:bg-blue-700 transition-colors",onClick:u,children:[r.jsx(yr,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Update available — click to restart"}),r.jsx("button",{onClick:c=>{c.stopPropagation(),l()},className:"absolute right-3 p-1 hover:bg-blue-500 rounded",children:r.jsx(yi,{className:"w-4 h-4"})})]}),n&&r.jsxs("div",{className:"fixed top-0 left-0 right-0 z-50 bg-amber-600 text-white px-4 py-2 flex items-center justify-center gap-2",children:[r.jsx(yr,{className:"w-4 h-4 animate-spin"}),r.jsx("span",{className:"text-sm font-medium",children:"Restarting server..."})]}),r.jsx(wW,{}),r.jsx(EP,{position:"bottom-right",richColors:!0})]})})}tP.createRoot(document.getElementById("root")).render(r.jsx(_W,{}));
3960
+ `}},gW={...iW,...oW,...aW,...lW,...cW,...dW,...uW,...hW,...fW,...mW,...pW},Ed={welcome:{bg:"bg-violet-500",light:"bg-violet-100 dark:bg-violet-950",text:"text-violet-600 dark:text-violet-400"},"first-project":{bg:"bg-blue-500",light:"bg-blue-100 dark:bg-blue-950",text:"text-blue-600 dark:text-blue-400"},"rules-guide":{bg:"bg-emerald-500",light:"bg-emerald-100 dark:bg-emerald-950",text:"text-emerald-600 dark:text-emerald-400"},"mcp-guide":{bg:"bg-orange-500",light:"bg-orange-100 dark:bg-orange-950",text:"text-orange-600 dark:text-orange-400"},"permissions-guide":{bg:"bg-green-500",light:"bg-green-100 dark:bg-green-950",text:"text-green-600 dark:text-green-400"},"memory-guide":{bg:"bg-pink-500",light:"bg-pink-100 dark:bg-pink-950",text:"text-pink-600 dark:text-pink-400"},"plugins-guide":{bg:"bg-purple-500",light:"bg-purple-100 dark:bg-purple-950",text:"text-purple-600 dark:text-purple-400"},"workstreams-guide":{bg:"bg-cyan-500",light:"bg-cyan-100 dark:bg-cyan-950",text:"text-cyan-600 dark:text-cyan-400"},"loops-guide":{bg:"bg-teal-500",light:"bg-teal-100 dark:bg-teal-950",text:"text-teal-600 dark:text-teal-400"},"multi-tool-guide":{bg:"bg-amber-500",light:"bg-amber-100 dark:bg-amber-950",text:"text-amber-600 dark:text-amber-400"},"next-steps":{bg:"bg-rose-500",light:"bg-rose-100 dark:bg-rose-950",text:"text-rose-600 dark:text-rose-400"}},Zw="claude-config-tutorial-visited";function xW(){const[e,t]=C.useState("intro"),[n,s]=C.useState({welcome:!0}),[o,d]=C.useState(()=>{try{return JSON.parse(localStorage.getItem(Zw)||"[]")}catch{return[]}}),u=C.useRef(null);C.useEffect(()=>{if(u.current){const b=u.current.querySelector("[data-radix-scroll-area-viewport]");b&&(b.scrollTop=0)}},[e]),C.useEffect(()=>{if(e&&!o.includes(e)){const b=[...o,e];d(b),localStorage.setItem(Zw,JSON.stringify(b))}},[e,o]);const l=b=>{s(j=>({...j,[b]:!j[b]}))},c=gW[e],f=il.flatMap(b=>b.subsections.length>0?b.subsections.map(j=>j.id):[b.id]),m=f.indexOf(e),h=m>0?f[m-1]:null,x=m<f.length-1?f[m+1]:null,w=Math.round(o.length/f.length*100),_=(()=>{for(const b of il)if(b.id===e||b.subsections.some(j=>j.id===e))return b;return il[0]})(),y=Ed[_.id]||Ed.welcome,v=b=>{for(const j of il){if(j.id===b)return j.title;const E=j.subsections.find(P=>P.id===b);if(E)return E.title}return""},g=b=>({__html:JN(b)});return r.jsxs("div",{className:"flex h-full",children:[r.jsxs("div",{className:"w-72 border-r border-border bg-muted/30 flex flex-col",children:[r.jsxs("div",{className:"p-4 border-b border-border bg-gradient-to-r from-indigo-500/10 to-purple-500/10",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg",children:r.jsx(Gd,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-foreground",children:"Tutorial"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Step-by-step guide"})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1",children:[r.jsx("span",{children:"Progress"}),r.jsxs("span",{children:[w,"% complete"]})]}),r.jsx(s2,{value:w,className:"h-2"})]})]}),r.jsx(Wn,{className:"flex-1",children:r.jsx("div",{className:"p-2",children:il.map((b,j)=>{const E=b.icon,P=Ed[b.id]||Ed.welcome,T=e===b.id||b.subsections.some(M=>M.id===e),N=b.subsections.length>0?b.subsections.every(M=>o.includes(M.id)):o.includes(b.id);return r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{className:Ae("w-full flex items-center gap-2 px-3 py-2.5 text-sm rounded-lg hover:bg-accent text-left transition-all",T&&"bg-accent"),onClick:()=>{b.subsections.length>0?(l(b.id),n[b.id]||t(b.subsections[0].id)):t(b.id)},children:[r.jsx("span",{className:Ae("w-7 h-7 rounded-lg flex items-center justify-center transition-colors",T?P.bg+" text-white":P.light),children:N?r.jsx(ta,{className:"w-4 h-4"}):r.jsx(E,{className:Ae("w-4 h-4",!T&&P.text)})}),r.jsx("span",{className:Ae("flex-1",T&&"font-medium"),children:b.title}),b.subsections.length>0&&r.jsx(Qr,{className:Ae("w-4 h-4 text-muted-foreground transition-transform",n[b.id]&&"rotate-90")})]}),b.subsections.length>0&&n[b.id]&&r.jsx("div",{className:"ml-4 mt-1 space-y-0.5 border-l-2 border-border pl-3",children:b.subsections.map(M=>{const I=e===M.id,O=o.includes(M.id);return r.jsxs("button",{className:Ae("w-full text-left px-3 py-1.5 text-sm rounded-md hover:bg-accent text-foreground flex items-center gap-2",I&&"bg-accent font-medium",I&&P.text),onClick:()=>t(M.id),children:[O&&!I&&r.jsx(ta,{className:"w-3 h-3 text-green-500"}),r.jsx("span",{className:Ae(!O&&!I&&"ml-5"),children:M.title})]},M.id)})})]},b.id)})})})]}),r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[r.jsx("div",{className:Ae("px-8 py-4 border-b border-border",y.light),children:r.jsxs("div",{className:"max-w-3xl mx-auto flex items-center gap-3",children:[r.jsx("div",{className:Ae("w-10 h-10 rounded-xl flex items-center justify-center",y.bg,"text-white"),children:r.jsx(_.icon,{className:"w-5 h-5"})}),r.jsxs("div",{children:[r.jsx("p",{className:Ae("text-sm font-medium",y.text),children:_.title}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:(c==null?void 0:c.title)||v(e)})]})]})}),r.jsx(Wn,{className:"flex-1",ref:u,children:r.jsx("div",{className:"max-w-3xl mx-auto p-8",children:c?r.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert prose-headings:text-foreground prose-p:text-muted-foreground prose-strong:text-foreground prose-code:text-primary prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-pre:bg-muted prose-pre:border prose-pre:border-border",dangerouslySetInnerHTML:g(c.content)}):r.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[r.jsx(Gd,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a topic from the sidebar"})]})})}),r.jsx("div",{className:"border-t border-border p-4 bg-muted/30",children:r.jsxs("div",{className:"max-w-3xl mx-auto flex items-center justify-between",children:[h?r.jsxs(se,{variant:"ghost",onClick:()=>t(h),className:"flex items-center gap-2",children:[r.jsx(v5,{className:"w-4 h-4"}),r.jsx("span",{className:"max-w-[150px] truncate",children:v(h)})]}):r.jsx("div",{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[m+1," of ",f.length]}),x?r.jsxs(se,{onClick:()=>t(x),className:Ae("flex items-center gap-2",y.bg,"hover:opacity-90"),children:[r.jsx("span",{className:"max-w-[150px] truncate",children:v(x)}),r.jsx(sg,{className:"w-4 h-4"})]}):r.jsx(se,{variant:"outline",onClick:()=>t("intro"),className:"flex items-center gap-2",children:"Start Over"})]})})]})]})}function vW(){const[e,t]=C.useState(null),[n,s]=C.useState(!0),[o,d]=C.useState(!1),[u,l]=C.useState(!1),[c,f]=C.useState(!1),[m,h]=C.useState(null);C.useEffect(()=>{x()},[]);const x=async()=>{try{s(!0);const j=await xe.getSessionStatus();t(j)}catch{J.error("Failed to load session status")}finally{s(!1)}},w=async()=>{var j,E;d(!0);try{const P=await xe.installSessionAll();P.success?(J.success("Session persistence installed!"),x()):J.error(((j=P.hooks)==null?void 0:j.error)||((E=P.command)==null?void 0:E.error)||"Installation failed")}catch{J.error("Installation failed")}finally{d(!1)}},k=async()=>{d(!0);try{const j=await xe.installSessionHooks();j.success?(J.success("Session hooks installed!"),x()):J.error(j.error||"Failed to install hooks")}catch{J.error("Failed to install hooks")}finally{d(!1)}},_=async()=>{d(!0);try{const j=await xe.installFlushCommand();j.success?(J.success(j.alreadyInstalled?"/flush command already installed":"/flush command installed!"),x()):J.error(j.error||"Failed to install command")}catch{J.error("Failed to install command")}finally{d(!1)}},y=async()=>{l(!0);try{const j=await xe.clearSessionContext();j.success?(J.success(j.cleared?"Session context cleared":"No context to clear"),x()):J.error("Failed to clear context")}catch{J.error("Failed to clear context")}finally{l(!1)}},v=async()=>{try{const j=await xe.getSessionContext();h(j.content),f(!0)}catch{J.error("Failed to load context")}},g=j=>j===null?"Unknown":j<60?`${j} minutes ago`:j<1440?`${Math.floor(j/60)} hours ago`:`${Math.floor(j/1440)} days ago`;if(n)return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(tt,{className:"w-8 h-8 animate-spin text-indigo-600"})});const b=(e==null?void 0:e.hooksInstalled)&&(e==null?void 0:e.flushCommandInstalled)&&(e==null?void 0:e.permissionInstalled);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("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-lg bg-indigo-100 dark:bg-indigo-950",children:r.jsx(Hn,{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:"Session Persistence"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Save and restore Claude Code session context"})]})]}),r.jsx(se,{variant:"ghost",size:"sm",onClick:x,children:r.jsx(yr,{className:"w-4 h-4"})})]}),r.jsxs("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:["Session persistence allows you to save your current Claude Code context using the ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1.5 py-0.5 rounded text-indigo-600 dark:text-indigo-400",children:"/flush"})," command, and automatically restore it when you start a new session."]})]}),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.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Installation Status"})}),r.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:[r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.hooksInstalled?r.jsx(Mt,{className:"w-5 h-5 text-green-500"}):r.jsx(Sn,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Session Hooks"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Auto-restore context on session start, preserve on session end"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qe,{variant:e!=null&&e.hooksInstalled?"default":"secondary",children:e!=null&&e.hooksInstalled?"Installed":"Not Installed"}),!(e!=null&&e.hooksInstalled)&&r.jsx(se,{variant:"outline",size:"sm",onClick:k,disabled:o,children:o?r.jsx(tt,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.flushCommandInstalled?r.jsx(Mt,{className:"w-5 h-5 text-green-500"}):r.jsx(Sn,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"/flush Command"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Adds the /flush command to save session context"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qe,{variant:e!=null&&e.flushCommandInstalled?"default":"secondary",children:e!=null&&e.flushCommandInstalled?"Installed":"Not Installed"}),!(e!=null&&e.flushCommandInstalled)&&r.jsx(se,{variant:"outline",size:"sm",onClick:_,disabled:o,children:o?r.jsx(tt,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.permissionInstalled?r.jsx(Mt,{className:"w-5 h-5 text-green-500"}):r.jsx(Sn,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Write Permission"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Allows Claude to write session context without prompting"})]})]}),r.jsx(Qe,{variant:e!=null&&e.permissionInstalled?"default":"secondary",children:e!=null&&e.permissionInstalled?"Granted":"Not Granted"})]})]}),!b&&r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-slate-900 border-t border-gray-200 dark:border-slate-800",children:r.jsxs(se,{onClick:w,disabled:o,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white",children:[o?r.jsx(tt,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(Qi,{className:"w-4 h-4 mr-2"}),"Install All"]})})]}),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:"Saved Context"}),(e==null?void 0:e.hasSavedContext)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(se,{variant:"outline",size:"sm",onClick:v,children:[r.jsx(Er,{className:"w-4 h-4 mr-2"}),"View"]}),r.jsx(se,{variant:"outline",size:"sm",onClick:y,disabled:u,className:"text-red-600 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950",children:u?r.jsx(tt,{className:"w-4 h-4 animate-spin"}):r.jsx(un,{className:"w-4 h-4"})})]})]}),r.jsx("div",{className:"p-4",children:e!=null&&e.hasSavedContext?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(pl,{className:"w-4 h-4 text-gray-400"}),r.jsx("span",{className:"text-gray-600 dark:text-slate-400",children:"Last saved:"}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:g(e.contextAge)})]}),e.contextPreview&&r.jsx("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:r.jsx("pre",{className:"text-xs text-gray-600 dark:text-slate-400 whitespace-pre-wrap overflow-hidden",children:e.contextPreview})}),r.jsxs("div",{className:"text-xs text-gray-500 dark:text-slate-500",children:["Storage: ",e.sessionDir]})]}):r.jsxs("div",{className:"text-center py-6",children:[r.jsx(Hn,{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 saved context"}),r.jsxs("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-1",children:["Use ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1 rounded",children:"/flush"})," in Claude Code to save your session"]})]})})]}),(e==null?void 0:e.lastSession)&&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.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Last Session"})}),r.jsxs("div",{className:"p-4 space-y-2",children:[e.lastSession.session_id&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"ID:"}),r.jsx("code",{className:"text-xs bg-gray-100 dark:bg-slate-800 px-2 py-0.5 rounded",children:e.lastSession.session_id})]}),e.lastSession.cwd&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Directory:"}),r.jsx("span",{className:"text-gray-900 dark:text-white font-mono text-xs",children:e.lastSession.cwd})]}),e.lastSession.timestamp&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Ended:"}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:e.lastSession.timestamp})]}),e.lastSession.reason&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Reason:"}),r.jsx(Qe,{variant:"secondary",children:e.lastSession.reason})]})]})]}),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:"How to Use"}),r.jsxs("ol",{className:"space-y-2 text-sm text-gray-600 dark:text-slate-400",children:[r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"1."}),"Install session hooks and the /flush command above"]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"2."}),"Use ",r.jsx("code",{className:"bg-white dark:bg-slate-800 px-1.5 py-0.5 rounded",children:"/flush"})," in Claude Code before ending a session"]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"3."}),"Your context is automatically restored when you start a new session"]})]})]}),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 session # Show session status"}),r.jsx("p",{children:"coder-config session install-hooks # Install session hooks"}),r.jsx("p",{children:"coder-config session clear # Clear saved context"})]})]}),r.jsx(wt,{open:c,onOpenChange:f,children:r.jsxs(gt,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(xt,{children:[r.jsx(vt,{children:"Saved Context"}),r.jsx(er,{children:"This context will be restored on your next Claude Code session"})]}),r.jsx("div",{className:"flex-1 overflow-auto py-4",children:r.jsx("pre",{className:"text-sm text-gray-700 dark:text-slate-300 whitespace-pre-wrap bg-gray-50 dark:bg-slate-900 p-4 rounded-lg",children:m||"No content"})}),r.jsx(Pt,{children:r.jsx(se,{variant:"ghost",onClick:()=>f(!1),children:"Close"})})]})})]})}const yW=[{id:"projects",label:"All Projects",icon:fs,section:"Projects"},{id:"explorer",label:"Project Explorer",icon:Ci,section:"Projects"},{id:"workstreams",label:"Workstreams",icon:WC,section:"Projects"},{id:"registry",label:"MCP Registry",icon:bs,section:"Tools"},{id:"plugins",label:"Plugins",icon:eo,section:"Tools"},{id:"memory",label:"Memory",icon:Ji,section:"Tools"},{id:"claude-settings",label:"Claude Code",icon:ks,section:"Configuration",tool:"claude"},{id:"gemini-settings",label:"Gemini CLI",icon:Ft,section:"Configuration",tool:"gemini"},{id:"codex-settings",label:"Codex CLI",icon:Ft,section:"Configuration",isNew:!0,tool:"codex"},{id:"antigravity-settings",label:"Antigravity",icon:Hl,section:"Configuration",tool:"antigravity"},{id:"create-mcp",label:"Create MCP",icon:Fn,section:"Developer"},{id:"loops",label:"Ralph Loops",icon:kl,section:"Developer",isNew:!0},{id:"sessions",label:"Sessions",icon:Hn,section:"System"},{id:"preferences",label:"Preferences",icon:VC,section:"System"},{id:"tutorial",label:"Tutorial",icon:Gd,section:"Help"},{id:"docs",label:"Docs & Help",icon:Xi,section:"Help"}],e_=(e,t)=>{try{const n=localStorage.getItem(`claude-config-${e}`);return n?JSON.parse(n):t}catch{return t}},bW=(e,t)=>{try{localStorage.setItem(`claude-config-${e}`,JSON.stringify(t))}catch{}};function wW(){const[e,t]=C.useState(()=>e_("currentView","explorer")),[n,s]=C.useState(!0),[o,d]=C.useState({dir:"",subprojects:[],hierarchy:[]}),[u,l]=C.useState([]),[c,f]=C.useState({mcpServers:{}}),[m,h]=C.useState([]),[x,w]=C.useState([]),[k,_]=C.useState(null),[y,v]=C.useState(null),[g,b]=C.useState(!1),[j,E]=C.useState({title:"",type:""}),[P,T]=C.useState(""),[N,M]=C.useState(""),[I,O]=C.useState({}),[B,H]=C.useState(null),[q,z]=C.useState(null),[G,X]=C.useState(!1),[K,F]=C.useState([]),[R,L]=C.useState(null),[U,$]=C.useState(!1),[ne,he]=C.useState(null),[pe,Y]=C.useState(null),[W,ae]=C.useState(!1),te=C.useRef(null);C.useEffect(()=>{bW("currentView",e)},[e]);const Q=C.useCallback(async()=>{try{const[ce,ye,Ne,Ke,me]=await Promise.all([xe.getProject(),xe.getConfigs(),xe.getRegistry(),xe.getRules(),xe.getCommands()]);d(ce),l(ye),f(Ne),h(Ke),w(me),ye.length>0&&!k&&_(ye[ye.length-1])}catch(ce){J.error("Failed to load data: "+ce.message)}finally{s(!1)}},[k]),ie=C.useCallback(async(ce=!1)=>{var ye;try{const Ne=await xe.getProjects();F(Ne.projects||[]);const Ke=(ye=Ne.projects)==null?void 0:ye.find(me=>me.isActive);if(L(Ke||null),ce&&Ke){const me=await xe.getSubprojects(Ke.path);he({dir:Ke.path,subprojects:me.subprojects||[]})}ce&&!Ke&&(e_("currentView",null)||t("projects"))}catch{console.log("Projects API not available")}},[]),be=async ce=>{try{const ye=await xe.setActiveProject(ce);ye.success?(d({dir:ye.dir,hierarchy:ye.hierarchy,subprojects:ye.subprojects}),he({dir:ye.dir,subprojects:ye.subprojects}),L(ye.project),F(Ne=>Ne.map(Ke=>({...Ke,isActive:Ke.id===ce}))),await Q(),J.success(`Switched to ${ye.project.name}`)):J.error(ye.error||"Failed to switch project")}catch(ye){J.error("Failed to switch project: "+ye.message)}},Fe=ce=>{F(ye=>[...ye,{...ce,exists:!0,hasClaudeConfig:!1}])};C.useEffect(()=>{Q(),ie(!0),(async()=>{var ye;try{const[Ne,Ke]=await Promise.all([xe.checkVersion(),xe.getConfig()]);if(H(Ne==null?void 0:Ne.installedVersion),Y((Ke==null?void 0:Ke.config)||{}),!te.current&&(Ne!=null&&Ne.installedVersion)&&(te.current=Ne.installedVersion),Ne!=null&&Ne.updateAvailable&&(Ne==null?void 0:Ne.updateMethod)==="npm")if((ye=Ke==null?void 0:Ke.config)!=null&&ye.autoUpdate){J.info(`Auto-updating to v${Ne.latestVersion}...`),X(!0);const me=await xe.performUpdate({updateMethod:Ne.updateMethod,targetVersion:Ne.latestVersion});if(me.success){J.success(`Updated to v${me.newVersion}! Restarting server...`);try{await xe.restartServer()}catch{}let _e=0;const Ie=setInterval(async()=>{_e++;try{await xe.checkVersion(),clearInterval(Ie),J.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{_e>30&&(clearInterval(Ie),J.info("Server restarting. Please refresh the page."),X(!1))}},500)}else J.error("Auto-update failed: "+me.error),X(!1),z(Ne)}else z(Ne)}catch{}})()},[]),C.useEffect(()=>{const ye=setInterval(async()=>{if(te.current)try{const Ne=await xe.checkVersion();Ne!=null&&Ne.installedVersion&&Ne.installedVersion!==te.current&&(console.log(`[stale-ui] Server updated to v${Ne.installedVersion}, refreshing...`),window.location.reload())}catch{}},3e4);return()=>clearInterval(ye)},[]);const Ve=async()=>{ae(!0);try{const ce=await xe.checkVersion();if(ce!=null&&ce.installedVersion&&te.current&&ce.installedVersion!==te.current){J.info(`Refreshing to v${ce.installedVersion}...`),setTimeout(()=>window.location.reload(),500);return}else ce!=null&&ce.updateAvailable?(z(ce),J.info(`Update available: v${ce.latestVersion}`)):J.success("You're on the latest version")}catch{J.error("Failed to check for updates")}finally{ae(!1)}},le=async()=>{if(q!=null&&q.updateAvailable){X(!0);try{const ce=await xe.performUpdate({updateMethod:q.updateMethod,sourcePath:q.sourcePath,targetVersion:q.latestVersion});if(ce.success){J.success(`Updated to v${ce.newVersion}! Restarting server...`),z(null),H(ce.newVersion);try{await xe.restartServer()}catch{}let ye=0;const Ne=setInterval(async()=>{ye++;try{await xe.checkVersion(),clearInterval(Ne),J.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{ye>30&&(clearInterval(Ne),J.info("Server restarting. Please refresh the page."),X(!1))}},500)}else J.error("Update failed: "+ce.error),X(!1)}catch(ce){J.error("Update failed: "+ce.message),X(!1)}}};C.useEffect(()=>{const ce=async()=>{try{const{hashes:Ne}=await xe.getFileHashes(),Ke=I,me=Object.keys(Ne).some(Ie=>Ke[Ie]!==Ne[Ie])||Object.keys(Ke).some(Ie=>!Ne[Ie]),_e=Ke.__subprojects__!==Ne.__subprojects__;if(me&&Object.keys(Ke).length>0&&(J.info("Files changed externally, reloading..."),await Q(),_e&&ne))try{const Ie=await xe.getSubprojects(ne.dir);he(Xe=>({...Xe,subprojects:Ie.subprojects||[]}))}catch{}O(Ne)}catch{}},ye=setInterval(ce,2e3);return ce(),()=>clearInterval(ye)},[I,Q,ne]);const we=new Set;u.forEach(ce=>{var ye,Ne;(((ye=ce.config)==null?void 0:ye.include)||[]).forEach(Ke=>we.add(Ke)),Object.keys(((Ne=ce.config)==null?void 0:Ne.mcpServers)||{}).forEach(Ke=>we.add(Ke))});const Ye={mcps:we.size,rules:m.length,commands:x.length},Ge=async()=>{try{const ce=await xe.applyConfig(o.dir);if(ce.tools){const ye=Object.entries(ce.tools).filter(([,Ne])=>Ne).map(([Ne])=>Ne==="claude"?"Claude Code":"Antigravity");ye.length>0?J.success(`Config applied to: ${ye.join(", ")}`):J.warning("No tools were updated")}else J.success("Configuration applied successfully!")}catch(ce){J.error("Failed to apply config: "+ce.message)}},ct=async()=>{s(!0),await Q(),J.success("Data refreshed")};if(n)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(tt,{className:"w-8 h-8 animate-spin text-primary"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading configuration..."})]})});const ke=()=>{switch(e){case"explorer":return r.jsx(o8,{project:o,onRefresh:Q});case"registry":return r.jsx(_z,{registry:c,searchQuery:P,setSearchQuery:T,onUpdate:Q});case"plugins":return r.jsx(Gz,{});case"memory":return r.jsx(Cz,{project:o,onUpdate:Q});case"create-mcp":return r.jsx(ZH,{project:o});case"claude-settings":return r.jsx(FH,{});case"gemini-settings":return r.jsx(BH,{});case"codex-settings":return r.jsx(JH,{});case"antigravity-settings":return r.jsx(VH,{});case"sessions":return r.jsx(vW,{});case"preferences":return r.jsx(OH,{onConfigChange:ce=>Y(ce)});case"projects":return r.jsx(Sz,{onProjectSwitch:ce=>{d({dir:ce.dir,hierarchy:ce.hierarchy,subprojects:ce.subprojects}),he({dir:ce.dir,subprojects:ce.subprojects}),Q(),ie()}});case"workstreams":return r.jsx(Kz,{projects:K,onWorkstreamChange:ce=>{J.success(`Switched to workstream: ${ce.name}`)}});case"loops":return r.jsx(qz,{activeProject:R});case"docs":return r.jsx(Vz,{});case"tutorial":return r.jsx(xW,{});default:return null}};return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"h-16 bg-card border-b border-border sticky top-0 z-50 shadow-sm",children:r.jsxs("div",{className:"h-full px-6 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg shadow-indigo-500/20",children:r.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 128 128",children:[r.jsx("circle",{cx:"64",cy:"64",r:"52",fill:"none",stroke:"white",strokeWidth:"10",strokeDasharray:"24 12"}),r.jsx("circle",{cx:"64",cy:"64",r:"28",fill:"white"}),r.jsx("circle",{cx:"64",cy:"64",r:"12",fill:"#7c3aed"})]})}),r.jsx("div",{children:r.jsxs("h1",{className:"text-xl font-bold text-foreground",children:["Coder ",r.jsx("span",{className:"text-primary",children:"Config"})]})}),q&&r.jsxs("button",{onClick:le,disabled:G,className:"ml-3 px-2.5 py-1 text-xs font-medium bg-green-100 text-green-700 hover:bg-green-200 rounded-full flex items-center gap-1.5 transition-colors disabled:opacity-50",children:[G?r.jsx(tt,{className:"w-3 h-3 animate-spin"}):r.jsx(Qi,{className:"w-3 h-3"}),G?"Updating...":`Update to v${q.latestVersion}`]})]}),r.jsx(Qj,{orientation:"vertical",className:"h-6"}),r.jsx(a8,{projects:K,activeProject:R,onSwitch:be,onAddClick:()=>$(!0),onManageClick:()=>t("projects")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(u8,{}),r.jsx(se,{variant:"ghost",size:"sm",onClick:ct,children:r.jsx(yr,{className:"w-4 h-4"})}),r.jsxs(se,{onClick:Ge,variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",title:"Config auto-applies on save. Click to manually re-apply.",children:[r.jsx(Hl,{className:"w-4 h-4"}),"Re-apply"]})]})]})}),r.jsxs("div",{className:"flex",children:[r.jsxs("aside",{className:"w-64 h-[calc(100vh-64px)] border-r border-border bg-card sticky top-16 flex flex-col",children:[r.jsx(Wn,{className:"flex-1 py-4",children:["Projects","Tools","Configuration","Developer","System","Help"].map(ce=>r.jsxs("div",{className:"mb-6",children:[r.jsx("h3",{className:"px-4 mb-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:ce}),r.jsx("div",{className:"space-y-0.5",children:yW.filter(ye=>ye.section===ce).filter(ye=>{var Ne;return ye.id!=="loops"||((Ne=pe==null?void 0:pe.experimental)==null?void 0:Ne.ralphLoops)}).filter(ye=>!ye.tool||((pe==null?void 0:pe.enabledTools)||["claude"]).includes(ye.tool)).map(ye=>{const Ne=ye.icon,Ke=e===ye.id;return r.jsxs("button",{onClick:()=>t(ye.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-all duration-200 border-l-2 ${Ke?"bg-accent border-primary text-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:[r.jsx(Ne,{className:"w-4 h-4"}),r.jsx("span",{className:"flex-1 text-left",children:ye.label}),ye.badge&&r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${Ke?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:Ye[ye.badge]}),ye.isNew&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-green-500/20 text-green-600 dark:text-green-400",children:"new"})]},ye.id)})})]},ce))}),r.jsx("div",{className:"px-4 py-3 border-t border-border",children:r.jsxs("button",{onClick:Ve,disabled:W,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",title:"Check for updates",children:[W?r.jsx(tt,{className:"w-3 h-3 animate-spin"}):null,B?`v${B}`:""]})})]}),r.jsx("main",{style:{zoom:.9},className:Ae("flex-1 overflow-auto",["explorer","docs","tutorial"].includes(e)?"h-[calc(100vh-64px)]":"p-6"),children:r.jsx(i_,{mode:"wait",children:r.jsx(Uo.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},className:["explorer","docs","tutorial"].includes(e)?"h-full":"",children:ke()},e)})})]}),r.jsx(qj,{open:U,onOpenChange:$,onAdded:Fe}),r.jsx(l8,{onStartTutorial:()=>t("tutorial")})]})}function _W(){const[e,t]=C.useState(!1),[n,s]=C.useState(!1),[o,d]=C.useState(!1),u=C.useCallback(async()=>{s(!0);try{await xe.restartServer(),J.info("Server restarting... page will reload."),setTimeout(()=>{window.location.reload()},2e3)}catch(c){J.error("Failed to restart: "+c.message),s(!1)}},[]),l=C.useCallback(()=>{d(!0),t(!1),J.dismiss("update-available")},[]);return C.useEffect(()=>{let c;const f=async()=>{try{const m=await xe.getVersion();console.log("[Update Check]",m),m.needsRestart&&!o&&t(!0)}catch{}};return f(),c=setInterval(f,3e4),()=>clearInterval(c)},[o]),r.jsx(c8,{children:r.jsxs("div",{className:"min-h-screen bg-background",children:[e&&!n&&r.jsxs("div",{className:"fixed top-0 left-0 right-0 z-50 bg-blue-600 text-white px-4 py-2 flex items-center justify-center gap-2 shadow-lg cursor-pointer hover:bg-blue-700 transition-colors",onClick:u,children:[r.jsx(yr,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Update available — click to restart"}),r.jsx("button",{onClick:c=>{c.stopPropagation(),l()},className:"absolute right-3 p-1 hover:bg-blue-500 rounded",children:r.jsx(yi,{className:"w-4 h-4"})})]}),n&&r.jsxs("div",{className:"fixed top-0 left-0 right-0 z-50 bg-amber-600 text-white px-4 py-2 flex items-center justify-center gap-2",children:[r.jsx(yr,{className:"w-4 h-4 animate-spin"}),r.jsx("span",{className:"text-sm font-medium",children:"Restarting server..."})]}),r.jsx(wW,{}),r.jsx(EP,{position:"bottom-right",richColors:!0})]})})}tP.createRoot(document.getElementById("root")).render(r.jsx(_W,{}));
@@ -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-Cc9KjNjc.js"></script>
22
+ <script type="module" crossorigin src="/assets/index-B9oalny4.js"></script>
23
23
  <link rel="stylesheet" crossorigin href="/assets/index-B0EJaqXM.css">
24
24
  </head>
25
25
  <body>