coder-config 0.49.1-beta → 0.49.2-beta

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.49.1-beta';
5
+ const VERSION = '0.49.2-beta';
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.49.1-beta",
3
+ "version": "0.49.2-beta",
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",
@@ -3722,4 +3722,4 @@ Everything you can do in the UI, you can do from the command line. Some power us
3722
3722
  Thanks for using Coder Config. The goal is to make AI coding assistants work the way you want them to, without the friction of scattered configuration files and forgotten context. Hopefully this tool helps.
3723
3723
 
3724
3724
  Happy coding.
3725
- `}},qW={...LW,...OW,...FW,...BW,...$W,...zW,...HW,...WW,...UW,...VW,...GW},uu={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"}},k_="claude-config-tutorial-visited",tp="claude-config-tutorial-active";function KW(){const[e,r]=_.useState(()=>{try{return localStorage.getItem(tp)||"intro"}catch{return"intro"}}),[s,n]=_.useState(()=>{try{const b=localStorage.getItem(tp)||"intro",k={welcome:!0};for(const N of Ta)N.subsections.some(P=>P.id===b)&&(k[N.id]=!0);return k}catch{return{welcome:!0}}}),[o,c]=_.useState(()=>{try{return JSON.parse(localStorage.getItem(k_)||"[]")}catch{return[]}}),d=_.useRef(null);_.useEffect(()=>{if(d.current){const b=d.current.querySelector("[data-radix-scroll-area-viewport]");b&&(b.scrollTop=0)}},[e]),_.useEffect(()=>{if(e&&(localStorage.setItem(tp,e),!o.includes(e))){const b=[...o,e];c(b),localStorage.setItem(k_,JSON.stringify(b))}},[e,o]);const l=b=>{n(k=>({...k,[b]:!k[b]}))},u=qW[e],f=Ta.flatMap(b=>b.subsections.length>0?b.subsections.map(k=>k.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),S=(()=>{for(const b of Ta)if(b.id===e||b.subsections.some(k=>k.id===e))return b;return Ta[0]})(),v=uu[S.id]||uu.welcome,y=b=>{for(const k of Ta){if(k.id===b)return k.title;const N=k.subsections.find(P=>P.id===b);if(N)return N.title}return""},g=b=>({__html:j2(b)});return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:"w-72 border-r border-border bg-muted/30 flex flex-col",children:[t.jsxs("div",{className:"p-4 border-b border-border bg-gradient-to-r from-indigo-500/10 to-purple-500/10",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.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:t.jsx(Eu,{className:"w-5 h-5 text-white"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"font-semibold text-foreground",children:"Tutorial"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Step-by-step guide"})]})]}),t.jsxs("div",{className:"mt-3",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1",children:[t.jsx("span",{children:"Progress"}),t.jsxs("span",{children:[w,"% complete"]})]}),t.jsx(M2,{value:w,className:"h-2"})]})]}),t.jsx(Js,{className:"flex-1",children:t.jsx("div",{className:"p-2",children:Ta.map((b,k)=>{const N=b.icon,P=uu[b.id]||uu.welcome,A=e===b.id||b.subsections.some(M=>M.id===e),E=b.subsections.length>0?b.subsections.every(M=>o.includes(M.id)):o.includes(b.id);return t.jsxs("div",{className:"mb-1",children:[t.jsxs("button",{className:Ne("w-full flex items-center gap-2 px-3 py-2.5 text-sm rounded-lg hover:bg-accent text-left transition-all",A&&"bg-accent"),onClick:()=>{b.subsections.length>0?(l(b.id),s[b.id]||r(b.subsections[0].id)):r(b.id)},children:[t.jsx("span",{className:Ne("w-7 h-7 rounded-lg flex items-center justify-center transition-colors",A?P.bg+" text-white":P.light),children:E?t.jsx(Oo,{className:"w-4 h-4"}):t.jsx(N,{className:Ne("w-4 h-4",!A&&P.text)})}),t.jsx("span",{className:Ne("flex-1",A&&"font-medium"),children:b.title}),b.subsections.length>0&&t.jsx(vs,{className:Ne("w-4 h-4 text-muted-foreground transition-transform",s[b.id]&&"rotate-90")})]}),b.subsections.length>0&&s[b.id]&&t.jsx("div",{className:"ml-4 mt-1 space-y-0.5 border-l-2 border-border pl-3",children:b.subsections.map(M=>{const D=e===M.id,O=o.includes(M.id);return t.jsxs("button",{className:Ne("w-full text-left px-3 py-1.5 text-sm rounded-md hover:bg-accent text-foreground flex items-center gap-2",D&&"bg-accent font-medium",D&&P.text),onClick:()=>r(M.id),children:[O&&!D&&t.jsx(Oo,{className:"w-3 h-3 text-green-500"}),t.jsx("span",{className:Ne(!O&&!D&&"ml-5"),children:M.title})]},M.id)})})]},b.id)})})})]}),t.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[t.jsx("div",{className:Ne("px-8 py-4 border-b border-border",v.light),children:t.jsxs("div",{className:"max-w-3xl mx-auto flex items-center gap-3",children:[t.jsx("div",{className:Ne("w-10 h-10 rounded-xl flex items-center justify-center",v.bg,"text-white"),children:t.jsx(S.icon,{className:"w-5 h-5"})}),t.jsxs("div",{children:[t.jsx("p",{className:Ne("text-sm font-medium",v.text),children:S.title}),t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:(u==null?void 0:u.title)||y(e)})]})]})}),t.jsx(Js,{className:"flex-1",ref:d,children:t.jsx("div",{className:"max-w-3xl mx-auto p-8",children:u?t.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 [&_:not(pre)>code]:text-primary [&_:not(pre)>code]:bg-muted [&_:not(pre)>code]:px-1 [&_:not(pre)>code]:py-0.5 [&_:not(pre)>code]:rounded [&_pre]:bg-zinc-900 [&_pre]:text-zinc-100 [&_pre]:border [&_pre]:border-zinc-700 [&_pre_code]:text-zinc-100 [&_pre_code]:bg-transparent [&_pre_code]:p-0",dangerouslySetInnerHTML:g(u.content)}):t.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[t.jsx(Eu,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),t.jsx("p",{children:"Select a topic from the sidebar"})]})})}),t.jsx("div",{className:"border-t border-border p-4 bg-muted/30",children:t.jsxs("div",{className:"max-w-3xl mx-auto flex items-center justify-between",children:[h?t.jsxs(se,{variant:"ghost",onClick:()=>r(h),className:"flex items-center gap-2",children:[t.jsx(M5,{className:"w-4 h-4"}),t.jsx("span",{className:"max-w-[150px] truncate",children:y(h)})]}):t.jsx("div",{}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[m+1," of ",f.length]}),x?t.jsxs(se,{onClick:()=>r(x),className:Ne("flex items-center gap-2",v.bg,"hover:opacity-90"),children:[t.jsx("span",{className:"max-w-[150px] truncate",children:y(x)}),t.jsx(Rg,{className:"w-4 h-4"})]}):t.jsx(se,{variant:"outline",onClick:()=>r("intro"),className:"flex items-center gap-2",children:"Start Over"})]})})]})]})}function YW(){const[e,r]=_.useState(null),[s,n]=_.useState(!0),[o,c]=_.useState(!1),[d,l]=_.useState(!1),[u,f]=_.useState(!1),[m,h]=_.useState(null);_.useEffect(()=>{x()},[]);const x=async()=>{try{n(!0);const k=await me.getSessionStatus();r(k)}catch{q.error("Failed to load session status")}finally{n(!1)}},w=async()=>{var k,N;c(!0);try{const P=await me.installSessionAll();P.success?(q.success("Session persistence installed!"),x()):q.error(((k=P.hooks)==null?void 0:k.error)||((N=P.command)==null?void 0:N.error)||"Installation failed")}catch{q.error("Installation failed")}finally{c(!1)}},j=async()=>{c(!0);try{const k=await me.installSessionHooks();k.success?(q.success("Session hooks installed!"),x()):q.error(k.error||"Failed to install hooks")}catch{q.error("Failed to install hooks")}finally{c(!1)}},S=async()=>{c(!0);try{const k=await me.installFlushCommand();k.success?(q.success(k.alreadyInstalled?"/flush command already installed":"/flush command installed!"),x()):q.error(k.error||"Failed to install command")}catch{q.error("Failed to install command")}finally{c(!1)}},v=async()=>{l(!0);try{const k=await me.clearSessionContext();k.success?(q.success(k.cleared?"Session context cleared":"No context to clear"),x()):q.error("Failed to clear context")}catch{q.error("Failed to clear context")}finally{l(!1)}},y=async()=>{try{const k=await me.getSessionContext();h(k.content),f(!0)}catch{q.error("Failed to load context")}},g=k=>k===null?"Unknown":k<60?`${k} minutes ago`:k<1440?`${Math.floor(k/60)} hours ago`:`${Math.floor(k/1440)} days ago`;if(s)return t.jsx("div",{className:"flex items-center justify-center h-64",children:t.jsx(Qe,{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 t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-5 shadow-sm",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"p-2 rounded-lg bg-indigo-100 dark:bg-indigo-950",children:t.jsx(bs,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Session Persistence"}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Save and restore Claude Code session context"})]})]}),t.jsx(se,{variant:"ghost",size:"sm",onClick:x,children:t.jsx(Mr,{className:"w-4 h-4"})})]}),t.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 ",t.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."]})]}),t.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[t.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:t.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Installation Status"})}),t.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:[t.jsxs("div",{className:"p-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.hooksInstalled?t.jsx(Rt,{className:"w-5 h-5 text-green-500"}):t.jsx(Is,{className:"w-5 h-5 text-amber-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Session Hooks"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Auto-restore context on session start, preserve on session end"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(tt,{variant:e!=null&&e.hooksInstalled?"default":"secondary",children:e!=null&&e.hooksInstalled?"Installed":"Not Installed"}),!(e!=null&&e.hooksInstalled)&&t.jsx(se,{variant:"outline",size:"sm",onClick:j,disabled:o,children:o?t.jsx(Qe,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),t.jsxs("div",{className:"p-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.flushCommandInstalled?t.jsx(Rt,{className:"w-5 h-5 text-green-500"}):t.jsx(Is,{className:"w-5 h-5 text-amber-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"/flush Command"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Adds the /flush command to save session context"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(tt,{variant:e!=null&&e.flushCommandInstalled?"default":"secondary",children:e!=null&&e.flushCommandInstalled?"Installed":"Not Installed"}),!(e!=null&&e.flushCommandInstalled)&&t.jsx(se,{variant:"outline",size:"sm",onClick:S,disabled:o,children:o?t.jsx(Qe,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),t.jsxs("div",{className:"p-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.permissionInstalled?t.jsx(Rt,{className:"w-5 h-5 text-green-500"}):t.jsx(Is,{className:"w-5 h-5 text-amber-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Write Permission"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Allows Claude to write session context without prompting"})]})]}),t.jsx(tt,{variant:e!=null&&e.permissionInstalled?"default":"secondary",children:e!=null&&e.permissionInstalled?"Granted":"Not Granted"})]})]}),!b&&t.jsx("div",{className:"p-4 bg-gray-50 dark:bg-slate-900 border-t border-gray-200 dark:border-slate-800",children:t.jsxs(se,{onClick:w,disabled:o,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white",children:[o?t.jsx(Qe,{className:"w-4 h-4 mr-2 animate-spin"}):t.jsx(xi,{className:"w-4 h-4 mr-2"}),"Install All"]})})]}),t.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[t.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700 flex items-center justify-between",children:[t.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Saved Context"}),(e==null?void 0:e.hasSavedContext)&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(se,{variant:"outline",size:"sm",onClick:y,children:[t.jsx(zr,{className:"w-4 h-4 mr-2"}),"View"]}),t.jsx(se,{variant:"outline",size:"sm",onClick:v,disabled:d,className:"text-red-600 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950",children:d?t.jsx(Qe,{className:"w-4 h-4 animate-spin"}):t.jsx(ws,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"p-4",children:e!=null&&e.hasSavedContext?t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx(ac,{className:"w-4 h-4 text-gray-400"}),t.jsx("span",{className:"text-gray-600 dark:text-slate-400",children:"Last saved:"}),t.jsx("span",{className:"text-gray-900 dark:text-white",children:g(e.contextAge)})]}),e.contextPreview&&t.jsx("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:t.jsx("pre",{className:"text-xs text-gray-600 dark:text-slate-400 whitespace-pre-wrap overflow-hidden",children:e.contextPreview})}),t.jsxs("div",{className:"text-xs text-gray-500 dark:text-slate-500",children:["Storage: ",e.sessionDir]})]}):t.jsxs("div",{className:"text-center py-6",children:[t.jsx(bs,{className:"w-12 h-12 text-gray-300 dark:text-slate-600 mx-auto mb-3"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:"No saved context"}),t.jsxs("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-1",children:["Use ",t.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)&&t.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[t.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:t.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Last Session"})}),t.jsxs("div",{className:"p-4 space-y-2",children:[e.lastSession.session_id&&t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"ID:"}),t.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&&t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Directory:"}),t.jsx("span",{className:"text-gray-900 dark:text-white font-mono text-xs",children:e.lastSession.cwd})]}),e.lastSession.timestamp&&t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Ended:"}),t.jsx("span",{className:"text-gray-900 dark:text-white",children:e.lastSession.timestamp})]}),e.lastSession.reason&&t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Reason:"}),t.jsx(tt,{variant:"secondary",children:e.lastSession.reason})]})]})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"How to Use"}),t.jsxs("ol",{className:"space-y-2 text-sm text-gray-600 dark:text-slate-400",children:[t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"1."}),"Install session hooks and the /flush command above"]}),t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"2."}),"Use ",t.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"]}),t.jsxs("li",{className:"flex gap-2",children:[t.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"]})]})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),t.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[t.jsx("p",{children:"coder-config session # Show session status"}),t.jsx("p",{children:"coder-config session install-hooks # Install session hooks"}),t.jsx("p",{children:"coder-config session clear # Clear saved context"})]})]}),t.jsx(bt,{open:u,onOpenChange:f,children:t.jsxs(ft,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[t.jsxs(mt,{children:[t.jsx(pt,{children:"Saved Context"}),t.jsx(rr,{children:"This context will be restored on your next Claude Code session"})]}),t.jsx("div",{className:"flex-1 overflow-auto py-4",children:t.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"})}),t.jsx(kt,{children:t.jsx(se,{variant:"ghost",onClick:()=>f(!1),children:"Close"})})]})})]})}const JW=["Built-in","Minimal","Git","Combo","System","Custom"];function XW(e){const r={};for(const s of e)r[s.category]||(r[s.category]=[]),r[s.category].push(s);return r}function QW(){const[e,r]=_.useState([]),[s,n]=_.useState(""),[o,c]=_.useState("default"),[d,l]=_.useState(""),[u,f]=_.useState(!0),[m,h]=_.useState(!1);_.useEffect(()=>{x()},[]);const x=async()=>{try{f(!0);const[y,g]=await Promise.all([me.getStatuslinePresets(),me.getCurrentStatusline()]);r(y.presets||[]),n(g.command||""),c(g.presetId||"default"),g.presetId==="custom"&&l(g.command||"")}catch(y){q.error("Failed to load statuslines: "+y.message)}finally{f(!1)}},w=async y=>{if(y.command===null){c("custom");return}h(!0);try{await me.setStatusline(y.command),n(y.command),c(y.id),q.success(`Statusline set to "${y.name}"`)}catch(g){q.error("Failed to apply statusline: "+g.message)}finally{h(!1)}},j=async()=>{h(!0);try{await me.setStatusline(d),n(d),c("custom"),q.success("Custom statusline applied")}catch(y){q.error("Failed to apply statusline: "+y.message)}finally{h(!1)}},S=async()=>{h(!0);try{await me.setStatusline(""),n(""),c("default"),q.success("Statusline reset to Claude Code default")}catch(y){q.error("Failed to reset statusline: "+y.message)}finally{h(!1)}};if(u)return t.jsx("div",{className:"flex items-center justify-center h-64",children:t.jsx(Qe,{className:"w-8 h-8 animate-spin text-indigo-600"})});const v=XW(e);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[t.jsx(Ut,{className:"w-5 h-5 text-indigo-500"}),"Statusline"]}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-slate-400 mt-1",children:["Customize the Claude Code terminal statusline. Sets ",t.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1 rounded text-xs",children:"statusCommand"})," in ",t.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1 rounded text-xs",children:"~/.claude/settings.json"}),"."]})]}),o!=="default"&&t.jsxs(se,{variant:"outline",size:"sm",onClick:S,disabled:m,className:"gap-1",children:[t.jsx(ec,{className:"w-3 h-3"}),"Reset"]})]}),s&&t.jsxs("div",{className:"mt-4 p-3 bg-gray-950 dark:bg-black rounded-lg font-mono text-xs text-green-400 border border-gray-800",children:[t.jsx("span",{className:"text-gray-500 select-none",children:"$ "}),s]})]}),JW.filter(y=>v[y]).map(y=>t.jsxs("div",{children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-slate-500 mb-3 px-1",children:y}),t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:v[y].map(g=>{const b=o===g.id,k=g.id==="custom";return t.jsxs("div",{onClick:()=>!k&&w(g),className:["rounded-xl border p-4 transition-all",k?"cursor-default":"cursor-pointer hover:border-indigo-400 dark:hover:border-indigo-500",b?"border-indigo-500 bg-indigo-50 dark:bg-indigo-950/40 shadow-sm":"border-gray-200 dark:border-slate-800 bg-white dark:bg-slate-950"].join(" "),children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:g.name}),b&&t.jsx(Rt,{className:"w-4 h-4 text-indigo-500 shrink-0"})]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-0.5",children:g.description})]}),k&&t.jsx(sl,{className:"w-4 h-4 text-gray-400 shrink-0 mt-0.5"})]}),!k&&t.jsx("div",{className:"mt-3 px-2 py-1.5 bg-gray-950 dark:bg-black rounded font-mono text-[11px] text-gray-300 truncate border border-gray-800",children:g.preview}),k&&t.jsxs("div",{className:"mt-3 space-y-2",onClick:N=>N.stopPropagation(),children:[t.jsx(ht,{value:d,onChange:N=>l(N.target.value),placeholder:'echo "$(git rev-parse --abbrev-ref HEAD)"',className:"font-mono text-xs h-20 resize-none bg-gray-950 dark:bg-black text-green-400 border-gray-800 placeholder:text-gray-600"}),t.jsxs(se,{size:"sm",className:"w-full",onClick:j,disabled:m||!d.trim(),children:[m?t.jsx(Qe,{className:"w-3 h-3 animate-spin mr-1"}):null,"Apply Custom"]})]})]},g.id)})})]},y)),t.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"How it works"}),t.jsxs("p",{className:"text-xs text-gray-600 dark:text-slate-400 mb-2",children:["Claude Code runs your ",t.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1 rounded",children:"statusCommand"})," shell script on each turn and displays the output in the terminal statusline. The command should be fast (under 100ms) and print a single line."]}),t.jsxs("div",{className:"space-y-1 text-xs font-mono text-gray-500 dark:text-slate-500",children:[t.jsx("p",{children:"# Edit directly:"}),t.jsx("p",{children:'~/.claude/settings.json → "statusCommand": "..."'})]})]})]})}const ZW=[{id:"projects",label:"All Projects",icon:$n,section:"Projects"},{id:"explorer",label:"Project Explorer",icon:Ji,section:"Projects"},{id:"workstreams",label:"Workstreams",icon:mC,section:"Projects"},{id:"registry",label:"MCP Registry",icon:Kn,section:"Tools"},{id:"plugins",label:"Plugins",icon:Fo,section:"Tools"},{id:"memory",label:"Memory",icon:Lo,section:"Tools"},{id:"claude-settings",label:"Claude Code",icon:Xn,section:"Configuration",tool:"claude"},{id:"gemini-settings",label:"Gemini CLI",icon:Ut,section:"Configuration",tool:"gemini"},{id:"codex-settings",label:"Codex CLI",icon:Ut,section:"Configuration",isNew:!0,tool:"codex"},{id:"antigravity-settings",label:"Antigravity",icon:Tc,section:"Configuration",tool:"antigravity"},{id:"create-mcp",label:"Create MCP",icon:Hr,section:"Developer"},{id:"loops",label:"Ralph Loops",icon:gc,section:"Developer",isNew:!0},{id:"statuslines",label:"Statusline",icon:BM,section:"System",isNew:!0},{id:"sessions",label:"Sessions",icon:bs,section:"System"},{id:"preferences",label:"Preferences",icon:pC,section:"System"},{id:"tutorial",label:"Tutorial",icon:Eu,section:"Help"},{id:"docs",label:"Docs & Help",icon:Do,section:"Help"}],j_=(e,r)=>{try{const s=localStorage.getItem(`claude-config-${e}`);return s?JSON.parse(s):r}catch{return r}},eU=(e,r)=>{try{localStorage.setItem(`claude-config-${e}`,JSON.stringify(r))}catch{}};function tU(){const{projects:e,activeProject:r,fetch:s,setActive:n}=Rx(),{appConfig:o,version:c,fetch:d,checkVersion:l}=Mw(),[u,f]=_.useState(()=>j_("currentView","explorer")),[m,h]=_.useState(!0),[x,w]=_.useState({dir:"",subprojects:[],hierarchy:[]}),[j,S]=_.useState([]),[v,y]=_.useState({mcpServers:{}}),[g,b]=_.useState([]),[k,N]=_.useState([]),[P,A]=_.useState(null),[E,M]=_.useState(null),[D,O]=_.useState(!1),[z,U]=_.useState({title:"",type:""}),[J,W]=_.useState(""),[$,Y]=_.useState(""),K=_.useRef({}),[L,T]=_.useState(null),[B,G]=_.useState(!1),[F,re]=_.useState(!1),[de,ue]=_.useState(null),[X,H]=_.useState(!1),oe=_.useRef(null);_.useEffect(()=>{eU("currentView",u)},[u]);const ie=_.useCallback(async()=>{try{const[pe,be,De,fe,Se]=await Promise.all([me.getProject(),me.getConfigs(),me.getRegistry(),me.getRules(),me.getCommands()]);w(pe),S(be),y(De),b(fe),N(Se),be.length>0&&!P&&A(be[be.length-1])}catch(pe){q.error("Failed to load data: "+pe.message)}finally{h(!1)}},[P]),Z=_.useCallback(async(pe=!1)=>{try{const be=await s(),De=be==null?void 0:be.find(fe=>fe.isActive);if(pe&&De){const fe=await me.getSubprojects(De.path);ue({dir:De.path,subprojects:fe.subprojects||[]})}pe&&!De&&(j_("currentView",null)||f("projects"))}catch{console.log("Projects API not available")}},[s]),le=async pe=>{try{const be=await n(pe);be.success?(w({dir:be.dir,hierarchy:be.hierarchy,subprojects:be.subprojects}),ue({dir:be.dir,subprojects:be.subprojects}),await ie(),q.success(`Switched to ${be.project.name}`)):q.error(be.error||"Failed to switch project")}catch(be){q.error("Failed to switch project: "+be.message)}},ee=()=>{s()};_.useEffect(()=>{ie(),Z(!0),(async()=>{try{const[be]=await Promise.all([l(),d()]);!oe.current&&(be!=null&&be.installedVersion)&&(oe.current=be.installedVersion);const De=Mw.getState().appConfig;if(be!=null&&be.updateAvailable&&(be==null?void 0:be.updateMethod)==="npm")if(De!=null&&De.autoUpdate){q.info(`Auto-updating to v${be.latestVersion}...`),G(!0);const fe=await me.performUpdate({updateMethod:be.updateMethod,targetVersion:be.latestVersion,channel:be.channel});if(fe.success){q.success(`Updated to v${fe.newVersion}! Restarting server...`);try{await me.restartServer()}catch{}let Se=0;const Te=setInterval(async()=>{Se++;try{await me.checkVersion(),clearInterval(Te),q.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{Se>30&&(clearInterval(Te),q.info("Server restarting. Please refresh the page."),G(!1))}},500)}else q.error("Auto-update failed: "+fe.error),G(!1),T(be)}else T(be)}catch{}})()},[]),_.useEffect(()=>{const be=setInterval(async()=>{if(oe.current)try{const De=await me.checkVersion();De!=null&&De.installedVersion&&De.installedVersion!==oe.current&&(console.log(`[stale-ui] Server updated to v${De.installedVersion}, refreshing...`),window.location.reload())}catch{}},3e4);return()=>clearInterval(be)},[]);const _e=(pe,be)=>{if(!pe||!be)return!1;const De=Te=>Te.split(".").map(He=>parseInt(He,10)||0),fe=De(pe),Se=De(be);for(let Te=0;Te<Math.max(fe.length,Se.length);Te++){if((fe[Te]||0)>(Se[Te]||0))return!0;if((fe[Te]||0)<(Se[Te]||0))return!1}return!1},Fe=async(pe,be="npm",De)=>{G(!0);const fe=await me.performUpdate({updateMethod:be,targetVersion:pe,channel:De});if(fe.success){q.success(`Updated to v${fe.newVersion}! Restarting server...`),T(null);try{await me.restartServer()}catch{}let Se=0;const Te=setInterval(async()=>{Se++;try{await me.checkVersion(),clearInterval(Te),q.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{Se>30&&(clearInterval(Te),q.info("Server restarting. Please refresh the page."),G(!1))}},500);return!0}else return q.error("Update failed: "+fe.error),G(!1),!1},he=async()=>{H(!0);try{const pe=await me.checkVersion(),be=pe==null?void 0:pe.installedVersion,De=pe==null?void 0:pe.latestVersion;if(be&&oe.current&&be!==oe.current){q.info(`Refreshing to v${be}...`),setTimeout(()=>window.location.reload(),500);return}_e(De,be)&&(o!=null&&o.autoUpdate?(H(!1),q.info(`Auto-updating to v${De}...`),await Fe(De,(pe==null?void 0:pe.updateMethod)||"npm",pe==null?void 0:pe.channel)):(T({...pe,updateAvailable:!0}),q.info(`Update available: v${De}`)))}catch{q.error("Failed to check for updates")}finally{H(!1)}},we=async()=>{if(L!=null&&L.updateAvailable){G(!0);try{const pe=await me.performUpdate({updateMethod:L.updateMethod,sourcePath:L.sourcePath,targetVersion:L.latestVersion,channel:L.channel});if(pe.success){q.success(`Updated to v${pe.newVersion}! Restarting server...`),T(null),setVersion(pe.newVersion);try{await me.restartServer()}catch{}let be=0;const De=setInterval(async()=>{be++;try{await me.checkVersion(),clearInterval(De),q.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{be>30&&(clearInterval(De),q.info("Server restarting. Please refresh the page."),G(!1))}},500)}else q.error("Update failed: "+pe.error),G(!1)}catch(pe){q.error("Update failed: "+pe.message),G(!1)}}};_.useEffect(()=>{const pe=async()=>{try{const{hashes:De}=await me.getFileHashes(),fe=K.current,Se=Object.keys(De).some(He=>fe[He]!==De[He])||Object.keys(fe).some(He=>!De[He]),Te=fe.__subprojects__!==De.__subprojects__;if(Se&&Object.keys(fe).length>0&&(await ie(),Te&&de))try{const He=await me.getSubprojects(de.dir);ue(Ye=>({...Ye,subprojects:He.subprojects||[]}))}catch{}K.current=De}catch{}},be=setInterval(pe,2e3);return pe(),()=>clearInterval(be)},[ie,de]);const Oe=new Set;j.forEach(pe=>{var be,De;(((be=pe.config)==null?void 0:be.include)||[]).forEach(fe=>Oe.add(fe)),Object.keys(((De=pe.config)==null?void 0:De.mcpServers)||{}).forEach(fe=>Oe.add(fe))});const $e={mcps:Oe.size,rules:g.length,commands:k.length},Ke=async()=>{try{const pe=await me.applyConfig(x.dir);if(pe.tools){const be=Object.entries(pe.tools).filter(([,De])=>De).map(([De])=>De==="claude"?"Claude Code":"Antigravity");be.length>0?q.success(`Config applied to: ${be.join(", ")}`):q.warning("No tools were updated")}else q.success("Configuration applied successfully!")}catch(pe){q.error("Failed to apply config: "+pe.message)}},xt=async()=>{h(!0),await ie(),q.success("Data refreshed")};if(m)return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-4",children:[t.jsx(Qe,{className:"w-8 h-8 animate-spin text-primary"}),t.jsx("p",{className:"text-muted-foreground",children:"Loading configuration..."})]})});const Ce=()=>{switch(u){case"explorer":return t.jsx(A8,{project:x,onRefresh:ie});case"registry":return t.jsx(YH,{registry:v,searchQuery:J,setSearchQuery:W,onUpdate:ie});case"plugins":return t.jsx(SW,{});case"memory":return t.jsx(JH,{project:x,onUpdate:ie});case"create-mcp":return t.jsx(jH,{project:x});case"claude-settings":return t.jsx(uH,{});case"gemini-settings":return t.jsx(hH,{});case"codex-settings":return t.jsx(CH,{});case"antigravity-settings":return t.jsx(xH,{});case"statuslines":return t.jsx(QW,{});case"sessions":return t.jsx(YW,{});case"preferences":return t.jsx(dH,{onConfigChange:()=>d()});case"projects":return t.jsx(tW,{onProjectSwitch:pe=>{w({dir:pe.dir,hierarchy:pe.hierarchy,subprojects:pe.subprojects}),ue({dir:pe.dir,subprojects:pe.subprojects}),ie(),Z()}});case"workstreams":return t.jsx(CW,{onWorkstreamChange:pe=>{q.success(`Switched to workstream: ${pe.name}`)}});case"loops":return t.jsx(kW,{activeProject:r});case"docs":return t.jsx(wW,{});case"tutorial":return t.jsx(KW,{});default:return null}};return t.jsxs("div",{className:"min-h-screen bg-background",children:[t.jsx("header",{className:"h-16 bg-card border-b border-border sticky top-0 z-50 shadow-sm",children:t.jsxs("div",{className:"h-full px-6 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.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:t.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 128 128",children:[t.jsx("circle",{cx:"64",cy:"64",r:"52",fill:"none",stroke:"white",strokeWidth:"10",strokeDasharray:"24 12"}),t.jsx("circle",{cx:"64",cy:"64",r:"28",fill:"white"}),t.jsx("circle",{cx:"64",cy:"64",r:"12",fill:"#7c3aed"})]})}),t.jsx("div",{children:t.jsxs("h1",{className:"text-xl font-bold text-foreground",children:["Coder ",t.jsx("span",{className:"text-primary",children:"Config"})]})}),L&&t.jsxs("button",{onClick:we,disabled:B,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:[B?t.jsx(Qe,{className:"w-3 h-3 animate-spin"}):t.jsx(xi,{className:"w-3 h-3"}),B?"Updating...":`Update to v${L.latestVersion}`]})]}),t.jsx(jN,{orientation:"vertical",className:"h-6"}),t.jsx(T8,{projects:e,activeProject:r,onSwitch:le,onAddClick:()=>re(!0),onManageClick:()=>f("projects")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(D8,{}),t.jsx(se,{variant:"ghost",size:"sm",onClick:xt,children:t.jsx(Mr,{className:"w-4 h-4"})}),t.jsxs(se,{onClick:Ke,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:[t.jsx(Tc,{className:"w-4 h-4"}),"Re-apply"]})]})]})}),t.jsxs("div",{className:"flex",children:[t.jsxs("aside",{className:"w-64 h-[calc(100vh-64px)] border-r border-border bg-card sticky top-16 flex flex-col",children:[t.jsx(Js,{className:"flex-1 py-4",children:["Projects","Tools","Configuration","Developer","System","Help"].map(pe=>t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:"px-4 mb-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:pe}),t.jsx("div",{className:"space-y-0.5",children:ZW.filter(be=>be.section===pe).filter(be=>{var De;return be.id!=="loops"||((De=o==null?void 0:o.experimental)==null?void 0:De.ralphLoops)}).filter(be=>!be.tool||((o==null?void 0:o.enabledTools)||["claude"]).includes(be.tool)).map(be=>{const De=be.icon,fe=u===be.id;return t.jsxs("button",{onClick:()=>f(be.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-all duration-200 border-l-2 ${fe?"bg-accent border-primary text-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:[t.jsx(De,{className:"w-4 h-4"}),t.jsx("span",{className:"flex-1 text-left",children:be.label}),be.badge&&t.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${fe?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:$e[be.badge]}),be.isNew&&t.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"})]},be.id)})})]},pe))}),t.jsx("div",{className:"px-4 py-3 border-t border-border",children:t.jsxs("button",{onClick:he,disabled:X,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",title:"Check for updates",children:[X?t.jsx(Qe,{className:"w-3 h-3 animate-spin"}):null,c?`v${c}`:""]})})]}),t.jsx("main",{style:["explorer","docs","tutorial"].includes(u)?{}:{zoom:.9},className:Ne("flex-1 overflow-auto",["explorer","docs","tutorial"].includes(u)?"h-[calc(100vh-64px)]":"p-6"),children:t.jsx(T_,{mode:"wait",children:t.jsx(Oa.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:["explorer","docs","tutorial"].includes(u)?"h-full":"",children:Ce()},u)})})]}),t.jsx(_N,{open:F,onOpenChange:re,onAdded:ee}),t.jsx(R8,{onStartTutorial:()=>f("tutorial")})]})}function rU(){const[e,r]=_.useState(!1),[s,n]=_.useState(!1),[o,c]=_.useState(!1),d=_.useCallback(async()=>{n(!0);try{await me.restartServer(),q.info("Server restarting... page will reload."),setTimeout(()=>{window.location.reload()},2e3)}catch(u){q.error("Failed to restart: "+u.message),n(!1)}},[]),l=_.useCallback(()=>{c(!0),r(!1),q.dismiss("update-available")},[]);return _.useEffect(()=>{let u;const f=async()=>{try{const m=await me.getVersion();console.log("[Update Check]",m),m.needsRestart&&!o&&r(!0)}catch{}};return f(),u=setInterval(f,3e4),()=>clearInterval(u)},[o]),t.jsx(M8,{children:t.jsxs("div",{className:"min-h-screen bg-background",children:[e&&!s&&t.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:d,children:[t.jsx(Mr,{className:"w-4 h-4"}),t.jsx("span",{className:"text-sm font-medium",children:"Update available — click to restart"}),t.jsx("button",{onClick:u=>{u.stopPropagation(),l()},className:"absolute right-3 p-1 hover:bg-blue-500 rounded",children:t.jsx(fi,{className:"w-4 h-4"})})]}),s&&t.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:[t.jsx(Mr,{className:"w-4 h-4 animate-spin"}),t.jsx("span",{className:"text-sm font-medium",children:"Restarting server..."})]}),t.jsx(tU,{}),t.jsx(WP,{position:"bottom-right",richColors:!0})]})})}gP.createRoot(document.getElementById("root")).render(t.jsx(rU,{}));
3725
+ `}},qW={...LW,...OW,...FW,...BW,...$W,...zW,...HW,...WW,...UW,...VW,...GW},uu={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"}},k_="claude-config-tutorial-visited",tp="claude-config-tutorial-active";function KW(){const[e,r]=_.useState(()=>{try{return localStorage.getItem(tp)||"intro"}catch{return"intro"}}),[s,n]=_.useState(()=>{try{const b=localStorage.getItem(tp)||"intro",k={welcome:!0};for(const N of Ta)N.subsections.some(P=>P.id===b)&&(k[N.id]=!0);return k}catch{return{welcome:!0}}}),[o,c]=_.useState(()=>{try{return JSON.parse(localStorage.getItem(k_)||"[]")}catch{return[]}}),d=_.useRef(null);_.useEffect(()=>{if(d.current){const b=d.current.querySelector("[data-radix-scroll-area-viewport]");b&&(b.scrollTop=0)}},[e]),_.useEffect(()=>{if(e&&(localStorage.setItem(tp,e),!o.includes(e))){const b=[...o,e];c(b),localStorage.setItem(k_,JSON.stringify(b))}},[e,o]);const l=b=>{n(k=>({...k,[b]:!k[b]}))},u=qW[e],f=Ta.flatMap(b=>b.subsections.length>0?b.subsections.map(k=>k.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),S=(()=>{for(const b of Ta)if(b.id===e||b.subsections.some(k=>k.id===e))return b;return Ta[0]})(),v=uu[S.id]||uu.welcome,y=b=>{for(const k of Ta){if(k.id===b)return k.title;const N=k.subsections.find(P=>P.id===b);if(N)return N.title}return""},g=b=>({__html:j2(b)});return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:"w-72 border-r border-border bg-muted/30 flex flex-col",children:[t.jsxs("div",{className:"p-4 border-b border-border bg-gradient-to-r from-indigo-500/10 to-purple-500/10",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.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:t.jsx(Eu,{className:"w-5 h-5 text-white"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"font-semibold text-foreground",children:"Tutorial"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Step-by-step guide"})]})]}),t.jsxs("div",{className:"mt-3",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1",children:[t.jsx("span",{children:"Progress"}),t.jsxs("span",{children:[w,"% complete"]})]}),t.jsx(M2,{value:w,className:"h-2"})]})]}),t.jsx(Js,{className:"flex-1",children:t.jsx("div",{className:"p-2",children:Ta.map((b,k)=>{const N=b.icon,P=uu[b.id]||uu.welcome,A=e===b.id||b.subsections.some(M=>M.id===e),E=b.subsections.length>0?b.subsections.every(M=>o.includes(M.id)):o.includes(b.id);return t.jsxs("div",{className:"mb-1",children:[t.jsxs("button",{className:Ne("w-full flex items-center gap-2 px-3 py-2.5 text-sm rounded-lg hover:bg-accent text-left transition-all",A&&"bg-accent"),onClick:()=>{b.subsections.length>0?(l(b.id),s[b.id]||r(b.subsections[0].id)):r(b.id)},children:[t.jsx("span",{className:Ne("w-7 h-7 rounded-lg flex items-center justify-center transition-colors",A?P.bg+" text-white":P.light),children:E?t.jsx(Oo,{className:"w-4 h-4"}):t.jsx(N,{className:Ne("w-4 h-4",!A&&P.text)})}),t.jsx("span",{className:Ne("flex-1",A&&"font-medium"),children:b.title}),b.subsections.length>0&&t.jsx(vs,{className:Ne("w-4 h-4 text-muted-foreground transition-transform",s[b.id]&&"rotate-90")})]}),b.subsections.length>0&&s[b.id]&&t.jsx("div",{className:"ml-4 mt-1 space-y-0.5 border-l-2 border-border pl-3",children:b.subsections.map(M=>{const D=e===M.id,O=o.includes(M.id);return t.jsxs("button",{className:Ne("w-full text-left px-3 py-1.5 text-sm rounded-md hover:bg-accent text-foreground flex items-center gap-2",D&&"bg-accent font-medium",D&&P.text),onClick:()=>r(M.id),children:[O&&!D&&t.jsx(Oo,{className:"w-3 h-3 text-green-500"}),t.jsx("span",{className:Ne(!O&&!D&&"ml-5"),children:M.title})]},M.id)})})]},b.id)})})})]}),t.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[t.jsx("div",{className:Ne("px-8 py-4 border-b border-border",v.light),children:t.jsxs("div",{className:"max-w-3xl mx-auto flex items-center gap-3",children:[t.jsx("div",{className:Ne("w-10 h-10 rounded-xl flex items-center justify-center",v.bg,"text-white"),children:t.jsx(S.icon,{className:"w-5 h-5"})}),t.jsxs("div",{children:[t.jsx("p",{className:Ne("text-sm font-medium",v.text),children:S.title}),t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:(u==null?void 0:u.title)||y(e)})]})]})}),t.jsx(Js,{className:"flex-1",ref:d,children:t.jsx("div",{className:"max-w-3xl mx-auto p-8",children:u?t.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 [&_:not(pre)>code]:text-primary [&_:not(pre)>code]:bg-muted [&_:not(pre)>code]:px-1 [&_:not(pre)>code]:py-0.5 [&_:not(pre)>code]:rounded [&_pre]:bg-zinc-900 [&_pre]:text-zinc-100 [&_pre]:border [&_pre]:border-zinc-700 [&_pre_code]:text-zinc-100 [&_pre_code]:bg-transparent [&_pre_code]:p-0",dangerouslySetInnerHTML:g(u.content)}):t.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[t.jsx(Eu,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),t.jsx("p",{children:"Select a topic from the sidebar"})]})})}),t.jsx("div",{className:"border-t border-border p-4 bg-muted/30",children:t.jsxs("div",{className:"max-w-3xl mx-auto flex items-center justify-between",children:[h?t.jsxs(se,{variant:"ghost",onClick:()=>r(h),className:"flex items-center gap-2",children:[t.jsx(M5,{className:"w-4 h-4"}),t.jsx("span",{className:"max-w-[150px] truncate",children:y(h)})]}):t.jsx("div",{}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[m+1," of ",f.length]}),x?t.jsxs(se,{onClick:()=>r(x),className:Ne("flex items-center gap-2",v.bg,"hover:opacity-90"),children:[t.jsx("span",{className:"max-w-[150px] truncate",children:y(x)}),t.jsx(Rg,{className:"w-4 h-4"})]}):t.jsx(se,{variant:"outline",onClick:()=>r("intro"),className:"flex items-center gap-2",children:"Start Over"})]})})]})]})}function YW(){const[e,r]=_.useState(null),[s,n]=_.useState(!0),[o,c]=_.useState(!1),[d,l]=_.useState(!1),[u,f]=_.useState(!1),[m,h]=_.useState(null);_.useEffect(()=>{x()},[]);const x=async()=>{try{n(!0);const k=await me.getSessionStatus();r(k)}catch{q.error("Failed to load session status")}finally{n(!1)}},w=async()=>{var k,N;c(!0);try{const P=await me.installSessionAll();P.success?(q.success("Session persistence installed!"),x()):q.error(((k=P.hooks)==null?void 0:k.error)||((N=P.command)==null?void 0:N.error)||"Installation failed")}catch{q.error("Installation failed")}finally{c(!1)}},j=async()=>{c(!0);try{const k=await me.installSessionHooks();k.success?(q.success("Session hooks installed!"),x()):q.error(k.error||"Failed to install hooks")}catch{q.error("Failed to install hooks")}finally{c(!1)}},S=async()=>{c(!0);try{const k=await me.installFlushCommand();k.success?(q.success(k.alreadyInstalled?"/flush command already installed":"/flush command installed!"),x()):q.error(k.error||"Failed to install command")}catch{q.error("Failed to install command")}finally{c(!1)}},v=async()=>{l(!0);try{const k=await me.clearSessionContext();k.success?(q.success(k.cleared?"Session context cleared":"No context to clear"),x()):q.error("Failed to clear context")}catch{q.error("Failed to clear context")}finally{l(!1)}},y=async()=>{try{const k=await me.getSessionContext();h(k.content),f(!0)}catch{q.error("Failed to load context")}},g=k=>k===null?"Unknown":k<60?`${k} minutes ago`:k<1440?`${Math.floor(k/60)} hours ago`:`${Math.floor(k/1440)} days ago`;if(s)return t.jsx("div",{className:"flex items-center justify-center h-64",children:t.jsx(Qe,{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 t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-5 shadow-sm",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"p-2 rounded-lg bg-indigo-100 dark:bg-indigo-950",children:t.jsx(bs,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Session Persistence"}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Save and restore Claude Code session context"})]})]}),t.jsx(se,{variant:"ghost",size:"sm",onClick:x,children:t.jsx(Mr,{className:"w-4 h-4"})})]}),t.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 ",t.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."]})]}),t.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[t.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:t.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Installation Status"})}),t.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:[t.jsxs("div",{className:"p-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.hooksInstalled?t.jsx(Rt,{className:"w-5 h-5 text-green-500"}):t.jsx(Is,{className:"w-5 h-5 text-amber-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Session Hooks"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Auto-restore context on session start, preserve on session end"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(tt,{variant:e!=null&&e.hooksInstalled?"default":"secondary",children:e!=null&&e.hooksInstalled?"Installed":"Not Installed"}),!(e!=null&&e.hooksInstalled)&&t.jsx(se,{variant:"outline",size:"sm",onClick:j,disabled:o,children:o?t.jsx(Qe,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),t.jsxs("div",{className:"p-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.flushCommandInstalled?t.jsx(Rt,{className:"w-5 h-5 text-green-500"}):t.jsx(Is,{className:"w-5 h-5 text-amber-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"/flush Command"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Adds the /flush command to save session context"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(tt,{variant:e!=null&&e.flushCommandInstalled?"default":"secondary",children:e!=null&&e.flushCommandInstalled?"Installed":"Not Installed"}),!(e!=null&&e.flushCommandInstalled)&&t.jsx(se,{variant:"outline",size:"sm",onClick:S,disabled:o,children:o?t.jsx(Qe,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),t.jsxs("div",{className:"p-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.permissionInstalled?t.jsx(Rt,{className:"w-5 h-5 text-green-500"}):t.jsx(Is,{className:"w-5 h-5 text-amber-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Write Permission"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Allows Claude to write session context without prompting"})]})]}),t.jsx(tt,{variant:e!=null&&e.permissionInstalled?"default":"secondary",children:e!=null&&e.permissionInstalled?"Granted":"Not Granted"})]})]}),!b&&t.jsx("div",{className:"p-4 bg-gray-50 dark:bg-slate-900 border-t border-gray-200 dark:border-slate-800",children:t.jsxs(se,{onClick:w,disabled:o,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white",children:[o?t.jsx(Qe,{className:"w-4 h-4 mr-2 animate-spin"}):t.jsx(xi,{className:"w-4 h-4 mr-2"}),"Install All"]})})]}),t.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[t.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700 flex items-center justify-between",children:[t.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Saved Context"}),(e==null?void 0:e.hasSavedContext)&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(se,{variant:"outline",size:"sm",onClick:y,children:[t.jsx(zr,{className:"w-4 h-4 mr-2"}),"View"]}),t.jsx(se,{variant:"outline",size:"sm",onClick:v,disabled:d,className:"text-red-600 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950",children:d?t.jsx(Qe,{className:"w-4 h-4 animate-spin"}):t.jsx(ws,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"p-4",children:e!=null&&e.hasSavedContext?t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx(ac,{className:"w-4 h-4 text-gray-400"}),t.jsx("span",{className:"text-gray-600 dark:text-slate-400",children:"Last saved:"}),t.jsx("span",{className:"text-gray-900 dark:text-white",children:g(e.contextAge)})]}),e.contextPreview&&t.jsx("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:t.jsx("pre",{className:"text-xs text-gray-600 dark:text-slate-400 whitespace-pre-wrap overflow-hidden",children:e.contextPreview})}),t.jsxs("div",{className:"text-xs text-gray-500 dark:text-slate-500",children:["Storage: ",e.sessionDir]})]}):t.jsxs("div",{className:"text-center py-6",children:[t.jsx(bs,{className:"w-12 h-12 text-gray-300 dark:text-slate-600 mx-auto mb-3"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:"No saved context"}),t.jsxs("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-1",children:["Use ",t.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)&&t.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[t.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:t.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Last Session"})}),t.jsxs("div",{className:"p-4 space-y-2",children:[e.lastSession.session_id&&t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"ID:"}),t.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&&t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Directory:"}),t.jsx("span",{className:"text-gray-900 dark:text-white font-mono text-xs",children:e.lastSession.cwd})]}),e.lastSession.timestamp&&t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Ended:"}),t.jsx("span",{className:"text-gray-900 dark:text-white",children:e.lastSession.timestamp})]}),e.lastSession.reason&&t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Reason:"}),t.jsx(tt,{variant:"secondary",children:e.lastSession.reason})]})]})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"How to Use"}),t.jsxs("ol",{className:"space-y-2 text-sm text-gray-600 dark:text-slate-400",children:[t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"1."}),"Install session hooks and the /flush command above"]}),t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"2."}),"Use ",t.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"]}),t.jsxs("li",{className:"flex gap-2",children:[t.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"]})]})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),t.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[t.jsx("p",{children:"coder-config session # Show session status"}),t.jsx("p",{children:"coder-config session install-hooks # Install session hooks"}),t.jsx("p",{children:"coder-config session clear # Clear saved context"})]})]}),t.jsx(bt,{open:u,onOpenChange:f,children:t.jsxs(ft,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[t.jsxs(mt,{children:[t.jsx(pt,{children:"Saved Context"}),t.jsx(rr,{children:"This context will be restored on your next Claude Code session"})]}),t.jsx("div",{className:"flex-1 overflow-auto py-4",children:t.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"})}),t.jsx(kt,{children:t.jsx(se,{variant:"ghost",onClick:()=>f(!1),children:"Close"})})]})})]})}const JW=["Built-in","Minimal","Git","Combo","System","Custom"];function XW(e){const r={};for(const s of e)r[s.category]||(r[s.category]=[]),r[s.category].push(s);return r}function QW(){const[e,r]=_.useState([]),[s,n]=_.useState(""),[o,c]=_.useState("default"),[d,l]=_.useState(""),[u,f]=_.useState(!0),[m,h]=_.useState(!1);_.useEffect(()=>{x()},[]);const x=async()=>{try{f(!0);const[y,g]=await Promise.all([me.getStatuslinePresets(),me.getCurrentStatusline()]);r(y.presets||[]),n(g.command||""),c(g.presetId||"default"),g.presetId==="custom"&&l(g.command||"")}catch(y){q.error("Failed to load statuslines: "+y.message)}finally{f(!1)}},w=async y=>{if(y.command===null){c("custom");return}h(!0);try{await me.setStatusline(y.command),n(y.command),c(y.id),q.success(`Statusline set to "${y.name}"`)}catch(g){q.error("Failed to apply statusline: "+g.message)}finally{h(!1)}},j=async()=>{h(!0);try{await me.setStatusline(d),n(d),c("custom"),q.success("Custom statusline applied")}catch(y){q.error("Failed to apply statusline: "+y.message)}finally{h(!1)}},S=async()=>{h(!0);try{await me.setStatusline(""),n(""),c("default"),q.success("Statusline reset to Claude Code default")}catch(y){q.error("Failed to reset statusline: "+y.message)}finally{h(!1)}};if(u)return t.jsx("div",{className:"flex items-center justify-center h-64",children:t.jsx(Qe,{className:"w-8 h-8 animate-spin text-indigo-600"})});const v=XW(e);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[t.jsx(Ut,{className:"w-5 h-5 text-indigo-500"}),"Statusline"]}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-slate-400 mt-1",children:["Customize the Claude Code terminal statusline. Sets ",t.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1 rounded text-xs",children:"statusCommand"})," in ",t.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1 rounded text-xs",children:"~/.claude/settings.json"}),"."]})]}),o!=="default"&&t.jsxs(se,{variant:"outline",size:"sm",onClick:S,disabled:m,className:"gap-1",children:[t.jsx(ec,{className:"w-3 h-3"}),"Reset"]})]}),t.jsxs("div",{className:"mt-4 flex items-start gap-2 text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg px-3 py-2",children:[t.jsx("span",{className:"shrink-0 mt-0.5",children:"⚡"}),t.jsxs("span",{children:["Changes apply to new Claude Code sessions. Start a new ",t.jsx("code",{className:"font-mono",children:"claude"})," session to see the updated statusline."]})]}),s&&t.jsxs("div",{className:"mt-3 p-3 bg-gray-950 dark:bg-black rounded-lg font-mono text-xs text-green-400 border border-gray-800",children:[t.jsx("span",{className:"text-gray-500 select-none",children:"$ "}),s]})]}),JW.filter(y=>v[y]).map(y=>t.jsxs("div",{children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-slate-500 mb-3 px-1",children:y}),t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:v[y].map(g=>{const b=o===g.id,k=g.id==="custom";return t.jsxs("div",{onClick:()=>!k&&w(g),className:["rounded-xl border p-4 transition-all",k?"cursor-default":"cursor-pointer hover:border-indigo-400 dark:hover:border-indigo-500",b?"border-indigo-500 bg-indigo-50 dark:bg-indigo-950/40 shadow-sm":"border-gray-200 dark:border-slate-800 bg-white dark:bg-slate-950"].join(" "),children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:g.name}),b&&t.jsx(Rt,{className:"w-4 h-4 text-indigo-500 shrink-0"})]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-0.5",children:g.description})]}),k&&t.jsx(sl,{className:"w-4 h-4 text-gray-400 shrink-0 mt-0.5"})]}),!k&&t.jsx("div",{className:"mt-3 px-2 py-1.5 bg-gray-950 dark:bg-black rounded font-mono text-[11px] text-gray-300 truncate border border-gray-800",children:g.preview}),k&&t.jsxs("div",{className:"mt-3 space-y-2",onClick:N=>N.stopPropagation(),children:[t.jsx(ht,{value:d,onChange:N=>l(N.target.value),placeholder:'echo "$(git rev-parse --abbrev-ref HEAD)"',className:"font-mono text-xs h-20 resize-none bg-gray-950 dark:bg-black text-green-400 border-gray-800 placeholder:text-gray-600"}),t.jsxs(se,{size:"sm",className:"w-full",onClick:j,disabled:m||!d.trim(),children:[m?t.jsx(Qe,{className:"w-3 h-3 animate-spin mr-1"}):null,"Apply Custom"]})]})]},g.id)})})]},y)),t.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"How it works"}),t.jsxs("p",{className:"text-xs text-gray-600 dark:text-slate-400 mb-2",children:["Claude Code runs your ",t.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1 rounded",children:"statusCommand"})," shell script on each turn and displays the output in the terminal statusline. The command should be fast (under 100ms) and print a single line."]}),t.jsxs("div",{className:"space-y-1 text-xs font-mono text-gray-500 dark:text-slate-500",children:[t.jsx("p",{children:"# Edit directly:"}),t.jsx("p",{children:'~/.claude/settings.json → "statusCommand": "..."'})]})]})]})}const ZW=[{id:"projects",label:"All Projects",icon:$n,section:"Projects"},{id:"explorer",label:"Project Explorer",icon:Ji,section:"Projects"},{id:"workstreams",label:"Workstreams",icon:mC,section:"Projects"},{id:"registry",label:"MCP Registry",icon:Kn,section:"Tools"},{id:"plugins",label:"Plugins",icon:Fo,section:"Tools"},{id:"memory",label:"Memory",icon:Lo,section:"Tools"},{id:"claude-settings",label:"Claude Code",icon:Xn,section:"Configuration",tool:"claude"},{id:"gemini-settings",label:"Gemini CLI",icon:Ut,section:"Configuration",tool:"gemini"},{id:"codex-settings",label:"Codex CLI",icon:Ut,section:"Configuration",isNew:!0,tool:"codex"},{id:"antigravity-settings",label:"Antigravity",icon:Tc,section:"Configuration",tool:"antigravity"},{id:"create-mcp",label:"Create MCP",icon:Hr,section:"Developer"},{id:"loops",label:"Ralph Loops",icon:gc,section:"Developer",isNew:!0},{id:"statuslines",label:"Statusline",icon:BM,section:"System",isNew:!0},{id:"sessions",label:"Sessions",icon:bs,section:"System"},{id:"preferences",label:"Preferences",icon:pC,section:"System"},{id:"tutorial",label:"Tutorial",icon:Eu,section:"Help"},{id:"docs",label:"Docs & Help",icon:Do,section:"Help"}],j_=(e,r)=>{try{const s=localStorage.getItem(`claude-config-${e}`);return s?JSON.parse(s):r}catch{return r}},eU=(e,r)=>{try{localStorage.setItem(`claude-config-${e}`,JSON.stringify(r))}catch{}};function tU(){const{projects:e,activeProject:r,fetch:s,setActive:n}=Rx(),{appConfig:o,version:c,fetch:d,checkVersion:l}=Mw(),[u,f]=_.useState(()=>j_("currentView","explorer")),[m,h]=_.useState(!0),[x,w]=_.useState({dir:"",subprojects:[],hierarchy:[]}),[j,S]=_.useState([]),[v,y]=_.useState({mcpServers:{}}),[g,b]=_.useState([]),[k,N]=_.useState([]),[P,A]=_.useState(null),[E,M]=_.useState(null),[D,O]=_.useState(!1),[z,U]=_.useState({title:"",type:""}),[J,W]=_.useState(""),[$,Y]=_.useState(""),K=_.useRef({}),[L,T]=_.useState(null),[B,G]=_.useState(!1),[F,re]=_.useState(!1),[de,ue]=_.useState(null),[X,H]=_.useState(!1),oe=_.useRef(null);_.useEffect(()=>{eU("currentView",u)},[u]);const ie=_.useCallback(async()=>{try{const[pe,be,De,fe,Se]=await Promise.all([me.getProject(),me.getConfigs(),me.getRegistry(),me.getRules(),me.getCommands()]);w(pe),S(be),y(De),b(fe),N(Se),be.length>0&&!P&&A(be[be.length-1])}catch(pe){q.error("Failed to load data: "+pe.message)}finally{h(!1)}},[P]),Z=_.useCallback(async(pe=!1)=>{try{const be=await s(),De=be==null?void 0:be.find(fe=>fe.isActive);if(pe&&De){const fe=await me.getSubprojects(De.path);ue({dir:De.path,subprojects:fe.subprojects||[]})}pe&&!De&&(j_("currentView",null)||f("projects"))}catch{console.log("Projects API not available")}},[s]),le=async pe=>{try{const be=await n(pe);be.success?(w({dir:be.dir,hierarchy:be.hierarchy,subprojects:be.subprojects}),ue({dir:be.dir,subprojects:be.subprojects}),await ie(),q.success(`Switched to ${be.project.name}`)):q.error(be.error||"Failed to switch project")}catch(be){q.error("Failed to switch project: "+be.message)}},ee=()=>{s()};_.useEffect(()=>{ie(),Z(!0),(async()=>{try{const[be]=await Promise.all([l(),d()]);!oe.current&&(be!=null&&be.installedVersion)&&(oe.current=be.installedVersion);const De=Mw.getState().appConfig;if(be!=null&&be.updateAvailable&&(be==null?void 0:be.updateMethod)==="npm")if(De!=null&&De.autoUpdate){q.info(`Auto-updating to v${be.latestVersion}...`),G(!0);const fe=await me.performUpdate({updateMethod:be.updateMethod,targetVersion:be.latestVersion,channel:be.channel});if(fe.success){q.success(`Updated to v${fe.newVersion}! Restarting server...`);try{await me.restartServer()}catch{}let Se=0;const Te=setInterval(async()=>{Se++;try{await me.checkVersion(),clearInterval(Te),q.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{Se>30&&(clearInterval(Te),q.info("Server restarting. Please refresh the page."),G(!1))}},500)}else q.error("Auto-update failed: "+fe.error),G(!1),T(be)}else T(be)}catch{}})()},[]),_.useEffect(()=>{const be=setInterval(async()=>{if(oe.current)try{const De=await me.checkVersion();De!=null&&De.installedVersion&&De.installedVersion!==oe.current&&(console.log(`[stale-ui] Server updated to v${De.installedVersion}, refreshing...`),window.location.reload())}catch{}},3e4);return()=>clearInterval(be)},[]);const _e=(pe,be)=>{if(!pe||!be)return!1;const De=Te=>Te.split(".").map(He=>parseInt(He,10)||0),fe=De(pe),Se=De(be);for(let Te=0;Te<Math.max(fe.length,Se.length);Te++){if((fe[Te]||0)>(Se[Te]||0))return!0;if((fe[Te]||0)<(Se[Te]||0))return!1}return!1},Fe=async(pe,be="npm",De)=>{G(!0);const fe=await me.performUpdate({updateMethod:be,targetVersion:pe,channel:De});if(fe.success){q.success(`Updated to v${fe.newVersion}! Restarting server...`),T(null);try{await me.restartServer()}catch{}let Se=0;const Te=setInterval(async()=>{Se++;try{await me.checkVersion(),clearInterval(Te),q.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{Se>30&&(clearInterval(Te),q.info("Server restarting. Please refresh the page."),G(!1))}},500);return!0}else return q.error("Update failed: "+fe.error),G(!1),!1},he=async()=>{H(!0);try{const pe=await me.checkVersion(),be=pe==null?void 0:pe.installedVersion,De=pe==null?void 0:pe.latestVersion;if(be&&oe.current&&be!==oe.current){q.info(`Refreshing to v${be}...`),setTimeout(()=>window.location.reload(),500);return}_e(De,be)&&(o!=null&&o.autoUpdate?(H(!1),q.info(`Auto-updating to v${De}...`),await Fe(De,(pe==null?void 0:pe.updateMethod)||"npm",pe==null?void 0:pe.channel)):(T({...pe,updateAvailable:!0}),q.info(`Update available: v${De}`)))}catch{q.error("Failed to check for updates")}finally{H(!1)}},we=async()=>{if(L!=null&&L.updateAvailable){G(!0);try{const pe=await me.performUpdate({updateMethod:L.updateMethod,sourcePath:L.sourcePath,targetVersion:L.latestVersion,channel:L.channel});if(pe.success){q.success(`Updated to v${pe.newVersion}! Restarting server...`),T(null),setVersion(pe.newVersion);try{await me.restartServer()}catch{}let be=0;const De=setInterval(async()=>{be++;try{await me.checkVersion(),clearInterval(De),q.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{be>30&&(clearInterval(De),q.info("Server restarting. Please refresh the page."),G(!1))}},500)}else q.error("Update failed: "+pe.error),G(!1)}catch(pe){q.error("Update failed: "+pe.message),G(!1)}}};_.useEffect(()=>{const pe=async()=>{try{const{hashes:De}=await me.getFileHashes(),fe=K.current,Se=Object.keys(De).some(He=>fe[He]!==De[He])||Object.keys(fe).some(He=>!De[He]),Te=fe.__subprojects__!==De.__subprojects__;if(Se&&Object.keys(fe).length>0&&(await ie(),Te&&de))try{const He=await me.getSubprojects(de.dir);ue(Ye=>({...Ye,subprojects:He.subprojects||[]}))}catch{}K.current=De}catch{}},be=setInterval(pe,2e3);return pe(),()=>clearInterval(be)},[ie,de]);const Oe=new Set;j.forEach(pe=>{var be,De;(((be=pe.config)==null?void 0:be.include)||[]).forEach(fe=>Oe.add(fe)),Object.keys(((De=pe.config)==null?void 0:De.mcpServers)||{}).forEach(fe=>Oe.add(fe))});const $e={mcps:Oe.size,rules:g.length,commands:k.length},Ke=async()=>{try{const pe=await me.applyConfig(x.dir);if(pe.tools){const be=Object.entries(pe.tools).filter(([,De])=>De).map(([De])=>De==="claude"?"Claude Code":"Antigravity");be.length>0?q.success(`Config applied to: ${be.join(", ")}`):q.warning("No tools were updated")}else q.success("Configuration applied successfully!")}catch(pe){q.error("Failed to apply config: "+pe.message)}},xt=async()=>{h(!0),await ie(),q.success("Data refreshed")};if(m)return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-4",children:[t.jsx(Qe,{className:"w-8 h-8 animate-spin text-primary"}),t.jsx("p",{className:"text-muted-foreground",children:"Loading configuration..."})]})});const Ce=()=>{switch(u){case"explorer":return t.jsx(A8,{project:x,onRefresh:ie});case"registry":return t.jsx(YH,{registry:v,searchQuery:J,setSearchQuery:W,onUpdate:ie});case"plugins":return t.jsx(SW,{});case"memory":return t.jsx(JH,{project:x,onUpdate:ie});case"create-mcp":return t.jsx(jH,{project:x});case"claude-settings":return t.jsx(uH,{});case"gemini-settings":return t.jsx(hH,{});case"codex-settings":return t.jsx(CH,{});case"antigravity-settings":return t.jsx(xH,{});case"statuslines":return t.jsx(QW,{});case"sessions":return t.jsx(YW,{});case"preferences":return t.jsx(dH,{onConfigChange:()=>d()});case"projects":return t.jsx(tW,{onProjectSwitch:pe=>{w({dir:pe.dir,hierarchy:pe.hierarchy,subprojects:pe.subprojects}),ue({dir:pe.dir,subprojects:pe.subprojects}),ie(),Z()}});case"workstreams":return t.jsx(CW,{onWorkstreamChange:pe=>{q.success(`Switched to workstream: ${pe.name}`)}});case"loops":return t.jsx(kW,{activeProject:r});case"docs":return t.jsx(wW,{});case"tutorial":return t.jsx(KW,{});default:return null}};return t.jsxs("div",{className:"min-h-screen bg-background",children:[t.jsx("header",{className:"h-16 bg-card border-b border-border sticky top-0 z-50 shadow-sm",children:t.jsxs("div",{className:"h-full px-6 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.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:t.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 128 128",children:[t.jsx("circle",{cx:"64",cy:"64",r:"52",fill:"none",stroke:"white",strokeWidth:"10",strokeDasharray:"24 12"}),t.jsx("circle",{cx:"64",cy:"64",r:"28",fill:"white"}),t.jsx("circle",{cx:"64",cy:"64",r:"12",fill:"#7c3aed"})]})}),t.jsx("div",{children:t.jsxs("h1",{className:"text-xl font-bold text-foreground",children:["Coder ",t.jsx("span",{className:"text-primary",children:"Config"})]})}),L&&t.jsxs("button",{onClick:we,disabled:B,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:[B?t.jsx(Qe,{className:"w-3 h-3 animate-spin"}):t.jsx(xi,{className:"w-3 h-3"}),B?"Updating...":`Update to v${L.latestVersion}`]})]}),t.jsx(jN,{orientation:"vertical",className:"h-6"}),t.jsx(T8,{projects:e,activeProject:r,onSwitch:le,onAddClick:()=>re(!0),onManageClick:()=>f("projects")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(D8,{}),t.jsx(se,{variant:"ghost",size:"sm",onClick:xt,children:t.jsx(Mr,{className:"w-4 h-4"})}),t.jsxs(se,{onClick:Ke,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:[t.jsx(Tc,{className:"w-4 h-4"}),"Re-apply"]})]})]})}),t.jsxs("div",{className:"flex",children:[t.jsxs("aside",{className:"w-64 h-[calc(100vh-64px)] border-r border-border bg-card sticky top-16 flex flex-col",children:[t.jsx(Js,{className:"flex-1 py-4",children:["Projects","Tools","Configuration","Developer","System","Help"].map(pe=>t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:"px-4 mb-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:pe}),t.jsx("div",{className:"space-y-0.5",children:ZW.filter(be=>be.section===pe).filter(be=>{var De;return be.id!=="loops"||((De=o==null?void 0:o.experimental)==null?void 0:De.ralphLoops)}).filter(be=>!be.tool||((o==null?void 0:o.enabledTools)||["claude"]).includes(be.tool)).map(be=>{const De=be.icon,fe=u===be.id;return t.jsxs("button",{onClick:()=>f(be.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-all duration-200 border-l-2 ${fe?"bg-accent border-primary text-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:[t.jsx(De,{className:"w-4 h-4"}),t.jsx("span",{className:"flex-1 text-left",children:be.label}),be.badge&&t.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${fe?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:$e[be.badge]}),be.isNew&&t.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"})]},be.id)})})]},pe))}),t.jsx("div",{className:"px-4 py-3 border-t border-border",children:t.jsxs("button",{onClick:he,disabled:X,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",title:"Check for updates",children:[X?t.jsx(Qe,{className:"w-3 h-3 animate-spin"}):null,c?`v${c}`:""]})})]}),t.jsx("main",{style:["explorer","docs","tutorial"].includes(u)?{}:{zoom:.9},className:Ne("flex-1 overflow-auto",["explorer","docs","tutorial"].includes(u)?"h-[calc(100vh-64px)]":"p-6"),children:t.jsx(T_,{mode:"wait",children:t.jsx(Oa.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:["explorer","docs","tutorial"].includes(u)?"h-full":"",children:Ce()},u)})})]}),t.jsx(_N,{open:F,onOpenChange:re,onAdded:ee}),t.jsx(R8,{onStartTutorial:()=>f("tutorial")})]})}function rU(){const[e,r]=_.useState(!1),[s,n]=_.useState(!1),[o,c]=_.useState(!1),d=_.useCallback(async()=>{n(!0);try{await me.restartServer(),q.info("Server restarting... page will reload."),setTimeout(()=>{window.location.reload()},2e3)}catch(u){q.error("Failed to restart: "+u.message),n(!1)}},[]),l=_.useCallback(()=>{c(!0),r(!1),q.dismiss("update-available")},[]);return _.useEffect(()=>{let u;const f=async()=>{try{const m=await me.getVersion();console.log("[Update Check]",m),m.needsRestart&&!o&&r(!0)}catch{}};return f(),u=setInterval(f,3e4),()=>clearInterval(u)},[o]),t.jsx(M8,{children:t.jsxs("div",{className:"min-h-screen bg-background",children:[e&&!s&&t.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:d,children:[t.jsx(Mr,{className:"w-4 h-4"}),t.jsx("span",{className:"text-sm font-medium",children:"Update available — click to restart"}),t.jsx("button",{onClick:u=>{u.stopPropagation(),l()},className:"absolute right-3 p-1 hover:bg-blue-500 rounded",children:t.jsx(fi,{className:"w-4 h-4"})})]}),s&&t.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:[t.jsx(Mr,{className:"w-4 h-4 animate-spin"}),t.jsx("span",{className:"text-sm font-medium",children:"Restarting server..."})]}),t.jsx(tU,{}),t.jsx(WP,{position:"bottom-right",richColors:!0})]})})}gP.createRoot(document.getElementById("root")).render(t.jsx(rU,{}));
@@ -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-DaWvjOBw.js"></script>
22
+ <script type="module" crossorigin src="/assets/index-zVvhh8v5.js"></script>
23
23
  <link rel="stylesheet" crossorigin href="/assets/index-C0x-uedt.css">
24
24
  </head>
25
25
  <body>