vskill 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -9
- package/agents.json +3 -1
- package/dist/agents/agents-registry.d.ts +61 -0
- package/dist/agents/agents-registry.js +203 -0
- package/dist/agents/agents-registry.js.map +1 -1
- package/dist/api/client.d.ts +85 -0
- package/dist/api/client.js +193 -24
- package/dist/api/client.js.map +1 -1
- package/dist/commands/add-lockfile.d.ts +6 -0
- package/dist/commands/add-lockfile.js +10 -0
- package/dist/commands/add-lockfile.js.map +1 -1
- package/dist/commands/add.d.ts +7 -0
- package/dist/commands/add.js +110 -2
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/auth.d.ts +23 -0
- package/dist/commands/auth.js +105 -11
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/eval/serve.d.ts +2 -0
- package/dist/commands/eval/serve.js +126 -4
- package/dist/commands/eval/serve.js.map +1 -1
- package/dist/commands/orgs.d.ts +21 -0
- package/dist/commands/orgs.js +164 -0
- package/dist/commands/orgs.js.map +1 -0
- package/dist/commands/skill.js +14 -1
- package/dist/commands/skill.js.map +1 -1
- package/dist/commands/whoami.d.ts +29 -0
- package/dist/commands/whoami.js +119 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/discovery/github-tree.d.ts +23 -3
- package/dist/discovery/github-tree.js +172 -24
- package/dist/discovery/github-tree.js.map +1 -1
- package/dist/eval/anthropic-catalog.js +32 -2
- package/dist/eval/anthropic-catalog.js.map +1 -1
- package/dist/eval/batch-judge.js +1 -0
- package/dist/eval/batch-judge.js.map +1 -1
- package/dist/eval/llm.d.ts +1 -1
- package/dist/eval/llm.js +104 -2
- package/dist/eval/llm.js.map +1 -1
- package/dist/eval-server/__tests__/helpers/studio-token-test-helpers.d.ts +2 -0
- package/dist/eval-server/__tests__/helpers/studio-token-test-helpers.js +20 -0
- package/dist/eval-server/__tests__/helpers/studio-token-test-helpers.js.map +1 -0
- package/dist/eval-server/active-tenant-routes.d.ts +15 -0
- package/dist/eval-server/active-tenant-routes.js +101 -0
- package/dist/eval-server/active-tenant-routes.js.map +1 -0
- package/dist/eval-server/api-routes.js +17 -2
- package/dist/eval-server/api-routes.js.map +1 -1
- package/dist/eval-server/desktop-open-routes.d.ts +8 -0
- package/dist/eval-server/desktop-open-routes.js +64 -0
- package/dist/eval-server/desktop-open-routes.js.map +1 -0
- package/dist/eval-server/eval-server.js +82 -5
- package/dist/eval-server/eval-server.js.map +1 -1
- package/dist/eval-server/export-skill-routes.d.ts +9 -0
- package/dist/eval-server/export-skill-routes.js +81 -0
- package/dist/eval-server/export-skill-routes.js.map +1 -0
- package/dist/eval-server/git-routes.d.ts +1 -0
- package/dist/eval-server/git-routes.js +101 -4
- package/dist/eval-server/git-routes.js.map +1 -1
- package/dist/eval-server/install-engine-routes.d.ts +3 -16
- package/dist/eval-server/install-engine-routes.js +9 -124
- package/dist/eval-server/install-engine-routes.js.map +1 -1
- package/dist/eval-server/install-jobs.d.ts +41 -0
- package/dist/eval-server/install-jobs.js +161 -0
- package/dist/eval-server/install-jobs.js.map +1 -0
- package/dist/eval-server/install-skill-routes.d.ts +74 -11
- package/dist/eval-server/install-skill-routes.js +506 -79
- package/dist/eval-server/install-skill-routes.js.map +1 -1
- package/dist/eval-server/install-state-routes.d.ts +4 -0
- package/dist/eval-server/install-state-routes.js +15 -1
- package/dist/eval-server/install-state-routes.js.map +1 -1
- package/dist/eval-server/oauth-github-routes.d.ts +2 -0
- package/dist/eval-server/oauth-github-routes.js +505 -0
- package/dist/eval-server/oauth-github-routes.js.map +1 -0
- package/dist/eval-server/platform-proxy.d.ts +17 -1
- package/dist/eval-server/platform-proxy.js +125 -13
- package/dist/eval-server/platform-proxy.js.map +1 -1
- package/dist/eval-server/plugin-cli-routes.js +9 -9
- package/dist/eval-server/plugin-cli-routes.js.map +1 -1
- package/dist/eval-server/remove-skill-routes.d.ts +18 -0
- package/dist/eval-server/remove-skill-routes.js +145 -0
- package/dist/eval-server/remove-skill-routes.js.map +1 -0
- package/dist/eval-server/router.d.ts +17 -3
- package/dist/eval-server/router.js +166 -9
- package/dist/eval-server/router.js.map +1 -1
- package/dist/eval-server/settings-store.js +1 -1
- package/dist/eval-server/settings-store.js.map +1 -1
- package/dist/eval-server/supported-agents-routes.d.ts +6 -0
- package/dist/eval-server/supported-agents-routes.js +41 -0
- package/dist/eval-server/supported-agents-routes.js.map +1 -0
- package/dist/eval-server/utils/spawn-env.d.ts +1 -0
- package/dist/eval-server/utils/spawn-env.js +47 -0
- package/dist/eval-server/utils/spawn-env.js.map +1 -0
- package/dist/eval-ui/assets/AdvancedTab-D8zbE5fH.js +1 -0
- package/dist/eval-ui/assets/{CreateSkillPage-CvdYq8Rr.js → CreateSkillPage-DOBhKdgr.js} +5 -5
- package/dist/eval-ui/assets/FindSkillsPalette-CyMmNPr-.js +2 -0
- package/dist/eval-ui/assets/GeneralTab-DYR9NWC4.js +1 -0
- package/dist/eval-ui/assets/PrivacyTab-CXIqQokl.js +1 -0
- package/dist/eval-ui/assets/{SearchPaletteCore-Bf3PBC64.js → SearchPaletteCore-Dn5gQJS_.js} +2 -2
- package/dist/eval-ui/assets/SkillDetailPanel-DTrRnyyJ.js +1 -0
- package/dist/eval-ui/assets/UpdateDropdown-Cvr2fe0z.js +1 -0
- package/dist/eval-ui/assets/UpdatesTab-DwJIUDPX.js +1 -0
- package/dist/eval-ui/assets/core-DZAvsxlC.js +1 -0
- package/dist/eval-ui/assets/event-CDYWU2X3.js +1 -0
- package/dist/eval-ui/assets/globals-BRZwPAPF.js +49 -0
- package/dist/eval-ui/assets/globals-C3oEdsJh.css +1 -0
- package/dist/eval-ui/assets/index-D7M0Jdss.js +1 -0
- package/dist/eval-ui/assets/lifecycle-DSleOV-l.js +1 -0
- package/dist/eval-ui/assets/lifecycle-d1Sm9Hts.css +1 -0
- package/dist/eval-ui/assets/main-D2shn1dH.js +87 -0
- package/dist/eval-ui/assets/preferences-BHZXB5dL.css +1 -0
- package/dist/eval-ui/assets/preferences-BKv6X7fK.js +2 -0
- package/dist/eval-ui/assets/useDesktopBridge-DxVWbYqK.js +2 -0
- package/dist/eval-ui/index.html +4 -2
- package/dist/eval-ui/lifecycle.html +33 -0
- package/dist/eval-ui/preferences.html +34 -0
- package/dist/index.js +47 -1
- package/dist/index.js.map +1 -1
- package/dist/installer/bundle-files.d.ts +4 -0
- package/dist/installer/bundle-files.js +97 -0
- package/dist/installer/bundle-files.js.map +1 -0
- package/dist/installer/canonical.d.ts +31 -6
- package/dist/installer/canonical.js +48 -12
- package/dist/installer/canonical.js.map +1 -1
- package/dist/installer/clipboard-export.d.ts +19 -0
- package/dist/installer/clipboard-export.js +88 -0
- package/dist/installer/clipboard-export.js.map +1 -0
- package/dist/installer/multi-install.d.ts +43 -0
- package/dist/installer/multi-install.js +237 -0
- package/dist/installer/multi-install.js.map +1 -0
- package/dist/installer/transformers/aider.d.ts +2 -0
- package/dist/installer/transformers/aider.js +32 -0
- package/dist/installer/transformers/aider.js.map +1 -0
- package/dist/installer/transformers/continue-dev.d.ts +2 -0
- package/dist/installer/transformers/continue-dev.js +6 -0
- package/dist/installer/transformers/continue-dev.js.map +1 -0
- package/dist/installer/transformers/cursor.d.ts +2 -0
- package/dist/installer/transformers/cursor.js +24 -0
- package/dist/installer/transformers/cursor.js.map +1 -0
- package/dist/installer/transformers/github-copilot.d.ts +2 -0
- package/dist/installer/transformers/github-copilot.js +17 -0
- package/dist/installer/transformers/github-copilot.js.map +1 -0
- package/dist/installer/transformers/index.d.ts +78 -0
- package/dist/installer/transformers/index.js +13 -0
- package/dist/installer/transformers/index.js.map +1 -0
- package/dist/installer/transformers/junie.d.ts +2 -0
- package/dist/installer/transformers/junie.js +6 -0
- package/dist/installer/transformers/junie.js.map +1 -0
- package/dist/installer/transformers/kiro.d.ts +2 -0
- package/dist/installer/transformers/kiro.js +6 -0
- package/dist/installer/transformers/kiro.js.map +1 -0
- package/dist/installer/transformers/trae.d.ts +2 -0
- package/dist/installer/transformers/trae.js +6 -0
- package/dist/installer/transformers/trae.js.map +1 -0
- package/dist/installer/transformers/windsurf.d.ts +2 -0
- package/dist/installer/transformers/windsurf.js +12 -0
- package/dist/installer/transformers/windsurf.js.map +1 -0
- package/dist/installer/yaml-safe-mutate.d.ts +19 -0
- package/dist/installer/yaml-safe-mutate.js +184 -0
- package/dist/installer/yaml-safe-mutate.js.map +1 -0
- package/dist/lib/active-tenant.d.ts +36 -0
- package/dist/lib/active-tenant.js +120 -0
- package/dist/lib/active-tenant.js.map +1 -0
- package/dist/lib/github-fetch.d.ts +1 -0
- package/dist/lib/github-fetch.js +11 -1
- package/dist/lib/github-fetch.js.map +1 -1
- package/dist/lib/keychain.d.ts +15 -2
- package/dist/lib/keychain.js +156 -8
- package/dist/lib/keychain.js.map +1 -1
- package/dist/lib/migration/keychain-migration.d.ts +35 -0
- package/dist/lib/migration/keychain-migration.js +189 -0
- package/dist/lib/migration/keychain-migration.js.map +1 -0
- package/dist/lib/tenant-resolver.d.ts +38 -0
- package/dist/lib/tenant-resolver.js +79 -0
- package/dist/lib/tenant-resolver.js.map +1 -0
- package/dist/lockfile/types.d.ts +8 -0
- package/dist/sidecar/eval-ui-manifest.json +1 -0
- package/dist/sidecar/sea-config.json +57 -0
- package/dist/sidecar/sea-prep.blob +0 -0
- package/dist/sidecar/server.cjs +141627 -0
- package/dist/sidecar/vskill-version.txt +1 -0
- package/dist/studio/lib/ops-log.js +140 -57
- package/dist/studio/lib/ops-log.js.map +1 -1
- package/dist/studio/lib/scope-transfer.d.ts +11 -1
- package/dist/studio/lib/scope-transfer.js +48 -24
- package/dist/studio/lib/scope-transfer.js.map +1 -1
- package/dist/studio/routes/index.js +10 -1
- package/dist/studio/routes/index.js.map +1 -1
- package/dist/studio/routes/ops.js +31 -7
- package/dist/studio/routes/ops.js.map +1 -1
- package/dist/studio/routes/promote.js +15 -8
- package/dist/studio/routes/promote.js.map +1 -1
- package/dist/studio/routes/revert.js +12 -1
- package/dist/studio/routes/revert.js.map +1 -1
- package/dist/studio/routes/test-install.js +13 -8
- package/dist/studio/routes/test-install.js.map +1 -1
- package/dist/studio-runtime/lockfile.d.ts +51 -0
- package/dist/studio-runtime/lockfile.js +216 -0
- package/dist/studio-runtime/lockfile.js.map +1 -0
- package/dist/updater/source-fetcher.js +2 -2
- package/dist/updater/source-fetcher.js.map +1 -1
- package/package.json +17 -1
- package/dist/eval-ui/assets/FindSkillsPalette-DsSgotS9.js +0 -2
- package/dist/eval-ui/assets/SkillDetailPanel-DAD2yJO-.js +0 -1
- package/dist/eval-ui/assets/UpdateDropdown-h5Hg3h7Z.js +0 -1
- package/dist/eval-ui/assets/index-CKLqBL52.css +0 -1
- package/dist/eval-ui/assets/index-JaDg6FlU.js +0 -124
- package/dist/eval-ui/assets/skill-studio-logo-CRyKgIrg.png +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{j as e,R as j,u as Z,b as X,r as b,g as B,c as D,w as ee,d as te,e as se,t as P,L as R,P as re,E as le,f as ae,S as ne}from"./index-JaDg6FlU.js";/* empty css */const oe=[{key:"slashCommands",label:"Slash"},{key:"hooks",label:"Hooks"},{key:"mcp",label:"MCP"},{key:"customSystemPrompt",label:"Prompt"}];function ie({supported:r,label:a}){return e.jsx("span",{style:{display:"inline-block",fontSize:10,padding:"1px 5px",borderRadius:3,marginRight:3,background:r?"var(--color-success-bg, #d4edda)":"var(--surface-3, #2a2a2a)",color:r?"var(--color-success, #28a745)":"var(--text-tertiary, #666)",border:`1px solid ${r?"var(--color-success, #28a745)":"var(--border-subtle, #333)"}`},children:a})}function F({agent:r,checked:a,onToggle:g}){return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:6,cursor:"pointer",border:r.installed?"1px solid var(--color-primary, #6366f1)":"1px solid var(--border-subtle, #333)",background:a?"var(--surface-2, #1e1e1e)":"transparent"},children:[e.jsx("input",{type:"checkbox",checked:a,onChange:g,style:{accentColor:"var(--color-primary, #6366f1)"}}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontWeight:500,fontSize:13,color:"var(--text-primary, #fff)"},children:r.displayName}),r.installed&&e.jsx("span",{style:{fontSize:10,padding:"1px 5px",borderRadius:3,background:"var(--color-primary-bg, #312e81)",color:"var(--color-primary, #6366f1)"},children:"installed"})]}),e.jsx("div",{style:{marginTop:3},children:oe.map(x=>e.jsx(ie,{supported:r.featureSupport[x.key],label:x.label},x.key))})]})]})}function de({agents:r,selectedIds:a,onChange:g}){const x=new Set(a),i=r.filter(n=>n.isUniversal),l=r.filter(n=>!n.isUniversal),c=n=>{const o=x.has(n)?a.filter(h=>h!==n):[...a,n];g(o)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[i.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Universal Agents"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:i.map(n=>e.jsx(F,{agent:n,checked:x.has(n.id),onToggle:()=>c(n.id)},n.id))})]}),l.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Other Agents"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:l.map(n=>e.jsx(F,{agent:n,checked:x.has(n.id),onToggle:()=>c(n.id)},n.id))})]})]})}const ce="Cross-universal — emits the same skill to 8 universal agents (Claude, Codex, Cursor, Cline, Gemini CLI, OpenCode, Kimi, Amp). Constrains output to the common schema across all agents. Recommended for portable skills.",ue="Powerful Claude-native engine — Anthropic's built-in skill-creator with a slightly richer schema (more expressive on Claude) but Claude-only. Pick this when you only target Claude Code and want full expressiveness.",xe="Generate raw — no engine assistance, you provide the full SKILL.md body.";function pe(r){return[{engine:"vskill",label:"VSkill skill-builder",caption:r.vskillSkillBuilder?`installed${r.vskillVersion?` v${r.vskillVersion}`:""}`:"not installed",tooltip:ce,detected:r.vskillSkillBuilder,installable:!0},{engine:"anthropic-skill-creator",label:"Anthropic skill-creator",caption:r.anthropicSkillCreator?"installed":"not installed",tooltip:ue,detected:r.anthropicSkillCreator,installable:!0},{engine:"none",label:"No engine — generate raw",caption:"always available",tooltip:xe,detected:!0,installable:!1}]}function me(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function ge(r){const{detection:a,selected:g,onSelect:x,onInstallClick:i}=r,l=j.useMemo(()=>me(),[]),c=j.useMemo(()=>pe(a),[a]),n=l?"":"transition-colors";return e.jsxs("fieldset",{className:"flex flex-col gap-2",children:[e.jsx("legend",{className:"text-xs font-semibold text-gray-700",children:"Authoring engine"}),e.jsx("div",{role:"tablist","aria-label":"Authoring engine",className:"flex flex-col gap-1.5",children:c.map(o=>{const h=g===o.engine,p=!o.detected&&o.installable,y=["flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm cursor-pointer",n,h?"border-blue-600 bg-blue-50":"border-gray-300 bg-white hover:border-gray-400"].filter(Boolean).join(" "),f=o.detected?{}:{opacity:.6};return e.jsxs("div",{role:"tab",tabIndex:0,"data-testid":`engine-selector-${o.engine}`,"aria-selected":h?"true":"false",title:o.tooltip,style:f,className:y,onClick:()=>x(o.engine),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),x(o.engine))},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-gray-900",children:o.label}),e.jsx("span",{className:"text-xs text-gray-500",children:o.caption})]}),p&&e.jsx("button",{type:"button","data-testid":`install-${o.engine}`,className:"rounded border border-blue-600 px-2 py-1 text-xs font-medium text-blue-700 hover:bg-blue-100",onClick:u=>{u.stopPropagation(),i(o.engine)},children:"Install"})]},o.engine)})})]})}const A="(?:0|[1-9]\\d*)",H="[0-9A-Za-z-]",$=`(?:${A}|\\d*[A-Za-z-]${H}*)`,z=`${H}+`,he=`(?:-${$}(?:\\.${$})*)`,fe=`(?:\\+${z}(?:\\.${z})*)`,ve=new RegExp(`^${A}\\.${A}\\.${A}${he}?${fe}?$`);function V(r){return typeof r!="string"?!1:ve.test(r.trim())}const ye="Skill version (semver). Auto-bumps on update unless versioningMode=author.",be="Must be valid semver (e.g. 1.0.0, 2.1.3-beta.1)";function je(r){const{value:a,onChange:g,mode:x,onValidityChange:i,versionsHref:l,disabled:c}=r,[n,o]=j.useState(!1),[h,p]=j.useState(()=>V(a)),y=V(a);j.useEffect(()=>{y!==h?(p(y),i==null||i(y)):i&&i(y)},[y]);const f=n&&!y,u=["w-full rounded-md border px-3 py-2 text-sm font-mono",f?"border-red-500 bg-red-50 focus:outline-red-600":"border-gray-300 bg-white focus:outline-blue-600",c?"opacity-60 cursor-not-allowed":""].join(" ");return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-700",htmlFor:"version-input",children:"Version"}),e.jsx("input",{id:"version-input","data-testid":"version-input",type:"text",title:ye,value:a,onChange:m=>g(m.currentTarget.value),onBlur:()=>o(!0),"aria-invalid":f?"true":"false","aria-describedby":f?"version-input-helper":void 0,disabled:c,className:u,placeholder:"1.0.0"}),f&&e.jsx("span",{id:"version-input-helper","data-testid":"version-input-helper",className:"text-xs text-red-600",role:"alert",children:be}),x==="update"&&l&&e.jsx("a",{"data-testid":"version-input-versions-link",href:l,target:"_blank",rel:"noreferrer",className:"text-xs text-blue-600 hover:underline",children:"Versions →"})]})}const E={status:"idle",liveTail:"",progress:[],exitCode:null,stderr:"",error:null};function ke(r={}){const a=r.fetchImpl??globalThis.fetch,g=r.eventSourceCtor??globalThis.EventSource,[x,i]=j.useState(E),l=j.useRef(null),c=j.useRef(null);j.useEffect(()=>()=>{var p;(p=c.current)==null||p.close()},[]);const n=j.useCallback(()=>{var p;(p=c.current)==null||p.close(),c.current=null,l.current=null,i(E)},[]),o=j.useCallback(async p=>{if(!g){i({...E,status:"failure",error:"EventSource not available"});return}l.current=p,i({...E,status:"spawning"});let y;try{const u=await a("/api/studio/install-engine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({engine:p})});if(!u.ok){const w=await u.json().catch(()=>({}));i({...E,status:"failure",error:w.remediation??w.error??`HTTP ${u.status}`});return}y=(await u.json()).jobId}catch(u){i({...E,status:"failure",error:u.message});return}const f=new g(`/api/studio/install-engine/${y}/stream`);c.current=f,i(u=>({...u,status:"streaming"})),f.addEventListener("progress",u=>{try{const m=JSON.parse(u.data);i(w=>({...w,liveTail:m.line.length>60?m.line.slice(0,60)+"…":m.line,progress:[...w.progress,m].slice(-200)}))}catch{}}),f.addEventListener("done",u=>{try{const m=JSON.parse(u.data);f.close(),c.current=null,i(w=>({...w,status:m.success?"success":"failure",exitCode:m.exitCode,stderr:m.stderr,error:m.success?null:m.stderr||`exit ${m.exitCode}`}))}catch{f.close(),c.current=null,i(m=>({...m,status:"failure",error:"malformed done event"}))}}),f.addEventListener("error",()=>{f.close(),c.current=null,i(u=>({...u,status:u.status==="streaming"?"failure":u.status,error:u.error??"stream error"}))})},[g,a]),h=j.useCallback(async()=>{const p=l.current;p&&await o(p)},[o]);return{state:x,install:o,retry:h,reset:n}}const we={vskill:"vskill install anton-abyzov/vskill/skill-builder","anthropic-skill-creator":"claude plugin install skill-creator"},Ne={vskill:"VSkill skill-builder","anthropic-skill-creator":"Anthropic skill-creator"},Se="This runs the command in your terminal as your user. Inspect before approving.";function Ce(r){const{engine:a,onClose:g,onSuccess:x,hookOpts:i}=r,{state:l,install:c,retry:n}=ke(i),o=we[a],h=Ne[a],p=j.useRef(!1);return j.useEffect(()=>{l.status==="success"&&!p.current&&(p.current=!0,x())},[l.status,x]),e.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"install-engine-title","data-testid":"install-engine-modal",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:e.jsxs("div",{className:"w-full max-w-lg rounded-lg bg-white p-6 shadow-xl",children:[e.jsxs("h2",{id:"install-engine-title",className:"text-lg font-semibold text-gray-900",children:["Install ",h]}),l.status==="idle"&&e.jsx(Le,{command:o,onCancel:g,onRun:()=>c(a)}),(l.status==="spawning"||l.status==="streaming")&&e.jsx(Ee,{command:o,liveTail:l.liveTail}),l.status==="success"&&e.jsx(Pe,{label:h,onClose:g}),l.status==="failure"&&e.jsx(Ie,{error:l.error??"Install failed",stderr:l.stderr,progress:l.progress,onRetry:()=>n(),onClose:g})]})})}function G({command:r}){return e.jsxs("pre",{"data-testid":"install-command-preview",className:"my-3 overflow-x-auto rounded bg-gray-900 px-3 py-2 font-mono text-xs text-green-300",children:["$ ",r]})}function Le(r){return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Studio will run this command on your behalf:"}),e.jsx(G,{command:r.command}),e.jsx("p",{className:"text-xs text-amber-700","data-testid":"install-security-note",children:Se}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button","data-testid":"install-cancel",className:"rounded border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50",onClick:r.onCancel,children:"Cancel"}),e.jsx("button",{type:"button","data-testid":"install-run",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onRun,children:"Run install"})]})]})}function Ee(r){return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Installing…"}),e.jsx(G,{command:r.command}),e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-gray-600",children:[e.jsx("span",{"data-testid":"install-spinner",className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-300 border-t-blue-600"}),e.jsx("span",{"data-testid":"install-live-tail",className:"font-mono",children:r.liveTail||"starting…"})]})]})}function Pe(r){return e.jsxs(e.Fragment,{children:[e.jsxs("p",{"data-testid":"install-success",className:"mt-3 text-sm font-medium text-green-700",children:["✓ ",r.label," installed"]}),e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx("button",{type:"button","data-testid":"install-close",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onClose,children:"Done"})})]})}function Ie(r){const[a,g]=j.useState(!1),x=r.progress.filter(l=>l.stream==="stderr").map(l=>l.line),i=x.length>0?x.join(`
|
|
2
|
-
`):r.stderr;return e.jsxs(e.Fragment,{children:[e.jsx("p",{"data-testid":"install-failure",className:"mt-3 text-sm font-medium text-red-700",children:"✗ Install failed"}),e.jsx("p",{className:"mt-1 text-xs text-gray-700",children:r.error}),
|
|
3
|
-
`)},[t.name,t.description,t.model,t.allowedTools,t.body]);return e.jsxs("div",{className:"px-4 py-6 sm:px-6 sm:py-7 lg:px-10 lg:py-8 max-w-6xl mx-auto w-full overflow-x-hidden",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:[e.jsx(R,{to:"/",className:"hover:underline",style:{color:"var(--text-tertiary)"},children:"Skills"}),e.jsx("span",{children:"/"}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"New Skill"})]}),e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-[22px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),t.standaloneLocked&&e.jsx("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider px-2 py-0.5 rounded whitespace-nowrap",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"1px solid var(--accent-muted)"},title:"You chose Standalone in the previous step. Plugin selection is disabled.",children:"Standalone"})]}),e.jsx("p",{className:"text-[13px] mt-1",style:{color:"var(--text-tertiary)"},children:"Define your skill's metadata, content, and placement"})]}),e.jsxs("div",{className:"inline-flex rounded-lg p-1 self-start sm:self-auto sm:flex-shrink-0 max-w-full",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},role:"tablist","aria-label":"Creation mode",children:[e.jsx("button",{onClick:()=>t.setMode("ai"),className:"px-4 py-2 rounded-md text-[13px] font-medium transition-all duration-200",style:{background:t.mode==="ai"?"var(--purple-muted)":"transparent",color:t.mode==="ai"?"var(--purple)":"var(--text-tertiary)",boxShadow:t.mode==="ai"?"0 1px 3px rgba(0,0,0,0.08)":"none"},children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(M,{size:14}),"AI-Assisted"]})}),e.jsx("button",{onClick:()=>t.setMode("manual"),className:"px-4 py-2 rounded-md text-[13px] font-medium transition-all duration-200",style:{background:t.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:t.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:t.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none"},children:"Manual"})]})]})]}),t.engineDetection&&e.jsx("div",{className:"mb-4",children:e.jsx(
|
|
1
|
+
import{j as e,R as b,r as v}from"./globals-BRZwPAPF.js";import{o as Z,u as X,b as ee,g as B,r as F,w as te,c as se,d as re,t as P,L as R,P as le,E as ae,e as ne,S as ie}from"./main-D2shn1dH.js";import"./useDesktopBridge-DxVWbYqK.js";/* empty css */const oe=[{key:"slashCommands",label:"Slash"},{key:"hooks",label:"Hooks"},{key:"mcp",label:"MCP"},{key:"customSystemPrompt",label:"Prompt"}];function de({supported:r,label:n}){return e.jsx("span",{style:{display:"inline-block",fontSize:10,padding:"1px 5px",borderRadius:3,marginRight:3,background:r?"var(--color-success-bg, #d4edda)":"var(--surface-3, #2a2a2a)",color:r?"var(--color-success, #28a745)":"var(--text-tertiary, #666)",border:`1px solid ${r?"var(--color-success, #28a745)":"var(--border-subtle, #333)"}`},children:n})}function D({agent:r,checked:n,onToggle:f}){return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:6,cursor:"pointer",border:r.installed?"1px solid var(--color-primary, #6366f1)":"1px solid var(--border-subtle, #333)",background:n?"var(--surface-2, #1e1e1e)":"transparent"},children:[e.jsx("input",{type:"checkbox",checked:n,onChange:f,style:{accentColor:"var(--color-primary, #6366f1)"}}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontWeight:500,fontSize:13,color:"var(--text-primary, #fff)"},children:r.displayName}),r.installed&&e.jsx("span",{style:{fontSize:10,padding:"1px 5px",borderRadius:3,background:"var(--color-primary-bg, #312e81)",color:"var(--color-primary, #6366f1)"},children:"installed"})]}),e.jsx("div",{style:{marginTop:3},children:oe.map(i=>e.jsx(de,{supported:r.featureSupport[i.key],label:i.label},i.key))})]})]})}function ce({agents:r,selectedIds:n,onChange:f}){const i=new Set(n),x=r.filter(a=>a.isUniversal),l=r.filter(a=>!a.isUniversal),p=a=>{const d=i.has(a)?n.filter(c=>c!==a):[...n,a];f(d)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[x.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Universal Agents"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:x.map(a=>e.jsx(D,{agent:a,checked:i.has(a.id),onToggle:()=>p(a.id)},a.id))})]}),l.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Other Agents"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:l.map(a=>e.jsx(D,{agent:a,checked:i.has(a.id),onToggle:()=>p(a.id)},a.id))})]})]})}const ue="Cross-universal — emits the same skill to 8 universal agents (Claude, Codex, Cursor, Cline, Gemini CLI, OpenCode, Kimi, Amp). Constrains output to the common schema across all agents. Recommended for portable skills.",xe="Powerful Claude-native engine — Anthropic's built-in skill-creator with a slightly richer schema (more expressive on Claude) but Claude-only. Pick this when you only target Claude Code and want full expressiveness.",pe="Generate raw — no engine assistance, you provide the full SKILL.md body.";function me(r){return[{engine:"vskill",label:"VSkill skill-builder",caption:r.vskillSkillBuilder?`installed${r.vskillVersion?` v${r.vskillVersion}`:""}`:"not installed",tooltip:ue,detected:r.vskillSkillBuilder,installable:!0},{engine:"anthropic-skill-creator",label:"Anthropic skill-creator",caption:r.anthropicSkillCreator?"installed":"not installed",tooltip:xe,detected:r.anthropicSkillCreator,installable:!0},{engine:"none",label:"No engine — generate raw",caption:"always available",tooltip:pe,detected:!0,installable:!1}]}function ge(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function he(r){const{detection:n,selected:f,onSelect:i,onInstallClick:x}=r,l=b.useMemo(()=>ge(),[]),p=b.useMemo(()=>me(n),[n]),a=l?"":"transition-colors";return e.jsxs("fieldset",{className:"flex flex-col gap-2",children:[e.jsx("legend",{className:"text-xs font-semibold text-gray-700",children:"Authoring engine"}),e.jsx("div",{role:"tablist","aria-label":"Authoring engine",className:"flex flex-col gap-1.5",children:p.map(d=>{const c=f===d.engine,k=!d.detected&&d.installable,h=["flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm cursor-pointer",a,c?"border-blue-600 bg-blue-50":"border-gray-300 bg-white hover:border-gray-400"].filter(Boolean).join(" "),u=d.detected?{}:{opacity:.6};return e.jsxs("div",{role:"tab",tabIndex:0,"data-testid":`engine-selector-${d.engine}`,"aria-selected":c?"true":"false",title:d.tooltip,style:u,className:h,onClick:()=>i(d.engine),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),i(d.engine))},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-gray-900",children:d.label}),e.jsx("span",{className:"text-xs text-gray-500",children:d.caption})]}),k&&e.jsx("button",{type:"button","data-testid":`install-${d.engine}`,className:"rounded border border-blue-600 px-2 py-1 text-xs font-medium text-blue-700 hover:bg-blue-100",onClick:g=>{g.stopPropagation(),x(d.engine)},children:"Install"})]},d.engine)})})]})}const A="(?:0|[1-9]\\d*)",H="[0-9A-Za-z-]",$=`(?:${A}|\\d*[A-Za-z-]${H}*)`,z=`${H}+`,fe=`(?:-${$}(?:\\.${$})*)`,ye=`(?:\\+${z}(?:\\.${z})*)`,ve=new RegExp(`^${A}\\.${A}\\.${A}${fe}?${ye}?$`);function V(r){return typeof r!="string"?!1:ve.test(r.trim())}const be="Skill version (semver). Auto-bumps on update unless versioningMode=author.",je="Must be valid semver (e.g. 1.0.0, 2.1.3-beta.1)";function ke(r){const{value:n,onChange:f,mode:i,onValidityChange:x,versionsHref:l,disabled:p}=r,[a,d]=b.useState(!1),[c,k]=b.useState(()=>V(n)),h=V(n);b.useEffect(()=>{h!==c?(k(h),x==null||x(h)):x&&x(h)},[h]);const u=a&&!h,g=["w-full rounded-md border px-3 py-2 text-sm font-mono",u?"border-red-500 bg-red-50 focus:outline-red-600":"border-gray-300 bg-white focus:outline-blue-600",p?"opacity-60 cursor-not-allowed":""].join(" ");return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-700",htmlFor:"version-input",children:"Version"}),e.jsx("input",{id:"version-input","data-testid":"version-input",type:"text",title:be,value:n,onChange:m=>f(m.currentTarget.value),onBlur:()=>d(!0),"aria-invalid":u?"true":"false","aria-describedby":u?"version-input-helper":void 0,disabled:p,className:g,placeholder:"1.0.0"}),u&&e.jsx("span",{id:"version-input-helper","data-testid":"version-input-helper",className:"text-xs text-red-600",role:"alert",children:je}),i==="update"&&l&&e.jsx("a",{"data-testid":"version-input-versions-link",href:l,target:"_blank",rel:"noreferrer",className:"text-xs text-blue-600 hover:underline",children:"Versions →"})]})}const E={status:"idle",liveTail:"",progress:[],exitCode:null,stderr:"",error:null};function we(r={}){const n=r.fetchImpl??globalThis.fetch,[f,i]=b.useState(E),x=b.useRef(null),l=b.useRef(null);b.useEffect(()=>()=>{var c;(c=l.current)==null||c.close()},[]);const p=b.useCallback(()=>{var c;(c=l.current)==null||c.close(),l.current=null,x.current=null,i(E)},[]),a=b.useCallback(async c=>{x.current=c,i({...E,status:"spawning"});let k;try{const u=await n("/api/studio/install-engine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({engine:c})});if(!u.ok){const m=await u.json().catch(()=>({}));i({...E,status:"failure",error:m.remediation??m.error??`HTTP ${u.status}`});return}k=(await u.json()).jobId}catch(u){i({...E,status:"failure",error:u.message});return}let h;h=Z(`/api/studio/install-engine/${k}/stream`,{fetchImpl:n,timeoutMessage:"install-engine SSE stream timed out",onEvent:({event:u,data:g})=>{if(u==="progress"){try{const m=JSON.parse(g);i(S=>({...S,liveTail:m.line.length>60?m.line.slice(0,60)+"…":m.line,progress:[...S.progress,m].slice(-200)}))}catch{}return}if(u==="done")try{const m=JSON.parse(g);h.close(),l.current=null,i(S=>({...S,status:m.success?"success":"failure",exitCode:m.exitCode,stderr:m.stderr,error:m.success?null:m.stderr||`exit ${m.exitCode}`}))}catch{h.close(),l.current=null,i(m=>({...m,status:"failure",error:"malformed done event"}))}},onError:u=>{l.current=null,i(g=>({...g,status:g.status==="streaming"?"failure":g.status,error:g.error??u.message}))}}),l.current=h,i(u=>({...u,status:"streaming"}))},[n]),d=b.useCallback(async()=>{const c=x.current;c&&await a(c)},[a]);return{state:f,install:a,retry:d,reset:p}}const Ne={vskill:"vskill install anton-abyzov/vskill/skill-builder","anthropic-skill-creator":"claude plugin install skill-creator"},Se={vskill:"VSkill skill-builder","anthropic-skill-creator":"Anthropic skill-creator"},Ce="This runs the command in your terminal as your user. Inspect before approving.";function Le(r){const{engine:n,onClose:f,onSuccess:i,hookOpts:x}=r,{state:l,install:p,retry:a}=we(x),d=Ne[n],c=Se[n],k=b.useRef(!1);return b.useEffect(()=>{l.status==="success"&&!k.current&&(k.current=!0,i())},[l.status,i]),e.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"install-engine-title","data-testid":"install-engine-modal",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:e.jsxs("div",{className:"w-full max-w-lg rounded-lg bg-white p-6 shadow-xl",children:[e.jsxs("h2",{id:"install-engine-title",className:"text-lg font-semibold text-gray-900",children:["Install ",c]}),l.status==="idle"&&e.jsx(Ee,{command:d,onCancel:f,onRun:()=>p(n)}),(l.status==="spawning"||l.status==="streaming")&&e.jsx(Pe,{command:d,liveTail:l.liveTail}),l.status==="success"&&e.jsx(Ie,{label:c,onClose:f}),l.status==="failure"&&e.jsx(Ae,{error:l.error??"Install failed",stderr:l.stderr,progress:l.progress,onRetry:()=>a(),onClose:f})]})})}function G({command:r}){return e.jsxs("pre",{"data-testid":"install-command-preview",className:"my-3 overflow-x-auto rounded bg-gray-900 px-3 py-2 font-mono text-xs text-green-300",children:["$ ",r]})}function Ee(r){return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Studio will run this command on your behalf:"}),e.jsx(G,{command:r.command}),e.jsx("p",{className:"text-xs text-amber-700","data-testid":"install-security-note",children:Ce}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button","data-testid":"install-cancel",className:"rounded border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50",onClick:r.onCancel,children:"Cancel"}),e.jsx("button",{type:"button","data-testid":"install-run",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onRun,children:"Run install"})]})]})}function Pe(r){return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Installing…"}),e.jsx(G,{command:r.command}),e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-gray-600",children:[e.jsx("span",{"data-testid":"install-spinner",className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-300 border-t-blue-600"}),e.jsx("span",{"data-testid":"install-live-tail",className:"font-mono",children:r.liveTail||"starting…"})]})]})}function Ie(r){return e.jsxs(e.Fragment,{children:[e.jsxs("p",{"data-testid":"install-success",className:"mt-3 text-sm font-medium text-green-700",children:["✓ ",r.label," installed"]}),e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx("button",{type:"button","data-testid":"install-close",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onClose,children:"Done"})})]})}function Ae(r){const[n,f]=b.useState(!1),i=r.progress.filter(l=>l.stream==="stderr").map(l=>l.line),x=i.length>0?i.join(`
|
|
2
|
+
`):r.stderr;return e.jsxs(e.Fragment,{children:[e.jsx("p",{"data-testid":"install-failure",className:"mt-3 text-sm font-medium text-red-700",children:"✗ Install failed"}),e.jsx("p",{className:"mt-1 text-xs text-gray-700",children:r.error}),x&&e.jsxs("details",{className:"mt-3 text-xs",open:n,onToggle:l=>f(l.currentTarget.open),children:[e.jsx("summary",{className:"cursor-pointer text-gray-600",children:"stderr"}),e.jsx("pre",{"data-testid":"install-stderr",className:"mt-2 overflow-x-auto rounded bg-gray-900 px-3 py-2 font-mono text-xs text-red-300",children:x})]}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button","data-testid":"install-close",className:"rounded border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50",onClick:r.onClose,children:"Close"}),e.jsx("button",{type:"button","data-testid":"install-retry",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onRetry,children:"Retry"})]})]})}const N={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Te(r){return r?/API usage limits|usage limit/i.test(r)&&/regain access|reset/i.test(r):!1}function Re(r){const n=r.match(/regain access on ([^"\\]+?)(?:\s*UTC)?["\\]/i)??r.match(/regain access on ([^"\\]+)/i);return n?`Resets ${n[1].trim()} UTC`:"Quota resets at the start of your next billing period"}function I(r){switch(r){case"claude-cli":return"Uses your logged-in Claude Code session — your existing CLI session handles quota. No API key needed. Overflow runs at standard API rates if extra usage is enabled in your account settings.";case"anthropic":return"Direct Anthropic API — pay-per-token. Full Opus / Sonnet / Haiku catalog. Requires ANTHROPIC_API_KEY.";case"openrouter":return"One API key → 300+ models from Anthropic, OpenAI (GPT-5 / o4-mini), Google (Gemini), Meta (Llama) and more. Same prices as direct.";case"ollama":return"Local models on your machine (Llama, Qwen, Mistral, etc.). Zero cost, zero data leaves your laptop.";case"lm-studio":return"Local models via LM Studio's OpenAI-compatible server. Works offline. Pick any model you've loaded in LM Studio.";default:return""}}function M({size:r=14,color:n="currentColor"}){return e.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function Fe(){const{config:r}=X(),{refreshSkills:n,revealSkill:f}=ee(),[i,x]=v.useState(null),l=b.useMemo(()=>{if(typeof window>"u")return{};const s=window.location.hash,o=s.indexOf("?");if(o===-1)return{};const w=new URLSearchParams(s.slice(o+1)),j={};for(const y of["mode","skillName","description","pluginName"]){const L=w.get(y);L&&(j[y]=L)}return j},[]),[p,a]=v.useState("claude-cli"),[d,c]=v.useState("sonnet"),[k,h]=v.useState(!1),[u,g]=v.useState(null),m=v.useRef(!1),[S,W]=v.useState([]),[U,K]=v.useState(()=>B("activeAgent",null));v.useEffect(()=>{function s(){K(B("activeAgent",null))}return window.addEventListener("studio:agent-changed",s),window.addEventListener("storage",s),()=>{window.removeEventListener("studio:agent-changed",s),window.removeEventListener("storage",s)}},[]);const Y=U!=="claude-code";v.useEffect(()=>{fetch("/api/agents/installed").then(s=>s.json()).then(s=>{s.agents&&W(s.agents)}).catch(()=>{})},[]),v.useEffect(()=>{var j;if(!r)return;const s=r.providers.filter(y=>y.available),o=F().skillGenModel;if(s.length===0){m.current=!0;return}if(o&&typeof o=="object"&&typeof o.provider=="string"&&typeof o.model=="string"){const y=s.find(T=>T.id===o.provider),L=y==null?void 0:y.models.some(T=>T.id===o.model);if(y&&L){a(o.provider),c(o.model),h(!0),m.current=!0;return}g({provider:o.provider,model:o.model})}if(s.find(y=>y.id==="claude-cli"))a("claude-cli"),c("sonnet");else{const y=s[0];a(y.id),c(((j=y.models[0])==null?void 0:j.id)??"")}h(!1),m.current=!0},[r]),v.useEffect(()=>{const s=o=>{if(o.key!==null&&!o.key.includes("vskill.studio.prefs"))return;const j=F().skillGenModel;j&&typeof j=="object"&&typeof j.provider=="string"&&typeof j.model=="string"&&(a(j.provider),c(j.model),h(!0))};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[]);const O=v.useCallback((s,o)=>{te("skillGenModel",{provider:s,model:o}),h(!0)},[]),q=v.useCallback(()=>({provider:p,model:d}),[p,d]),Q=l.mode==="standalone"?3:void 0,{flushBySkillName:J}=se(),t=re({onCreated:(s,o)=>{n(),setTimeout(()=>f(s,o),500)},resolveAiConfigOverride:q,forceLayout:Q,flushPendingForSkillName:J});v.useEffect(()=>{l.skillName&&!t.name&&t.setName(P(l.skillName)),l.description&&!t.description&&t.setDescription(l.description),l.description&&!t.aiPrompt&&t.setAiPrompt(l.description),l.pluginName&&!t.plugin&&t.setPlugin(P(l.pluginName))},[]);const C=r==null?void 0:r.providers.find(s=>s.id===p&&s.available),_=v.useMemo(()=>{const s=["---"];return t.description?s.push(`description: "${t.description.replace(/"/g,'\\"')}"`):s.push('description: ""'),t.allowedTools.trim()&&s.push(`allowed-tools: ${t.allowedTools.trim()}`),t.model&&s.push(`model: ${t.model}`),t.targetAgents.length>0&&s.push(`target-agents: ${t.targetAgents.join(", ")}`),s.push("---"),s.push(""),t.body.trim()?s.push(t.body.trim()):(s.push(`# /${t.name||"skill-name"}`),s.push(""),s.push("You are a helpful assistant.")),s.join(`
|
|
3
|
+
`)},[t.name,t.description,t.model,t.allowedTools,t.body]);return e.jsxs("div",{className:"px-4 py-6 sm:px-6 sm:py-7 lg:px-10 lg:py-8 max-w-6xl mx-auto w-full overflow-x-hidden",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:[e.jsx(R,{to:"/",className:"hover:underline",style:{color:"var(--text-tertiary)"},children:"Skills"}),e.jsx("span",{children:"/"}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"New Skill"})]}),e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-[22px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),t.standaloneLocked&&e.jsx("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider px-2 py-0.5 rounded whitespace-nowrap",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"1px solid var(--accent-muted)"},title:"You chose Standalone in the previous step. Plugin selection is disabled.",children:"Standalone"})]}),e.jsx("p",{className:"text-[13px] mt-1",style:{color:"var(--text-tertiary)"},children:"Define your skill's metadata, content, and placement"})]}),e.jsxs("div",{className:"inline-flex rounded-lg p-1 self-start sm:self-auto sm:flex-shrink-0 max-w-full",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},role:"tablist","aria-label":"Creation mode",children:[e.jsx("button",{onClick:()=>t.setMode("ai"),className:"px-4 py-2 rounded-md text-[13px] font-medium transition-all duration-200",style:{background:t.mode==="ai"?"var(--purple-muted)":"transparent",color:t.mode==="ai"?"var(--purple)":"var(--text-tertiary)",boxShadow:t.mode==="ai"?"0 1px 3px rgba(0,0,0,0.08)":"none"},children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(M,{size:14}),"AI-Assisted"]})}),e.jsx("button",{onClick:()=>t.setMode("manual"),className:"px-4 py-2 rounded-md text-[13px] font-medium transition-all duration-200",style:{background:t.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:t.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:t.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none"},children:"Manual"})]})]})]}),t.engineDetection&&e.jsx("div",{className:"mb-4",children:e.jsx(he,{detection:t.engineDetection,selected:t.engine,onSelect:s=>t.setEngine(s),onInstallClick:s=>x(s)})}),t.layoutLoading&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),e.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),e.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!t.layoutLoading&&t.layout&&t.mode==="ai"&&e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 animate-fade-in",children:[e.jsxs("div",{className:"flex-1 min-w-0 space-y-5",children:[e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[e.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"var(--purple-muted)"},children:e.jsx(M,{size:13,color:"var(--purple)"})}),"Describe Your Skill"]}),e.jsx("textarea",{ref:t.promptRef,value:t.aiPrompt,onChange:s=>t.setAiPrompt(s.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
|
|
4
4
|
|
|
5
|
-
Include any specific behaviors, constraints, or output formats you want.`,rows:6,disabled:t.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...S,minHeight:"140px"},onKeyDown:s=>{s.key==="Enter"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),t.handleGenerate())}}),e.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[e.jsx("span",{children:"Source Model"}),!p&&c==="claude-cli"&&o==="sonnet"&&e.jsx("span",{className:"text-[10px] font-normal uppercase tracking-wider px-1.5 py-0.5 rounded",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"Default"})]}),f&&e.jsxs("div",{role:"status",className:"mb-3 px-3 py-2 rounded-lg text-[12px] flex items-center justify-between gap-3",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:[e.jsxs("span",{children:["Previous selection ",e.jsxs("code",{children:[f.provider,"/",f.model]})," unavailable — reverted to default."]}),e.jsx("button",{onClick:()=>u(null),className:"text-[11px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},"aria-label":"Dismiss notice",children:"✕"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",title:C?void 0:"Install a provider (Ollama / LM Studio / OpenRouter) or run `claude login` to enable model selection.",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),e.jsx("select",{value:c,onChange:s=>{var v;const d=s.target.value;n(d);const N=r==null?void 0:r.providers.find(L=>L.id===d),k=((v=N==null?void 0:N.models[0])==null?void 0:v.id)??o;N!=null&&N.models[0]&&h(k),O(d,k)},disabled:t.generating||!C,title:C?I(c)||void 0:"Install a provider (Ollama / LM Studio / OpenRouter) or run `claude login` to enable model selection.",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S,children:r==null?void 0:r.providers.filter(s=>s.available).map(s=>e.jsx("option",{value:s.id,title:I(s.id),children:s.label},s.id))}),I(c)&&e.jsxs("div",{className:"mt-1.5 text-[11px]",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:[I(c),c==="claude-cli"&&e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:"https://claude.com/settings/usage",target:"_blank",rel:"noreferrer",style:{color:"var(--color-accent, #2f6f8f)",textDecoration:"underline"},children:"Enable extra usage →"})]})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Model"}),e.jsx("select",{value:o,onChange:s=>{const d=s.target.value;h(d),O(c,d)},disabled:t.generating||!C,className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S,children:C==null?void 0:C.models.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))})]})]})]}),Y&&w.length>0&&e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Target Agents",e.jsx("span",{className:"text-[11px] font-normal ml-2",style:{color:"var(--text-tertiary)"},children:"(optional — leave empty for Claude Code default)"})]}),e.jsx(de,{agents:w,selectedIds:t.targetAgents,onChange:t.setTargetAgents})]}),t.generating&&t.aiProgress.length>0&&e.jsx("div",{children:e.jsx(re,{entries:t.aiProgress,isRunning:!0})}),t.aiError&&e.jsx("div",{children:Ae(t.aiError)?e.jsxs("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--yellow-muted)",color:"var(--text-primary)",border:"1px solid var(--yellow)"},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Your Claude Code session quota is exhausted"}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)",lineHeight:1.5,marginBottom:8},children:[Te(t.aiError),". Switch to another provider (Anthropic API, OpenRouter, or a local model) or enable extra usage to continue past your monthly quota."]}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("a",{href:"https://claude.com/settings/usage",target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",padding:"4px 10px",fontSize:12,fontWeight:500,color:"var(--color-paper, #fff)",background:"var(--color-accent, #2f6f8f)",borderRadius:4,textDecoration:"none"},children:"Enable extra usage →"}),e.jsx("button",{onClick:t.clearAiError,style:{padding:"4px 10px",fontSize:12,color:"var(--text-primary)",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,cursor:"pointer"},children:"Dismiss"})]})]}):t.aiClassifiedError?e.jsx(le,{error:t.aiClassifiedError,onRetry:t.handleGenerate,onDismiss:t.clearAiError}):e.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:t.aiError})}),e.jsxs("div",{className:"flex items-center gap-3",children:[t.generating?e.jsx("button",{onClick:t.handleCancelGenerate,className:"px-6 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:"Cancel Generation"}):e.jsxs("button",{onClick:t.handleGenerate,disabled:!t.aiPrompt.trim(),className:"px-6 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:t.aiPrompt.trim()?"var(--color-action, #2F5B8E)":"var(--surface-3)",color:t.aiPrompt.trim()?"var(--color-action-ink, #FFFFFF)":"var(--text-tertiary)",cursor:t.aiPrompt.trim()?"pointer":"not-allowed"},children:[e.jsx(M,{size:14})," Generate Skill"]}),e.jsx(R,{to:"/",className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)"},children:"Cancel"})]})]}),e.jsx("div",{className:"w-full lg:w-[340px] lg:flex-shrink-0 min-w-0",children:e.jsx("div",{className:"lg:sticky lg:top-8",children:e.jsxs("div",{className:"glass-card p-4",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"SKILL.md Preview"}),e.jsx("pre",{className:"text-[11px] font-mono leading-relaxed overflow-auto max-h-[500px] p-3 rounded-lg",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:_})]})})})]}),!t.layoutLoading&&t.layout&&t.mode==="manual"&&e.jsx("div",{className:"animate-fade-in",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 min-w-0 space-y-5",children:[e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 mb-3",children:[e.jsx("h3",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Location"}),t.standaloneLocked&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium px-2 py-1 rounded-md whitespace-nowrap",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"1px solid var(--accent-muted)"},title:"You chose Standalone in the previous step. To change, go back and pick a different destination.",children:[e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Standalone skill"]})]}),t.standaloneLocked?e.jsxs("p",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:["Lives at ",e.jsxs("code",{style:{fontFamily:"var(--font-mono)",fontSize:11},children:["<project>/skills/","<name>","/SKILL.md"]})," — works with every agent. No plugin selected."]}):e.jsxs(e.Fragment,{children:[t.creatableLayouts.length>1&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.creatableLayouts.map(s=>e.jsx("button",{onClick:()=>{t.setSelectedLayout(s.layout);const d=s.existingPlugins[0];t.setPlugin(d||""),t.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150 whitespace-nowrap",style:{background:t.selectedLayout===s.layout?"var(--accent)":"var(--surface-3)",color:t.selectedLayout===s.layout?"var(--color-paper)":"var(--text-secondary)",border:`1px solid ${t.selectedLayout===s.layout?"var(--accent)":"var(--border-subtle)"}`},children:s.label},s.layout)),!t.creatableLayouts.find(s=>s.layout===3)&&e.jsx("button",{onClick:()=>{t.setSelectedLayout(3),t.setPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150 whitespace-nowrap",style:{background:t.selectedLayout===3?"var(--accent)":"var(--surface-3)",color:t.selectedLayout===3?"var(--color-paper)":"var(--text-secondary)",border:`1px solid ${t.selectedLayout===3?"var(--accent)":"var(--border-subtle)"}`},children:"Root skills/"})]})]}),t.selectedLayout!==3&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),e.jsxs("select",{value:t.plugin,onChange:s=>{t.setPlugin(s.target.value),t.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S,children:[t.availablePlugins.map(s=>e.jsx("option",{value:s,children:s},s)),e.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),t.plugin==="__new__"&&e.jsx("input",{type:"text",value:t.newPlugin,onChange:s=>t.setNewPlugin(P(s.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:S})]})]}),e.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono overflow-x-auto",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)",wordBreak:"break-all",overflowWrap:"anywhere",lineHeight:1.55},children:t.pathPreview})]}),!t.standaloneLocked&&t.showPluginRecommendation&&t.pluginLayoutInfo&&t.selectedLayout===3&&e.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",style:{background:"var(--accent-muted)",color:"var(--text-secondary)",border:"1px solid var(--accent-muted)"},children:[e.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),e.jsxs("span",{children:["Plugins detected (",e.jsx("strong",{children:t.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:t.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"var(--accent)",color:"var(--color-paper)",border:"none",cursor:"pointer"},children:"Use plugin"}),e.jsx("button",{onClick:()=>t.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsxs("div",{className:"glass-card p-5",children:[e.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:["Name ",e.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),e.jsx("input",{type:"text",value:t.name,onChange:s=>t.setName(P(s.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S})]}),e.jsx("div",{className:"mb-4",children:e.jsx(je,{value:t.version,onChange:t.setVersion,onValidityChange:t.setVersionValid,mode:"create"})}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:["Description ",e.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),e.jsx("textarea",{value:t.description,onChange:s=>t.setDescription(s.target.value),placeholder:"Brief description — used for auto-activation keywords",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...S,minHeight:"72px"}}),e.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"This text is used by Claude to decide when to activate the skill"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Model"}),e.jsxs("select",{value:t.model,onChange:s=>t.setModel(s.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S,children:[e.jsx("option",{value:"",children:"Any (default)"}),e.jsx("option",{value:"opus",children:"Opus"}),e.jsx("option",{value:"sonnet",children:"Sonnet"}),e.jsx("option",{value:"haiku",children:"Haiku"})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),e.jsx("input",{type:"text",value:t.allowedTools,onChange:s=>t.setAllowedTools(s.target.value),placeholder:"Read, Write, Edit, Bash, Glob, Grep",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S})]})]})]}),e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),e.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),e.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(s=>e.jsxs("button",{onClick:()=>t.setBodyViewMode(s),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:t.bodyViewMode===s?"var(--surface-4)":"transparent",color:t.bodyViewMode===s?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:t.bodyViewMode===s?600:400,border:"none",cursor:"pointer"},children:[s==="write"?e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]}):e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),e.jsx("span",{children:s==="write"?"Write":"Preview"})]},s))})]}),t.bodyViewMode==="write"?e.jsx("textarea",{value:t.body,onChange:s=>t.setBody(s.target.value),placeholder:`# /my-skill
|
|
5
|
+
Include any specific behaviors, constraints, or output formats you want.`,rows:6,disabled:t.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...N,minHeight:"140px"},onKeyDown:s=>{s.key==="Enter"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),t.handleGenerate())}}),e.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[e.jsx("span",{children:"Source Model"}),!k&&p==="claude-cli"&&d==="sonnet"&&e.jsx("span",{className:"text-[10px] font-normal uppercase tracking-wider px-1.5 py-0.5 rounded",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"Default"})]}),u&&e.jsxs("div",{role:"status",className:"mb-3 px-3 py-2 rounded-lg text-[12px] flex items-center justify-between gap-3",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:[e.jsxs("span",{children:["Previous selection ",e.jsxs("code",{children:[u.provider,"/",u.model]})," unavailable — reverted to default."]}),e.jsx("button",{onClick:()=>g(null),className:"text-[11px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},"aria-label":"Dismiss notice",children:"✕"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",title:C?void 0:"Install a provider (Ollama / LM Studio / OpenRouter) or run `claude login` to enable model selection.",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),e.jsx("select",{value:p,onChange:s=>{var y;const o=s.target.value;a(o);const w=r==null?void 0:r.providers.find(L=>L.id===o),j=((y=w==null?void 0:w.models[0])==null?void 0:y.id)??d;w!=null&&w.models[0]&&c(j),O(o,j)},disabled:t.generating||!C,title:C?I(p)||void 0:"Install a provider (Ollama / LM Studio / OpenRouter) or run `claude login` to enable model selection.",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N,children:r==null?void 0:r.providers.filter(s=>s.available).map(s=>e.jsx("option",{value:s.id,title:I(s.id),children:s.label},s.id))}),I(p)&&e.jsxs("div",{className:"mt-1.5 text-[11px]",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:[I(p),p==="claude-cli"&&e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:"https://claude.com/settings/usage",target:"_blank",rel:"noreferrer",style:{color:"var(--color-accent, #2f6f8f)",textDecoration:"underline"},children:"Enable extra usage →"})]})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Model"}),e.jsx("select",{value:d,onChange:s=>{const o=s.target.value;c(o),O(p,o)},disabled:t.generating||!C,className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N,children:C==null?void 0:C.models.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))})]})]})]}),Y&&S.length>0&&e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Target Agents",e.jsx("span",{className:"text-[11px] font-normal ml-2",style:{color:"var(--text-tertiary)"},children:"(optional — leave empty for Claude Code default)"})]}),e.jsx(ce,{agents:S,selectedIds:t.targetAgents,onChange:t.setTargetAgents})]}),t.generating&&t.aiProgress.length>0&&e.jsx("div",{children:e.jsx(le,{entries:t.aiProgress,isRunning:!0})}),t.aiError&&e.jsx("div",{children:Te(t.aiError)?e.jsxs("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--yellow-muted)",color:"var(--text-primary)",border:"1px solid var(--yellow)"},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Your Claude Code session quota is exhausted"}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)",lineHeight:1.5,marginBottom:8},children:[Re(t.aiError),". Switch to another provider (Anthropic API, OpenRouter, or a local model) or enable extra usage to continue past your monthly quota."]}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("a",{href:"https://claude.com/settings/usage",target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",padding:"4px 10px",fontSize:12,fontWeight:500,color:"var(--color-paper, #fff)",background:"var(--color-accent, #2f6f8f)",borderRadius:4,textDecoration:"none"},children:"Enable extra usage →"}),e.jsx("button",{onClick:t.clearAiError,style:{padding:"4px 10px",fontSize:12,color:"var(--text-primary)",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,cursor:"pointer"},children:"Dismiss"})]})]}):t.aiClassifiedError?e.jsx(ae,{error:t.aiClassifiedError,onRetry:t.handleGenerate,onDismiss:t.clearAiError}):e.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:t.aiError})}),e.jsxs("div",{className:"flex items-center gap-3",children:[t.generating?e.jsx("button",{onClick:t.handleCancelGenerate,className:"px-6 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:"Cancel Generation"}):e.jsxs("button",{onClick:t.handleGenerate,disabled:!t.aiPrompt.trim(),className:"px-6 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:t.aiPrompt.trim()?"var(--color-action, #2F5B8E)":"var(--surface-3)",color:t.aiPrompt.trim()?"var(--color-action-ink, #FFFFFF)":"var(--text-tertiary)",cursor:t.aiPrompt.trim()?"pointer":"not-allowed"},children:[e.jsx(M,{size:14})," Generate Skill"]}),e.jsx(R,{to:"/",className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)"},children:"Cancel"})]})]}),e.jsx("div",{className:"w-full lg:w-[340px] lg:flex-shrink-0 min-w-0",children:e.jsx("div",{className:"lg:sticky lg:top-8",children:e.jsxs("div",{className:"glass-card p-4",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"SKILL.md Preview"}),e.jsx("pre",{className:"text-[11px] font-mono leading-relaxed overflow-auto max-h-[500px] p-3 rounded-lg",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:_})]})})})]}),!t.layoutLoading&&t.layout&&t.mode==="manual"&&e.jsx("div",{className:"animate-fade-in",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 min-w-0 space-y-5",children:[e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 mb-3",children:[e.jsx("h3",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Location"}),t.standaloneLocked&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium px-2 py-1 rounded-md whitespace-nowrap",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"1px solid var(--accent-muted)"},title:"You chose Standalone in the previous step. To change, go back and pick a different destination.",children:[e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Standalone skill"]})]}),t.standaloneLocked?e.jsxs("p",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:["Lives at ",e.jsxs("code",{style:{fontFamily:"var(--font-mono)",fontSize:11},children:["<project>/skills/","<name>","/SKILL.md"]})," — works with every agent. No plugin selected."]}):e.jsxs(e.Fragment,{children:[t.creatableLayouts.length>1&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.creatableLayouts.map(s=>e.jsx("button",{onClick:()=>{t.setSelectedLayout(s.layout);const o=s.existingPlugins[0];t.setPlugin(o||""),t.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150 whitespace-nowrap",style:{background:t.selectedLayout===s.layout?"var(--accent)":"var(--surface-3)",color:t.selectedLayout===s.layout?"var(--color-paper)":"var(--text-secondary)",border:`1px solid ${t.selectedLayout===s.layout?"var(--accent)":"var(--border-subtle)"}`},children:s.label},s.layout)),!t.creatableLayouts.find(s=>s.layout===3)&&e.jsx("button",{onClick:()=>{t.setSelectedLayout(3),t.setPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150 whitespace-nowrap",style:{background:t.selectedLayout===3?"var(--accent)":"var(--surface-3)",color:t.selectedLayout===3?"var(--color-paper)":"var(--text-secondary)",border:`1px solid ${t.selectedLayout===3?"var(--accent)":"var(--border-subtle)"}`},children:"Root skills/"})]})]}),t.selectedLayout!==3&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),e.jsxs("select",{value:t.plugin,onChange:s=>{t.setPlugin(s.target.value),t.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N,children:[t.availablePlugins.map(s=>e.jsx("option",{value:s,children:s},s)),e.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),t.plugin==="__new__"&&e.jsx("input",{type:"text",value:t.newPlugin,onChange:s=>t.setNewPlugin(P(s.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:N})]})]}),e.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono overflow-x-auto",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)",wordBreak:"break-all",overflowWrap:"anywhere",lineHeight:1.55},children:t.pathPreview})]}),!t.standaloneLocked&&t.showPluginRecommendation&&t.pluginLayoutInfo&&t.selectedLayout===3&&e.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",style:{background:"var(--accent-muted)",color:"var(--text-secondary)",border:"1px solid var(--accent-muted)"},children:[e.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),e.jsxs("span",{children:["Plugins detected (",e.jsx("strong",{children:t.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:t.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"var(--accent)",color:"var(--color-paper)",border:"none",cursor:"pointer"},children:"Use plugin"}),e.jsx("button",{onClick:()=>t.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsxs("div",{className:"glass-card p-5",children:[e.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:["Name ",e.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),e.jsx("input",{type:"text",value:t.name,onChange:s=>t.setName(P(s.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N})]}),e.jsx("div",{className:"mb-4",children:e.jsx(ke,{value:t.version,onChange:t.setVersion,onValidityChange:t.setVersionValid,mode:"create"})}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:["Description ",e.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),e.jsx("textarea",{value:t.description,onChange:s=>t.setDescription(s.target.value),placeholder:"Brief description — used for auto-activation keywords",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...N,minHeight:"72px"}}),e.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"This text is used by Claude to decide when to activate the skill"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Model"}),e.jsxs("select",{value:t.model,onChange:s=>t.setModel(s.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N,children:[e.jsx("option",{value:"",children:"Any (default)"}),e.jsx("option",{value:"opus",children:"Opus"}),e.jsx("option",{value:"sonnet",children:"Sonnet"}),e.jsx("option",{value:"haiku",children:"Haiku"})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),e.jsx("input",{type:"text",value:t.allowedTools,onChange:s=>t.setAllowedTools(s.target.value),placeholder:"Read, Write, Edit, Bash, Glob, Grep",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N})]})]})]}),e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),e.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),e.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(s=>e.jsxs("button",{onClick:()=>t.setBodyViewMode(s),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:t.bodyViewMode===s?"var(--surface-4)":"transparent",color:t.bodyViewMode===s?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:t.bodyViewMode===s?600:400,border:"none",cursor:"pointer"},children:[s==="write"?e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]}):e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),e.jsx("span",{children:s==="write"?"Write":"Preview"})]},s))})]}),t.bodyViewMode==="write"?e.jsx("textarea",{value:t.body,onChange:s=>t.setBody(s.target.value),placeholder:`# /my-skill
|
|
6
6
|
|
|
7
7
|
You are an expert at...
|
|
8
8
|
|
|
@@ -10,4 +10,4 @@ You are an expert at...
|
|
|
10
10
|
|
|
11
11
|
1. First, understand the request
|
|
12
12
|
2. Then, implement the solution
|
|
13
|
-
3. Finally, verify the result`,rows:12,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...
|
|
13
|
+
3. Finally, verify the result`,rows:12,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...N,minHeight:"200px"}}):t.body.trim()?e.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"200px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:ne(t.body)}}):e.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"200px",maxHeight:"400px",overflowY:"auto"},children:e.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),e.jsx(ie,{skillName:t.name||"{skill}",hasEvals:!1,isDraft:t.draftSaved}),t.error&&e.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:t.error}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:t.handleCreate,disabled:t.creating||!t.name||!t.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:t.creating||!t.name||!t.description?"var(--surface-3)":"var(--color-action, #2F5B8E)",color:t.creating||!t.name||!t.description?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:t.creating||!t.name||!t.description?"not-allowed":"pointer",opacity:t.creating?.7:1},children:t.creating?"Creating...":"Create Skill"}),e.jsx(R,{to:"/",className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)"},children:"Cancel"})]})]}),e.jsx("div",{className:"w-full lg:w-[340px] lg:flex-shrink-0 min-w-0",children:e.jsx("div",{className:"lg:sticky lg:top-8",children:e.jsxs("div",{className:"glass-card p-4",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"SKILL.md Preview"}),e.jsx("pre",{className:"text-[11px] font-mono leading-relaxed overflow-auto max-h-[500px] p-3 rounded-lg",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:_})]})})})]})}),i&&e.jsx(Le,{engine:i,onClose:()=>x(null),onSuccess:()=>{t.refreshEngineDetection()}})]})}export{Fe as CreateSkillPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SearchPaletteCore-Dn5gQJS_.js","assets/globals-BRZwPAPF.js","assets/globals-C3oEdsJh.css","assets/skill-url-C4ekwoGs.js","assets/main-D2shn1dH.js","assets/useDesktopBridge-DxVWbYqK.js","assets/fonts-i7Lkz2zN.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as f}from"./useDesktopBridge-DxVWbYqK.js";import{r as t,j as d}from"./globals-BRZwPAPF.js";const l=t.lazy(()=>f(()=>import("./SearchPaletteCore-Dn5gQJS_.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function w(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function y({onSelect:i,onNavigate:u}={}){const[n,o]=t.useState(!1),s=t.useRef(null),a=w();t.useEffect(()=>{function e(){s.current=document.activeElement??null,o(!0)}return window.addEventListener("openFindSkills",e),()=>window.removeEventListener("openFindSkills",e)},[]),t.useEffect(()=>{if(!n)return;function e(r){r.key==="Escape"&&o(!1)}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]),t.useEffect(()=>{if(n)return;const e=s.current;if(e&&typeof e.focus=="function")try{e.focus()}catch{}s.current=null},[n]);const c=t.useCallback((e,r)=>{try{typeof window<"u"&&window.sessionStorage&&window.sessionStorage.setItem("find-skills:last-query",r??"")}catch{}if(o(!1),i)try{i(e,r)}catch{}},[i]);return n?d.jsx("div",{"data-testid":"find-skills-palette-shell","data-reduced-motion":a?"true":"false",children:d.jsx(t.Suspense,{fallback:null,children:d.jsx(l,{initialOpen:!0,onSelect:c,onNavigate:u})})}):null}export{y as FindSkillsPalette,y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,j as l}from"./globals-BRZwPAPF.js";import{u as S,C as P,S as k,F as y,a as C,T as A}from"./preferences-BKv6X7fK.js";/* empty css */import"./useDesktopBridge-DxVWbYqK.js";const L={title:"This is your home directory",body:"Skill Studio shows personal skills here. Pick a specific project subfolder instead."},R={title:"This is a personal-scope folder",body:"Skills under this directory are personal-scope (shared across all your projects). If you meant to open a specific project, pick a project subfolder instead."};function _({kind:a,path:t,onPickAgain:i,onProceed:c,onClose:e}){const d=o.useRef(null),u=o.useRef(null);o.useEffect(()=>{var r;(r=u.current)==null||r.focus()},[]),o.useEffect(()=>{const r=s=>{s.key==="Escape"&&(s.preventDefault(),e())};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[e]);const g=a==="home_root"?L:R,f="folder-picker-warning-title",p="folder-picker-warning-body";return l.jsx("div",{"data-testid":"folder-picker-warning-overlay",role:"presentation",onClick:r=>{r.target===r.currentTarget&&e()},style:E,children:l.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":f,"aria-describedby":p,"data-testid":"folder-picker-warning-dialog","data-kind":a,style:F,children:[l.jsx("h2",{id:f,style:O,children:g.title}),l.jsx("p",{id:p,style:T,children:g.body}),l.jsx("code",{"data-testid":"folder-picker-warning-path",style:z,children:t}),l.jsxs("div",{style:I,children:[l.jsx("button",{ref:u,type:"button","data-testid":"folder-picker-warning-pick-again",onClick:i,style:B,children:"Pick again"}),l.jsx("button",{type:"button","data-testid":"folder-picker-warning-use-anyway",onClick:c,style:N,children:"Use this anyway"})]})]})})}const E={position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},F={background:"var(--color-surface, #ffffff)",color:"var(--color-text, #1a1a1a)",padding:"24px 28px",borderRadius:8,width:"min(480px, 90vw)",boxShadow:"0 20px 50px rgba(0,0,0,0.25)",fontFamily:"var(--font-system, -apple-system, system-ui)"},O={margin:"0 0 12px",fontSize:18,fontWeight:600},T={margin:"0 0 12px",fontSize:14,lineHeight:1.5,color:"var(--color-text-soft, #555)"},z={display:"block",padding:"8px 10px",background:"var(--color-pill-bg, rgba(0,0,0,0.05))",borderRadius:4,fontSize:12,marginBottom:18,wordBreak:"break-all"},I={display:"flex",gap:10,justifyContent:"flex-end"},B={background:"var(--color-accent, #2563eb)",color:"#fff",border:"none",borderRadius:4,padding:"8px 16px",fontSize:14,fontWeight:500,cursor:"pointer"},N={background:"transparent",color:"var(--color-text, #333)",border:"1px solid var(--color-border, #ccc)",borderRadius:4,padding:"8px 16px",fontSize:14,cursor:"pointer"};function U({bridge:a,snapshot:t,onSnapshotChanged:i,pushToast:c}){const{t:e}=S("preferences"),d=!a.available,[u,g]=o.useState((t==null?void 0:t.general.theme)??"system");o.useEffect(()=>{t!=null&&t.general.theme&&g(t.general.theme)},[t==null?void 0:t.general.theme]);const f=o.useCallback(async n=>{g(n);try{await a.setSetting("general.theme",n),await i()}catch{c({message:"Couldn't update theme.",variant:"error"})}},[a,i,c]),p=o.useCallback(async n=>{try{await a.setAutostart(n),await a.setSetting("general.launchAtLogin",n),await i()}catch{c({message:e("general.launchAtLogin.errorAdmin"),variant:"error",actions:[{label:e("general.launchAtLogin.openSettings"),onClick:()=>{}}]}),await i()}},[a,i,c,e]),[r,s]=o.useState(null),m=o.useCallback(async n=>{await a.setSetting("general.defaultProjectFolder",n),await i()},[a,i]),h=o.useCallback(async()=>{try{const n=await a.pickProjectFolder();if(!n)return;const{path:b,classification:x}=n;if(x.kind==="home_root"){s({kind:"home_root",path:b});return}if(x.kind==="personal_scope"){s({kind:"personal_scope",path:b});return}await m(b)}catch{c({message:"Couldn't open folder picker.",variant:"error"})}},[a,m,c]),j=u,w=(t==null?void 0:t.general.launchAtLogin)??!1,v=(t==null?void 0:t.general.defaultProjectFolder)??null;return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:"preferences-content__heading",children:[l.jsx("h1",{children:e("general.heading")}),l.jsx("p",{children:e("general.subheading")})]}),d?l.jsxs(P,{variant:"info",children:[l.jsx("strong",{children:e("common.browserMode")}),l.jsx("span",{children:e("app.browserCallout")}),l.jsx("a",{href:e("app.downloadUrl"),target:"_blank",rel:"noopener noreferrer",children:e("app.downloadLink")})]}):null,l.jsx(k,{title:e("general.theme.label"),children:l.jsx(y,{label:e("general.theme.label"),help:e("general.theme.help"),control:l.jsx(C,{ariaLabel:e("general.theme.label"),value:j,onChange:f,options:[{value:"system",label:e("general.theme.system")},{value:"light",label:e("general.theme.light")},{value:"dark",label:e("general.theme.dark")}]})})}),l.jsxs(k,{title:e("tabs.general"),children:[l.jsx(y,{label:e("general.launchAtLogin.label"),help:e(d?"general.launchAtLogin.browserDisabled":"general.launchAtLogin.help"),control:l.jsx(A,{ariaLabel:e("general.launchAtLogin.label"),checked:w,onChange:p,disabled:d})}),l.jsx(y,{stacked:!0,label:e("general.defaultProject.label"),help:e("general.defaultProject.help"),control:l.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center",marginTop:6},children:[l.jsx("code",{className:"pref-path-display",style:{flex:1},children:v??e("general.defaultProject.notSet")}),l.jsx("button",{type:"button",className:"pref-button",disabled:d,"aria-disabled":d||void 0,onClick:h,children:e("general.defaultProject.choose")})]})}),l.jsx(y,{label:e("general.language.label"),help:e("general.language.help"),control:l.jsx("select",{className:"pref-select",defaultValue:"en","aria-label":e("general.language.label"),children:l.jsx("option",{value:"en",children:e("general.language.english")})})})]}),r?l.jsx(_,{kind:r.kind,path:r.path,onPickAgain:()=>{s(null),h()},onProceed:()=>{const n=r.path;s(null),m(n)},onClose:()=>s(null)}):null]})}export{U as GeneralTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,j as a}from"./globals-BRZwPAPF.js";import{u as h,C as x,S as j,F as n,T as p}from"./preferences-BKv6X7fK.js";/* empty css */import"./useDesktopBridge-DxVWbYqK.js";function E({bridge:l,snapshot:r,onSnapshotChanged:i,pushToast:t}){const{t:e}=h("preferences"),y=!l.available,v=(r==null?void 0:r.privacy.telemetryEnabled)??!1,m=(r==null?void 0:r.privacy.crashReportingEnabled)??!1,o=s.useCallback(async(c,d,g)=>{try{await l.setSetting(c,d),await i()}catch{t({message:`Couldn't update ${g}.`,variant:"error"})}},[l,i,t]),b=s.useCallback(async()=>{try{await l.openLogsFolder()}catch{t({message:"Couldn't open logs folder.",variant:"error"})}},[l,t]);return a.jsxs(a.Fragment,{children:[a.jsxs("header",{className:"preferences-content__heading",children:[a.jsx("h1",{children:e("privacy.heading")}),a.jsx("p",{children:e("privacy.subheading")})]}),a.jsx(x,{variant:"info",children:e("privacy.disclosure")}),a.jsxs(j,{title:e("privacy.heading"),children:[a.jsx(n,{label:e("privacy.telemetry.label"),help:e("privacy.telemetry.help"),control:a.jsx(p,{ariaLabel:e("privacy.telemetry.label"),checked:v,onChange:c=>o("privacy.telemetryEnabled",c,"telemetry")})}),a.jsx(n,{label:e("privacy.crash.label"),help:e("privacy.crash.help"),control:a.jsx(p,{ariaLabel:e("privacy.crash.label"),checked:m,onChange:c=>o("privacy.crashReportingEnabled",c,"crash reporting")})}),y?null:a.jsx(n,{label:e("privacy.openLogs.label"),help:e("privacy.openLogs.help"),control:a.jsx("button",{type:"button",className:"pref-button",onClick:b,children:e("privacy.openLogs.label")})})]})]})}export{E as PrivacyTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as i,j as t,i as xe}from"./index-JaDg6FlU.js";import{a as ye}from"./skill-url-C4ekwoGs.js";/* empty css */function me(a){return a?a.replace(/<(?!\/?b>)[^>]+>/gi,""):""}function be(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Ie(a,p){if(!a)return"";const d=be(a);if(!p)return d;const u=p.trim().split(/\s+/).filter(Boolean);if(u.length===0)return d;const T=u.map(W=>W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),b=new RegExp(`(${T})`,"gi");return d.replace(b,"<b>$1</b>")}function ve(a){return a?a<1e3?String(a):`${(a/1e3).toFixed(1)}k`:""}const ke=[{label:"Security",href:"/skills?category=security"},{label:"Coding",href:"/skills?category=development"},{label:"DevOps",href:"/skills?category=devops"},{label:"Testing",href:"/skills?category=testing"},{label:"Data",href:"/skills?category=data"},{label:"Design",href:"/skills?category=design"}],Se=[{label:"Submit a skill",href:"/submit"},{label:"Browse all skills",href:"/skills"}],J="var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif)",c="var(--font-mono, 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace)";function Ee({tier:a,isTainted:p,isBlocked:d}){const u={display:"inline-flex",alignItems:"center",padding:"1px 6px",height:16,borderRadius:3,fontFamily:c,fontSize:9.5,fontWeight:600,letterSpacing:"0.04em",whiteSpace:"nowrap",lineHeight:1,textTransform:"uppercase"};if(d)return t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":"BLOCKED",style:{...u,color:"#7A1F1F",background:"#FBE8E5",border:"1px solid #E8B7B0"},children:"BLOCKED"});if(p)return t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":"TAINTED",style:{...u,color:"#7A4A00",background:"#FBEFD3",border:"1px solid #E8C885"},children:"Tainted"});const b={CERTIFIED:{color:"var(--color-installed, #2F6A4A)",bg:"rgba(47,106,74,0.08)",border:"rgba(47,106,74,0.25)"},VERIFIED:{color:"var(--color-focus, #3B6EA8)",bg:"rgba(59,110,168,0.08)",border:"rgba(59,110,168,0.25)"},REJECTED:{color:"#7A1F1F",bg:"#FBE8E5",border:"#E8B7B0"},BLOCKED:{color:"#7A1F1F",bg:"#FBE8E5",border:"#E8B7B0"}}[a];return b?t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":a,style:{...u,color:b.color,background:b.bg,border:`1px solid ${b.border}`},children:xe(a)}):null}function O(){return t.jsxs("div",{"data-testid":"skeleton-row",style:{padding:"10px 18px",display:"flex",alignItems:"center",gap:10},children:[t.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[t.jsx("div",{style:{height:12,width:"32%",borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite"}}),t.jsx("div",{style:{height:9,width:"55%",borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite",animationDelay:"0.18s"}})]}),t.jsx("div",{style:{height:14,width:52,borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite",animationDelay:"0.36s"}})]})}function Fe(a){var d,u;const p=(d=a.target)==null?void 0:d.tagName;return!!(p==="INPUT"||p==="TEXTAREA"||p==="SELECT"||(u=a.target)!=null&&u.isContentEditable)}const je="/api/v1/studio/search",we="/api/v1/stats",Ae="/api/v1/studio/telemetry/search-select",Re=10,Q=20,Ce=150;function Be({onSelect:a,onNavigate:p,searchUrl:d=je,trendingUrl:u=we,telemetrySelectUrl:T=Ae,maxPages:b=Re,initialOpen:W=!1}={}){const[L,E]=i.useState(W),[o,F]=i.useState(""),[I,h]=i.useState([]),[U,v]=i.useState(0),[j,B]=i.useState(!1),[_,w]=i.useState(1),[H,x]=i.useState(!1),[M,V]=i.useState(!1),[$,k]=i.useState(null),[A,R]=i.useState(!1),Z=i.useRef(null),N=i.useRef(null),z=i.useRef(!1),ee=i.useRef(null),te=i.useRef(null),q=i.useRef(new Map),S=i.useRef(null),[,ue]=i.useState(!1),re=i.useMemo(()=>typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform||""),[]),K=i.useRef(o);i.useEffect(()=>{K.current=o},[o]),i.useEffect(()=>{S.current||fetch(u).then(e=>e.json()).then(e=>{S.current=e.trendingSkills??[],ue(!0)}).catch(()=>{})},[u]),i.useEffect(()=>{const e=r=>{if(r.key==="Escape"){E(!1);return}if(L&&(r.metaKey||r.ctrlKey)&&/^[1-9]$/.test(r.key)){r.preventDefault();const s=Number(r.key)-1;v(s),window.dispatchEvent(new CustomEvent("findSkillsActivateAt",{detail:{index:s}}));return}!r.metaKey&&!r.ctrlKey&&!r.altKey&&r.key.length===1&&!Fe(r)&&(z.current=!0,F(r.key),E(!0))},n=r=>{var y;const l=(y=r.detail)==null?void 0:y.query;l&&(z.current=!0,F(l)),E(!0)};return window.addEventListener("keydown",e),window.addEventListener("openFindSkills",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("openFindSkills",n)}},[L]),i.useLayoutEffect(()=>{var n;if(!L){(n=N.current)==null||n.abort();return}if(z.current)z.current=!1,h([]),v(0),w(1),x(!1),B(!1),k(null),R(!1);else{const r=(()=>{var s;try{return((s=window.sessionStorage)==null?void 0:s.getItem("find-skills:last-query"))??""}catch{return""}})();F(r),h([]),v(0),w(1),x(!1),B(!1),k(null),R(!1)}const e=Z.current;if(e){e.focus({preventScroll:!0});const r=e.value.length;e.setSelectionRange(r,r)}},[L]),i.useEffect(()=>{if(!o.trim()||o.trim().length<2){h([]),x(!1),w(1),k(null);return}const e=6e4,n=o.trim().toLowerCase(),r=q.current.get(n);if(r&&Date.now()-r.timestamp<e){h(r.results),x(r.hasMore),w(1),B(!1),k(null),fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=1`).then(m=>m.ok?m.json():null).then(m=>{var g;m&&q.current.set(n,{results:m.results||[],hasMore:((g=m.pagination)==null?void 0:g.hasMore)??!1,timestamp:Date.now()})}).catch(()=>{});return}B(!0),k(null);const l=new AbortController,y=setTimeout(async()=>{var m;try{const g=await fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=1`,{signal:l.signal});if(g.status>=500){R(!0),h([]),x(!1),k(null);return}if(!g.ok){h([]),x(!1),k(`search failed (${g.status})`);return}const ce=await g.json(),de=ce.results||[],pe=((m=ce.pagination)==null?void 0:m.hasMore)??!1;h(de),x(pe),w(1),R(!1),q.current.set(n,{results:de,hasMore:pe,timestamp:Date.now()})}catch(g){if(g instanceof DOMException&&g.name==="AbortError")return;R(!0),h([]),x(!1),k(null)}finally{l.signal.aborted||B(!1)}},Ce);return()=>{clearTimeout(y),l.abort()}},[o,d]);const C=_>=b,ne=i.useCallback(async()=>{var n,r;if(M||C)return;const e=_+1;V(!0),N.current=new AbortController;try{const s=await fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=${e}`,{signal:N.current.signal});if(!s.ok)return;const l=await s.json();h(y=>[...y,...l.results||[]]),x(((n=l.pagination)==null?void 0:n.hasMore)??!1),w(e)}catch(s){if(s instanceof DOMException&&s.name==="AbortError")return}finally{(r=N.current)!=null&&r.signal.aborted||V(!1)}},[_,o,M,C,d]);i.useEffect(()=>{const e=ee.current,n=te.current;if(!e||!n||typeof IntersectionObserver>"u")return;const r=new IntersectionObserver(s=>{s[0].isIntersecting&&H&&!j&&!M&&!C&&ne()},{root:n,rootMargin:"100px"});return r.observe(e),()=>r.disconnect()},[H,j,M,C,ne]);const P=e=>({name:e.name,displayName:e.displayName,author:e.author,repoUrl:e.repoUrl,certTier:e.certTier,githubStars:0,highlight:"",category:"",ownerSlug:e.ownerSlug,repoSlug:e.repoSlug,skillSlug:e.skillSlug}),G=(()=>{const e=o.trim();if(A&&e.length>=1&&S.current){const n=e.toLowerCase();return S.current.filter(r=>r.name.toLowerCase().includes(n)||(r.displayName??"").toLowerCase().includes(n)).slice(0,30).map(P)}if(e.length>=2)return I;if(e.length===1&&S.current){const n=e.toLowerCase();return S.current.filter(r=>r.name.toLowerCase().startsWith(n)||r.displayName.toLowerCase().startsWith(n)).slice(0,10).map(P)}return e.length===0&&S.current?S.current.slice(0,10).map(P):[]})(),f=[...G.map(e=>{const n=e.skillSlug||e.name.split("/").pop()||e.name,r=e.ownerSlug&&e.repoSlug?`${e.ownerSlug}/${e.repoSlug}`:e.author;return{type:"skill",label:n,publisher:r,name:e.name,command:e.command?e.pluginName?`${e.pluginName}:${e.command}`:e.command:void 0,pluginName:e.pluginName||void 0,meta:e.category||"",certTier:e.certTier,isTainted:e.isTainted,isBlocked:e.isBlocked,repoUrl:e.repoUrl,highlight:e.highlight,githubStars:e.githubStars,category:e.category,href:ye(e.name),sourceResult:e}}),...!o&&G.length===0?ke.map(e=>({type:"category",label:e.label,publisher:"",name:"",meta:"",certTier:"",repoUrl:"",href:e.href})):[],...!o&&G.length===0?Se.map(e=>({type:"action",label:e.label,publisher:"",name:"",meta:"",certTier:"",repoUrl:"",href:e.href})):[]],ie=i.useCallback(e=>{try{fetch(T,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({skillName:e,q:K.current.trim(),ts:Date.now()}),keepalive:!0}).catch(()=>{})}catch{}},[T]),D=i.useCallback((e,n)=>{if(n&&(ie(n.name),a))try{a(n,K.current.trim())}catch{}if(E(!1),p)try{p(e)}catch{}},[a,p,ie]);i.useEffect(()=>{function e(n){var l;const r=((l=n.detail)==null?void 0:l.index)??-1,s=f[r];s&&D(s.href,s.type==="skill"?s.sourceResult:void 0)}return window.addEventListener("findSkillsActivateAt",e),()=>window.removeEventListener("findSkillsActivateAt",e)},[f,D]);const fe=e=>{if(e.key==="ArrowDown")e.preventDefault(),v(n=>Math.min(n+1,f.length-1));else if(e.key==="ArrowUp")e.preventDefault(),v(n=>Math.max(n-1,0));else if(e.key==="Enter"&&f[U]){const n=f[U];D(n.href,n.type==="skill"?n.sourceResult:void 0)}};if(!L)return null;let ae="";const se=!j&&!$&&!A&&o.trim().length>=2&&I.length===0,Y=j&&I.length===0&&o.trim().length>=2&&!A,oe=o.trim(),le=()=>{R(!1);const e=o;F(""),setTimeout(()=>F(e),0)},ge={position:"fixed",inset:0,background:"color-mix(in srgb, var(--color-ink, #191919) 35%, transparent)",backdropFilter:"blur(6px) saturate(1.1)",WebkitBackdropFilter:"blur(6px) saturate(1.1)"},he={position:"relative",width:"100%",maxWidth:640,margin:"0 16px",background:"var(--bg-surface, #FFFFFF)",color:"var(--text-primary, #191919)",borderRadius:12,border:"1px solid var(--color-rule, #E8E1D6)",boxShadow:"0 1px 0 rgba(255,255,255,0.6) inset,0 24px 60px -12px rgba(25,20,15,0.28),0 12px 24px -8px rgba(25,20,15,0.18)",overflow:"hidden",fontFamily:J};return t.jsxs("div",{"data-testid":"find-skills-palette",role:"dialog","aria-modal":"true","aria-label":"Find verified skills",style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"min(18vh, 144px)"},onClick:()=>E(!1),children:[t.jsx("div",{style:ge}),t.jsx("style",{children:`
|
|
1
|
+
import{r as i,j as t}from"./globals-BRZwPAPF.js";import{a as xe}from"./skill-url-C4ekwoGs.js";import{h as ye}from"./main-D2shn1dH.js";import"./useDesktopBridge-DxVWbYqK.js";/* empty css */function me(a){return a?a.replace(/<(?!\/?b>)[^>]+>/gi,""):""}function be(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Me(a,p){if(!a)return"";const d=be(a);if(!p)return d;const u=p.trim().split(/\s+/).filter(Boolean);if(u.length===0)return d;const T=u.map(W=>W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),b=new RegExp(`(${T})`,"gi");return d.replace(b,"<b>$1</b>")}function ve(a){return a?a<1e3?String(a):`${(a/1e3).toFixed(1)}k`:""}const ke=[{label:"Security",href:"/skills?category=security"},{label:"Coding",href:"/skills?category=development"},{label:"DevOps",href:"/skills?category=devops"},{label:"Testing",href:"/skills?category=testing"},{label:"Data",href:"/skills?category=data"},{label:"Design",href:"/skills?category=design"}],Se=[{label:"Submit a skill",href:"/submit"},{label:"Browse all skills",href:"/skills"}],J="var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif)",c="var(--font-mono, 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace)";function Ee({tier:a,isTainted:p,isBlocked:d}){const u={display:"inline-flex",alignItems:"center",padding:"1px 6px",height:16,borderRadius:3,fontFamily:c,fontSize:9.5,fontWeight:600,letterSpacing:"0.04em",whiteSpace:"nowrap",lineHeight:1,textTransform:"uppercase"};if(d)return t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":"BLOCKED",style:{...u,color:"#7A1F1F",background:"#FBE8E5",border:"1px solid #E8B7B0"},children:"BLOCKED"});if(p)return t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":"TAINTED",style:{...u,color:"#7A4A00",background:"#FBEFD3",border:"1px solid #E8C885"},children:"Tainted"});const b={CERTIFIED:{color:"var(--color-installed, #2F6A4A)",bg:"rgba(47,106,74,0.08)",border:"rgba(47,106,74,0.25)"},VERIFIED:{color:"var(--color-focus, #3B6EA8)",bg:"rgba(59,110,168,0.08)",border:"rgba(59,110,168,0.25)"},REJECTED:{color:"#7A1F1F",bg:"#FBE8E5",border:"#E8B7B0"},BLOCKED:{color:"#7A1F1F",bg:"#FBE8E5",border:"#E8B7B0"}}[a];return b?t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":a,style:{...u,color:b.color,background:b.bg,border:`1px solid ${b.border}`},children:ye(a)}):null}function O(){return t.jsxs("div",{"data-testid":"skeleton-row",style:{padding:"10px 18px",display:"flex",alignItems:"center",gap:10},children:[t.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[t.jsx("div",{style:{height:12,width:"32%",borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite"}}),t.jsx("div",{style:{height:9,width:"55%",borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite",animationDelay:"0.18s"}})]}),t.jsx("div",{style:{height:14,width:52,borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite",animationDelay:"0.36s"}})]})}function Fe(a){var d,u;const p=(d=a.target)==null?void 0:d.tagName;return!!(p==="INPUT"||p==="TEXTAREA"||p==="SELECT"||(u=a.target)!=null&&u.isContentEditable)}const je="/api/v1/studio/search",we="/api/v1/stats",Ae="/api/v1/studio/telemetry/search-select",Re=10,Q=20,Ce=150;function $e({onSelect:a,onNavigate:p,searchUrl:d=je,trendingUrl:u=we,telemetrySelectUrl:T=Ae,maxPages:b=Re,initialOpen:W=!1}={}){const[L,E]=i.useState(W),[o,F]=i.useState(""),[I,h]=i.useState([]),[U,v]=i.useState(0),[j,B]=i.useState(!1),[_,w]=i.useState(1),[H,x]=i.useState(!1),[M,V]=i.useState(!1),[$,k]=i.useState(null),[A,R]=i.useState(!1),Z=i.useRef(null),N=i.useRef(null),z=i.useRef(!1),ee=i.useRef(null),te=i.useRef(null),q=i.useRef(new Map),S=i.useRef(null),[,ue]=i.useState(!1),re=i.useMemo(()=>typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform||""),[]),K=i.useRef(o);i.useEffect(()=>{K.current=o},[o]),i.useEffect(()=>{S.current||fetch(u).then(e=>e.json()).then(e=>{S.current=e.trendingSkills??[],ue(!0)}).catch(()=>{})},[u]),i.useEffect(()=>{const e=r=>{if(r.key==="Escape"){E(!1);return}if(L&&(r.metaKey||r.ctrlKey)&&/^[1-9]$/.test(r.key)){r.preventDefault();const s=Number(r.key)-1;v(s),window.dispatchEvent(new CustomEvent("findSkillsActivateAt",{detail:{index:s}}));return}!r.metaKey&&!r.ctrlKey&&!r.altKey&&r.key.length===1&&!Fe(r)&&(z.current=!0,F(r.key),E(!0))},n=r=>{var y;const l=(y=r.detail)==null?void 0:y.query;l&&(z.current=!0,F(l)),E(!0)};return window.addEventListener("keydown",e),window.addEventListener("openFindSkills",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("openFindSkills",n)}},[L]),i.useLayoutEffect(()=>{var n;if(!L){(n=N.current)==null||n.abort();return}if(z.current)z.current=!1,h([]),v(0),w(1),x(!1),B(!1),k(null),R(!1);else{const r=(()=>{var s;try{return((s=window.sessionStorage)==null?void 0:s.getItem("find-skills:last-query"))??""}catch{return""}})();F(r),h([]),v(0),w(1),x(!1),B(!1),k(null),R(!1)}const e=Z.current;if(e){e.focus({preventScroll:!0});const r=e.value.length;e.setSelectionRange(r,r)}},[L]),i.useEffect(()=>{if(!o.trim()||o.trim().length<2){h([]),x(!1),w(1),k(null);return}const e=6e4,n=o.trim().toLowerCase(),r=q.current.get(n);if(r&&Date.now()-r.timestamp<e){h(r.results),x(r.hasMore),w(1),B(!1),k(null),fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=1`).then(m=>m.ok?m.json():null).then(m=>{var g;m&&q.current.set(n,{results:m.results||[],hasMore:((g=m.pagination)==null?void 0:g.hasMore)??!1,timestamp:Date.now()})}).catch(()=>{});return}B(!0),k(null);const l=new AbortController,y=setTimeout(async()=>{var m;try{const g=await fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=1`,{signal:l.signal});if(g.status>=500){R(!0),h([]),x(!1),k(null);return}if(!g.ok){h([]),x(!1),k(`search failed (${g.status})`);return}const ce=await g.json(),de=ce.results||[],pe=((m=ce.pagination)==null?void 0:m.hasMore)??!1;h(de),x(pe),w(1),R(!1),q.current.set(n,{results:de,hasMore:pe,timestamp:Date.now()})}catch(g){if(g instanceof DOMException&&g.name==="AbortError")return;R(!0),h([]),x(!1),k(null)}finally{l.signal.aborted||B(!1)}},Ce);return()=>{clearTimeout(y),l.abort()}},[o,d]);const C=_>=b,ne=i.useCallback(async()=>{var n,r;if(M||C)return;const e=_+1;V(!0),N.current=new AbortController;try{const s=await fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=${e}`,{signal:N.current.signal});if(!s.ok)return;const l=await s.json();h(y=>[...y,...l.results||[]]),x(((n=l.pagination)==null?void 0:n.hasMore)??!1),w(e)}catch(s){if(s instanceof DOMException&&s.name==="AbortError")return}finally{(r=N.current)!=null&&r.signal.aborted||V(!1)}},[_,o,M,C,d]);i.useEffect(()=>{const e=ee.current,n=te.current;if(!e||!n||typeof IntersectionObserver>"u")return;const r=new IntersectionObserver(s=>{s[0].isIntersecting&&H&&!j&&!M&&!C&&ne()},{root:n,rootMargin:"100px"});return r.observe(e),()=>r.disconnect()},[H,j,M,C,ne]);const P=e=>({name:e.name,displayName:e.displayName,author:e.author,repoUrl:e.repoUrl,certTier:e.certTier,githubStars:0,highlight:"",category:"",ownerSlug:e.ownerSlug,repoSlug:e.repoSlug,skillSlug:e.skillSlug}),G=(()=>{const e=o.trim();if(A&&e.length>=1&&S.current){const n=e.toLowerCase();return S.current.filter(r=>r.name.toLowerCase().includes(n)||(r.displayName??"").toLowerCase().includes(n)).slice(0,30).map(P)}if(e.length>=2)return I;if(e.length===1&&S.current){const n=e.toLowerCase();return S.current.filter(r=>r.name.toLowerCase().startsWith(n)||r.displayName.toLowerCase().startsWith(n)).slice(0,10).map(P)}return e.length===0&&S.current?S.current.slice(0,10).map(P):[]})(),f=[...G.map(e=>{const n=e.skillSlug||e.name.split("/").pop()||e.name,r=e.ownerSlug&&e.repoSlug?`${e.ownerSlug}/${e.repoSlug}`:e.author;return{type:"skill",label:n,publisher:r,name:e.name,command:e.command?e.pluginName?`${e.pluginName}:${e.command}`:e.command:void 0,pluginName:e.pluginName||void 0,meta:e.category||"",certTier:e.certTier,isTainted:e.isTainted,isBlocked:e.isBlocked,repoUrl:e.repoUrl,highlight:e.highlight,githubStars:e.githubStars,category:e.category,href:xe(e.name),sourceResult:e}}),...!o&&G.length===0?ke.map(e=>({type:"category",label:e.label,publisher:"",name:"",meta:"",certTier:"",repoUrl:"",href:e.href})):[],...!o&&G.length===0?Se.map(e=>({type:"action",label:e.label,publisher:"",name:"",meta:"",certTier:"",repoUrl:"",href:e.href})):[]],ie=i.useCallback(e=>{try{fetch(T,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({skillName:e,q:K.current.trim(),ts:Date.now()}),keepalive:!0}).catch(()=>{})}catch{}},[T]),D=i.useCallback((e,n)=>{if(n&&(ie(n.name),a))try{a(n,K.current.trim())}catch{}if(E(!1),p)try{p(e)}catch{}},[a,p,ie]);i.useEffect(()=>{function e(n){var l;const r=((l=n.detail)==null?void 0:l.index)??-1,s=f[r];s&&D(s.href,s.type==="skill"?s.sourceResult:void 0)}return window.addEventListener("findSkillsActivateAt",e),()=>window.removeEventListener("findSkillsActivateAt",e)},[f,D]);const fe=e=>{if(e.key==="ArrowDown")e.preventDefault(),v(n=>Math.min(n+1,f.length-1));else if(e.key==="ArrowUp")e.preventDefault(),v(n=>Math.max(n-1,0));else if(e.key==="Enter"&&f[U]){const n=f[U];D(n.href,n.type==="skill"?n.sourceResult:void 0)}};if(!L)return null;let ae="";const se=!j&&!$&&!A&&o.trim().length>=2&&I.length===0,Y=j&&I.length===0&&o.trim().length>=2&&!A,oe=o.trim(),le=()=>{R(!1);const e=o;F(""),setTimeout(()=>F(e),0)},ge={position:"fixed",inset:0,background:"color-mix(in srgb, var(--color-ink, #191919) 35%, transparent)",backdropFilter:"blur(6px) saturate(1.1)",WebkitBackdropFilter:"blur(6px) saturate(1.1)"},he={position:"relative",width:"100%",maxWidth:640,margin:"0 16px",background:"var(--bg-surface, #FFFFFF)",color:"var(--text-primary, #191919)",borderRadius:12,border:"1px solid var(--color-rule, #E8E1D6)",boxShadow:"0 1px 0 rgba(255,255,255,0.6) inset,0 24px 60px -12px rgba(25,20,15,0.28),0 12px 24px -8px rgba(25,20,15,0.18)",overflow:"hidden",fontFamily:J};return t.jsxs("div",{"data-testid":"find-skills-palette",role:"dialog","aria-modal":"true","aria-label":"Find verified skills",style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"min(18vh, 144px)"},onClick:()=>E(!1),children:[t.jsx("div",{style:ge}),t.jsx("style",{children:`
|
|
2
2
|
@keyframes fsp-pulse {
|
|
3
3
|
0%, 100% { opacity: 1; }
|
|
4
4
|
50% { opacity: 0.45; }
|
|
@@ -11,4 +11,4 @@ import{r as i,j as t,i as xe}from"./index-JaDg6FlU.js";import{a as ye}from"./ski
|
|
|
11
11
|
.fsp-rise { animation: none !important; }
|
|
12
12
|
[data-testid="skeleton-row"] > div { animation: none !important; }
|
|
13
13
|
}
|
|
14
|
-
`}),t.jsxs("div",{className:"fsp-rise",style:{...he,animation:"fsp-rise 180ms cubic-bezier(0.2, 0, 0, 1)"},onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 18px",borderBottom:"1px solid var(--color-rule, #E8E1D6)",background:"linear-gradient(180deg, var(--bg-surface, #FFFFFF) 0%, color-mix(in srgb, var(--bg-surface, #FFFFFF) 96%, var(--color-accent, #D4A27F) 4%) 100%)"},children:[t.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,marginRight:10,color:"var(--color-accent-ink, #7A4A24)"},children:t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("circle",{cx:"7",cy:"7",r:"4.5"}),t.jsx("path",{d:"m13.5 13.5-3.2-3.2"})]})}),t.jsx("input",{ref:Z,value:o,onChange:e=>{F(e.target.value),v(0)},onKeyDown:fe,placeholder:"Search verified skills…",role:"combobox","aria-expanded":"true","aria-controls":"find-skills-listbox","aria-autocomplete":"list",autoFocus:!0,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",style:{flex:1,border:"none",outline:"none",padding:"16px 0",fontFamily:J,fontSize:16,fontWeight:400,letterSpacing:"-0.005em",background:"transparent",color:"var(--text-primary, #191919)",minWidth:0}}),j&&t.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",marginRight:10,color:"var(--text-secondary, #5A5651)"},children:t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:[t.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.4",fill:"none",opacity:"0.25"}),t.jsx("path",{d:"M12.5 7a5.5 5.5 0 0 0-5.5-5.5",stroke:"currentColor",strokeWidth:"1.4",fill:"none",strokeLinecap:"round",children:t.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 7 7",to:"360 7 7",dur:"0.7s",repeatCount:"indefinite"})})]})}),t.jsx("kbd",{style:{fontFamily:c,fontSize:10.5,fontWeight:500,color:"var(--text-secondary, #5A5651)",border:"1px solid var(--color-rule, #E8E1D6)",borderRadius:4,padding:"2px 6px",background:"var(--bg-canvas, #FBF8F3)"},children:"Esc"})]}),A&&t.jsxs("div",{"data-testid":"search-degraded-banner",role:"status",style:{display:"flex",alignItems:"center",gap:10,padding:"8px 18px",fontFamily:c,fontSize:11.5,color:"var(--color-accent-ink, #7A4A24)",background:"color-mix(in srgb, var(--color-accent, #D4A27F) 12%, transparent)",borderBottom:"1px solid color-mix(in srgb, var(--color-accent, #D4A27F) 30%, transparent)"},children:[t.jsx("span",{"aria-hidden":"true",children:"◐"}),t.jsx("span",{style:{flex:1},children:"Live search is offline — showing trending matches"}),t.jsx("button",{"data-testid":"search-retry",onClick:le,style:{fontFamily:c,fontSize:10.5,padding:"3px 8px",borderRadius:3,border:"1px solid var(--color-accent, #D4A27F)",background:"transparent",color:"var(--color-accent-ink, #7A4A24)",cursor:"pointer"},children:"Retry"})]}),t.jsxs("div",{ref:te,role:"listbox",id:"find-skills-listbox",style:{maxHeight:"min(56vh, 432px)",overflowY:"auto",padding:"6px 0"},children:[Y&&t.jsxs(t.Fragment,{children:[t.jsx(O,{}),t.jsx(O,{}),t.jsx(O,{}),t.jsx(O,{})]}),$&&!A&&t.jsxs("div",{"data-testid":"search-error",style:{padding:"20px 18px",textAlign:"center",fontFamily:c,fontSize:12.5,color:"var(--color-ink-muted, #5A5651)"},children:[t.jsx("div",{style:{marginBottom:8},children:$}),t.jsx("button",{"data-testid":"search-retry",onClick:le,style:{fontFamily:c,fontSize:11,padding:"4px 10px",borderRadius:4,border:"1px solid var(--color-rule, #E8E1D6)",background:"transparent",color:"var(--text-primary, #191919)",cursor:"pointer"},children:"Retry"})]}),se&&t.jsxs("div",{style:{padding:"28px 18px",textAlign:"center"},children:[t.jsxs("div",{style:{fontFamily:J,fontSize:13,color:"var(--text-secondary, #5A5651)",marginBottom:6},children:["No matches for ",t.jsxs("span",{style:{color:"var(--text-primary, #191919)",fontFamily:c},children:['"',oe,'"']})]}),t.jsx("a",{href:"/skills",style:{fontFamily:c,fontSize:12,color:"var(--color-action, #2F5B8E)",textDecoration:"none",borderBottom:"1px solid currentColor",paddingBottom:1},onClick:e=>{e.preventDefault(),D("/skills")},children:"Browse by category →"})]}),!Y&&f.length===0&&!se&&!$&&t.jsx("div",{style:{padding:"20px 18px",textAlign:"center",fontFamily:c,fontSize:11.5,color:"var(--text-secondary, #5A5651)"},children:"Loading trending…"}),!Y&&f.map((e,n)=>{const r=e.type==="skill"?A?"TRENDING (FILTERED)":oe.length>=2?"RESULTS":"TRENDING":e.type==="category"?"CATEGORIES":"ACTIONS",s=r!==ae;s&&(ae=r);const l=n===U,y=n<9?`${re?"⌘":"Ctrl"} ${n+1}`:"";return t.jsxs("div",{children:[s&&t.jsx("div",{style:{padding:"10px 18px 4px",fontFamily:c,fontSize:9.5,fontWeight:600,color:"var(--text-secondary, #5A5651)",letterSpacing:"0.12em",textTransform:"uppercase"},children:r}),e.type==="skill"?t.jsxs("div",{role:"option","aria-selected":l,onClick:()=>D(e.href,e.sourceResult),onMouseEnter:()=>v(n),style:{position:"relative",padding:"8px 18px 8px 22px",cursor:"pointer",display:"flex",alignItems:"center",gap:12,background:l?"color-mix(in srgb, var(--color-accent, #D4A27F) 8%, transparent)":"transparent",transition:"background 120ms ease"},children:[l&&t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:6,bottom:6,width:3,background:"var(--color-accent, #D4A27F)",borderRadius:"0 2px 2px 0"}}),t.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:2},children:[t.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[t.jsx("span",{style:{fontFamily:c,fontSize:13,fontWeight:600,color:"var(--text-primary, #191919)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:e.label}),e.pluginName&&t.jsx("span",{style:{fontSize:9.5,padding:"1px 5px",borderRadius:3,color:"var(--color-action, #2F5B8E)",background:"rgba(47,91,142,0.08)",border:"1px solid rgba(47,91,142,0.22)",whiteSpace:"nowrap",flexShrink:0,fontFamily:c},children:e.pluginName})]}),t.jsxs("div",{style:{fontSize:11,color:"var(--text-secondary, #5A5651)",fontFamily:c,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",opacity:.85},children:[e.publisher,e.highlight&&t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{margin:"0 6px",opacity:.5},children:"·"}),t.jsx("span",{"data-testid":"search-highlight",dangerouslySetInnerHTML:{__html:me(e.highlight)}})]})]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.githubStars!=null&&e.githubStars>0&&t.jsxs("span",{"data-testid":"star-count",style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:10.5,fontFamily:c,color:"var(--text-secondary, #5A5651)",whiteSpace:"nowrap"},children:[t.jsx("svg",{width:10,height:10,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25z"})}),ve(e.githubStars)]}),t.jsx(Ee,{tier:e.certTier,isTainted:e.isTainted,isBlocked:e.isBlocked}),l&&y&&t.jsx("span",{"aria-hidden":"true",style:{fontFamily:c,fontSize:9.5,color:"var(--text-secondary, #5A5651)",padding:"1px 5px",borderRadius:3,border:"1px solid var(--color-rule, #E8E1D6)",whiteSpace:"nowrap"},children:y})]})]}):t.jsxs("div",{role:"option","aria-selected":l,onClick:()=>D(e.href),onMouseEnter:()=>v(n),style:{position:"relative",padding:"7px 18px 7px 22px",cursor:"pointer",background:l?"color-mix(in srgb, var(--color-accent, #D4A27F) 8%, transparent)":"transparent",fontFamily:c,fontSize:12.5,color:"var(--text-primary, #191919)"},children:[l&&t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:4,bottom:4,width:3,background:"var(--color-accent, #D4A27F)",borderRadius:"0 2px 2px 0"}}),e.label]})]},`${e.type}-${e.name||e.label}`)}),H&&!j&&I.length>0&&!C&&t.jsx("div",{ref:ee,"data-testid":"scroll-sentinel",style:{padding:"8px 18px",textAlign:"center"},children:M&&t.jsx("span",{style:{fontFamily:c,fontSize:11,color:"var(--text-secondary, #5A5651)"},children:"Loading…"})}),C&&I.length>0&&t.jsx("div",{"data-testid":"hard-cap-link",style:{padding:"12px 18px",textAlign:"center",fontFamily:c,fontSize:11.5},children:t.jsx("a",{href:`https://verified-skill.com/skills?q=${encodeURIComponent(o.trim())}`,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--color-action, #2F5B8E)",textDecoration:"none"},children:"See all results on verified-skill.com →"})})]}),t.jsxs("div",{"data-testid":"palette-footer",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 18px",borderTop:"1px solid var(--color-rule, #E8E1D6)",background:"var(--bg-canvas, #FBF8F3)",fontFamily:c,fontSize:10.5,color:"var(--text-secondary, #5A5651)"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[t.jsx(X,{keys:["↑","↓"],label:"navigate"}),t.jsx(X,{keys:["↵"],label:"open"}),t.jsx(X,{keys:[re?"⌘":"Ctrl","1-9"],label:"jump"})]}),t.jsx("div",{style:{display:"flex",alignItems:"center",gap:6},children:t.jsx("span",{style:{opacity:.7},children:f.length>0?`${f.length} ${f.length===1?"result":"results"}`:""})})]})]})]})}function X({keys:a,label:p}){return t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:2},children:a.map((d,u)=>t.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:16,height:16,padding:"0 4px",fontFamily:c,fontSize:10,fontWeight:500,color:"var(--text-secondary, #5A5651)",background:"var(--bg-surface, #FFFFFF)",border:"1px solid var(--color-rule, #E8E1D6)",borderRadius:3,lineHeight:1},children:d},u))}),t.jsx("span",{children:p})]})}export{Be as default,ve as formatStarCount,Ie as highlightMatches};
|
|
14
|
+
`}),t.jsxs("div",{className:"fsp-rise",style:{...he,animation:"fsp-rise 180ms cubic-bezier(0.2, 0, 0, 1)"},onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 18px",borderBottom:"1px solid var(--color-rule, #E8E1D6)",background:"linear-gradient(180deg, var(--bg-surface, #FFFFFF) 0%, color-mix(in srgb, var(--bg-surface, #FFFFFF) 96%, var(--color-accent, #D4A27F) 4%) 100%)"},children:[t.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,marginRight:10,color:"var(--color-accent-ink, #7A4A24)"},children:t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("circle",{cx:"7",cy:"7",r:"4.5"}),t.jsx("path",{d:"m13.5 13.5-3.2-3.2"})]})}),t.jsx("input",{ref:Z,value:o,onChange:e=>{F(e.target.value),v(0)},onKeyDown:fe,placeholder:"Search verified skills…",role:"combobox","aria-expanded":"true","aria-controls":"find-skills-listbox","aria-autocomplete":"list",autoFocus:!0,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",style:{flex:1,border:"none",outline:"none",padding:"16px 0",fontFamily:J,fontSize:16,fontWeight:400,letterSpacing:"-0.005em",background:"transparent",color:"var(--text-primary, #191919)",minWidth:0}}),j&&t.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",marginRight:10,color:"var(--text-secondary, #5A5651)"},children:t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:[t.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.4",fill:"none",opacity:"0.25"}),t.jsx("path",{d:"M12.5 7a5.5 5.5 0 0 0-5.5-5.5",stroke:"currentColor",strokeWidth:"1.4",fill:"none",strokeLinecap:"round",children:t.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 7 7",to:"360 7 7",dur:"0.7s",repeatCount:"indefinite"})})]})}),t.jsx("kbd",{style:{fontFamily:c,fontSize:10.5,fontWeight:500,color:"var(--text-secondary, #5A5651)",border:"1px solid var(--color-rule, #E8E1D6)",borderRadius:4,padding:"2px 6px",background:"var(--bg-canvas, #FBF8F3)"},children:"Esc"})]}),A&&t.jsxs("div",{"data-testid":"search-degraded-banner",role:"status",style:{display:"flex",alignItems:"center",gap:10,padding:"8px 18px",fontFamily:c,fontSize:11.5,color:"var(--color-accent-ink, #7A4A24)",background:"color-mix(in srgb, var(--color-accent, #D4A27F) 12%, transparent)",borderBottom:"1px solid color-mix(in srgb, var(--color-accent, #D4A27F) 30%, transparent)"},children:[t.jsx("span",{"aria-hidden":"true",children:"◐"}),t.jsx("span",{style:{flex:1},children:"Live search is offline — showing trending matches"}),t.jsx("button",{"data-testid":"search-retry",onClick:le,style:{fontFamily:c,fontSize:10.5,padding:"3px 8px",borderRadius:3,border:"1px solid var(--color-accent, #D4A27F)",background:"transparent",color:"var(--color-accent-ink, #7A4A24)",cursor:"pointer"},children:"Retry"})]}),t.jsxs("div",{ref:te,role:"listbox",id:"find-skills-listbox",style:{maxHeight:"min(56vh, 432px)",overflowY:"auto",padding:"6px 0"},children:[Y&&t.jsxs(t.Fragment,{children:[t.jsx(O,{}),t.jsx(O,{}),t.jsx(O,{}),t.jsx(O,{})]}),$&&!A&&t.jsxs("div",{"data-testid":"search-error",style:{padding:"20px 18px",textAlign:"center",fontFamily:c,fontSize:12.5,color:"var(--color-ink-muted, #5A5651)"},children:[t.jsx("div",{style:{marginBottom:8},children:$}),t.jsx("button",{"data-testid":"search-retry",onClick:le,style:{fontFamily:c,fontSize:11,padding:"4px 10px",borderRadius:4,border:"1px solid var(--color-rule, #E8E1D6)",background:"transparent",color:"var(--text-primary, #191919)",cursor:"pointer"},children:"Retry"})]}),se&&t.jsxs("div",{style:{padding:"28px 18px",textAlign:"center"},children:[t.jsxs("div",{style:{fontFamily:J,fontSize:13,color:"var(--text-secondary, #5A5651)",marginBottom:6},children:["No matches for ",t.jsxs("span",{style:{color:"var(--text-primary, #191919)",fontFamily:c},children:['"',oe,'"']})]}),t.jsx("a",{href:"/skills",style:{fontFamily:c,fontSize:12,color:"var(--color-action, #2F5B8E)",textDecoration:"none",borderBottom:"1px solid currentColor",paddingBottom:1},onClick:e=>{e.preventDefault(),D("/skills")},children:"Browse by category →"})]}),!Y&&f.length===0&&!se&&!$&&t.jsx("div",{style:{padding:"20px 18px",textAlign:"center",fontFamily:c,fontSize:11.5,color:"var(--text-secondary, #5A5651)"},children:"Loading trending…"}),!Y&&f.map((e,n)=>{const r=e.type==="skill"?A?"TRENDING (FILTERED)":oe.length>=2?"RESULTS":"TRENDING":e.type==="category"?"CATEGORIES":"ACTIONS",s=r!==ae;s&&(ae=r);const l=n===U,y=n<9?`${re?"⌘":"Ctrl"} ${n+1}`:"";return t.jsxs("div",{children:[s&&t.jsx("div",{style:{padding:"10px 18px 4px",fontFamily:c,fontSize:9.5,fontWeight:600,color:"var(--text-secondary, #5A5651)",letterSpacing:"0.12em",textTransform:"uppercase"},children:r}),e.type==="skill"?t.jsxs("div",{role:"option","aria-selected":l,onClick:()=>D(e.href,e.sourceResult),onMouseEnter:()=>v(n),style:{position:"relative",padding:"8px 18px 8px 22px",cursor:"pointer",display:"flex",alignItems:"center",gap:12,background:l?"color-mix(in srgb, var(--color-accent, #D4A27F) 8%, transparent)":"transparent",transition:"background 120ms ease"},children:[l&&t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:6,bottom:6,width:3,background:"var(--color-accent, #D4A27F)",borderRadius:"0 2px 2px 0"}}),t.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:2},children:[t.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[t.jsx("span",{style:{fontFamily:c,fontSize:13,fontWeight:600,color:"var(--text-primary, #191919)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:e.label}),e.pluginName&&t.jsx("span",{style:{fontSize:9.5,padding:"1px 5px",borderRadius:3,color:"var(--color-action, #2F5B8E)",background:"rgba(47,91,142,0.08)",border:"1px solid rgba(47,91,142,0.22)",whiteSpace:"nowrap",flexShrink:0,fontFamily:c},children:e.pluginName})]}),t.jsxs("div",{style:{fontSize:11,color:"var(--text-secondary, #5A5651)",fontFamily:c,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",opacity:.85},children:[e.publisher,e.highlight&&t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{margin:"0 6px",opacity:.5},children:"·"}),t.jsx("span",{"data-testid":"search-highlight",dangerouslySetInnerHTML:{__html:me(e.highlight)}})]})]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.githubStars!=null&&e.githubStars>0&&t.jsxs("span",{"data-testid":"star-count",style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:10.5,fontFamily:c,color:"var(--text-secondary, #5A5651)",whiteSpace:"nowrap"},children:[t.jsx("svg",{width:10,height:10,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25z"})}),ve(e.githubStars)]}),t.jsx(Ee,{tier:e.certTier,isTainted:e.isTainted,isBlocked:e.isBlocked}),l&&y&&t.jsx("span",{"aria-hidden":"true",style:{fontFamily:c,fontSize:9.5,color:"var(--text-secondary, #5A5651)",padding:"1px 5px",borderRadius:3,border:"1px solid var(--color-rule, #E8E1D6)",whiteSpace:"nowrap"},children:y})]})]}):t.jsxs("div",{role:"option","aria-selected":l,onClick:()=>D(e.href),onMouseEnter:()=>v(n),style:{position:"relative",padding:"7px 18px 7px 22px",cursor:"pointer",background:l?"color-mix(in srgb, var(--color-accent, #D4A27F) 8%, transparent)":"transparent",fontFamily:c,fontSize:12.5,color:"var(--text-primary, #191919)"},children:[l&&t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:4,bottom:4,width:3,background:"var(--color-accent, #D4A27F)",borderRadius:"0 2px 2px 0"}}),e.label]})]},`${e.type}-${e.name||e.label}`)}),H&&!j&&I.length>0&&!C&&t.jsx("div",{ref:ee,"data-testid":"scroll-sentinel",style:{padding:"8px 18px",textAlign:"center"},children:M&&t.jsx("span",{style:{fontFamily:c,fontSize:11,color:"var(--text-secondary, #5A5651)"},children:"Loading…"})}),C&&I.length>0&&t.jsx("div",{"data-testid":"hard-cap-link",style:{padding:"12px 18px",textAlign:"center",fontFamily:c,fontSize:11.5},children:t.jsx("a",{href:`https://verified-skill.com/skills?q=${encodeURIComponent(o.trim())}`,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--color-action, #2F5B8E)",textDecoration:"none"},children:"See all results on verified-skill.com →"})})]}),t.jsxs("div",{"data-testid":"palette-footer",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 18px",borderTop:"1px solid var(--color-rule, #E8E1D6)",background:"var(--bg-canvas, #FBF8F3)",fontFamily:c,fontSize:10.5,color:"var(--text-secondary, #5A5651)"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[t.jsx(X,{keys:["↑","↓"],label:"navigate"}),t.jsx(X,{keys:["↵"],label:"open"}),t.jsx(X,{keys:[re?"⌘":"Ctrl","1-9"],label:"jump"})]}),t.jsx("div",{style:{display:"flex",alignItems:"center",gap:6},children:t.jsx("span",{style:{opacity:.7},children:f.length>0?`${f.length} ${f.length===1?"result":"results"}`:""})})]})]})]})}function X({keys:a,label:p}){return t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:2},children:a.map((d,u)=>t.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:16,height:16,padding:"0 4px",fontFamily:c,fontSize:10,fontWeight:500,color:"var(--text-secondary, #5A5651)",background:"var(--bg-surface, #FFFFFF)",border:"1px solid var(--color-rule, #E8E1D6)",borderRadius:3,lineHeight:1},children:d},u))}),t.jsx("span",{children:p})]})}export{$e as default,ve as formatStarCount,Me as highlightMatches};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,r as c}from"./globals-BRZwPAPF.js";import{g as pe,a as G,T as me,I as ge}from"./main-D2shn1dH.js";import{s as N}from"./skill-url-C4ekwoGs.js";import"./useDesktopBridge-DxVWbYqK.js";/* empty css */const X={T0:{label:"BLOCKED",cssVar:"var(--trust-t0)"},T1:{label:"UNSCANNED",cssVar:"var(--trust-t1)"},T2:{label:"BASIC",cssVar:"var(--trust-t2)"},T3:{label:"VERIFIED",cssVar:"var(--trust-t3)"},T4:{label:"CERTIFIED",cssVar:"var(--trust-t4)"}};function he({tier:r}){const i=X[r]??X.T1;return t.jsxs("span",{"data-testid":"trust-badge","data-tier":r,style:{display:"inline-flex",alignItems:"center",gap:"0.3rem",padding:"0.15rem 0.5rem",borderRadius:"4px",fontFamily:"var(--font-geist-mono)",fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.03em",textTransform:"uppercase",whiteSpace:"nowrap",color:i.cssVar,backgroundColor:`color-mix(in srgb, ${i.cssVar} 10%, transparent)`,border:`1px solid color-mix(in srgb, ${i.cssVar} 25%, transparent)`,lineHeight:1,height:"22px"},children:[r," ",i.label]})}const ye=/^https?:\/\/github\.com\/([a-zA-Z0-9_.-]+)\/([a-zA-Z0-9_.-]+?)(\.git)?(\/.*)?$/;function xe(r){var v,x;const a=r.trim().match(ye);if(!a)return null;const p=(v=a[1])==null?void 0:v.toLowerCase();let u=(x=a[2])==null?void 0:x.toLowerCase();if(!p||!u)return null;u=u.replace(/\.git$/,"");const s=`https://github.com/${p}/${u}`;return{owner:p,name:u,url:s}}function ve({repoUrl:r,mono:i="var(--font-geist-mono)",fontSize:a="0.75rem",showPlaceholder:p=!0}){if(!r)return p?t.jsx("span",{style:{color:"var(--text-faint)",fontSize:a},children:"--"}):null;const u=xe(r);return u?t.jsxs("a",{"data-testid":"repo-link",href:u.url,target:"_blank",rel:"noopener noreferrer",onClick:s=>s.stopPropagation(),style:{color:"#0D9488",textDecoration:"none",fontSize:a,fontFamily:i},children:[u.owner,"/",u.name]}):t.jsx("span",{style:{color:"var(--text-faint)",fontSize:a,fontFamily:i},children:r})}const be="var(--font-geist-mono)",ke={ONLINE:"var(--status-success-text)",OFFLINE:"var(--status-danger-text)",STALE:"var(--status-neutral-text)"},Ee={ONLINE:"var(--status-success-bg)",OFFLINE:"var(--status-danger-bg)",STALE:"var(--status-neutral-bg)"};function je({skillName:r,repoUrl:i}){const[a,p]=c.useState(null),[u,s]=c.useState(!1);if(c.useEffect(()=>{i&&(s(!0),fetch(N(r,"repo-health")).then(w=>{if(!w.ok)throw new Error("fetch failed");return w.json()}).then(w=>{p(w.status),s(!1)}).catch(()=>{p(null),s(!1)}))},[r,i]),!i)return null;if(u)return t.jsx("span",{"data-testid":"repo-health-loading",style:{display:"inline-block",width:56,height:20,borderRadius:"4px",backgroundColor:"color-mix(in srgb, var(--text-faint) 20%, transparent)",animation:"pulse 1.5s ease-in-out infinite"}});if(!a||a==="UNKNOWN")return null;const v=ke[a]??"var(--status-neutral-text)",x=Ee[a]??"var(--status-neutral-bg)";return t.jsx("span",{"data-testid":"repo-health-badge",style:{fontFamily:be,fontSize:"0.75rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",padding:"0.2rem 0.6rem",borderRadius:"999px",backgroundColor:x,color:v,whiteSpace:"nowrap"},children:a})}function we({children:r,compact:i}){return t.jsx("pre",{"data-testid":"terminal-block",style:{background:"var(--bg-code, #161B22)",color:"#E6EDF3",fontFamily:"var(--font-geist-mono)",fontSize:i?"0.8rem":"0.875rem",lineHeight:1.6,padding:i?"1rem 1.25rem":"1.5rem 2rem",borderRadius:"6px",overflowX:"auto",margin:0},children:r})}const Se="/api/v1/studio/telemetry/install-copy",$e=/^[a-zA-Z0-9._@/-]+$/,Fe=/^[a-zA-Z0-9._-]+$/,Ie="https://verified-skill.com";function Te(r){return`${r.owner}/${r.repo}/${r.slug}`}function Ae(r,i){return r!=null&&r.ownerSlug&&(r!=null&&r.repoSlug)?`${r.ownerSlug}/${r.repoSlug}`:r!=null&&r.publisher?r.publisher:`${i.owner}/${i.repo}`}function Ce(r){return r==="user"?" --global":` --scope ${r}`}function Re(r){return r==="user"?"User":"Project"}function De(r,i,a,p){const u=a?`${r}/${i}@${a}`:`${r}/${i}`;if(!$e.test(`${r}/${i}`))return{ok:!1,reason:"Invalid skill identifier"};if(a&&!Fe.test(a))return{ok:!1,reason:"Invalid version identifier"};const s=Ce(p),v=`npx vskill@latest install ${u}${s}`,x=[{label:"npm",comment:"# npm",command:v},{label:"bun",comment:"# bun",command:`bunx vskill@latest install ${u}${s}`},{label:"pnpm",comment:"# pnpm",command:`pnpx vskill@latest install ${u}${s}`},{label:"yarn",comment:"# yarn",command:`yarn dlx vskill@latest install ${u}${s}`},{label:"alternative",comment:"# alternative (publisher + --skill flag)",command:a?`npx vskill@latest install ${r}@${a} --skill ${i}${s}`:`npx vskill@latest install ${r} --skill ${i}${s}`}];return{ok:!0,command:v,variants:x}}function I(r,i,a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:r,kind:i,durationMs:a,severity:i==="error"?"error":"info"}}))}async function Y(r){var i;if(typeof navigator<"u"&&((i=navigator.clipboard)!=null&&i.writeText))try{return await navigator.clipboard.writeText(r),!0}catch{}if(typeof document>"u")return!1;try{const a=document.createElement("textarea");a.value=r,a.setAttribute("readonly",""),a.style.position="fixed",a.style.left="-9999px",document.body.appendChild(a),a.select();const p=document.execCommand("copy");return document.body.removeChild(a),p}catch{return!1}}function Z(r,i){try{fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i),keepalive:!0}).catch(()=>{})}catch{}}function Oe({selectedSkill:r,onClose:i,activeAgentId:a,telemetryInstallCopyUrl:p=Se,onToast:u}){const[s,v]=c.useState(null),[x,w]=c.useState([]),[J,Q]=c.useState(!1),[ee,te]=c.useState(null),[T,A]=c.useState(!0),[C,V]=c.useState(null),[y,O]=c.useState(null),[k,re]=c.useState("project"),[b,R]=c.useState(null),[_,ne]=c.useState(0),[D,M]=c.useState(!1),U=c.useRef(null),P=c.useRef(null),W=c.useRef(null),K=c.useRef(!1),g=Te(r),se=a===void 0?pe("activeAgent",null):a;c.useEffect(()=>{K.current=D},[D]),c.useEffect(()=>(W.current=document.activeElement??null,()=>{const e=W.current;if(e&&typeof e.focus=="function")try{e.focus()}catch{}}),[]),c.useEffect(()=>{const e=setTimeout(()=>{var n;return(n=P.current)==null?void 0:n.focus()},50);return()=>clearTimeout(e)},[]),c.useEffect(()=>{let e=!1;A(!0),V(null);const n=N(g),d=N(g,"versions");return Promise.all([fetch(n).then(async o=>{if(!o.ok)throw new Error(`metadata ${o.status}`);return o.json()}),fetch(d).then(async o=>{if(!o.ok)throw new Error(`versions ${o.status}`);const l=await o.json(),f=Array.isArray(l)?l:(l==null?void 0:l.versions)??[],h=!Array.isArray(l)&&(l==null?void 0:l.unversioned)===!0,j=!Array.isArray(l)&&typeof(l==null?void 0:l.currentVersion)=="string"?l.currentVersion:null;return{list:f,unversioned:h,currentVersion:j}})]).then(([o,l])=>{if(e)return;v(o),w(l.list),Q(l.unversioned),te(l.currentVersion);const f=l.list.find(h=>h.isLatest)??l.list[0]??null;O(f?f.version:null),A(!1)}).catch(o=>{e||(V(o instanceof Error?o.message:String(o)),A(!1))}),()=>{e=!0}},[g,_]),c.useEffect(()=>{let e=!1;return G.getSkillInstallState(g).then(n=>{e||R(n)},()=>{if(!e){try{const n="vskill:installState:warned";typeof sessionStorage<"u"&&!sessionStorage.getItem(n)&&(sessionStorage.setItem(n,"1"),console.warn("[SkillDetailPanel] install-state fetch failed; falling back to optimistic not-installed UX"))}catch{}R(null)}}),()=>{e=!0}},[g,_]),c.useEffect(()=>{if(typeof window>"u")return;let e=null;const n=d=>{const o=d.detail;!(o!=null&&o.skill)||o.skill!==g||(e&&clearTimeout(e),e=setTimeout(()=>{G.getSkillInstallState(g).then(l=>R(l),()=>{})},50))};return window.addEventListener("studio:skill-installed",n),()=>{e&&clearTimeout(e),window.removeEventListener("studio:skill-installed",n)}},[g]),c.useEffect(()=>{function e(n){if(!(K.current||typeof document<"u"&&document.querySelector("[data-testid='settings-modal'], [data-testid='install-targets-modal'], [data-testid='clipboard-export-dialog']"))){if(n.key==="Escape")n.stopPropagation(),L();else if(n.key==="Tab"){const o=U.current;if(!o)return;const l=o.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(l.length===0)return;const f=l[0],h=l[l.length-1],j=document.activeElement;n.shiftKey&&j===f?(n.preventDefault(),h.focus()):!n.shiftKey&&j===h&&(n.preventDefault(),f.focus())}}}return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[]);const L=c.useCallback(()=>{i();let e="";try{typeof window<"u"&&window.sessionStorage&&(e=window.sessionStorage.getItem("find-skills:last-query")??"")}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("openFindSkills",{detail:{query:e}}))},[i]),S=Ae(s,r),E=(s==null?void 0:s.skillSlug)??r.slug,$=(s==null?void 0:s.displayName)??r.displayName??E,oe=(s==null?void 0:s.isBlocked)===!0,F=c.useMemo(()=>x.length===0?[]:[...x].sort((n,d)=>{const o=n.publishedAt?Date.parse(n.publishedAt):0;return(d.publishedAt?Date.parse(d.publishedAt):0)-o}).slice(0,5),[x]),B=c.useMemo(()=>!y||F.length===0?!0:F[0].version===y,[y,F]),m=c.useMemo(()=>y?De(S,E,B?null:y,k):null,[S,E,y,B,k]);c.useCallback(async()=>{if(!m||!m.ok)return;const e=await Y(m.command);Z(p,{skillName:g,version:y??"",q:"",ts:Date.now()});const n=e?`Run ${m.command} in your terminal`:"Copy failed — please copy the command manually.";if(u)try{u(n,e?"success":"error")}catch{}else I(n,e?"success":"error",3500)},[m,p,g,y,S,E,B,u]);const le=c.useCallback(()=>{!m||!m.ok||M(!0)},[m]),ie=c.useCallback(e=>{const n=e.filter(f=>f.status==="error");if(n.length>0){const f=n[0],h=`Install finished with ${n.length} error${n.length===1?"":"s"}: ${f.detail??f.agentId}`;if(u)try{u(h,"error")}catch{}else I(h,"error",0);return}const d=e.filter(f=>f.status==="installed").length,o=e.filter(f=>f.status==="exported").length;if(d===0&&o===0){const f="Install finished without writing any selected target. Check the selected tool and try again.";if(u)try{u(f,"error")}catch{}else I(f,"error",0);return}if(typeof window<"u")try{window.dispatchEvent(new CustomEvent("studio:skill-installed",{detail:{skill:`${S}/${E}`,scope:k}}))}catch{}const l=o>0?`Installed ${$}; ${o} target${o===1?"":"s"} need paste.`:`Installed ${$} to ${d} target${d===1?"":"s"}.`;if(u)try{u(l,"success")}catch{}else I(l,"success",5e3)},[S,E,k,$,u]),ae=(s==null?void 0:s.trustTier)??"T1",de=(s==null?void 0:s.certTier)==="CERTIFIED"||(s==null?void 0:s.certTier)==="VERIFIED"?s.certTier:"VERIFIED";return t.jsxs(t.Fragment,{children:[t.jsxs("div",{ref:U,"data-testid":"skill-detail-panel",role:"dialog","aria-modal":"true","aria-label":`Skill detail — ${$}`,style:{position:"fixed",inset:0,zIndex:9998,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"min(10vh, 80px)"},onClick:e=>{e.target===e.currentTarget&&L()},children:[t.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",backdropFilter:"blur(4px)"}}),t.jsxs("div",{onClick:e=>e.stopPropagation(),style:{position:"relative",width:"100%",maxWidth:720,margin:"0 1rem",background:"var(--bg-surface, #FFFFFF)",color:"var(--text-primary, #191919)",borderRadius:"8px",border:"1px solid var(--color-rule, #E8E1D6)",boxShadow:"0 20px 60px rgba(0,0,0,0.15)",overflow:"hidden",maxHeight:"80vh",display:"flex",flexDirection:"column"},children:[t.jsxs("div",{style:{padding:"0.75rem 1rem",borderBottom:"1px solid var(--color-rule, #E8E1D6)",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},children:[t.jsx("button",{ref:P,type:"button",onClick:L,"data-testid":"skill-detail-back",style:{background:"transparent",border:"none",padding:"4px 8px",borderRadius:4,cursor:"pointer",fontFamily:"var(--font-mono, monospace)",fontSize:12,color:"var(--text-secondary, #5A5651)"},children:"← Back to results"}),t.jsx("kbd",{style:{fontFamily:"var(--font-mono, monospace)",fontSize:11,color:"var(--text-secondary, #5A5651)",border:"1px solid var(--color-rule, #E8E1D6)",borderRadius:4,padding:"1px 5px"},children:"Esc"})]}),t.jsxs("div",{style:{overflowY:"auto",padding:"1rem",flex:1},children:[T&&t.jsx("div",{"data-testid":"skill-detail-loading",style:{padding:"2rem",textAlign:"center",color:"var(--text-secondary, #5A5651)"},children:"Loading…"}),C&&!T&&t.jsxs("div",{"data-testid":"skill-detail-error",style:{padding:"1.5rem",textAlign:"center",fontFamily:"var(--font-mono, monospace)",fontSize:"0.875rem",color:"var(--red, #b54444)"},children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:["Failed to load skill: ",C]}),t.jsx("button",{"data-testid":"skill-detail-retry",onClick:()=>ne(e=>e+1),style:{fontFamily:"var(--font-mono, monospace)",fontSize:"0.8125rem",padding:"0.4rem 1rem",borderRadius:4,border:"1px solid var(--color-rule, #E8E1D6)",background:"transparent",color:"var(--text-primary, #191919)",cursor:"pointer"},children:"Retry"})]}),!T&&!C&&t.jsxs(t.Fragment,{children:[t.jsxs("section",{"data-testid":"skill-detail-hero",style:{marginBottom:"1.25rem"},children:[t.jsx("h2",{style:{margin:"0 0 0.5rem",fontSize:"1.25rem",fontWeight:600},children:$}),(s==null?void 0:s.description)&&t.jsx("p",{style:{margin:"0 0 0.75rem",color:"var(--text-secondary, #5A5651)",fontSize:"0.875rem",lineHeight:1.5},children:s.description}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.5rem",alignItems:"center"},children:[t.jsx(he,{tier:ae}),t.jsx(me,{tier:de,isTainted:s==null?void 0:s.isTainted}),t.jsx(ve,{repoUrl:(s==null?void 0:s.repoUrl)??null}),t.jsx(je,{skillName:g,repoUrl:s==null?void 0:s.repoUrl})]})]}),t.jsxs("section",{"data-testid":"skill-detail-versions",style:{marginBottom:"1.25rem"},children:[t.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-secondary, #5A5651)"},children:"Versions"}),F.length===0?J?t.jsxs("div",{"data-testid":"skill-detail-unversioned",style:{color:"var(--text-secondary, #5A5651)",fontSize:"0.8125rem"},children:["Discovered — no published version yet (currentVersion: ",ee??"unknown",")."]}):t.jsx("div",{"data-testid":"skill-detail-no-versions",style:{color:"var(--text-secondary, #5A5651)",fontSize:"0.8125rem"},children:"No versions found."}):t.jsx("ul",{style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:4},children:F.map(e=>{const n=e.version===y,d=e.publishedAt?e.publishedAt.slice(0,10):"",o=e.authorEmail??e.author??"";return t.jsx("li",{children:t.jsxs("button",{type:"button","data-testid":"skill-detail-version-row","data-version":e.version,"data-selected":n?"true":"false","aria-pressed":n,onClick:()=>O(e.version),style:{width:"100%",textAlign:"left",padding:"0.5rem 0.75rem",borderRadius:4,border:n?"1px solid var(--color-action, #2F5B8E)":"1px solid var(--color-rule, #E8E1D6)",background:n?"color-mix(in srgb, var(--color-action, #2F5B8E) 8%, transparent)":"transparent",cursor:"pointer",fontFamily:"var(--font-mono, monospace)",fontSize:"0.8125rem",color:"var(--text-primary, #191919)",display:"flex",alignItems:"center",gap:"0.5rem"},children:[t.jsx("span",{"aria-hidden":"true",style:{width:14,display:"inline-flex",justifyContent:"center"},children:n?"●":"○"}),t.jsxs("span",{style:{fontWeight:600},children:["v",e.version]}),d&&t.jsxs("span",{style:{color:"var(--text-secondary, #5A5651)"},children:["· ",d]}),o&&t.jsxs("span",{style:{color:"var(--text-secondary, #5A5651)"},children:["· ",o]}),n&&t.jsx("span",{"data-testid":"skill-detail-version-selected-tag",style:{marginLeft:"auto",fontSize:"0.6875rem",color:"var(--color-action, #2F5B8E)"},children:"Selected"})]})},e.version)})}),t.jsx("div",{style:{marginTop:"0.5rem",textAlign:"right"},children:t.jsx("a",{"data-testid":"skill-detail-see-all-versions",href:`${Ie}/skills/${r.owner}/${r.repo}/${r.slug}/versions`,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--font-mono, monospace)",fontSize:"0.75rem",color:"var(--color-action, #2F5B8E)",textDecoration:"none"},children:"see all versions →"})})]}),oe?t.jsxs("section",{"data-testid":"skill-detail-blocked",style:{marginBottom:"0.5rem"},children:[t.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--red, #b54444)"},children:"This skill is blocked"}),t.jsx("div",{style:{padding:"1rem",borderRadius:6,border:"1px solid var(--red, #b54444)",background:"var(--red-muted, color-mix(in srgb, #b54444 18%, transparent))",color:"var(--red, #b54444)",fontSize:"0.875rem"},children:(s==null?void 0:s.blockReason)??"This skill has been blocked by platform moderators and cannot be installed."})]}):m&&!m.ok?t.jsxs("section",{"data-testid":"skill-detail-install-error",style:{marginBottom:"0.5rem"},children:[t.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--red, #b54444)"},children:"Install command unavailable"}),t.jsxs("div",{style:{padding:"1rem",borderRadius:6,border:"1px solid var(--red, #b54444)",background:"var(--red-muted, color-mix(in srgb, #b54444 18%, transparent))",color:"var(--red, #b54444)",fontSize:"0.875rem"},children:[m.reason," — refusing to render the install panel for safety."]})]}):m&&m.ok?t.jsxs("section",{"data-testid":"skill-detail-install",style:{marginBottom:"0.5rem"},children:[t.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-secondary, #5A5651)"},children:"Install"}),t.jsxs("div",{role:"radiogroup","aria-label":"Install scope","data-testid":"skill-detail-install-scope",style:{display:"flex",gap:"0.5rem",alignItems:"center",marginBottom:"0.75rem",fontFamily:"var(--font-mono, monospace)",fontSize:"0.75rem",color:"var(--text-secondary, #5A5651)"},children:[t.jsx("span",{children:"Scope:"}),["project","user"].map(e=>{var H;const n=k===e,d=(H=b==null?void 0:b.scopes)==null?void 0:H[e],o=(d==null?void 0:d.installed)===!0,l=(b==null?void 0:b.detectedAgentTools)??[],f=l.map(z=>`./${z.localDir}`).join(", "),h=l.map(z=>z.globalDir).join(", "),j=(d==null?void 0:d.installedAgentTools)??[],ce=d!=null&&d.version?`Installed v${d.version} · ${j.join(", ")}`:`Installed · ${j.join(", ")}`,ue=e==="project"?f?`Will install to: ${f}`:"Install with --scope project":h?`Will install to: ${h}`:"Install with --global",fe=o?ce:ue,q=Re(e);return t.jsx("button",{type:"button",role:"radio","aria-checked":n,"aria-disabled":o,disabled:o,"data-testid":`skill-detail-install-scope-${e}`,"data-installed":o?"true":"false",title:fe,onClick:()=>{o||re(e)},style:{padding:"0.25rem 0.6rem",borderRadius:4,border:`1px solid ${n?"var(--text-primary, #191919)":"var(--color-rule, #E8E1D6)"}`,background:n?"var(--text-primary, #191919)":"transparent",color:n?"var(--bg-surface, #FFFFFF)":"var(--text-secondary, #5A5651)",cursor:o?"not-allowed":"pointer",opacity:o?.55:1,fontFamily:"var(--font-mono, monospace)",fontSize:"0.75rem",fontWeight:n?600:400},children:o?`Installed ✓ ${q}`:q},e)})]}),(()=>{var l;const e=(l=b==null?void 0:b.scopes)==null?void 0:l[k],n=(e==null?void 0:e.installed)===!0,d=e!=null&&e.version?` (v${e.version})`:"",o=`Already installed at ${k} — re-run via CLI to force`;return t.jsx("button",{type:"button",onClick:le,disabled:n,"aria-disabled":n,"data-testid":"skill-detail-install-primary","data-installed":n?"true":"false","aria-label":n?"Already installed at the selected scope":"Install skill",title:n?o:void 0,style:{display:"inline-flex",alignItems:"center",marginBottom:"0.75rem",padding:"0.5rem 1rem",borderRadius:6,border:"1px solid var(--text-primary, #191919)",background:n?"var(--bg-surface, #FFFFFF)":"var(--text-primary, #191919)",color:n?"var(--text-secondary, #5A5651)":"var(--bg-surface, #FFFFFF)",cursor:n?"not-allowed":"pointer",opacity:n?.7:1,fontFamily:"var(--font-mono, monospace)",fontSize:"0.875rem",fontWeight:600},children:n?`✓ Installed${d}`:"Install"})})(),t.jsx("div",{"data-testid":"skill-detail-install-command",style:{display:"block"},children:t.jsx(we,{compact:!0,children:m.variants.map((e,n)=>t.jsxs("div",{"data-testid":`skill-detail-install-variant-${e.label}`,style:{display:"flex",gap:"0.75rem",alignItems:"flex-start",marginTop:n===0?0:"0.75rem"},children:[t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{color:"#8B949E",marginBottom:"0.125rem"},children:e.comment}),t.jsxs("div",{children:[t.jsx("span",{style:{color:"#8B949E",marginRight:"0.5rem"},children:"$"}),t.jsx("span",{"data-testid":`skill-detail-install-variant-cmd-${e.label}`,children:e.command})]})]}),t.jsx("button",{type:"button",onClick:async()=>{const d=await Y(e.command),o=d?`Run ${e.command} in your terminal`:"Copy failed — please copy the command manually.";if(u)try{u(o,d?"success":"error")}catch{}else I(o,d?"success":"error",3500);d&&Z(p,{skillName:g,version:y??"",q:"",ts:Date.now()})},"data-testid":`skill-detail-copy-${e.label}`,"aria-label":`Copy ${e.label} install command`,style:{flexShrink:0,padding:"0.25rem 0.6rem",borderRadius:4,border:"1px solid color-mix(in srgb, #E6EDF3 25%, transparent)",background:"color-mix(in srgb, #E6EDF3 8%, transparent)",color:"#E6EDF3",cursor:"pointer",fontFamily:"var(--font-mono, monospace)",fontSize:"0.7rem",alignSelf:"flex-end"},children:"Copy"})]},e.label))})})]}):null]})]})]})]}),D&&t.jsx(ge,{skill:`${S}/${E}`,skillDisplayName:$,scope:k,targetVersion:y,activeAgentId:se,onClose:()=>M(!1),onSuccess:ie})]})}export{Oe as SkillDetailPanel,Oe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as v,j as a}from"./globals-BRZwPAPF.js";import{f as N,b as E,a as L}from"./main-D2shn1dH.js";import"./useDesktopBridge-DxVWbYqK.js";/* empty css */function M(l,d){const[c,u]=l.split("."),[w,f]=d.split("."),r=Number(c),m=Number(u),p=Number(w),y=Number(f);return!Number.isFinite(r)||!Number.isFinite(p)?(console.warn(`[semverBump] unparseable version: installed=${l} latest=${d}`),"patch"):p>r?"major":!Number.isFinite(m)||!Number.isFinite(y)?(console.warn(`[semverBump] unparseable minor: installed=${l} latest=${d}`),"patch"):y>m?"minor":"patch"}const F={major:{bg:"var(--red-muted)",text:"var(--red)"},minor:{bg:"var(--yellow-muted)",text:"var(--yellow)"},patch:{bg:"var(--green-muted)",text:"var(--green)"}},z=["project","personal","plugin"];function D(l,d={}){if(l.length===0)return"No tracked install — click to view details";const c=l.filter(n=>!n.readonly),u=l.filter(n=>n.readonly);if(c.length===0)return"Plugin-bundled — Update via plugin to refresh";const f=z.filter(n=>c.some(x=>x.scope===n)).join(" + "),m=Array.from(new Set(c.map(n=>n.agentLabel))).sort((n,x)=>n.localeCompare(x)).join(", "),p=c.length;let i=`Updates ${p} ${p===1?"location":"locations"}: ${f} (${m})`;if(d.pinned)return i+=" — pinned (skipped)",i;if(u.length>0){const n=Array.from(new Set(u.map(x=>x.pluginSlug??"?")));n.length===1&&n[0]!=="?"?i+=` — ${u.length} from plugin ${n[0]} (handled separately)`:i+=` — ${u.length} plugin-bundled (handled separately)`}return i}function P({updates:l,isRefreshing:d,onRefresh:c,onSelectSkill:u,onViewAll:w,onClose:f,anchorRef:r,diffSummariesById:m}){const p=v.useRef(null),y=v.useRef(null);v.useEffect(()=>{var e;(e=y.current)==null||e.focus()},[]),v.useEffect(()=>{function e(s){p.current&&(p.current.contains(s.target)||r!=null&&r.current&&r.current.contains(s.target)||f())}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[f,r]),v.useEffect(()=>{function e(s){var g;s.key==="Escape"&&(s.preventDefault(),f(),(g=r==null?void 0:r.current)==null||g.focus())}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[f,r]);const i=l.filter(e=>e.updateAvailable),{toast:n}=N(),{onSkillUpdated:x}=E(),[j,k]=v.useState(()=>new Set);async function $(e){const s=e.installLocations??[],g=s.filter(t=>!t.readonly);if(s.length>0&&g.length===0){const t=s[0].pluginSlug??"the plugin";n({severity:"info",message:`This skill came from plugin ${t}. Update the plugin to refresh it.`});return}if(!j.has(e.name)){k(t=>{const o=new Set(t);return o.add(e.name),o});try{const t=e.name.split("/"),o=e.localPlugin??(t.length>=2?t[t.length-2]:t[0]),b=e.localSkill??t[t.length-1],h=await L.postSkillUpdate(o,b);if(h.ok){const S=g.length||1,U=S===1?"location":"locations";x(o,b),n({severity:"success",message:`Updated ${b} in ${S} ${U}.`,durationMs:4e3})}else n({severity:"error",message:`Couldn't update ${b} — HTTP ${h.status}`,durationMs:0})}catch(t){const o=t instanceof Error?t.message:"Network error";n({severity:"error",message:`Update failed: ${o}`,durationMs:0})}finally{k(t=>{const o=new Set(t);return o.delete(e.name),o})}}}return a.jsxs("div",{ref:p,role:"dialog","aria-modal":"false","aria-label":"Skill update summary","data-testid":"update-dropdown",style:{position:"absolute",top:"calc(100% + 6px)",right:0,width:440,maxHeight:400,overflow:"auto",background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:10,zIndex:1e3,fontFamily:"var(--font-sans)",display:"flex",flexDirection:"column",gap:6},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"2px 4px 6px",borderBottom:"1px solid var(--border-default)"},children:[a.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:i.length===0?"No updates available":`${i.length} updates available`}),a.jsx("button",{type:"button","data-testid":"update-dropdown-refresh",onClick:c,disabled:d,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:d?"not-allowed":"pointer",padding:"2px 6px"},children:d?"Refreshing…":"Refresh"})]}),i.length>0?a.jsx("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:2},children:i.map((e,s)=>{const g=e.latest?M(e.installed,e.latest):"patch",t=F[g],o=m==null?void 0:m.get(e.name),b=D(e.installLocations??[],{pinned:e.pinned??!1}),h=j.has(e.name);return a.jsxs("li",{style:{margin:0,display:"flex",alignItems:"stretch",gap:4},children:[a.jsxs("button",{ref:s===0?y:void 0,type:"button","data-testid":"update-dropdown-row","data-skill-name":e.name,onClick:()=>u(e),style:{display:"flex",alignItems:"flex-start",gap:8,width:"100%",padding:"6px 8px",background:"transparent",border:"none",borderRadius:4,cursor:"pointer",color:"var(--text-primary)",fontFamily:"inherit",fontSize:12,textAlign:"left"},children:[a.jsx("span",{"aria-hidden":"true","data-testid":"update-dropdown-bump-dot","data-bump":g,style:{width:8,height:8,borderRadius:"50%",background:t.text,flexShrink:0,marginTop:4}}),a.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[a.jsx("span",{style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[e.installed," → ",e.latest??"?"]})]}),o&&a.jsx("span",{"data-testid":"update-dropdown-diff-summary",style:{fontSize:11,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o})]})]}),a.jsx("button",{type:"button","data-testid":"update-dropdown-row-update","data-skill-name":e.name,title:b,onClick:()=>{$(e)},disabled:h,style:{flexShrink:0,padding:"0 10px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:h?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:11,fontWeight:500},children:h?"Updating…":"Update"})]},e.name)})}):a.jsx("div",{style:{padding:"12px 4px",fontSize:12,color:"var(--text-secondary)"},children:"All installed skills are up to date."}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"4px 4px 0",borderTop:"1px solid var(--border-default)",marginTop:2},children:a.jsx("button",{type:"button","data-testid":"update-dropdown-view-all",onClick:w,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer",padding:"4px 6px"},children:"View all"})})]})}export{P as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,j as e}from"./globals-BRZwPAPF.js";import{u as M,C as T,S as N,F as C,a as q,T as O,D as Q}from"./preferences-BKv6X7fK.js";/* empty css */import"./useDesktopBridge-DxVWbYqK.js";function G(s){if(!s)return null;const l=new Date(s).getTime();if(Number.isNaN(l))return s;const i=Date.now()-l;return i<6e4?"just now":i<36e5?`${Math.round(i/6e4)}m ago`:i<864e5?`${Math.round(i/36e5)}h ago`:new Date(s).toLocaleString()}function S(s){const l=s.toLowerCase();return l.includes("signature")||l.includes("verify")?"signature":l.includes("space")||l.includes("disk")?"disk":l.includes("network")||l.includes("fetch")||l.includes("connect")?"network":"unknown"}function X({bridge:s,snapshot:l,onSnapshotChanged:i,pushToast:u,triggerCheckNonce:j}){const{t}=M("preferences"),k=!s.available,[d,m]=o.useState("idle"),[g,B]=o.useState(null),[D,w]=o.useState(null),[x,y]=o.useState(null),[c,E]=o.useState(null),[n,p]=o.useState({open:!1,update:null,installState:"idle",progressBytes:0,totalBytes:null}),_=o.useRef(j??0);o.useEffect(()=>{let a=!1;return s.getAppMetadata().then(r=>{a||E(r)}).catch(()=>{}),()=>{a=!0}},[s]);const F=(l==null?void 0:l.updates.channel)??"stable",L=(l==null?void 0:l.updates.autoCheck)??!0,V=G(l==null?void 0:l.updates.lastCheckedAt),b=o.useCallback(async()=>{if(!(k||d==="checking")){m("checking"),w(null),y(null);try{const a=await s.checkForUpdates();B(a),a.available?(m("available"),p({open:!0,update:a,installState:"idle",progressBytes:0,totalBytes:null})):(m("up-to-date"),u({message:t("updates.upToDate"),variant:"success"})),await i()}catch(a){const r=a instanceof Error?a.message:String(a);m("error"),w(r),y(S(r))}}},[s,d,k,i,u,t]),R=o.useCallback(async a=>{try{await s.setSetting("updates.channel",a),await i(),a==="beta"&&u({message:t("updates.channel.betaUnavailable")})}catch{u({message:"Couldn't update channel.",variant:"error"})}},[s,i,u,t]),U=o.useCallback(async a=>{try{await s.setSetting("updates.autoCheck",a),await i()}catch{u({message:"Couldn't update auto-check.",variant:"error"})}},[s,i,u]),A=o.useCallback(async()=>{if(n.update){p(a=>({...a,installState:"preparing"}));try{await s.downloadAndInstallUpdate((a,r)=>{p(f=>({...f,installState:"downloading",progressBytes:a,totalBytes:r}))}),p(a=>({...a,installState:"ready-to-restart"}))}catch(a){const r=a instanceof Error?a.message:String(a),f=S(r);p(h=>({...h,open:!1,installState:"idle"})),m("error"),w(r),y(f)}}},[s,n.update]),I=o.useCallback(async()=>{var a;(a=n.update)!=null&&a.latestVersion&&(await s.setSetting("updates.skippedVersion",n.update.latestVersion),p(r=>({...r,open:!1})),await i())},[s,n.update,i]),$=o.useCallback(async()=>{const a=new Date(Date.now()+864e5).toISOString();await s.setSetting("updates.snoozedUntil",a),p(r=>({...r,open:!1})),await i()},[s,i]),z=o.useCallback(async()=>{try{await s.restartApp()}catch(a){const r=a instanceof Error?a.message:String(a);u({message:r||"Couldn't restart Skill Studio.",variant:"error"})}},[s,u]);o.useEffect(()=>{const a=j??0;a===0||a===_.current||(_.current=a,b())},[b,j]);const K=()=>{if(!n.open||!n.update)return null;const a=n.update,r=n.installState==="preparing"||n.installState==="downloading"||n.installState==="installing",f=n.installState==="ready-to-restart",h=n.totalBytes&&n.totalBytes>0?Math.min(100,Math.round(n.progressBytes/n.totalBytes*100)):null;return e.jsxs(Q,{open:n.open,onDismiss:()=>p(v=>({...v,open:!1})),ariaLabel:t("updates.dialog.title"),children:[e.jsx("h2",{className:"pref-dialog__title",children:t("updates.dialog.title")}),e.jsx("p",{className:"pref-dialog__body",children:t("updates.dialog.version",{version:a.latestVersion??"?"})}),e.jsxs("div",{children:[e.jsx("p",{className:"pref-row__label-text",style:{marginBottom:6},children:t("updates.dialog.releaseNotes")}),e.jsx("div",{className:"pref-dialog__release-notes",children:a.releaseNotes??t("updates.dialog.noReleaseNotes")})]}),r?e.jsxs("div",{className:"pref-progress",children:[e.jsx("div",{className:"pref-progress__bar",children:e.jsx("div",{className:"pref-progress__fill",style:{width:h===null?"30%":`${h}%`}})}),e.jsxs("span",{className:"pref-progress__text",children:[n.installState==="preparing"?t("updates.dialog.preparing"):t("updates.dialog.downloading"),h!==null?` (${h}%)`:null]})]}):null,e.jsx("div",{className:"pref-dialog__actions",children:f?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"pref-dialog__body",style:{marginRight:"auto"},children:t("updates.dialog.restartRequired")}),e.jsx("button",{type:"button",className:"pref-button",onClick:()=>p(v=>({...v,open:!1})),children:t("updates.dialog.onQuit")}),e.jsx("button",{type:"button",className:"pref-button pref-button--primary",onClick:z,children:t("updates.dialog.restartNow")})]}):r?e.jsx("button",{type:"button",className:"pref-button",onClick:()=>s.cancelUpdate().catch(()=>{}),children:t("updates.dialog.cancel")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"pref-button",onClick:I,children:t("updates.dialog.skipVersion")}),e.jsx("button",{type:"button",className:"pref-button",onClick:$,children:t("updates.dialog.later")}),e.jsx("button",{type:"button",className:"pref-button pref-button--primary",onClick:A,children:t("updates.dialog.installNow")})]})})]})};return k?e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"preferences-content__heading",children:[e.jsx("h1",{children:t("updates.heading")}),e.jsx("p",{children:t("updates.subheading")})]}),e.jsxs(T,{variant:"info",children:[e.jsx("strong",{children:t("common.browserMode")}),e.jsx("span",{children:t("updates.browserCallout")}),e.jsx("a",{href:t("app.downloadUrl"),target:"_blank",rel:"noopener noreferrer",children:t("app.downloadLink")})]}),e.jsx(N,{title:t("updates.about.heading"),children:e.jsxs("div",{className:"pref-meta-row",children:[e.jsx("span",{className:"pref-meta-row__label",children:t("updates.currentVersion")}),e.jsx("span",{className:"pref-meta-row__value",children:"browser"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"preferences-content__heading",children:[e.jsx("h1",{children:t("updates.heading")}),e.jsx("p",{children:t("updates.subheading")})]}),e.jsxs(N,{title:t("updates.heading"),children:[e.jsxs("div",{className:"pref-meta-row",children:[e.jsx("span",{className:"pref-meta-row__label",children:t("updates.currentVersion")}),e.jsxs("span",{className:"pref-meta-row__value",children:[(c==null?void 0:c.version)??"(unknown)",c!=null&&c.build?` (${c.build})`:""]})]}),e.jsxs("div",{className:"pref-meta-row",children:[e.jsx("span",{className:"pref-meta-row__label",children:t("updates.lastChecked")}),e.jsx("span",{className:"pref-meta-row__value",children:V??t("updates.lastCheckedNever")})]}),e.jsx(C,{label:t("updates.channel.label"),help:t("updates.channel.help"),control:e.jsx(q,{ariaLabel:t("updates.channel.label"),value:F,onChange:R,options:[{value:"stable",label:t("updates.channel.stable")},{value:"beta",label:t("updates.channel.beta")}]})}),e.jsx(C,{label:t("updates.autoCheck.label"),help:t("updates.autoCheck.help"),control:e.jsx(O,{ariaLabel:t("updates.autoCheck.label"),checked:L,onChange:U})}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center",marginTop:4},children:[e.jsx("button",{type:"button",className:"pref-button pref-button--primary",onClick:b,disabled:d==="checking",children:d==="checking"?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[e.jsx("span",{className:"pref-spinner","aria-hidden":"true"}),t("updates.checking")]}):t("updates.checkNow")}),e.jsxs("div",{className:"pref-status-row","data-state":d==="up-to-date"?"success":d==="error"?"error":void 0,children:[d==="up-to-date"?t("updates.upToDate"):null,d==="available"&&(g!=null&&g.latestVersion)?e.jsx(e.Fragment,{children:t("updates.updateAvailable",{version:g.latestVersion})}):null,d==="error"&&x?e.jsx(e.Fragment,{children:x==="signature"?t("updates.errors.signature"):x==="disk"?t("updates.errors.diskSpace"):x==="network"?t("updates.errors.network"):D??"Unknown error"}):null]})]}),d==="error"?e.jsxs("div",{style:{display:"flex",gap:8,marginTop:4},children:[e.jsx("button",{type:"button",className:"pref-button",onClick:b,children:t("updates.errors.tryAgain")}),e.jsx("button",{type:"button",className:"pref-button",onClick:()=>s.openLogsFolder().catch(()=>{}),children:t("updates.errors.viewLogs")})]}):null]}),e.jsxs(N,{title:t("updates.about.heading"),children:[e.jsxs("div",{className:"pref-meta-row",children:[e.jsx("span",{className:"pref-meta-row__label",children:t("updates.about.build")}),e.jsx("span",{className:"pref-meta-row__value",children:(c==null?void 0:c.build)??"(unknown)"})]}),e.jsxs("div",{className:"pref-meta-row",children:[e.jsx("span",{className:"pref-meta-row__label",children:t("updates.about.commit")}),e.jsx("span",{className:"pref-meta-row__value",children:(c==null?void 0:c.commit)??"(unknown)"})]}),e.jsxs("ul",{className:"pref-link-list","aria-label":t("updates.about.heading"),children:[e.jsx("li",{children:e.jsx("a",{href:"https://verified-skill.com",target:"_blank",rel:"noopener noreferrer",children:t("updates.about.links.website")})}),e.jsx("li",{children:e.jsx("a",{href:"https://verified-skill.com/licenses",target:"_blank",rel:"noopener noreferrer",children:t("updates.about.links.openSource")})}),e.jsx("li",{children:e.jsx("a",{href:"https://verified-skill.com/acknowledgements",target:"_blank",rel:"noopener noreferrer",children:t("updates.about.links.acknowledgements")})})]})]}),K()]})}export{X as UpdatesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function s(n,e,i,a){if(typeof e=="function"?n!==e||!a:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(n):a?a.value:e.get(n)}function h(n,e,i,a,l){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,i),i}var r,t,o,_;const f="__TAURI_TO_IPC_KEY__";function d(n,e=!1){return window.__TAURI_INTERNALS__.transformCallback(n,e)}class u{constructor(e){r.set(this,void 0),t.set(this,0),o.set(this,[]),_.set(this,void 0),h(this,r,e||(()=>{})),this.id=d(i=>{const a=i.index;if("end"in i){a==s(this,t,"f")?this.cleanupCallback():h(this,_,a);return}const l=i.message;if(a==s(this,t,"f")){for(s(this,r,"f").call(this,l),h(this,t,s(this,t,"f")+1);s(this,t,"f")in s(this,o,"f");){const c=s(this,o,"f")[s(this,t,"f")];s(this,r,"f").call(this,c),delete s(this,o,"f")[s(this,t,"f")],h(this,t,s(this,t,"f")+1)}s(this,t,"f")===s(this,_,"f")&&this.cleanupCallback()}else s(this,o,"f")[a]=l})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){h(this,r,e)}get onmessage(){return s(this,r,"f")}[(r=new WeakMap,t=new WeakMap,o=new WeakMap,_=new WeakMap,f)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[f]()}}async function p(n,e={},i){return window.__TAURI_INTERNALS__.invoke(n,e,i)}export{u as C,p as i,d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i,t as d}from"./core-DZAvsxlC.js";var n;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_SUSPENDED="tauri://suspended",e.WINDOW_RESUMED="tauri://resumed",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(n||(n={}));async function _(e,a){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,a),await i("plugin:event|unlisten",{event:e,eventId:a})}async function u(e,a,t){var r;const l=typeof(t==null?void 0:t.target)=="string"?{kind:"AnyLabel",label:t.target}:(r=t==null?void 0:t.target)!==null&&r!==void 0?r:{kind:"Any"};return i("plugin:event|listen",{event:e,target:l,handler:d(a)}).then(D=>async()=>_(e,D))}async function c(e,a,t){return u(e,r=>{_(e,r.id),a(r)},t)}async function s(e,a){await i("plugin:event|emit",{event:e,payload:a})}async function o(e,a,t){await i("plugin:event|emit_to",{target:typeof e=="string"?{kind:"AnyLabel",label:e}:e,event:a,payload:t})}export{n as TauriEvent,s as emit,o as emitTo,u as listen,c as once};
|