@entrydesk/cli 1.26.0 → 1.26.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.
- package/dist/{agents-BPEYRMJS.js → agents-XQH67YBG.js} +1 -1
- package/dist/{billing-ZIIVREJT.js → billing-PZG7BF2R.js} +1 -1
- package/dist/{budget-GOLUDBCL.js → budget-LHLL6XAX.js} +1 -1
- package/dist/chunk-3LVMVSXH.js +91 -0
- package/dist/{chunk-HDVXCFOU.js → chunk-JMRVTRPY.js} +1 -1
- package/dist/chunk-KBW7PPBV.js +2 -0
- package/dist/chunk-SVE74GZ2.js +8 -0
- package/dist/{chunk-DR3LDSMV.js → chunk-U3S6IYK7.js} +2 -2
- package/dist/config-2UKI6TWQ.js +2 -0
- package/dist/{config-4IUXVJTP.js → config-I6QH74VH.js} +1 -1
- package/dist/{config-help-VOALBZOV.js → config-help-54ZPTSGK.js} +1 -1
- package/dist/{connectors-CSQK22LM.js → connectors-R6BMPLPB.js} +1 -1
- package/dist/{help-4WGGQ6JC.js → help-TFK3BT5B.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/login-5PYRMAXU.js +2 -0
- package/dist/{logout-ADWPA2FG.js → logout-N3DWUIVM.js} +1 -1
- package/dist/{marketplace-SQVRI7DY.js → marketplace-X7HJBCLX.js} +1 -1
- package/dist/{mcp-VDO3M3ZZ.js → mcp-L2E3UYM3.js} +1 -1
- package/dist/{meeting-TW3VZXAR.js → meeting-ZPU6GRAQ.js} +1 -1
- package/dist/models-ZQQ6IAMC.js +3 -0
- package/dist/{notifications-W4JZNPP5.js → notifications-A2E4NNUF.js} +1 -1
- package/dist/{profile-AHVLOC6L.js → profile-7EC34EQQ.js} +1 -1
- package/dist/{recordings-LYXVL3QK.js → recordings-WTXTIM47.js} +9 -9
- package/dist/{schedules-EBOKWL2V.js → schedules-6HOZPI2B.js} +1 -1
- package/dist/{skills-KZ3IZP5O.js → skills-IMSSEM4W.js} +1 -1
- package/dist/status-APAONGPM.js +2 -0
- package/dist/{task-RMAWXZYH.js → task-REAQDDHD.js} +45 -45
- package/dist/{tasks-IN2ZYMSB.js → tasks-F7APMWQ2.js} +1 -1
- package/dist/{token-FCXXKQBB.js → token-ET5ACXYV.js} +1 -1
- package/dist/token-util-4YZZOFTH.js +2 -0
- package/dist/{tool-MJKJCMYH.js → tool-HK6VUF2X.js} +1 -1
- package/dist/{update-5CGQNKNF.js → update-DKQXM2AG.js} +1 -1
- package/dist/{usage-46QSLRS2.js → usage-PHN54NZW.js} +1 -1
- package/dist/version-SNWB2HVT.js +2 -0
- package/dist/{workflow-BR4CFCAK.js → workflow-ASYU6KRW.js} +1 -1
- package/dist/{workspaces-IAN5MGM7.js → workspaces-6L42VXYO.js} +1 -1
- package/package.json +4 -5
- package/dist/chunk-EFMVEUKG.js +0 -97
- package/dist/chunk-KURQCTT3.js +0 -2
- package/dist/config-IAKKALFC.js +0 -2
- package/dist/login-EB3L2V2J.js +0 -2
- package/dist/models-B3KI6HNA.js +0 -3
- package/dist/status-L6BVD6XO.js +0 -2
- package/dist/token-util-OEHRI4SO.js +0 -2
- package/dist/version-CE6LTBHK.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{h as S,
|
|
2
|
+
import{h as S,t as g,v as $}from"./chunk-U3S6IYK7.js";import"./chunk-KBW7PPBV.js";function u(){console.log(`
|
|
3
3
|
Usage: entrydesk schedules [list|get|create|edit|delete|activate|pause|run|runs] [options]
|
|
4
4
|
|
|
5
5
|
Commands:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{c as ke}from"./chunk-
|
|
2
|
+
import{c as ke}from"./chunk-3LVMVSXH.js";import"./chunk-SVE74GZ2.js";import{b as F,h as ye,t as ge,v as J}from"./chunk-U3S6IYK7.js";import"./chunk-KBW7PPBV.js";import Ht from"crypto";import M from"fs";import h from"fs/promises";import me from"os";import k from"path";import{Readable as Mt}from"stream";import{pipeline as _t}from"stream/promises";import Kt from"adm-zip";import zt from"archiver";import{isHTTPError as Wt}from"ky";import re from"fs/promises";import ne from"path";import{execFileSync as mt}from"child_process";import $ from"fs";import kt from"os";import x from"path";import ot from"os";import B from"fs";import qe from"os";import _ from"path";import se from"fs";import Se from"path";var Ye="skills-lock.json",V=".entrydesk",le=1;function he(){return{version:le,skills:{}}}function we(e){return Se.join(e,V,Ye)}function I(e){try{let t=JSON.parse(se.readFileSync(we(e),"utf8"));return t.version!==le||typeof t.skills!="object"||t.skills===null?he():t}catch{return he()}}function ve(e,t){let o={};for(let s of Object.keys(t.skills).toSorted())o[s]=t.skills[s];let r={version:le,...t.workspaceId?{workspaceId:t.workspaceId}:{},skills:o},i=we(e);se.mkdirSync(Se.dirname(i),{recursive:!0}),se.writeFileSync(i,`${JSON.stringify(r,null,2)}
|
|
3
3
|
`,"utf8")}function Z(e,t){return I(e).skills[t]}function O(e,t,o){let r=I(e);r.skills[t]=o,ve(e,r)}function be(e,t){let o=I(e);if(!(t in o.skills))return!1;let{[t]:r,...i}=o.skills;return ve(e,{...o,skills:i}),!0}var Qe="project.json",et="global-link.json";function Ie(e){try{let t=JSON.parse(B.readFileSync(e,"utf8"));return typeof t.workspaceId!="string"||t.workspaceId===""?void 0:t}catch{return}}function Le(e,t){B.mkdirSync(_.dirname(e),{recursive:!0}),B.writeFileSync(e,`${JSON.stringify(t,null,2)}
|
|
4
4
|
`,"utf8")}function $e(e){return B.existsSync(e)?(B.rmSync(e),!0):!1}function N(e){return _.join(e,V,Qe)}function H(){return _.join(qe.homedir(),V,et)}function xe(){return Ie(H())}function X(e){Le(H(),e)}function Ee(){return $e(H())}function ce(e=process.cwd()){let t=_.resolve(e);for(;;){if(B.existsSync(N(t)))return t;let o=_.dirname(t);if(o===t)return;t=o}}function tt(e){return Ie(N(e))}function Y(e,t){Le(N(e),t)}function je(e){return $e(N(e))}function Pe(e=process.cwd()){let t=ce(e);if(!t)return;let o=tt(t);return o?{rootDir:t,link:o}:void 0}function Ae(e){let t=F.getApiUrl()??void 0;if(e&&t&&e!==t)throw new Error(`This directory is linked to a workspace on ${e}, but the active profile points at ${t}. Re-run 'entrydesk skills link' or switch profile.`)}function v(e,t){if(e){let r=ot.homedir(),i=xe();return i?(Ae(i.apiUrl),{rootDir:r,workspaceId:i.workspaceId,linked:!0}):{rootDir:r,workspaceId:t,linked:!1}}let o=Pe(process.cwd());return o?(Ae(o.link.apiUrl),{rootDir:o.rootDir,workspaceId:o.link.workspaceId,linked:!0}):{rootDir:process.cwd(),workspaceId:t,linked:!1}}import E from"fs";import K from"path";function q(e,t){let o=K.dirname(e);E.mkdirSync(o,{recursive:!0});let r=E.mkdtempSync(K.join(o,`.${K.basename(e)}.tmp-`)),i=K.join(r,"next"),s=K.join(r,"prev");E.mkdirSync(i,{recursive:!0});let c=!1;try{t(i),E.existsSync(e)&&(E.renameSync(e,s),c=!0),E.renameSync(i,e)}catch(n){throw c&&!E.existsSync(e)&&E.renameSync(s,e),n}finally{E.rmSync(r,{recursive:!0,force:!0})}}import{createHash as Ce}from"crypto";import Q from"fs";import z from"path";var Re=new Set([".git","node_modules","__pycache__",".DS_Store","__MACOSX"]),Ne="SKILL.md";function rt(e){let t=Q.readdirSync(e,{withFileTypes:!0}).filter(r=>!Re.has(r.name));if(t.some(r=>r.isFile()&&r.name===Ne))return e;let o=t.filter(r=>r.isDirectory());if(o.length===1){let r=z.join(e,o[0].name);if(Q.existsSync(z.join(r,Ne)))return r}return e}function De(e,t,o){for(let r of Q.readdirSync(t,{withFileTypes:!0})){if(Re.has(r.name))continue;let i=z.join(t,r.name);r.isDirectory()?De(e,i,o):r.isFile()&&o.push({rel:z.relative(e,i).split(z.sep).join("/"),abs:i})}}function nt(e){let t=[];De(e,e,t),t.sort((r,i)=>r.rel<i.rel?-1:r.rel>i.rel?1:0);let o=Ce("sha256");for(let r of t){let i=Ce("sha256").update(Q.readFileSync(r.abs)).digest("hex");o.update(r.rel).update("\0").update(i).update("\0")}return o.digest("hex")}function j(e){return nt(rt(e))}import L from"fs";import S from"path";var R=[{id:"claude-code",displayName:"Claude Code",skillsSubdir:S.join(".claude","skills"),rootMarker:".claude"},{id:"codex",displayName:"Codex",skillsSubdir:S.join(".codex","skills"),rootMarker:".codex"},{id:"cursor",displayName:"Cursor",skillsSubdir:S.join(".cursor","skills"),rootMarker:".cursor"},{id:"universal",displayName:"Universal (.agents)",skillsSubdir:S.join(".agents","skills"),rootMarker:".agents"}];function ee(e,t){return S.join(t,e.skillsSubdir)}function it(e){let t=R.filter(o=>o.id==="universal"||L.existsSync(S.join(e,o.rootMarker)));return t.length>0?t:R.filter(o=>o.id==="universal")}function Te(e){let t;try{t=L.lstatSync(e)}catch{return}t.isSymbolicLink()?L.unlinkSync(e):t.isDirectory()?L.rmSync(e,{recursive:!0,force:!0}):L.rmSync(e,{force:!0})}function st(e,t,o,r="symlink"){let i=S.basename(S.dirname(t))||t,s=S.join(t,o);if(L.mkdirSync(t,{recursive:!0}),Te(s),r==="symlink")try{let c=S.relative(t,e);return L.symlinkSync(c,s,process.platform==="win32"?"junction":"dir"),{agentId:i,linkPath:s,mode:"symlink",ok:!0}}catch{}try{return L.cpSync(e,s,{recursive:!0}),{agentId:i,linkPath:s,mode:"copy",ok:!0}}catch(c){return{agentId:i,linkPath:s,mode:"copy",ok:!1,error:c instanceof Error?c.message:String(c)}}}function Ue(e,t){let o=S.join(e,t);try{L.lstatSync(o)}catch{return!1}return Te(o),!0}function Fe(e,t){let o;try{o=L.lstatSync(e)}catch{return!1}return o.isSymbolicLink()?S.resolve(S.dirname(e),L.readlinkSync(e))===S.resolve(t):!1}function lt(e,t){return t&&t.length>0?t.includes("*")?[...R]:R.filter(o=>t.includes(o.id)):it(e)}function te(e,t,o,r="symlink",i){return lt(o,i).map(s=>st(e,ee(s,o),t,r))}import oe from"path";var ct=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u;function ae(e){if(!ct.test(e))throw new Error(`Invalid skill name "${e}": must be lowercase letters, digits and single hyphens (e.g. "my-skill").`)}function b(e,t){ae(t);let o=oe.resolve(e,".entrydesk","skills"),r=oe.resolve(o,t);if(r!==oe.join(o,t)||!r.startsWith(o+oe.sep))throw new Error(`Refusing unsafe skill path for "${t}".`);return r}async function P(e,t,o){let r=[],i;do{let s=await e.listAvailableSkills(t,o,{nextKey:i,limit:100});r.push(...s.skills),i=s.nextKey}while(i);return r}import A from"fs";import fe from"os";import D from"path";var Oe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu,at=/^([\w.-]+)\/([\w.-]+)(?:\/(.+))?$/u;function ft(e){return e==="~"?fe.homedir():e.startsWith("~/")||e.startsWith("~\\")?D.join(fe.homedir(),e.slice(2)):e}function ut(e){return e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.startsWith("~")||e.startsWith(".\\")||/^[a-zA-Z]:[\\/]/u.test(e)}function dt(e){let t=/^https?:\/\/github\.com\/([\w.-]+)\/([\w.-]+?)(?:\.git)?(?:\/tree\/([^/]+)(?:\/(.+))?)?\/?$/u.exec(e);return t?{type:"github",owner:t[1],repo:t[2],gitRef:t[3],subpath:t[4],url:`https://github.com/${t[1]}/${t[2]}`}:null}function Be(e){let t=e.trim();if(ut(t))return{type:"local",path:D.resolve(ft(t))};if(t.startsWith("ed:")){let i=t.slice(3);return{type:"entrydesk",ref:i,isId:Oe.test(i)}}if(Oe.test(t))return{type:"entrydesk",ref:t,isId:!0};if(t.startsWith("git@")||t.endsWith(".git"))return{type:"git",url:t};let o=dt(t);if(o)return o;if(/^https?:\/\//u.test(t))return{type:"git",url:t};let r=at.exec(t);return r?{type:"github",owner:r[1],repo:r[2],subpath:r[3],url:`https://github.com/${r[1]}/${r[2]}`}:{type:"entrydesk",ref:t,isId:!1}}function ue(e){return e.type==="github"?"github":e.type}var pt=new Set([".git","node_modules","__pycache__",".DS_Store",".entrydesk"]);function de(e,t){if(!A.existsSync(D.join(e,"SKILL.md")))throw new Error(`No SKILL.md found at ${e}`);let o=A.realpathSync(e),r=A.existsSync(t)?A.realpathSync(t):D.resolve(t);if(o===r)return;let i=A.mkdtempSync(D.join(fe.tmpdir(),"ed-local-skill-")),s=D.join(i,"skill");try{A.cpSync(o,s,{recursive:!0,filter:c=>!pt.has(D.basename(c))}),q(t,c=>{A.cpSync(s,c,{recursive:!0})})}finally{A.rmSync(i,{recursive:!0,force:!0})}}var yt="skills@1.5.12";function He(e){try{let t=$.readFileSync(x.join(e,"SKILL.md"),"utf8"),o=/^name:\s*(.+?)\s*$/mu.exec(t.split(/^---\s*$/mu)[1]??"");if(o?.[1])return o[1].replace(/^['"]|['"]$/gu,"")}catch{}return x.basename(e)}async function gt(e,t){let{default:o}=await import("adm-zip"),r=new o(e);q(t,i=>{let s=x.resolve(i)+x.sep;for(let c of r.getEntries()){if(c.isDirectory)continue;let n=x.resolve(i,c.entryName);if(!n.startsWith(s))throw new Error(`Zip entry contains path traversal: ${c.entryName}`);$.mkdirSync(x.dirname(n),{recursive:!0}),$.writeFileSync(n,c.getData())}})}async function ht(e,t){if(t.isId)return t.ref;let r=(await P(e.client,e.accessToken,e.workspaceId)).find(i=>i.name===t.ref||i.id===t.ref);if(!r)throw new Error(`Skill not found in workspace: ${t.ref}`);return r.id}function St(e,t,o){let r=$.mkdtempSync(x.join(kt.tmpdir(),"ed-npx-skills-")),i=["-y",yt,"add",e,"--copy","--yes"];try{mt("npx",i,{cwd:r,stdio:o?["ignore","pipe","pipe"]:"inherit"})}catch(l){throw $.rmSync(r,{recursive:!0,force:!0}),new Error(`npx skills failed for ${e}. Ensure npx + network are available. (${l instanceof Error?l.message:String(l)})`,{cause:l})}let s=x.join(r,".agents","skills");if(!$.existsSync(s))throw $.rmSync(r,{recursive:!0,force:!0}),new Error(`npx skills produced no skills under ${s}`);let c=$.readdirSync(s,{withFileTypes:!0}).filter(l=>l.isDirectory());if(c.length===0)throw $.rmSync(r,{recursive:!0,force:!0}),new Error("npx skills installed no skill directory");let n=c[0];if(c.length>1){let l=t.type==="github"&&t.subpath?x.basename(t.subpath):void 0,f=l?c.find(a=>a.name===l):void 0;if(!f)throw $.rmSync(r,{recursive:!0,force:!0}),new Error(`npx skills installed [${c.map(a=>a.name).join(", ")}]; ${l?`none matched the subpath "${l}"`:"specify a subpath to pick one"}.`);n=f}return{dir:x.join(s,n.name),tmpRoot:r}}async function Me(e,t){let o=e.configKey;if(!o)throw new Error("Missing source. Usage: entrydesk skills add <source>");let r=Be(o),i=!!e.global,s=v(i,t.workspaceId),c=s.rootDir,n={...t,workspaceId:s.workspaceId};if(!s.linked){let d={workspaceId:t.workspaceId,apiUrl:F.getApiUrl()??void 0};i?X(d):Y(process.cwd(),d)}let l,f,a;if(r.type==="entrydesk"){f=await ht(n,r);let d=await n.client.downloadSkillCurrent(n.accessToken,n.workspaceId,f);l=d.name,a=b(c,l);let m=await fetch(d.url);if(!m.ok)throw new Error(`Failed to download ${l}: ${m.status}`);await gt(Buffer.from(await m.arrayBuffer()),a)}else if(r.type==="local")l=He(r.path),a=b(c,l),de(r.path,a);else{let{dir:d,tmpRoot:m}=St(o,r,!!e.json);try{l=He(d),a=b(c,l),de(d,a)}finally{$.rmSync(m,{recursive:!0,force:!0})}}let y=j(a),g={source:o,sourceType:ue(r),skillId:f,localHash:y,lastPulledHash:r.type==="entrydesk"?y:"",mode:"symlink",...r.type==="github"?{sourceUrl:r.url,ref:r.gitRef,subpath:r.subpath}:{},...r.type==="git"?{sourceUrl:r.url}:{}};O(c,l,g);let u=te(a,l,c,"symlink",e.agents);e.json?console.info(JSON.stringify({name:l,sourceType:ue(r),hash:y},null,2)):console.info(`\u2713 added ${l} (${r.type}, ${y.slice(0,12)}) \u2192 agents: ${u.map(d=>d.agentId).join(", ")}`)}import G from"fs";import wt from"os";import W from"path";import vt from"archiver";function bt(e){return typeof e!="object"||e===null?!1:e.response?.status===404||/\b404\b/u.test(String(e.message??""))}function It(e){return e.remoteHash===null?"create":e.currentHash===e.baseHash?"noop":!e.force&&e.remoteHash!==e.lastPulledHash?"stale":"push"}function Lt(e){return new Promise((t,o)=>{let r=[],i=vt("zip",{zlib:{level:9}});i.on("data",s=>r.push(s)),i.on("error",o),i.on("end",()=>t(Buffer.concat(r))),i.directory(e,!1),i.finalize()})}async function $t(e,t){let{url:o}=await e.client.downloadSkillCurrent(e.accessToken,e.workspaceId,t),r=await fetch(o);if(!r.ok)throw new Error(`download for staleness check failed: ${r.status}`);let i=G.mkdtempSync(W.join(wt.tmpdir(),"ed-push-cmp-"));try{let{default:s}=await import("adm-zip");for(let c of new s(Buffer.from(await r.arrayBuffer())).getEntries()){if(c.isDirectory)continue;let n=W.resolve(i,c.entryName);n.startsWith(W.resolve(i)+W.sep)&&(G.mkdirSync(W.dirname(n),{recursive:!0}),G.writeFileSync(n,c.getData()))}return j(i)}finally{G.rmSync(i,{recursive:!0,force:!0})}}async function _e(e,t,o,r,i,s,c){let n=await Lt(r),l=new FormData;l.append("file",new Blob([n],{type:"application/zip"}),`${o}.zip`),c&&l.append("force","true");let f=await e.client.uploadSkill(e.accessToken,e.workspaceId,l);O(t,o,{...s,skillId:f.id,localHash:i,lastPulledHash:i})}async function xt(e,t,o,r,i){let s=b(t,o);if(!G.existsSync(s))throw new Error(`No local copy for ${o}`);let c=j(s);if(r.skillId){let f=null;try{f=await $t(e,r.skillId)}catch(a){if(!bt(a))throw a}if(f!==null){let a=It({currentHash:c,baseHash:r.localHash,lastPulledHash:r.lastPulledHash,remoteHash:f,force:i});return a==="noop"||a==="stale"||await _e(e,t,o,s,c,r,!0),a}}let l=(await P(e.client,e.accessToken,e.workspaceId)).find(f=>f.name===o);return l&&!i?"name-conflict":(await _e(e,t,o,s,c,r,!!l),"create")}async function Ke(e,t){let{rootDir:o,workspaceId:r}=v(!!e.global,t.workspaceId),i={...t,workspaceId:r},s=!!e.force,c=e.configKey?[e.configKey]:Object.keys(I(o).skills);if(c.length===0){console.info("Nothing to push \u2014 no tracked skills.");return}let n=!1;for(let l of c){let f=Z(o,l);if(!f){console.info(`\u2717 ${l}: not tracked (run: entrydesk skills add <source>)`),n=!0;continue}let a=await xt(i,o,l,f,s),y={create:`\u2713 pushed ${l} (created in workspace)`,push:`\u2713 pushed ${l}`,noop:`\xB7 ${l} unchanged`,stale:`\u2717 ${l} rejected \u2014 remote changed since last pull. Run 'entrydesk skills pull ${l}' first (or --force).`,"name-conflict":`\u2717 ${l} rejected \u2014 a different skill named "${l}" already exists in the workspace. Pull it first, or --force to overwrite.`};console.info(y[a]),(a==="stale"||a==="name-conflict")&&(n=!0)}n&&(process.exitCode=1)}import pe from"fs";import Et from"path";function jt(e,t,o,r){let i=[],s=[];for(let c of R){let n=Et.join(ee(c,t),e);try{pe.lstatSync(n)}catch{continue}r||Fe(n,o)?i.push(c.id):s.push(c.id)}return{removable:i,preserved:s}}async function ze(e,t){let o=e.configKey;if(!o)throw new Error("Missing skill name. Usage: entrydesk skills remove <name>");ae(o);let{rootDir:r,workspaceId:i}=v(!!e.global,t.workspaceId),s=Z(r,o),c=b(r,o),n=pe.existsSync(c),l=!!s||n,{removable:f,preserved:a}=jt(o,r,c,l);if(!(l||f.length>0)&&!(e.remote&&s?.skillId)){a.length>0?console.info(`Left ${o} untouched in ${a.join(", ")} \u2014 not EntryDesk-managed; remove it manually if intended.`):console.info(`Nothing to remove \u2014 ${o} is not installed.`);return}let g=!1;e.remote&&(s?.skillId?(await t.client.deleteSkill(t.accessToken,i,s.skillId),g=!0):console.info(`\xB7 skipped --remote: no known workspace skillId for ${o} (it was never pushed from here).`));for(let p of R)f.includes(p.id)&&Ue(ee(p,r),o);n&&pe.rmSync(c,{recursive:!0,force:!0}),be(r,o);let u={name:o,canonicalRemoved:n,agentsUnlinked:f,agentsPreserved:a,untracked:!s,remoteDeleted:g};if(e.json){console.info(JSON.stringify(u,null,2));return}let d=f.length>0?` (agents: ${f.join(", ")})`:"",m=a.length>0?` \u2014 kept non-managed entries in ${a.join(", ")}`:"";console.info(`\u2713 removed ${o}${d}${g?" + deleted from workspace":""}${m}`)}import Pt from"fs";function At(e,t,o){return t?(o??e.localHash)===e.lastPulledHash?"synced":"ahead":e.skillId?"remote-deleted":"local-only"}var We={synced:"\u2014",ahead:"push (local edits)","local-only":"push (never uploaded)","remote-deleted":"push to restore, or remove","remote-only":"add / pull to install"},Ct={synced:"\u2713",ahead:"\u2191","local-only":"\u2299","remote-deleted":"\u26A0","remote-only":"\u2601"};async function Ge(e,t){let o=!!e.global,{rootDir:r,workspaceId:i}=v(o,t.workspaceId),s=o?"global":"project",c=I(r).skills,n=await P(t.client,t.accessToken,i),l=new Map(n.map(u=>[u.id,u])),f=new Map(n.map(u=>[u.name,u])),a=[],y=new Set;for(let[u,d]of Object.entries(c)){let m=d.skillId?l.get(d.skillId):f.get(u);m&&y.add(m.id);let p=b(r,u),w=Pt.existsSync(p)?j(p):null,T=At(d,!!m,w);a.push({name:u,scope:s,state:T,hint:We[T]})}for(let u of n)y.has(u.id)||a.push({name:u.name,scope:s,state:"remote-only",hint:We["remote-only"]});if(a.sort((u,d)=>u.name<d.name?-1:u.name>d.name?1:0),e.json){console.info(JSON.stringify(a,null,2));return}if(a.length===0){console.info("No skills tracked locally or available in the workspace.");return}let g=(u,d)=>u.padEnd(d);console.info(`${g("NAME",26)}${g("SCOPE",9)}STATUS`);for(let u of a)console.info(`${g(u.name,26)}${g(u.scope,9)}${Ct[u.state]} ${g(u.state,16)}${u.hint}`)}var Je=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;function Nt(e,t){let o=e.configKey&&Je.test(e.configKey)?e.configKey:t.workspaceId,r={workspaceId:o,apiUrl:F.getApiUrl()??void 0};if(e.global)X(r),console.info(`Linked ${H()} \u2192 workspace ${o}`);else{let i=process.cwd();Y(i,r),console.info(`Linked ${N(i)} \u2192 workspace ${o}`)}}function Rt(e){if(e.global){Ee()?console.info(`Unlinked ${H()}`):console.info("No global link found.");return}let t=ce(process.cwd());t&&je(t)?console.info(`Unlinked ${N(t)}`):console.info("No project link found.")}async function Dt(e,t,o,r,i){let s=o.skillId;if(!s){let{skills:p}=await e.client.listAvailableSkills(e.accessToken,e.workspaceId),w=p.find(T=>T.name===o.name);if(!w)throw new Error(`Skill not found in workspace: ${o.name}`);s=w.id}let{url:c,name:n}=await e.client.downloadSkillCurrent(e.accessToken,e.workspaceId,s),l=await fetch(c);if(!l.ok)throw new Error(`Failed to download ${n}: ${l.status}`);let f=Buffer.from(await l.arrayBuffer()),a=b(t,n);await re.rm(a,{recursive:!0,force:!0}),await re.mkdir(a,{recursive:!0});let{default:y}=await import("adm-zip"),g=ne.resolve(a)+ne.sep;for(let p of new y(f).getEntries()){if(p.isDirectory)continue;let w=ne.resolve(a,p.entryName);if(!w.startsWith(g))throw new Error(`Zip entry contains path traversal: ${p.entryName}`);await re.mkdir(ne.dirname(w),{recursive:!0}),await re.writeFile(w,p.getData())}let u=j(a);O(t,n,{source:s,sourceType:"entrydesk",skillId:s,localHash:u,lastPulledHash:u,mode:"symlink"});let m=te(a,n,t,"symlink",i);return r||console.info(`\u2713 pulled ${n} (${u.slice(0,12)}) \u2192 agents: ${m.map(p=>p.agentId).join(", ")}`),{name:n,hash:u}}async function Tt(e,t){let{rootDir:o,workspaceId:r}=v(!!e.global,t.workspaceId),i={...t,workspaceId:r},s=!!e.json,c=[];if(e.configKey)c.push(Je.test(e.configKey)?{skillId:e.configKey}:{name:e.configKey});else{let l=I(o).skills;for(let[f,a]of Object.entries(l))c.push({skillId:a.skillId,name:f});if(c.length===0){console.info("Nothing to pull \u2014 no tracked skills. Try: entrydesk skills pull <name>");return}}let n=[];for(let l of c)n.push(await Dt(i,o,l,s,e.agents));s&&console.info(JSON.stringify(n,null,2))}var Ut=new Set(["add","pull","push","status","remove","link","unlink"]);function Ve(e){return Ut.has(e)}function Ze(e,t){return e.action==="add"?Me(e,t):e.action==="pull"?Tt(e,t):e.action==="push"?Ke(e,t):e.action==="status"?Ge(e,t):e.action==="remove"?ze(e,t):(e.action==="link"?Nt(e,t):e.action==="unlink"&&Rt(e),Promise.resolve())}function Ft(e){return e.all?"all":e.remote&&!e.local?"remote":e.local&&!e.remote?"local":"all"}function Ot(e,t,o){let r=new Map(t.map(n=>[n.name,n])),i=new Map(Object.entries(e)),s=new Set;if(o!=="remote")for(let n of i.keys())s.add(n);if(o!=="local")for(let n of r.keys())s.add(n);let c=[];for(let n of s){let l=i.get(n),f=r.get(n);c.push({name:n,local:!!l,remote:!!f,sourceType:l?.sourceType,skillId:l?.skillId??f?.id})}return c.sort((n,l)=>n.name<l.name?-1:n.name>l.name?1:0),c}function Bt(e){return e.local&&e.remote?"local+remote":e.local?"local-only":"remote-only"}async function Xe(e,t){let o=Ft(e),{rootDir:r,workspaceId:i}=v(!!e.global,t.workspaceId),s=o==="remote"?{}:I(r).skills,c=o==="local"?[]:await P(t.client,t.accessToken,i),n=Ot(s,c,o);if(e.json){console.info(JSON.stringify(n,null,2));return}if(n.length===0){console.info(o==="local"?"No skills tracked locally.":"No skills available in the workspace.");return}let l=(f,a)=>f.padEnd(a);console.info(`${l("NAME",28)}${l("WHERE",14)}SOURCE`);for(let f of n)console.info(`${l(f.name,28)}${l(Bt(f),14)}${f.sourceType??"\u2014"}`)}function C(){console.log(`
|
|
5
5
|
Usage: entrydesk skills [list|upload|delete|download|toggle|versions|share] [options]
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as c,b as i,g as a,h as g,m as f,p,s as d,v as u}from"./chunk-U3S6IYK7.js";import"./chunk-KBW7PPBV.js";async function W(t){try{let o=c.getEffectiveProfileName(),n={model:i.getDefaultModel(),connectors:i.getDefaultConnectorIds()},r=f();if(r){t.json?console.log(JSON.stringify({loggedIn:!0,authSource:r.authSource,profile:o,workspaceId:r.workspaceId,defaults:n})):(console.log(`Profile: ${o}`),console.log(`Authenticated via ${r.label} (no login required)`),console.log(`Workspace ID: ${r.workspaceId}`));return}let e=await a.getAll();if(!e){t.json?console.log(JSON.stringify({loggedIn:!1,profile:o,defaults:n})):(console.log(`Profile: ${o}`),console.log("Not logged in"),console.log("Run `entrydesk login` to authenticate"));return}let l;if(e.workspaceId)try{let s=new g,m=await d(),{workspaces:k}=await s.getWorkspaces(m);l=k.find(I=>I.id===e.workspaceId)?.name}catch(s){if(s instanceof p){t.json?console.log(JSON.stringify({loggedIn:!1,profile:o,defaults:n})):(console.log(`Profile: ${o}`),console.log("Not logged in"),console.log("Run `entrydesk login` to authenticate"));return}}t.json?console.log(JSON.stringify({loggedIn:!0,authSource:"file",profile:o,email:e.email,workspaceId:e.workspaceId,workspaceName:l,defaults:n})):(console.log(`Profile: ${o}`),console.log(`Logged in as ${e.email}`),l&&console.log(`Workspace: ${l}`),e.workspaceId&&console.log(`Workspace ID: ${e.workspaceId}`))}catch(o){u(o)}}export{W as runStatus};
|