@wangcansun/cc-config 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/README.md +3 -3
  2. package/cli.mjs +13 -3
  3. package/dashboard/dist/client/assets/activity-4TqyD_rE.js +1 -0
  4. package/dashboard/dist/client/assets/{commands-DhNv8XVR.js → commands-DEkiXZYl.js} +1 -1
  5. package/dashboard/dist/client/assets/dashboard-kD72rFaQ.js +1 -0
  6. package/dashboard/dist/client/assets/{detail-panel-C8SGLgm-.js → detail-panel-BIvsI61i.js} +1 -1
  7. package/dashboard/dist/client/assets/{header-CBzSNzdI.js → header-BTV9BL6u.js} +1 -1
  8. package/dashboard/dist/client/assets/{index-CaDf51H6.js → index-C8Brdl4F.js} +2 -2
  9. package/dashboard/dist/client/assets/{index-CFEz1CGb.js → index-CUdpRxTZ.js} +1 -1
  10. package/dashboard/dist/client/assets/{markdown-viewer-Bj8nSOSJ.js → markdown-viewer-Bcu9HM71.js} +3 -3
  11. package/dashboard/dist/client/assets/{mcp-BX69kbwu.js → mcp-DrHxDxfw.js} +1 -1
  12. package/dashboard/dist/client/assets/{plugins-BslRzmVr.js → plugins-husUl0t4.js} +1 -1
  13. package/dashboard/dist/client/assets/{profiles-CfOCpDPJ.js → profiles-tCUJYeeT.js} +1 -1
  14. package/dashboard/dist/client/assets/{recommended-BAj0agKu.js → recommended-Brh5GAZB.js} +1 -1
  15. package/dashboard/dist/client/assets/{search-box-CqaIZ9mR.js → search-box-CO7338GK.js} +1 -1
  16. package/dashboard/dist/client/assets/{select-BtWQJMup.js → select-BdEpCEBk.js} +1 -1
  17. package/dashboard/dist/client/assets/{settings-CicCcNf_.js → settings-DpddxKm5.js} +1 -1
  18. package/dashboard/dist/client/assets/{skills-DML4G4BP.js → skills-BvLEIHVX.js} +1 -1
  19. package/dashboard/dist/client/assets/{tag-Q3V7Jugn.js → tag-CkZkoVAp.js} +1 -1
  20. package/dashboard/dist/client/index.html +1 -1
  21. package/dashboard/dist/server.mjs +12 -2
  22. package/package.json +1 -2
  23. package/dashboard/dist/client/assets/activity-DS5YBWMm.js +0 -1
  24. package/dashboard/dist/client/assets/dashboard-DIyDYrl6.js +0 -1
