vskill 0.5.128 → 0.5.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -659
- package/agents.json +1 -1
- package/dist/eval-server/eval-server.js +2 -0
- package/dist/eval-server/eval-server.js.map +1 -1
- package/dist/eval-server/git-routes.d.ts +5 -0
- package/dist/eval-server/git-routes.js +172 -0
- package/dist/eval-server/git-routes.js.map +1 -0
- package/dist/eval-server/router.d.ts +2 -0
- package/dist/eval-server/router.js +3 -1
- package/dist/eval-server/router.js.map +1 -1
- package/dist/eval-server/skill-name-resolver.d.ts +13 -0
- package/dist/eval-server/skill-name-resolver.js +47 -0
- package/dist/eval-server/skill-name-resolver.js.map +1 -1
- package/dist/eval-ui/assets/{CommandPalette-D_MdwCki.js → CommandPalette-BIjKkHCC.js} +1 -1
- package/dist/eval-ui/assets/{CreateSkillPage-lLACfsOZ.js → CreateSkillPage-CmV0WZOn.js} +1 -1
- package/dist/eval-ui/assets/{FindSkillsPalette-VTksFrSO.js → FindSkillsPalette-BtYgEsVD.js} +2 -2
- package/dist/eval-ui/assets/{SearchPaletteCore-D49bVafl.js → SearchPaletteCore-CAEO357X.js} +1 -1
- package/dist/eval-ui/assets/{SkillDetailPanel-Cg8lyDAl.js → SkillDetailPanel-AH9wV3VU.js} +1 -1
- package/dist/eval-ui/assets/{UpdateDropdown-CLt94M3u.js → UpdateDropdown-BwMxB2Ub.js} +1 -1
- package/dist/eval-ui/assets/{index-fbCfi37A.js → index-ZByf-wxl.js} +37 -37
- package/dist/eval-ui/assets/skill-url-C4ekwoGs.js +1 -0
- package/dist/eval-ui/index.html +1 -1
- package/dist/scanner/patterns.js +1 -1
- package/package.json +1 -1
- package/dist/eval-ui/assets/skill-url-DXjZASn-.js +0 -1
|
@@ -1 +1 @@
|
|
|
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
|
+
import{j as e,r as l,T as M}from"./index-ZByf-wxl.js";import{s as C}from"./skill-url-C4ekwoGs.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-
|
|
1
|
+
import{r as h,e as $,j as a,f as N}from"./index-ZByf-wxl.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};
|