@entrydesk/cli 2.1.0-beta.2 → 2.1.0-beta.4

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 (85) hide show
  1. package/README.md +69 -12
  2. package/dist/{add-DXYghmJz.js → add-4VqDcbIj.js} +9 -1
  3. package/dist/agents-CCOqroYN.js +10 -0
  4. package/dist/{billing-Bkk1BhAw.js → billing-BV5kdyQb.js} +9 -1
  5. package/dist/{budget-dazpYOON.js → budget-CnxbNkne.js} +9 -1
  6. package/dist/build-task-request-config-CjKDSNjv.js +10 -0
  7. package/dist/commands-DRUlUd-I.js +10 -0
  8. package/dist/{commands-DUKXJUfr.js → commands-gyHmiEsC.js} +9 -1
  9. package/dist/{config-CSJx1Xlt.js → config-CJf4r7wp.js} +9 -1
  10. package/dist/confirm-Ct432t3K.js +10 -0
  11. package/dist/connectors-C_Re7e0l.js +11 -0
  12. package/dist/{file-upload-BmP4AJY0.js → file-upload-D2s_clGk.js} +8 -0
  13. package/dist/{format-C3tQC6LL.js → format-DCvznP70.js} +8 -0
  14. package/dist/{hash-Ddmw8YE4.js → hash-CnSb1n2t.js} +8 -0
  15. package/dist/index.js +50 -15
  16. package/dist/{installer-iaoPJQn3.js → installer-CKB3jBE-.js} +8 -0
  17. package/dist/instruction-DYgn39xF.js +10 -0
  18. package/dist/isRecord-BNZWvqVS.js +10 -0
  19. package/dist/{login-ACaFCfsh.js → login-C0Zz6tHG.js} +9 -1
  20. package/dist/logout-DnFBlXMZ.js +10 -0
  21. package/dist/{marketplace-S_4fkbWt.js → marketplace-DQsEzT6T.js} +9 -1
  22. package/dist/{mcp-DOUHU2_Z.js → mcp-DHXuIFWP.js} +9 -1
  23. package/dist/{mcp-client-LcmqajIh.js → mcp-client-EK-Fh8gM.js} +9 -1
  24. package/dist/{meeting-BG76tnT9.js → meeting-C6H_GJB7.js} +9 -1
  25. package/dist/message-utils-Cq_Fel5P.js +15 -0
  26. package/dist/{models-CkepW_-c.js → models-DT78HZxx.js} +9 -1
  27. package/dist/{notifications-BAMcYXhl.js → notifications-3UrKbGaT.js} +9 -1
  28. package/dist/options-Dpxg1wT1.js +10 -0
  29. package/dist/paginate-Brd-j5V8.js +10 -0
  30. package/dist/{paths-DQh1PdjS.js → paths-mBL9tt9p.js} +9 -1
  31. package/dist/{profile-BzXbLYDw.js → profile-D4m5ZAG7.js} +9 -1
  32. package/dist/profile-storage-CPg61h-2.js +68 -0
  33. package/dist/{project-B9uLW5nn.js → project-C5_rCWCh.js} +9 -1
  34. package/dist/project-context-DnIuy1T0.js +10 -0
  35. package/dist/{project-governance-CwVlxGE2.js → project-governance-CxDZSThr.js} +9 -1
  36. package/dist/{project-sources-BzMkopCj.js → project-sources-D17oXXhL.js} +9 -1
  37. package/dist/project-sources-write-C-W8gjLg.js +10 -0
  38. package/dist/{project-tasks-CnXLm061.js → project-tasks-t4HFgEoZ.js} +9 -1
  39. package/dist/{push-DWIgzvqe.js → push-CJZLFEdk.js} +9 -1
  40. package/dist/{recordings-_HnTtukO.js → recordings-DeB1LqiS.js} +9 -1
  41. package/dist/remote-D3JMUBbh.js +10 -0
  42. package/dist/{remove-Cpen9pWn.js → remove-ChV-BE95.js} +9 -1
  43. package/dist/resolve-Czx_OkYk.js +14 -0
  44. package/dist/resource-grants-zAoqe73P.js +10 -0
  45. package/dist/{rolldown-runtime-CIdiawuB.js → rolldown-runtime-CiM6yMNq.js} +8 -0
  46. package/dist/{schedules-DACWrdY_.js → schedules-COBaV-Be.js} +10 -2
  47. package/dist/skills-OLZywcSs.js +10 -0
  48. package/dist/{status-BKd81bGK.js → status-CpfDbB9S.js} +9 -1
  49. package/dist/{status-ErhWpQxW.js → status-Oo8upbyy.js} +9 -1
  50. package/dist/stdin-B18x8pUF.js +10 -0
  51. package/dist/task-C8PttINZ.js +108 -0
  52. package/dist/tasks-CAmfAGsn.js +22 -0
  53. package/dist/tasks-dv0gJ38_.js +10 -0
  54. package/dist/tool-kEevHrsQ.js +17 -0
  55. package/dist/{update-D09UponU.js → update-Y9S-P4wG.js} +9 -1
  56. package/dist/{usage-Dibnsgtg.js → usage-CHIhyA8S.js} +9 -1
  57. package/dist/{usage-audit-Be431Kj1.js → usage-audit-C1xGe42N.js} +9 -1
  58. package/dist/version-Dgsb7T5N.js +10 -0
  59. package/dist/workflow-DWmgcRJ_.js +14 -0
  60. package/dist/{workspaces-rVOwf5zp.js → workspaces-3PFiXy1I.js} +9 -1
  61. package/package.json +11 -7
  62. package/dist/agents-Drg2ZD85.js +0 -2
  63. package/dist/build-task-request-config-BDlX-M_P.js +0 -2
  64. package/dist/commands-FVFeS1MV.js +0 -2
  65. package/dist/confirm-BrJZbaxf.js +0 -2
  66. package/dist/connectors-CHcopt49.js +0 -3
  67. package/dist/instruction-BXKEUplM.js +0 -2
  68. package/dist/logout-BX4YsOqw.js +0 -2
  69. package/dist/options-CgmngSTC.js +0 -2
  70. package/dist/paginate-DUu8qbek.js +0 -2
  71. package/dist/profile-storage-DlaupNlV.js +0 -60
  72. package/dist/project-context-VlX5GZxr.js +0 -2
  73. package/dist/project-sources-write-D3WzWqet.js +0 -2
  74. package/dist/remote-nEFOyIM2.js +0 -2
  75. package/dist/resolve-7OXPmNrX.js +0 -6
  76. package/dist/resource-grants-D-ImlByb.js +0 -2
  77. package/dist/skills-BenhDHKq.js +0 -2
  78. package/dist/stdin-DzzLUF6W.js +0 -2
  79. package/dist/task-CvQD8Y4d.js +0 -104
  80. package/dist/tasks-C4dAgHmR.js +0 -2
  81. package/dist/tasks-CnncSIan.js +0 -14
  82. package/dist/terminal-text-D04u1hg1.js +0 -2
  83. package/dist/tool-CpSoLUlR.js +0 -5
  84. package/dist/version-BTqAbDeB.js +0 -2
  85. package/dist/workflow-Dx41WM43.js +0 -6
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{Et as e,T as t}from"./profile-storage-DlaupNlV.js";import{T as n,a as r,b as i,f as a,g as o,o as s,u as c,y as l}from"./resolve-7OXPmNrX.js";const u=e.options.join(`, `),d=`tasks:read`;function f(e,t){return a(t,t=>r(t,e))}function p(n){return e.safeParse(n).success?null:n===`asset`||n===`assets`?new s(`asset_not_on_context_surface`,`Assets are not part of the CLI context surface — open them in the Hub. Pass one of: ${u}.`):new s(`invalid_context_source_type`,`"${t(n)}" is not a context source type. Pass one of: ${u}.`)}function m(e,t){return new s(`invalid_argument`,`${e} ${t}.`)}function h(e,t,n,r){if(!/^[+-]?\d+$/u.test(t.trim()))return m(e,`must be an integer`);let i=Number.parseInt(t,10);return i<n||i>r?m(e,`must be between ${n} and ${r}`):null}async function g(e,t,n,r,i){if(t===void 0)return;let a=h(e,t,n,r);return a&&await c(i,a),Number.parseInt(t,10)}async function _(e,t){let n=e.trim();return n.length===0&&await c(t,m(`<query>`,`must not be empty`)),n.length>200&&await c(t,m(`<query>`,`must be at most 200 characters`)),n}async function v(e,t){let n=p(e);return n&&await c(t,n),e}async function y(e,n,r){let i=await _(n,r),s=r.type?await v(r.type,r):void 0,c=await g(`--limit`,r.limit,1,20,r),u=await f(e,r);await a(r,async e=>{let{results:n}=await e.client.searchProjectContext(e.accessToken,e.workspaceId,u,{q:i,...s&&{type:s},...c!==void 0&&{limit:c}});if(r.json){l({results:n});return}if(n.length===0){console.log(`Nothing matched ${t(i)}.`);return}o(n)},d)}function b(e){return e.nextOffset===void 0?`Output was truncated at this source's text limit.`:`Output was truncated. Read on with --offset ${e.nextOffset}.`}function x(e,t){if(t.json){l(e);return}process.stdout.write(n(e.content)),e.truncated&&console.error(b(e))}function S(e){let n=t(e.title);return e.status===`download`?`"${n}" holds no text to read. Download it instead — the link is short-lived and tied to you: ${t(e.downloadUrl)}`:e.status===`pending`?`"${n}" is still being fetched. Try again once its snapshot is ready.`:`"${n}" could not be fetched: ${t(e.error)}`}function C(e,t){t.json?i(e):console.error(`Error: ${S(e)}`),process.exit(1)}async function w(e,t,n,r){let i=await v(t,r),o=await g(`--offset`,r.offset,0,2**53-1,r),s=await f(e,r),c=await a(r,async e=>e.client.readProjectContext(e.accessToken,e.workspaceId,s,{sourceType:i,sourceId:n},{depth:r.full||o!==void 0?`full`:`summary`,...o!==void 0&&{offset:o}}),d);if(c.status===`text`){x(c,r);return}C(c,r)}export{w as readProjectContext,y as searchProjectContext};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{Dt as e,Ft as t,T as n}from"./profile-storage-DlaupNlV.js";import{C as r,a as i,d as a,h as o,m as s,o as c,u as l,y as u}from"./resolve-7OXPmNrX.js";import{n as d,t as f}from"./file-upload-BmP4AJY0.js";const p=[`file`,`link`],m=p.join(`, `),h=/^https?:\/\//iu;function g(e){return p.some(t=>t===e)}function _(e){return e===`asset`||e===`assets`?new c(`asset_not_a_source`,`Assets are managed in the Hub, not through \`sources-*\`. Pass one of: ${m}.`):new c(`invalid_source_type`,`"${n(e)}" is not a source type. Pass one of: ${m}.`)}async function v(e,t){return g(e)?e:l(t,_(e))}async function y(t){if(t.description===void 0)return;let n=e.safeParse({description:t.description});return n.success?n.data.description:l(t,new c(`description_too_long`,`--description ${n.error.issues[0]?.message??`is invalid`}.`))}async function b(e,r){let i=t.safeParse(e);return i.success?i.data:l(r,new c(`invalid_link_url`,`${n(e)} is not a link the project can fetch: ${i.error.issues[0]?.message??`invalid URL`}. Pass a public http(s) URL.`))}function x(e){let t=n(e.filePath);switch(e.problem){case`missing`:return new c(`local_file_not_found`,`No file at ${t}. Pass the path of a local file, or an http(s):// URL to add a link.`);case`not_a_file`:return new c(`local_path_not_a_file`,`${t} is not a regular file. Pass the path of one file at a time.`);default:return new c(`local_file_unreadable`,`Cannot read ${t}. Check its permissions and try again.`)}}async function S(e,t){try{return await d(e)}catch(e){if(!(e instanceof f))throw e;return l(t,x(e))}}async function C(e,t,n,r){let{client:i,accessToken:a,workspaceId:c}=e;return n.type===`file`?s(await i.updateProjectFileDescription(a,c,t,n.id,{description:r})):o(await i.updateProjectLinkDescription(a,c,t,n.id,{description:r}))}async function w(e,t,n,r){let{client:i,accessToken:a,workspaceId:c}=e;return n.kind===`link`?o(await i.addProjectLink(a,c,t,{url:n.url,description:r})):s(await i.uploadProjectFile(a,c,t,n.file,{description:r}))}function T(e,t,n){if(n.json){u(t);return}r(e,t,t.status===`pending`?"Its snapshot is being fetched; `entrydesk project sources <project>` shows when it is ready.":void 0)}async function E(e,t){return h.test(e)?{kind:`link`,url:await b(e,t)}:{kind:`file`,file:await S(e,t)}}async function D(e,t,n){let r=await y(n),o=await E(t,n);await a(n,async t=>{T(`Added`,await w(t,await i(t,e),o,r),n)})}async function O(e,t,n,r){let o=await v(t,r),s=await y(r);if(s===void 0)return l(r,new c(`description_missing`,`Pass --description <text>. An empty string clears the description.`));await a(r,async t=>{T(`Updated`,await C(t,await i(t,e),{type:o,id:n},s),r)})}async function k(e,t,n){await a(n,async r=>{let a=await i(r,e);T(`Refetching`,o(await r.client.refetchProjectLink(r.accessToken,r.workspaceId,a,t)),n)})}async function A(e,t,r,o){let s=await v(t,o);await a(o,async t=>{let{client:a,accessToken:c,workspaceId:l}=t,d=await i(t,e);if(s===`file`?await a.removeProjectFile(c,l,d,r):await a.removeProjectLink(c,l,d,r),o.json){u({type:s,id:r,removed:!0});return}console.log(`Removed ${s}: ${n(r)}`)})}export{D as addProjectSource,O as editProjectSource,k as refetchProjectSource,A as removeProjectSource};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- async function e(e,t,n){let r=[],i;do{let a=await e.listAvailableSkills(t,n,{nextKey:i,limit:100});r.push(...a.skills),i=a.nextKey}while(i);return r}export{e as t};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import{It as e,T as t,a as n,b as r,g as i,o as a,u as o,w as s,x as c}from"./profile-storage-DlaupNlV.js";import"./options-CgmngSTC.js";import{i as l,n as u}from"./format-C3tQC6LL.js";import{HTTPError as d}from"ky";import{validate as f}from"uuid";function p(e){return t(e)}function m(e){return e.split(`
3
- `).map(p)}function h(e,{numbered:t}){console.log(`Projects (${e.length}):\n`);for(let[n,r]of e.entries()){let e=t?`${String(n+1).padStart(2,` `)} `:``;console.log(` ${e}${p(r.name)}`),console.log(` ${r.role} · updated ${u(r.updatedAt)}`),console.log(` ID: ${r.id}`),console.log(``)}t||console.log("This listing is filtered or paged, so its positions are not the numbers `<project>` takes — pass an ID above.")}function g(e){return`${p(e.name)} <${p(e.email)}> · ${e.role}`}function _(e){console.log(`${p(e.name)}\n`),console.log(` ID: ${e.id}`),console.log(` Role: ${e.role}`),e.description&&console.log(` Description: ${p(e.description)}`),console.log(` Updated: ${u(e.updatedAt)}`),console.log(` Sources: ${e.sourceCount} · Tasks: ${e.taskCount} · Assets: ${e.assetCount}`),console.log(`\n Members (${e.members.length}):`);for(let t of e.members)console.log(` - ${g(t)}`);if(console.log(`
4
- Instruction:`),!e.instruction){console.log(` (none)`);return}for(let t of m(e.instruction))console.log(` ${t}`)}function v(e){console.log(`Members of ${p(e.name)} (${e.members.length}):\n`);for(let t of e.members)console.log(` - ${g(t)}`),console.log(` ID: ${t.userId}`)}function y(e){console.log(`Deleting project: ${p(e.name)}`),console.log(` ID: ${e.id}\n`),console.log(`This will:`),console.log(` - Detach its ${l(e.taskCount,`task`)}; each returns to its owner's main list`),console.log(` - Delete its ${l(e.sourceCount,`source`)} — the files and links in it`),console.log(` - Delete its ${l(e.assetCount,`asset`)}, with every version in their history`),console.log(`
5
- This can't be undone.`)}function b(e){return process.stdout.isTTY?m(e).join(`
6
- `):e}function x(e){let t=JSON.stringify(e);console.log(process.stdout.isTTY?p(t):t)}function S(e){let t=JSON.stringify(e);process.stderr.write(`${process.stderr.isTTY?p(t):t}\n`)}function C(e){return{type:`file`,id:e.id,title:e.name,description:e.description,status:`ready`}}function w(e){return{type:`link`,id:e.id,title:e.title??e.url,description:e.description,status:e.status,url:e.url,fetchError:e.fetchError}}function T(e){return e.status===`failed`&&e.fetchError?`${e.status} — ${p(e.fetchError)}`:e.status}function E(e){console.log(`Sources (${e.length}):\n`);for(let t of e)console.log(` [${t.type}] ${p(t.title)}`),console.log(` ID: ${t.id}`),console.log(` Status: ${T(t)}`),t.url&&console.log(` URL: ${p(t.url)}`),console.log(` Description: ${t.description?p(t.description):`(none)`}`),console.log(``)}function D(e,t,n){console.log(`${e} ${t.type}: ${p(t.title)}`),console.log(` ID: ${t.id}`),console.log(` Status: ${T(t)}`),n&&console.log(n)}function O(e){for(let t of m(e))console.log(` ${t}`)}function k(e){console.log(`Results (${e.length}):\n`);for(let t of e)console.log(` [${t.type}] ${p(t.title)}`),t.type===`task`?(console.log(` ID: ${t.taskId}`),console.log(` Updated: ${u(t.updatedAt)}`)):(console.log(` ID: ${t.sourceId}`),t.description&&console.log(` Description: ${p(t.description)}`)),t.snippet&&O(t.snippet),console.log(``)}var A=class extends Error{code;constructor(e,t){super(t),this.code=e,this.name=`ProjectCommandError`}};const j=`Project not found`,M="Source not found. Check the type and id against `entrydesk project sources <project>`.";function N(){return new A(`project_not_found`,j)}function P(){return new A(`project_feature_disabled`,"Projects are not enabled on this server. Ask an operator to set ENABLE_PROJECT, or point `entrydesk config set apiUrl <url>` at a server that has them.")}const F={context_source_not_found:`Context source not found. Check the id, and note that assets are not part of the CLI context surface — view them in the Hub.`,project_owner_required:`Only a project owner can do this. Ask an owner, or have one make you an owner first.`,project_last_owner_required:`This is the last owner of the project. Promote another member to owner before removing or demoting them.`,project_invitee_not_in_workspace:`That user is not a member of this workspace, so they cannot be added to a project in it.`,project_member_already_exists:`That user is already a member of this project.`,project_member_not_found:`That user is not a member of this project.`,task_not_found:`Task not found. Only a task you own can be moved or shared, and only by its id.`,asset_sharing_confirmation_required:`This task produced assets the project does not hold yet. Moving it in shares them with every member of the project — re-run with --confirm-asset-sharing to confirm.`,task_not_in_project:`This task is not in a project, so there are no project members to share it with.`,task_project_mismatch:"This task was moved out of this project while the command ran, so nothing was changed. `entrydesk project tasks <project>` lists the tasks in each project; re-run against the one it is in now.",not_project_member:"This person is not a member of the project. `entrydesk project get <project> --json` lists the members with their ids.",sharing_disabled:`Sharing is turned off for this workspace by an admin.`,share_visibility_not_allowed:`This share level is not allowed by the workspace share policy set by an admin.`,project_not_found:j,project_file_not_found:M,project_link_not_found:M,file_not_found:`The uploaded file is no longer there to attach. Run the command again.`,project_file_already_attached:`This file is already a source of the project.`,project_link_fetch_in_progress:"This link is already being fetched. Wait for `entrydesk project sources <project>` to show it as ready or failed, then refetch."};function I(){return new A(`project_owner_required`,F.project_owner_required)}function L(e){let{status:t}=e.response;if(t<400||t>=500)return null;let n=s(e.data);if(n===void 0)return null;let r=F[n];return r===void 0?null:new A(n,r)}async function R(e){try{let{features:t}=await e.getRuntimeConfig();if(!t.enableProject)return P()}catch{}return N()}const z=[/\/projects\/[^/]+\/notes$/u,/\/projects\/[^/]+\/tasks$/u,/\/tasks\/[^/]+$/u,/\/tasks\/[^/]+\/project$/u,/\/tasks\/[^/]+\/shares(?:\/members\/[^/]+)?$/u];function B(e){let{pathname:t}=new URL(e.request.url),n=z.some(e=>e.test(t));return e.request.method.toUpperCase()===`GET`?n?`tasks:read`:`projects:read`:n?`tasks:write`:`projects:write`}function V(t){if(typeof t!=`object`||!t)return;let n=t.data;if(typeof n!=`object`||!n)return;let{missingScopes:r,mode:i}=n;if(!Array.isArray(r)||r.length===0)return;let a=r.filter(t=>typeof t==`string`&&Object.hasOwn(e,t));if(a.length===r.length)return{scopes:a,mode:i===`any`?`any`:`all`}}function H({scopes:e,mode:t}){let n=e.map(e=>`\`${e}\``);if(n.length===1)return`the ${n[0]} scope`;let r=new Intl.ListFormat(`en`,{type:t===`any`?`disjunction`:`conjunction`}).format(n);return t===`any`?`one of the ${r} scopes`:`the ${r} scopes`}function U(e){let t=null;try{t=i()}catch{}let n=H(e),r=e.scopes.length===1||e.mode===`any`?`it`:`them`;return t?.authSource===`pat-env`?`This token is missing ${n}. Issue a personal access token that grants ${r}, then set ENTRYDESK_TOKEN to it.`:`Your session is missing ${n} — it predates project support. Run \`entrydesk login\` again to grant ${r}.`}function W(e){return new A(`insufficient_scope`,U(e))}function G(e){if(!(e instanceof c))return null;switch(e.code){case`project_not_found`:return N();case`project_not_enabled`:return P();case`insufficient_scope`:return W({scopes:[`tasks:write`],mode:`all`});default:return null}}async function K(e,t,n){if(t instanceof A)return t;if(!(t instanceof d))return null;let r=t.response.status;return r===403&&s(t.data)===`insufficient_scope`?W(V(t.data)??{scopes:[n??B(t)],mode:`all`}):r===404&&e?L(t)??R(e):L(t)}async function q(e,t={}){return K(t.client,e,t.requiredScope)}async function J(e,r,i,o){let s=await K(e,r,o);i.json||(s||a(r),console.error(`Error: ${t(s.message)}`),process.exit(1)),S({error:s?{code:s.code,message:s.message}:{code:`request_failed`,message:n(r).message}}),process.exit(1)}function Y(e,t){return J(void 0,t,e)}async function X(e,t,n){let i=new r;try{let{accessToken:e,workspaceId:n}=await o();return await t({client:i,accessToken:e,workspaceId:n})}catch(t){return J(i,t,e,n)}}async function Z(e,t){await X(e,t)}async function Q({client:e,accessToken:t,workspaceId:n},r){return e.listProjects(t,n,{limit:r.limit??20,nextKey:r.nextKey,filter:r.filter,sortBy:r.sortBy??`createdAt`,order:r.order??`asc`})}async function $(e,t){if(f(t))return t;if(!/^\d+$/u.test(t))throw N();let n=Number.parseInt(t,10),{projects:r}=await Q(e,{filter:`all`});if(n<1||n>r.length)throw new A(`project_index_out_of_range`,`No project numbered ${n}. \`entrydesk project list\` shows ${r.length}.`);return r[n-1].id}async function ee(e,t){let n=await $(e,t);return e.client.getProject(e.accessToken,e.workspaceId,n)}async function te(e,t){await e.client.getTasks(e.accessToken,e.workspaceId,{limit:1,projectId:t})}async function ne(e,t){return X({json:t},t=>$(t,e),`projects:read`)}export{D as C,v as S,b as T,y as _,$ as a,S as b,G as c,Z as d,X as f,k as g,w as h,ne as i,I as l,C as m,Q as n,A as o,g as p,ee as r,q as s,te as t,Y as u,_ as v,E as w,h as x,x as y};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{F as e}from"./profile-storage-DlaupNlV.js";function t(t){let n=e(t);if(console.log(`User grants (${n.length}):`),n.length===0){console.log(` (none)`);return}for(let e of n)console.log(` - ${e.user.name} <${e.user.email}> · ${e.role}`),console.log(` ID: ${e.subjectId}`)}export{t};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{b as e,u as t}from"./profile-storage-DlaupNlV.js";import{t as n}from"./resource-grants-D-ImlByb.js";import{i as r,m as i}from"./paths-DQh1PdjS.js";import{n as a,t as o}from"./commands-DUKXJUfr.js";import{t as s}from"./remote-nEFOyIM2.js";import c from"node:fs";import l from"node:os";import u from"node:path";import{isHTTPError as d}from"ky";import f from"node:crypto";import p from"node:fs/promises";import{Readable as m}from"node:stream";import{pipeline as h}from"node:stream/promises";import g from"adm-zip";import _ from"archiver";function v(e){return e.all?`all`:e.remote&&!e.local?`remote`:e.local&&!e.remote?`local`:`all`}function y(e,t,n){let r=new Map(t.map(e=>[e.name,e])),i=new Map(Object.entries(e)),a=new Set;if(n!==`remote`)for(let e of i.keys())a.add(e);if(n!==`local`)for(let e of r.keys())a.add(e);let o=[];for(let e of a){let t=i.get(e),n=r.get(e);o.push({name:e,local:!!t,remote:!!n,sourceType:t?.sourceType,skillId:t?.skillId??n?.id})}return o.sort((e,t)=>e.name<t.name?-1:+(e.name>t.name)),o}function b(e){return e.local&&e.remote?`local+remote`:e.local?`local-only`:`remote-only`}async function x(e,t){let n=v(e),{rootDir:a,workspaceId:o}=r(!!e.global,t.workspaceId),c=y(n===`remote`?{}:i(a).skills,n===`local`?[]:await s(t.client,t.accessToken,o),n);if(e.json){console.info(JSON.stringify(c,null,2));return}if(c.length===0){console.info(n===`local`?`No skills tracked locally.`:`No skills available in the workspace.`);return}let l=(e,t)=>e.padEnd(t);console.info(`${l(`NAME`,28)}${l(`WHERE`,14)}SOURCE`);for(let e of c)console.info(`${l(e.name,28)}${l(b(e),14)}${e.sourceType??`—`}`)}async function S(){let{accessToken:n,workspaceId:r}=await t();return{accessToken:n,workspaceId:r,client:new e}}function C(e,t){let n=u.relative(e,t);return n===``||!n.startsWith(`..`)&&!u.isAbsolute(n)}async function w(e){let t=await p.realpath(e),n=[process.cwd(),l.homedir()];if(!(await Promise.all(n.map(async e=>{try{return await p.realpath(e)}catch{return u.resolve(e)}}))).some(e=>C(e,t)))throw Error(`Invalid upload path: must be within the current directory or your home directory.`)}async function T(e){let t=await p.mkdtemp(u.join(l.tmpdir(),`entrydesk-skill-`)),n=u.join(t,`${u.basename(e)}.zip`);return await new Promise((t,r)=>{let i=c.createWriteStream(n),a=_(`zip`,{zlib:{level:9}});i.on(`close`,()=>t()),i.on(`error`,r),a.on(`error`,r),a.pipe(i),a.directory(e,!1),a.finalize()}),{zipPath:n,cleanupDir:t}}function E(e){console.log(`Versions (${e.length}):\n`);for(let t of e){let e=new Date(t.createdAt).toLocaleString();if(console.log(` v${t.versionNumber} · ${e}`),t.description){let e=t.description.length>100?`${t.description.slice(0,100)}…`:t.description;console.log(` ${e}`)}console.log(` Version ID: ${t.id}`),console.log(``)}}async function D(e){let t=await S();if(e.local||e.remote||e.all){await x(e,t);return}let n=[],r;do{let i=await t.client.listAvailableSkills(t.accessToken,t.workspaceId,{createdBy:e.mine?`me`:void 0,nextKey:r,limit:100});n.push(...i.skills),r=i.nextKey}while(r);if(e.json){console.log(JSON.stringify(n));return}if(n.length===0){console.log("No skills in this workspace yet. Upload one with `entrydesk skills upload <path>`, or browse `entrydesk marketplace`.");return}console.log(`Available skills (${n.length}):\n`);for(let e of n)console.log(` ${e.name} (${e.provider})`),console.log(` ${e.description.slice(0,120)}`),console.log(` ID: ${e.id}`),console.log(` Author: ${e.author.name}`),console.log(``)}async function O(n,r){let{accessToken:i,workspaceId:a}=await t(),o=new e,s=u.resolve(n),c;try{c=await p.stat(s)}catch{console.error(`File not found: ${s}`),process.exit(1)}let l=s,f=null;try{try{await w(s)}catch(e){let t=e instanceof Error?e.message:`Invalid upload path.`;console.error(t),process.exit(1)}if(c.isDirectory()){let e=await T(s);l=e.zipPath,f=e.cleanupDir}else c.isFile()||(console.error(`Not a file or directory: ${s}`),process.exit(1));u.extname(l).toLowerCase()!==`.zip`&&(console.error(`Only .zip files are supported for upload.`),process.exit(1));let e=await p.readFile(l),t=new FormData;t.append(`file`,new Blob([e],{type:`application/zip`}),u.basename(l)),r.force&&t.append(`force`,`true`);let n;try{n=await o.uploadSkill(i,a,t)}catch(e){throw d(e)&&e.response.status===409&&(console.error(`Upload failed: A skill with this name already exists.`),console.error(`Use --force to overwrite the existing skill.`),process.exit(1)),e}if(r.json){console.log(JSON.stringify(n));return}console.log(`Uploaded skill: ${n.name}`),console.log(` ID: ${n.id}`),console.log(` Version ID: ${n.versionId}`),console.log(` Description: ${n.description}`)}finally{f&&await p.rm(f,{recursive:!0,force:!0})}}async function k(n,r){!r.enable&&!r.disable&&(console.error(`Pass exactly one of --enable or --disable.`),process.exit(1));let i=!!r.enable,{accessToken:a,workspaceId:o}=await t(),s=await new e().updateSkillPreference(a,o,n,i);if(r.json){console.log(JSON.stringify(s));return}console.log(`${s.isEnabled?`Enabled`:`Disabled`} skill for you: ${n}`)}async function A(n,r){let{accessToken:i,workspaceId:a}=await t(),o=await new e().getSkillVersions(i,a,n);if(r.json){console.log(JSON.stringify(o));return}if(o.versions.length===0){console.log(`No versions for this skill.`);return}E(o.versions)}async function j(r,i){let{accessToken:a,workspaceId:o}=await t(),s=new e;if(i.addUser){let e=await s.upsertSkillGrant(a,o,r,i.addUser,i.role);if(i.json){console.log(JSON.stringify(e));return}console.log(`Granted ${i.role} to user ${i.addUser}`);return}if(i.removeUser){if(await s.removeSkillGrant(a,o,r,i.removeUser),i.json){console.log(JSON.stringify({userId:i.removeUser,removed:!0}));return}console.log(`Revoked access for user ${i.removeUser}`);return}let c=await s.getSkillGrants(a,o,r);if(i.json){console.log(JSON.stringify(c));return}n(c)}async function M(n){let{accessToken:r,workspaceId:i}=await t();await new e().deleteSkill(r,i,n),console.log(`Deleted skill: ${n}`)}async function N(n,r){let{accessToken:i,workspaceId:a}=await t(),{url:o,name:s}=await new e().downloadSkillCurrent(i,a,n);(s.includes(`/`)||s.includes(u.sep)||s===`.`||s===`..`||!s)&&(console.error(`Invalid skill name for output directory: ${s}`),process.exit(1));let d=u.resolve(s),_=await p.mkdtemp(u.join(l.tmpdir(),`entrydesk-skill-download-`)),v=u.join(_,`${s}.zip`);try{let e=await fetch(o);if(!e.ok)throw Error(`Failed to download skill zip: ${e.status} ${e.statusText}`);if(!e.body)throw Error(`Response body is empty`);let t=c.createWriteStream(v);await h(m.fromWeb(e.body),t);let i=await p.mkdtemp(u.join(u.dirname(d),`.entrydesk-skill-extract-`)),a=null;try{r.json||console.log(`Extracting…`);let e=new g(v),t=u.resolve(i)+u.sep;for(let n of e.getEntries()){if(n.isDirectory)continue;let e=u.resolve(i,n.entryName);if(!e.startsWith(t))throw Error(`Zip entry contains path traversal: ${n.entryName}`);await p.mkdir(u.dirname(e),{recursive:!0}),await p.writeFile(e,n.getData())}c.existsSync(d)&&(a=u.join(u.dirname(d),`.entrydesk-backup-${f.randomUUID()}`),r.json||console.log(`Replacing existing directory: ${d}`),await p.rename(d,a));try{await p.rename(i,d),a&&c.existsSync(a)&&(await p.rm(a,{recursive:!0,force:!0}),a=null)}catch(e){throw a&&c.existsSync(a)&&(await p.rename(a,d),a=null),e}}catch(e){if(await p.rm(i,{recursive:!0,force:!0}),a&&c.existsSync(a))try{await p.rename(a,d)}catch{console.error(`Warning: Could not restore backup. Your original files are at: ${a}`)}throw e}if(r.json){console.log(JSON.stringify({skillId:n,skillName:s,outputDir:d}));return}console.log(`Downloaded skill "${s}" to ${d}`)}finally{await p.rm(_,{recursive:!0,force:!0})}}async function P(e,t){let{runSkillsAdd:n}=await import(`./add-DXYghmJz.js`);await n(e,t,await S())}async function F(e,t){await a(e,t,await S())}async function I(e,t){let{runSkillsPush:n}=await import(`./push-DWIgzvqe.js`);await n(e,t,await S())}async function L(e){let{runSkillsStatus:t}=await import(`./status-BKd81bGK.js`);await t(e,await S())}async function R(e,t){let{runSkillsRemove:n}=await import(`./remove-Cpen9pWn.js`);await n(e,t,await S())}async function z(e,t){o(e,t,await S())}export{P as addSkill,M as deleteSkill,N as downloadSkill,z as linkSkillsDirectory,A as listSkillVersions,D as listSkills,F as pullSkill,I as pushSkill,R as removeSkill,j as shareSkill,L as showSkillsStatus,k as toggleSkill,O as uploadSkill};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- async function e(){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString(`utf8`)}export{e as t};