@@ -1 +1 @@
1
- import{j as e,u as _,v as J,r as a,B as w,w as Q,x as X,h as Z,y as q}from"./index-CaDf51H6.js";import{H as ee}from"./header-CBzSNzdI.js";import{D as se}from"./detail-panel-C8SGLgm-.js";import{T as M}from"./tag-Q3V7Jugn.js";import{S as te}from"./search-box-CqaIZ9mR.js";function D({server:s,onClick:m}){const o=s.enabled!==!1;return e.jsxs("div",{className:"flex items-center gap-4 px-5 py-4 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--border)"},onClick:m,onMouseEnter:d=>{d.currentTarget.style.backgroundColor="var(--bg-hover)"},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent"},children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:o?"var(--status-green)":"var(--text-muted)"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm",style:{color:"var(--text-primary)",fontWeight:510},children:s.name}),e.jsxs("p",{className:"text-xs font-mono truncate mt-0.5",style:{color:"var(--text-faint)"},children:[s.config.command,s.config.args&&s.config.args.length>0?" "+s.config.args.join(" "):""]})]}),e.jsx(M,{label:o?"Connected":"Disabled",variant:o?"green":"gray"}),e.jsx("svg",{className:"w-4 h-4 shrink-0",style:{color:"var(--text-faint)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})}function W({icon:s,label:m,count:o,children:d}){const[c,l]=a.useState(!0);return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("button",{className:"w-full flex items-center justify-between px-5 py-3 text-left transition-colors hover:bg-bg-hover",style:{borderBottom:c?"1px solid var(--border)":"none"},onClick:()=>l(!c),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base",children:s}),e.jsx("span",{className:"text-sm font-medium",style:{color:m==="User"?"var(--accent-light)":"var(--text-muted)"},children:m}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-secondary)"},children:o})]}),e.jsx("svg",{className:"w-4 h-4 transition-transform",style:{color:"var(--text-muted)",transform:c?"rotate(0deg)":"rotate(-90deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),c&&e.jsx("div",{children:d})]})}function H(s){switch(s){case"mcp-registry":return"green";case"npm":return"blue";case"smithery":return"orange"}}function A(s){switch(s){case"mcp-registry":return"Official Registry";case"npm":return"npm";case"smithery":return"Smithery"}}function re({result:s,onInstall:m}){return e.jsx("div",{className:"rounded-lg p-5 transition-colors hover:bg-bg-hover",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("code",{className:"text-sm font-mono font-medium",style:{color:"var(--accent-light)"},children:s.name}),e.jsx(M,{label:A(s.source),variant:H(s.source)}),s.version&&e.jsx(M,{label:`v${s.version}`,variant:"gray"})]}),s.description&&e.jsx("p",{className:"text-xs mt-1 line-clamp-2",style:{color:"var(--text-secondary)"},children:s.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[s.repositoryUrl&&e.jsx("a",{href:s.repositoryUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs underline transition-colors",style:{color:"var(--text-muted)"},onClick:o=>o.stopPropagation(),children:"Repository"}),s.npmUrl&&e.jsx("a",{href:s.npmUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs underline transition-colors",style:{color:"var(--text-muted)"},onClick:o=>o.stopPropagation(),children:"npm"})]})]}),e.jsx(w,{variant:"primary",size:"sm",onClick:()=>m(s),children:"Install"})]})})}function ae(){return e.jsx("div",{className:"space-y-3",children:[1,2,3].map(s=>e.jsx("div",{className:"rounded-lg p-5 animate-pulse",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 rounded w-48 mb-2",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-full mb-1",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-2/3",style:{backgroundColor:"var(--border)"}})]}),e.jsx("div",{className:"h-8 w-16 rounded-lg",style:{backgroundColor:"var(--border)"}})]})},s))})}function le({result:s,onConfirm:m,onCancel:o,installing:d,error:c}){const l=s.installCommand?s.installCommand.split(" ").slice(1):["-y",s.name],[x,u]=a.useState(s.name),[v,y]=a.useState("npx"),[h,f]=a.useState(l.join(" ")),[r,g]=a.useState([]),L=()=>{g(t=>[...t,{key:"",value:""}])},k=(t,i,p)=>{g(j=>j.map((R,C)=>C===t?{...R,[i]:p}:R))},T=t=>{g(i=>i.filter((p,j)=>j!==t))},b=()=>{const t={};for(const i of r)i.key.trim()&&(t[i.key.trim()]=i.value);m(x.trim(),v.trim(),h.trim().split(/\s+/).filter(Boolean),t)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-50",style:{backgroundColor:"var(--overlay-bg)"},onClick:o}),e.jsxs("div",{className:"fixed z-50 rounded-lg p-6 shadow-2xl",style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"480px",maxWidth:"95vw",maxHeight:"85vh",overflowY:"auto",backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},onClick:t=>t.stopPropagation(),children:[e.jsx("h2",{className:"text-lg font-medium mb-1",style:{color:"var(--text-primary)"},children:"Install MCP Server"}),e.jsx("p",{className:"text-xs mb-5",style:{color:"var(--text-muted)"},children:"This will add the server to your user-level MCP config (~/.claude/.mcp.json)."}),e.jsx("div",{className:"mb-4",children:e.jsx(M,{label:A(s.source),variant:H(s.source)})}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Server Name"}),e.jsx("input",{type:"text",value:x,onChange:t=>u(t.target.value),className:"w-full px-3 py-2 rounded-lg text-sm font-mono outline-none",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--card-border)",color:"var(--text-primary)"}})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Command"}),e.jsx("input",{type:"text",value:v,onChange:t=>y(t.target.value),className:"w-full px-3 py-2 rounded-lg text-sm font-mono outline-none",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--card-border)",color:"var(--text-primary)"}})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Arguments (space-separated)"}),e.jsx("input",{type:"text",value:h,onChange:t=>f(t.target.value),className:"w-full px-3 py-2 rounded-lg text-sm font-mono outline-none",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--card-border)",color:"var(--text-primary)"}})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"text-xs font-medium",style:{color:"var(--text-secondary)"},children:"Environment Variables"}),e.jsx("button",{className:"text-xs px-2 py-0.5 rounded transition-colors",style:{color:"var(--accent-light)",backgroundColor:"rgba(94, 106, 210, 0.1)"},onClick:L,children:"+ Add"})]}),r.length===0&&e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"No environment variables"}),r.map((t,i)=>e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("input",{type:"text",placeholder:"KEY",value:t.key,onChange:p=>k(i,"key",p.target.value),className:"flex-1 px-2 py-1.5 rounded text-xs font-mono outline-none",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--card-border)",color:"var(--accent-light)"}}),e.jsx("input",{type:"text",placeholder:"value",value:t.value,onChange:p=>k(i,"value",p.target.value),className:"flex-1 px-2 py-1.5 rounded text-xs font-mono outline-none",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--card-border)",color:"var(--text-secondary)"}}),e.jsx("button",{className:"text-xs px-1.5 py-1 rounded transition-colors",style:{color:"var(--status-red)"},onClick:()=>T(i),children:"x"})]},i))]}),e.jsxs("div",{className:"mb-5",children:[e.jsx("label",{className:"block text-xs font-medium mb-1",style:{color:"var(--text-muted)"},children:"Config Preview"}),e.jsx("pre",{className:"rounded-lg p-3 text-xs font-mono overflow-x-auto",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-secondary)"},children:JSON.stringify({[x||"server-name"]:{command:v,...h.trim()?{args:h.trim().split(/\s+/)}:{},...r.some(t=>t.key.trim())?{env:Object.fromEntries(r.filter(t=>t.key.trim()).map(t=>[t.key,t.value]))}:{}}},null,2)})]}),c&&e.jsx("div",{className:"rounded-lg px-3 py-2 mb-4 text-xs",style:{backgroundColor:"rgba(255, 71, 87, 0.15)",color:"var(--status-red)"},children:c}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx(w,{variant:"secondary",size:"md",onClick:o,disabled:d,children:"Cancel"}),e.jsx(w,{variant:"primary",size:"md",onClick:b,disabled:d||!x.trim()||!v.trim(),children:d?"Installing...":"Install"})]})]})]})}function ne({onInstalled:s}){const{t:m}=_(),[o,d]=a.useState(""),[c,l]=a.useState("all"),[x,u]=a.useState([]),[v,y]=a.useState([]),[h,f]=a.useState(!1),[r,g]=a.useState(!1),[L,k]=a.useState(!0),[T,b]=a.useState(!1),[t,i]=a.useState(null),[p,j]=a.useState(!1),[R,C]=a.useState(null),[E,B]=a.useState(null),S=a.useRef(null),O=a.useRef(!1);a.useEffect(()=>{O.current||(O.current=!0,k(!0),X().then(n=>{y(n.results),f(n.smitheryAvailable)}).catch(()=>{}).finally(()=>k(!1)))},[]);const z=a.useCallback(async n=>{if(!n.trim()){u([]),b(!1),g(!1);return}g(!0);try{const I=await Z(n);u(I.results),f(I.smitheryAvailable),b(!0)}catch{b(!0)}finally{g(!1)}},[]);a.useEffect(()=>{if(S.current&&clearTimeout(S.current),!o.trim()){u([]),b(!1);return}return S.current=setTimeout(()=>z(o),300),()=>{S.current&&clearTimeout(S.current)}},[o,z]),a.useEffect(()=>{if(!E)return;const n=setTimeout(()=>B(null),4e3);return()=>clearTimeout(n)},[E]);const P=o.trim().length>0,F=P?x:v,V=P?r:L,N=c==="all"?F:F.filter(n=>n.source===c),Y=async(n,I,G,$)=>{j(!0),C(null);try{await q(n,I,G,Object.keys($).length>0?$:void 0),i(null),B(`Successfully installed "${n}"`),s()}catch(U){C(U instanceof Error?U.message:"Install failed")}finally{j(!1)}},K=[{key:"all",label:"All"},{key:"mcp-registry",label:"Official Registry"},{key:"npm",label:"npm"},{key:"smithery",label:"Smithery"}];return e.jsxs("div",{children:[e.jsx("div",{className:"mb-4",children:e.jsx(te,{value:o,onChange:d,placeholder:m("config.mcp.searchStorePlaceholder")})}),e.jsx("div",{className:"flex items-center gap-2 mb-4 flex-wrap",children:K.map(n=>e.jsx("button",{className:"px-3 py-1 rounded-full text-xs font-medium transition-colors",style:{backgroundColor:c===n.key?"var(--accent)":"var(--input-bg)",color:c===n.key?"#fff":"var(--text-secondary)"},onClick:()=>l(n.key),children:n.label},n.key))}),!h&&T&&e.jsx("p",{className:"text-xs mb-4",style:{color:"var(--text-muted)"},children:"Set SMITHERY_API_KEY environment variable to enable Smithery search."}),E&&e.jsxs("div",{className:"rounded-lg px-4 py-3 mb-4 text-sm flex items-center gap-2",style:{backgroundColor:"rgba(0, 184, 148, 0.15)",color:"var(--status-green)"},children:[e.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),E]}),V?e.jsx(ae,{}):P&&T&&N.length===0?e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:["No results found for “",o,"”",c!=="all"?` in ${A(c)}`:"","."]})}):N.length>0?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:P?`${N.length} result${N.length!==1?"s":""}`:`Top ${N.length} MCP Servers`}),N.map(n=>e.jsx(re,{result:n,onInstall:i},`${n.source}-${n.name}`))]}):e.jsxs("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("p",{className:"text-sm mb-2",style:{color:"var(--text-muted)"},children:"Search for MCP servers across npm, Official MCP Registry, and Smithery."}),e.jsx("p",{className:"text-xs",style:{color:"var(--text-faint)"},children:"Type a search term above to get started."})]}),t&&e.jsx(le,{result:t,onConfirm:Y,onCancel:()=>{i(null),C(null)},installing:p,error:R})]})}function xe(){const{t:s}=_(),{data:m,isLoading:o,mutate:d}=J(),c=m??[],[l,x]=a.useState(null),[u,v]=a.useState("installed"),y=c.filter(r=>r.source==="user"||!r.source),h=c.filter(r=>r.source==="system");async function f(r){try{await Q(r),d(),x(null)}catch(g){console.error("Failed to remove MCP server",g)}}return e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 bg-bg-primary",children:[e.jsx(ee,{title:s("config.mcp.title",{n:c.length}),children:e.jsx(w,{variant:"primary",size:"md",onClick:()=>v("store"),children:s("config.mcp.install")})}),e.jsxs("div",{className:"flex items-center gap-1 mb-4",children:[e.jsx("button",{className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors",style:{backgroundColor:u==="installed"?"var(--accent)":"transparent",color:u==="installed"?"#fff":"var(--text-muted)"},onClick:()=>v("installed"),children:s("config.mcp.installed")}),e.jsx("button",{className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors",style:{backgroundColor:u==="store"?"var(--accent)":"transparent",color:u==="store"?"#fff":"var(--text-muted)"},onClick:()=>v("store"),children:s("config.mcp.store")})]})]}),u==="installed"?e.jsxs(e.Fragment,{children:[o?e.jsx("p",{style:{color:"var(--text-secondary)"},children:"Loading..."}):c.length===0?e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:["No MCP servers configured. Click “Add Server” to get started, or browse the ",e.jsx("button",{className:"underline",style:{color:"var(--accent-light)"},onClick:()=>v("store"),children:"MCP Store"}),"."]})}):e.jsxs("div",{className:"space-y-6",children:[y.length>0&&e.jsx(W,{icon:"👤",label:"User",count:y.length,children:y.map(r=>e.jsx(D,{server:r,onClick:()=>x(r)},r.name))}),h.length>0&&e.jsx(W,{icon:"🔧",label:"System",count:h.length,children:h.map(r=>e.jsx(D,{server:r,onClick:()=>x(r)},r.name))})]}),e.jsx(se,{open:l!==null,onClose:()=>x(null),title:(l==null?void 0:l.name)??"",subtitle:"MCP Server",tags:l?[{label:l.enabled!==!1?"Connected":"Disabled",variant:l.enabled!==!1?"green":"red"}]:[],actions:l&&l.source!=="system"?e.jsx(w,{variant:"danger",size:"sm",onClick:()=>f(l.name),children:"Remove"}):void 0,children:l&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Connection Config"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Command"}),e.jsx("code",{className:"text-xs font-mono",style:{color:"var(--accent-light)"},children:l.config.command})]}),l.config.args&&l.config.args.length>0&&e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Args"}),e.jsx("code",{className:"text-xs font-mono text-right",style:{color:"var(--text-secondary)"},children:l.config.args.join(" ")})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Scope"}),e.jsx("span",{className:"text-xs",style:{color:"var(--text-secondary)"},children:"Global"})]})]})]}),l.config.env&&Object.keys(l.config.env).length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Environment Variables"}),e.jsx("div",{className:"rounded-lg p-3 space-y-2",style:{backgroundColor:"var(--bg-secondary)"},children:Object.entries(l.config.env).map(([r])=>e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("code",{className:"text-xs font-mono",style:{color:"var(--accent-light)"},children:r}),e.jsx("code",{className:"text-xs font-mono",style:{color:"var(--text-muted)"},children:"--------"})]},r))})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Tools Provided"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:e.jsx(M,{label:"Tools available when connected",variant:"purple"})})]})]})})]}):e.jsx(ne,{onInstalled:()=>d()})]})}export{xe as default};
1
+ import{j as e,u as _,v as J,r as a,B as w,w as Q,x as X,h as Z,y as q}from"./index-C8Brdl4F.js";import{H as ee}from"./header-BTV9BL6u.js";import{D as se}from"./detail-panel-BIvsI61i.js";import{T as M}from"./tag-CkZkoVAp.js";import{S as te}from"./search-box-CO7338GK.js";function D({server:s,onClick:m}){const o=s.enabled!==!1;return e.jsxs("div",{className:"flex items-center gap-4 px-5 py-4 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--border)"},onClick:m,onMouseEnter:d=>{d.currentTarget.style.backgroundColor="var(--bg-hover)"},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent"},children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:o?"var(--status-green)":"var(--text-muted)"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm",style:{color:"var(--text-primary)",fontWeight:510},children:s.name}),e.jsxs("p",{className:"text-xs font-mono truncate mt-0.5",style:{color:"var(--text-faint)"},children:[s.config.command,s.config.args&&s.config.args.length>0?" "+s.config.args.join(" "):""]})]}),e.jsx(M,{label:o?"Connected":"Disabled",variant:o?"green":"gray"}),e.jsx("svg",{className:"w-4 h-4 shrink-0",style:{color:"var(--text-faint)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})}function W({icon:s,label:m,count:o,children:d}){const[c,l]=a.useState(!0);return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("button",{className:"w-full flex items-center justify-between px-5 py-3 text-left transition-colors hover:bg-bg-hover",style:{borderBottom:c?"1px solid var(--border)":"none"},onClick:()=>l(!c),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base",children:s}),e.jsx("span",{className:"text-sm font-medium",style:{color:m==="User"?"var(--accent-light)":"var(--text-muted)"},children:m}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-secondary)"},children:o})]}),e.jsx("svg",{className:"w-4 h-4 transition-transform",style:{color:"var(--text-muted)",transform:c?"rotate(0deg)":"rotate(-90deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),c&&e.jsx("div",{children:d})]})}function H(s){switch(s){case"mcp-registry":return"green";case"npm":return"blue";case"smithery":return"orange"}}function A(s){switch(s){case"mcp-registry":return"Official Registry";case"npm":return"npm";case"smithery":return"Smithery"}}function re({result:s,onInstall:m}){return e.jsx("div",{className:"rounded-lg p-5 transition-colors hover:bg-bg-hover",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("code",{className:"text-sm font-mono font-medium",style:{color:"var(--accent-light)"},children:s.name}),e.jsx(M,{label:A(s.source),variant:H(s.source)}),s.version&&e.jsx(M,{label:`v${s.version}`,variant:"gray"})]}),s.description&&e.jsx("p",{className:"text-xs mt-1 line-clamp-2",style:{color:"var(--text-secondary)"},children:s.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[s.repositoryUrl&&e.jsx("a",{href:s.repositoryUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs underline transition-colors",style:{color:"var(--text-muted)"},onClick:o=>o.stopPropagation(),children:"Repository"}),s.npmUrl&&e.jsx("a",{href:s.npmUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs underline transition-colors",style:{color:"var(--text-muted)"},onClick:o=>o.stopPropagation(),children:"npm"})]})]}),e.jsx(w,{variant:"primary",size:"sm",onClick:()=>m(s),children:"Install"})]})})}function ae(){return e.jsx("div",{className:"space-y-3",children:[1,2,3].map(s=>e.jsx("div",{className:"rounded-lg p-5 animate-pulse",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 rounded w-48 mb-2",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-full mb-1",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-2/3",style:{backgroundColor:"var(--border)"}})]}),e.jsx("div",{className:"h-8 w-16 rounded-lg",style:{backgroundColor:"var(--border)"}})]})},s))})}function le({result:s,onConfirm:m,onCancel:o,installing:d,error:c}){const l=s.installCommand?s.installCommand.split(" ").slice(1):["-y",s.name],[x,u]=a.useState(s.name),[v,y]=a.useState("npx"),[h,f]=a.useState(l.join(" ")),[r,g]=a.useState([]),L=()=>{g(t=>[...t,{key:"",value:""}])},k=(t,i,p)=>{g(j=>j.map((R,C)=>C===t?{...R,[i]:p}:R))},T=t=>{g(i=>i.filter((p,j)=>j!==t))},b=()=>{const t={};for(const i of r)i.key.trim()&&(t[i.key.trim()]=i.value);m(x.trim(),v.trim(),h.trim().split(/\s+/).filter(Boolean),t)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-50",style:{backgroundColor:"var(--overlay-bg)"},onClick:o}),e.jsxs("div",{className:"fixed z-50 rounded-lg p-6 shadow-2xl",style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"480px",maxWidth:"95vw",maxHeight:"85vh",overflowY:"auto",backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},onClick:t=>t.stopPropagation(),children:[e.jsx("h2",{className:"text-lg font-medium mb-1",style:{color:"var(--text-primary)"},children:"Install MCP Server"}),e.jsx("p",{className:"text-xs mb-5",style:{color:"var(--text-muted)"},children:"This will add the server to your user-level MCP config (~/.claude/.mcp.json)."}),e.jsx("div",{className:"mb-4",children:e.jsx(M,{label:A(s.source),variant:H(s.source)})}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Server Name"}),e.jsx("input",{type:"text",value:x,onChange:t=>u(t.target.value),className:"w-full px-3 py-2 rounded-lg text-sm font-mono outline-none",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--card-border)",color:"var(--text-primary)"}})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Command"}),e.jsx("input",{type:"text",value:v,onChange:t=>y(t.target.value),className:"w-full px-3 py-2 rounded-lg text-sm font-mono outline-none",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--card-border)",color:"var(--text-primary)"}})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Arguments (space-separated)"}),e.jsx("input",{type:"text",value:h,onChange:t=>f(t.target.value),className:"w-full px-3 py-2 rounded-lg text-sm font-mono outline-none",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--card-border)",color:"var(--text-primary)"}})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"text-xs font-medium",style:{color:"var(--text-secondary)"},children:"Environment Variables"}),e.jsx("button",{className:"text-xs px-2 py-0.5 rounded transition-colors",style:{color:"var(--accent-light)",backgroundColor:"rgba(94, 106, 210, 0.1)"},onClick:L,children:"+ Add"})]}),r.length===0&&e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"No environment variables"}),r.map((t,i)=>e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("input",{type:"text",placeholder:"KEY",value:t.key,onChange:p=>k(i,"key",p.target.value),className:"flex-1 px-2 py-1.5 rounded text-xs font-mono outline-none",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--card-border)",color:"var(--accent-light)"}}),e.jsx("input",{type:"text",placeholder:"value",value:t.value,onChange:p=>k(i,"value",p.target.value),className:"flex-1 px-2 py-1.5 rounded text-xs font-mono outline-none",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--card-border)",color:"var(--text-secondary)"}}),e.jsx("button",{className:"text-xs px-1.5 py-1 rounded transition-colors",style:{color:"var(--status-red)"},onClick:()=>T(i),children:"x"})]},i))]}),e.jsxs("div",{className:"mb-5",children:[e.jsx("label",{className:"block text-xs font-medium mb-1",style:{color:"var(--text-muted)"},children:"Config Preview"}),e.jsx("pre",{className:"rounded-lg p-3 text-xs font-mono overflow-x-auto",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-secondary)"},children:JSON.stringify({[x||"server-name"]:{command:v,...h.trim()?{args:h.trim().split(/\s+/)}:{},...r.some(t=>t.key.trim())?{env:Object.fromEntries(r.filter(t=>t.key.trim()).map(t=>[t.key,t.value]))}:{}}},null,2)})]}),c&&e.jsx("div",{className:"rounded-lg px-3 py-2 mb-4 text-xs",style:{backgroundColor:"rgba(255, 71, 87, 0.15)",color:"var(--status-red)"},children:c}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx(w,{variant:"secondary",size:"md",onClick:o,disabled:d,children:"Cancel"}),e.jsx(w,{variant:"primary",size:"md",onClick:b,disabled:d||!x.trim()||!v.trim(),children:d?"Installing...":"Install"})]})]})]})}function ne({onInstalled:s}){const{t:m}=_(),[o,d]=a.useState(""),[c,l]=a.useState("all"),[x,u]=a.useState([]),[v,y]=a.useState([]),[h,f]=a.useState(!1),[r,g]=a.useState(!1),[L,k]=a.useState(!0),[T,b]=a.useState(!1),[t,i]=a.useState(null),[p,j]=a.useState(!1),[R,C]=a.useState(null),[E,B]=a.useState(null),S=a.useRef(null),O=a.useRef(!1);a.useEffect(()=>{O.current||(O.current=!0,k(!0),X().then(n=>{y(n.results),f(n.smitheryAvailable)}).catch(()=>{}).finally(()=>k(!1)))},[]);const z=a.useCallback(async n=>{if(!n.trim()){u([]),b(!1),g(!1);return}g(!0);try{const I=await Z(n);u(I.results),f(I.smitheryAvailable),b(!0)}catch{b(!0)}finally{g(!1)}},[]);a.useEffect(()=>{if(S.current&&clearTimeout(S.current),!o.trim()){u([]),b(!1);return}return S.current=setTimeout(()=>z(o),300),()=>{S.current&&clearTimeout(S.current)}},[o,z]),a.useEffect(()=>{if(!E)return;const n=setTimeout(()=>B(null),4e3);return()=>clearTimeout(n)},[E]);const P=o.trim().length>0,F=P?x:v,V=P?r:L,N=c==="all"?F:F.filter(n=>n.source===c),Y=async(n,I,G,$)=>{j(!0),C(null);try{await q(n,I,G,Object.keys($).length>0?$:void 0),i(null),B(`Successfully installed "${n}"`),s()}catch(U){C(U instanceof Error?U.message:"Install failed")}finally{j(!1)}},K=[{key:"all",label:"All"},{key:"mcp-registry",label:"Official Registry"},{key:"npm",label:"npm"},{key:"smithery",label:"Smithery"}];return e.jsxs("div",{children:[e.jsx("div",{className:"mb-4",children:e.jsx(te,{value:o,onChange:d,placeholder:m("config.mcp.searchStorePlaceholder")})}),e.jsx("div",{className:"flex items-center gap-2 mb-4 flex-wrap",children:K.map(n=>e.jsx("button",{className:"px-3 py-1 rounded-full text-xs font-medium transition-colors",style:{backgroundColor:c===n.key?"var(--accent)":"var(--input-bg)",color:c===n.key?"#fff":"var(--text-secondary)"},onClick:()=>l(n.key),children:n.label},n.key))}),!h&&T&&e.jsx("p",{className:"text-xs mb-4",style:{color:"var(--text-muted)"},children:"Set SMITHERY_API_KEY environment variable to enable Smithery search."}),E&&e.jsxs("div",{className:"rounded-lg px-4 py-3 mb-4 text-sm flex items-center gap-2",style:{backgroundColor:"rgba(0, 184, 148, 0.15)",color:"var(--status-green)"},children:[e.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),E]}),V?e.jsx(ae,{}):P&&T&&N.length===0?e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:["No results found for “",o,"”",c!=="all"?` in ${A(c)}`:"","."]})}):N.length>0?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:P?`${N.length} result${N.length!==1?"s":""}`:`Top ${N.length} MCP Servers`}),N.map(n=>e.jsx(re,{result:n,onInstall:i},`${n.source}-${n.name}`))]}):e.jsxs("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("p",{className:"text-sm mb-2",style:{color:"var(--text-muted)"},children:"Search for MCP servers across npm, Official MCP Registry, and Smithery."}),e.jsx("p",{className:"text-xs",style:{color:"var(--text-faint)"},children:"Type a search term above to get started."})]}),t&&e.jsx(le,{result:t,onConfirm:Y,onCancel:()=>{i(null),C(null)},installing:p,error:R})]})}function xe(){const{t:s}=_(),{data:m,isLoading:o,mutate:d}=J(),c=m??[],[l,x]=a.useState(null),[u,v]=a.useState("installed"),y=c.filter(r=>r.source==="user"||!r.source),h=c.filter(r=>r.source==="system");async function f(r){try{await Q(r),d(),x(null)}catch(g){console.error("Failed to remove MCP server",g)}}return e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 bg-bg-primary",children:[e.jsx(ee,{title:s("config.mcp.title",{n:c.length}),children:e.jsx(w,{variant:"primary",size:"md",onClick:()=>v("store"),children:s("config.mcp.install")})}),e.jsxs("div",{className:"flex items-center gap-1 mb-4",children:[e.jsx("button",{className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors",style:{backgroundColor:u==="installed"?"var(--accent)":"transparent",color:u==="installed"?"#fff":"var(--text-muted)"},onClick:()=>v("installed"),children:s("config.mcp.installed")}),e.jsx("button",{className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors",style:{backgroundColor:u==="store"?"var(--accent)":"transparent",color:u==="store"?"#fff":"var(--text-muted)"},onClick:()=>v("store"),children:s("config.mcp.store")})]})]}),u==="installed"?e.jsxs(e.Fragment,{children:[o?e.jsx("p",{style:{color:"var(--text-secondary)"},children:"Loading..."}):c.length===0?e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:["No MCP servers configured. Click “Add Server” to get started, or browse the ",e.jsx("button",{className:"underline",style:{color:"var(--accent-light)"},onClick:()=>v("store"),children:"MCP Store"}),"."]})}):e.jsxs("div",{className:"space-y-6",children:[y.length>0&&e.jsx(W,{icon:"👤",label:"User",count:y.length,children:y.map(r=>e.jsx(D,{server:r,onClick:()=>x(r)},r.name))}),h.length>0&&e.jsx(W,{icon:"🔧",label:"System",count:h.length,children:h.map(r=>e.jsx(D,{server:r,onClick:()=>x(r)},r.name))})]}),e.jsx(se,{open:l!==null,onClose:()=>x(null),title:(l==null?void 0:l.name)??"",subtitle:"MCP Server",tags:l?[{label:l.enabled!==!1?"Connected":"Disabled",variant:l.enabled!==!1?"green":"red"}]:[],actions:l&&l.source!=="system"?e.jsx(w,{variant:"danger",size:"sm",onClick:()=>f(l.name),children:"Remove"}):void 0,children:l&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Connection Config"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Command"}),e.jsx("code",{className:"text-xs font-mono",style:{color:"var(--accent-light)"},children:l.config.command})]}),l.config.args&&l.config.args.length>0&&e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Args"}),e.jsx("code",{className:"text-xs font-mono text-right",style:{color:"var(--text-secondary)"},children:l.config.args.join(" ")})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Scope"}),e.jsx("span",{className:"text-xs",style:{color:"var(--text-secondary)"},children:"Global"})]})]})]}),l.config.env&&Object.keys(l.config.env).length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Environment Variables"}),e.jsx("div",{className:"rounded-lg p-3 space-y-2",style:{backgroundColor:"var(--bg-secondary)"},children:Object.entries(l.config.env).map(([r])=>e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("code",{className:"text-xs font-mono",style:{color:"var(--accent-light)"},children:r}),e.jsx("code",{className:"text-xs font-mono",style:{color:"var(--text-muted)"},children:"--------"})]},r))})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Tools Provided"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:e.jsx(M,{label:"Tools available when connected",variant:"purple"})})]})]})})]}):e.jsx(ne,{onInstalled:()=>d()})]})}export{xe as default};
@@ -1,2 +1,2 @@
1
- import{r as u,j as e,B as C,i as $,k as U,u as L,l as E,m as A,n as z,t as W,o as F,p as H,q as V}from"./index-CaDf51H6.js";import{H as O}from"./header-CBzSNzdI.js";import{D as B}from"./detail-panel-C8SGLgm-.js";import{S as D}from"./search-box-CqaIZ9mR.js";import{T as y}from"./tag-Q3V7Jugn.js";import{S as q}from"./select-BtWQJMup.js";import{M as G}from"./markdown-viewer-Bj8nSOSJ.js";function K({open:r,onClose:i,title:l,message:d,command:p,commandNote:m}){const[h,a]=u.useState(!1);if(!r)return null;function t(){p&&(navigator.clipboard.writeText(p),a(!0),setTimeout(()=>a(!1),2e3))}return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--overlay-bg)"},onClick:i,children:e.jsxs("div",{className:"rounded-lg p-6 w-full max-w-lg mx-4",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--card-border)",boxShadow:"rgba(0,0,0,0.4) 0px 8px 24px"},onClick:v=>v.stopPropagation(),children:[e.jsx("h3",{className:"text-lg mb-3",style:{color:"var(--text-primary)",fontWeight:510},children:l}),e.jsx("p",{className:"text-sm mb-4 whitespace-pre-wrap",style:{color:"var(--text-secondary)"},children:d}),p&&e.jsxs("div",{className:"rounded-lg p-3 mb-4 flex items-center justify-between gap-3",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--border)"},children:[e.jsx("code",{className:"text-sm font-mono flex-1 min-w-0 break-all",style:{color:"var(--accent-light)"},children:p}),e.jsx("button",{onClick:t,className:"shrink-0 px-3 py-1.5 rounded text-xs font-medium transition-colors hover:bg-bg-hover",style:{color:h?"var(--status-green)":"var(--text-secondary)",border:"1px solid var(--border)"},children:h?"✓ Copied":"📋 Copy"})]}),m&&e.jsx("p",{className:"text-xs mb-4",style:{color:"var(--text-muted)"},children:m}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx(C,{variant:"primary",size:"md",onClick:i,children:"Got it"})})]})})}function _({plugin:r,onClick:i}){return e.jsxs("div",{className:"flex items-center gap-4 px-5 py-4 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--border)"},onClick:i,onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--bg-hover)"},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent"},children:[e.jsx("div",{className:"w-9 h-9 rounded-lg shrink-0 flex items-center justify-center text-white text-sm font-medium",style:{backgroundColor:"var(--accent)"},children:r.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm",style:{color:"var(--text-primary)",fontWeight:510},children:r.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[e.jsx(y,{label:`v${r.version}`,variant:"gray"}),e.jsx(y,{label:r.marketplace,variant:"blue"}),r.enabled?e.jsx(y,{label:"Enabled",variant:"green"}):e.jsx(y,{label:"Disabled",variant:"red"})]})]}),e.jsx("svg",{className:"w-4 h-4 shrink-0",style:{color:"var(--text-faint)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})}function J(r){return r.type==="http"?`# HTTP MCP server — connect via an MCP client:
1
+ import{r as u,j as e,B as C,i as $,k as U,u as L,l as E,m as A,n as z,t as W,o as F,p as H,q as V}from"./index-C8Brdl4F.js";import{H as O}from"./header-BTV9BL6u.js";import{D as B}from"./detail-panel-BIvsI61i.js";import{S as D}from"./search-box-CO7338GK.js";import{T as y}from"./tag-CkZkoVAp.js";import{S as q}from"./select-BdEpCEBk.js";import{M as G}from"./markdown-viewer-Bcu9HM71.js";function K({open:r,onClose:i,title:l,message:d,command:p,commandNote:m}){const[h,a]=u.useState(!1);if(!r)return null;function t(){p&&(navigator.clipboard.writeText(p),a(!0),setTimeout(()=>a(!1),2e3))}return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--overlay-bg)"},onClick:i,children:e.jsxs("div",{className:"rounded-lg p-6 w-full max-w-lg mx-4",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--card-border)",boxShadow:"rgba(0,0,0,0.4) 0px 8px 24px"},onClick:v=>v.stopPropagation(),children:[e.jsx("h3",{className:"text-lg mb-3",style:{color:"var(--text-primary)",fontWeight:510},children:l}),e.jsx("p",{className:"text-sm mb-4 whitespace-pre-wrap",style:{color:"var(--text-secondary)"},children:d}),p&&e.jsxs("div",{className:"rounded-lg p-3 mb-4 flex items-center justify-between gap-3",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--border)"},children:[e.jsx("code",{className:"text-sm font-mono flex-1 min-w-0 break-all",style:{color:"var(--accent-light)"},children:p}),e.jsx("button",{onClick:t,className:"shrink-0 px-3 py-1.5 rounded text-xs font-medium transition-colors hover:bg-bg-hover",style:{color:h?"var(--status-green)":"var(--text-secondary)",border:"1px solid var(--border)"},children:h?"✓ Copied":"📋 Copy"})]}),m&&e.jsx("p",{className:"text-xs mb-4",style:{color:"var(--text-muted)"},children:m}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx(C,{variant:"primary",size:"md",onClick:i,children:"Got it"})})]})})}function _({plugin:r,onClick:i}){return e.jsxs("div",{className:"flex items-center gap-4 px-5 py-4 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--border)"},onClick:i,onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--bg-hover)"},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent"},children:[e.jsx("div",{className:"w-9 h-9 rounded-lg shrink-0 flex items-center justify-center text-white text-sm font-medium",style:{backgroundColor:"var(--accent)"},children:r.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm",style:{color:"var(--text-primary)",fontWeight:510},children:r.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[e.jsx(y,{label:`v${r.version}`,variant:"gray"}),e.jsx(y,{label:r.marketplace,variant:"blue"}),r.enabled?e.jsx(y,{label:"Enabled",variant:"green"}):e.jsx(y,{label:"Disabled",variant:"red"})]})]}),e.jsx("svg",{className:"w-4 h-4 shrink-0",style:{color:"var(--text-faint)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})}function J(r){return r.type==="http"?`# HTTP MCP server — connect via an MCP client:
2
2
  # url: ${r.url??""}`:[r.command??"",...r.args??[]].filter(Boolean).join(" ")}function T({text:r,label:i="Copy"}){const[l,d]=u.useState(!1),p=m=>{m.stopPropagation(),navigator.clipboard.writeText(r),d(!0),window.setTimeout(()=>d(!1),1500)};return e.jsxs("button",{onClick:p,className:"inline-flex items-center gap-1 rounded px-2 py-1 transition-colors hover:bg-bg-hover",style:{fontSize:"11px",color:l?"var(--status-green)":"var(--text-muted)",border:"1px solid var(--card-border)"},title:l?"Copied!":r,children:[l?e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),l?"Copied":i]})}function R({primary:r,secondary:i,onClick:l}){return e.jsxs("div",{role:"button",tabIndex:0,onClick:l,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l())},className:"rounded-lg px-3 py-2 cursor-pointer transition-colors hover:bg-bg-hover",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("code",{className:"text-xs font-mono font-medium",style:{color:"var(--text-primary)"},children:r}),i&&e.jsx("p",{className:"text-xs mt-1 line-clamp-3",style:{color:"var(--text-secondary)"},children:i.replace(/^"|"$/g,"")})]})}function S({title:r,count:i,children:l}){return e.jsxs("section",{children:[e.jsxs("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3 flex items-center gap-2",style:{color:"var(--text-muted)"},children:[r,e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-secondary)"},children:i})]}),l]})}function Q({preview:r,pluginName:i,onClose:l}){const[d,p]=u.useState(null),[m,h]=u.useState(!0);return u.useEffect(()=>{let a=!1;return h(!0),p(null),U(r.filePath).then(({content:t})=>{a||p(t)}).catch(()=>{a||p("*Failed to load content*")}).finally(()=>{a||h(!1)}),()=>{a=!0}},[r.filePath]),u.useEffect(()=>{const a=t=>{t.key==="Escape"&&l()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[l]),e.jsxs("div",{className:"fixed inset-0 flex flex-col",style:{backgroundColor:"var(--bg-primary)",zIndex:60},children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 shrink-0 gap-3",style:{borderBottom:"1px solid var(--border)",backgroundColor:"var(--bg-secondary)"},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("code",{className:"text-base font-mono font-medium truncate",style:{color:"var(--accent-light)"},children:r.kind==="command"?`/${r.name}`:r.name}),e.jsx(y,{label:r.kind==="command"?"Command":"Skill",variant:"blue"}),e.jsx(y,{label:i,variant:"gray"}),e.jsx(y,{label:"Read-only",variant:"orange"})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("code",{className:"text-xs font-mono hidden lg:block",style:{color:"var(--text-muted)"},children:r.filePath}),e.jsx("button",{className:"w-8 h-8 rounded-lg flex items-center justify-center transition-colors hover:bg-bg-hover",style:{color:"var(--text-secondary)"},onClick:l,"aria-label":"Close preview",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto px-8 py-6",children:m?e.jsx("div",{className:"max-w-4xl mx-auto text-center py-12",children:e.jsx("p",{style:{color:"var(--text-muted)"},children:"Loading content..."})}):e.jsx(G,{content:d??"*No content available*",className:"max-w-4xl mx-auto skill-markdown"})})]})}function X({pluginName:r}){const[i,l]=u.useState(null),[d,p]=u.useState(!0),[m,h]=u.useState(null),[a,t]=u.useState(null);if(u.useEffect(()=>{let s=!1;return p(!0),h(null),l(null),t(null),fetch(`/api/plugins/${encodeURIComponent(r)}/contents`).then(n=>{if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}).then(n=>{s||l(n)}).catch(n=>{s||h(String(n))}).finally(()=>{s||p(!1)}),()=>{s=!0}},[r]),d)return e.jsx("div",{className:"space-y-3",children:[0,1,2].map(s=>e.jsx("div",{className:"rounded-lg h-14 animate-pulse",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"}},s))});if(m||!i)return e.jsxs("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:["Could not load plugin contents",m?` (${m})`:"","."]});const{commands:v,skills:f,mcpServers:x}=i;return v.length>0||f.length>0||x.length>0?e.jsxs(e.Fragment,{children:[v.length>0&&e.jsx(S,{title:"Commands",count:v.length,children:e.jsx("div",{className:"space-y-2",children:v.map(s=>e.jsx(R,{primary:`/${s.name}`,secondary:s.description,onClick:()=>t({kind:"command",name:s.name,filePath:s.filePath})},s.filePath))})}),f.length>0&&e.jsx(S,{title:"Skills",count:f.length,children:e.jsx("div",{className:"space-y-2",children:f.map(s=>e.jsx(R,{primary:s.name,secondary:s.description,onClick:()=>t({kind:"skill",name:s.name,filePath:s.filePath})},s.filePath))})}),x.length>0&&e.jsx(S,{title:"MCP Servers",count:x.length,children:e.jsx("div",{className:"space-y-2",children:x.map(s=>{const n=J(s);return e.jsxs("div",{className:"rounded-lg px-3 py-2 space-y-2",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"text-xs font-mono font-medium",style:{color:"var(--text-primary)"},children:s.name}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--border)",color:"var(--text-secondary)"},children:s.type})]}),s.type==="stdio"&&n&&e.jsx(T,{text:n,label:"Copy"}),s.type==="http"&&s.url&&e.jsx(T,{text:s.url,label:"Copy URL"})]}),e.jsx("code",{className:"block text-xs font-mono px-2 py-1.5 rounded break-all whitespace-pre-wrap",style:{backgroundColor:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:s.type==="http"?s.url:n}),e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Run this in your terminal to inspect the server's tools and prompts."})]},s.name)})})}),a&&$.createPortal(e.jsx(Q,{preview:a,pluginName:r,onClose:()=>t(null)}),document.body)]}):e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"This plugin does not expose any commands, skills, or MCP servers."})}function Y(){const{t:r}=L(),{data:i,isLoading:l,mutate:d}=E(),p=i??[],[m,h]=u.useState(""),[a,t]=u.useState(null),[v,f]=u.useState({}),[x,k]=u.useState(null),s=p.filter(o=>o.name.toLowerCase().includes(m.toLowerCase()));async function n(o){try{await F(o),d(),t(null)}catch(b){console.error("Failed to remove plugin",b)}}async function w(o){try{await W(o.name,!o.enabled),d(),t({...o,enabled:!o.enabled})}catch(b){console.error("Failed to toggle plugin",b)}}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(D,{value:m,onChange:h,placeholder:r("config.plugins.searchInstalledPlaceholder")})}),l?e.jsx("p",{style:{color:"var(--text-secondary)"},children:"Loading..."}):s.length===0?e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:m?"No plugins match your search.":"No plugins installed."})}):e.jsx("div",{className:"space-y-6",children:Object.entries(s.reduce((o,b)=>{const N=b.marketplace||"unknown";return o[N]||(o[N]=[]),o[N].push(b),o},{})).map(([o,b])=>{const N=v[o];return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("button",{className:"w-full flex items-center justify-between px-5 py-3 text-left transition-colors hover:bg-bg-hover",style:{borderBottom:N?"none":"1px solid var(--border)"},onClick:()=>f(c=>({...c,[o]:!c[o]})),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",style:{color:"var(--accent-light)"},children:o}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-secondary)"},children:b.length})]}),e.jsx("svg",{className:"w-4 h-4 transition-transform",style:{color:"var(--text-muted)",transform:N?"rotate(-90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),!N&&e.jsx("div",{children:b.map(c=>e.jsx(_,{plugin:c,onClick:()=>t(c)},c.name))})]},o)})}),e.jsx(B,{open:a!==null,onClose:()=>t(null),title:(a==null?void 0:a.name)??"",subtitle:a==null?void 0:a.marketplace,icon:e.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center text-text-primary text-sm font-medium",style:{background:"linear-gradient(135deg, var(--accent), var(--accent-light))"},children:a==null?void 0:a.name.charAt(0).toUpperCase()}),tags:a?[{label:`v${a.version}`,variant:"gray"},{label:a.marketplace,variant:"blue"},{label:a.enabled?"Enabled":"Disabled",variant:a.enabled?"green":"red"}]:[],actions:a?e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"secondary",size:"sm",title:"Dashboard cannot fetch marketplace updates. Run `/plugin marketplace update` in Claude Code — command copied to clipboard.",onClick:()=>{const o=`/plugin marketplace update ${a.marketplace}`;navigator.clipboard.writeText(o),k({title:"Check for Updates",message:"Dashboard cannot fetch marketplace updates directly — this runs in Claude Code.",command:o,commandNote:"The command has been copied to your clipboard. Paste it into Claude Code to refresh this marketplace."})},children:"Check Updates"}),e.jsx(C,{variant:"secondary",size:"sm",onClick:()=>w(a),children:a.enabled?"Disable":"Enable"}),e.jsx(C,{variant:"danger",size:"sm",onClick:()=>n(a.name),children:"Remove"})]}):void 0,children:a&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Metadata"}),e.jsx("div",{className:"space-y-2",children:[{label:"Marketplace",value:a.marketplace},{label:"Installed",value:new Date(a.installedAt).toLocaleDateString()},{label:"Last Updated",value:new Date(a.lastUpdated).toLocaleDateString()},{label:"Install Path",value:a.installPath}].map(({label:o,value:b})=>e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:o}),e.jsx("span",{className:"text-xs text-right break-all font-mono",style:{color:"var(--text-secondary)",maxWidth:"240px"},children:b})]},o))})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Status"}),e.jsx("div",{className:"flex gap-2",children:e.jsx(y,{label:a.enabled?"Enabled":"Disabled",variant:a.enabled?"green":"red"})})]}),e.jsx(X,{pluginName:a.name})]})}),e.jsx(K,{open:x!==null,onClose:()=>k(null),title:(x==null?void 0:x.title)??"",message:(x==null?void 0:x.message)??"",command:x==null?void 0:x.command,commandNote:x==null?void 0:x.commandNote})]})}function Z(){const{t:r}=L(),{data:i,isLoading:l}=A(),d=i??[],[p,m]=u.useState(null),[h,a]=u.useState(""),[t,v]=u.useState(null),[f,x]=u.useState(!1),k=p??(d.length>0?d[0].name:null),{data:s,isLoading:n}=z(k),o=(s??[]).filter(c=>c.name.toLowerCase().includes(h.toLowerCase())||c.description.toLowerCase().includes(h.toLowerCase())||(c.category??"").toLowerCase().includes(h.toLowerCase())),b=o.reduce((c,j)=>{const g=j.category||"other";return c[g]||(c[g]=[]),c[g].push(j),c},{}),N=Object.entries(b).sort(([c],[j])=>c.localeCompare(j));return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-56",children:e.jsx(q,{value:k??"",onChange:c=>{m(c),a(""),v(null)},options:d.length===0?[{value:"",label:"No marketplaces"}]:d.map(c=>({value:c.name,label:c.name})),placeholder:r("config.plugins.marketplaceSelectPlaceholder"),disabled:l||d.length===0})}),e.jsx("div",{className:"flex-1",children:e.jsx(D,{value:h,onChange:a,placeholder:r("config.plugins.searchAvailablePlaceholder")})}),o.length>0&&e.jsxs("span",{className:"text-xs shrink-0",style:{color:"var(--text-muted)"},children:[o.length," plugin",o.length!==1?"s":""]})]}),n||l?e.jsx("p",{style:{color:"var(--text-secondary)"},children:"Loading..."}):k?o.length===0?e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:h?"No plugins match your search.":"No plugins found in this marketplace."})}):e.jsx("div",{className:"space-y-4",children:N.map(([c,j])=>e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xs font-medium uppercase tracking-wider mb-2 px-1",style:{color:"var(--text-muted)"},children:[c," (",j.length,")"]}),e.jsx("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:j.map((g,I)=>e.jsxs("div",{className:"flex items-center gap-4 px-5 py-4 cursor-pointer transition-colors hover:bg-bg-hover",style:{borderBottom:I<j.length-1?"1px solid var(--border)":"none"},onClick:()=>v(g),children:[e.jsx("div",{className:"w-9 h-9 rounded-lg shrink-0 flex items-center justify-center text-text-primary text-sm font-medium",style:{background:g.installed?"linear-gradient(135deg, var(--status-green), #4ade80)":"linear-gradient(135deg, var(--accent), var(--accent-hover))"},children:g.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:g.name}),g.installed?e.jsx(y,{label:"Installed",variant:"green"}):e.jsx(y,{label:"Available",variant:"blue"}),g.installed&&g.enabled&&e.jsx(y,{label:"Enabled",variant:"green"})]}),e.jsx("p",{className:"text-xs mt-1 line-clamp-2",style:{color:"var(--text-secondary)"},children:g.description||"No description available."})]}),!g.installed&&e.jsxs("code",{className:"text-xs font-mono px-2 py-1 rounded shrink-0 cursor-pointer inline-flex items-center gap-1.5 transition-colors hover:opacity-80",style:{backgroundColor:"var(--bg-secondary)",color:"var(--accent-light)",border:"1px solid var(--border)"},title:"Click to copy",onClick:M=>{M.stopPropagation(),navigator.clipboard.writeText(`/plugin install ${g.name}@${k}`);const P=M.currentTarget;P.style.color="var(--status-green)",setTimeout(()=>{P.style.color="var(--accent-light)"},1e3)},children:["/plugin install ",g.name,"@",k,e.jsxs("svg",{className:"w-3 h-3 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})]}),e.jsx("svg",{className:"w-4 h-4 shrink-0",style:{color:"var(--text-muted)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},g.name))})]},c))}):e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:'No marketplaces configured. Add one in the "Manage Marketplaces" tab.'})}),e.jsx(B,{open:t!==null,onClose:()=>v(null),title:(t==null?void 0:t.name)??"",subtitle:t==null?void 0:t.marketplace,icon:e.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center text-text-primary text-sm font-medium",style:{background:t!=null&&t.installed?"linear-gradient(135deg, var(--status-green), #4ade80)":"linear-gradient(135deg, var(--accent), var(--accent-hover))"},children:t==null?void 0:t.name.charAt(0).toUpperCase()}),tags:t?[{label:`v${t.version}`,variant:"gray"},{label:t.marketplace,variant:"blue"},{label:t.installed?"Installed":"Available",variant:t.installed?"green":"blue"},...t.category?[{label:t.category,variant:"purple"}]:[]]:[],actions:t&&!t.installed?e.jsx(C,{variant:"primary",size:"sm",title:"Plugin install must be run inside Claude Code. The command is copied to your clipboard.",onClick:()=>{const c=`/plugin install ${t.name}@${t.marketplace}`;navigator.clipboard.writeText(c),x(!0),setTimeout(()=>x(!1),2e3)},children:f?"Copied!":"Copy Install Command"}):void 0,children:t&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Description"}),e.jsx("p",{className:"text-sm",style:{color:"var(--text-secondary)"},children:t.description||"No description available."})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Details"}),e.jsx("div",{className:"space-y-2",children:[{label:"Version",value:t.version},{label:"Marketplace",value:t.marketplace},...t.category?[{label:"Category",value:t.category}]:[],...t.homepage?[{label:"Homepage",value:t.homepage}]:[]].map(({label:c,value:j})=>e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:c}),c==="Homepage"?e.jsx("a",{href:j,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-right break-all font-mono hover:underline",style:{color:"var(--accent-hover)",maxWidth:"240px"},children:j}):e.jsx("span",{className:"text-xs text-right break-all font-mono",style:{color:"var(--text-secondary)",maxWidth:"240px"},children:j})]},c))})]}),!t.installed&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Installation"}),e.jsxs("div",{className:"rounded-lg p-3",style:{backgroundColor:"var(--bg-secondary)"},children:[e.jsx("p",{className:"text-xs mb-2",style:{color:"var(--text-secondary)"},children:"Run this command in Claude Code to install:"}),e.jsxs("code",{className:"text-xs block font-mono px-2 py-1 rounded",style:{backgroundColor:"var(--border)",color:"var(--accent-light)"},children:["/plugin install ",t.name,"@",t.marketplace]})]})]})]})})]})}function ee(){const{data:r,isLoading:i,mutate:l}=A(),d=r??[],[p,m]=u.useState(""),[h,a]=u.useState(""),[t,v]=u.useState(null),[f,x]=u.useState(!1);async function k(){if(!p.trim()||!h.trim()){v("Both name and repository are required.");return}v(null),x(!0);try{await H(p.trim(),h.trim()),l(),m(""),a("")}catch(n){v(n instanceof Error?n.message:"Failed to add marketplace")}finally{x(!1)}}async function s(n){try{await V(n),l()}catch(w){console.error("Failed to remove marketplace",w)}}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-lg p-5 mb-6",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("h3",{className:"text-sm font-medium mb-4",style:{color:"var(--text-primary)"},children:"Add Marketplace"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs block mb-1",style:{color:"var(--text-muted)"},children:"Name"}),e.jsx("input",{type:"text",value:p,onChange:n=>m(n.target.value),placeholder:"e.g., my-plugins",className:"w-full px-3 py-2 rounded-lg text-sm outline-none",style:{backgroundColor:"var(--border)",border:"1px solid var(--input-border)",color:"var(--text-primary)"}})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs block mb-1",style:{color:"var(--text-muted)"},children:"GitHub Repository"}),e.jsx("input",{type:"text",value:h,onChange:n=>a(n.target.value),placeholder:"e.g., owner/repo-name",className:"w-full px-3 py-2 rounded-lg text-sm outline-none",style:{backgroundColor:"var(--border)",border:"1px solid var(--input-border)",color:"var(--text-primary)"}})]}),t&&e.jsx("p",{className:"text-xs",style:{color:"var(--status-red)"},children:t}),e.jsx(C,{variant:"primary",size:"md",onClick:k,disabled:f,children:f?"Adding...":"Add Marketplace"})]}),e.jsxs("p",{className:"text-xs mt-3",style:{color:"var(--text-muted)"},children:["Note: Adding a marketplace here only registers it. To clone the repository, run ",e.jsx("code",{style:{color:"var(--accent-light)"},children:"/marketplace add"})," in Claude Code."]})]}),e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Registered Marketplaces"}),i?e.jsx("p",{style:{color:"var(--text-secondary)"},children:"Loading..."}):d.length===0?e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"No marketplaces registered."})}):e.jsx("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:d.map((n,w)=>e.jsxs("div",{className:"flex items-center gap-4 px-5 py-4",style:{borderBottom:w<d.length-1?"1px solid var(--border)":"none"},children:[e.jsx("div",{className:"w-9 h-9 rounded-lg shrink-0 flex items-center justify-center text-text-primary text-sm font-medium",style:{background:"linear-gradient(135deg, var(--text-secondary), var(--accent-hover))"},children:n.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:n.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[e.jsx(y,{label:n.source.repo,variant:"blue"}),e.jsx(y,{label:n.source.source,variant:"gray"}),e.jsxs("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:["Updated: ",new Date(n.lastUpdated).toLocaleDateString()]})]})]}),e.jsx(C,{variant:"danger",size:"sm",onClick:()=>s(n.name),children:"Remove"})]},n.name))})]})}function ce(){const{t:r}=L(),[i,l]=u.useState("installed"),{data:d}=E(),p=(d??[]).length;return e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 bg-bg-primary",children:[e.jsx(O,{title:r("config.plugins.title",{n:p})}),e.jsx("div",{className:"flex items-center gap-1 mb-4",children:[{id:"installed",label:r("config.plugins.installed")},{id:"marketplace",label:r("config.plugins.marketplace")},{id:"manage",label:r("config.plugins.manageMarketplaces")}].map(({id:m,label:h})=>e.jsx("button",{className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors",style:{backgroundColor:i===m?"var(--accent)":"transparent",color:i===m?"#fff":"var(--text-muted)"},onClick:()=>l(m),children:h},m))})]}),i==="installed"&&e.jsx(Y,{}),i==="marketplace"&&e.jsx(Z,{}),i==="manage"&&e.jsx(ee,{})]})}export{ce as default};
@@ -1,2 +1,2 @@
1
- import{j as e,B as h,r as m,I as S,J as L,b as D,u as R,K as E,L as O,M as W}from"./index-CaDf51H6.js";import{H as z}from"./header-CBzSNzdI.js";import{T as C}from"./tag-Q3V7Jugn.js";import{S as A}from"./select-BtWQJMup.js";function I({open:r,onClose:s,onConfirm:p,title:o,message:x,confirmLabel:c="Confirm",variant:n="danger"}){return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--overlay-bg)"},onClick:s,children:e.jsxs("div",{className:"rounded-lg p-6 w-full max-w-md mx-4",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--card-border)",boxShadow:"rgba(0,0,0,0.4) 0px 2px 4px"},onClick:d=>d.stopPropagation(),children:[e.jsx("h3",{className:"text-lg mb-2",style:{color:"var(--text-primary)",fontWeight:510},children:o}),e.jsx("p",{className:"text-sm mb-6",style:{color:"var(--text-secondary)"},children:x}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx(h,{variant:"ghost",size:"md",onClick:s,children:"Cancel"}),e.jsx(h,{variant:n,size:"md",onClick:p,children:c})]})]})}):null}function F({profile:r,onActivate:s,onExport:p,onDelete:o}){var n,d;const x=((n=r.plugins)==null?void 0:n.length)??0,c=Object.keys(r.mcpServers??{}).length;return e.jsxs("div",{className:"rounded-lg p-5 flex flex-col gap-4",style:{backgroundColor:"var(--card-bg)",border:r.active?"1px solid var(--accent)":"1px solid var(--card-border)"},children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-medium text-base shrink-0",style:{backgroundColor:"var(--accent)"},children:r.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm",style:{color:"var(--text-primary)",fontWeight:510},children:r.name}),e.jsxs("p",{className:"text-xs mt-0.5",style:{color:"var(--text-faint)"},children:["Created ",new Date(r.createdAt).toLocaleDateString()]})]})]}),r.active&&e.jsx(C,{label:"Active",variant:"green"})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(C,{label:`${x} plugins`,variant:"purple"}),e.jsx(C,{label:`${c} MCPs`,variant:"blue"}),((d=r.commands)==null?void 0:d.length)>0&&e.jsx(C,{label:`${r.commands.length} commands`,variant:"gray"})]}),r.description&&e.jsx("p",{className:"text-xs",style:{color:"var(--text-secondary)"},children:r.description}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsx(h,{variant:r.active?"ghost":"primary",size:"sm",onClick:s,disabled:r.active,children:r.active?"Active":"Activate"}),e.jsx(h,{variant:"secondary",size:"sm",onClick:p,children:"Export"}),e.jsx(h,{variant:"danger",size:"sm",onClick:o,children:"Delete"})]})]})}function T({profiles:r}){const[s,p]=m.useState(""),[o,x]=m.useState("json"),[c,n]=m.useState(!1),[d,u]=m.useState({plugins:!0,mcpServers:!0,commands:!0,settings:!0,credentials:!1});function v(t){u(a=>({...a,[t]:!a[t]}))}async function f(){if(s){n(!0);try{const{data:t}=await S(s),a=new Blob([t],{type:o==="json"?"application/json":"text/yaml"}),i=URL.createObjectURL(a),j=document.createElement("a");j.href=i,j.download=`${s}-export.${o}`,j.click(),URL.revokeObjectURL(i)}catch(t){console.error("Export failed",t)}finally{n(!1)}}}const b=[{value:"",label:"Select a profile..."},...r.map(t=>({value:t.name,label:t.name}))];return e.jsxs("div",{className:"rounded-lg p-5 h-full",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("h2",{className:"text-base mb-4",style:{color:"var(--text-primary)",fontWeight:510},children:"Export"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider mb-2",style:{color:"var(--text-muted)",fontWeight:510},children:"Profile"}),e.jsx(A,{value:s,onChange:p,options:b,placeholder:"Select a profile..."})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider mb-2",style:{color:"var(--text-muted)",fontWeight:510},children:"Include"}),e.jsx("div",{className:"space-y-2",children:Object.keys(d).map(t=>e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:d[t],onChange:()=>v(t),className:"w-4 h-4 rounded",style:{accentColor:"var(--accent)"}}),e.jsx("span",{className:"text-sm capitalize",style:{color:"var(--text-secondary)"},children:t==="mcpServers"?"MCP Servers":t}),t==="credentials"&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{backgroundColor:"rgba(255, 71, 87, 0.15)",color:"var(--status-red)"},children:"sensitive"})]},t))})]}),e.jsxs("div",{className:"mb-5",children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider mb-2",style:{color:"var(--text-muted)",fontWeight:510},children:"Format"}),e.jsx("div",{className:"flex gap-2",children:["json","yaml"].map(t=>e.jsx("button",{onClick:()=>x(t),className:"px-4 py-1.5 rounded-md text-sm transition-colors",style:{backgroundColor:o===t?"var(--accent)":"var(--input-bg)",color:o===t?"#fff":"var(--text-secondary)",border:o===t?"none":"1px solid var(--card-border)",fontWeight:510},children:t.toUpperCase()},t))})]}),e.jsx(h,{variant:"primary",size:"md",onClick:f,disabled:!s||c,children:c?"Exporting...":"Export to File"})]})}function U(){const[r,s]=m.useState(null),[p,o]=m.useState(null),[x,c]=m.useState(null),[n,d]=m.useState(!1),[u,v]=m.useState(!1),[f,b]=m.useState(null),t=m.useRef(null);function a(l){o(l.name);const g=new FileReader;g.onload=N=>{var w;const k=(w=N.target)==null?void 0:w.result;s(k);try{const P=JSON.parse(k);c(P)}catch{c({raw:k.slice(0,200)})}},g.readAsText(l)}function i(l){l.preventDefault(),d(!1);const g=l.dataTransfer.files[0];g&&a(g)}function j(l){var N;const g=(N=l.target.files)==null?void 0:N[0];g&&a(g)}async function y(l){if(r){v(!0),b(null);try{await L(r,l),b(`Import successful (${l} strategy applied).`)}catch(g){b(`Import failed: ${g.message}`)}finally{v(!1)}}}return e.jsxs("div",{className:"rounded-lg p-5 h-full",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("h2",{className:"text-base mb-4",style:{color:"var(--text-primary)",fontWeight:510},children:"Import"}),e.jsxs("div",{className:"rounded-lg border-2 border-dashed p-8 text-center mb-4 cursor-pointer transition-colors",style:{borderColor:n?"var(--accent)":"var(--card-border)",backgroundColor:n?"rgba(94, 106, 210, 0.05)":"transparent"},onDragOver:l=>{l.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:i,onClick:()=>{var l;return(l=t.current)==null?void 0:l.click()},children:[e.jsx("input",{ref:t,type:"file",accept:".json,.yaml,.yml",className:"hidden",onChange:j}),e.jsx("svg",{className:"w-8 h-8 mx-auto mb-2",style:{color:"var(--text-muted)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),p?e.jsx("p",{className:"text-sm",style:{color:"var(--accent-light)",fontWeight:510},children:p}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm",style:{color:"var(--text-secondary)",fontWeight:510},children:"Drop JSON or YAML file here"}),e.jsx("p",{className:"text-xs mt-1",style:{color:"var(--text-muted)"},children:"or click to browse"})]})]}),x&&e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider mb-2",style:{color:"var(--text-muted)",fontWeight:510},children:"Preview"}),e.jsxs("pre",{className:"text-xs rounded-lg p-3 overflow-auto max-h-48 whitespace-pre-wrap",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-secondary)"},children:[JSON.stringify(x,null,2).slice(0,600),JSON.stringify(x,null,2).length>600?`
1
+ import{j as e,B as h,r as m,I as S,J as L,b as D,u as R,K as E,L as O,M as W}from"./index-C8Brdl4F.js";import{H as z}from"./header-BTV9BL6u.js";import{T as C}from"./tag-CkZkoVAp.js";import{S as A}from"./select-BdEpCEBk.js";function I({open:r,onClose:s,onConfirm:p,title:o,message:x,confirmLabel:c="Confirm",variant:n="danger"}){return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--overlay-bg)"},onClick:s,children:e.jsxs("div",{className:"rounded-lg p-6 w-full max-w-md mx-4",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--card-border)",boxShadow:"rgba(0,0,0,0.4) 0px 2px 4px"},onClick:d=>d.stopPropagation(),children:[e.jsx("h3",{className:"text-lg mb-2",style:{color:"var(--text-primary)",fontWeight:510},children:o}),e.jsx("p",{className:"text-sm mb-6",style:{color:"var(--text-secondary)"},children:x}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx(h,{variant:"ghost",size:"md",onClick:s,children:"Cancel"}),e.jsx(h,{variant:n,size:"md",onClick:p,children:c})]})]})}):null}function F({profile:r,onActivate:s,onExport:p,onDelete:o}){var n,d;const x=((n=r.plugins)==null?void 0:n.length)??0,c=Object.keys(r.mcpServers??{}).length;return e.jsxs("div",{className:"rounded-lg p-5 flex flex-col gap-4",style:{backgroundColor:"var(--card-bg)",border:r.active?"1px solid var(--accent)":"1px solid var(--card-border)"},children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-medium text-base shrink-0",style:{backgroundColor:"var(--accent)"},children:r.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm",style:{color:"var(--text-primary)",fontWeight:510},children:r.name}),e.jsxs("p",{className:"text-xs mt-0.5",style:{color:"var(--text-faint)"},children:["Created ",new Date(r.createdAt).toLocaleDateString()]})]})]}),r.active&&e.jsx(C,{label:"Active",variant:"green"})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(C,{label:`${x} plugins`,variant:"purple"}),e.jsx(C,{label:`${c} MCPs`,variant:"blue"}),((d=r.commands)==null?void 0:d.length)>0&&e.jsx(C,{label:`${r.commands.length} commands`,variant:"gray"})]}),r.description&&e.jsx("p",{className:"text-xs",style:{color:"var(--text-secondary)"},children:r.description}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsx(h,{variant:r.active?"ghost":"primary",size:"sm",onClick:s,disabled:r.active,children:r.active?"Active":"Activate"}),e.jsx(h,{variant:"secondary",size:"sm",onClick:p,children:"Export"}),e.jsx(h,{variant:"danger",size:"sm",onClick:o,children:"Delete"})]})]})}function T({profiles:r}){const[s,p]=m.useState(""),[o,x]=m.useState("json"),[c,n]=m.useState(!1),[d,u]=m.useState({plugins:!0,mcpServers:!0,commands:!0,settings:!0,credentials:!1});function v(t){u(a=>({...a,[t]:!a[t]}))}async function f(){if(s){n(!0);try{const{data:t}=await S(s),a=new Blob([t],{type:o==="json"?"application/json":"text/yaml"}),i=URL.createObjectURL(a),j=document.createElement("a");j.href=i,j.download=`${s}-export.${o}`,j.click(),URL.revokeObjectURL(i)}catch(t){console.error("Export failed",t)}finally{n(!1)}}}const b=[{value:"",label:"Select a profile..."},...r.map(t=>({value:t.name,label:t.name}))];return e.jsxs("div",{className:"rounded-lg p-5 h-full",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("h2",{className:"text-base mb-4",style:{color:"var(--text-primary)",fontWeight:510},children:"Export"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider mb-2",style:{color:"var(--text-muted)",fontWeight:510},children:"Profile"}),e.jsx(A,{value:s,onChange:p,options:b,placeholder:"Select a profile..."})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider mb-2",style:{color:"var(--text-muted)",fontWeight:510},children:"Include"}),e.jsx("div",{className:"space-y-2",children:Object.keys(d).map(t=>e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:d[t],onChange:()=>v(t),className:"w-4 h-4 rounded",style:{accentColor:"var(--accent)"}}),e.jsx("span",{className:"text-sm capitalize",style:{color:"var(--text-secondary)"},children:t==="mcpServers"?"MCP Servers":t}),t==="credentials"&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{backgroundColor:"rgba(255, 71, 87, 0.15)",color:"var(--status-red)"},children:"sensitive"})]},t))})]}),e.jsxs("div",{className:"mb-5",children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider mb-2",style:{color:"var(--text-muted)",fontWeight:510},children:"Format"}),e.jsx("div",{className:"flex gap-2",children:["json","yaml"].map(t=>e.jsx("button",{onClick:()=>x(t),className:"px-4 py-1.5 rounded-md text-sm transition-colors",style:{backgroundColor:o===t?"var(--accent)":"var(--input-bg)",color:o===t?"#fff":"var(--text-secondary)",border:o===t?"none":"1px solid var(--card-border)",fontWeight:510},children:t.toUpperCase()},t))})]}),e.jsx(h,{variant:"primary",size:"md",onClick:f,disabled:!s||c,children:c?"Exporting...":"Export to File"})]})}function U(){const[r,s]=m.useState(null),[p,o]=m.useState(null),[x,c]=m.useState(null),[n,d]=m.useState(!1),[u,v]=m.useState(!1),[f,b]=m.useState(null),t=m.useRef(null);function a(l){o(l.name);const g=new FileReader;g.onload=N=>{var w;const k=(w=N.target)==null?void 0:w.result;s(k);try{const P=JSON.parse(k);c(P)}catch{c({raw:k.slice(0,200)})}},g.readAsText(l)}function i(l){l.preventDefault(),d(!1);const g=l.dataTransfer.files[0];g&&a(g)}function j(l){var N;const g=(N=l.target.files)==null?void 0:N[0];g&&a(g)}async function y(l){if(r){v(!0),b(null);try{await L(r,l),b(`Import successful (${l} strategy applied).`)}catch(g){b(`Import failed: ${g.message}`)}finally{v(!1)}}}return e.jsxs("div",{className:"rounded-lg p-5 h-full",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("h2",{className:"text-base mb-4",style:{color:"var(--text-primary)",fontWeight:510},children:"Import"}),e.jsxs("div",{className:"rounded-lg border-2 border-dashed p-8 text-center mb-4 cursor-pointer transition-colors",style:{borderColor:n?"var(--accent)":"var(--card-border)",backgroundColor:n?"rgba(94, 106, 210, 0.05)":"transparent"},onDragOver:l=>{l.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:i,onClick:()=>{var l;return(l=t.current)==null?void 0:l.click()},children:[e.jsx("input",{ref:t,type:"file",accept:".json,.yaml,.yml",className:"hidden",onChange:j}),e.jsx("svg",{className:"w-8 h-8 mx-auto mb-2",style:{color:"var(--text-muted)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),p?e.jsx("p",{className:"text-sm",style:{color:"var(--accent-light)",fontWeight:510},children:p}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm",style:{color:"var(--text-secondary)",fontWeight:510},children:"Drop JSON or YAML file here"}),e.jsx("p",{className:"text-xs mt-1",style:{color:"var(--text-muted)"},children:"or click to browse"})]})]}),x&&e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider mb-2",style:{color:"var(--text-muted)",fontWeight:510},children:"Preview"}),e.jsxs("pre",{className:"text-xs rounded-lg p-3 overflow-auto max-h-48 whitespace-pre-wrap",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-secondary)"},children:[JSON.stringify(x,null,2).slice(0,600),JSON.stringify(x,null,2).length>600?`
2
2
  ...`:""]})]}),f&&e.jsx("div",{className:"rounded-lg px-4 py-2.5 mb-4 text-sm",style:{backgroundColor:f.includes("failed")?"rgba(255, 71, 87, 0.1)":"rgba(39, 166, 68, 0.1)",color:f.includes("failed")?"var(--status-red)":"var(--status-green)"},children:f}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(h,{variant:"secondary",size:"md",onClick:()=>y("merge"),disabled:!r||u,children:u?"Importing...":"Merge (keep existing)"}),e.jsx(h,{variant:"primary",size:"md",onClick:()=>y("replace"),disabled:!r||u,children:"Replace All"})]})]})}function H(){const r=D(),{t:s}=R(),{data:p,isLoading:o,mutate:x}=E(),c=p??[],[n,d]=m.useState("profiles"),[u,v]=m.useState(null);async function f(a){try{await O(a),x()}catch(i){console.error("Failed to activate profile",i)}}async function b(a){try{await W(a),x(),v(null)}catch(i){console.error("Failed to delete profile",i)}}async function t(a){try{const{data:i}=await S(a),j=new Blob([i],{type:"application/json"}),y=URL.createObjectURL(j),l=document.createElement("a");l.href=y,l.download=`${a}-profile.json`,l.click(),URL.revokeObjectURL(y)}catch(i){console.error("Failed to export profile",i)}}return e.jsxs("div",{children:[e.jsx(z,{title:s("profiles.title"),children:n==="profiles"&&c.length>0&&e.jsx(h,{variant:"primary",size:"md",onClick:()=>r("/config"),children:s("profiles.saveCurrent")})}),e.jsx("div",{className:"flex items-center gap-1 mb-6 p-1 rounded-lg",style:{backgroundColor:"var(--bg-tertiary)"},children:[{id:"profiles",label:s("profiles.tabs.profiles")},{id:"export-import",label:s("profiles.tabs.exportImport")}].map(({id:a,label:i})=>e.jsx("button",{className:"px-4 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:n===a?"var(--accent)":"transparent",color:n===a?"#fff":"var(--text-muted)",fontWeight:n===a?510:400},onClick:()=>d(a),children:i},a))}),n==="export-import"?o?e.jsx("p",{style:{color:"var(--text-secondary)"},children:"Loading..."}):e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsx(T,{profiles:c}),e.jsx(U,{})]}):o?e.jsx("p",{style:{color:"var(--text-secondary)"},children:"Loading..."}):c.length===0?e.jsxs("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--border, var(--card-border))"},children:[e.jsx("h3",{className:"text-base mb-2",style:{color:"var(--text-primary)",fontWeight:510},children:s("profiles.emptyTitle")}),e.jsx("p",{className:"text-sm mb-6",style:{color:"var(--text-muted)"},children:s("profiles.emptyBody")}),e.jsx(h,{variant:"primary",size:"md",onClick:()=>r("/config"),children:s("profiles.saveCurrent")})]}):e.jsx("div",{className:"grid grid-cols-2 gap-4",children:c.map(a=>e.jsx(F,{profile:a,onActivate:()=>f(a.name),onExport:()=>t(a.name),onDelete:()=>v(a.name)},a.name))}),e.jsx(I,{open:u!==null,onClose:()=>v(null),onConfirm:()=>u&&b(u),title:"Delete Profile",message:`Are you sure you want to delete profile "${u}"? This action cannot be undone.`,confirmLabel:"Delete",variant:"danger"})]})}export{H as default};
@@ -1 +1 @@
1
- import{u as w,f as R,r as n,g as P,j as e,s as M,h as L}from"./index-CaDf51H6.js";import{H as E}from"./header-CBzSNzdI.js";import{T as b}from"./tag-Q3V7Jugn.js";import{S as I}from"./search-box-CqaIZ9mR.js";const $={plugin:"🧩",mcp:"🔌",skill:"⚡"},A={Trending:"green",Popular:"blue",New:"purple",Rising:"orange"},F=["All","Plugins","MCP Servers","Skills"],k=["development","productivity","database","ai","devops","testing","documentation"];function T({label:t,active:r,onClick:d}){return e.jsx("button",{className:"px-3 py-1.5 rounded-lg text-xs font-medium transition-colors",style:{backgroundColor:r?"var(--accent)":"var(--bg-tertiary)",color:r?"#fff":"var(--text-muted)",border:r?"none":"1px solid var(--border)"},onClick:d,children:t})}function C({rec:t}){const[r,d]=n.useState(!1),c=n.useCallback(()=>{t.installCommand&&navigator.clipboard.writeText(t.installCommand).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})},[t.installCommand]),o=$[t.type]??"📦",y=A[t.popularity]??"gray";return e.jsxs("div",{className:"rounded-lg p-5 flex flex-col gap-3",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-lg shrink-0",children:o}),e.jsx("span",{className:"font-mono text-sm font-medium truncate",style:{color:"var(--accent-light)"},children:t.name})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(b,{label:t.popularity,variant:y}),t.category&&e.jsx(b,{label:t.category,variant:"gray"})]})]}),e.jsx("p",{className:"text-sm leading-relaxed",style:{color:"var(--text-secondary)"},children:t.description}),e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)",fontStyle:"italic"},children:t.reason}),e.jsxs("div",{className:"flex items-center gap-2 mt-auto pt-1",children:[t.installCommand&&e.jsx("button",{className:"px-3 py-1.5 rounded-lg text-xs font-medium transition-colors",style:{backgroundColor:r?"var(--status-green)":"var(--accent)",color:"#fff"},onClick:c,children:r?"Copied!":"Copy Install"}),t.url&&e.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1.5 rounded-lg text-xs font-medium transition-colors",style:{backgroundColor:"var(--bg-tertiary)",color:"var(--text-secondary)",border:"1px solid var(--border)",textDecoration:"none"},children:"View"}),e.jsx("span",{className:"ml-auto text-xs px-2 py-0.5 rounded",style:{backgroundColor:"var(--bg-tertiary)",color:"var(--text-muted)"},children:t.type})]})]})}function V({result:t}){const[r,d]=n.useState(!1),c=n.useCallback(()=>{t.installCommand&&navigator.clipboard.writeText(t.installCommand).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})},[t.installCommand]),o={"skills.sh":"purple","mcp-registry":"green",npm:"blue",smithery:"orange"};return e.jsx("div",{className:"rounded-lg p-4 transition-colors hover:bg-bg-hover",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("code",{className:"text-sm font-mono font-medium",style:{color:"var(--accent-light)"},children:t.name}),e.jsx(b,{label:t.source,variant:o[t.source]??"gray"}),t.badge&&e.jsx(b,{label:t.badge,variant:"blue"})]}),t.description&&e.jsx("p",{className:"text-xs mt-1 line-clamp-2",style:{color:"var(--text-secondary)"},children:t.description}),t.installCommand&&e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("code",{className:"text-xs font-mono px-2 py-1 rounded",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-secondary)"},children:t.installCommand}),e.jsx("button",{className:"p-1 rounded transition-colors hover:bg-bg-hover shrink-0",style:{color:r?"var(--status-green)":"var(--text-muted)"},onClick:c,title:"Copy install command",children:r?e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),t.url&&e.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs underline mt-1 inline-block transition-colors",style:{color:"var(--text-muted)"},children:"View"})]})})})}function _(){return e.jsx("div",{className:"space-y-3",children:[1,2,3].map(t=>e.jsx("div",{className:"rounded-lg p-4 animate-pulse",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("div",{className:"flex items-start gap-3",children:e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 rounded w-48 mb-2",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-full mb-1",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-2/3",style:{backgroundColor:"var(--border)"}})]})})},t))})}function B(){const{t}=w(),[r,d]=n.useState(""),[c,o]=n.useState([]),[y,p]=n.useState(!1),[j,x]=n.useState(!1),f=n.useRef(null),m=n.useCallback(async u=>{if(!u.trim()){o([]),x(!1),p(!1);return}p(!0);try{const[g,v]=await Promise.allSettled([M(u),L(u)]),h=[];if(g.status==="fulfilled")for(const i of g.value)h.push({name:i.name,source:"skills.sh",installCommand:i.installCommand,url:i.url,badge:i.installs});if(v.status==="fulfilled")for(const i of v.value.results)h.push({name:i.name,description:i.description,source:i.source,installCommand:i.installCommand,url:i.repositoryUrl??i.npmUrl});o(h),x(!0)}catch{x(!0)}finally{p(!1)}},[]);return n.useEffect(()=>{if(f.current&&clearTimeout(f.current),!r.trim()){o([]),x(!1);return}return f.current=setTimeout(()=>m(r),500),()=>{f.current&&clearTimeout(f.current)}},[r,m]),e.jsxs("div",{className:"mt-10",children:[e.jsx("h2",{className:"text-lg font-medium mb-1",style:{color:"var(--text-primary)"},children:t("recommended.findMore")}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--text-muted)"},children:t("recommended.findMoreBody")}),e.jsx("div",{className:"mb-4",children:e.jsx(I,{value:r,onChange:d,placeholder:t("recommended.findMorePlaceholder")})}),y?e.jsx(_,{}):j&&c.length===0?e.jsx("div",{className:"rounded-lg p-8 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:["No results found for “",r,"”."]})}):c.length>0?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:[c.length," result",c.length!==1?"s":""," from skills.sh and MCP registries"]}),c.map(u=>e.jsx(V,{result:u},`${u.source}-${u.name}`))]}):null]})}function H(){const{t}=w(),{data:r,isLoading:d,mutate:c}=R(),[o,y]=n.useState(!1),[p,j]=n.useState("All"),[x,f]=n.useState(null),m=(r==null?void 0:r.recommendations)??[],u=(r==null?void 0:r.generatedAt)??null,g=(r==null?void 0:r.model)??null,v=n.useMemo(()=>{const s=new Set;for(const l of m)l.category&&s.add(l.category);return k.filter(l=>s.has(l)).concat([...s].filter(l=>!k.includes(l)))},[m]),h=n.useMemo(()=>{let s=m;return p==="Plugins"?s=s.filter(l=>l.type==="plugin"):p==="MCP Servers"?s=s.filter(l=>l.type==="mcp"):p==="Skills"&&(s=s.filter(l=>l.type==="skill")),x&&(s=s.filter(l=>l.category===x)),s},[m,p,x]),i=n.useCallback(async()=>{y(!0);try{const s=await P();await c(s,!1)}catch{}finally{y(!1)}},[c]),S=m.length===0&&!d&&!o;return e.jsxs("div",{children:[e.jsx(E,{title:t("recommended.title"),subtitle:t("recommended.subtitle"),children:e.jsxs("button",{className:"px-4 py-2 rounded-lg text-sm font-medium transition-colors flex items-center gap-2",style:{backgroundColor:o?"var(--bg-tertiary)":"var(--accent)",color:o?"var(--text-muted)":"#fff",cursor:o?"not-allowed":"pointer"},disabled:o,onClick:i,children:[o&&e.jsx("span",{className:"inline-block w-4 h-4 rounded-full border-2 animate-spin",style:{borderColor:"var(--card-border)",borderTopColor:"var(--accent-light)"}}),t(o?"recommended.generating":"recommended.refresh")]})}),u&&e.jsxs("p",{className:"text-xs mb-4",style:{color:"var(--text-muted)"},children:["Generated ",new Date(u).toLocaleString(),g&&g!=="static"&&g!=="static-fallback"?` via ${g}`:g==="static"||g==="static-fallback"?" (static fallback)":""]}),m.length>0&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-6",children:[F.map(s=>e.jsx(T,{label:s,active:p===s,onClick:()=>{j(s),f(null)}},s)),e.jsx("span",{className:"w-px h-5 mx-1",style:{backgroundColor:"var(--border)"}}),v.map(s=>e.jsx(T,{label:s,active:x===s,onClick:()=>f(x===s?null:s)},s))]}),(d||o)&&m.length===0&&e.jsxs("div",{className:"rounded-lg p-12 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("span",{className:"inline-block w-8 h-8 rounded-full border-3 animate-spin mb-4",style:{borderWidth:"3px",borderColor:"var(--card-border)",borderTopColor:"var(--accent-light)"}}),e.jsx("p",{className:"text-sm",style:{color:"var(--text-secondary)"},children:o?"Generating personalized recommendations...":"Loading recommendations..."}),e.jsx("p",{className:"text-xs mt-1",style:{color:"var(--text-muted)"},children:"This may take a few seconds"})]}),S&&e.jsxs("div",{className:"rounded-lg p-12 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("p",{className:"text-lg mb-2",style:{color:"var(--text-muted)"},children:t("recommended.emptyTitle")}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--text-faint)"},children:t("recommended.emptyBody")}),e.jsx("button",{className:"px-5 py-2.5 rounded-lg text-sm font-medium",style:{backgroundColor:"var(--accent)",color:"#fff"},onClick:i,children:t("recommended.generate")})]}),h.length>0&&(()=>{const s=h.filter(a=>a.popularity==="Top"||a.popularity==="Popular"),l=h.filter(a=>a.popularity==="Trending"||a.popularity==="Rising"||a.popularity==="New"),N=h.filter(a=>!["Top","Popular","Trending","Rising","New"].includes(a.popularity));return e.jsxs("div",{className:"space-y-8",children:[s.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-3 flex items-center gap-2",style:{color:"var(--text-secondary)"},children:[e.jsx("span",{children:"🏆"})," Top / Most Popular",e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-muted)"},children:s.length})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"16px"},children:s.map(a=>e.jsx(C,{rec:a},`${a.type}-${a.name}`))})]}),l.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-3 flex items-center gap-2",style:{color:"var(--text-secondary)"},children:[e.jsx("span",{children:"🔥"})," Trending / Rising",e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-muted)"},children:l.length})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"16px"},children:l.map(a=>e.jsx(C,{rec:a},`${a.type}-${a.name}`))})]}),N.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",style:{color:"var(--text-secondary)"},children:"Other"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"16px"},children:N.map(a=>e.jsx(C,{rec:a},`${a.type}-${a.name}`))})]})]})})(),m.length>0&&h.length===0&&!d&&e.jsx("div",{className:"rounded-lg p-8 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"No recommendations match the current filter."})}),e.jsx(B,{})]})}export{H as default};
1
+ import{u as w,f as R,r as n,g as P,j as e,s as M,h as L}from"./index-C8Brdl4F.js";import{H as E}from"./header-BTV9BL6u.js";import{T as b}from"./tag-CkZkoVAp.js";import{S as I}from"./search-box-CO7338GK.js";const $={plugin:"🧩",mcp:"🔌",skill:"⚡"},A={Trending:"green",Popular:"blue",New:"purple",Rising:"orange"},F=["All","Plugins","MCP Servers","Skills"],k=["development","productivity","database","ai","devops","testing","documentation"];function T({label:t,active:r,onClick:d}){return e.jsx("button",{className:"px-3 py-1.5 rounded-lg text-xs font-medium transition-colors",style:{backgroundColor:r?"var(--accent)":"var(--bg-tertiary)",color:r?"#fff":"var(--text-muted)",border:r?"none":"1px solid var(--border)"},onClick:d,children:t})}function C({rec:t}){const[r,d]=n.useState(!1),c=n.useCallback(()=>{t.installCommand&&navigator.clipboard.writeText(t.installCommand).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})},[t.installCommand]),o=$[t.type]??"📦",y=A[t.popularity]??"gray";return e.jsxs("div",{className:"rounded-lg p-5 flex flex-col gap-3",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-lg shrink-0",children:o}),e.jsx("span",{className:"font-mono text-sm font-medium truncate",style:{color:"var(--accent-light)"},children:t.name})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(b,{label:t.popularity,variant:y}),t.category&&e.jsx(b,{label:t.category,variant:"gray"})]})]}),e.jsx("p",{className:"text-sm leading-relaxed",style:{color:"var(--text-secondary)"},children:t.description}),e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)",fontStyle:"italic"},children:t.reason}),e.jsxs("div",{className:"flex items-center gap-2 mt-auto pt-1",children:[t.installCommand&&e.jsx("button",{className:"px-3 py-1.5 rounded-lg text-xs font-medium transition-colors",style:{backgroundColor:r?"var(--status-green)":"var(--accent)",color:"#fff"},onClick:c,children:r?"Copied!":"Copy Install"}),t.url&&e.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1.5 rounded-lg text-xs font-medium transition-colors",style:{backgroundColor:"var(--bg-tertiary)",color:"var(--text-secondary)",border:"1px solid var(--border)",textDecoration:"none"},children:"View"}),e.jsx("span",{className:"ml-auto text-xs px-2 py-0.5 rounded",style:{backgroundColor:"var(--bg-tertiary)",color:"var(--text-muted)"},children:t.type})]})]})}function V({result:t}){const[r,d]=n.useState(!1),c=n.useCallback(()=>{t.installCommand&&navigator.clipboard.writeText(t.installCommand).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})},[t.installCommand]),o={"skills.sh":"purple","mcp-registry":"green",npm:"blue",smithery:"orange"};return e.jsx("div",{className:"rounded-lg p-4 transition-colors hover:bg-bg-hover",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("code",{className:"text-sm font-mono font-medium",style:{color:"var(--accent-light)"},children:t.name}),e.jsx(b,{label:t.source,variant:o[t.source]??"gray"}),t.badge&&e.jsx(b,{label:t.badge,variant:"blue"})]}),t.description&&e.jsx("p",{className:"text-xs mt-1 line-clamp-2",style:{color:"var(--text-secondary)"},children:t.description}),t.installCommand&&e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("code",{className:"text-xs font-mono px-2 py-1 rounded",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-secondary)"},children:t.installCommand}),e.jsx("button",{className:"p-1 rounded transition-colors hover:bg-bg-hover shrink-0",style:{color:r?"var(--status-green)":"var(--text-muted)"},onClick:c,title:"Copy install command",children:r?e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),t.url&&e.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs underline mt-1 inline-block transition-colors",style:{color:"var(--text-muted)"},children:"View"})]})})})}function _(){return e.jsx("div",{className:"space-y-3",children:[1,2,3].map(t=>e.jsx("div",{className:"rounded-lg p-4 animate-pulse",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("div",{className:"flex items-start gap-3",children:e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 rounded w-48 mb-2",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-full mb-1",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-2/3",style:{backgroundColor:"var(--border)"}})]})})},t))})}function B(){const{t}=w(),[r,d]=n.useState(""),[c,o]=n.useState([]),[y,p]=n.useState(!1),[j,x]=n.useState(!1),f=n.useRef(null),m=n.useCallback(async u=>{if(!u.trim()){o([]),x(!1),p(!1);return}p(!0);try{const[g,v]=await Promise.allSettled([M(u),L(u)]),h=[];if(g.status==="fulfilled")for(const i of g.value)h.push({name:i.name,source:"skills.sh",installCommand:i.installCommand,url:i.url,badge:i.installs});if(v.status==="fulfilled")for(const i of v.value.results)h.push({name:i.name,description:i.description,source:i.source,installCommand:i.installCommand,url:i.repositoryUrl??i.npmUrl});o(h),x(!0)}catch{x(!0)}finally{p(!1)}},[]);return n.useEffect(()=>{if(f.current&&clearTimeout(f.current),!r.trim()){o([]),x(!1);return}return f.current=setTimeout(()=>m(r),500),()=>{f.current&&clearTimeout(f.current)}},[r,m]),e.jsxs("div",{className:"mt-10",children:[e.jsx("h2",{className:"text-lg font-medium mb-1",style:{color:"var(--text-primary)"},children:t("recommended.findMore")}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--text-muted)"},children:t("recommended.findMoreBody")}),e.jsx("div",{className:"mb-4",children:e.jsx(I,{value:r,onChange:d,placeholder:t("recommended.findMorePlaceholder")})}),y?e.jsx(_,{}):j&&c.length===0?e.jsx("div",{className:"rounded-lg p-8 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:["No results found for “",r,"”."]})}):c.length>0?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:[c.length," result",c.length!==1?"s":""," from skills.sh and MCP registries"]}),c.map(u=>e.jsx(V,{result:u},`${u.source}-${u.name}`))]}):null]})}function H(){const{t}=w(),{data:r,isLoading:d,mutate:c}=R(),[o,y]=n.useState(!1),[p,j]=n.useState("All"),[x,f]=n.useState(null),m=(r==null?void 0:r.recommendations)??[],u=(r==null?void 0:r.generatedAt)??null,g=(r==null?void 0:r.model)??null,v=n.useMemo(()=>{const s=new Set;for(const l of m)l.category&&s.add(l.category);return k.filter(l=>s.has(l)).concat([...s].filter(l=>!k.includes(l)))},[m]),h=n.useMemo(()=>{let s=m;return p==="Plugins"?s=s.filter(l=>l.type==="plugin"):p==="MCP Servers"?s=s.filter(l=>l.type==="mcp"):p==="Skills"&&(s=s.filter(l=>l.type==="skill")),x&&(s=s.filter(l=>l.category===x)),s},[m,p,x]),i=n.useCallback(async()=>{y(!0);try{const s=await P();await c(s,!1)}catch{}finally{y(!1)}},[c]),S=m.length===0&&!d&&!o;return e.jsxs("div",{children:[e.jsx(E,{title:t("recommended.title"),subtitle:t("recommended.subtitle"),children:e.jsxs("button",{className:"px-4 py-2 rounded-lg text-sm font-medium transition-colors flex items-center gap-2",style:{backgroundColor:o?"var(--bg-tertiary)":"var(--accent)",color:o?"var(--text-muted)":"#fff",cursor:o?"not-allowed":"pointer"},disabled:o,onClick:i,children:[o&&e.jsx("span",{className:"inline-block w-4 h-4 rounded-full border-2 animate-spin",style:{borderColor:"var(--card-border)",borderTopColor:"var(--accent-light)"}}),t(o?"recommended.generating":"recommended.refresh")]})}),u&&e.jsxs("p",{className:"text-xs mb-4",style:{color:"var(--text-muted)"},children:["Generated ",new Date(u).toLocaleString(),g&&g!=="static"&&g!=="static-fallback"?` via ${g}`:g==="static"||g==="static-fallback"?" (static fallback)":""]}),m.length>0&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-6",children:[F.map(s=>e.jsx(T,{label:s,active:p===s,onClick:()=>{j(s),f(null)}},s)),e.jsx("span",{className:"w-px h-5 mx-1",style:{backgroundColor:"var(--border)"}}),v.map(s=>e.jsx(T,{label:s,active:x===s,onClick:()=>f(x===s?null:s)},s))]}),(d||o)&&m.length===0&&e.jsxs("div",{className:"rounded-lg p-12 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("span",{className:"inline-block w-8 h-8 rounded-full border-3 animate-spin mb-4",style:{borderWidth:"3px",borderColor:"var(--card-border)",borderTopColor:"var(--accent-light)"}}),e.jsx("p",{className:"text-sm",style:{color:"var(--text-secondary)"},children:o?"Generating personalized recommendations...":"Loading recommendations..."}),e.jsx("p",{className:"text-xs mt-1",style:{color:"var(--text-muted)"},children:"This may take a few seconds"})]}),S&&e.jsxs("div",{className:"rounded-lg p-12 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("p",{className:"text-lg mb-2",style:{color:"var(--text-muted)"},children:t("recommended.emptyTitle")}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--text-faint)"},children:t("recommended.emptyBody")}),e.jsx("button",{className:"px-5 py-2.5 rounded-lg text-sm font-medium",style:{backgroundColor:"var(--accent)",color:"#fff"},onClick:i,children:t("recommended.generate")})]}),h.length>0&&(()=>{const s=h.filter(a=>a.popularity==="Top"||a.popularity==="Popular"),l=h.filter(a=>a.popularity==="Trending"||a.popularity==="Rising"||a.popularity==="New"),N=h.filter(a=>!["Top","Popular","Trending","Rising","New"].includes(a.popularity));return e.jsxs("div",{className:"space-y-8",children:[s.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-3 flex items-center gap-2",style:{color:"var(--text-secondary)"},children:[e.jsx("span",{children:"🏆"})," Top / Most Popular",e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-muted)"},children:s.length})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"16px"},children:s.map(a=>e.jsx(C,{rec:a},`${a.type}-${a.name}`))})]}),l.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-3 flex items-center gap-2",style:{color:"var(--text-secondary)"},children:[e.jsx("span",{children:"🔥"})," Trending / Rising",e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-muted)"},children:l.length})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"16px"},children:l.map(a=>e.jsx(C,{rec:a},`${a.type}-${a.name}`))})]}),N.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",style:{color:"var(--text-secondary)"},children:"Other"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"16px"},children:N.map(a=>e.jsx(C,{rec:a},`${a.type}-${a.name}`))})]})]})})(),m.length>0&&h.length===0&&!d&&e.jsx("div",{className:"rounded-lg p-8 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"No recommendations match the current filter."})}),e.jsx(B,{})]})}export{H as default};
@@ -1 +1 @@
1
- import{j as e}from"./index-CaDf51H6.js";function a({value:r,onChange:t,placeholder:o="Search..."}){return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-3 flex items-center pointer-events-none","aria-hidden":"true",children:e.jsx("svg",{className:"w-4 h-4",style:{color:"var(--text-muted)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0z"})})}),e.jsx("input",{type:"text",value:r,onChange:s=>t(s.target.value),placeholder:o,className:"w-full pl-9 pr-4 py-2 rounded-md text-sm outline-none transition-colors search-input",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid",color:"var(--text-primary)"}})]})}export{a as S};
1
+ import{j as e}from"./index-C8Brdl4F.js";function a({value:r,onChange:t,placeholder:o="Search..."}){return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-3 flex items-center pointer-events-none","aria-hidden":"true",children:e.jsx("svg",{className:"w-4 h-4",style:{color:"var(--text-muted)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0z"})})}),e.jsx("input",{type:"text",value:r,onChange:s=>t(s.target.value),placeholder:o,className:"w-full pl-9 pr-4 py-2 rounded-md text-sm outline-none transition-colors search-input",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid",color:"var(--text-primary)"}})]})}export{a as S};
@@ -1 +1 @@
1
- import{r as c,j as r}from"./index-CaDf51H6.js";function m({value:o,onChange:i,options:u,placeholder:v,disabled:n}){const[d,a]=c.useState(!1),l=c.useRef(null);c.useEffect(()=>{const e=t=>{l.current&&!l.current.contains(t.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const s=u.find(e=>e.value===o);return r.jsxs("div",{ref:l,className:"relative",children:[r.jsxs("button",{type:"button",className:"w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--border)",color:s?"var(--text-primary)":"var(--text-muted)",opacity:n?.5:1,cursor:n?"not-allowed":"pointer"},onClick:()=>!n&&a(!d),disabled:n,children:[r.jsx("span",{className:"truncate",children:(s==null?void 0:s.label)??v??"Select..."}),r.jsx("svg",{className:"w-4 h-4 shrink-0 ml-2",style:{color:"var(--text-muted)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),d&&r.jsx("div",{className:"absolute z-50 w-full mt-1 rounded-lg overflow-hidden shadow-xl max-h-60 overflow-y-auto",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--border-strong)"},children:u.map(e=>r.jsx("button",{type:"button",className:"w-full text-left px-3 py-2 text-sm transition-colors",style:{backgroundColor:e.value===o?"var(--bg-hover)":"transparent",color:e.value===o?"var(--text-primary)":"var(--text-secondary)"},onMouseEnter:t=>{t.target.style.backgroundColor="var(--bg-hover)"},onMouseLeave:t=>{t.target.style.backgroundColor=e.value===o?"var(--bg-hover)":"transparent"},onClick:()=>{i(e.value),a(!1)},children:e.label},e.value))})]})}export{m as S};
1
+ import{r as c,j as r}from"./index-C8Brdl4F.js";function m({value:o,onChange:i,options:u,placeholder:v,disabled:n}){const[d,a]=c.useState(!1),l=c.useRef(null);c.useEffect(()=>{const e=t=>{l.current&&!l.current.contains(t.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const s=u.find(e=>e.value===o);return r.jsxs("div",{ref:l,className:"relative",children:[r.jsxs("button",{type:"button",className:"w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--border)",color:s?"var(--text-primary)":"var(--text-muted)",opacity:n?.5:1,cursor:n?"not-allowed":"pointer"},onClick:()=>!n&&a(!d),disabled:n,children:[r.jsx("span",{className:"truncate",children:(s==null?void 0:s.label)??v??"Select..."}),r.jsx("svg",{className:"w-4 h-4 shrink-0 ml-2",style:{color:"var(--text-muted)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),d&&r.jsx("div",{className:"absolute z-50 w-full mt-1 rounded-lg overflow-hidden shadow-xl max-h-60 overflow-y-auto",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--border-strong)"},children:u.map(e=>r.jsx("button",{type:"button",className:"w-full text-left px-3 py-2 text-sm transition-colors",style:{backgroundColor:e.value===o?"var(--bg-hover)":"transparent",color:e.value===o?"var(--text-primary)":"var(--text-secondary)"},onMouseEnter:t=>{t.target.style.backgroundColor="var(--bg-hover)"},onMouseLeave:t=>{t.target.style.backgroundColor=e.value===o?"var(--bg-hover)":"transparent"},onClick:()=>{i(e.value),a(!1)},children:e.label},e.value))})]})}export{m as S};
@@ -1 +1 @@
1
- import{u as j,j as e,r as i,B as S,c as E,E as V,F as k,G as T,H as L}from"./index-CaDf51H6.js";import{H as O}from"./header-CBzSNzdI.js";import{S as F}from"./select-BtWQJMup.js";import{T as M}from"./tag-Q3V7Jugn.js";const N=["claude-opus-4-5","claude-sonnet-4-5","claude-haiku-4-5","claude-3-7-sonnet-20250219","claude-3-5-sonnet-20241022","claude-3-5-haiku-20241022"];function P({value:r,onChange:l}){const{t:n}=j(),o=[{value:"",label:n("config.settings.modelSelectPlaceholder")},...N.map(s=>({value:s,label:s})),...r&&!N.includes(r)?[{value:r,label:r}]:[]];return e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs uppercase tracking-wider",style:{color:"var(--text-muted)",fontWeight:510},children:n("config.settings.model")}),e.jsx(F,{value:r,onChange:l,options:o,placeholder:n("config.settings.modelSelectPlaceholder")}),e.jsx("input",{type:"text",value:r,onChange:s=>l(s.target.value),placeholder:n("config.settings.modelCustomPlaceholder"),className:"w-full px-3 py-2 rounded-md text-sm outline-none",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--card-border)",color:"var(--text-primary)"},onFocus:s=>{s.currentTarget.style.borderColor="var(--accent)"},onBlur:s=>{s.currentTarget.style.borderColor="var(--card-border)"}})]})}function B({vars:r,onAdd:l,onRemove:n}){const{t:o}=j(),[s,m]=i.useState(""),[u,p]=i.useState(""),[v,f]=i.useState({});function g(){const t=s.trim(),d=u.trim();t&&(l(t,d),m(""),p(""))}function y(t){f(d=>({...d,[t]:!d[t]}))}const h={backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--card-border)",color:"var(--text-primary)"};return e.jsxs("div",{className:"space-y-2",children:[Object.entries(r).length===0?e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:o("config.settings.noEnv")}):e.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--card-border)"},children:Object.entries(r).map(([t,d],b)=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",style:{borderBottom:b<Object.entries(r).length-1?"1px solid var(--border)":"none"},children:[e.jsx("code",{className:"text-sm font-mono flex-1",style:{color:"var(--accent-light)"},children:t}),e.jsx("code",{className:"text-sm font-mono flex-1 text-right",style:{color:"var(--text-secondary)"},children:v[t]?d:"--------"}),e.jsx("button",{onClick:()=>y(t),className:"text-xs px-2 py-1 rounded transition-colors",style:{color:"var(--text-muted)",backgroundColor:"var(--border)"},title:v[t]?o("config.settings.envHide"):o("config.settings.envShow"),children:v[t]?o("config.settings.envHide"):o("config.settings.envShow")}),e.jsx("button",{onClick:()=>n(t),className:"p-1 rounded transition-colors",style:{color:"var(--status-red)"},title:o("config.settings.envRemove"),children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},t))}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx("input",{type:"text",value:s,onChange:t=>m(t.target.value),placeholder:o("config.settings.envKeyPlaceholder"),className:"flex-1 px-3 py-2 rounded-md text-sm font-mono outline-none",style:h,onFocus:t=>{t.currentTarget.style.borderColor="var(--accent)"},onBlur:t=>{t.currentTarget.style.borderColor="var(--card-border)"},onKeyDown:t=>t.key==="Enter"&&g()}),e.jsx("input",{type:"text",value:u,onChange:t=>p(t.target.value),placeholder:o("config.settings.envValuePlaceholder"),className:"flex-1 px-3 py-2 rounded-md text-sm outline-none",style:h,onFocus:t=>{t.currentTarget.style.borderColor="var(--accent)"},onBlur:t=>{t.currentTarget.style.borderColor="var(--card-border)"},onKeyDown:t=>t.key==="Enter"&&g()}),e.jsx(S,{variant:"primary",size:"md",onClick:g,children:o("config.settings.envAdd")})]})]})}const H={PreToolUse:"blue",PostToolUse:"green",Notification:"yellow",Stop:"orange",SubagentStop:"pink"};function R({hooks:r}){const l=Object.entries(r);return l.length===0?e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"No hooks configured."}):e.jsx("div",{className:"space-y-3",children:l.map(([n,o])=>e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsx(M,{label:n,variant:H[n]??"gray"})}),e.jsx("div",{className:"space-y-2",children:o.map((s,m)=>e.jsxs("div",{className:"rounded-lg p-3",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--border)"},children:[e.jsxs("code",{className:"block text-xs font-mono",style:{color:"var(--accent-light)"},children:[s.command,s.args&&s.args.length>0?" "+s.args.join(" "):""]}),s.timeout!==void 0&&e.jsxs("p",{className:"text-xs mt-1",style:{color:"var(--text-muted)"},children:["Timeout: ",s.timeout,"ms"]})]},m))})]},n))})}function z(){const{t:r}=j(),{data:l,isLoading:n,mutate:o}=E(),s=l??{},[m,u]=i.useState({}),[p,v]=i.useState(!0),[f,g]=i.useState(!1),[y,h]=i.useState(""),t=n||p;i.useEffect(()=>{async function c(){try{const a=await V();u(a)}catch(a){console.error("Failed to load env vars",a)}finally{v(!1)}}c()},[]),i.useEffect(()=>{s.model!==void 0&&h(s.model??"")},[s.model]);async function d(){g(!0);try{await k({model:y}),o()}catch(c){console.error("Failed to save model",c)}finally{g(!1)}}async function b(c,a){try{await T(c,a),u(x=>({...x,[c]:a}))}catch(x){console.error("Failed to set env var",x)}}async function C(c){try{await L(c),u(a=>{const x={...a};return delete x[c],x})}catch(a){console.error("Failed to remove env var",a)}}const w=s.hooks??{};return e.jsxs("div",{children:[e.jsx(O,{title:r("config.settings.title")}),t?e.jsx("p",{style:{color:"var(--text-secondary)"},children:r("common.loading")}):e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsxs("section",{className:"rounded-lg p-5",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("h2",{className:"text-sm mb-4",style:{color:"var(--text-primary)",fontWeight:510},children:r("config.settings.model")}),e.jsx(P,{value:y,onChange:h}),e.jsx("div",{className:"mt-4",children:e.jsx(S,{variant:"primary",size:"md",onClick:d,disabled:f,children:r(f?"common.saving":"common.save")})})]}),e.jsxs("section",{className:"rounded-lg p-5",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("h2",{className:"text-sm mb-4",style:{color:"var(--text-primary)",fontWeight:510},children:r("config.settings.envVars")}),e.jsx(B,{vars:m,onAdd:b,onRemove:C})]}),e.jsxs("section",{className:"rounded-lg p-5",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("h2",{className:"text-sm mb-4",style:{color:"var(--text-primary)",fontWeight:510},children:r("config.settings.hooks")}),e.jsx(R,{hooks:w})]})]})]})}export{z as default};
1
+ import{u as j,j as e,r as i,B as S,c as E,E as V,F as k,G as T,H as L}from"./index-C8Brdl4F.js";import{H as O}from"./header-BTV9BL6u.js";import{S as F}from"./select-BdEpCEBk.js";import{T as M}from"./tag-CkZkoVAp.js";const N=["claude-opus-4-5","claude-sonnet-4-5","claude-haiku-4-5","claude-3-7-sonnet-20250219","claude-3-5-sonnet-20241022","claude-3-5-haiku-20241022"];function P({value:r,onChange:l}){const{t:n}=j(),o=[{value:"",label:n("config.settings.modelSelectPlaceholder")},...N.map(s=>({value:s,label:s})),...r&&!N.includes(r)?[{value:r,label:r}]:[]];return e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs uppercase tracking-wider",style:{color:"var(--text-muted)",fontWeight:510},children:n("config.settings.model")}),e.jsx(F,{value:r,onChange:l,options:o,placeholder:n("config.settings.modelSelectPlaceholder")}),e.jsx("input",{type:"text",value:r,onChange:s=>l(s.target.value),placeholder:n("config.settings.modelCustomPlaceholder"),className:"w-full px-3 py-2 rounded-md text-sm outline-none",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--card-border)",color:"var(--text-primary)"},onFocus:s=>{s.currentTarget.style.borderColor="var(--accent)"},onBlur:s=>{s.currentTarget.style.borderColor="var(--card-border)"}})]})}function B({vars:r,onAdd:l,onRemove:n}){const{t:o}=j(),[s,m]=i.useState(""),[u,p]=i.useState(""),[v,f]=i.useState({});function g(){const t=s.trim(),d=u.trim();t&&(l(t,d),m(""),p(""))}function y(t){f(d=>({...d,[t]:!d[t]}))}const h={backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--card-border)",color:"var(--text-primary)"};return e.jsxs("div",{className:"space-y-2",children:[Object.entries(r).length===0?e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:o("config.settings.noEnv")}):e.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--card-border)"},children:Object.entries(r).map(([t,d],b)=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",style:{borderBottom:b<Object.entries(r).length-1?"1px solid var(--border)":"none"},children:[e.jsx("code",{className:"text-sm font-mono flex-1",style:{color:"var(--accent-light)"},children:t}),e.jsx("code",{className:"text-sm font-mono flex-1 text-right",style:{color:"var(--text-secondary)"},children:v[t]?d:"--------"}),e.jsx("button",{onClick:()=>y(t),className:"text-xs px-2 py-1 rounded transition-colors",style:{color:"var(--text-muted)",backgroundColor:"var(--border)"},title:v[t]?o("config.settings.envHide"):o("config.settings.envShow"),children:v[t]?o("config.settings.envHide"):o("config.settings.envShow")}),e.jsx("button",{onClick:()=>n(t),className:"p-1 rounded transition-colors",style:{color:"var(--status-red)"},title:o("config.settings.envRemove"),children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},t))}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx("input",{type:"text",value:s,onChange:t=>m(t.target.value),placeholder:o("config.settings.envKeyPlaceholder"),className:"flex-1 px-3 py-2 rounded-md text-sm font-mono outline-none",style:h,onFocus:t=>{t.currentTarget.style.borderColor="var(--accent)"},onBlur:t=>{t.currentTarget.style.borderColor="var(--card-border)"},onKeyDown:t=>t.key==="Enter"&&g()}),e.jsx("input",{type:"text",value:u,onChange:t=>p(t.target.value),placeholder:o("config.settings.envValuePlaceholder"),className:"flex-1 px-3 py-2 rounded-md text-sm outline-none",style:h,onFocus:t=>{t.currentTarget.style.borderColor="var(--accent)"},onBlur:t=>{t.currentTarget.style.borderColor="var(--card-border)"},onKeyDown:t=>t.key==="Enter"&&g()}),e.jsx(S,{variant:"primary",size:"md",onClick:g,children:o("config.settings.envAdd")})]})]})}const H={PreToolUse:"blue",PostToolUse:"green",Notification:"yellow",Stop:"orange",SubagentStop:"pink"};function R({hooks:r}){const l=Object.entries(r);return l.length===0?e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"No hooks configured."}):e.jsx("div",{className:"space-y-3",children:l.map(([n,o])=>e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsx(M,{label:n,variant:H[n]??"gray"})}),e.jsx("div",{className:"space-y-2",children:o.map((s,m)=>e.jsxs("div",{className:"rounded-lg p-3",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--border)"},children:[e.jsxs("code",{className:"block text-xs font-mono",style:{color:"var(--accent-light)"},children:[s.command,s.args&&s.args.length>0?" "+s.args.join(" "):""]}),s.timeout!==void 0&&e.jsxs("p",{className:"text-xs mt-1",style:{color:"var(--text-muted)"},children:["Timeout: ",s.timeout,"ms"]})]},m))})]},n))})}function z(){const{t:r}=j(),{data:l,isLoading:n,mutate:o}=E(),s=l??{},[m,u]=i.useState({}),[p,v]=i.useState(!0),[f,g]=i.useState(!1),[y,h]=i.useState(""),t=n||p;i.useEffect(()=>{async function c(){try{const a=await V();u(a)}catch(a){console.error("Failed to load env vars",a)}finally{v(!1)}}c()},[]),i.useEffect(()=>{s.model!==void 0&&h(s.model??"")},[s.model]);async function d(){g(!0);try{await k({model:y}),o()}catch(c){console.error("Failed to save model",c)}finally{g(!1)}}async function b(c,a){try{await T(c,a),u(x=>({...x,[c]:a}))}catch(x){console.error("Failed to set env var",x)}}async function C(c){try{await L(c),u(a=>{const x={...a};return delete x[c],x})}catch(a){console.error("Failed to remove env var",a)}}const w=s.hooks??{};return e.jsxs("div",{children:[e.jsx(O,{title:r("config.settings.title")}),t?e.jsx("p",{style:{color:"var(--text-secondary)"},children:r("common.loading")}):e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsxs("section",{className:"rounded-lg p-5",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("h2",{className:"text-sm mb-4",style:{color:"var(--text-primary)",fontWeight:510},children:r("config.settings.model")}),e.jsx(P,{value:y,onChange:h}),e.jsx("div",{className:"mt-4",children:e.jsx(S,{variant:"primary",size:"md",onClick:d,disabled:f,children:r(f?"common.saving":"common.save")})})]}),e.jsxs("section",{className:"rounded-lg p-5",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("h2",{className:"text-sm mb-4",style:{color:"var(--text-primary)",fontWeight:510},children:r("config.settings.envVars")}),e.jsx(B,{vars:m,onAdd:b,onRemove:C})]}),e.jsxs("section",{className:"rounded-lg p-5",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("h2",{className:"text-sm mb-4",style:{color:"var(--text-primary)",fontWeight:510},children:r("config.settings.hooks")}),e.jsx(R,{hooks:w})]})]})]})}export{z as default};
@@ -1 +1 @@
1
- import{u as z,z as V,r as t,j as e,A as I,C as A,s as G,k as _}from"./index-CaDf51H6.js";import{H as D}from"./header-CBzSNzdI.js";import{S as F}from"./search-box-CqaIZ9mR.js";import{T as b}from"./tag-Q3V7Jugn.js";import{M as J}from"./markdown-viewer-Bj8nSOSJ.js";function E(l){const r=l.replace(/\\/g,"/").split("/"),c=r.indexOf("cache");if(c!==-1&&r[c+2])return r[c+2];const i=r.indexOf("skills");return i>=2?r[i-2]:"Custom"}function M({icon:l,label:r,count:c,children:i}){const[d,h]=t.useState(!0);return e.jsxs("div",{children:[e.jsxs("button",{className:"flex items-center gap-2 mb-3 w-full text-left",onClick:()=>h(!d),children:[e.jsx("span",{className:"text-base",children:l}),e.jsx("h3",{className:"text-sm font-medium",style:{color:r==="User"?"var(--accent-light)":"var(--text-muted)"},children:r}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-secondary)"},children:c}),e.jsx("svg",{className:"w-4 h-4 ml-auto transition-transform",style:{color:"var(--text-muted)",transform:d?"rotate(0deg)":"rotate(-90deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),d&&i]})}function K(){return e.jsx("div",{className:"space-y-3",children:[1,2,3].map(l=>e.jsx("div",{className:"rounded-lg p-5 animate-pulse",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 rounded w-64 mb-2",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-24 mb-3",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-full",style:{backgroundColor:"var(--border)"}})]}),e.jsx("div",{className:"h-8 w-16 rounded-lg",style:{backgroundColor:"var(--border)"}})]})},l))})}function Q({result:l}){const[r,c]=t.useState(!1),i=t.useCallback(()=>{navigator.clipboard.writeText(l.installCommand).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)})},[l.installCommand]);return e.jsx("div",{className:"rounded-lg p-5 transition-colors hover:bg-bg-hover",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("code",{className:"text-sm font-mono font-medium",style:{color:"var(--accent-light)"},children:l.name}),e.jsx(b,{label:l.installs,variant:"blue"})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("code",{className:"text-xs font-mono px-2 py-1 rounded",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-secondary)"},children:l.installCommand}),e.jsx("button",{className:"p-1 rounded transition-colors hover:bg-bg-hover shrink-0",style:{color:r?"var(--status-green)":"var(--text-muted)"},onClick:i,title:"Copy install command",children:r?e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),e.jsx("div",{className:"mt-2",children:e.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs underline transition-colors",style:{color:"var(--text-muted)"},children:"View on skills.sh"})})]})})})}function X(){const{t:l}=z(),[r,c]=t.useState(""),[i,d]=t.useState([]),[h,T]=t.useState([]),[o,g]=t.useState(!1),[k,f]=t.useState(!0),[N,v]=t.useState(!1),p=t.useRef(null),C=t.useRef(!1);t.useEffect(()=>{C.current||(C.current=!0,f(!0),A().then(n=>T(n)).catch(()=>{}).finally(()=>f(!1)))},[]);const j=t.useCallback(async n=>{if(!n.trim()){d([]),v(!1),g(!1);return}g(!0);try{const y=await G(n);d(y),v(!0)}catch{v(!0)}finally{g(!1)}},[]);t.useEffect(()=>{if(p.current&&clearTimeout(p.current),!r.trim()){d([]),v(!1);return}return p.current=setTimeout(()=>j(r),500),()=>{p.current&&clearTimeout(p.current)}},[r,j]);const x=r.trim().length>0,u=x?i:h,S=x?o:k;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-4",children:e.jsx(F,{value:r,onChange:c,placeholder:l("config.skills.searchPlaceholder")})}),S?e.jsx(K,{}):x&&N&&i.length===0?e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:["No results found for “",r,"”."]})}):u.length>0?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:x?`${u.length} result${u.length!==1?"s":""}`:`Top ${u.length} Skills`}),u.map(n=>e.jsx(Q,{result:n},n.name))]}):e.jsxs("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("p",{className:"text-sm mb-2",style:{color:"var(--text-muted)"},children:"Search the skills.sh ecosystem — 91,000+ skills available"}),e.jsx("p",{className:"text-xs",style:{color:"var(--text-faint)"},children:"Type a search term above to discover skills for Claude."})]})]})}function te(){const{t:l}=z(),{data:r,isLoading:c,mutate:i}=V(),d=r??[],[h,T]=t.useState(""),[o,g]=t.useState(null),[k,f]=t.useState(null),[N,v]=t.useState(!1),[p,C]=t.useState({}),[j,x]=t.useState(!1),[u,S]=t.useState(""),[n,y]=t.useState("installed");async function H(s){g(s),f(null),v(!0);try{const{content:a}=await _(s.filePath);f(a)}catch{f("*Failed to load content*")}finally{v(!1)}}async function O(){if(o)try{await I(o.filePath,u),f(u),x(!1),i()}catch(s){console.error("Failed to save",s)}}const R=d.filter(s=>s.name.toLowerCase().includes(h.toLowerCase())||(s.description??"").toLowerCase().includes(h.toLowerCase())),w=R.filter(s=>s.source==="user"),B=R.filter(s=>s.source!=="user"),W=B.reduce((s,a)=>{const m=E(a.filePath);return s[m]||(s[m]=[]),s[m].push(a),s},{});function $(s){C(a=>({...a,[s]:!a[s]}))}function P(s,a,m){return e.jsxs("div",{className:"flex items-start gap-4 px-5 py-3 cursor-pointer transition-colors hover:bg-bg-hover",style:{borderBottom:a<m-1?"1px solid var(--border)":"none"},onClick:()=>H(s),children:[e.jsx("code",{className:"text-sm font-mono shrink-0",style:{color:"var(--accent-light)"},children:s.name}),e.jsxs("div",{className:"flex-1 min-w-0",children:[s.description&&e.jsx("p",{className:"text-xs",style:{color:"var(--text-secondary)"},children:s.description}),s.tags&&s.tags.length>0&&e.jsx("div",{className:"flex gap-1.5 mt-1 flex-wrap",children:s.tags.map(L=>e.jsx(b,{label:L,variant:"gray"},L))})]}),e.jsx(b,{label:"skill",variant:"purple"})]},s.name)}return e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 bg-bg-primary",children:[e.jsx(D,{title:l("config.skills.title",{n:d.length})}),e.jsxs("div",{className:"flex items-center gap-1 mb-4",children:[e.jsx("button",{className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors",style:{backgroundColor:n==="installed"?"var(--accent)":"transparent",color:n==="installed"?"#fff":"var(--text-muted)"},onClick:()=>y("installed"),children:l("config.skills.installed")}),e.jsx("button",{className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors",style:{backgroundColor:n==="store"?"var(--accent)":"transparent",color:n==="store"?"#fff":"var(--text-muted)"},onClick:()=>y("store"),children:l("config.skills.store")})]})]}),n==="installed"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(F,{value:h,onChange:T,placeholder:l("config.skills.searchPlaceholder")})}),c?e.jsx("p",{style:{color:"var(--text-secondary)"},children:"Loading..."}):R.length===0?e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:h?"No skills match your search.":e.jsxs(e.Fragment,{children:["No skills found. Browse the"," ",e.jsx("button",{className:"underline",style:{color:"var(--accent-light)"},onClick:()=>y("store"),children:"Skill Store"})," ","to discover and install skills."]})})}):e.jsxs("div",{className:"space-y-6",children:[w.length>0&&e.jsx(M,{icon:"👤",label:"User",count:w.length,children:e.jsx("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:w.map((s,a)=>P(s,a,w.length))})}),B.length>0&&e.jsx(M,{icon:"🔧",label:"System",count:B.length,children:e.jsx("div",{className:"space-y-4",children:Object.entries(W).map(([s,a])=>{const m=p[s];return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("button",{className:"w-full flex items-center justify-between px-5 py-3 text-left transition-colors hover:bg-bg-hover",style:{borderBottom:m?"none":"1px solid var(--border)"},onClick:()=>$(s),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:s}),e.jsx(b,{label:`${a.length}`,variant:"purple"})]}),e.jsx("svg",{className:"w-4 h-4 transition-transform",style:{color:"var(--text-muted)",transform:m?"rotate(-90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),!m&&e.jsx("div",{children:a.map((L,U)=>P(L,U,a.length))})]},s)})})})]}),o&&e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col",style:{backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 shrink-0",style:{borderBottom:"1px solid var(--border)",backgroundColor:"var(--bg-secondary)"},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("code",{className:"text-base font-mono font-medium",style:{color:"var(--accent-light)"},children:o.name}),e.jsx(b,{label:o.source==="user"?"User":"System",variant:o.source==="user"?"purple":"gray"}),e.jsx(b,{label:E(o.filePath),variant:"blue"}),o.description&&e.jsxs("span",{className:"text-xs truncate",style:{color:"var(--text-muted)"},children:["— ",o.description]})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("code",{className:"text-xs font-mono hidden lg:block",style:{color:"var(--text-muted)"},children:o.filePath}),o.source==="user"&&!j&&!N&&e.jsx("button",{onClick:()=>{x(!0),S(k??"")},className:"px-3 py-1.5 rounded-lg text-sm font-medium transition-colors hover:bg-bg-hover",style:{color:"var(--accent-light)"},children:"Edit"}),e.jsx("button",{className:"w-8 h-8 rounded-lg flex items-center justify-center transition-colors hover:bg-bg-hover",style:{color:"var(--text-secondary)"},onClick:()=>{g(null),x(!1),f(null)},children:"✕"})]})]}),e.jsx("div",{className:"flex-1 overflow-auto px-8 py-6",children:j?e.jsxs("div",{className:"max-w-4xl mx-auto flex flex-col h-full",children:[e.jsx("textarea",{value:u,onChange:s=>S(s.target.value),className:"flex-1 w-full p-4 rounded-lg font-mono text-sm resize-none outline-none",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-secondary)",border:"1px solid var(--card-border)",minHeight:"500px"}}),e.jsxs("div",{className:"flex gap-3 mt-4 justify-end",children:[e.jsx("button",{onClick:()=>x(!1),className:"px-4 py-2 rounded-lg text-sm btn-secondary",children:"Cancel"}),e.jsx("button",{onClick:O,className:"px-4 py-2 rounded-lg text-sm btn-primary",children:"Save"})]})]}):N?e.jsx("div",{className:"max-w-4xl mx-auto text-center py-12",children:e.jsx("p",{style:{color:"var(--text-muted)"},children:"Loading content..."})}):e.jsx(J,{content:k??"*No content available*",className:"max-w-4xl mx-auto skill-markdown"})})]})]}):e.jsx(X,{})]})}export{te as default};
1
+ import{u as z,z as V,r as t,j as e,A as I,C as A,s as G,k as _}from"./index-C8Brdl4F.js";import{H as D}from"./header-BTV9BL6u.js";import{S as F}from"./search-box-CO7338GK.js";import{T as b}from"./tag-CkZkoVAp.js";import{M as J}from"./markdown-viewer-Bcu9HM71.js";function E(l){const r=l.replace(/\\/g,"/").split("/"),c=r.indexOf("cache");if(c!==-1&&r[c+2])return r[c+2];const i=r.indexOf("skills");return i>=2?r[i-2]:"Custom"}function M({icon:l,label:r,count:c,children:i}){const[d,h]=t.useState(!0);return e.jsxs("div",{children:[e.jsxs("button",{className:"flex items-center gap-2 mb-3 w-full text-left",onClick:()=>h(!d),children:[e.jsx("span",{className:"text-base",children:l}),e.jsx("h3",{className:"text-sm font-medium",style:{color:r==="User"?"var(--accent-light)":"var(--text-muted)"},children:r}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-secondary)"},children:c}),e.jsx("svg",{className:"w-4 h-4 ml-auto transition-transform",style:{color:"var(--text-muted)",transform:d?"rotate(0deg)":"rotate(-90deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),d&&i]})}function K(){return e.jsx("div",{className:"space-y-3",children:[1,2,3].map(l=>e.jsx("div",{className:"rounded-lg p-5 animate-pulse",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 rounded w-64 mb-2",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-24 mb-3",style:{backgroundColor:"var(--border)"}}),e.jsx("div",{className:"h-3 rounded w-full",style:{backgroundColor:"var(--border)"}})]}),e.jsx("div",{className:"h-8 w-16 rounded-lg",style:{backgroundColor:"var(--border)"}})]})},l))})}function Q({result:l}){const[r,c]=t.useState(!1),i=t.useCallback(()=>{navigator.clipboard.writeText(l.installCommand).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)})},[l.installCommand]);return e.jsx("div",{className:"rounded-lg p-5 transition-colors hover:bg-bg-hover",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("code",{className:"text-sm font-mono font-medium",style:{color:"var(--accent-light)"},children:l.name}),e.jsx(b,{label:l.installs,variant:"blue"})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("code",{className:"text-xs font-mono px-2 py-1 rounded",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-secondary)"},children:l.installCommand}),e.jsx("button",{className:"p-1 rounded transition-colors hover:bg-bg-hover shrink-0",style:{color:r?"var(--status-green)":"var(--text-muted)"},onClick:i,title:"Copy install command",children:r?e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),e.jsx("div",{className:"mt-2",children:e.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs underline transition-colors",style:{color:"var(--text-muted)"},children:"View on skills.sh"})})]})})})}function X(){const{t:l}=z(),[r,c]=t.useState(""),[i,d]=t.useState([]),[h,T]=t.useState([]),[o,g]=t.useState(!1),[k,f]=t.useState(!0),[N,v]=t.useState(!1),p=t.useRef(null),C=t.useRef(!1);t.useEffect(()=>{C.current||(C.current=!0,f(!0),A().then(n=>T(n)).catch(()=>{}).finally(()=>f(!1)))},[]);const j=t.useCallback(async n=>{if(!n.trim()){d([]),v(!1),g(!1);return}g(!0);try{const y=await G(n);d(y),v(!0)}catch{v(!0)}finally{g(!1)}},[]);t.useEffect(()=>{if(p.current&&clearTimeout(p.current),!r.trim()){d([]),v(!1);return}return p.current=setTimeout(()=>j(r),500),()=>{p.current&&clearTimeout(p.current)}},[r,j]);const x=r.trim().length>0,u=x?i:h,S=x?o:k;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-4",children:e.jsx(F,{value:r,onChange:c,placeholder:l("config.skills.searchPlaceholder")})}),S?e.jsx(K,{}):x&&N&&i.length===0?e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsxs("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:["No results found for “",r,"”."]})}):u.length>0?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:x?`${u.length} result${u.length!==1?"s":""}`:`Top ${u.length} Skills`}),u.map(n=>e.jsx(Q,{result:n},n.name))]}):e.jsxs("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("p",{className:"text-sm mb-2",style:{color:"var(--text-muted)"},children:"Search the skills.sh ecosystem — 91,000+ skills available"}),e.jsx("p",{className:"text-xs",style:{color:"var(--text-faint)"},children:"Type a search term above to discover skills for Claude."})]})]})}function te(){const{t:l}=z(),{data:r,isLoading:c,mutate:i}=V(),d=r??[],[h,T]=t.useState(""),[o,g]=t.useState(null),[k,f]=t.useState(null),[N,v]=t.useState(!1),[p,C]=t.useState({}),[j,x]=t.useState(!1),[u,S]=t.useState(""),[n,y]=t.useState("installed");async function H(s){g(s),f(null),v(!0);try{const{content:a}=await _(s.filePath);f(a)}catch{f("*Failed to load content*")}finally{v(!1)}}async function O(){if(o)try{await I(o.filePath,u),f(u),x(!1),i()}catch(s){console.error("Failed to save",s)}}const R=d.filter(s=>s.name.toLowerCase().includes(h.toLowerCase())||(s.description??"").toLowerCase().includes(h.toLowerCase())),w=R.filter(s=>s.source==="user"),B=R.filter(s=>s.source!=="user"),W=B.reduce((s,a)=>{const m=E(a.filePath);return s[m]||(s[m]=[]),s[m].push(a),s},{});function $(s){C(a=>({...a,[s]:!a[s]}))}function P(s,a,m){return e.jsxs("div",{className:"flex items-start gap-4 px-5 py-3 cursor-pointer transition-colors hover:bg-bg-hover",style:{borderBottom:a<m-1?"1px solid var(--border)":"none"},onClick:()=>H(s),children:[e.jsx("code",{className:"text-sm font-mono shrink-0",style:{color:"var(--accent-light)"},children:s.name}),e.jsxs("div",{className:"flex-1 min-w-0",children:[s.description&&e.jsx("p",{className:"text-xs",style:{color:"var(--text-secondary)"},children:s.description}),s.tags&&s.tags.length>0&&e.jsx("div",{className:"flex gap-1.5 mt-1 flex-wrap",children:s.tags.map(L=>e.jsx(b,{label:L,variant:"gray"},L))})]}),e.jsx(b,{label:"skill",variant:"purple"})]},s.name)}return e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 bg-bg-primary",children:[e.jsx(D,{title:l("config.skills.title",{n:d.length})}),e.jsxs("div",{className:"flex items-center gap-1 mb-4",children:[e.jsx("button",{className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors",style:{backgroundColor:n==="installed"?"var(--accent)":"transparent",color:n==="installed"?"#fff":"var(--text-muted)"},onClick:()=>y("installed"),children:l("config.skills.installed")}),e.jsx("button",{className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors",style:{backgroundColor:n==="store"?"var(--accent)":"transparent",color:n==="store"?"#fff":"var(--text-muted)"},onClick:()=>y("store"),children:l("config.skills.store")})]})]}),n==="installed"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(F,{value:h,onChange:T,placeholder:l("config.skills.searchPlaceholder")})}),c?e.jsx("p",{style:{color:"var(--text-secondary)"},children:"Loading..."}):R.length===0?e.jsx("div",{className:"rounded-lg p-10 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:h?"No skills match your search.":e.jsxs(e.Fragment,{children:["No skills found. Browse the"," ",e.jsx("button",{className:"underline",style:{color:"var(--accent-light)"},onClick:()=>y("store"),children:"Skill Store"})," ","to discover and install skills."]})})}):e.jsxs("div",{className:"space-y-6",children:[w.length>0&&e.jsx(M,{icon:"👤",label:"User",count:w.length,children:e.jsx("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:w.map((s,a)=>P(s,a,w.length))})}),B.length>0&&e.jsx(M,{icon:"🔧",label:"System",count:B.length,children:e.jsx("div",{className:"space-y-4",children:Object.entries(W).map(([s,a])=>{const m=p[s];return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("button",{className:"w-full flex items-center justify-between px-5 py-3 text-left transition-colors hover:bg-bg-hover",style:{borderBottom:m?"none":"1px solid var(--border)"},onClick:()=>$(s),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:s}),e.jsx(b,{label:`${a.length}`,variant:"purple"})]}),e.jsx("svg",{className:"w-4 h-4 transition-transform",style:{color:"var(--text-muted)",transform:m?"rotate(-90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),!m&&e.jsx("div",{children:a.map((L,U)=>P(L,U,a.length))})]},s)})})})]}),o&&e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col",style:{backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 shrink-0",style:{borderBottom:"1px solid var(--border)",backgroundColor:"var(--bg-secondary)"},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("code",{className:"text-base font-mono font-medium",style:{color:"var(--accent-light)"},children:o.name}),e.jsx(b,{label:o.source==="user"?"User":"System",variant:o.source==="user"?"purple":"gray"}),e.jsx(b,{label:E(o.filePath),variant:"blue"}),o.description&&e.jsxs("span",{className:"text-xs truncate",style:{color:"var(--text-muted)"},children:["— ",o.description]})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("code",{className:"text-xs font-mono hidden lg:block",style:{color:"var(--text-muted)"},children:o.filePath}),o.source==="user"&&!j&&!N&&e.jsx("button",{onClick:()=>{x(!0),S(k??"")},className:"px-3 py-1.5 rounded-lg text-sm font-medium transition-colors hover:bg-bg-hover",style:{color:"var(--accent-light)"},children:"Edit"}),e.jsx("button",{className:"w-8 h-8 rounded-lg flex items-center justify-center transition-colors hover:bg-bg-hover",style:{color:"var(--text-secondary)"},onClick:()=>{g(null),x(!1),f(null)},children:"✕"})]})]}),e.jsx("div",{className:"flex-1 overflow-auto px-8 py-6",children:j?e.jsxs("div",{className:"max-w-4xl mx-auto flex flex-col h-full",children:[e.jsx("textarea",{value:u,onChange:s=>S(s.target.value),className:"flex-1 w-full p-4 rounded-lg font-mono text-sm resize-none outline-none",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-secondary)",border:"1px solid var(--card-border)",minHeight:"500px"}}),e.jsxs("div",{className:"flex gap-3 mt-4 justify-end",children:[e.jsx("button",{onClick:()=>x(!1),className:"px-4 py-2 rounded-lg text-sm btn-secondary",children:"Cancel"}),e.jsx("button",{onClick:O,className:"px-4 py-2 rounded-lg text-sm btn-primary",children:"Save"})]})]}):N?e.jsx("div",{className:"max-w-4xl mx-auto text-center py-12",children:e.jsx("p",{style:{color:"var(--text-muted)"},children:"Loading content..."})}):e.jsx(J,{content:k??"*No content available*",className:"max-w-4xl mx-auto skill-markdown"})})]})]}):e.jsx(X,{})]})}export{te as default};
@@ -1 +1 @@
1
- import{j as a}from"./index-CaDf51H6.js";const t={green:{bg:"rgba(39, 166, 68, 0.15)",color:"var(--status-green)"},blue:{bg:"rgba(94, 106, 210, 0.15)",color:"var(--accent-light)"},orange:{bg:"rgba(138, 143, 152, 0.15)",color:"var(--text-secondary)"},purple:{bg:"rgba(94, 106, 210, 0.15)",color:"var(--accent-light)"},red:{bg:"rgba(255, 71, 87, 0.15)",color:"var(--status-red)"},yellow:{bg:"rgba(138, 143, 152, 0.15)",color:"var(--text-secondary)"},pink:{bg:"rgba(94, 106, 210, 0.12)",color:"var(--accent-hover)"},gray:{bg:"var(--border)",color:"var(--text-muted)"}};function c({label:o,variant:e="gray"}){const r=t[e];return a.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs",style:{backgroundColor:r.bg,color:r.color,fontWeight:510},children:o})}export{c as T};
1
+ import{j as a}from"./index-C8Brdl4F.js";const t={green:{bg:"rgba(39, 166, 68, 0.15)",color:"var(--status-green)"},blue:{bg:"rgba(94, 106, 210, 0.15)",color:"var(--accent-light)"},orange:{bg:"rgba(138, 143, 152, 0.15)",color:"var(--text-secondary)"},purple:{bg:"rgba(94, 106, 210, 0.15)",color:"var(--accent-light)"},red:{bg:"rgba(255, 71, 87, 0.15)",color:"var(--status-red)"},yellow:{bg:"rgba(138, 143, 152, 0.15)",color:"var(--text-secondary)"},pink:{bg:"rgba(94, 106, 210, 0.12)",color:"var(--accent-hover)"},gray:{bg:"var(--border)",color:"var(--text-muted)"}};function c({label:o,variant:e="gray"}){const r=t[e];return a.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs",style:{backgroundColor:r.bg,color:r.color,fontWeight:510},children:o})}export{c as T};
@@ -10,7 +10,7 @@
10
10
  <link rel="icon" type="image/png" sizes="32x32" href="/icon-32.png" />
11
11
  <link rel="icon" type="image/png" sizes="192x192" href="/icon-192.png" />
12
12
  <link rel="apple-touch-icon" sizes="192x192" href="/icon-192.png" />
13
- <script type="module" crossorigin src="/assets/index-CaDf51H6.js"></script>
13
+ <script type="module" crossorigin src="/assets/index-C8Brdl4F.js"></script>
14
14
  <link rel="stylesheet" crossorigin href="/assets/index-CHtRMAMT.css">
15
15
  </head>
16
16
  <body>
@@ -34939,7 +34939,7 @@ var SessionManager = class {
34939
34939
  sessions.sort((a, b) => {
34940
34940
  if (a.alive !== b.alive)
34941
34941
  return a.alive ? -1 : 1;
34942
- return b.startedAt - a.startedAt;
34942
+ return (b.lastActive ?? b.startedAt) - (a.lastActive ?? a.startedAt);
34943
34943
  });
34944
34944
  setCache("all-sessions", sessions);
34945
34945
  return sessions;
@@ -34960,7 +34960,8 @@ var SessionManager = class {
34960
34960
  continue;
34961
34961
  const existing = sessionMap.get(entry.sessionId);
34962
34962
  if (existing) {
34963
- if (entry.timestamp && entry.timestamp > existing.startedAt) {
34963
+ if (entry.timestamp && entry.timestamp > (existing.lastActive ?? existing.startedAt)) {
34964
+ existing.lastActive = entry.timestamp;
34964
34965
  }
34965
34966
  if (entry.display) {
34966
34967
  existing.lastMessage = entry.display;
@@ -34971,6 +34972,7 @@ var SessionManager = class {
34971
34972
  sessionId: entry.sessionId,
34972
34973
  cwd: entry.project ?? "",
34973
34974
  startedAt: entry.timestamp ?? 0,
34975
+ lastActive: entry.timestamp ?? 0,
34974
34976
  alive: false,
34975
34977
  lastMessage: entry.display,
34976
34978
  projectDir: entry.project
@@ -35061,6 +35063,13 @@ var SessionManager = class {
35061
35063
  existing.historyFile = historyFile;
35062
35064
  if (!existing.projectDir)
35063
35065
  existing.projectDir = decodedPath;
35066
+ try {
35067
+ const fileStat = await stat(historyFile);
35068
+ if (fileStat.mtimeMs > (existing.lastActive ?? existing.startedAt)) {
35069
+ existing.lastActive = fileStat.mtimeMs;
35070
+ }
35071
+ } catch {
35072
+ }
35064
35073
  if (!existing.projectConfig) {
35065
35074
  existing.projectConfig = await this.getProjectConfig(existing.cwd || decodedPath);
35066
35075
  }
@@ -35086,6 +35095,7 @@ var SessionManager = class {
35086
35095
  sessionId: entry,
35087
35096
  cwd: decodedPath,
35088
35097
  startedAt: entryStat.mtimeMs,
35098
+ lastActive: entryStat.mtimeMs,
35089
35099
  alive: false,
35090
35100
  projectDir: decodedPath
35091
35101
  });
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@wangcansun/cc-config",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Standalone CLI + dashboard to manage your whole Claude Code setup: plugins, MCP servers, skills, commands, settings, profiles, sessions, and usage metrics.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "claude-config": "./cli.mjs",
8
7
  "cc-config": "./cli.mjs"
9
8
  },
10
9
  "files": [