coder-config 0.47.5-beta → 0.47.6-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.47.5-beta';
5
+ const VERSION = '0.47.6-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.47.5-beta",
3
+ "version": "0.47.6-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",
@@ -2990,7 +2990,7 @@ When reporting issues, include:
2990
2990
  - Operating system
2991
2991
  - Error messages or logs
2992
2992
  `}},hW={...YH,...JH,...XH,...QH,...ZH,...eW,...tW,...rW,...sW,...nW,...iW,...oW,...aW,...lW,...cW,...dW,...uW};function y2(e){let t=e.replace(/```(\w*)\n([\s\S]*?)```/g,(s,n,o)=>`<pre class="bg-zinc-900 text-zinc-100 p-4 rounded-lg overflow-x-auto my-4"><code class="text-sm">${o.replace(/\\\`/g,"`").replace(/</g,"&lt;").replace(/>/g,"&gt;").trim()}</code></pre>`);return t=t.replace(/(\|[^\n]+\|\n\|[-| :]+\|\n(?:\|[^\n]+\|\n?)+)/g,s=>{const n=s.trim().split(`
2993
- `);if(n.length<2)return s;const o=n[0].split("|").filter(u=>u.trim()).map(u=>`<th class="border border-border px-3 py-2 bg-muted font-semibold text-left">${u.trim()}</th>`).join(""),c=n.slice(2).map(u=>`<tr>${u.split("|").filter(d=>d.trim()).map(d=>`<td class="border border-border px-3 py-2">${d.trim()}</td>`).join("")}</tr>`).join("");return`<table class="w-full border-collapse border border-border my-4"><thead><tr>${o}</tr></thead><tbody>${c}</tbody></table>`}),t=t.replace(/`([^`]+)`/g,(s,n)=>`<code class="bg-muted px-1.5 py-0.5 rounded text-sm font-mono">${n.replace(/\*/g,"&#42;").replace(/_/g,"&#95;")}</code>`),t.replace(/^### (.*$)/gim,'<h3 class="text-lg font-semibold mt-6 mb-2 text-foreground">$1</h3>').replace(/^## (.*$)/gim,'<h2 class="text-xl font-semibold mt-8 mb-4 text-foreground">$1</h2>').replace(/^# (.*$)/gim,'<h1 class="text-2xl font-bold mb-6 text-foreground">$1</h1>').replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'<img src="$2" alt="$1" class="rounded-lg shadow-lg my-4 max-w-full border border-border" />').replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/^- (.*$)/gim,'<li class="ml-4">$1</li>').replace(/(<li.*<\/li>\n?)+/g,'<ul class="list-disc my-2">$&</ul>').replace(/^\d+\. (.*$)/gim,'<li class="ml-4">$1</li>').replace(/\n\n/g,'</p><p class="my-3 text-foreground">').replace(/\n/g,"<br/>")}function fW(){const[e,t]=_.useState("installation"),[s,n]=_.useState({"getting-started":!0}),o=u=>{n(l=>({...l,[u]:!l[u]}))},c=hW[e];return r.jsxs("div",{className:"flex h-full",children:[r.jsxs("div",{className:"w-64 border-r border-border bg-muted/50 flex flex-col",children:[r.jsx("div",{className:"p-4 border-b border-border",children:r.jsxs("h2",{className:"font-semibold flex items-center gap-2 text-foreground",children:[r.jsx(To,{className:"w-5 h-5"}),"Documentation"]})}),r.jsx(Ys,{className:"flex-1",children:r.jsx("div",{className:"p-2",children:KH.map(u=>r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{className:Ne("w-full flex items-center gap-2 px-3 py-2 text-sm rounded-md hover:bg-accent text-left",(e===u.id||u.subsections.some(l=>l.id===e))&&"bg-accent"),onClick:()=>{u.subsections.length>0?(o(u.id),s[u.id]||t(u.subsections[0].id)):t(u.id)},children:[r.jsx(u.icon,{className:"w-4 h-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1",children:u.title}),u.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"}),u.subsections.length>0&&r.jsx(xs,{className:Ne("w-4 h-4 text-muted-foreground transition-transform",s[u.id]&&"rotate-90")})]}),u.subsections.length>0&&s[u.id]&&r.jsx("div",{className:"ml-6 mt-1 space-y-1",children:u.subsections.map(l=>r.jsx("button",{className:Ne("w-full text-left px-3 py-1.5 text-sm rounded-md hover:bg-accent text-foreground",e===l.id&&"bg-accent text-primary font-medium"),onClick:()=>t(l.id),children:l.title},l.id))})]},u.id))})})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(Ys,{className:"h-full",children:r.jsx("div",{className:"max-w-3xl mx-auto p-8",children:c?r.jsx("div",{className:"prose prose-sm max-w-none",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:y2(c.content)}})}):r.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[r.jsx(To,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a topic from the sidebar"})]})})})})]})}var mW={};const g_={development:"bg-blue-100 text-blue-700 border-blue-200 dark:bg-blue-900/30 dark:text-blue-400 dark:border-blue-800",productivity:"bg-green-100 text-green-700 border-green-200 dark:bg-green-900/30 dark:text-green-400 dark:border-green-800",integration:"bg-purple-100 text-purple-700 border-purple-200 dark:bg-purple-900/30 dark:text-purple-400 dark:border-purple-800",external:"bg-orange-100 text-orange-700 border-orange-200 dark:bg-orange-900/30 dark:text-orange-400 dark:border-orange-800",lsp:"bg-cyan-100 text-cyan-700 border-cyan-200 dark:bg-cyan-900/30 dark:text-cyan-400 dark:border-cyan-800",default:"bg-gray-100 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-700"};function pW(){var ae,ne,Z,le,Se,Le,Ue;const[e,t]=_.useState(!0),[s,n]=_.useState({allPlugins:[],categories:[],marketplaces:[],enabledPlugins:null}),[o,c]=_.useState(""),[u,l]=_.useState([]),[d,f]=_.useState([]),[m,h]=_.useState(!0),[g,w]=_.useState(!0),[j,S]=_.useState(!0),[v,y]=_.useState(!0),[x,b]=_.useState("name"),[k,E]=_.useState(null),[P,A]=_.useState({open:!1,repo:""}),[N,M]=_.useState(!1),[D,O]=_.useState({open:!1,plugin:null}),[$,V]=_.useState(!1),X=async()=>{t(!0);try{const pe=await ue.getPlugins();n(pe)}catch(pe){K.error("Failed to load plugins: "+pe.message)}finally{t(!1)}};_.useEffect(()=>{X()},[]);const W=_.useMemo(()=>{let pe=s.allPlugins||[];if(o){const be=o.toLowerCase();pe=pe.filter(Fe=>{var qe,Xe,Et;return((qe=Fe.name)==null?void 0:qe.toLowerCase().includes(be))||((Xe=Fe.description)==null?void 0:Xe.toLowerCase().includes(be))||((Et=Fe.category)==null?void 0:Et.toLowerCase().includes(be))})}return pe=pe.filter(be=>!(be.sourceType==="external"&&!g||be.sourceType==="internal"&&!m)),pe=pe.filter(be=>!(be.installed&&!j||!be.installed&&!v)),u.length>0&&(pe=pe.filter(be=>u.includes(be.category))),d.length>0&&(pe=pe.filter(be=>d.includes(be.marketplace))),pe.sort((be,Fe)=>{if(x==="installed"){if(be.installed&&!Fe.installed)return-1;if(!be.installed&&Fe.installed)return 1}if(x==="category"){const qe=(be.category||"zzz").localeCompare(Fe.category||"zzz");if(qe!==0)return qe}return be.name.localeCompare(Fe.name)}),pe},[s.allPlugins,o,g,m,j,v,u,d,x]),z=pe=>{l(be=>be.includes(pe)?be.filter(Fe=>Fe!==pe):[...be,pe])},Y=pe=>{f(be=>be.includes(pe)?be.filter(Fe=>Fe!==pe):[...be,pe])},G=async pe=>{E(pe);try{const be=await ue.refreshMarketplace(pe);be.success?(K.success(`Refreshed ${pe}`),await X()):K.error(be.error||"Failed to refresh marketplace")}catch(be){K.error("Failed to refresh: "+be.message)}finally{E(null)}},L=async()=>{if(!P.repo.trim()){K.error("Please enter a repository URL");return}try{const pe=await ue.addMarketplace("",P.repo.trim());pe.success?(K.success("Marketplace added"),A({open:!1,repo:""}),await X()):K.error(pe.error||"Failed to add marketplace")}catch(pe){K.error("Failed to add marketplace: "+pe.message)}},R=async(pe,be,Fe)=>{V(!0);try{const qe=Fe!==!0,Xe=await ue.setPluginEnabled(pe,be,qe);Xe.success?(K.success(`Plugin ${qe?"enabled":"disabled"} for ${pe===mW.HOME?"~":pe}`),await X()):K.error(Xe.error||"Failed to update plugin state")}catch(qe){K.error("Failed to update plugin: "+qe.message)}finally{V(!1)}},B=async(pe,be)=>{V(!0);try{const Fe=await ue.setPluginEnabled(pe,be,null);Fe.success?(K.success("Plugin override removed"),await X()):K.error(Fe.error||"Failed to remove override")}catch(Fe){K.error("Failed to update plugin: "+Fe.message)}finally{V(!1)}},q=pe=>{O({open:!0,plugin:pe})},F=(s.allPlugins||[]).filter(pe=>pe.installed).length,ee=(s.allPlugins||[]).filter(pe=>!pe.installed).length,ce=(s.allPlugins||[]).filter(pe=>pe.sourceType==="internal").length,me=(s.allPlugins||[]).filter(pe=>pe.sourceType==="external").length,J=s.marketplaces||[],H=s.categories||[];return e?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(Ze,{className:"w-8 h-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-indigo-50 dark:bg-indigo-950/30 border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 flex items-start gap-3",children:[r.jsx(Ju,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-indigo-800 dark:text-indigo-300",children:[r.jsx("p",{className:"font-medium",children:"Install plugins from Project Explorer"}),r.jsxs("p",{className:"text-indigo-600 dark:text-indigo-400 mt-1",children:["Use the ",r.jsx("kbd",{className:"px-1.5 py-0.5 bg-indigo-100 dark:bg-indigo-900 rounded text-xs",children:"+"}),' menu on any project and select "Install Plugins" to add plugins with project-level scope control.']})]})]}),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-5 border-b border-gray-200 dark:border-slate-700",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[r.jsx(Io,{className:"w-5 h-5 text-indigo-600"}),"Plugin Directory",r.jsxs(et,{variant:"outline",className:"ml-2 font-normal",children:[W.length," of ",((ae=s.allPlugins)==null?void 0:ae.length)||0]})]}),r.jsx(re,{variant:"ghost",size:"sm",onClick:X,disabled:e,children:r.jsx(Tr,{className:`w-4 h-4 ${e?"animate-spin":""}`})})]}),r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Pc,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),r.jsx(at,{value:o,onChange:pe=>c(pe.target.value),placeholder:"Search plugins...",className:"pl-9 bg-white dark:bg-slate-900 border-gray-300 dark:border-slate-700"})]}),r.jsxs(Br,{value:x,onValueChange:b,children:[r.jsx(Pr,{className:"w-40",children:r.jsx($r,{placeholder:"Sort by"})}),r.jsxs(Ar,{children:[r.jsx(Ft,{value:"name",children:"Name"}),r.jsx(Ft,{value:"installed",children:"Installed first"}),r.jsx(Ft,{value:"category",children:"Category"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1",children:[r.jsx(Xd,{className:"w-3 h-3"}),"Marketplace",d.length>0&&r.jsx(et,{variant:"secondary",className:"ml-1 h-4 px-1 text-[10px]",children:d.length}),r.jsx(vr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(dn,{align:"start",className:"w-56",children:[r.jsx(xc,{className:"text-xs",children:"Filter by marketplace"}),r.jsx(gs,{}),J.length>0?J.map(pe=>r.jsx(gc,{checked:d.includes(pe.name),onCheckedChange:()=>Y(pe.name),children:pe.name},pe.name)):r.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No marketplaces"}),r.jsx(gs,{}),r.jsxs(Nt,{onClick:()=>M(!0),children:[r.jsx(un,{className:"w-3 h-3 mr-2"}),"Manage Marketplaces"]}),d.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(gs,{}),r.jsx(Nt,{onClick:()=>f([]),children:"Clear filters"})]})]})]}),r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1",children:[r.jsx(Mg,{className:"w-3 h-3"}),"Category",u.length>0&&r.jsx(et,{variant:"secondary",className:"ml-1 h-4 px-1 text-[10px]",children:u.length}),r.jsx(vr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(dn,{align:"start",className:"w-48",children:[r.jsx(xc,{className:"text-xs",children:"Filter by category"}),r.jsx(gs,{}),H.map(pe=>r.jsx(gc,{checked:u.includes(pe),onCheckedChange:()=>z(pe),children:pe},pe)),u.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(gs,{}),r.jsx(Nt,{onClick:()=>l([]),children:"Clear filters"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(ut,{checked:j,onCheckedChange:S,className:"h-4 w-7 data-[state=checked]:bg-green-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400",children:["Installed (",F,")"]})]}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(ut,{checked:v,onCheckedChange:y,className:"h-4 w-7 data-[state=checked]:bg-blue-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400",children:["Available (",ee,")"]})]}),r.jsx("span",{className:"text-gray-300 dark:text-slate-600",children:"|"}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(ut,{checked:m,onCheckedChange:h,className:"h-4 w-7 data-[state=checked]:bg-indigo-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400 flex items-center gap-1",children:[r.jsx(tC,{className:"w-3 h-3"})," Anthropic (",ce,")"]})]}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(ut,{checked:g,onCheckedChange:w,className:"h-4 w-7 data-[state=checked]:bg-orange-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400 flex items-center gap-1",children:[r.jsx(Yi,{className:"w-3 h-3"})," Community (",me,")"]})]})]})]})]}),r.jsxs("div",{className:"p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[W.map((pe,be)=>{const Fe=g_[pe.category]||g_.default,qe=pe.mcpServers?Object.keys(pe.mcpServers).length:0,Xe=pe.lspServers?Object.keys(pe.lspServers).length:0,Et=`${pe.name}@${pe.marketplace}`,_e=pe.enabledState,he=(_e==null?void 0:_e.merged)===!0;return(_e==null?void 0:_e.merged)!==null&&(_e==null||_e.merged),r.jsxs(Ma.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:Math.min(be*.02,.3)},className:`rounded-lg border p-4 transition-all hover:shadow-md ${he?"bg-emerald-50 border-emerald-200 dark:bg-emerald-950/20 dark:border-emerald-800":pe.installed?"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-800":"bg-white border-gray-200 dark:bg-slate-900 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:pe.name}),pe.sourceType==="external"&&r.jsx(Yi,{className:"w-3.5 h-3.5 text-orange-500 flex-shrink-0",title:"Community plugin"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[pe.installed&&r.jsxs(et,{variant:"outline",className:"text-green-600 border-green-300 dark:text-green-400 dark:border-green-700 text-[10px]",children:[r.jsx(Dt,{className:"w-2.5 h-2.5 mr-0.5"}),"Installed"]}),he&&r.jsxs(et,{variant:"outline",className:"text-emerald-600 border-emerald-300 dark:text-emerald-400 dark:border-emerald-700 text-[10px]",children:[r.jsx(Db,{className:"w-2.5 h-2.5 mr-0.5"}),"Enabled"]})]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[pe.installed&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-60 hover:opacity-100",onClick:()=>q(pe),children:r.jsx(un,{className:"w-4 h-4"})})}),r.jsx(It,{children:r.jsx("p",{children:"Configure per-directory"})})]})}),pe.homepage&&r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-60 hover:opacity-100",onClick:()=>window.open(pe.homepage,"_blank"),children:r.jsx(fu,{className:"w-4 h-4"})})]})]}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-3 line-clamp-2",children:pe.description||"No description available"}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-2",children:[pe.category&&r.jsx(et,{variant:"outline",className:`text-[10px] px-1.5 py-0 ${Fe}`,children:pe.category}),pe.version&&r.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-slate-500",children:["v",pe.version]})]}),(qe>0||Xe>0||pe.commands)&&r.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-gray-500 dark:text-slate-500 pt-2 border-t border-gray-100 dark:border-slate-800",children:[Xe>0&&r.jsxs("span",{className:"flex items-center gap-1 bg-cyan-50 dark:bg-cyan-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(Gn,{className:"w-3 h-3 text-cyan-600"}),Xe," LSP"]}),qe>0&&r.jsxs("span",{className:"flex items-center gap-1 bg-blue-50 dark:bg-blue-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(vs,{className:"w-3 h-3 text-blue-600"}),qe," MCP"]}),pe.commands&&r.jsxs("span",{className:"flex items-center gap-1 bg-green-50 dark:bg-green-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(Kt,{className:"w-3 h-3 text-green-600"}),"Commands"]})]})]},Et)}),W.length===0&&r.jsxs("div",{className:"col-span-full text-center py-12 text-gray-500 dark:text-slate-400",children:[r.jsx(Io,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{className:"font-medium",children:"No plugins found"}),r.jsx("p",{className:"text-sm mt-1",children:"Try adjusting your filters or search query"}),(u.length>0||d.length>0||o)&&r.jsx(re,{variant:"link",size:"sm",onClick:()=>{l([]),f([]),c("")},className:"mt-2",children:"Clear all filters"})]})]})]}),r.jsx(vt,{open:P.open,onOpenChange:pe=>A({...P,open:pe}),children:r.jsxs(ht,{className:"max-w-lg",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Xd,{className:"w-5 h-5 text-purple-600"}),"Add Plugin Marketplace"]}),r.jsx(tr,{children:"Add a marketplace from a GitHub repository URL or local path."})]}),r.jsx("div",{className:"space-y-4 py-4",children:r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Repository URL or Path"}),r.jsx(at,{value:P.repo,onChange:pe=>A({...P,repo:pe.target.value}),placeholder:"owner/repo or full GitHub URL",className:"mt-1"}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-2",children:"Supported formats:"}),r.jsxs("ul",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1 space-y-1 ml-2",children:[r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"owner/repo"})," — GitHub shorthand"]}),r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"https://github.com/owner/repo"})," — Full URL"]}),r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"/local/path"})," — Local directory"]})]}),r.jsxs("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-2",children:["Search GitHub for ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"claude-plugins"})," to find community marketplaces."]})]})}),r.jsxs(St,{children:[r.jsx(re,{variant:"ghost",onClick:()=>A({open:!1,repo:""}),children:"Cancel"}),r.jsxs(re,{onClick:L,className:"bg-purple-600 hover:bg-purple-700 text-white",children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Add Marketplace"]})]})]})}),r.jsx(vt,{open:N,onOpenChange:M,children:r.jsxs(ht,{className:"max-w-2xl",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Xd,{className:"w-5 h-5 text-purple-600"}),"Plugin Marketplaces",r.jsx(et,{variant:"outline",className:"ml-2 font-normal",children:J.length})]}),r.jsx(tr,{children:"Manage your plugin marketplaces. Add external marketplaces to discover more plugins."})]}),r.jsx("div",{className:"py-4",children:J.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:J.map(pe=>{var Fe,qe,Xe;const be=(((Fe=pe.plugins)==null?void 0:Fe.length)||0)+(((qe=pe.externalPlugins)==null?void 0:qe.length)||0);return r.jsxs("div",{className:"bg-purple-50 dark:bg-purple-950/20 rounded-lg border border-purple-200 dark:border-purple-800 p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h3",{className:"font-semibold text-purple-900 dark:text-purple-200",children:pe.name}),r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>G(pe.name),disabled:k===pe.name,className:"h-7 w-7 p-0",children:r.jsx(Tr,{className:`w-4 h-4 text-purple-600 dark:text-purple-400 ${k===pe.name?"animate-spin":""}`})})]}),r.jsx("p",{className:"text-sm text-purple-700 dark:text-purple-300 mb-2 truncate",children:typeof pe.source=="string"?pe.source:((Xe=pe.source)==null?void 0:Xe.repo)||"Unknown source"}),r.jsxs("div",{className:"flex items-center justify-between text-xs text-purple-600 dark:text-purple-400",children:[r.jsxs("span",{children:[be," plugins"]}),pe.lastUpdated&&r.jsxs("span",{children:["Updated: ",new Date(pe.lastUpdated).toLocaleDateString()]})]})]},pe.name)})}):r.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-slate-400",children:[r.jsx(Xd,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No marketplaces configured."}),r.jsx("p",{className:"text-sm mt-1",children:"Add a marketplace to discover plugins."})]})}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>M(!1),children:"Close"}),r.jsxs(re,{onClick:()=>{M(!1),A({open:!0,repo:""})},className:"bg-purple-600 hover:bg-purple-700 text-white",children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Add Marketplace"]})]})]})}),r.jsx(vt,{open:D.open,onOpenChange:pe=>O({...D,open:pe}),children:r.jsxs(ht,{className:"max-w-lg",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Mb,{className:"w-5 h-5 text-emerald-600"}),"Configure Plugin: ",(ne=D.plugin)==null?void 0:ne.name]}),r.jsx(tr,{children:"Enable or disable this plugin for specific directories. Child directories inherit parent settings unless overridden."})]}),r.jsxs("div",{className:"space-y-3 py-4 max-h-[400px] overflow-y-auto",children:[(Se=(le=(Z=D.plugin)==null?void 0:Z.enabledState)==null?void 0:le.perDir)==null?void 0:Se.map((pe,be)=>{const Fe=`${D.plugin.name}@${D.plugin.marketplace}`,qe=pe.enabled!==null&&pe.enabled!==void 0,Xe=pe.enabled===!0,Et=pe.enabled===!1;let _e=null;if(!qe&&be>0)for(let he=be-1;he>=0;he--){const ye=D.plugin.enabledState.perDir[he];if(ye.enabled!==null&&ye.enabled!==void 0){_e=ye.enabled;break}}return r.jsxs("div",{className:`flex items-center justify-between p-3 rounded-lg border ${Xe?"bg-emerald-50 border-emerald-200 dark:bg-emerald-950/30 dark:border-emerald-800":Et?"bg-red-50 border-red-200 dark:bg-red-950/30 dark:border-red-800":"bg-gray-50 border-gray-200 dark:bg-slate-800/50 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:pe.label}),!qe&&_e!==null&&r.jsxs(et,{variant:"outline",className:"text-[10px] text-gray-500",children:["inherited: ",_e?"on":"off"]})]}),qe&&r.jsx("p",{className:"text-[10px] text-gray-500 dark:text-slate-400 mt-0.5",children:Xe?"Explicitly enabled":"Explicitly disabled"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[qe&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-gray-400 hover:text-gray-600",onClick:()=>B(pe.dir,Fe),disabled:$,children:r.jsx(EM,{className:"w-4 h-4"})})}),r.jsx(It,{children:r.jsx("p",{children:"Remove override (inherit from parent)"})})]})}),r.jsxs("div",{className:"flex items-center gap-1 border rounded-lg overflow-hidden",children:[r.jsx(re,{variant:Xe?"default":"ghost",size:"sm",className:`h-7 px-2 rounded-none ${Xe?"bg-emerald-600 hover:bg-emerald-700 text-white":""}`,onClick:()=>R(pe.dir,Fe,!1),disabled:$||Xe,children:r.jsx(Db,{className:"w-3 h-3"})}),r.jsx(re,{variant:Et?"default":"ghost",size:"sm",className:`h-7 px-2 rounded-none ${Et?"bg-red-600 hover:bg-red-700 text-white":""}`,onClick:()=>R(pe.dir,Fe,!0),disabled:$||Et,children:r.jsx(UM,{className:"w-3 h-3"})})]})]})]},pe.dir)}),(!((Ue=(Le=D.plugin)==null?void 0:Le.enabledState)!=null&&Ue.perDir)||D.plugin.enabledState.perDir.length===0)&&r.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-slate-400",children:[r.jsx(Mb,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No config hierarchy found."}),r.jsx("p",{className:"text-sm mt-1",children:"Create a .claude/mcps.json in your project first."})]})]}),r.jsx(St,{children:r.jsx(re,{variant:"ghost",onClick:()=>O({open:!1,plugin:null}),children:"Done"})})]})}),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 (Claude Code)"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{className:"text-gray-400 dark:text-slate-500",children:"# Add marketplace (one-time)"}),r.jsx("p",{children:"claude plugin marketplace add regression-io/coder-config-plugins"}),r.jsx("p",{className:"text-gray-400 dark:text-slate-500 mt-2",children:"# Install plugins from marketplace"}),r.jsx("p",{children:"claude plugin install <name>@coder-config-plugins"}),r.jsx("p",{className:"text-gray-400 dark:text-slate-500 mt-2",children:"# Manage plugins"}),r.jsx("p",{children:"claude plugin list # List installed"}),r.jsx("p",{children:"claude plugin uninstall <name> # Remove plugin"})]})]})]})}function gW({onWorkstreamChange:e}){var io,Tn,Ko,oo,Zn,fs,ao,Mr;const{projects:t,fetch:s}=Px(),{workstreams:n,loading:o,fetch:c,create:u,update:l,delete:d,addProject:f,removeProject:m,countWorkstreamsForProject:h}=bN(),[g,w]=_.useState(null),[j,S]=_.useState(!1),[v,y]=_.useState(null),[x,b]=_.useState(!1),[k,E]=_.useState(null),[P,A]=_.useState(new Set),[N,M]=_.useState(""),[D,O]=_.useState(""),[$,V]=_.useState([]),[X,W]=_.useState(!1),[z,Y]=_.useState(!1),[G,L]=_.useState({}),[R,B]=_.useState({}),[q,F]=_.useState({}),[ee,ce]=_.useState({isInstalled:!1,loading:!0}),[me,J]=_.useState(!1),[H,ae]=_.useState(null),[ne,Z]=_.useState([]),[le,Se]=_.useState(!1),[Le,Ue]=_.useState(()=>{try{return JSON.parse(localStorage.getItem("dismissedWorkstreamSuggestions")||"[]")}catch{return[]}}),[pe,be]=_.useState(!1),[Fe,qe]=_.useState(""),[Xe,Et]=_.useState([]),[_e,he]=_.useState("llama3.2"),[ye,Ie]=_.useState(null),[de,we]=_.useState(""),[Ae,$e]=_.useState(!1),[Ke,jt]=_.useState({installed:!1,loading:!0}),[ot,ur]=_.useState({workstreamAutoActivate:!0}),[Rr,Vr]=_.useState(!1),[Jt,Sr]=_.useState(!1),[Wt,yr]=_.useState(null),[us,Qr]=_.useState("");_.useEffect(()=>{c(),s(),zt(),rr(),Os(),nt(),Ls()},[c,s]);const Ls=async()=>{try{const Q=await ue.getAvailableAITools();Q.success&&Q.tools&&(Et(Q.tools),Q.tools.find(Ge=>Ge.id==="claude"&&Ge.available)&&qe("claude"))}catch(Q){console.error("Failed to load AI tools:",Q)}},Os=async()=>{try{const Q=await ue.getCdHookStatus();jt({...Q,loading:!1})}catch(Q){jt({installed:!1,loading:!1,error:Q.message})}},nt=async()=>{try{const Q=await ue.getWorkstreamSettings();ur(Q.settings||{workstreamAutoActivate:!0})}catch(Q){console.error("Failed to load global settings:",Q)}},zt=async()=>{try{const Q=await ue.getWorkstreamHookStatus();ce({...Q,loading:!1})}catch(Q){ce({isInstalled:!1,loading:!1,error:Q.message})}},rr=async()=>{try{Se(!0);const[Q,De]=await Promise.all([ue.getActivitySummary(),ue.getWorkstreamSuggestions()]);ae(Q),Z(De.suggestions||[])}catch(Q){console.log("Activity data not available:",Q.message)}finally{Se(!1)}},ar=Q=>{M(Q.name),V([...Q.projects]),O(`# Auto-generated workstream based on activity patterns
2993
+ `);if(n.length<2)return s;const o=n[0].split("|").filter(u=>u.trim()).map(u=>`<th class="border border-border px-3 py-2 bg-muted font-semibold text-left">${u.trim()}</th>`).join(""),c=n.slice(2).map(u=>`<tr>${u.split("|").filter(d=>d.trim()).map(d=>`<td class="border border-border px-3 py-2">${d.trim()}</td>`).join("")}</tr>`).join("");return`<table class="w-full border-collapse border border-border my-4"><thead><tr>${o}</tr></thead><tbody>${c}</tbody></table>`}),t=t.replace(/`([^`]+)`/g,(s,n)=>`<code class="bg-muted px-1.5 py-0.5 rounded text-sm font-mono">${n.replace(/\*/g,"&#42;").replace(/_/g,"&#95;")}</code>`),t.replace(/^### (.*$)/gim,'<h3 class="text-lg font-semibold mt-6 mb-2 text-foreground">$1</h3>').replace(/^## (.*$)/gim,'<h2 class="text-xl font-semibold mt-8 mb-4 text-foreground">$1</h2>').replace(/^# (.*$)/gim,'<h1 class="text-2xl font-bold mb-6 text-foreground">$1</h1>').replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'<img src="$2" alt="$1" class="rounded-lg shadow-lg my-4 max-w-full border border-border" />').replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/^- (.*$)/gim,'<li class="ml-4 list-disc">$1</li>').replace(/((?:<li class="ml-4 list-disc">.*<\/li>\n?)+)/g,'<ul class="list-disc my-2">$1</ul>').replace(/^\d+\. (.*$)/gim,'<li class="ml-4 list-decimal">$1</li>').replace(/((?:<li class="ml-4 list-decimal">.*<\/li>\n?)+)/g,'<ol class="list-decimal my-2">$1</ol>').replace(/\n\n/g,'</p><p class="my-3 text-foreground">').replace(/\n/g,"<br/>")}function fW(){const[e,t]=_.useState("installation"),[s,n]=_.useState({"getting-started":!0}),o=u=>{n(l=>({...l,[u]:!l[u]}))},c=hW[e];return r.jsxs("div",{className:"flex h-full",children:[r.jsxs("div",{className:"w-64 border-r border-border bg-muted/50 flex flex-col",children:[r.jsx("div",{className:"p-4 border-b border-border",children:r.jsxs("h2",{className:"font-semibold flex items-center gap-2 text-foreground",children:[r.jsx(To,{className:"w-5 h-5"}),"Documentation"]})}),r.jsx(Ys,{className:"flex-1",children:r.jsx("div",{className:"p-2",children:KH.map(u=>r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{className:Ne("w-full flex items-center gap-2 px-3 py-2 text-sm rounded-md hover:bg-accent text-left",(e===u.id||u.subsections.some(l=>l.id===e))&&"bg-accent"),onClick:()=>{u.subsections.length>0?(o(u.id),s[u.id]||t(u.subsections[0].id)):t(u.id)},children:[r.jsx(u.icon,{className:"w-4 h-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1",children:u.title}),u.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"}),u.subsections.length>0&&r.jsx(xs,{className:Ne("w-4 h-4 text-muted-foreground transition-transform",s[u.id]&&"rotate-90")})]}),u.subsections.length>0&&s[u.id]&&r.jsx("div",{className:"ml-6 mt-1 space-y-1",children:u.subsections.map(l=>r.jsx("button",{className:Ne("w-full text-left px-3 py-1.5 text-sm rounded-md hover:bg-accent text-foreground",e===l.id&&"bg-accent text-primary font-medium"),onClick:()=>t(l.id),children:l.title},l.id))})]},u.id))})})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(Ys,{className:"h-full",children:r.jsx("div",{className:"max-w-3xl mx-auto p-8",children:c?r.jsx("div",{className:"prose prose-sm max-w-none",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:y2(c.content)}})}):r.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[r.jsx(To,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a topic from the sidebar"})]})})})})]})}var mW={};const g_={development:"bg-blue-100 text-blue-700 border-blue-200 dark:bg-blue-900/30 dark:text-blue-400 dark:border-blue-800",productivity:"bg-green-100 text-green-700 border-green-200 dark:bg-green-900/30 dark:text-green-400 dark:border-green-800",integration:"bg-purple-100 text-purple-700 border-purple-200 dark:bg-purple-900/30 dark:text-purple-400 dark:border-purple-800",external:"bg-orange-100 text-orange-700 border-orange-200 dark:bg-orange-900/30 dark:text-orange-400 dark:border-orange-800",lsp:"bg-cyan-100 text-cyan-700 border-cyan-200 dark:bg-cyan-900/30 dark:text-cyan-400 dark:border-cyan-800",default:"bg-gray-100 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-700"};function pW(){var ae,ne,Z,le,Se,Le,Ue;const[e,t]=_.useState(!0),[s,n]=_.useState({allPlugins:[],categories:[],marketplaces:[],enabledPlugins:null}),[o,c]=_.useState(""),[u,l]=_.useState([]),[d,f]=_.useState([]),[m,h]=_.useState(!0),[g,w]=_.useState(!0),[j,S]=_.useState(!0),[v,y]=_.useState(!0),[x,b]=_.useState("name"),[k,E]=_.useState(null),[P,A]=_.useState({open:!1,repo:""}),[N,M]=_.useState(!1),[D,O]=_.useState({open:!1,plugin:null}),[$,V]=_.useState(!1),X=async()=>{t(!0);try{const pe=await ue.getPlugins();n(pe)}catch(pe){K.error("Failed to load plugins: "+pe.message)}finally{t(!1)}};_.useEffect(()=>{X()},[]);const W=_.useMemo(()=>{let pe=s.allPlugins||[];if(o){const be=o.toLowerCase();pe=pe.filter(Fe=>{var qe,Xe,Et;return((qe=Fe.name)==null?void 0:qe.toLowerCase().includes(be))||((Xe=Fe.description)==null?void 0:Xe.toLowerCase().includes(be))||((Et=Fe.category)==null?void 0:Et.toLowerCase().includes(be))})}return pe=pe.filter(be=>!(be.sourceType==="external"&&!g||be.sourceType==="internal"&&!m)),pe=pe.filter(be=>!(be.installed&&!j||!be.installed&&!v)),u.length>0&&(pe=pe.filter(be=>u.includes(be.category))),d.length>0&&(pe=pe.filter(be=>d.includes(be.marketplace))),pe.sort((be,Fe)=>{if(x==="installed"){if(be.installed&&!Fe.installed)return-1;if(!be.installed&&Fe.installed)return 1}if(x==="category"){const qe=(be.category||"zzz").localeCompare(Fe.category||"zzz");if(qe!==0)return qe}return be.name.localeCompare(Fe.name)}),pe},[s.allPlugins,o,g,m,j,v,u,d,x]),z=pe=>{l(be=>be.includes(pe)?be.filter(Fe=>Fe!==pe):[...be,pe])},Y=pe=>{f(be=>be.includes(pe)?be.filter(Fe=>Fe!==pe):[...be,pe])},G=async pe=>{E(pe);try{const be=await ue.refreshMarketplace(pe);be.success?(K.success(`Refreshed ${pe}`),await X()):K.error(be.error||"Failed to refresh marketplace")}catch(be){K.error("Failed to refresh: "+be.message)}finally{E(null)}},L=async()=>{if(!P.repo.trim()){K.error("Please enter a repository URL");return}try{const pe=await ue.addMarketplace("",P.repo.trim());pe.success?(K.success("Marketplace added"),A({open:!1,repo:""}),await X()):K.error(pe.error||"Failed to add marketplace")}catch(pe){K.error("Failed to add marketplace: "+pe.message)}},R=async(pe,be,Fe)=>{V(!0);try{const qe=Fe!==!0,Xe=await ue.setPluginEnabled(pe,be,qe);Xe.success?(K.success(`Plugin ${qe?"enabled":"disabled"} for ${pe===mW.HOME?"~":pe}`),await X()):K.error(Xe.error||"Failed to update plugin state")}catch(qe){K.error("Failed to update plugin: "+qe.message)}finally{V(!1)}},B=async(pe,be)=>{V(!0);try{const Fe=await ue.setPluginEnabled(pe,be,null);Fe.success?(K.success("Plugin override removed"),await X()):K.error(Fe.error||"Failed to remove override")}catch(Fe){K.error("Failed to update plugin: "+Fe.message)}finally{V(!1)}},q=pe=>{O({open:!0,plugin:pe})},F=(s.allPlugins||[]).filter(pe=>pe.installed).length,ee=(s.allPlugins||[]).filter(pe=>!pe.installed).length,ce=(s.allPlugins||[]).filter(pe=>pe.sourceType==="internal").length,me=(s.allPlugins||[]).filter(pe=>pe.sourceType==="external").length,J=s.marketplaces||[],H=s.categories||[];return e?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(Ze,{className:"w-8 h-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-indigo-50 dark:bg-indigo-950/30 border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 flex items-start gap-3",children:[r.jsx(Ju,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-indigo-800 dark:text-indigo-300",children:[r.jsx("p",{className:"font-medium",children:"Install plugins from Project Explorer"}),r.jsxs("p",{className:"text-indigo-600 dark:text-indigo-400 mt-1",children:["Use the ",r.jsx("kbd",{className:"px-1.5 py-0.5 bg-indigo-100 dark:bg-indigo-900 rounded text-xs",children:"+"}),' menu on any project and select "Install Plugins" to add plugins with project-level scope control.']})]})]}),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-5 border-b border-gray-200 dark:border-slate-700",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[r.jsx(Io,{className:"w-5 h-5 text-indigo-600"}),"Plugin Directory",r.jsxs(et,{variant:"outline",className:"ml-2 font-normal",children:[W.length," of ",((ae=s.allPlugins)==null?void 0:ae.length)||0]})]}),r.jsx(re,{variant:"ghost",size:"sm",onClick:X,disabled:e,children:r.jsx(Tr,{className:`w-4 h-4 ${e?"animate-spin":""}`})})]}),r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Pc,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),r.jsx(at,{value:o,onChange:pe=>c(pe.target.value),placeholder:"Search plugins...",className:"pl-9 bg-white dark:bg-slate-900 border-gray-300 dark:border-slate-700"})]}),r.jsxs(Br,{value:x,onValueChange:b,children:[r.jsx(Pr,{className:"w-40",children:r.jsx($r,{placeholder:"Sort by"})}),r.jsxs(Ar,{children:[r.jsx(Ft,{value:"name",children:"Name"}),r.jsx(Ft,{value:"installed",children:"Installed first"}),r.jsx(Ft,{value:"category",children:"Category"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1",children:[r.jsx(Xd,{className:"w-3 h-3"}),"Marketplace",d.length>0&&r.jsx(et,{variant:"secondary",className:"ml-1 h-4 px-1 text-[10px]",children:d.length}),r.jsx(vr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(dn,{align:"start",className:"w-56",children:[r.jsx(xc,{className:"text-xs",children:"Filter by marketplace"}),r.jsx(gs,{}),J.length>0?J.map(pe=>r.jsx(gc,{checked:d.includes(pe.name),onCheckedChange:()=>Y(pe.name),children:pe.name},pe.name)):r.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No marketplaces"}),r.jsx(gs,{}),r.jsxs(Nt,{onClick:()=>M(!0),children:[r.jsx(un,{className:"w-3 h-3 mr-2"}),"Manage Marketplaces"]}),d.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(gs,{}),r.jsx(Nt,{onClick:()=>f([]),children:"Clear filters"})]})]})]}),r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1",children:[r.jsx(Mg,{className:"w-3 h-3"}),"Category",u.length>0&&r.jsx(et,{variant:"secondary",className:"ml-1 h-4 px-1 text-[10px]",children:u.length}),r.jsx(vr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(dn,{align:"start",className:"w-48",children:[r.jsx(xc,{className:"text-xs",children:"Filter by category"}),r.jsx(gs,{}),H.map(pe=>r.jsx(gc,{checked:u.includes(pe),onCheckedChange:()=>z(pe),children:pe},pe)),u.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(gs,{}),r.jsx(Nt,{onClick:()=>l([]),children:"Clear filters"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(ut,{checked:j,onCheckedChange:S,className:"h-4 w-7 data-[state=checked]:bg-green-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400",children:["Installed (",F,")"]})]}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(ut,{checked:v,onCheckedChange:y,className:"h-4 w-7 data-[state=checked]:bg-blue-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400",children:["Available (",ee,")"]})]}),r.jsx("span",{className:"text-gray-300 dark:text-slate-600",children:"|"}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(ut,{checked:m,onCheckedChange:h,className:"h-4 w-7 data-[state=checked]:bg-indigo-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400 flex items-center gap-1",children:[r.jsx(tC,{className:"w-3 h-3"})," Anthropic (",ce,")"]})]}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(ut,{checked:g,onCheckedChange:w,className:"h-4 w-7 data-[state=checked]:bg-orange-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400 flex items-center gap-1",children:[r.jsx(Yi,{className:"w-3 h-3"})," Community (",me,")"]})]})]})]})]}),r.jsxs("div",{className:"p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[W.map((pe,be)=>{const Fe=g_[pe.category]||g_.default,qe=pe.mcpServers?Object.keys(pe.mcpServers).length:0,Xe=pe.lspServers?Object.keys(pe.lspServers).length:0,Et=`${pe.name}@${pe.marketplace}`,_e=pe.enabledState,he=(_e==null?void 0:_e.merged)===!0;return(_e==null?void 0:_e.merged)!==null&&(_e==null||_e.merged),r.jsxs(Ma.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:Math.min(be*.02,.3)},className:`rounded-lg border p-4 transition-all hover:shadow-md ${he?"bg-emerald-50 border-emerald-200 dark:bg-emerald-950/20 dark:border-emerald-800":pe.installed?"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-800":"bg-white border-gray-200 dark:bg-slate-900 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:pe.name}),pe.sourceType==="external"&&r.jsx(Yi,{className:"w-3.5 h-3.5 text-orange-500 flex-shrink-0",title:"Community plugin"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[pe.installed&&r.jsxs(et,{variant:"outline",className:"text-green-600 border-green-300 dark:text-green-400 dark:border-green-700 text-[10px]",children:[r.jsx(Dt,{className:"w-2.5 h-2.5 mr-0.5"}),"Installed"]}),he&&r.jsxs(et,{variant:"outline",className:"text-emerald-600 border-emerald-300 dark:text-emerald-400 dark:border-emerald-700 text-[10px]",children:[r.jsx(Db,{className:"w-2.5 h-2.5 mr-0.5"}),"Enabled"]})]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[pe.installed&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-60 hover:opacity-100",onClick:()=>q(pe),children:r.jsx(un,{className:"w-4 h-4"})})}),r.jsx(It,{children:r.jsx("p",{children:"Configure per-directory"})})]})}),pe.homepage&&r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-60 hover:opacity-100",onClick:()=>window.open(pe.homepage,"_blank"),children:r.jsx(fu,{className:"w-4 h-4"})})]})]}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-3 line-clamp-2",children:pe.description||"No description available"}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-2",children:[pe.category&&r.jsx(et,{variant:"outline",className:`text-[10px] px-1.5 py-0 ${Fe}`,children:pe.category}),pe.version&&r.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-slate-500",children:["v",pe.version]})]}),(qe>0||Xe>0||pe.commands)&&r.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-gray-500 dark:text-slate-500 pt-2 border-t border-gray-100 dark:border-slate-800",children:[Xe>0&&r.jsxs("span",{className:"flex items-center gap-1 bg-cyan-50 dark:bg-cyan-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(Gn,{className:"w-3 h-3 text-cyan-600"}),Xe," LSP"]}),qe>0&&r.jsxs("span",{className:"flex items-center gap-1 bg-blue-50 dark:bg-blue-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(vs,{className:"w-3 h-3 text-blue-600"}),qe," MCP"]}),pe.commands&&r.jsxs("span",{className:"flex items-center gap-1 bg-green-50 dark:bg-green-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(Kt,{className:"w-3 h-3 text-green-600"}),"Commands"]})]})]},Et)}),W.length===0&&r.jsxs("div",{className:"col-span-full text-center py-12 text-gray-500 dark:text-slate-400",children:[r.jsx(Io,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{className:"font-medium",children:"No plugins found"}),r.jsx("p",{className:"text-sm mt-1",children:"Try adjusting your filters or search query"}),(u.length>0||d.length>0||o)&&r.jsx(re,{variant:"link",size:"sm",onClick:()=>{l([]),f([]),c("")},className:"mt-2",children:"Clear all filters"})]})]})]}),r.jsx(vt,{open:P.open,onOpenChange:pe=>A({...P,open:pe}),children:r.jsxs(ht,{className:"max-w-lg",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Xd,{className:"w-5 h-5 text-purple-600"}),"Add Plugin Marketplace"]}),r.jsx(tr,{children:"Add a marketplace from a GitHub repository URL or local path."})]}),r.jsx("div",{className:"space-y-4 py-4",children:r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Repository URL or Path"}),r.jsx(at,{value:P.repo,onChange:pe=>A({...P,repo:pe.target.value}),placeholder:"owner/repo or full GitHub URL",className:"mt-1"}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-2",children:"Supported formats:"}),r.jsxs("ul",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1 space-y-1 ml-2",children:[r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"owner/repo"})," — GitHub shorthand"]}),r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"https://github.com/owner/repo"})," — Full URL"]}),r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"/local/path"})," — Local directory"]})]}),r.jsxs("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-2",children:["Search GitHub for ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"claude-plugins"})," to find community marketplaces."]})]})}),r.jsxs(St,{children:[r.jsx(re,{variant:"ghost",onClick:()=>A({open:!1,repo:""}),children:"Cancel"}),r.jsxs(re,{onClick:L,className:"bg-purple-600 hover:bg-purple-700 text-white",children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Add Marketplace"]})]})]})}),r.jsx(vt,{open:N,onOpenChange:M,children:r.jsxs(ht,{className:"max-w-2xl",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Xd,{className:"w-5 h-5 text-purple-600"}),"Plugin Marketplaces",r.jsx(et,{variant:"outline",className:"ml-2 font-normal",children:J.length})]}),r.jsx(tr,{children:"Manage your plugin marketplaces. Add external marketplaces to discover more plugins."})]}),r.jsx("div",{className:"py-4",children:J.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:J.map(pe=>{var Fe,qe,Xe;const be=(((Fe=pe.plugins)==null?void 0:Fe.length)||0)+(((qe=pe.externalPlugins)==null?void 0:qe.length)||0);return r.jsxs("div",{className:"bg-purple-50 dark:bg-purple-950/20 rounded-lg border border-purple-200 dark:border-purple-800 p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h3",{className:"font-semibold text-purple-900 dark:text-purple-200",children:pe.name}),r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>G(pe.name),disabled:k===pe.name,className:"h-7 w-7 p-0",children:r.jsx(Tr,{className:`w-4 h-4 text-purple-600 dark:text-purple-400 ${k===pe.name?"animate-spin":""}`})})]}),r.jsx("p",{className:"text-sm text-purple-700 dark:text-purple-300 mb-2 truncate",children:typeof pe.source=="string"?pe.source:((Xe=pe.source)==null?void 0:Xe.repo)||"Unknown source"}),r.jsxs("div",{className:"flex items-center justify-between text-xs text-purple-600 dark:text-purple-400",children:[r.jsxs("span",{children:[be," plugins"]}),pe.lastUpdated&&r.jsxs("span",{children:["Updated: ",new Date(pe.lastUpdated).toLocaleDateString()]})]})]},pe.name)})}):r.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-slate-400",children:[r.jsx(Xd,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No marketplaces configured."}),r.jsx("p",{className:"text-sm mt-1",children:"Add a marketplace to discover plugins."})]})}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>M(!1),children:"Close"}),r.jsxs(re,{onClick:()=>{M(!1),A({open:!0,repo:""})},className:"bg-purple-600 hover:bg-purple-700 text-white",children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Add Marketplace"]})]})]})}),r.jsx(vt,{open:D.open,onOpenChange:pe=>O({...D,open:pe}),children:r.jsxs(ht,{className:"max-w-lg",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Mb,{className:"w-5 h-5 text-emerald-600"}),"Configure Plugin: ",(ne=D.plugin)==null?void 0:ne.name]}),r.jsx(tr,{children:"Enable or disable this plugin for specific directories. Child directories inherit parent settings unless overridden."})]}),r.jsxs("div",{className:"space-y-3 py-4 max-h-[400px] overflow-y-auto",children:[(Se=(le=(Z=D.plugin)==null?void 0:Z.enabledState)==null?void 0:le.perDir)==null?void 0:Se.map((pe,be)=>{const Fe=`${D.plugin.name}@${D.plugin.marketplace}`,qe=pe.enabled!==null&&pe.enabled!==void 0,Xe=pe.enabled===!0,Et=pe.enabled===!1;let _e=null;if(!qe&&be>0)for(let he=be-1;he>=0;he--){const ye=D.plugin.enabledState.perDir[he];if(ye.enabled!==null&&ye.enabled!==void 0){_e=ye.enabled;break}}return r.jsxs("div",{className:`flex items-center justify-between p-3 rounded-lg border ${Xe?"bg-emerald-50 border-emerald-200 dark:bg-emerald-950/30 dark:border-emerald-800":Et?"bg-red-50 border-red-200 dark:bg-red-950/30 dark:border-red-800":"bg-gray-50 border-gray-200 dark:bg-slate-800/50 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:pe.label}),!qe&&_e!==null&&r.jsxs(et,{variant:"outline",className:"text-[10px] text-gray-500",children:["inherited: ",_e?"on":"off"]})]}),qe&&r.jsx("p",{className:"text-[10px] text-gray-500 dark:text-slate-400 mt-0.5",children:Xe?"Explicitly enabled":"Explicitly disabled"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[qe&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-gray-400 hover:text-gray-600",onClick:()=>B(pe.dir,Fe),disabled:$,children:r.jsx(EM,{className:"w-4 h-4"})})}),r.jsx(It,{children:r.jsx("p",{children:"Remove override (inherit from parent)"})})]})}),r.jsxs("div",{className:"flex items-center gap-1 border rounded-lg overflow-hidden",children:[r.jsx(re,{variant:Xe?"default":"ghost",size:"sm",className:`h-7 px-2 rounded-none ${Xe?"bg-emerald-600 hover:bg-emerald-700 text-white":""}`,onClick:()=>R(pe.dir,Fe,!1),disabled:$||Xe,children:r.jsx(Db,{className:"w-3 h-3"})}),r.jsx(re,{variant:Et?"default":"ghost",size:"sm",className:`h-7 px-2 rounded-none ${Et?"bg-red-600 hover:bg-red-700 text-white":""}`,onClick:()=>R(pe.dir,Fe,!0),disabled:$||Et,children:r.jsx(UM,{className:"w-3 h-3"})})]})]})]},pe.dir)}),(!((Ue=(Le=D.plugin)==null?void 0:Le.enabledState)!=null&&Ue.perDir)||D.plugin.enabledState.perDir.length===0)&&r.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-slate-400",children:[r.jsx(Mb,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No config hierarchy found."}),r.jsx("p",{className:"text-sm mt-1",children:"Create a .claude/mcps.json in your project first."})]})]}),r.jsx(St,{children:r.jsx(re,{variant:"ghost",onClick:()=>O({open:!1,plugin:null}),children:"Done"})})]})}),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 (Claude Code)"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{className:"text-gray-400 dark:text-slate-500",children:"# Add marketplace (one-time)"}),r.jsx("p",{children:"claude plugin marketplace add regression-io/coder-config-plugins"}),r.jsx("p",{className:"text-gray-400 dark:text-slate-500 mt-2",children:"# Install plugins from marketplace"}),r.jsx("p",{children:"claude plugin install <name>@coder-config-plugins"}),r.jsx("p",{className:"text-gray-400 dark:text-slate-500 mt-2",children:"# Manage plugins"}),r.jsx("p",{children:"claude plugin list # List installed"}),r.jsx("p",{children:"claude plugin uninstall <name> # Remove plugin"})]})]})]})}function gW({onWorkstreamChange:e}){var io,Tn,Ko,oo,Zn,fs,ao,Mr;const{projects:t,fetch:s}=Px(),{workstreams:n,loading:o,fetch:c,create:u,update:l,delete:d,addProject:f,removeProject:m,countWorkstreamsForProject:h}=bN(),[g,w]=_.useState(null),[j,S]=_.useState(!1),[v,y]=_.useState(null),[x,b]=_.useState(!1),[k,E]=_.useState(null),[P,A]=_.useState(new Set),[N,M]=_.useState(""),[D,O]=_.useState(""),[$,V]=_.useState([]),[X,W]=_.useState(!1),[z,Y]=_.useState(!1),[G,L]=_.useState({}),[R,B]=_.useState({}),[q,F]=_.useState({}),[ee,ce]=_.useState({isInstalled:!1,loading:!0}),[me,J]=_.useState(!1),[H,ae]=_.useState(null),[ne,Z]=_.useState([]),[le,Se]=_.useState(!1),[Le,Ue]=_.useState(()=>{try{return JSON.parse(localStorage.getItem("dismissedWorkstreamSuggestions")||"[]")}catch{return[]}}),[pe,be]=_.useState(!1),[Fe,qe]=_.useState(""),[Xe,Et]=_.useState([]),[_e,he]=_.useState("llama3.2"),[ye,Ie]=_.useState(null),[de,we]=_.useState(""),[Ae,$e]=_.useState(!1),[Ke,jt]=_.useState({installed:!1,loading:!0}),[ot,ur]=_.useState({workstreamAutoActivate:!0}),[Rr,Vr]=_.useState(!1),[Jt,Sr]=_.useState(!1),[Wt,yr]=_.useState(null),[us,Qr]=_.useState("");_.useEffect(()=>{c(),s(),zt(),rr(),Os(),nt(),Ls()},[c,s]);const Ls=async()=>{try{const Q=await ue.getAvailableAITools();Q.success&&Q.tools&&(Et(Q.tools),Q.tools.find(Ge=>Ge.id==="claude"&&Ge.available)&&qe("claude"))}catch(Q){console.error("Failed to load AI tools:",Q)}},Os=async()=>{try{const Q=await ue.getCdHookStatus();jt({...Q,loading:!1})}catch(Q){jt({installed:!1,loading:!1,error:Q.message})}},nt=async()=>{try{const Q=await ue.getWorkstreamSettings();ur(Q.settings||{workstreamAutoActivate:!0})}catch(Q){console.error("Failed to load global settings:",Q)}},zt=async()=>{try{const Q=await ue.getWorkstreamHookStatus();ce({...Q,loading:!1})}catch(Q){ce({isInstalled:!1,loading:!1,error:Q.message})}},rr=async()=>{try{Se(!0);const[Q,De]=await Promise.all([ue.getActivitySummary(),ue.getWorkstreamSuggestions()]);ae(Q),Z(De.suggestions||[])}catch(Q){console.log("Activity data not available:",Q.message)}finally{Se(!1)}},ar=Q=>{M(Q.name),V([...Q.projects]),O(`# Auto-generated workstream based on activity patterns
2994
2994
 
2995
2995
  These projects are frequently worked on together.`),S(!0)},_s=Q=>{V(De=>De.filter(Ge=>Ge!==Q))},Vt=Q=>{$.includes(Q)||V(De=>[...De,Q])},Ut=async Q=>{const De=G[Q];if(!De&&!R[Q]){F(Ge=>({...Ge,[Q]:!0}));try{const Ge=await ue.getSubprojects(Q);B(Ct=>({...Ct,[Q]:Ge.subprojects||[]}))}catch(Ge){console.error("Failed to load subprojects:",Ge),B(Ct=>({...Ct,[Q]:[]}))}finally{F(Ge=>({...Ge,[Q]:!1}))}}L(Ge=>({...Ge,[Q]:!De}))},Ur=Q=>{const De=Q.projects.sort().join("|"),Ge=[...Le,De];Ue(Ge),localStorage.setItem("dismissedWorkstreamSuggestions",JSON.stringify(Ge)),Z(Ct=>Ct.filter($t=>$t.projects.sort().join("|")!==De)),K.success("Suggestion dismissed")},dt=ne.filter(Q=>{const De=Q.projects.sort().join("|");return!Le.includes(De)}),hr=async()=>{if(confirm("Clear activity data older than 30 days?"))try{const Q=await ue.clearActivity(30);Q.success&&(K.success(`Cleared ${Q.cleared} old entries`),rr())}catch(Q){K.error("Failed to clear activity: "+Q.message)}},hs=async(Q,De)=>{var Ge;if(!Q||Q.length===0){K.error("Add projects first to generate rules");return}be(!0);try{const Ct=Fe==="ollama"?{model:_e}:{},$t=await ue.generateWorkstreamRules(Q,Fe||!1,Ct);if($t.success&&$t.rules){De($t.rules);const kt=((Ge=Xe.find(sr=>sr.id===Fe))==null?void 0:Ge.name)||"AI";K.success(Fe?`Generated rules with ${kt}`:"Generated rules from repos")}else K.error($t.error||"Failed to generate rules")}catch(Ct){K.error("Failed to generate rules: "+Ct.message)}finally{be(!1)}},Zr=async()=>{J(!0);try{const Q=await ue.installWorkstreamHook();Q.success?(K.success(Q.message),ce(De=>({...De,isInstalled:!0}))):K.error(Q.error||"Failed to install hook")}catch(Q){K.error("Failed to install hook: "+Q.message)}finally{J(!1)}},Qe=async()=>{Vr(!0);try{const Q=await ue.installCdHook();Q.success?(K.success("CD hook installed. Restart your shell to activate."),jt(De=>({...De,installed:!0}))):K.error(Q.error||"Failed to install CD hook")}catch(Q){K.error("Failed to install CD hook: "+Q.message)}finally{Vr(!1)}},fn=async()=>{Vr(!0);try{const Q=await ue.uninstallCdHook();Q.success?(K.success("CD hook uninstalled. Restart your shell to apply."),jt(De=>({...De,installed:!1}))):K.error(Q.error||"Failed to uninstall CD hook")}catch(Q){K.error("Failed to uninstall CD hook: "+Q.message)}finally{Vr(!1)}},ll=async()=>{const Q=!ot.workstreamAutoActivate;try{await ue.setGlobalAutoActivate(Q),ur(De=>({...De,workstreamAutoActivate:Q})),K.success(`Auto-activation ${Q?"enabled":"disabled"}`)}catch(De){K.error("Failed to update setting: "+De.message)}},es=async(Q,De)=>{try{(await ue.setWorkstreamAutoActivate(Q.id,De)).success&&(await c(),K.success(`Auto-activate ${De} for ${Q.name}`))}catch(Ge){K.error("Failed to update: "+Ge.message)}},wi=async()=>{if(!(!Wt||!us.trim()))try{(await ue.addTriggerFolder(Wt.id,us.trim())).success&&(await c(),K.success("Trigger folder added"),Sr(!1),Qr(""),yr(null))}catch(Q){K.error("Failed to add trigger folder: "+Q.message)}},mn=async(Q,De)=>{try{(await ue.removeTriggerFolder(Q.id,De)).success&&(await c(),K.success("Trigger folder removed"))}catch(Ge){K.error("Failed to remove trigger folder: "+Ge.message)}},Cr=()=>c(),so=async()=>{if(!N.trim()){K.error("Name is required");return}W(!0);const Q=await u(N.trim(),$,D);Q.success?(K.success(`Created workstream: ${N}`),S(!1),M(""),O(""),V([]),Z(De=>De.filter(Ge=>Ge.name!==N.trim()))):K.error(Q.error||"Failed to create workstream"),W(!1)},Wo=async Q=>{if(!confirm(`Delete workstream "${Q.name}"?
2996
2996
 
@@ -3033,6 +3033,8 @@ Then we'll move to MCP servers. These give your AI coding tools new abilities—
3033
3033
 
3034
3034
  After that, we'll cover permissions (controlling what your AI can do without asking), memory (helping it remember things), and plugins (pre-built configurations you can install with a click).
3035
3035
 
3036
+ We'll also cover multi-tool support—how to sync your configuration across Claude Code, Gemini CLI, Codex CLI, and Antigravity so you configure once and use everywhere.
3037
+
3036
3038
  Finally, we'll tackle workstreams—the feature that makes working across multiple repos actually pleasant. If you've ever had to re-explain how your API and frontend connect every time you start a new session, workstreams solve that.
3037
3039
 
3038
3040
  Each section takes about five minutes. You can stop anytime and pick up where you left off.
@@ -3063,60 +3065,24 @@ With a project added, let's look at what you can do with it.
3063
3065
 
3064
3066
  ### The Project Explorer
3065
3067
 
3066
- Click **Project Explorer** in the sidebar. This is your window into your project's your AI configuration. If the project has a \`.claude\` folder, you'll see its contents laid out as a file tree. If there's no \`.claude\` folder yet, you'll see a prompt to create one.
3068
+ Click **Project Explorer** in the sidebar. This is your window into your project's AI configuration. If the project has a \`.claude\` folder, you'll see its contents laid out as a file tree. If there's no \`.claude\` folder yet, you'll see options to create config files that will set it up for you.
3067
3069
 
3068
- The explorer shows the files your AI cares about: rules in the \`rules/\` folder, skills in \`commands/\`, MCP configurations, and local settings. You can click any file to view or edit it right in the browser. Right-click for more options—rename, duplicate, delete.
3070
+ The explorer shows the configuration files that matter: rules in the \`rules/\` folder, skills in \`commands/\`, MCP configurations, and local settings. You can click any file to view or edit it right in the browser.
3069
3071
 
3070
3072
  ### Project Information
3071
3073
 
3072
- Above the file tree, there's a summary panel. It shows the project's name, its path, and quick stats like how many rules you have configured. You'll also find buttons to open the project in VS Code or jump to it in your terminal.
3074
+ Above the file tree, there's a summary panel showing the project's name, its path, and quick stats like how many rules you have configured.
3073
3075
 
3074
3076
  ### When There's No .claude Folder
3075
3077
 
3076
- New projects don't have your AI configuration yet. That's fine. The Project Explorer will offer to initialize one for you, creating the basic folder structure. Or you can create it manually—it's just folders and files, nothing special about them.
3078
+ New projects don't have AI configuration yet. That's fine. In the Project Explorer, use the **+** menu on your project folder to create config files like \`mcps.json\`, rules, or settings. The \`.claude\` folder gets created automatically when you add your first config file. Or you can create it manually—it's just folders and files, nothing special about them.
3077
3079
 
3078
3080
  ### Editing Configuration Files
3079
3081
 
3080
- The built-in editor handles the file formats your AI uses: markdown for rules, JSON for MCP configs and settings. Changes save automatically when you navigate away, though you can also save explicitly. The editor is simple by design—for complex editing, use the "Open in VS Code" button.
3082
+ The built-in editor handles the file formats your tools use: markdown for rules, JSON for MCP configs and settings. Changes save automatically when you navigate away, though you can also save explicitly.
3081
3083
 
3082
3084
  Let's create the \`.claude\` folder in the next section, then start writing rules.
3083
- `},"claude-folder":{title:"The .claude Folder",content:`
3084
- The \`.claude\` folder is where your project's your AI configuration lives. Everything your AI needs to know about your project—how you want it to behave, what tools it can use, what patterns to follow—goes here.
3085
-
3086
- ### Creating the Folder
3087
-
3088
- If your project doesn't have a \`.claude\` folder yet, go to Project Explorer and click **Initialize .claude**. This creates the folder with a basic structure:
3089
-
3090
- \`\`\`
3091
- .claude/
3092
- ├── rules/ # Markdown files with guidelines
3093
- ├── commands/ # Skills (reusable prompts)
3094
- ├── settings.local.json # Project-specific settings
3095
- └── mcps.json # MCP server configurations
3096
- \`\`\`
3097
-
3098
- You can also create this manually if you prefer—it's just regular folders and files.
3099
-
3100
- ### What Each Piece Does
3101
-
3102
- The \`rules/\` folder contains markdown files that tell your AI about your project. These are instructions, conventions, things to avoid—any guidance you'd give a new team member. your AI reads them at the start of every session.
3103
-
3104
- The \`commands/\` folder holds skills—reusable prompts you can invoke with slash commands. If you find yourself typing the same instructions over and over, turn them into a skill.
3105
-
3106
- The \`settings.local.json\` file stores project-specific settings that override global defaults. And \`mcps.json\` defines which MCP servers this project uses.
3107
-
3108
- ### The CLAUDE.md Alternative
3109
-
3110
- There's another option: create a \`CLAUDE.md\` file in your project root (not inside \`.claude/\`). your AI reads this automatically too. Some developers prefer this because it's more visible—right there at the top level where everyone can see it.
3111
-
3112
- You can use both. The \`CLAUDE.md\` file works well for high-level project context, while the \`.claude/rules/\` folder suits more detailed, categorized guidelines.
3113
-
3114
- ### Should You Commit It?
3115
-
3116
- Generally, yes. Committing your \`.claude\` folder means everyone on your team gets the same your AI experience. The one exception is \`settings.local.json\`—that's for personal preferences and should probably stay in your \`.gitignore\`.
3117
-
3118
- Now that you have the structure in place, let's learn about rules—the most powerful way to configure your AI for your project.
3119
- `}},AW={"what-are-rules":{title:"What Are Rules?",content:`
3085
+ `},"claude-folder":{title:"The .claude Folder",content:"\nThe `.claude` folder is where your project's AI configuration lives. Everything your AI needs to know about your project—how you want it to behave, what tools it can use, what patterns to follow—goes here.\n\n### Creating the Folder\n\nIf your project doesn't have a `.claude` folder yet, go to Project Explorer and use the **+** menu on your project folder. Creating any config file (like a rule or `mcps.json`) will automatically create the `.claude` folder. The typical structure looks like this:\n\n```\n.claude/\n├── rules/ # Markdown files with guidelines\n├── commands/ # Skills (reusable prompts)\n├── settings.local.json # Project-specific settings\n└── mcps.json # MCP server configurations\n```\n\nYou can also create this manually if you prefer—it's just regular folders and files.\n\n### What Each Piece Does\n\nThe `rules/` folder contains markdown files that tell your AI about your project. These are instructions, conventions, things to avoid—any guidance you'd give a new team member. They're read at the start of every session.\n\nThe `commands/` folder holds skills—reusable prompts you can invoke with slash commands. If you find yourself typing the same instructions over and over, turn them into a skill.\n\nThe `settings.local.json` file stores project-specific settings that override global defaults. And `mcps.json` defines which MCP servers this project uses.\n\n### The CLAUDE.md Alternative\n\nThere's another option: create a `CLAUDE.md` file in your project root (not inside `.claude/`). Your AI reads this automatically too. Some developers prefer this because it's more visible—right there at the top level where everyone can see it.\n\nYou can use both. The `CLAUDE.md` file works well for high-level project context, while the `.claude/rules/` folder suits more detailed, categorized guidelines.\n\n### Should You Commit It?\n\nGenerally, yes. Committing your `.claude` folder means everyone on your team gets the same AI-assisted experience. The one exception is `settings.local.json`—that's for personal preferences and should probably stay in your `.gitignore`.\n\nNow that you have the structure in place, let's learn about rules—the most powerful way to configure your AI for your project.\n "}},AW={"what-are-rules":{title:"What Are Rules?",content:`
3120
3086
  Rules are instructions for your AI assistant written in plain Markdown. They tell it things about your project—how it's structured, what coding conventions to follow, what to avoid. Think of them as persistent context that gets loaded before every conversation.
3121
3087
 
3122
3088
  ### How Rules Work
@@ -3253,7 +3219,7 @@ Click **MCP Registry** in the sidebar. This shows MCPs from the global registry
3253
3219
 
3254
3220
  ### Adding to Your Project
3255
3221
 
3256
- On the MCP detail page, you'll see an **Add to Project** button. Click it. This adds the MCP to your current project's configuration, stored in \`.claude/mcps.json\`.
3222
+ From the MCP Registry, you can add any MCP to the global registry. To add it to a specific project, go to **Project Explorer**, open the project's \`mcps.json\` file, and click **+ Add MCP**. Select from registry MCPs or add a custom one. The MCP gets stored in your project's \`.claude/mcps.json\`.
3257
3223
 
3258
3224
  ### Configuration
3259
3225
 
@@ -3274,7 +3240,7 @@ Change \`/path/to/allowed/directory\` to an actual path on your system—maybe \
3274
3240
 
3275
3241
  ### Applying the Configuration
3276
3242
 
3277
- After configuring, click **Re-apply Config** in the header. This updates the generated config files that your AI reads. If your AI tool is already running, restart it so it picks up the new MCP.
3243
+ After configuring, click **Re-apply** in the header (config also auto-applies on save). This updates the generated config files that your AI reads. If your AI tool is already running, restart it so it picks up the new MCP.
3278
3244
 
3279
3245
  ### Testing It Works
3280
3246
 
@@ -3307,9 +3273,9 @@ These values are stored locally in your \`.claude/.env\` file. They're never com
3307
3273
 
3308
3274
  ### Global vs Project MCPs
3309
3275
 
3310
- You can configure MCPs at two levels. **Global MCPs** apply to all your projects—configure these in Preferences MCP Servers. Good candidates include the memory MCP for persistent storage across everything, or tools you use universally regardless of project.
3276
+ You can configure MCPs at two levels. **Global MCPs** apply to all your projects—configure these in the Project Explorer's home-level \`mcps.json\` (under \`~/.claude/\`). Good candidates include the memory MCP for persistent storage across everything, or tools you use universally regardless of project.
3311
3277
 
3312
- **Project MCPs** apply to one project only—configure these in the MCP Registry when a project is selected. Good candidates include database connections specific to that project, or API integrations you only need in certain contexts.
3278
+ **Project MCPs** apply to one project only—configure these in your project's \`mcps.json\` via the Project Explorer. Good candidates include database connections specific to that project, or API integrations you only need in certain contexts.
3313
3279
 
3314
3280
  When your AI starts in a project directory, it loads global MCPs first, then adds any project-specific ones.
3315
3281
 
@@ -3349,7 +3315,7 @@ Let's configure permissions for your workflow.
3349
3315
 
3350
3316
  ### Getting to the Permissions Panel
3351
3317
 
3352
- Click **Claude Code** in the sidebar. Scroll to the **Permissions** section. You'll see three columns: Allow, Ask, and Deny. Each shows the rules currently configured for that level.
3318
+ Click **Claude Code** in the sidebar. The **Permissions** tab is shown by default. You'll see three sections: Allow, Ask, and Deny. Each shows the rules currently configured for that level.
3353
3319
 
3354
3320
  ### Adding Rules
3355
3321
 
@@ -3397,7 +3363,7 @@ Preferences describe how you like things done: "I prefer functional components w
3397
3363
 
3398
3364
  ### How Memory Works Technically
3399
3365
 
3400
- Memory is just markdown files. Each file contains entries organized by type—preferences, corrections, facts, patterns, decisions. your AI reads these files when a session starts, incorporating them into its context.
3366
+ Memory is just markdown files. Each file contains entries organized by type—preferences, corrections, facts, patterns, decisions. Your AI reads these files when a session starts, incorporating them into its context.
3401
3367
 
3402
3368
  Here's what an entry looks like:
3403
3369
 
@@ -3417,7 +3383,7 @@ Let's add some memory entries to make your AI smarter about how you work.
3417
3383
 
3418
3384
  ### Accessing the Memory View
3419
3385
 
3420
- Click **Memory** in the sidebar. You'll see two tabs: **Global** and **Project**. Global memory affects all your projects; project memory affects only the current project. Switch between them depending on where the information belongs.
3386
+ Click **Memory** in the sidebar. You'll see tabs for **Global Memory**, **Project Memory**, and **Sync Memory**. Global memory affects all your projects; project memory affects only the current project. Sync memory manages shared state across tools. Switch between them depending on where the information belongs.
3421
3387
 
3422
3388
  ### Adding an Entry
3423
3389
 
@@ -3459,9 +3425,9 @@ A plugin can include any combination of configuration elements. It might have **
3459
3425
 
3460
3426
  ### Why Use Plugins
3461
3427
 
3462
- Writing good your AI configuration takes time. You need to think through conventions, test what works, refine the wording. Plugin authors have done this work already. They've figured out which rules actually help, what patterns your AI follows well, and how to phrase things clearly.
3428
+ Writing good AI configuration takes time. You need to think through conventions, test what works, refine the wording. Plugin authors have done this work already. They've figured out which rules actually help, what patterns work well, and how to phrase things clearly.
3463
3429
 
3464
- Plugins also let you learn from others. When you install a React TypeScript plugin, you're getting someone's refined understanding of how your AI works best with that stack. Even if you customize it later, you start from a much better baseline.
3430
+ Plugins also let you learn from others. When you install a React TypeScript plugin, you're getting someone's refined understanding of how AI assistants work best with that stack. Even if you customize it later, you start from a much better baseline.
3465
3431
 
3466
3432
  ### Where Plugins Come From
3467
3433
 
@@ -3483,27 +3449,19 @@ Click on a plugin card to see its details: what rules it includes, any MCPs it c
3483
3449
 
3484
3450
  ### Installing
3485
3451
 
3486
- Found one you want? Click **Install**. A dialog asks where to install it.
3487
-
3488
- Choosing **project scope** puts the plugin's files into your current project's \`.claude/\` folder. Only this project uses it—good for project-specific plugins.
3489
-
3490
- Choosing **user scope** installs to your global \`~/.claude/\` folder. All your projects can use it—good for plugins you want everywhere.
3452
+ To install a plugin, go to **Project Explorer**, click the **+** menu on your project folder, and choose **Install Plugins**. You'll see a dialog where you can pick from available plugins. Select the ones you want and they'll be added to your project's \`.claude/\` folder.
3491
3453
 
3492
3454
  ### What Happens After Installing
3493
3455
 
3494
- The plugin's files are copied to your chosen location. Rules become active immediately—your AI reads them on the next session. Skills appear in your available slash commands list. MCPs might need additional setup; check the plugin's documentation for any environment variables or configuration needed.
3456
+ The plugin's files are copied into your project configuration. Rules become active immediately—they're loaded on the next session. Skills appear in your available slash commands list. MCPs might need additional setup; check the plugin's documentation for any environment variables or configuration needed.
3495
3457
 
3496
3458
  ### Managing Installed Plugins
3497
3459
 
3498
- Back on the Plugins view, you'll see a section showing what you've installed. You can toggle plugins on and off without uninstalling them—useful for temporarily disabling something. You can uninstall completely if you no longer need a plugin, which deletes the files it added. And when plugin authors release new versions, you can update to get the latest.
3499
-
3500
- ### Per-Directory Control
3501
-
3502
- Here's a powerful feature: you can enable or disable plugins at different levels of your project hierarchy. Maybe you want a plugin globally but turned off for one specific project. Or enabled only for a particular subfolder. The Plugins view lets you set this up.
3460
+ Back on the Plugins view, you'll see a section showing what you've installed. You can uninstall plugins you no longer need, which removes the files they added.
3503
3461
 
3504
3462
  ### Finding More Plugins
3505
3463
 
3506
- The default marketplace is just a starting point. You can add additional marketplaces in Settings Plugin Marketplaces. Community marketplaces, company-internal collections, or your own curated set—add the git repo URL and refresh to see new plugins.
3464
+ The default marketplace is just a starting point. You can add additional marketplaces from the **Plugins** view using **Manage Marketplaces**. Community marketplaces, company-internal collections, or your own curated set—add the git repo URL and refresh to see new plugins.
3507
3465
 
3508
3466
  You can also create your own plugins. The format is straightforward: a git repo with a manifest file and your configuration files. The Plugins view links to documentation if you want to try this.
3509
3467
  `}},DW={"what-are-workstreams":{title:"What Are Workstreams?",content:`
@@ -3511,7 +3469,7 @@ Workstreams solve a problem that anyone working on multi-repo projects knows wel
3511
3469
 
3512
3470
  ### The Multi-Repo Reality
3513
3471
 
3514
- Modern software often spans multiple repositories. You might have a React frontend in one repo, a Node.js API in another, shared TypeScript types in a third, and infrastructure configs in a fourth. These are all part of the same product, but they live in separate folders with separate your AI configurations.
3472
+ Modern software often spans multiple repositories. You might have a React frontend in one repo, a Node.js API in another, shared TypeScript types in a third, and infrastructure configs in a fourth. These are all part of the same product, but they live in separate folders with separate AI configurations.
3515
3473
 
3516
3474
  Every time you switch repos, your AI loses context. It doesn't know that the API you're calling from the frontend lives in that other repo you were just working in. It doesn't remember the database schema you discussed yesterday while working on the backend.
3517
3475
 
@@ -3525,7 +3483,7 @@ When you're working in any repo that belongs to a workstream, your AI automatica
3525
3483
 
3526
3484
  Say you're in the frontend repo and ask your AI to call a new API endpoint. With workstreams, your AI knows the API repo's structure and conventions. It can suggest code that matches how endpoints are actually built there, not just guess based on what it sees in the frontend.
3527
3485
 
3528
- Or you're debugging an issue that spans both repos. your AI can reason about the full request flow—from frontend component to API handler to database—because it has context about both sides.
3486
+ Or you're debugging an issue that spans both repos. Your AI can reason about the full request flow—from frontend component to API handler to database—because it has context about both sides.
3529
3487
 
3530
3488
  ### When You Need Workstreams
3531
3489
 
@@ -3592,7 +3550,7 @@ The overhead isn't just the typing. Each round trip breaks your flow. You're eit
3592
3550
 
3593
3551
  ### What Loops Change
3594
3552
 
3595
- With a Ralph Loop, you describe the task once. your AI asks clarifying questions to make sure it understands. Then it drafts a plan. You review and approve the plan. your AI executes, iteration after iteration, until the task is complete. You can walk away and come back to finished work.
3553
+ With a Ralph Loop, you describe the task once. Your AI asks clarifying questions to make sure it understands. Then it drafts a plan. You review and approve the plan. It executes, iteration after iteration, until the task is complete. You can walk away and come back to finished work.
3596
3554
 
3597
3555
  ### The Three Phases
3598
3556
 
@@ -3626,7 +3584,7 @@ Click **New Loop**. A dialog asks for a task description. This is your chance to
3626
3584
 
3627
3585
  Be specific. A good task description might be "Add a dark mode toggle to the settings page, storing the preference in localStorage and respecting the system preference by default." Or "Create unit tests for the UserService class, covering all public methods, using Jest." Or "Refactor the payment module to use async/await instead of callbacks, updating all calling code."
3628
3586
 
3629
- Vague descriptions lead to vague results. "Fix bugs" doesn't tell your AI which bugs. "Make it better" doesn't explain better how. The more specific your description, the better your AI can plan and execute.
3587
+ Vague descriptions lead to vague results. "Fix bugs" doesn't tell your AI which bugs. "Make it better" doesn't explain what "better" means. The more specific your description, the better your AI can plan and execute.
3630
3588
 
3631
3589
  ### Step 3: Create and Start
3632
3590
 
@@ -3634,11 +3592,11 @@ Click **Create Loop**. The loop appears in your list with status "pending." Clic
3634
3592
 
3635
3593
  ### Step 4: Run Through the Phases
3636
3594
 
3637
- Once started, the loop enters the Clarify phase. your AI might ask questions like "Should dark mode affect the entire app or just the settings page?" Answer these to help your AI understand your requirements fully.
3595
+ Once started, the loop enters the Clarify phase. Your AI might ask questions like "Should dark mode affect the entire app or just the settings page?" Answer these to help it understand your requirements fully.
3638
3596
 
3639
- After clarification, your AI moves to Plan. You'll see a detailed breakdown of what it intends to do. Review this carefully. If something looks wrong, ask for revisions. If it looks good, approve it.
3597
+ After clarification, it moves to Plan. You'll see a detailed breakdown of what it intends to do. Review this carefully. If something looks wrong, ask for revisions. If it looks good, approve it.
3640
3598
 
3641
- With the plan approved, your AI enters Execute. Watch the progress indicators showing iterations completed and budget used. your AI works through the plan, making real changes to your codebase.
3599
+ With the plan approved, the loop enters Execute. Watch the progress indicators showing iterations completed and budget used. Your AI works through the plan, making real changes to your codebase.
3642
3600
 
3643
3601
  ### Monitoring Progress
3644
3602
 
@@ -3678,7 +3636,7 @@ In practice, there are limits. Each tool has its own configuration format and qu
3678
3636
 
3679
3637
  ### Enabling Other Tools
3680
3638
 
3681
- By default, Coder Config focuses on Claude Code. To add other tools, go to **Preferences** in the sidebar. Find the **Enabled Tools** section and check the tools you want to manage. New menu items appear in the sidebar for each enabled tool.
3639
+ By default, Coder Config focuses on Claude Code. To add other tools, go to **Preferences** in the sidebar. Find the **Enabled AI Tools** section and check the tools you want to manage. New menu items appear in the sidebar for each enabled tool.
3682
3640
  `},"syncing-tools":{title:"Syncing Between Tools",content:`
3683
3641
  When you use multiple AI coding tools, keeping their configurations in sync becomes important. You don't want different rules telling one tool one thing and another something different.
3684
3642
 
@@ -3688,9 +3646,7 @@ Rule syncing copies your rule files between tool-specific folders. Claude Code r
3688
3646
 
3689
3647
  ### How to Sync
3690
3648
 
3691
- Go to **Project Explorer** and look for the **Sync Rules** button. Click it, choose which tools to sync with, and the files are copied over.
3692
-
3693
- You can also set up automatic syncing in Preferences. When enabled, changes to rules automatically propagate to other tools' folders.
3649
+ Go to **Project Explorer** and look for the **Sync** button. Click it, choose which tools to sync with, and the files are copied over.
3694
3650
 
3695
3651
  ### What Syncs and What Doesn't
3696
3652
 
@@ -3754,4 +3710,4 @@ Everything you can do in the UI, you can do from the command line. Some power us
3754
3710
  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.
3755
3711
 
3756
3712
  Happy coding.
3757
- `}},BW={...EW,...PW,...AW,...TW,...RW,...MW,...IW,...DW,...LW,...OW,...FW},cu={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"}},b_="claude-config-tutorial-visited",Zm="claude-config-tutorial-active";function $W(){const[e,t]=_.useState(()=>{try{return localStorage.getItem(Zm)||"intro"}catch{return"intro"}}),[s,n]=_.useState(()=>{const b=localStorage.getItem(Zm)||"intro",k={welcome:!0};for(const E of Na)E.subsections.some(P=>P.id===b)&&(k[E.id]=!0);return k}),[o,c]=_.useState(()=>{try{return JSON.parse(localStorage.getItem(b_)||"[]")}catch{return[]}}),u=_.useRef(null);_.useEffect(()=>{if(u.current){const b=u.current.querySelector("[data-radix-scroll-area-viewport]");b&&(b.scrollTop=0)}},[e]),_.useEffect(()=>{if(e&&(localStorage.setItem(Zm,e),!o.includes(e))){const b=[...o,e];c(b),localStorage.setItem(b_,JSON.stringify(b))}},[e,o]);const l=b=>{n(k=>({...k,[b]:!k[b]}))},d=BW[e],f=Na.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,g=m<f.length-1?f[m+1]:null,w=Math.round(o.length/f.length*100),S=(()=>{for(const b of Na)if(b.id===e||b.subsections.some(k=>k.id===e))return b;return Na[0]})(),v=cu[S.id]||cu.welcome,y=b=>{for(const k of Na){if(k.id===b)return k.title;const E=k.subsections.find(P=>P.id===b);if(E)return E.title}return""},x=b=>({__html:y2(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(ju,{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(j2,{value:w,className:"h-2"})]})]}),r.jsx(Ys,{className:"flex-1",children:r.jsx("div",{className:"p-2",children:Na.map((b,k)=>{const E=b.icon,P=cu[b.id]||cu.welcome,A=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: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]||t(b.subsections[0].id)):t(b.id)},children:[r.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:N?r.jsx(Mo,{className:"w-4 h-4"}):r.jsx(E,{className:Ne("w-4 h-4",!A&&P.text)})}),r.jsx("span",{className:Ne("flex-1",A&&"font-medium"),children:b.title}),b.subsections.length>0&&r.jsx(xs,{className:Ne("w-4 h-4 text-muted-foreground transition-transform",s[b.id]&&"rotate-90")})]}),b.subsections.length>0&&s[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 D=e===M.id,O=o.includes(M.id);return r.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:()=>t(M.id),children:[O&&!D&&r.jsx(Mo,{className:"w-3 h-3 text-green-500"}),r.jsx("span",{className:Ne(!O&&!D&&"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:Ne("px-8 py-4 border-b border-border",v.light),children:r.jsxs("div",{className:"max-w-3xl mx-auto flex items-center gap-3",children:[r.jsx("div",{className:Ne("w-10 h-10 rounded-xl flex items-center justify-center",v.bg,"text-white"),children:r.jsx(S.icon,{className:"w-5 h-5"})}),r.jsxs("div",{children:[r.jsx("p",{className:Ne("text-sm font-medium",v.text),children:S.title}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:(d==null?void 0:d.title)||y(e)})]})]})}),r.jsx(Ys,{className:"flex-1",ref:u,children:r.jsx("div",{className:"max-w-3xl mx-auto p-8",children:d?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 [&_: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:x(d.content)}):r.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[r.jsx(ju,{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(re,{variant:"ghost",onClick:()=>t(h),className:"flex items-center gap-2",children:[r.jsx(j5,{className:"w-4 h-4"}),r.jsx("span",{className:"max-w-[150px] truncate",children:y(h)})]}):r.jsx("div",{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[m+1," of ",f.length]}),g?r.jsxs(re,{onClick:()=>t(g),className:Ne("flex items-center gap-2",v.bg,"hover:opacity-90"),children:[r.jsx("span",{className:"max-w-[150px] truncate",children:y(g)}),r.jsx(Ag,{className:"w-4 h-4"})]}):r.jsx(re,{variant:"outline",onClick:()=>t("intro"),className:"flex items-center gap-2",children:"Start Over"})]})})]})]})}function zW(){const[e,t]=_.useState(null),[s,n]=_.useState(!0),[o,c]=_.useState(!1),[u,l]=_.useState(!1),[d,f]=_.useState(!1),[m,h]=_.useState(null);_.useEffect(()=>{g()},[]);const g=async()=>{try{n(!0);const k=await ue.getSessionStatus();t(k)}catch{K.error("Failed to load session status")}finally{n(!1)}},w=async()=>{var k,E;c(!0);try{const P=await ue.installSessionAll();P.success?(K.success("Session persistence installed!"),g()):K.error(((k=P.hooks)==null?void 0:k.error)||((E=P.command)==null?void 0:E.error)||"Installation failed")}catch{K.error("Installation failed")}finally{c(!1)}},j=async()=>{c(!0);try{const k=await ue.installSessionHooks();k.success?(K.success("Session hooks installed!"),g()):K.error(k.error||"Failed to install hooks")}catch{K.error("Failed to install hooks")}finally{c(!1)}},S=async()=>{c(!0);try{const k=await ue.installFlushCommand();k.success?(K.success(k.alreadyInstalled?"/flush command already installed":"/flush command installed!"),g()):K.error(k.error||"Failed to install command")}catch{K.error("Failed to install command")}finally{c(!1)}},v=async()=>{l(!0);try{const k=await ue.clearSessionContext();k.success?(K.success(k.cleared?"Session context cleared":"No context to clear"),g()):K.error("Failed to clear context")}catch{K.error("Failed to clear context")}finally{l(!1)}},y=async()=>{try{const k=await ue.getSessionContext();h(k.content),f(!0)}catch{K.error("Failed to load context")}},x=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 r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(Ze,{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(ys,{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(re,{variant:"ghost",size:"sm",onClick:g,children:r.jsx(Tr,{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(Dt,{className:"w-5 h-5 text-green-500"}):r.jsx(Rs,{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(et,{variant:e!=null&&e.hooksInstalled?"default":"secondary",children:e!=null&&e.hooksInstalled?"Installed":"Not Installed"}),!(e!=null&&e.hooksInstalled)&&r.jsx(re,{variant:"outline",size:"sm",onClick:j,disabled:o,children:o?r.jsx(Ze,{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(Dt,{className:"w-5 h-5 text-green-500"}):r.jsx(Rs,{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(et,{variant:e!=null&&e.flushCommandInstalled?"default":"secondary",children:e!=null&&e.flushCommandInstalled?"Installed":"Not Installed"}),!(e!=null&&e.flushCommandInstalled)&&r.jsx(re,{variant:"outline",size:"sm",onClick:S,disabled:o,children:o?r.jsx(Ze,{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(Dt,{className:"w-5 h-5 text-green-500"}):r.jsx(Rs,{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(et,{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(re,{onClick:w,disabled:o,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white",children:[o?r.jsx(Ze,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(xi,{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(re,{variant:"outline",size:"sm",onClick:y,children:[r.jsx(zr,{className:"w-4 h-4 mr-2"}),"View"]}),r.jsx(re,{variant:"outline",size:"sm",onClick:v,disabled:u,className:"text-red-600 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950",children:u?r.jsx(Ze,{className:"w-4 h-4 animate-spin"}):r.jsx(bs,{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(sc,{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:x(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(ys,{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(et,{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(vt,{open:d,onOpenChange:f,children:r.jsxs(ht,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(ft,{children:[r.jsx(mt,{children:"Saved Context"}),r.jsx(tr,{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(St,{children:r.jsx(re,{variant:"ghost",onClick:()=>f(!1),children:"Close"})})]})})]})}const HW=[{id:"projects",label:"All Projects",icon:Bn,section:"Projects"},{id:"explorer",label:"Project Explorer",icon:Ki,section:"Projects"},{id:"workstreams",label:"Workstreams",icon:cC,section:"Projects"},{id:"registry",label:"MCP Registry",icon:Gn,section:"Tools"},{id:"plugins",label:"Plugins",icon:Io,section:"Tools"},{id:"memory",label:"Memory",icon:Ro,section:"Tools"},{id:"claude-settings",label:"Claude Code",icon:Jn,section:"Configuration",tool:"claude"},{id:"gemini-settings",label:"Gemini CLI",icon:Kt,section:"Configuration",tool:"gemini"},{id:"codex-settings",label:"Codex CLI",icon:Kt,section:"Configuration",isNew:!0,tool:"codex"},{id:"antigravity-settings",label:"Antigravity",icon:Ec,section:"Configuration",tool:"antigravity"},{id:"create-mcp",label:"Create MCP",icon:Hr,section:"Developer"},{id:"loops",label:"Ralph Loops",icon:hc,section:"Developer",isNew:!0},{id:"sessions",label:"Sessions",icon:ys,section:"System"},{id:"preferences",label:"Preferences",icon:dC,section:"System"},{id:"tutorial",label:"Tutorial",icon:ju,section:"Help"},{id:"docs",label:"Docs & Help",icon:To,section:"Help"}],w_=(e,t)=>{try{const s=localStorage.getItem(`claude-config-${e}`);return s?JSON.parse(s):t}catch{return t}},WW=(e,t)=>{try{localStorage.setItem(`claude-config-${e}`,JSON.stringify(t))}catch{}};function VW(){const{projects:e,activeProject:t,fetch:s,setActive:n}=Px(),{appConfig:o,version:c,fetch:u,checkVersion:l}=Ew(),[d,f]=_.useState(()=>w_("currentView","explorer")),[m,h]=_.useState(!0),[g,w]=_.useState({dir:"",subprojects:[],hierarchy:[]}),[j,S]=_.useState([]),[v,y]=_.useState({mcpServers:{}}),[x,b]=_.useState([]),[k,E]=_.useState([]),[P,A]=_.useState(null),[N,M]=_.useState(null),[D,O]=_.useState(!1),[$,V]=_.useState({title:"",type:""}),[X,W]=_.useState(""),[z,Y]=_.useState(""),G=_.useRef({}),[L,R]=_.useState(null),[B,q]=_.useState(!1),[F,ee]=_.useState(!1),[ce,me]=_.useState(null),[J,H]=_.useState(!1),ae=_.useRef(null);_.useEffect(()=>{WW("currentView",d)},[d]);const ne=_.useCallback(async()=>{try{const[he,ye,Ie,de,we]=await Promise.all([ue.getProject(),ue.getConfigs(),ue.getRegistry(),ue.getRules(),ue.getCommands()]);w(he),S(ye),y(Ie),b(de),E(we),ye.length>0&&!P&&A(ye[ye.length-1])}catch(he){K.error("Failed to load data: "+he.message)}finally{h(!1)}},[P]),Z=_.useCallback(async(he=!1)=>{try{const ye=await s(),Ie=ye==null?void 0:ye.find(de=>de.isActive);if(he&&Ie){const de=await ue.getSubprojects(Ie.path);me({dir:Ie.path,subprojects:de.subprojects||[]})}he&&!Ie&&(w_("currentView",null)||f("projects"))}catch{console.log("Projects API not available")}},[s]),le=async he=>{try{const ye=await n(he);ye.success?(w({dir:ye.dir,hierarchy:ye.hierarchy,subprojects:ye.subprojects}),me({dir:ye.dir,subprojects:ye.subprojects}),await ne(),K.success(`Switched to ${ye.project.name}`)):K.error(ye.error||"Failed to switch project")}catch(ye){K.error("Failed to switch project: "+ye.message)}},Se=()=>{s()};_.useEffect(()=>{ne(),Z(!0),(async()=>{try{const[ye]=await Promise.all([l(),u()]);!ae.current&&(ye!=null&&ye.installedVersion)&&(ae.current=ye.installedVersion);const Ie=Ew.getState().appConfig;if(ye!=null&&ye.updateAvailable&&(ye==null?void 0:ye.updateMethod)==="npm")if(Ie!=null&&Ie.autoUpdate){K.info(`Auto-updating to v${ye.latestVersion}...`),q(!0);const de=await ue.performUpdate({updateMethod:ye.updateMethod,targetVersion:ye.latestVersion,channel:ye.channel});if(de.success){K.success(`Updated to v${de.newVersion}! Restarting server...`);try{await ue.restartServer()}catch{}let we=0;const Ae=setInterval(async()=>{we++;try{await ue.checkVersion(),clearInterval(Ae),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{we>30&&(clearInterval(Ae),K.info("Server restarting. Please refresh the page."),q(!1))}},500)}else K.error("Auto-update failed: "+de.error),q(!1),R(ye)}else R(ye)}catch{}})()},[]),_.useEffect(()=>{const ye=setInterval(async()=>{if(ae.current)try{const Ie=await ue.checkVersion();Ie!=null&&Ie.installedVersion&&Ie.installedVersion!==ae.current&&(console.log(`[stale-ui] Server updated to v${Ie.installedVersion}, refreshing...`),window.location.reload())}catch{}},3e4);return()=>clearInterval(ye)},[]);const Le=(he,ye)=>{if(!he||!ye)return!1;const Ie=Ae=>Ae.split(".").map($e=>parseInt($e,10)||0),de=Ie(he),we=Ie(ye);for(let Ae=0;Ae<Math.max(de.length,we.length);Ae++){if((de[Ae]||0)>(we[Ae]||0))return!0;if((de[Ae]||0)<(we[Ae]||0))return!1}return!1},Ue=async(he,ye="npm",Ie)=>{q(!0);const de=await ue.performUpdate({updateMethod:ye,targetVersion:he,channel:Ie});if(de.success){K.success(`Updated to v${de.newVersion}! Restarting server...`),R(null);try{await ue.restartServer()}catch{}let we=0;const Ae=setInterval(async()=>{we++;try{await ue.checkVersion(),clearInterval(Ae),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{we>30&&(clearInterval(Ae),K.info("Server restarting. Please refresh the page."),q(!1))}},500);return!0}else return K.error("Update failed: "+de.error),q(!1),!1},pe=async()=>{H(!0);try{const he=await ue.checkVersion(),ye=he==null?void 0:he.installedVersion,Ie=he==null?void 0:he.latestVersion;if(ye&&ae.current&&ye!==ae.current){K.info(`Refreshing to v${ye}...`),setTimeout(()=>window.location.reload(),500);return}Le(Ie,ye)&&(o!=null&&o.autoUpdate?(H(!1),K.info(`Auto-updating to v${Ie}...`),await Ue(Ie,(he==null?void 0:he.updateMethod)||"npm",he==null?void 0:he.channel)):(R({...he,updateAvailable:!0}),K.info(`Update available: v${Ie}`)))}catch{K.error("Failed to check for updates")}finally{H(!1)}},be=async()=>{if(L!=null&&L.updateAvailable){q(!0);try{const he=await ue.performUpdate({updateMethod:L.updateMethod,sourcePath:L.sourcePath,targetVersion:L.latestVersion,channel:L.channel});if(he.success){K.success(`Updated to v${he.newVersion}! Restarting server...`),R(null),setVersion(he.newVersion);try{await ue.restartServer()}catch{}let ye=0;const Ie=setInterval(async()=>{ye++;try{await ue.checkVersion(),clearInterval(Ie),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{ye>30&&(clearInterval(Ie),K.info("Server restarting. Please refresh the page."),q(!1))}},500)}else K.error("Update failed: "+he.error),q(!1)}catch(he){K.error("Update failed: "+he.message),q(!1)}}};_.useEffect(()=>{const he=async()=>{try{const{hashes:Ie}=await ue.getFileHashes(),de=G.current,we=Object.keys(Ie).some($e=>de[$e]!==Ie[$e])||Object.keys(de).some($e=>!Ie[$e]),Ae=de.__subprojects__!==Ie.__subprojects__;if(we&&Object.keys(de).length>0&&(await ne(),Ae&&ce))try{const $e=await ue.getSubprojects(ce.dir);me(Ke=>({...Ke,subprojects:$e.subprojects||[]}))}catch{}G.current=Ie}catch{}},ye=setInterval(he,2e3);return he(),()=>clearInterval(ye)},[ne,ce]);const Fe=new Set;j.forEach(he=>{var ye,Ie;(((ye=he.config)==null?void 0:ye.include)||[]).forEach(de=>Fe.add(de)),Object.keys(((Ie=he.config)==null?void 0:Ie.mcpServers)||{}).forEach(de=>Fe.add(de))});const qe={mcps:Fe.size,rules:x.length,commands:k.length},Xe=async()=>{try{const he=await ue.applyConfig(g.dir);if(he.tools){const ye=Object.entries(he.tools).filter(([,Ie])=>Ie).map(([Ie])=>Ie==="claude"?"Claude Code":"Antigravity");ye.length>0?K.success(`Config applied to: ${ye.join(", ")}`):K.warning("No tools were updated")}else K.success("Configuration applied successfully!")}catch(he){K.error("Failed to apply config: "+he.message)}},Et=async()=>{h(!0),await ne(),K.success("Data refreshed")};if(m)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(Ze,{className:"w-8 h-8 animate-spin text-primary"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading configuration..."})]})});const _e=()=>{switch(d){case"explorer":return r.jsx(_8,{project:g,onRefresh:ne});case"registry":return r.jsx(zH,{registry:v,searchQuery:X,setSearchQuery:W,onUpdate:ne});case"plugins":return r.jsx(pW,{});case"memory":return r.jsx(HH,{project:g,onUpdate:ne});case"create-mcp":return r.jsx(vH,{project:g});case"claude-settings":return r.jsx(sH,{});case"gemini-settings":return r.jsx(nH,{});case"codex-settings":return r.jsx(gH,{});case"antigravity-settings":return r.jsx(cH,{});case"sessions":return r.jsx(zW,{});case"preferences":return r.jsx(rH,{onConfigChange:()=>u()});case"projects":return r.jsx(qH,{onProjectSwitch:he=>{w({dir:he.dir,hierarchy:he.hierarchy,subprojects:he.subprojects}),me({dir:he.dir,subprojects:he.subprojects}),ne(),Z()}});case"workstreams":return r.jsx(gW,{onWorkstreamChange:he=>{K.success(`Switched to workstream: ${he.name}`)}});case"loops":return r.jsx(xW,{activeProject:t});case"docs":return r.jsx(fW,{});case"tutorial":return r.jsx($W,{});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"})]})}),L&&r.jsxs("button",{onClick:be,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?r.jsx(Ze,{className:"w-3 h-3 animate-spin"}):r.jsx(xi,{className:"w-3 h-3"}),B?"Updating...":`Update to v${L.latestVersion}`]})]}),r.jsx(yN,{orientation:"vertical",className:"h-6"}),r.jsx(S8,{projects:e,activeProject:t,onSwitch:le,onAddClick:()=>ee(!0),onManageClick:()=>f("projects")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(N8,{}),r.jsx(re,{variant:"ghost",size:"sm",onClick:Et,children:r.jsx(Tr,{className:"w-4 h-4"})}),r.jsxs(re,{onClick:Xe,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(Ec,{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(Ys,{className:"flex-1 py-4",children:["Projects","Tools","Configuration","Developer","System","Help"].map(he=>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:he}),r.jsx("div",{className:"space-y-0.5",children:HW.filter(ye=>ye.section===he).filter(ye=>{var Ie;return ye.id!=="loops"||((Ie=o==null?void 0:o.experimental)==null?void 0:Ie.ralphLoops)}).filter(ye=>!ye.tool||((o==null?void 0:o.enabledTools)||["claude"]).includes(ye.tool)).map(ye=>{const Ie=ye.icon,de=d===ye.id;return r.jsxs("button",{onClick:()=>f(ye.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-all duration-200 border-l-2 ${de?"bg-accent border-primary text-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:[r.jsx(Ie,{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 ${de?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:qe[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)})})]},he))}),r.jsx("div",{className:"px-4 py-3 border-t border-border",children:r.jsxs("button",{onClick:pe,disabled:J,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",title:"Check for updates",children:[J?r.jsx(Ze,{className:"w-3 h-3 animate-spin"}):null,c?`v${c}`:""]})})]}),r.jsx("main",{style:["explorer","docs","tutorial"].includes(d)?{}:{zoom:.9},className:Ne("flex-1 overflow-auto",["explorer","docs","tutorial"].includes(d)?"h-[calc(100vh-64px)]":"p-6"),children:r.jsx(j_,{mode:"wait",children:r.jsx(Ma.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:["explorer","docs","tutorial"].includes(d)?"h-full":"",children:_e()},d)})})]}),r.jsx(pN,{open:F,onOpenChange:ee,onAdded:Se}),r.jsx(C8,{onStartTutorial:()=>f("tutorial")})]})}function UW(){const[e,t]=_.useState(!1),[s,n]=_.useState(!1),[o,c]=_.useState(!1),u=_.useCallback(async()=>{n(!0);try{await ue.restartServer(),K.info("Server restarting... page will reload."),setTimeout(()=>{window.location.reload()},2e3)}catch(d){K.error("Failed to restart: "+d.message),n(!1)}},[]),l=_.useCallback(()=>{c(!0),t(!1),K.dismiss("update-available")},[]);return _.useEffect(()=>{let d;const f=async()=>{try{const m=await ue.getVersion();console.log("[Update Check]",m),m.needsRestart&&!o&&t(!0)}catch{}};return f(),d=setInterval(f,3e4),()=>clearInterval(d)},[o]),r.jsx(k8,{children:r.jsxs("div",{className:"min-h-screen bg-background",children:[e&&!s&&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(Tr,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Update available — click to restart"}),r.jsx("button",{onClick:d=>{d.stopPropagation(),l()},className:"absolute right-3 p-1 hover:bg-blue-500 rounded",children:r.jsx(hi,{className:"w-4 h-4"})})]}),s&&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(Tr,{className:"w-4 h-4 animate-spin"}),r.jsx("span",{className:"text-sm font-medium",children:"Restarting server..."})]}),r.jsx(VW,{}),r.jsx(LP,{position:"bottom-right",richColors:!0})]})})}cP.createRoot(document.getElementById("root")).render(r.jsx(UW,{}));
3713
+ `}},BW={...EW,...PW,...AW,...TW,...RW,...MW,...IW,...DW,...LW,...OW,...FW},cu={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"}},b_="claude-config-tutorial-visited",Zm="claude-config-tutorial-active";function $W(){const[e,t]=_.useState(()=>{try{return localStorage.getItem(Zm)||"intro"}catch{return"intro"}}),[s,n]=_.useState(()=>{try{const b=localStorage.getItem(Zm)||"intro",k={welcome:!0};for(const E of Na)E.subsections.some(P=>P.id===b)&&(k[E.id]=!0);return k}catch{return{welcome:!0}}}),[o,c]=_.useState(()=>{try{return JSON.parse(localStorage.getItem(b_)||"[]")}catch{return[]}}),u=_.useRef(null);_.useEffect(()=>{if(u.current){const b=u.current.querySelector("[data-radix-scroll-area-viewport]");b&&(b.scrollTop=0)}},[e]),_.useEffect(()=>{if(e&&(localStorage.setItem(Zm,e),!o.includes(e))){const b=[...o,e];c(b),localStorage.setItem(b_,JSON.stringify(b))}},[e,o]);const l=b=>{n(k=>({...k,[b]:!k[b]}))},d=BW[e],f=Na.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,g=m<f.length-1?f[m+1]:null,w=Math.round(o.length/f.length*100),S=(()=>{for(const b of Na)if(b.id===e||b.subsections.some(k=>k.id===e))return b;return Na[0]})(),v=cu[S.id]||cu.welcome,y=b=>{for(const k of Na){if(k.id===b)return k.title;const E=k.subsections.find(P=>P.id===b);if(E)return E.title}return""},x=b=>({__html:y2(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(ju,{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(j2,{value:w,className:"h-2"})]})]}),r.jsx(Ys,{className:"flex-1",children:r.jsx("div",{className:"p-2",children:Na.map((b,k)=>{const E=b.icon,P=cu[b.id]||cu.welcome,A=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: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]||t(b.subsections[0].id)):t(b.id)},children:[r.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:N?r.jsx(Mo,{className:"w-4 h-4"}):r.jsx(E,{className:Ne("w-4 h-4",!A&&P.text)})}),r.jsx("span",{className:Ne("flex-1",A&&"font-medium"),children:b.title}),b.subsections.length>0&&r.jsx(xs,{className:Ne("w-4 h-4 text-muted-foreground transition-transform",s[b.id]&&"rotate-90")})]}),b.subsections.length>0&&s[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 D=e===M.id,O=o.includes(M.id);return r.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:()=>t(M.id),children:[O&&!D&&r.jsx(Mo,{className:"w-3 h-3 text-green-500"}),r.jsx("span",{className:Ne(!O&&!D&&"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:Ne("px-8 py-4 border-b border-border",v.light),children:r.jsxs("div",{className:"max-w-3xl mx-auto flex items-center gap-3",children:[r.jsx("div",{className:Ne("w-10 h-10 rounded-xl flex items-center justify-center",v.bg,"text-white"),children:r.jsx(S.icon,{className:"w-5 h-5"})}),r.jsxs("div",{children:[r.jsx("p",{className:Ne("text-sm font-medium",v.text),children:S.title}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:(d==null?void 0:d.title)||y(e)})]})]})}),r.jsx(Ys,{className:"flex-1",ref:u,children:r.jsx("div",{className:"max-w-3xl mx-auto p-8",children:d?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 [&_: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:x(d.content)}):r.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[r.jsx(ju,{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(re,{variant:"ghost",onClick:()=>t(h),className:"flex items-center gap-2",children:[r.jsx(j5,{className:"w-4 h-4"}),r.jsx("span",{className:"max-w-[150px] truncate",children:y(h)})]}):r.jsx("div",{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[m+1," of ",f.length]}),g?r.jsxs(re,{onClick:()=>t(g),className:Ne("flex items-center gap-2",v.bg,"hover:opacity-90"),children:[r.jsx("span",{className:"max-w-[150px] truncate",children:y(g)}),r.jsx(Ag,{className:"w-4 h-4"})]}):r.jsx(re,{variant:"outline",onClick:()=>t("intro"),className:"flex items-center gap-2",children:"Start Over"})]})})]})]})}function zW(){const[e,t]=_.useState(null),[s,n]=_.useState(!0),[o,c]=_.useState(!1),[u,l]=_.useState(!1),[d,f]=_.useState(!1),[m,h]=_.useState(null);_.useEffect(()=>{g()},[]);const g=async()=>{try{n(!0);const k=await ue.getSessionStatus();t(k)}catch{K.error("Failed to load session status")}finally{n(!1)}},w=async()=>{var k,E;c(!0);try{const P=await ue.installSessionAll();P.success?(K.success("Session persistence installed!"),g()):K.error(((k=P.hooks)==null?void 0:k.error)||((E=P.command)==null?void 0:E.error)||"Installation failed")}catch{K.error("Installation failed")}finally{c(!1)}},j=async()=>{c(!0);try{const k=await ue.installSessionHooks();k.success?(K.success("Session hooks installed!"),g()):K.error(k.error||"Failed to install hooks")}catch{K.error("Failed to install hooks")}finally{c(!1)}},S=async()=>{c(!0);try{const k=await ue.installFlushCommand();k.success?(K.success(k.alreadyInstalled?"/flush command already installed":"/flush command installed!"),g()):K.error(k.error||"Failed to install command")}catch{K.error("Failed to install command")}finally{c(!1)}},v=async()=>{l(!0);try{const k=await ue.clearSessionContext();k.success?(K.success(k.cleared?"Session context cleared":"No context to clear"),g()):K.error("Failed to clear context")}catch{K.error("Failed to clear context")}finally{l(!1)}},y=async()=>{try{const k=await ue.getSessionContext();h(k.content),f(!0)}catch{K.error("Failed to load context")}},x=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 r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(Ze,{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(ys,{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(re,{variant:"ghost",size:"sm",onClick:g,children:r.jsx(Tr,{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(Dt,{className:"w-5 h-5 text-green-500"}):r.jsx(Rs,{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(et,{variant:e!=null&&e.hooksInstalled?"default":"secondary",children:e!=null&&e.hooksInstalled?"Installed":"Not Installed"}),!(e!=null&&e.hooksInstalled)&&r.jsx(re,{variant:"outline",size:"sm",onClick:j,disabled:o,children:o?r.jsx(Ze,{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(Dt,{className:"w-5 h-5 text-green-500"}):r.jsx(Rs,{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(et,{variant:e!=null&&e.flushCommandInstalled?"default":"secondary",children:e!=null&&e.flushCommandInstalled?"Installed":"Not Installed"}),!(e!=null&&e.flushCommandInstalled)&&r.jsx(re,{variant:"outline",size:"sm",onClick:S,disabled:o,children:o?r.jsx(Ze,{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(Dt,{className:"w-5 h-5 text-green-500"}):r.jsx(Rs,{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(et,{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(re,{onClick:w,disabled:o,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white",children:[o?r.jsx(Ze,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(xi,{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(re,{variant:"outline",size:"sm",onClick:y,children:[r.jsx(zr,{className:"w-4 h-4 mr-2"}),"View"]}),r.jsx(re,{variant:"outline",size:"sm",onClick:v,disabled:u,className:"text-red-600 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950",children:u?r.jsx(Ze,{className:"w-4 h-4 animate-spin"}):r.jsx(bs,{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(sc,{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:x(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(ys,{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(et,{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(vt,{open:d,onOpenChange:f,children:r.jsxs(ht,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(ft,{children:[r.jsx(mt,{children:"Saved Context"}),r.jsx(tr,{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(St,{children:r.jsx(re,{variant:"ghost",onClick:()=>f(!1),children:"Close"})})]})})]})}const HW=[{id:"projects",label:"All Projects",icon:Bn,section:"Projects"},{id:"explorer",label:"Project Explorer",icon:Ki,section:"Projects"},{id:"workstreams",label:"Workstreams",icon:cC,section:"Projects"},{id:"registry",label:"MCP Registry",icon:Gn,section:"Tools"},{id:"plugins",label:"Plugins",icon:Io,section:"Tools"},{id:"memory",label:"Memory",icon:Ro,section:"Tools"},{id:"claude-settings",label:"Claude Code",icon:Jn,section:"Configuration",tool:"claude"},{id:"gemini-settings",label:"Gemini CLI",icon:Kt,section:"Configuration",tool:"gemini"},{id:"codex-settings",label:"Codex CLI",icon:Kt,section:"Configuration",isNew:!0,tool:"codex"},{id:"antigravity-settings",label:"Antigravity",icon:Ec,section:"Configuration",tool:"antigravity"},{id:"create-mcp",label:"Create MCP",icon:Hr,section:"Developer"},{id:"loops",label:"Ralph Loops",icon:hc,section:"Developer",isNew:!0},{id:"sessions",label:"Sessions",icon:ys,section:"System"},{id:"preferences",label:"Preferences",icon:dC,section:"System"},{id:"tutorial",label:"Tutorial",icon:ju,section:"Help"},{id:"docs",label:"Docs & Help",icon:To,section:"Help"}],w_=(e,t)=>{try{const s=localStorage.getItem(`claude-config-${e}`);return s?JSON.parse(s):t}catch{return t}},WW=(e,t)=>{try{localStorage.setItem(`claude-config-${e}`,JSON.stringify(t))}catch{}};function VW(){const{projects:e,activeProject:t,fetch:s,setActive:n}=Px(),{appConfig:o,version:c,fetch:u,checkVersion:l}=Ew(),[d,f]=_.useState(()=>w_("currentView","explorer")),[m,h]=_.useState(!0),[g,w]=_.useState({dir:"",subprojects:[],hierarchy:[]}),[j,S]=_.useState([]),[v,y]=_.useState({mcpServers:{}}),[x,b]=_.useState([]),[k,E]=_.useState([]),[P,A]=_.useState(null),[N,M]=_.useState(null),[D,O]=_.useState(!1),[$,V]=_.useState({title:"",type:""}),[X,W]=_.useState(""),[z,Y]=_.useState(""),G=_.useRef({}),[L,R]=_.useState(null),[B,q]=_.useState(!1),[F,ee]=_.useState(!1),[ce,me]=_.useState(null),[J,H]=_.useState(!1),ae=_.useRef(null);_.useEffect(()=>{WW("currentView",d)},[d]);const ne=_.useCallback(async()=>{try{const[he,ye,Ie,de,we]=await Promise.all([ue.getProject(),ue.getConfigs(),ue.getRegistry(),ue.getRules(),ue.getCommands()]);w(he),S(ye),y(Ie),b(de),E(we),ye.length>0&&!P&&A(ye[ye.length-1])}catch(he){K.error("Failed to load data: "+he.message)}finally{h(!1)}},[P]),Z=_.useCallback(async(he=!1)=>{try{const ye=await s(),Ie=ye==null?void 0:ye.find(de=>de.isActive);if(he&&Ie){const de=await ue.getSubprojects(Ie.path);me({dir:Ie.path,subprojects:de.subprojects||[]})}he&&!Ie&&(w_("currentView",null)||f("projects"))}catch{console.log("Projects API not available")}},[s]),le=async he=>{try{const ye=await n(he);ye.success?(w({dir:ye.dir,hierarchy:ye.hierarchy,subprojects:ye.subprojects}),me({dir:ye.dir,subprojects:ye.subprojects}),await ne(),K.success(`Switched to ${ye.project.name}`)):K.error(ye.error||"Failed to switch project")}catch(ye){K.error("Failed to switch project: "+ye.message)}},Se=()=>{s()};_.useEffect(()=>{ne(),Z(!0),(async()=>{try{const[ye]=await Promise.all([l(),u()]);!ae.current&&(ye!=null&&ye.installedVersion)&&(ae.current=ye.installedVersion);const Ie=Ew.getState().appConfig;if(ye!=null&&ye.updateAvailable&&(ye==null?void 0:ye.updateMethod)==="npm")if(Ie!=null&&Ie.autoUpdate){K.info(`Auto-updating to v${ye.latestVersion}...`),q(!0);const de=await ue.performUpdate({updateMethod:ye.updateMethod,targetVersion:ye.latestVersion,channel:ye.channel});if(de.success){K.success(`Updated to v${de.newVersion}! Restarting server...`);try{await ue.restartServer()}catch{}let we=0;const Ae=setInterval(async()=>{we++;try{await ue.checkVersion(),clearInterval(Ae),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{we>30&&(clearInterval(Ae),K.info("Server restarting. Please refresh the page."),q(!1))}},500)}else K.error("Auto-update failed: "+de.error),q(!1),R(ye)}else R(ye)}catch{}})()},[]),_.useEffect(()=>{const ye=setInterval(async()=>{if(ae.current)try{const Ie=await ue.checkVersion();Ie!=null&&Ie.installedVersion&&Ie.installedVersion!==ae.current&&(console.log(`[stale-ui] Server updated to v${Ie.installedVersion}, refreshing...`),window.location.reload())}catch{}},3e4);return()=>clearInterval(ye)},[]);const Le=(he,ye)=>{if(!he||!ye)return!1;const Ie=Ae=>Ae.split(".").map($e=>parseInt($e,10)||0),de=Ie(he),we=Ie(ye);for(let Ae=0;Ae<Math.max(de.length,we.length);Ae++){if((de[Ae]||0)>(we[Ae]||0))return!0;if((de[Ae]||0)<(we[Ae]||0))return!1}return!1},Ue=async(he,ye="npm",Ie)=>{q(!0);const de=await ue.performUpdate({updateMethod:ye,targetVersion:he,channel:Ie});if(de.success){K.success(`Updated to v${de.newVersion}! Restarting server...`),R(null);try{await ue.restartServer()}catch{}let we=0;const Ae=setInterval(async()=>{we++;try{await ue.checkVersion(),clearInterval(Ae),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{we>30&&(clearInterval(Ae),K.info("Server restarting. Please refresh the page."),q(!1))}},500);return!0}else return K.error("Update failed: "+de.error),q(!1),!1},pe=async()=>{H(!0);try{const he=await ue.checkVersion(),ye=he==null?void 0:he.installedVersion,Ie=he==null?void 0:he.latestVersion;if(ye&&ae.current&&ye!==ae.current){K.info(`Refreshing to v${ye}...`),setTimeout(()=>window.location.reload(),500);return}Le(Ie,ye)&&(o!=null&&o.autoUpdate?(H(!1),K.info(`Auto-updating to v${Ie}...`),await Ue(Ie,(he==null?void 0:he.updateMethod)||"npm",he==null?void 0:he.channel)):(R({...he,updateAvailable:!0}),K.info(`Update available: v${Ie}`)))}catch{K.error("Failed to check for updates")}finally{H(!1)}},be=async()=>{if(L!=null&&L.updateAvailable){q(!0);try{const he=await ue.performUpdate({updateMethod:L.updateMethod,sourcePath:L.sourcePath,targetVersion:L.latestVersion,channel:L.channel});if(he.success){K.success(`Updated to v${he.newVersion}! Restarting server...`),R(null),setVersion(he.newVersion);try{await ue.restartServer()}catch{}let ye=0;const Ie=setInterval(async()=>{ye++;try{await ue.checkVersion(),clearInterval(Ie),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{ye>30&&(clearInterval(Ie),K.info("Server restarting. Please refresh the page."),q(!1))}},500)}else K.error("Update failed: "+he.error),q(!1)}catch(he){K.error("Update failed: "+he.message),q(!1)}}};_.useEffect(()=>{const he=async()=>{try{const{hashes:Ie}=await ue.getFileHashes(),de=G.current,we=Object.keys(Ie).some($e=>de[$e]!==Ie[$e])||Object.keys(de).some($e=>!Ie[$e]),Ae=de.__subprojects__!==Ie.__subprojects__;if(we&&Object.keys(de).length>0&&(await ne(),Ae&&ce))try{const $e=await ue.getSubprojects(ce.dir);me(Ke=>({...Ke,subprojects:$e.subprojects||[]}))}catch{}G.current=Ie}catch{}},ye=setInterval(he,2e3);return he(),()=>clearInterval(ye)},[ne,ce]);const Fe=new Set;j.forEach(he=>{var ye,Ie;(((ye=he.config)==null?void 0:ye.include)||[]).forEach(de=>Fe.add(de)),Object.keys(((Ie=he.config)==null?void 0:Ie.mcpServers)||{}).forEach(de=>Fe.add(de))});const qe={mcps:Fe.size,rules:x.length,commands:k.length},Xe=async()=>{try{const he=await ue.applyConfig(g.dir);if(he.tools){const ye=Object.entries(he.tools).filter(([,Ie])=>Ie).map(([Ie])=>Ie==="claude"?"Claude Code":"Antigravity");ye.length>0?K.success(`Config applied to: ${ye.join(", ")}`):K.warning("No tools were updated")}else K.success("Configuration applied successfully!")}catch(he){K.error("Failed to apply config: "+he.message)}},Et=async()=>{h(!0),await ne(),K.success("Data refreshed")};if(m)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(Ze,{className:"w-8 h-8 animate-spin text-primary"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading configuration..."})]})});const _e=()=>{switch(d){case"explorer":return r.jsx(_8,{project:g,onRefresh:ne});case"registry":return r.jsx(zH,{registry:v,searchQuery:X,setSearchQuery:W,onUpdate:ne});case"plugins":return r.jsx(pW,{});case"memory":return r.jsx(HH,{project:g,onUpdate:ne});case"create-mcp":return r.jsx(vH,{project:g});case"claude-settings":return r.jsx(sH,{});case"gemini-settings":return r.jsx(nH,{});case"codex-settings":return r.jsx(gH,{});case"antigravity-settings":return r.jsx(cH,{});case"sessions":return r.jsx(zW,{});case"preferences":return r.jsx(rH,{onConfigChange:()=>u()});case"projects":return r.jsx(qH,{onProjectSwitch:he=>{w({dir:he.dir,hierarchy:he.hierarchy,subprojects:he.subprojects}),me({dir:he.dir,subprojects:he.subprojects}),ne(),Z()}});case"workstreams":return r.jsx(gW,{onWorkstreamChange:he=>{K.success(`Switched to workstream: ${he.name}`)}});case"loops":return r.jsx(xW,{activeProject:t});case"docs":return r.jsx(fW,{});case"tutorial":return r.jsx($W,{});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"})]})}),L&&r.jsxs("button",{onClick:be,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?r.jsx(Ze,{className:"w-3 h-3 animate-spin"}):r.jsx(xi,{className:"w-3 h-3"}),B?"Updating...":`Update to v${L.latestVersion}`]})]}),r.jsx(yN,{orientation:"vertical",className:"h-6"}),r.jsx(S8,{projects:e,activeProject:t,onSwitch:le,onAddClick:()=>ee(!0),onManageClick:()=>f("projects")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(N8,{}),r.jsx(re,{variant:"ghost",size:"sm",onClick:Et,children:r.jsx(Tr,{className:"w-4 h-4"})}),r.jsxs(re,{onClick:Xe,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(Ec,{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(Ys,{className:"flex-1 py-4",children:["Projects","Tools","Configuration","Developer","System","Help"].map(he=>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:he}),r.jsx("div",{className:"space-y-0.5",children:HW.filter(ye=>ye.section===he).filter(ye=>{var Ie;return ye.id!=="loops"||((Ie=o==null?void 0:o.experimental)==null?void 0:Ie.ralphLoops)}).filter(ye=>!ye.tool||((o==null?void 0:o.enabledTools)||["claude"]).includes(ye.tool)).map(ye=>{const Ie=ye.icon,de=d===ye.id;return r.jsxs("button",{onClick:()=>f(ye.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-all duration-200 border-l-2 ${de?"bg-accent border-primary text-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:[r.jsx(Ie,{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 ${de?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:qe[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)})})]},he))}),r.jsx("div",{className:"px-4 py-3 border-t border-border",children:r.jsxs("button",{onClick:pe,disabled:J,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",title:"Check for updates",children:[J?r.jsx(Ze,{className:"w-3 h-3 animate-spin"}):null,c?`v${c}`:""]})})]}),r.jsx("main",{style:["explorer","docs","tutorial"].includes(d)?{}:{zoom:.9},className:Ne("flex-1 overflow-auto",["explorer","docs","tutorial"].includes(d)?"h-[calc(100vh-64px)]":"p-6"),children:r.jsx(j_,{mode:"wait",children:r.jsx(Ma.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:["explorer","docs","tutorial"].includes(d)?"h-full":"",children:_e()},d)})})]}),r.jsx(pN,{open:F,onOpenChange:ee,onAdded:Se}),r.jsx(C8,{onStartTutorial:()=>f("tutorial")})]})}function UW(){const[e,t]=_.useState(!1),[s,n]=_.useState(!1),[o,c]=_.useState(!1),u=_.useCallback(async()=>{n(!0);try{await ue.restartServer(),K.info("Server restarting... page will reload."),setTimeout(()=>{window.location.reload()},2e3)}catch(d){K.error("Failed to restart: "+d.message),n(!1)}},[]),l=_.useCallback(()=>{c(!0),t(!1),K.dismiss("update-available")},[]);return _.useEffect(()=>{let d;const f=async()=>{try{const m=await ue.getVersion();console.log("[Update Check]",m),m.needsRestart&&!o&&t(!0)}catch{}};return f(),d=setInterval(f,3e4),()=>clearInterval(d)},[o]),r.jsx(k8,{children:r.jsxs("div",{className:"min-h-screen bg-background",children:[e&&!s&&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(Tr,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Update available — click to restart"}),r.jsx("button",{onClick:d=>{d.stopPropagation(),l()},className:"absolute right-3 p-1 hover:bg-blue-500 rounded",children:r.jsx(hi,{className:"w-4 h-4"})})]}),s&&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(Tr,{className:"w-4 h-4 animate-spin"}),r.jsx("span",{className:"text-sm font-medium",children:"Restarting server..."})]}),r.jsx(VW,{}),r.jsx(LP,{position:"bottom-right",richColors:!0})]})})}cP.createRoot(document.getElementById("root")).render(r.jsx(UW,{}));
@@ -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-D_IOpAe4.js"></script>
22
+ <script type="module" crossorigin src="/assets/index-C0Pwt3Iu.js"></script>
23
23
  <link rel="stylesheet" crossorigin href="/assets/index-CXW3qd8r.css">
24
24
  </head>
25
25
  <body>