openskillmd 0.3.0 → 0.3.1

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.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
3
+ import{a as h}from"./chunk-IZJHFL7T.js";import{c as y,e as S}from"./chunk-5CDG6OB7.js";import"./chunk-YAZPI4SK.js";import{f as u,h as c}from"./chunk-ONVELHE6.js";import{l as g,n as k}from"./chunk-OVTYCRA4.js";import{spawn as $}from"child_process";import{createRequire as x}from"module";var w=x(import.meta.url);function b(e){return e.replace(/^.*[█╔╗╚╝═║].*\r?\n?/gm,"").replace(/^.*open agent skills ecosystem.*\r?\n?/gm,"")}function v(e){return!e||typeof e!="string"||e.length===0||e.length>500?{ok:!1,code:2,message:"Source is required, e.g. owner/repo or owner/repo@skill"}:/[/@:.]/.test(e)?{ok:!0}:{ok:!1,code:"needs-resolution",slug:e}}async function A(e){let r;try{r=await S(e)}catch(t){return t instanceof y&&t.statusCode===404?{ok:!1,message:`No skill named "${e}" in the registry.`,suggestion:"Run `osm search <query>` to find it, or pass owner/repo directly."}:{ok:!1,message:`Couldn't reach the registry to resolve "${e}".`,suggestion:"Check your connection (and OPENSKILL_API_URL, if set), or pass owner/repo directly."}}let s=r.name||null;if(r.githubOwner&&r.githubRepo){let t=`${r.githubOwner}/${r.githubRepo}`;return{ok:!0,source:t,skillName:s,note:s?`resolved ${e} \u2192 ${t} (skill: ${s})`:`resolved ${e} \u2192 ${t}`}}return r.sourceUrl&&/^https?:\/\//.test(r.sourceUrl)?{ok:!0,source:r.sourceUrl,skillName:s,note:s?`resolved ${e} \u2192 ${r.sourceUrl} (skill: ${s})`:`resolved ${e} \u2192 ${r.sourceUrl}`}:{ok:!1,message:`"${e}" lives only in the OpenSkill registry \u2014 it has no GitHub source to install from yet.`,suggestion:`Run \`osm info ${e}\` to inspect it.`}}function L(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function O(e,r={},s=null){let t=["add",e,"-y"];if(s){t.push("--skill",s);let n=L(s);n&&n!==s.toLowerCase()&&t.push("--skill",n)}for(let n of r.agent??[])t.push("-a",n);return r.global&&t.push("-g"),r.copy&&t.push("--copy"),t}function j(e,r,s,t,n=null){return s===0?{ok:!0,source:e,resolvedFrom:n,agent:r.agent??null,scope:r.global?"user":"project"}:{ok:!1,source:e,resolvedFrom:n,error:{code:`INSTALL_EXIT_${s}`,message:t.trim()||"install failed"}}}async function T(e,r={}){let s=e,t=null,n=null,i=v(e);if(!i.ok){i.code!=="needs-resolution"&&(console.error(u(i.message,i.suggestion)),process.exit(i.code));let l=r.json?null:h({text:`Resolving "${i.slug}" in the registry...`,spinner:k,color:!1}).start(),o=await A(i.slug);l?.stop(),o.ok||(r.json?c({ok:!1,source:e,resolvedFrom:null,error:{code:"SLUG_RESOLUTION_FAILED",message:o.message}}):console.error(u(o.message,o.suggestion)),process.exit(2)),r.json||console.error(g(` \u2192 ${o.note}`)),s=o.source,t=i.slug,n=o.skillName}let d;try{d=w.resolve("skills/bin/cli.mjs")}catch{console.error(u("The installer backend is missing.","Reinstall @openskillmd/osm to restore its dependencies.")),process.exit(3)}let R=O(s,r,n);r.json||(console.error(g(" \u2192 fetching skill files\u2026")),console.error(""));let a=$(process.execPath,[d,...R],{stdio:["inherit","pipe","pipe"],env:{...process.env,DISABLE_TELEMETRY:"1"}}),p="";a.stdout&&a.stdout.on("data",l=>{let o=b(l.toString("utf-8"));o&&!r.json&&process.stdout.write(o)}),a.stderr&&a.stderr.on("data",l=>{let o=l.toString("utf-8");if(r.json)p+=o;else{let m=b(o);m&&process.stderr.write(m)}});let f=await new Promise(l=>{a.once("exit",o=>l(o??1)),a.once("error",()=>l(3))});r.json&&c(j(s,r,f,p,t)),process.exit(f)}export{T as addCommand,j as buildJsonResult,O as buildSkillsArgs,A as resolveSlug,b as stripSkillsBanner,L as toSkillSlug,v as validateSource};
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
3
+ import{a as d}from"./chunk-IZJHFL7T.js";import{g as C,h as v,i as y,j as S}from"./chunk-5CDG6OB7.js";import{a as g}from"./chunk-MWJMJUS4.js";import"./chunk-YAZPI4SK.js";import{a as f,b as h,d as $,e as l,f as m}from"./chunk-ONVELHE6.js";import{f as n,k as w,l as s,n as u}from"./chunk-OVTYCRA4.js";var p="__exit__";async function _(){try{let{mode:t}=await g.prompt([{type:"list",name:"mode",message:n("What would you like to explore?"),choices:[{name:"\u{1F4DA} Collections (curated sets of skills & blueprints)",value:"collections"},{name:"\u{1F50C} MCP servers",value:"mcp"},{name:s("\u2190 Exit"),value:p}]}]);if(t===p)return;if(t==="mcp"){await k();return}await x()}catch(t){process.stderr.write(m(t instanceof Error?t.message:"Unknown error")+`
4
+ `)}}async function x(){let t=d({text:"Loading collections...",spinner:u,color:!1}).start(),i=await C({limit:50});if(t.stop(),i.length===0){process.stderr.write(m("No collections found.")+`
5
+ `);return}let c=i.map(r=>({name:`${r.icon||"\u{1F4E6}"} ${r.name} ${s(`(${r.itemCount} items)`)}`,value:r.slug}));c.push({name:s("\u2190 Exit"),value:p});let{slug:o}=await g.prompt([{type:"list",name:"slug",message:n("Choose a collection to explore:"),choices:c,pageSize:15}]);if(o===p)return;let e=d({text:"Loading collection...",spinner:u,color:!1}).start(),a=await v(o);e.stop(),M(a)}function M(t){process.stderr.write(l(`${t.icon||"\u{1F4E6}"} ${t.name}`)+`
6
+ `),t.description&&process.stderr.write(` ${w(t.description)}
7
+
8
+ `);let i=t.skills??[],c=t.blueprints??[],o=t.mcpServers??[];if(i.length===0&&c.length===0&&o.length===0){process.stderr.write(s(` This collection is empty.
9
+
10
+ `));return}if(i.length>0){process.stderr.write(l(`Skills (${i.length})`)+`
11
+ `);for(let e of i){let a=e.scoreOverall!=null?h(e.scoreOverall,100):s("--");process.stdout.write(` ${n(e.name)}${f(e.publisher)} ${s("\xB7")} score: ${a} ${s("\xB7")} ${$(e.downloads)} downloads
12
+ `),e.description&&process.stdout.write(` ${s(e.description.slice(0,100))}
13
+ `),process.stdout.write(` ${s(`slug: ${e.slug}`)}
14
+
15
+ `)}}if(c.length>0){process.stderr.write(l(`Blueprints (${c.length})`)+`
16
+ `);for(let e of c)process.stdout.write(` ${n(e.name)}${f(e.publisher)} ${s("\xB7")} ${$(e.downloads)} downloads
17
+ `),e.description&&process.stdout.write(` ${s(e.description.slice(0,100))}
18
+ `),process.stdout.write(` ${s(`slug: ${e.slug}`)}
19
+
20
+ `)}if(o.length>0){process.stderr.write(l(`MCP Servers (${o.length})`)+`
21
+ `);for(let e of o){let a=e.stargazerCount!=null?`\u2605 ${e.stargazerCount}`:"";process.stdout.write(` ${n(e.displayName||e.name)} ${s(a)}
22
+ `),e.description&&process.stdout.write(` ${s(e.description.slice(0,100))}
23
+ `),process.stdout.write(` ${s(`slug: ${e.slug}`)}
24
+
25
+ `)}}process.stderr.write(s(` Run ${n("osm info <slug>")} (skills/blueprints) or ${n("osm mcp info <slug>")} for details.
26
+
27
+ `))}async function k(){let t=d({text:"Loading MCP categories...",spinner:u,color:!1}).start(),i=await S();if(t.stop(),i.length===0){process.stderr.write(m("No MCP server categories found.")+`
28
+ `);return}let c=i.map(r=>({name:`${r.category} ${s(`(${r.count})`)}`,value:r.category}));c.push({name:s("\u2190 Exit"),value:p});let{category:o}=await g.prompt([{type:"list",name:"category",message:n("Choose an MCP category:"),choices:c,pageSize:15}]);if(o===p)return;let e=d({text:"Loading MCP servers...",spinner:u,color:!1}).start(),{data:a}=await y({category:o,limit:50});if(e.stop(),process.stderr.write(l(`MCP Servers \xB7 ${o}`)+`
29
+ `),a.length===0){process.stderr.write(s(` No servers in this category yet.
30
+
31
+ `));return}for(let r of a){let b=r.stargazerCount!=null?`\u2605 ${r.stargazerCount}`:"";process.stdout.write(` ${n(r.displayName||r.name)} ${s(b)}
32
+ `),r.description&&process.stdout.write(` ${s(r.description.slice(0,100))}
33
+ `),process.stdout.write(` ${s(`slug: ${r.slug}`)}
34
+
35
+ `)}process.stderr.write(s(` Run ${n("osm mcp info <slug>")} for details.
36
+
37
+ `))}export{_ as browseCommand};