skill-atlas-cli 0.10.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import e,{readFileSync as t}from"node:fs";import{cac as n}from"cac";import r from"chalk";import{agentRegister as i,checkForUpdate as a,logger as o}from"../lib/index.js";import{createHash as s,randomBytes as c,randomUUID as l}from"node:crypto";import u,{join as d}from"node:path";import f from"semver";import p from"node:os";import{spawn as m}from"node:child_process";import*as h from"@clack/prompts";import g from"axios";import _,{basename as v,dirname as y,join as b,normalize as x,relative as ee,resolve as S,sep as te}from"path";import{existsSync as C,writeFileSync as ne}from"fs";import re,{homedir as ie,platform as ae,tmpdir as oe}from"os";import*as se from"readline";import{Writable as ce}from"stream";import{cp as le,lstat as ue,mkdir as de,readFile as fe,readdir as pe,readlink as me,realpath as he,rename as ge,rm as w,stat as _e,symlink as ve,unlink as ye,writeFile as be}from"fs/promises";import{fileURLToPath as xe}from"url";import{info as Se}from"console";import{execFileSync as Ce}from"child_process";import{createConsola as we}from"consola";import Te from"secp256k1";var Ee=Object.create,De=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,ke=Object.getOwnPropertyNames,Ae=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty,Me=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ne=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ke(t),a=0,o=i.length,s;a<o;a++)s=i[a],!je.call(e,s)&&s!==n&&De(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Oe(t,s))||r.enumerable});return e},Pe=(e,t,n)=>(n=e==null?{}:Ee(Ae(e)),Ne(t||!e||!e.__esModule?De(n,`default`,{value:e,enumerable:!0}):n,e));const T=process.env.SKILLATLAS_CONFIG_DIR||u.join(p.homedir(),`.skillatlas`),Fe=u.join(T,`auth.json`),E=u.join(T,`skillatlas-meta.json`),Ie={production:{apiBase:`https://
|
|
2
|
+
import e,{readFileSync as t}from"node:fs";import{cac as n}from"cac";import r from"chalk";import{agentRegister as i,checkForUpdate as a,logger as o}from"../lib/index.js";import{createHash as s,randomBytes as c,randomUUID as l}from"node:crypto";import u,{join as d}from"node:path";import f from"semver";import p from"node:os";import{spawn as m}from"node:child_process";import*as h from"@clack/prompts";import g from"axios";import _,{basename as v,dirname as y,join as b,normalize as x,relative as ee,resolve as S,sep as te}from"path";import{existsSync as C,writeFileSync as ne}from"fs";import re,{homedir as ie,platform as ae,tmpdir as oe}from"os";import*as se from"readline";import{Writable as ce}from"stream";import{cp as le,lstat as ue,mkdir as de,readFile as fe,readdir as pe,readlink as me,realpath as he,rename as ge,rm as w,stat as _e,symlink as ve,unlink as ye,writeFile as be}from"fs/promises";import{fileURLToPath as xe}from"url";import{info as Se}from"console";import{execFileSync as Ce}from"child_process";import{createConsola as we}from"consola";import Te from"secp256k1";var Ee=Object.create,De=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,ke=Object.getOwnPropertyNames,Ae=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty,Me=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ne=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ke(t),a=0,o=i.length,s;a<o;a++)s=i[a],!je.call(e,s)&&s!==n&&De(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Oe(t,s))||r.enumerable});return e},Pe=(e,t,n)=>(n=e==null?{}:Ee(Ae(e)),Ne(t||!e||!e.__esModule?De(n,`default`,{value:e,enumerable:!0}):n,e));const T=process.env.SKILLATLAS_CONFIG_DIR||u.join(p.homedir(),`.skillatlas`),Fe=u.join(T,`auth.json`),E=u.join(T,`skillatlas-meta.json`),Ie={production:{apiBase:`https://skillhub.wanuai.cn/`},pre:{apiBase:`https://pre-skillhub.aliyun-inc.com/`}},Le=process.env.SKILLATLAS_ENV||`production`;let Re=process.env.SKILLATLAS_API_BASE||Ie[Le].apiBase;const D=process.env.OPENCLAW_STATE_DIR||u.join(p.homedir(),`.openclaw`),O=u.join(D,`seafood-lock.json`),ze=u.join(D,`identity`,`device.json`),Be={skill:`skills`,plugin:`plugins`,trigger:`triggers`,channel:`channels`,experience:`experiences`},Ve={project:`maas-skill-hub`,logStore:`cli`,endpoint:process.env.SKILLATLAS_SLS_ENDPOINT||`cn-hangzhou.log.aliyuncs.com`};function He(){let e=process.env.SKILLATLAS_DISABLE_TELEMETRY;return e===`1`||e===`true`}function Ue(){return Ve}function We(){return Le}function k(){e.existsSync(T)||e.mkdirSync(T,{recursive:!0})}function Ge(e){let t=Be[e];if(!t)throw Error(`Unknown asset type: ${e}. Valid types: ${Object.keys(Be).join(`, `)}`);return u.join(D,t)}function Ke(){return Re}function qe(e){Re=e.replace(/\/+$/,``)}function Je(){qe(Ie.pre.apiBase)}function Ye(){if(process.env.OPENCLAWMP_TOKEN)return process.env.OPENCLAWMP_TOKEN;if(k(),e.existsSync(Fe))try{let t=JSON.parse(e.readFileSync(Fe,`utf-8`));if(t.token)return t.token}catch{}return null}function Xe(t,n={}){k();let r={token:t,savedAt:new Date().toISOString(),...n};e.writeFileSync(Fe,JSON.stringify(r,null,2)+`
|
|
3
3
|
`)}function Ze(){if(!e.existsSync(ze))return null;try{return JSON.parse(e.readFileSync(ze,`utf-8`)).deviceId||null}catch{return null}}function Qe(){k();let t={};if(e.existsSync(E))try{if(t=JSON.parse(e.readFileSync(E,`utf-8`)),t.agentId)return t.agentId}catch{}return null}function $e(t,n,r,i){k();let a={};if(e.existsSync(E))try{a=JSON.parse(e.readFileSync(E,`utf-8`))}catch{}a.agentId=t,a.token=n,r&&(a.registeredAt=r),i&&(a.expiresAt=i),a.credentialsSavedAt=new Date().toISOString(),e.writeFileSync(E,JSON.stringify(a,null,2)+`
|
|
4
4
|
`)}function et(){if(!e.existsSync(E))return null;try{let t=JSON.parse(e.readFileSync(E,`utf-8`));return t.agentId&&t.token?{agentId:t.agentId,token:t.token,registeredAt:t.registeredAt,expiresAt:t.expiresAt}:null}catch{return null}}function tt(){if(!e.existsSync(O)){let t=u.dirname(O);e.existsSync(t)||e.mkdirSync(t,{recursive:!0}),e.writeFileSync(O,JSON.stringify({version:1,installed:{}},null,2)+`
|
|
5
5
|
`)}}function nt(){tt();try{return JSON.parse(e.readFileSync(O,`utf-8`))}catch{return{version:1,installed:{}}}}function rt(t,n,r){let i=nt();i.installed[t]={version:n,installedAt:new Date().toISOString(),location:r},e.writeFileSync(O,JSON.stringify(i,null,2)+`
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{existsSync as t,mkdirSync as n,readFileSync as r,writeFileSync as i}from"node:fs";import a,{join as o}from"node:path";import s from"semver";import c from"node:os";import{spawn as l}from"node:child_process";import*as u from"@clack/prompts";import d from"chalk";import f from"axios";import p,{basename as ee,dirname as m,join as h,normalize as g,relative as _,resolve as v,sep as te}from"path";import{existsSync as y,writeFileSync as ne}from"fs";import re,{homedir as ie,platform as ae,tmpdir as oe}from"os";import*as se from"readline";import{Writable as ce}from"stream";import{cp as le,lstat as ue,mkdir as b,readFile as de,readdir as fe,readlink as pe,realpath as me,rename as he,rm as x,stat as ge,symlink as _e,unlink as ve,writeFile as ye}from"fs/promises";import{fileURLToPath as be}from"url";import{info as xe}from"console";import{execFileSync as Se}from"child_process";import{createConsola as Ce}from"consola";import{createHash as we,randomBytes as Te}from"node:crypto";import S from"secp256k1";var Ee=Object.create,De=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,ke=Object.getOwnPropertyNames,Ae=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty,Me=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ne=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ke(t),a=0,o=i.length,s;a<o;a++)s=i[a],!je.call(e,s)&&s!==n&&De(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Oe(t,s))||r.enumerable});return e},Pe=(e,t,n)=>(n=e==null?{}:Ee(Ae(e)),Ne(t||!e||!e.__esModule?De(n,`default`,{value:e,enumerable:!0}):n,e));const C=process.env.SKILLATLAS_CONFIG_DIR||a.join(c.homedir(),`.skillatlas`),Fe=a.join(C,`auth.json`),w=a.join(C,`skillatlas-meta.json`),Ie={production:{apiBase:`https://
|
|
1
|
+
import e,{existsSync as t,mkdirSync as n,readFileSync as r,writeFileSync as i}from"node:fs";import a,{join as o}from"node:path";import s from"semver";import c from"node:os";import{spawn as l}from"node:child_process";import*as u from"@clack/prompts";import d from"chalk";import f from"axios";import p,{basename as ee,dirname as m,join as h,normalize as g,relative as _,resolve as v,sep as te}from"path";import{existsSync as y,writeFileSync as ne}from"fs";import re,{homedir as ie,platform as ae,tmpdir as oe}from"os";import*as se from"readline";import{Writable as ce}from"stream";import{cp as le,lstat as ue,mkdir as b,readFile as de,readdir as fe,readlink as pe,realpath as me,rename as he,rm as x,stat as ge,symlink as _e,unlink as ve,writeFile as ye}from"fs/promises";import{fileURLToPath as be}from"url";import{info as xe}from"console";import{execFileSync as Se}from"child_process";import{createConsola as Ce}from"consola";import{createHash as we,randomBytes as Te}from"node:crypto";import S from"secp256k1";var Ee=Object.create,De=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,ke=Object.getOwnPropertyNames,Ae=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty,Me=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ne=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ke(t),a=0,o=i.length,s;a<o;a++)s=i[a],!je.call(e,s)&&s!==n&&De(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Oe(t,s))||r.enumerable});return e},Pe=(e,t,n)=>(n=e==null?{}:Ee(Ae(e)),Ne(t||!e||!e.__esModule?De(n,`default`,{value:e,enumerable:!0}):n,e));const C=process.env.SKILLATLAS_CONFIG_DIR||a.join(c.homedir(),`.skillatlas`),Fe=a.join(C,`auth.json`),w=a.join(C,`skillatlas-meta.json`),Ie={production:{apiBase:`https://skillhub.wanuai.cn/`},pre:{apiBase:`https://pre-skillhub.aliyun-inc.com/`}},Le=process.env.SKILLATLAS_ENV||`production`;let Re=process.env.SKILLATLAS_API_BASE||Ie[Le].apiBase;const ze=process.env.OPENCLAW_STATE_DIR||a.join(c.homedir(),`.openclaw`),T=a.join(ze,`seafood-lock.json`),Be=a.join(ze,`identity`,`device.json`),Ve={skill:`skills`,plugin:`plugins`,trigger:`triggers`,channel:`channels`,experience:`experiences`},He={project:`maas-skill-hub`,logStore:`cli`,endpoint:process.env.SKILLATLAS_SLS_ENDPOINT||`cn-hangzhou.log.aliyuncs.com`};function Ue(){let e=process.env.SKILLATLAS_DISABLE_TELEMETRY;return e===`1`||e===`true`}function We(){return He}function Ge(){return Le}function E(){e.existsSync(C)||e.mkdirSync(C,{recursive:!0})}function Ke(e){let t=Ve[e];if(!t)throw Error(`Unknown asset type: ${e}. Valid types: ${Object.keys(Ve).join(`, `)}`);return a.join(ze,t)}function qe(){return Re}function Je(e){Re=e.replace(/\/+$/,``)}function Ye(){Je(Ie.pre.apiBase)}function Xe(){if(process.env.OPENCLAWMP_TOKEN)return process.env.OPENCLAWMP_TOKEN;if(E(),e.existsSync(Fe))try{let t=JSON.parse(e.readFileSync(Fe,`utf-8`));if(t.token)return t.token}catch{}return null}function Ze(t,n={}){E();let r={token:t,savedAt:new Date().toISOString(),...n};e.writeFileSync(Fe,JSON.stringify(r,null,2)+`
|
|
2
2
|
`)}function Qe(){if(!e.existsSync(Be))return null;try{return JSON.parse(e.readFileSync(Be,`utf-8`)).deviceId||null}catch{return null}}function $e(){E();let t={};if(e.existsSync(w))try{if(t=JSON.parse(e.readFileSync(w,`utf-8`)),t.agentId)return t.agentId}catch{}return null}function et(t,n,r,i){E();let a={};if(e.existsSync(w))try{a=JSON.parse(e.readFileSync(w,`utf-8`))}catch{}a.agentId=t,a.token=n,r&&(a.registeredAt=r),i&&(a.expiresAt=i),a.credentialsSavedAt=new Date().toISOString(),e.writeFileSync(w,JSON.stringify(a,null,2)+`
|
|
3
3
|
`)}function tt(){if(!e.existsSync(w))return null;try{let t=JSON.parse(e.readFileSync(w,`utf-8`));return t.agentId&&t.token?{agentId:t.agentId,token:t.token,registeredAt:t.registeredAt,expiresAt:t.expiresAt}:null}catch{return null}}function nt(){if(!e.existsSync(T)){let t=a.dirname(T);e.existsSync(t)||e.mkdirSync(t,{recursive:!0}),e.writeFileSync(T,JSON.stringify({version:1,installed:{}},null,2)+`
|
|
4
4
|
`)}}function rt(){nt();try{return JSON.parse(e.readFileSync(T,`utf-8`))}catch{return{version:1,installed:{}}}}function it(t,n,r){let i=rt();i.installed[t]={version:n,installedAt:new Date().toISOString(),location:r},e.writeFileSync(T,JSON.stringify(i,null,2)+`
|