vskill 0.5.127 → 0.5.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/agents.json +1 -1
  2. package/dist/bin.js +0 -0
  3. package/dist/eval-server/api-routes.js +32 -0
  4. package/dist/eval-server/api-routes.js.map +1 -1
  5. package/dist/eval-ui/assets/{CommandPalette-LtejhB76.js → CommandPalette-D_MdwCki.js} +1 -1
  6. package/dist/eval-ui/assets/{CreateSkillPage-3RuqLQnm.js → CreateSkillPage-lLACfsOZ.js} +1 -1
  7. package/dist/eval-ui/assets/{FindSkillsPalette-Dbl2_IC4.js → FindSkillsPalette-VTksFrSO.js} +2 -2
  8. package/dist/eval-ui/assets/{SearchPaletteCore-CLZmxDat.js → SearchPaletteCore-D49bVafl.js} +1 -1
  9. package/dist/eval-ui/assets/{SkillDetailPanel-RQc5u4nm.js → SkillDetailPanel-Cg8lyDAl.js} +1 -1
  10. package/dist/eval-ui/assets/{UpdateDropdown-O8YGQyMH.js → UpdateDropdown-CLt94M3u.js} +1 -1
  11. package/dist/eval-ui/assets/index-fbCfi37A.js +102 -0
  12. package/dist/eval-ui/assets/{skill-url-BpZjDR8A.js → skill-url-DXjZASn-.js} +1 -1
  13. package/dist/eval-ui/index.html +1 -1
  14. package/dist/index.js +0 -0
  15. package/package.json +1 -1
  16. package/dist/agents/agents-registry.test.d.ts +0 -1
  17. package/dist/agents/agents-registry.test.js +0 -248
  18. package/dist/agents/agents-registry.test.js.map +0 -1
  19. package/dist/api/client.test.d.ts +0 -1
  20. package/dist/api/client.test.js +0 -428
  21. package/dist/api/client.test.js.map +0 -1
  22. package/dist/audit/audit-integration.test.d.ts +0 -1
  23. package/dist/audit/audit-integration.test.js +0 -92
  24. package/dist/audit/audit-integration.test.js.map +0 -1
  25. package/dist/audit/audit-llm.test.d.ts +0 -1
  26. package/dist/audit/audit-llm.test.js +0 -110
  27. package/dist/audit/audit-llm.test.js.map +0 -1
  28. package/dist/audit/audit-patterns.test.d.ts +0 -1
  29. package/dist/audit/audit-patterns.test.js +0 -91
  30. package/dist/audit/audit-patterns.test.js.map +0 -1
  31. package/dist/audit/audit-scanner.test.d.ts +0 -1
  32. package/dist/audit/audit-scanner.test.js +0 -112
  33. package/dist/audit/audit-scanner.test.js.map +0 -1
  34. package/dist/audit/audit-types.test.d.ts +0 -1
  35. package/dist/audit/audit-types.test.js +0 -140
  36. package/dist/audit/audit-types.test.js.map +0 -1
  37. package/dist/audit/config.test.d.ts +0 -1
  38. package/dist/audit/config.test.js +0 -44
  39. package/dist/audit/config.test.js.map +0 -1
  40. package/dist/audit/file-discovery.test.d.ts +0 -1
  41. package/dist/audit/file-discovery.test.js +0 -120
  42. package/dist/audit/file-discovery.test.js.map +0 -1
  43. package/dist/audit/fix-suggestions.test.d.ts +0 -1
  44. package/dist/audit/fix-suggestions.test.js +0 -35
  45. package/dist/audit/fix-suggestions.test.js.map +0 -1
  46. package/dist/audit/formatters/json-formatter.test.d.ts +0 -1
  47. package/dist/audit/formatters/json-formatter.test.js +0 -49
  48. package/dist/audit/formatters/json-formatter.test.js.map +0 -1
  49. package/dist/audit/formatters/report-formatter.test.d.ts +0 -1
  50. package/dist/audit/formatters/report-formatter.test.js +0 -51
  51. package/dist/audit/formatters/report-formatter.test.js.map +0 -1
  52. package/dist/audit/formatters/sarif-formatter.test.d.ts +0 -1
  53. package/dist/audit/formatters/sarif-formatter.test.js +0 -71
  54. package/dist/audit/formatters/sarif-formatter.test.js.map +0 -1
  55. package/dist/audit/formatters/terminal-formatter.test.d.ts +0 -1
  56. package/dist/audit/formatters/terminal-formatter.test.js +0 -51
  57. package/dist/audit/formatters/terminal-formatter.test.js.map +0 -1
  58. package/dist/blocklist/blocklist-e2e.test.d.ts +0 -1
  59. package/dist/blocklist/blocklist-e2e.test.js +0 -346
  60. package/dist/blocklist/blocklist-e2e.test.js.map +0 -1
  61. package/dist/blocklist/blocklist.test.d.ts +0 -1
  62. package/dist/blocklist/blocklist.test.js +0 -259
  63. package/dist/blocklist/blocklist.test.js.map +0 -1
  64. package/dist/commands/__tests__/eval-router.test.d.ts +0 -1
  65. package/dist/commands/__tests__/eval-router.test.js +0 -60
  66. package/dist/commands/__tests__/eval-router.test.js.map +0 -1
  67. package/dist/commands/__tests__/eval-serve.test.d.ts +0 -1
  68. package/dist/commands/__tests__/eval-serve.test.js +0 -23
  69. package/dist/commands/__tests__/eval-serve.test.js.map +0 -1
  70. package/dist/commands/add-blocklist-e2e.test.d.ts +0 -1
  71. package/dist/commands/add-blocklist-e2e.test.js +0 -397
  72. package/dist/commands/add-blocklist-e2e.test.js.map +0 -1
  73. package/dist/commands/add-wizard.test.d.ts +0 -1
  74. package/dist/commands/add-wizard.test.js +0 -392
  75. package/dist/commands/add-wizard.test.js.map +0 -1
  76. package/dist/commands/add.test.d.ts +0 -1
  77. package/dist/commands/add.test.js +0 -2365
  78. package/dist/commands/add.test.js.map +0 -1
  79. package/dist/commands/audit.test.d.ts +0 -1
  80. package/dist/commands/audit.test.js +0 -79
  81. package/dist/commands/audit.test.js.map +0 -1
  82. package/dist/commands/blocklist.test.d.ts +0 -1
  83. package/dist/commands/blocklist.test.js +0 -158
  84. package/dist/commands/blocklist.test.js.map +0 -1
  85. package/dist/commands/eval/__tests__/coverage.test.d.ts +0 -1
  86. package/dist/commands/eval/__tests__/coverage.test.js +0 -122
  87. package/dist/commands/eval/__tests__/coverage.test.js.map +0 -1
  88. package/dist/commands/eval/__tests__/generate-all.test.d.ts +0 -1
  89. package/dist/commands/eval/__tests__/generate-all.test.js +0 -133
  90. package/dist/commands/eval/__tests__/generate-all.test.js.map +0 -1
  91. package/dist/commands/eval/__tests__/init.test.d.ts +0 -1
  92. package/dist/commands/eval/__tests__/init.test.js +0 -116
  93. package/dist/commands/eval/__tests__/init.test.js.map +0 -1
  94. package/dist/commands/eval/__tests__/run.test.d.ts +0 -1
  95. package/dist/commands/eval/__tests__/run.test.js +0 -186
  96. package/dist/commands/eval/__tests__/run.test.js.map +0 -1
  97. package/dist/commands/find.test.d.ts +0 -1
  98. package/dist/commands/find.test.js +0 -481
  99. package/dist/commands/find.test.js.map +0 -1
  100. package/dist/commands/marketplace.test.d.ts +0 -1
  101. package/dist/commands/marketplace.test.js +0 -129
  102. package/dist/commands/marketplace.test.js.map +0 -1
  103. package/dist/commands/remove.test.d.ts +0 -1
  104. package/dist/commands/remove.test.js +0 -164
  105. package/dist/commands/remove.test.js.map +0 -1
  106. package/dist/commands/should-skip.test.d.ts +0 -1
  107. package/dist/commands/should-skip.test.js +0 -56
  108. package/dist/commands/should-skip.test.js.map +0 -1
  109. package/dist/commands/submit.test.d.ts +0 -1
  110. package/dist/commands/submit.test.js +0 -83
  111. package/dist/commands/submit.test.js.map +0 -1
  112. package/dist/commands/update.test.d.ts +0 -1
  113. package/dist/commands/update.test.js +0 -250
  114. package/dist/commands/update.test.js.map +0 -1
  115. package/dist/discovery/github-tree.test.d.ts +0 -1
  116. package/dist/discovery/github-tree.test.js +0 -372
  117. package/dist/discovery/github-tree.test.js.map +0 -1
  118. package/dist/eval/__tests__/activation-tester.test.d.ts +0 -1
  119. package/dist/eval/__tests__/activation-tester.test.js +0 -203
  120. package/dist/eval/__tests__/activation-tester.test.js.map +0 -1
  121. package/dist/eval/__tests__/benchmark-history.test.d.ts +0 -1
  122. package/dist/eval/__tests__/benchmark-history.test.js +0 -422
  123. package/dist/eval/__tests__/benchmark-history.test.js.map +0 -1
  124. package/dist/eval/__tests__/benchmark.test.d.ts +0 -1
  125. package/dist/eval/__tests__/benchmark.test.js +0 -94
  126. package/dist/eval/__tests__/benchmark.test.js.map +0 -1
  127. package/dist/eval/__tests__/comparator.test.d.ts +0 -1
  128. package/dist/eval/__tests__/comparator.test.js +0 -282
  129. package/dist/eval/__tests__/comparator.test.js.map +0 -1
  130. package/dist/eval/__tests__/judge.test.d.ts +0 -1
  131. package/dist/eval/__tests__/judge.test.js +0 -122
  132. package/dist/eval/__tests__/judge.test.js.map +0 -1
  133. package/dist/eval/__tests__/llm.test.d.ts +0 -1
  134. package/dist/eval/__tests__/llm.test.js +0 -543
  135. package/dist/eval/__tests__/llm.test.js.map +0 -1
  136. package/dist/eval/__tests__/mcp-detector.test.d.ts +0 -1
  137. package/dist/eval/__tests__/mcp-detector.test.js +0 -180
  138. package/dist/eval/__tests__/mcp-detector.test.js.map +0 -1
  139. package/dist/eval/__tests__/prompt-builder.test.d.ts +0 -1
  140. package/dist/eval/__tests__/prompt-builder.test.js +0 -142
  141. package/dist/eval/__tests__/prompt-builder.test.js.map +0 -1
  142. package/dist/eval/__tests__/schema.test.d.ts +0 -1
  143. package/dist/eval/__tests__/schema.test.js +0 -247
  144. package/dist/eval/__tests__/schema.test.js.map +0 -1
  145. package/dist/eval/__tests__/skill-scanner.test.d.ts +0 -1
  146. package/dist/eval/__tests__/skill-scanner.test.js +0 -228
  147. package/dist/eval/__tests__/skill-scanner.test.js.map +0 -1
  148. package/dist/eval/__tests__/verdict.test.d.ts +0 -1
  149. package/dist/eval/__tests__/verdict.test.js +0 -47
  150. package/dist/eval/__tests__/verdict.test.js.map +0 -1
  151. package/dist/eval-server/__tests__/benchmark-runner.test.d.ts +0 -1
  152. package/dist/eval-server/__tests__/benchmark-runner.test.js +0 -301
  153. package/dist/eval-server/__tests__/benchmark-runner.test.js.map +0 -1
  154. package/dist/eval-server/__tests__/comparison-sse-events.test.d.ts +0 -1
  155. package/dist/eval-server/__tests__/comparison-sse-events.test.js +0 -278
  156. package/dist/eval-server/__tests__/comparison-sse-events.test.js.map +0 -1
  157. package/dist/eval-server/__tests__/sse-helpers.test.d.ts +0 -1
  158. package/dist/eval-server/__tests__/sse-helpers.test.js +0 -128
  159. package/dist/eval-server/__tests__/sse-helpers.test.js.map +0 -1
  160. package/dist/eval-ui/assets/index-DlZduKAT.js +0 -102
  161. package/dist/installer/canonical.test.d.ts +0 -1
  162. package/dist/installer/canonical.test.js +0 -264
  163. package/dist/installer/canonical.test.js.map +0 -1
  164. package/dist/lockfile/lockfile.test.d.ts +0 -1
  165. package/dist/lockfile/lockfile.test.js +0 -204
  166. package/dist/lockfile/lockfile.test.js.map +0 -1
  167. package/dist/lockfile/project-root.test.d.ts +0 -1
  168. package/dist/lockfile/project-root.test.js +0 -49
  169. package/dist/lockfile/project-root.test.js.map +0 -1
  170. package/dist/marketplace/marketplace.test.d.ts +0 -1
  171. package/dist/marketplace/marketplace.test.js +0 -312
  172. package/dist/marketplace/marketplace.test.js.map +0 -1
  173. package/dist/resolvers/source-resolver.test.d.ts +0 -1
  174. package/dist/resolvers/source-resolver.test.js +0 -104
  175. package/dist/resolvers/source-resolver.test.js.map +0 -1
  176. package/dist/resolvers/url-resolver.test.d.ts +0 -1
  177. package/dist/resolvers/url-resolver.test.js +0 -49
  178. package/dist/resolvers/url-resolver.test.js.map +0 -1
  179. package/dist/scanner/dci-integration.test.d.ts +0 -1
  180. package/dist/scanner/dci-integration.test.js +0 -83
  181. package/dist/scanner/dci-integration.test.js.map +0 -1
  182. package/dist/scanner/patterns.test.d.ts +0 -1
  183. package/dist/scanner/patterns.test.js +0 -832
  184. package/dist/scanner/patterns.test.js.map +0 -1
  185. package/dist/scanner/tier1.test.d.ts +0 -1
  186. package/dist/scanner/tier1.test.js +0 -305
  187. package/dist/scanner/tier1.test.js.map +0 -1
  188. package/dist/security/platform-security.test.d.ts +0 -1
  189. package/dist/security/platform-security.test.js +0 -92
  190. package/dist/security/platform-security.test.js.map +0 -1
  191. package/dist/settings/settings.test.d.ts +0 -1
  192. package/dist/settings/settings.test.js +0 -103
  193. package/dist/settings/settings.test.js.map +0 -1
  194. package/dist/updater/source-fetcher.test.d.ts +0 -1
  195. package/dist/updater/source-fetcher.test.js +0 -192
  196. package/dist/updater/source-fetcher.test.js.map +0 -1
  197. package/dist/utils/__tests__/paths.test.d.ts +0 -1
  198. package/dist/utils/__tests__/paths.test.js +0 -22
  199. package/dist/utils/__tests__/paths.test.js.map +0 -1
  200. package/dist/utils/__tests__/resolve-binary.integration.test.d.ts +0 -1
  201. package/dist/utils/__tests__/resolve-binary.integration.test.js +0 -138
  202. package/dist/utils/__tests__/resolve-binary.integration.test.js.map +0 -1
  203. package/dist/utils/__tests__/resolve-binary.test.d.ts +0 -1
  204. package/dist/utils/__tests__/resolve-binary.test.js +0 -175
  205. package/dist/utils/__tests__/resolve-binary.test.js.map +0 -1
  206. package/dist/utils/__tests__/validation.test.d.ts +0 -1
  207. package/dist/utils/__tests__/validation.test.js +0 -107
  208. package/dist/utils/__tests__/validation.test.js.map +0 -1
  209. package/dist/utils/agent-filter.test.d.ts +0 -1
  210. package/dist/utils/agent-filter.test.js +0 -75
  211. package/dist/utils/agent-filter.test.js.map +0 -1
  212. package/dist/utils/output.test.d.ts +0 -1
  213. package/dist/utils/output.test.js +0 -28
  214. package/dist/utils/output.test.js.map +0 -1
  215. package/dist/utils/project-root.test.d.ts +0 -1
  216. package/dist/utils/project-root.test.js +0 -74
  217. package/dist/utils/project-root.test.js.map +0 -1
  218. package/dist/utils/prompts.test.d.ts +0 -1
  219. package/dist/utils/prompts.test.js +0 -285
  220. package/dist/utils/prompts.test.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import{j as e,R as y,u as Q,a as J,r as v,g as D,b as $,w as Z,c as X,t as P,L as R,P as ee,E as te,d as se,S as re}from"./index-DlZduKAT.js";/* empty css */const ae=[{key:"slashCommands",label:"Slash"},{key:"hooks",label:"Hooks"},{key:"mcp",label:"MCP"},{key:"customSystemPrompt",label:"Prompt"}];function le({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 B({agent:r,checked:a,onToggle:m}){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:m,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:ae.map(u=>e.jsx(le,{supported:r.featureSupport[u.key],label:u.label},u.key))})]})]})}function ne({agents:r,selectedIds:a,onChange:m}){const u=new Set(a),n=r.filter(o=>o.isUniversal),l=r.filter(o=>!o.isUniversal),x=o=>{const i=u.has(o)?a.filter(k=>k!==o):[...a,o];m(i)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[n.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:n.map(o=>e.jsx(B,{agent:o,checked:u.has(o.id),onToggle:()=>x(o.id)},o.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(o=>e.jsx(B,{agent:o,checked:u.has(o.id),onToggle:()=>x(o.id)},o.id))})]})]})}const oe="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.",ie="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.",de="Generate raw — no engine assistance, you provide the full SKILL.md body.";function ce(r){return[{engine:"vskill",label:"VSkill skill-builder",caption:r.vskillSkillBuilder?`installed${r.vskillVersion?` v${r.vskillVersion}`:""}`:"not installed",tooltip:oe,detected:r.vskillSkillBuilder,installable:!0},{engine:"anthropic-skill-creator",label:"Anthropic skill-creator",caption:r.anthropicSkillCreator?"installed":"not installed",tooltip:ie,detected:r.anthropicSkillCreator,installable:!0},{engine:"none",label:"No engine — generate raw",caption:"always available",tooltip:de,detected:!0,installable:!1}]}function ue(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function xe(r){const{detection:a,selected:m,onSelect:u,onInstallClick:n}=r,l=y.useMemo(()=>ue(),[]),x=y.useMemo(()=>ce(a),[a]),o=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:x.map(i=>{const k=m===i.engine,p=!i.detected&&i.installable,b=["flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm cursor-pointer",o,k?"border-blue-600 bg-blue-50":"border-gray-300 bg-white hover:border-gray-400"].filter(Boolean).join(" "),h=i.detected?{}:{opacity:.6};return e.jsxs("div",{role:"tab",tabIndex:0,"data-testid":`engine-selector-${i.engine}`,"aria-selected":k?"true":"false",title:i.tooltip,style:h,className:b,onClick:()=>u(i.engine),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),u(i.engine))},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-gray-900",children:i.label}),e.jsx("span",{className:"text-xs text-gray-500",children:i.caption})]}),p&&e.jsx("button",{type:"button","data-testid":`install-${i.engine}`,className:"rounded border border-blue-600 px-2 py-1 text-xs font-medium text-blue-700 hover:bg-blue-100",onClick:d=>{d.stopPropagation(),n(i.engine)},children:"Install"})]},i.engine)})})]})}const A="(?:0|[1-9]\\d*)",H="[0-9A-Za-z-]",F=`(?:${A}|\\d*[A-Za-z-]${H}*)`,z=`${H}+`,pe=`(?:-${F}(?:\\.${F})*)`,me=`(?:\\+${z}(?:\\.${z})*)`,ge=new RegExp(`^${A}\\.${A}\\.${A}${pe}?${me}?$`);function V(r){return typeof r!="string"?!1:ge.test(r.trim())}const he="Skill version (semver). Auto-bumps on update unless versioningMode=author.",fe="Must be valid semver (e.g. 1.0.0, 2.1.3-beta.1)";function ve(r){const{value:a,onChange:m,mode:u,onValidityChange:n,versionsHref:l,disabled:x}=r,[o,i]=y.useState(!1),[k,p]=y.useState(()=>V(a)),b=V(a);y.useEffect(()=>{b!==k?(p(b),n==null||n(b)):n&&n(b)},[b]);const h=o&&!b,d=["w-full rounded-md border px-3 py-2 text-sm font-mono",h?"border-red-500 bg-red-50 focus:outline-red-600":"border-gray-300 bg-white focus:outline-blue-600",x?"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:he,value:a,onChange:g=>m(g.currentTarget.value),onBlur:()=>i(!0),"aria-invalid":h?"true":"false","aria-describedby":h?"version-input-helper":void 0,disabled:x,className:d,placeholder:"1.0.0"}),h&&e.jsx("span",{id:"version-input-helper","data-testid":"version-input-helper",className:"text-xs text-red-600",role:"alert",children:fe}),u==="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 ye(r={}){const a=r.fetchImpl??globalThis.fetch,m=r.eventSourceCtor??globalThis.EventSource,[u,n]=y.useState(E),l=y.useRef(null),x=y.useRef(null);y.useEffect(()=>()=>{var p;(p=x.current)==null||p.close()},[]);const o=y.useCallback(()=>{var p;(p=x.current)==null||p.close(),x.current=null,l.current=null,n(E)},[]),i=y.useCallback(async p=>{if(!m){n({...E,status:"failure",error:"EventSource not available"});return}l.current=p,n({...E,status:"spawning"});let b;try{const d=await a("/api/studio/install-engine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({engine:p})});if(!d.ok){const C=await d.json().catch(()=>({}));n({...E,status:"failure",error:C.remediation??C.error??`HTTP ${d.status}`});return}b=(await d.json()).jobId}catch(d){n({...E,status:"failure",error:d.message});return}const h=new m(`/api/studio/install-engine/${b}/stream`);x.current=h,n(d=>({...d,status:"streaming"})),h.addEventListener("progress",d=>{try{const g=JSON.parse(d.data);n(C=>({...C,liveTail:g.line.length>60?g.line.slice(0,60)+"…":g.line,progress:[...C.progress,g].slice(-200)}))}catch{}}),h.addEventListener("done",d=>{try{const g=JSON.parse(d.data);h.close(),x.current=null,n(C=>({...C,status:g.success?"success":"failure",exitCode:g.exitCode,stderr:g.stderr,error:g.success?null:g.stderr||`exit ${g.exitCode}`}))}catch{h.close(),x.current=null,n(g=>({...g,status:"failure",error:"malformed done event"}))}}),h.addEventListener("error",()=>{h.close(),x.current=null,n(d=>({...d,status:d.status==="streaming"?"failure":d.status,error:d.error??"stream error"}))})},[m,a]),k=y.useCallback(async()=>{const p=l.current;p&&await i(p)},[i]);return{state:u,install:i,retry:k,reset:o}}const be={vskill:"vskill install anton-abyzov/vskill/skill-builder","anthropic-skill-creator":"claude plugin install skill-creator"},je={vskill:"VSkill skill-builder","anthropic-skill-creator":"Anthropic skill-creator"},ke="This runs the command in your terminal as your user. Inspect before approving.";function we(r){const{engine:a,onClose:m,onSuccess:u,hookOpts:n}=r,{state:l,install:x,retry:o}=ye(n),i=be[a],k=je[a],p=y.useRef(!1);return y.useEffect(()=>{l.status==="success"&&!p.current&&(p.current=!0,u())},[l.status,u]),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 ",k]}),l.status==="idle"&&e.jsx(Ne,{command:i,onCancel:m,onRun:()=>x(a)}),(l.status==="spawning"||l.status==="streaming")&&e.jsx(Ce,{command:i,liveTail:l.liveTail}),l.status==="success"&&e.jsx(Se,{label:k,onClose:m}),l.status==="failure"&&e.jsx(Le,{error:l.error??"Install failed",stderr:l.stderr,progress:l.progress,onRetry:()=>o(),onClose:m})]})})}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 Ne(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:ke}),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 Ce(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 Se(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 Le(r){const[a,m]=y.useState(!1),u=r.progress.filter(l=>l.stream==="stderr").map(l=>l.line),n=u.length>0?u.join(`
1
+ import{j as e,R as y,u as Q,a as J,r as v,g as D,b as $,w as Z,c as X,t as P,L as R,P as ee,E as te,d as se,S as re}from"./index-fbCfi37A.js";/* empty css */const ae=[{key:"slashCommands",label:"Slash"},{key:"hooks",label:"Hooks"},{key:"mcp",label:"MCP"},{key:"customSystemPrompt",label:"Prompt"}];function le({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 B({agent:r,checked:a,onToggle:m}){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:m,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:ae.map(u=>e.jsx(le,{supported:r.featureSupport[u.key],label:u.label},u.key))})]})]})}function ne({agents:r,selectedIds:a,onChange:m}){const u=new Set(a),n=r.filter(o=>o.isUniversal),l=r.filter(o=>!o.isUniversal),x=o=>{const i=u.has(o)?a.filter(k=>k!==o):[...a,o];m(i)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[n.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:n.map(o=>e.jsx(B,{agent:o,checked:u.has(o.id),onToggle:()=>x(o.id)},o.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(o=>e.jsx(B,{agent:o,checked:u.has(o.id),onToggle:()=>x(o.id)},o.id))})]})]})}const oe="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.",ie="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.",de="Generate raw — no engine assistance, you provide the full SKILL.md body.";function ce(r){return[{engine:"vskill",label:"VSkill skill-builder",caption:r.vskillSkillBuilder?`installed${r.vskillVersion?` v${r.vskillVersion}`:""}`:"not installed",tooltip:oe,detected:r.vskillSkillBuilder,installable:!0},{engine:"anthropic-skill-creator",label:"Anthropic skill-creator",caption:r.anthropicSkillCreator?"installed":"not installed",tooltip:ie,detected:r.anthropicSkillCreator,installable:!0},{engine:"none",label:"No engine — generate raw",caption:"always available",tooltip:de,detected:!0,installable:!1}]}function ue(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function xe(r){const{detection:a,selected:m,onSelect:u,onInstallClick:n}=r,l=y.useMemo(()=>ue(),[]),x=y.useMemo(()=>ce(a),[a]),o=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:x.map(i=>{const k=m===i.engine,p=!i.detected&&i.installable,b=["flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm cursor-pointer",o,k?"border-blue-600 bg-blue-50":"border-gray-300 bg-white hover:border-gray-400"].filter(Boolean).join(" "),h=i.detected?{}:{opacity:.6};return e.jsxs("div",{role:"tab",tabIndex:0,"data-testid":`engine-selector-${i.engine}`,"aria-selected":k?"true":"false",title:i.tooltip,style:h,className:b,onClick:()=>u(i.engine),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),u(i.engine))},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-gray-900",children:i.label}),e.jsx("span",{className:"text-xs text-gray-500",children:i.caption})]}),p&&e.jsx("button",{type:"button","data-testid":`install-${i.engine}`,className:"rounded border border-blue-600 px-2 py-1 text-xs font-medium text-blue-700 hover:bg-blue-100",onClick:d=>{d.stopPropagation(),n(i.engine)},children:"Install"})]},i.engine)})})]})}const A="(?:0|[1-9]\\d*)",H="[0-9A-Za-z-]",F=`(?:${A}|\\d*[A-Za-z-]${H}*)`,z=`${H}+`,pe=`(?:-${F}(?:\\.${F})*)`,me=`(?:\\+${z}(?:\\.${z})*)`,ge=new RegExp(`^${A}\\.${A}\\.${A}${pe}?${me}?$`);function V(r){return typeof r!="string"?!1:ge.test(r.trim())}const he="Skill version (semver). Auto-bumps on update unless versioningMode=author.",fe="Must be valid semver (e.g. 1.0.0, 2.1.3-beta.1)";function ve(r){const{value:a,onChange:m,mode:u,onValidityChange:n,versionsHref:l,disabled:x}=r,[o,i]=y.useState(!1),[k,p]=y.useState(()=>V(a)),b=V(a);y.useEffect(()=>{b!==k?(p(b),n==null||n(b)):n&&n(b)},[b]);const h=o&&!b,d=["w-full rounded-md border px-3 py-2 text-sm font-mono",h?"border-red-500 bg-red-50 focus:outline-red-600":"border-gray-300 bg-white focus:outline-blue-600",x?"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:he,value:a,onChange:g=>m(g.currentTarget.value),onBlur:()=>i(!0),"aria-invalid":h?"true":"false","aria-describedby":h?"version-input-helper":void 0,disabled:x,className:d,placeholder:"1.0.0"}),h&&e.jsx("span",{id:"version-input-helper","data-testid":"version-input-helper",className:"text-xs text-red-600",role:"alert",children:fe}),u==="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 ye(r={}){const a=r.fetchImpl??globalThis.fetch,m=r.eventSourceCtor??globalThis.EventSource,[u,n]=y.useState(E),l=y.useRef(null),x=y.useRef(null);y.useEffect(()=>()=>{var p;(p=x.current)==null||p.close()},[]);const o=y.useCallback(()=>{var p;(p=x.current)==null||p.close(),x.current=null,l.current=null,n(E)},[]),i=y.useCallback(async p=>{if(!m){n({...E,status:"failure",error:"EventSource not available"});return}l.current=p,n({...E,status:"spawning"});let b;try{const d=await a("/api/studio/install-engine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({engine:p})});if(!d.ok){const C=await d.json().catch(()=>({}));n({...E,status:"failure",error:C.remediation??C.error??`HTTP ${d.status}`});return}b=(await d.json()).jobId}catch(d){n({...E,status:"failure",error:d.message});return}const h=new m(`/api/studio/install-engine/${b}/stream`);x.current=h,n(d=>({...d,status:"streaming"})),h.addEventListener("progress",d=>{try{const g=JSON.parse(d.data);n(C=>({...C,liveTail:g.line.length>60?g.line.slice(0,60)+"…":g.line,progress:[...C.progress,g].slice(-200)}))}catch{}}),h.addEventListener("done",d=>{try{const g=JSON.parse(d.data);h.close(),x.current=null,n(C=>({...C,status:g.success?"success":"failure",exitCode:g.exitCode,stderr:g.stderr,error:g.success?null:g.stderr||`exit ${g.exitCode}`}))}catch{h.close(),x.current=null,n(g=>({...g,status:"failure",error:"malformed done event"}))}}),h.addEventListener("error",()=>{h.close(),x.current=null,n(d=>({...d,status:d.status==="streaming"?"failure":d.status,error:d.error??"stream error"}))})},[m,a]),k=y.useCallback(async()=>{const p=l.current;p&&await i(p)},[i]);return{state:u,install:i,retry:k,reset:o}}const be={vskill:"vskill install anton-abyzov/vskill/skill-builder","anthropic-skill-creator":"claude plugin install skill-creator"},je={vskill:"VSkill skill-builder","anthropic-skill-creator":"Anthropic skill-creator"},ke="This runs the command in your terminal as your user. Inspect before approving.";function we(r){const{engine:a,onClose:m,onSuccess:u,hookOpts:n}=r,{state:l,install:x,retry:o}=ye(n),i=be[a],k=je[a],p=y.useRef(!1);return y.useEffect(()=>{l.status==="success"&&!p.current&&(p.current=!0,u())},[l.status,u]),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 ",k]}),l.status==="idle"&&e.jsx(Ne,{command:i,onCancel:m,onRun:()=>x(a)}),(l.status==="spawning"||l.status==="streaming")&&e.jsx(Ce,{command:i,liveTail:l.liveTail}),l.status==="success"&&e.jsx(Se,{label:k,onClose:m}),l.status==="failure"&&e.jsx(Le,{error:l.error??"Install failed",stderr:l.stderr,progress:l.progress,onRetry:()=>o(),onClose:m})]})})}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 Ne(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:ke}),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 Ce(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 Se(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 Le(r){const[a,m]=y.useState(!1),u=r.progress.filter(l=>l.stream==="stderr").map(l=>l.line),n=u.length>0?u.join(`
2
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}),n&&e.jsxs("details",{className:"mt-3 text-xs",open:a,onToggle:l=>m(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:n})]}),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 Ee(r){return r?/API usage limits|usage limit/i.test(r)&&/regain access|reset/i.test(r):!1}function Pe(r){const a=r.match(/regain access on ([^"\\]+?)(?:\s*UTC)?["\\]/i)??r.match(/regain access on ([^"\\]+)/i);return a?`Resets ${a[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:a="currentColor"}){return e.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:a,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 Te(){const r=Q(),{config:a}=J(),[m,u]=v.useState(null),n=y.useMemo(()=>{if(typeof window>"u")return{};const s=window.location.hash,c=s.indexOf("?");if(c===-1)return{};const w=new URLSearchParams(s.slice(c+1)),j={};for(const f of["mode","skillName","description","pluginName"]){const L=w.get(f);L&&(j[f]=L)}return j},[]),[l,x]=v.useState("claude-cli"),[o,i]=v.useState("sonnet"),[k,p]=v.useState(!1),[b,h]=v.useState(null),d=v.useRef(!1),[g,C]=v.useState([]),[W,U]=v.useState(()=>D("activeAgent",null));v.useEffect(()=>{function s(){U(D("activeAgent",null))}return window.addEventListener("studio:agent-changed",s),window.addEventListener("storage",s),()=>{window.removeEventListener("studio:agent-changed",s),window.removeEventListener("storage",s)}},[]);const K=W!=="claude-code";v.useEffect(()=>{fetch("/api/agents/installed").then(s=>s.json()).then(s=>{s.agents&&C(s.agents)}).catch(()=>{})},[]),v.useEffect(()=>{var j;if(!a)return;const s=a.providers.filter(f=>f.available),c=$().skillGenModel;if(s.length===0){d.current=!0;return}if(c&&typeof c=="object"&&typeof c.provider=="string"&&typeof c.model=="string"){const f=s.find(T=>T.id===c.provider),L=f==null?void 0:f.models.some(T=>T.id===c.model);if(f&&L){x(c.provider),i(c.model),p(!0),d.current=!0;return}h({provider:c.provider,model:c.model})}if(s.find(f=>f.id==="claude-cli"))x("claude-cli"),i("sonnet");else{const f=s[0];x(f.id),i(((j=f.models[0])==null?void 0:j.id)??"")}p(!1),d.current=!0},[a]),v.useEffect(()=>{const s=c=>{if(c.key!==null&&!c.key.includes("vskill.studio.prefs"))return;const j=$().skillGenModel;j&&typeof j=="object"&&typeof j.provider=="string"&&typeof j.model=="string"&&(x(j.provider),i(j.model),p(!0))};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[]);const O=v.useCallback((s,c)=>{Z("skillGenModel",{provider:s,model:c}),p(!0)},[]),Y=v.useCallback(()=>({provider:l,model:o}),[l,o]),q=n.mode==="standalone"?3:void 0,t=X({onCreated:(s,c)=>r(`/skills/${s}/${c}`),resolveAiConfigOverride:Y,forceLayout:q});v.useEffect(()=>{n.skillName&&!t.name&&t.setName(P(n.skillName)),n.description&&!t.description&&t.setDescription(n.description),n.description&&!t.aiPrompt&&t.setAiPrompt(n.description),n.pluginName&&!t.plugin&&t.setPlugin(P(n.pluginName))},[]);const S=a==null?void 0:a.providers.find(s=>s.id===l&&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
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(xe,{detection:t.engineDetection,selected:t.engine,onSelect:s=>t.setEngine(s),onInstallClick:s=>u(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
 
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SearchPaletteCore-CLZmxDat.js","assets/index-DlZduKAT.js","assets/index-C8DXCPPg.css","assets/fonts-i7Lkz2zN.css","assets/skill-url-BpZjDR8A.js"])))=>i.map(i=>d[i]);
2
- import{r as t,j as d,_ as l}from"./index-DlZduKAT.js";/* empty css */const f=t.lazy(()=>l(()=>import("./SearchPaletteCore-CLZmxDat.js"),__vite__mapDeps([0,1,2,3,4])));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(f,{initialOpen:!0,onSelect:c,onNavigate:u})})}):null}export{y as FindSkillsPalette,y as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SearchPaletteCore-D49bVafl.js","assets/index-fbCfi37A.js","assets/index-C8DXCPPg.css","assets/fonts-i7Lkz2zN.css","assets/skill-url-DXjZASn-.js"])))=>i.map(i=>d[i]);
2
+ import{r as t,j as d,_ as l}from"./index-fbCfi37A.js";/* empty css */const f=t.lazy(()=>l(()=>import("./SearchPaletteCore-D49bVafl.js"),__vite__mapDeps([0,1,2,3,4])));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(f,{initialOpen:!0,onSelect:c,onNavigate:u})})}):null}export{y as FindSkillsPalette,y as default};
@@ -1,4 +1,4 @@
1
- import{r as a,j as t}from"./index-DlZduKAT.js";import{a as xe,f as ye}from"./skill-url-BpZjDR8A.js";/* empty css */function me(i){return i?i.replace(/<(?!\/?b>)[^>]+>/gi,""):""}function be(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ie(i,p){if(!i)return"";const d=be(i);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(i){return i?i<1e3?String(i):`${(i/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:i,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"}}[i];return b?t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":i,style:{...u,color:b.color,background:b.bg,border:`1px solid ${b.border}`},children:ye(i)}):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(i){var d,u;const p=(d=i.target)==null?void 0:d.tagName;return!!(p==="INPUT"||p==="TEXTAREA"||p==="SELECT"||(u=i.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:i,onNavigate:p,searchUrl:d=je,trendingUrl:u=we,telemetrySelectUrl:T=Ae,maxPages:b=Re,initialOpen:W=!1}={}){const[L,E]=a.useState(W),[o,F]=a.useState(""),[I,h]=a.useState([]),[U,v]=a.useState(0),[j,B]=a.useState(!1),[_,w]=a.useState(1),[H,x]=a.useState(!1),[M,V]=a.useState(!1),[$,k]=a.useState(null),[A,R]=a.useState(!1),Z=a.useRef(null),N=a.useRef(null),z=a.useRef(!1),ee=a.useRef(null),te=a.useRef(null),q=a.useRef(new Map),S=a.useRef(null),[,ue]=a.useState(!1),re=a.useMemo(()=>typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform||""),[]),K=a.useRef(o);a.useEffect(()=>{K.current=o},[o]),a.useEffect(()=>{S.current||fetch(u).then(e=>e.json()).then(e=>{S.current=e.trendingSkills??[],ue(!0)}).catch(()=>{})},[u]),a.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]),a.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]),a.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=a.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]);a.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})):[]],ae=a.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=a.useCallback((e,n)=>{if(n&&(ae(n.name),i))try{i(n,K.current.trim())}catch{}if(E(!1),p)try{p(e)}catch{}},[i,p,ae]);a.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 ie="";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 a,j as t}from"./index-fbCfi37A.js";import{a as xe,f as ye}from"./skill-url-DXjZASn-.js";/* empty css */function me(i){return i?i.replace(/<(?!\/?b>)[^>]+>/gi,""):""}function be(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ie(i,p){if(!i)return"";const d=be(i);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(i){return i?i<1e3?String(i):`${(i/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:i,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"}}[i];return b?t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":i,style:{...u,color:b.color,background:b.bg,border:`1px solid ${b.border}`},children:ye(i)}):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(i){var d,u;const p=(d=i.target)==null?void 0:d.tagName;return!!(p==="INPUT"||p==="TEXTAREA"||p==="SELECT"||(u=i.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:i,onNavigate:p,searchUrl:d=je,trendingUrl:u=we,telemetrySelectUrl:T=Ae,maxPages:b=Re,initialOpen:W=!1}={}){const[L,E]=a.useState(W),[o,F]=a.useState(""),[I,h]=a.useState([]),[U,v]=a.useState(0),[j,B]=a.useState(!1),[_,w]=a.useState(1),[H,x]=a.useState(!1),[M,V]=a.useState(!1),[$,k]=a.useState(null),[A,R]=a.useState(!1),Z=a.useRef(null),N=a.useRef(null),z=a.useRef(!1),ee=a.useRef(null),te=a.useRef(null),q=a.useRef(new Map),S=a.useRef(null),[,ue]=a.useState(!1),re=a.useMemo(()=>typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform||""),[]),K=a.useRef(o);a.useEffect(()=>{K.current=o},[o]),a.useEffect(()=>{S.current||fetch(u).then(e=>e.json()).then(e=>{S.current=e.trendingSkills??[],ue(!0)}).catch(()=>{})},[u]),a.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]),a.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]),a.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=a.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]);a.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})):[]],ae=a.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=a.useCallback((e,n)=>{if(n&&(ae(n.name),i))try{i(n,K.current.trim())}catch{}if(E(!1),p)try{p(e)}catch{}},[i,p,ae]);a.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 ie="";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; }
@@ -1 +1 @@
1
- import{j as e,r as l}from"./index-DlZduKAT.js";import{s as C,T as M}from"./skill-url-BpZjDR8A.js";/* empty css */const z={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 P({tier:t}){const s=z[t]??z.T1;return e.jsxs("span",{"data-testid":"trust-badge","data-tier":t,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:s.cssVar,backgroundColor:`color-mix(in srgb, ${s.cssVar} 10%, transparent)`,border:`1px solid color-mix(in srgb, ${s.cssVar} 25%, transparent)`,lineHeight:1,height:"22px"},children:[t," ",s.label]})}const W=/^https?:\/\/github\.com\/([a-zA-Z0-9_.-]+)\/([a-zA-Z0-9_.-]+?)(\.git)?(\/.*)?$/;function H(t){var g,x;const o=t.trim().match(W);if(!o)return null;const d=(g=o[1])==null?void 0:g.toLowerCase();let r=(x=o[2])==null?void 0:x.toLowerCase();if(!d||!r)return null;r=r.replace(/\.git$/,"");const m=`https://github.com/${d}/${r}`;return{owner:d,name:r,url:m}}function K({repoUrl:t,mono:s="var(--font-geist-mono)",fontSize:o="0.75rem",showPlaceholder:d=!0}){if(!t)return d?e.jsx("span",{style:{color:"var(--text-faint)",fontSize:o},children:"--"}):null;const r=H(t);return r?e.jsxs("a",{"data-testid":"repo-link",href:r.url,target:"_blank",rel:"noopener noreferrer",onClick:m=>m.stopPropagation(),style:{color:"#0D9488",textDecoration:"none",fontSize:o,fontFamily:s},children:[r.owner,"/",r.name]}):e.jsx("span",{style:{color:"var(--text-faint)",fontSize:o,fontFamily:s},children:t})}const q="var(--font-geist-mono)",G={ONLINE:"var(--status-success-text)",OFFLINE:"var(--status-danger-text)",STALE:"var(--status-neutral-text)"},Z={ONLINE:"var(--status-success-bg)",OFFLINE:"var(--status-danger-bg)",STALE:"var(--status-neutral-bg)"};function X({skillName:t,repoUrl:s}){const[o,d]=l.useState(null),[r,m]=l.useState(!1);if(l.useEffect(()=>{s&&(m(!0),fetch(C(t,"repo-health")).then(h=>{if(!h.ok)throw new Error("fetch failed");return h.json()}).then(h=>{d(h.status),m(!1)}).catch(()=>{d(null),m(!1)}))},[t,s]),!s)return null;if(r)return e.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(!o||o==="UNKNOWN")return null;const g=G[o]??"var(--status-neutral-text)",x=Z[o]??"var(--status-neutral-bg)";return e.jsx("span",{"data-testid":"repo-health-badge",style:{fontFamily:q,fontSize:"0.75rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",padding:"0.2rem 0.6rem",borderRadius:"999px",backgroundColor:x,color:g,whiteSpace:"nowrap"},children:o})}function Y({children:t,compact:s}){return e.jsx("pre",{"data-testid":"terminal-block",style:{background:"var(--bg-code)",color:"#E6EDF3",fontFamily:"var(--font-geist-mono)",fontSize:s?"0.8rem":"0.875rem",lineHeight:1.6,padding:s?"1rem 1.25rem":"1.5rem 2rem",borderRadius:"6px",overflowX:"auto",margin:0},children:t})}const J="/api/v1/studio/telemetry/install-copy",Q=/^[a-zA-Z0-9._@/-]+$/,ee=/^[a-zA-Z0-9._-]+$/,te="https://verified-skill.com";function re(t){return`${t.owner}/${t.repo}/${t.slug}`}function ne(t,s){return t!=null&&t.ownerSlug&&(t!=null&&t.repoSlug)?`${t.ownerSlug}/${t.repoSlug}`:t!=null&&t.publisher?t.publisher:`${s.owner}/${s.repo}`}function se(t,s,o){const d=o?`${t}/${s}@${o}`:`${t}/${s}`;return Q.test(`${t}/${s}`)?o&&!ee.test(o)?{ok:!1,reason:"Invalid version identifier"}:{ok:!0,command:`vskill install ${d}`}:{ok:!1,reason:"Invalid skill identifier"}}function oe(t,s,o){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,kind:s,durationMs:o,severity:s==="error"?"error":"info"}}))}async function ie(t){var s;if(typeof navigator<"u"&&((s=navigator.clipboard)!=null&&s.writeText))try{return await navigator.clipboard.writeText(t),!0}catch{}if(typeof document>"u")return!1;try{const o=document.createElement("textarea");o.value=t,o.setAttribute("readonly",""),o.style.position="fixed",o.style.left="-9999px",document.body.appendChild(o),o.select();const d=document.execCommand("copy");return document.body.removeChild(o),d}catch{return!1}}function ae(t,s){try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),keepalive:!0}).catch(()=>{})}catch{}}function ue({selectedSkill:t,onClose:s,telemetryInstallCopyUrl:o=J,onToast:d}){const[r,m]=l.useState(null),[g,x]=l.useState([]),[h,E]=l.useState(!0),[T,$]=l.useState(null),[u,I]=l.useState(null),[D,B]=l.useState(0),F=l.useRef(null),A=l.useRef(null),L=l.useRef(null),y=re(t);l.useEffect(()=>(L.current=document.activeElement??null,()=>{const n=L.current;if(n&&typeof n.focus=="function")try{n.focus()}catch{}}),[]),l.useEffect(()=>{const n=setTimeout(()=>{var i;return(i=A.current)==null?void 0:i.focus()},50);return()=>clearTimeout(n)},[]),l.useEffect(()=>{let n=!1;E(!0),$(null);const i=C(y),p=C(y,"versions");return Promise.all([fetch(i).then(async a=>{if(!a.ok)throw new Error(`metadata ${a.status}`);return a.json()}),fetch(p).then(async a=>{if(!a.ok)throw new Error(`versions ${a.status}`);const c=await a.json();return Array.isArray(c)?c:(c==null?void 0:c.versions)??[]})]).then(([a,c])=>{if(n)return;m(a),x(c);const k=c.find(w=>w.isLatest)??c[0]??null;I(k?k.version:null),E(!1)}).catch(a=>{n||($(a instanceof Error?a.message:String(a)),E(!1))}),()=>{n=!0}},[y,D]),l.useEffect(()=>{function n(i){if(i.key==="Escape")i.stopPropagation(),R();else if(i.key==="Tab"){const p=F.current;if(!p)return;const a=p.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(a.length===0)return;const c=a[0],k=a[a.length-1],w=document.activeElement;i.shiftKey&&w===c?(i.preventDefault(),k.focus()):!i.shiftKey&&w===k&&(i.preventDefault(),c.focus())}}return window.addEventListener("keydown",n,!0),()=>window.removeEventListener("keydown",n,!0)},[]);const R=l.useCallback(()=>{s();let n="";try{typeof window<"u"&&window.sessionStorage&&(n=window.sessionStorage.getItem("find-skills:last-query")??"")}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("openFindSkills",{detail:{query:n}}))},[s]),S=ne(r,t),b=(r==null?void 0:r.skillSlug)??t.slug,N=(r==null?void 0:r.displayName)??t.displayName??b,_=(r==null?void 0:r.isBlocked)===!0,v=l.useMemo(()=>g.length===0?[]:[...g].sort((i,p)=>{const a=i.publishedAt?Date.parse(i.publishedAt):0;return(p.publishedAt?Date.parse(p.publishedAt):0)-a}).slice(0,5),[g]),j=l.useMemo(()=>!u||v.length===0?!0:v[0].version===u,[u,v]),f=l.useMemo(()=>u?se(S,b,j?null:u):null,[S,b,u,j]),V=l.useCallback(async()=>{if(!f||!f.ok)return;const n=await ie(f.command);ae(o,{skillName:y,version:u??"",q:"",ts:Date.now()});const i=n?`Run vskill install ${S}/${b}${j?"":`@${u}`} in your terminal`:"Copy failed — please copy the command manually.";if(d)try{d(i,n?"success":"error")}catch{}else oe(i,n?"success":"error",3500)},[f,o,y,u,S,b,j,d]),O=(r==null?void 0:r.trustTier)??"T1",U=(r==null?void 0:r.certTier)==="CERTIFIED"||(r==null?void 0:r.certTier)==="VERIFIED"?r.certTier:"VERIFIED";return e.jsxs("div",{ref:F,"data-testid":"skill-detail-panel",role:"dialog","aria-modal":"true","aria-label":`Skill detail — ${N}`,style:{position:"fixed",inset:0,zIndex:9998,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"min(10vh, 80px)"},onClick:n=>{n.target===n.currentTarget&&R()},children:[e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",backdropFilter:"blur(4px)"}}),e.jsxs("div",{onClick:n=>n.stopPropagation(),style:{position:"relative",width:"100%",maxWidth:720,margin:"0 1rem",background:"var(--bg)",borderRadius:"8px",border:"1px solid var(--border)",boxShadow:"0 20px 60px rgba(0,0,0,0.15)",overflow:"hidden",maxHeight:"80vh",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"0.75rem 1rem",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},children:[e.jsx("button",{ref:A,type:"button",onClick:R,"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)"},children:"← Back to results"}),e.jsx("kbd",{style:{fontFamily:"var(--font-mono, monospace)",fontSize:11,color:"var(--text-faint)",border:"1px solid var(--border)",borderRadius:4,padding:"1px 5px"},children:"Esc"})]}),e.jsxs("div",{style:{overflowY:"auto",padding:"1rem",flex:1},children:[h&&e.jsx("div",{"data-testid":"skill-detail-loading",style:{padding:"2rem",textAlign:"center",color:"var(--text-faint)"},children:"Loading…"}),T&&!h&&e.jsxs("div",{"data-testid":"skill-detail-error",style:{padding:"1.5rem",textAlign:"center",fontFamily:"var(--font-mono, monospace)",fontSize:"0.875rem",color:"var(--status-danger-text)"},children:[e.jsxs("div",{style:{marginBottom:"0.75rem"},children:["Failed to load skill: ",T]}),e.jsx("button",{"data-testid":"skill-detail-retry",onClick:()=>B(n=>n+1),style:{fontFamily:"var(--font-mono, monospace)",fontSize:"0.8125rem",padding:"0.4rem 1rem",borderRadius:4,border:"1px solid var(--border)",background:"transparent",color:"var(--text)",cursor:"pointer"},children:"Retry"})]}),!h&&!T&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{"data-testid":"skill-detail-hero",style:{marginBottom:"1.25rem"},children:[e.jsx("h2",{style:{margin:"0 0 0.5rem",fontSize:"1.25rem",fontWeight:600},children:N}),(r==null?void 0:r.description)&&e.jsx("p",{style:{margin:"0 0 0.75rem",color:"var(--text-secondary)",fontSize:"0.875rem",lineHeight:1.5},children:r.description}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.5rem",alignItems:"center"},children:[e.jsx(P,{tier:O}),e.jsx(M,{tier:U,isTainted:r==null?void 0:r.isTainted}),e.jsx(K,{repoUrl:(r==null?void 0:r.repoUrl)??null}),e.jsx(X,{skillName:y,repoUrl:r==null?void 0:r.repoUrl})]})]}),e.jsxs("section",{"data-testid":"skill-detail-versions",style:{marginBottom:"1.25rem"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-faint)"},children:"Versions"}),v.length===0?e.jsx("div",{style:{color:"var(--text-faint)",fontSize:"0.8125rem"},children:"No versions found."}):e.jsx("ul",{style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:4},children:v.map(n=>{const i=n.version===u,p=n.publishedAt?n.publishedAt.slice(0,10):"",a=n.authorEmail??n.author??"";return e.jsx("li",{children:e.jsxs("button",{type:"button","data-testid":"skill-detail-version-row","data-version":n.version,"data-selected":i?"true":"false","aria-pressed":i,onClick:()=>I(n.version),style:{width:"100%",textAlign:"left",padding:"0.5rem 0.75rem",borderRadius:4,border:i?"1px solid var(--link-accent, #0d9488)":"1px solid var(--border)",background:i?"color-mix(in srgb, var(--link-accent, #0d9488) 8%, transparent)":"transparent",cursor:"pointer",fontFamily:"var(--font-mono, monospace)",fontSize:"0.8125rem",color:"var(--text)",display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx("span",{"aria-hidden":"true",style:{width:14,display:"inline-flex",justifyContent:"center"},children:i?"●":"○"}),e.jsxs("span",{style:{fontWeight:600},children:["v",n.version]}),p&&e.jsxs("span",{style:{color:"var(--text-faint)"},children:["· ",p]}),a&&e.jsxs("span",{style:{color:"var(--text-faint)"},children:["· ",a]}),i&&e.jsx("span",{"data-testid":"skill-detail-version-selected-tag",style:{marginLeft:"auto",fontSize:"0.6875rem",color:"var(--link-accent, #0d9488)"},children:"Selected"})]})},n.version)})}),e.jsx("div",{style:{marginTop:"0.5rem",textAlign:"right"},children:e.jsx("a",{"data-testid":"skill-detail-see-all-versions",href:`${te}/skills/${t.owner}/${t.repo}/${t.slug}/versions`,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--font-mono, monospace)",fontSize:"0.75rem",color:"var(--link-accent, #0d9488)",textDecoration:"none"},children:"see all versions →"})})]}),_?e.jsxs("section",{"data-testid":"skill-detail-blocked",style:{marginBottom:"0.5rem"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--status-danger-text)"},children:"This skill is blocked"}),e.jsx("div",{style:{padding:"1rem",borderRadius:6,border:"1px solid var(--status-danger-border)",background:"var(--status-danger-bg)",color:"var(--status-danger-text)",fontSize:"0.875rem"},children:(r==null?void 0:r.blockReason)??"This skill has been blocked by platform moderators and cannot be installed."})]}):f&&!f.ok?e.jsxs("section",{"data-testid":"skill-detail-install-error",style:{marginBottom:"0.5rem"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--status-danger-text)"},children:"Install command unavailable"}),e.jsxs("div",{style:{padding:"1rem",borderRadius:6,border:"1px solid var(--status-danger-border)",background:"var(--status-danger-bg)",color:"var(--status-danger-text)",fontSize:"0.875rem"},children:[f.reason," — refusing to render the install panel for safety."]})]}):f&&f.ok?e.jsxs("section",{"data-testid":"skill-detail-install",style:{marginBottom:"0.5rem"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-faint)"},children:"Install"}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"stretch"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(Y,{compact:!0,children:e.jsx("span",{"data-testid":"skill-detail-install-command",children:f.command})})}),e.jsx("button",{type:"button",onClick:V,"data-testid":"skill-detail-copy","aria-label":"Copy install command",style:{flexShrink:0,padding:"0 1rem",borderRadius:6,border:"1px solid var(--border)",background:"var(--bg)",color:"var(--text)",cursor:"pointer",fontFamily:"var(--font-mono, monospace)",fontSize:"0.8125rem"},children:"Copy"})]})]}):null]})]})]})]})}export{ue as SkillDetailPanel,ue as default};
1
+ import{j as e,r as l}from"./index-fbCfi37A.js";import{s as C,T as M}from"./skill-url-DXjZASn-.js";/* empty css */const z={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 P({tier:t}){const s=z[t]??z.T1;return e.jsxs("span",{"data-testid":"trust-badge","data-tier":t,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:s.cssVar,backgroundColor:`color-mix(in srgb, ${s.cssVar} 10%, transparent)`,border:`1px solid color-mix(in srgb, ${s.cssVar} 25%, transparent)`,lineHeight:1,height:"22px"},children:[t," ",s.label]})}const W=/^https?:\/\/github\.com\/([a-zA-Z0-9_.-]+)\/([a-zA-Z0-9_.-]+?)(\.git)?(\/.*)?$/;function H(t){var g,x;const o=t.trim().match(W);if(!o)return null;const d=(g=o[1])==null?void 0:g.toLowerCase();let r=(x=o[2])==null?void 0:x.toLowerCase();if(!d||!r)return null;r=r.replace(/\.git$/,"");const m=`https://github.com/${d}/${r}`;return{owner:d,name:r,url:m}}function K({repoUrl:t,mono:s="var(--font-geist-mono)",fontSize:o="0.75rem",showPlaceholder:d=!0}){if(!t)return d?e.jsx("span",{style:{color:"var(--text-faint)",fontSize:o},children:"--"}):null;const r=H(t);return r?e.jsxs("a",{"data-testid":"repo-link",href:r.url,target:"_blank",rel:"noopener noreferrer",onClick:m=>m.stopPropagation(),style:{color:"#0D9488",textDecoration:"none",fontSize:o,fontFamily:s},children:[r.owner,"/",r.name]}):e.jsx("span",{style:{color:"var(--text-faint)",fontSize:o,fontFamily:s},children:t})}const q="var(--font-geist-mono)",G={ONLINE:"var(--status-success-text)",OFFLINE:"var(--status-danger-text)",STALE:"var(--status-neutral-text)"},Z={ONLINE:"var(--status-success-bg)",OFFLINE:"var(--status-danger-bg)",STALE:"var(--status-neutral-bg)"};function X({skillName:t,repoUrl:s}){const[o,d]=l.useState(null),[r,m]=l.useState(!1);if(l.useEffect(()=>{s&&(m(!0),fetch(C(t,"repo-health")).then(h=>{if(!h.ok)throw new Error("fetch failed");return h.json()}).then(h=>{d(h.status),m(!1)}).catch(()=>{d(null),m(!1)}))},[t,s]),!s)return null;if(r)return e.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(!o||o==="UNKNOWN")return null;const g=G[o]??"var(--status-neutral-text)",x=Z[o]??"var(--status-neutral-bg)";return e.jsx("span",{"data-testid":"repo-health-badge",style:{fontFamily:q,fontSize:"0.75rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",padding:"0.2rem 0.6rem",borderRadius:"999px",backgroundColor:x,color:g,whiteSpace:"nowrap"},children:o})}function Y({children:t,compact:s}){return e.jsx("pre",{"data-testid":"terminal-block",style:{background:"var(--bg-code)",color:"#E6EDF3",fontFamily:"var(--font-geist-mono)",fontSize:s?"0.8rem":"0.875rem",lineHeight:1.6,padding:s?"1rem 1.25rem":"1.5rem 2rem",borderRadius:"6px",overflowX:"auto",margin:0},children:t})}const J="/api/v1/studio/telemetry/install-copy",Q=/^[a-zA-Z0-9._@/-]+$/,ee=/^[a-zA-Z0-9._-]+$/,te="https://verified-skill.com";function re(t){return`${t.owner}/${t.repo}/${t.slug}`}function ne(t,s){return t!=null&&t.ownerSlug&&(t!=null&&t.repoSlug)?`${t.ownerSlug}/${t.repoSlug}`:t!=null&&t.publisher?t.publisher:`${s.owner}/${s.repo}`}function se(t,s,o){const d=o?`${t}/${s}@${o}`:`${t}/${s}`;return Q.test(`${t}/${s}`)?o&&!ee.test(o)?{ok:!1,reason:"Invalid version identifier"}:{ok:!0,command:`vskill install ${d}`}:{ok:!1,reason:"Invalid skill identifier"}}function oe(t,s,o){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,kind:s,durationMs:o,severity:s==="error"?"error":"info"}}))}async function ie(t){var s;if(typeof navigator<"u"&&((s=navigator.clipboard)!=null&&s.writeText))try{return await navigator.clipboard.writeText(t),!0}catch{}if(typeof document>"u")return!1;try{const o=document.createElement("textarea");o.value=t,o.setAttribute("readonly",""),o.style.position="fixed",o.style.left="-9999px",document.body.appendChild(o),o.select();const d=document.execCommand("copy");return document.body.removeChild(o),d}catch{return!1}}function ae(t,s){try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),keepalive:!0}).catch(()=>{})}catch{}}function ue({selectedSkill:t,onClose:s,telemetryInstallCopyUrl:o=J,onToast:d}){const[r,m]=l.useState(null),[g,x]=l.useState([]),[h,E]=l.useState(!0),[T,$]=l.useState(null),[u,I]=l.useState(null),[D,B]=l.useState(0),F=l.useRef(null),A=l.useRef(null),L=l.useRef(null),y=re(t);l.useEffect(()=>(L.current=document.activeElement??null,()=>{const n=L.current;if(n&&typeof n.focus=="function")try{n.focus()}catch{}}),[]),l.useEffect(()=>{const n=setTimeout(()=>{var i;return(i=A.current)==null?void 0:i.focus()},50);return()=>clearTimeout(n)},[]),l.useEffect(()=>{let n=!1;E(!0),$(null);const i=C(y),p=C(y,"versions");return Promise.all([fetch(i).then(async a=>{if(!a.ok)throw new Error(`metadata ${a.status}`);return a.json()}),fetch(p).then(async a=>{if(!a.ok)throw new Error(`versions ${a.status}`);const c=await a.json();return Array.isArray(c)?c:(c==null?void 0:c.versions)??[]})]).then(([a,c])=>{if(n)return;m(a),x(c);const k=c.find(w=>w.isLatest)??c[0]??null;I(k?k.version:null),E(!1)}).catch(a=>{n||($(a instanceof Error?a.message:String(a)),E(!1))}),()=>{n=!0}},[y,D]),l.useEffect(()=>{function n(i){if(i.key==="Escape")i.stopPropagation(),R();else if(i.key==="Tab"){const p=F.current;if(!p)return;const a=p.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(a.length===0)return;const c=a[0],k=a[a.length-1],w=document.activeElement;i.shiftKey&&w===c?(i.preventDefault(),k.focus()):!i.shiftKey&&w===k&&(i.preventDefault(),c.focus())}}return window.addEventListener("keydown",n,!0),()=>window.removeEventListener("keydown",n,!0)},[]);const R=l.useCallback(()=>{s();let n="";try{typeof window<"u"&&window.sessionStorage&&(n=window.sessionStorage.getItem("find-skills:last-query")??"")}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("openFindSkills",{detail:{query:n}}))},[s]),S=ne(r,t),b=(r==null?void 0:r.skillSlug)??t.slug,N=(r==null?void 0:r.displayName)??t.displayName??b,_=(r==null?void 0:r.isBlocked)===!0,v=l.useMemo(()=>g.length===0?[]:[...g].sort((i,p)=>{const a=i.publishedAt?Date.parse(i.publishedAt):0;return(p.publishedAt?Date.parse(p.publishedAt):0)-a}).slice(0,5),[g]),j=l.useMemo(()=>!u||v.length===0?!0:v[0].version===u,[u,v]),f=l.useMemo(()=>u?se(S,b,j?null:u):null,[S,b,u,j]),V=l.useCallback(async()=>{if(!f||!f.ok)return;const n=await ie(f.command);ae(o,{skillName:y,version:u??"",q:"",ts:Date.now()});const i=n?`Run vskill install ${S}/${b}${j?"":`@${u}`} in your terminal`:"Copy failed — please copy the command manually.";if(d)try{d(i,n?"success":"error")}catch{}else oe(i,n?"success":"error",3500)},[f,o,y,u,S,b,j,d]),O=(r==null?void 0:r.trustTier)??"T1",U=(r==null?void 0:r.certTier)==="CERTIFIED"||(r==null?void 0:r.certTier)==="VERIFIED"?r.certTier:"VERIFIED";return e.jsxs("div",{ref:F,"data-testid":"skill-detail-panel",role:"dialog","aria-modal":"true","aria-label":`Skill detail — ${N}`,style:{position:"fixed",inset:0,zIndex:9998,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"min(10vh, 80px)"},onClick:n=>{n.target===n.currentTarget&&R()},children:[e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",backdropFilter:"blur(4px)"}}),e.jsxs("div",{onClick:n=>n.stopPropagation(),style:{position:"relative",width:"100%",maxWidth:720,margin:"0 1rem",background:"var(--bg)",borderRadius:"8px",border:"1px solid var(--border)",boxShadow:"0 20px 60px rgba(0,0,0,0.15)",overflow:"hidden",maxHeight:"80vh",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"0.75rem 1rem",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},children:[e.jsx("button",{ref:A,type:"button",onClick:R,"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)"},children:"← Back to results"}),e.jsx("kbd",{style:{fontFamily:"var(--font-mono, monospace)",fontSize:11,color:"var(--text-faint)",border:"1px solid var(--border)",borderRadius:4,padding:"1px 5px"},children:"Esc"})]}),e.jsxs("div",{style:{overflowY:"auto",padding:"1rem",flex:1},children:[h&&e.jsx("div",{"data-testid":"skill-detail-loading",style:{padding:"2rem",textAlign:"center",color:"var(--text-faint)"},children:"Loading…"}),T&&!h&&e.jsxs("div",{"data-testid":"skill-detail-error",style:{padding:"1.5rem",textAlign:"center",fontFamily:"var(--font-mono, monospace)",fontSize:"0.875rem",color:"var(--status-danger-text)"},children:[e.jsxs("div",{style:{marginBottom:"0.75rem"},children:["Failed to load skill: ",T]}),e.jsx("button",{"data-testid":"skill-detail-retry",onClick:()=>B(n=>n+1),style:{fontFamily:"var(--font-mono, monospace)",fontSize:"0.8125rem",padding:"0.4rem 1rem",borderRadius:4,border:"1px solid var(--border)",background:"transparent",color:"var(--text)",cursor:"pointer"},children:"Retry"})]}),!h&&!T&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{"data-testid":"skill-detail-hero",style:{marginBottom:"1.25rem"},children:[e.jsx("h2",{style:{margin:"0 0 0.5rem",fontSize:"1.25rem",fontWeight:600},children:N}),(r==null?void 0:r.description)&&e.jsx("p",{style:{margin:"0 0 0.75rem",color:"var(--text-secondary)",fontSize:"0.875rem",lineHeight:1.5},children:r.description}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.5rem",alignItems:"center"},children:[e.jsx(P,{tier:O}),e.jsx(M,{tier:U,isTainted:r==null?void 0:r.isTainted}),e.jsx(K,{repoUrl:(r==null?void 0:r.repoUrl)??null}),e.jsx(X,{skillName:y,repoUrl:r==null?void 0:r.repoUrl})]})]}),e.jsxs("section",{"data-testid":"skill-detail-versions",style:{marginBottom:"1.25rem"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-faint)"},children:"Versions"}),v.length===0?e.jsx("div",{style:{color:"var(--text-faint)",fontSize:"0.8125rem"},children:"No versions found."}):e.jsx("ul",{style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:4},children:v.map(n=>{const i=n.version===u,p=n.publishedAt?n.publishedAt.slice(0,10):"",a=n.authorEmail??n.author??"";return e.jsx("li",{children:e.jsxs("button",{type:"button","data-testid":"skill-detail-version-row","data-version":n.version,"data-selected":i?"true":"false","aria-pressed":i,onClick:()=>I(n.version),style:{width:"100%",textAlign:"left",padding:"0.5rem 0.75rem",borderRadius:4,border:i?"1px solid var(--link-accent, #0d9488)":"1px solid var(--border)",background:i?"color-mix(in srgb, var(--link-accent, #0d9488) 8%, transparent)":"transparent",cursor:"pointer",fontFamily:"var(--font-mono, monospace)",fontSize:"0.8125rem",color:"var(--text)",display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx("span",{"aria-hidden":"true",style:{width:14,display:"inline-flex",justifyContent:"center"},children:i?"●":"○"}),e.jsxs("span",{style:{fontWeight:600},children:["v",n.version]}),p&&e.jsxs("span",{style:{color:"var(--text-faint)"},children:["· ",p]}),a&&e.jsxs("span",{style:{color:"var(--text-faint)"},children:["· ",a]}),i&&e.jsx("span",{"data-testid":"skill-detail-version-selected-tag",style:{marginLeft:"auto",fontSize:"0.6875rem",color:"var(--link-accent, #0d9488)"},children:"Selected"})]})},n.version)})}),e.jsx("div",{style:{marginTop:"0.5rem",textAlign:"right"},children:e.jsx("a",{"data-testid":"skill-detail-see-all-versions",href:`${te}/skills/${t.owner}/${t.repo}/${t.slug}/versions`,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--font-mono, monospace)",fontSize:"0.75rem",color:"var(--link-accent, #0d9488)",textDecoration:"none"},children:"see all versions →"})})]}),_?e.jsxs("section",{"data-testid":"skill-detail-blocked",style:{marginBottom:"0.5rem"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--status-danger-text)"},children:"This skill is blocked"}),e.jsx("div",{style:{padding:"1rem",borderRadius:6,border:"1px solid var(--status-danger-border)",background:"var(--status-danger-bg)",color:"var(--status-danger-text)",fontSize:"0.875rem"},children:(r==null?void 0:r.blockReason)??"This skill has been blocked by platform moderators and cannot be installed."})]}):f&&!f.ok?e.jsxs("section",{"data-testid":"skill-detail-install-error",style:{marginBottom:"0.5rem"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--status-danger-text)"},children:"Install command unavailable"}),e.jsxs("div",{style:{padding:"1rem",borderRadius:6,border:"1px solid var(--status-danger-border)",background:"var(--status-danger-bg)",color:"var(--status-danger-text)",fontSize:"0.875rem"},children:[f.reason," — refusing to render the install panel for safety."]})]}):f&&f.ok?e.jsxs("section",{"data-testid":"skill-detail-install",style:{marginBottom:"0.5rem"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem",fontSize:"0.8125rem",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-faint)"},children:"Install"}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"stretch"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(Y,{compact:!0,children:e.jsx("span",{"data-testid":"skill-detail-install-command",children:f.command})})}),e.jsx("button",{type:"button",onClick:V,"data-testid":"skill-detail-copy","aria-label":"Copy install command",style:{flexShrink:0,padding:"0 1rem",borderRadius:6,border:"1px solid var(--border)",background:"var(--bg)",color:"var(--text)",cursor:"pointer",fontFamily:"var(--font-mono, monospace)",fontSize:"0.8125rem"},children:"Copy"})]})]}):null]})]})]})]})}export{ue as SkillDetailPanel,ue as default};
@@ -1 +1 @@
1
- import{r as h,e as $,j as a,f as N}from"./index-DlZduKAT.js";/* empty css */function U(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 E={major:{bg:"var(--red-muted)",text:"var(--red)"},minor:{bg:"var(--yellow-muted)",text:"var(--yellow)"},patch:{bg:"var(--green-muted)",text:"var(--green)"}},L=["project","personal","plugin"];function M(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=L.filter(n=>c.some(g=>g.scope===n)).join(" + "),m=Array.from(new Set(c.map(n=>n.agentLabel))).sort((n,g)=>n.localeCompare(g)).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(g=>g.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 T({updates:l,isRefreshing:d,onRefresh:c,onSelectSkill:u,onViewAll:w,onClose:f,anchorRef:r,diffSummariesById:m}){const p=h.useRef(null),y=h.useRef(null);h.useEffect(()=>{var e;(e=y.current)==null||e.focus()},[]),h.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]),h.useEffect(()=>{function e(s){var x;s.key==="Escape"&&(s.preventDefault(),f(),(x=r==null?void 0:r.current)==null||x.focus())}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[f,r]);const i=l.filter(e=>e.updateAvailable),{toast:n}=$(),[g,j]=h.useState(()=>new Set);async function S(e){const s=e.installLocations??[],x=s.filter(t=>!t.readonly);if(s.length>0&&x.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(!g.has(e.name)){j(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]),v=e.localSkill??t[t.length-1],b=await N.postSkillUpdate(o,v);if(b.ok){const k=x.length||1;n({severity:"success",message:`Updated ${v} in ${k} ${k===1?"location":"locations"}.`,durationMs:4e3})}else n({severity:"error",message:`Couldn't update ${v} — HTTP ${b.status}`,durationMs:0})}catch(t){const o=t instanceof Error?t.message:"Network error";n({severity:"error",message:`Update failed: ${o}`,durationMs:0})}finally{j(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:320,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 x=e.latest?U(e.installed,e.latest):"patch",t=E[x],o=m==null?void 0:m.get(e.name),v=M(e.installLocations??[],{pinned:e.pinned??!1}),b=g.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":x,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:v,onClick:()=>{S(e)},disabled:b,style:{flexShrink:0,padding:"0 10px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:b?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:11,fontWeight:500},children:b?"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{T as default};
1
+ import{r as h,e as $,j as a,f as N}from"./index-fbCfi37A.js";/* empty css */function U(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 E={major:{bg:"var(--red-muted)",text:"var(--red)"},minor:{bg:"var(--yellow-muted)",text:"var(--yellow)"},patch:{bg:"var(--green-muted)",text:"var(--green)"}},L=["project","personal","plugin"];function M(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=L.filter(n=>c.some(g=>g.scope===n)).join(" + "),m=Array.from(new Set(c.map(n=>n.agentLabel))).sort((n,g)=>n.localeCompare(g)).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(g=>g.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 T({updates:l,isRefreshing:d,onRefresh:c,onSelectSkill:u,onViewAll:w,onClose:f,anchorRef:r,diffSummariesById:m}){const p=h.useRef(null),y=h.useRef(null);h.useEffect(()=>{var e;(e=y.current)==null||e.focus()},[]),h.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]),h.useEffect(()=>{function e(s){var x;s.key==="Escape"&&(s.preventDefault(),f(),(x=r==null?void 0:r.current)==null||x.focus())}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[f,r]);const i=l.filter(e=>e.updateAvailable),{toast:n}=$(),[g,j]=h.useState(()=>new Set);async function S(e){const s=e.installLocations??[],x=s.filter(t=>!t.readonly);if(s.length>0&&x.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(!g.has(e.name)){j(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]),v=e.localSkill??t[t.length-1],b=await N.postSkillUpdate(o,v);if(b.ok){const k=x.length||1;n({severity:"success",message:`Updated ${v} in ${k} ${k===1?"location":"locations"}.`,durationMs:4e3})}else n({severity:"error",message:`Couldn't update ${v} — HTTP ${b.status}`,durationMs:0})}catch(t){const o=t instanceof Error?t.message:"Network error";n({severity:"error",message:`Update failed: ${o}`,durationMs:0})}finally{j(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:320,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 x=e.latest?U(e.installed,e.latest):"patch",t=E[x],o=m==null?void 0:m.get(e.name),v=M(e.installLocations??[],{pinned:e.pinned??!1}),b=g.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":x,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:v,onClick:()=>{S(e)},disabled:b,style:{flexShrink:0,padding:"0 10px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:b?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:11,fontWeight:500},children:b?"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{T as default};