@zenovay/cli 1.0.20 → 1.0.22
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 +11 -42
- package/dist/{agency-HUEiLBdM.js → agency-Okyub24M.js} +1 -1
- package/dist/{ai-DVPgEpE5.js → ai-CkHldAAy.js} +2 -2
- package/dist/{alerts-DGhhV3nQ.js → alerts-CtJvkno7.js} +1 -1
- package/dist/analytical-screen-aN7IdBJg.js +2 -0
- package/dist/{analytics-jdQxsYk5.js → analytics-CmVIDrWQ.js} +2 -2
- package/dist/{annotation-D6fLu27t.js → annotation-BRVtWCp9.js} +1 -1
- package/dist/api-DNwHhHgq.js +1 -0
- package/dist/api-keys-BxKxRqyW.js +4 -0
- package/dist/api-v2-Bz2fYoCL.js +1 -0
- package/dist/api-v2-DSKqzdg2.js +1 -0
- package/dist/audit-DCnHqE9J.js +9 -0
- package/dist/{bar-NfgovYHe.js → bar-DjNjvYQO.js} +1 -1
- package/dist/bin.js +10 -8
- package/dist/{chat-panel-Dr-UWkLV.js → chat-panel-DKVM8gnJ.js} +2 -2
- package/dist/commands-CGCCx0-s.js +2 -0
- package/dist/{companies-DL_wp_Sj.js → companies-cabj3d0-.js} +1 -1
- package/dist/{completions-DNxZXd8A.js → completions-OtJMEYDU.js} +1 -1
- package/dist/csv-emit-CBCNHfG-.js +1 -0
- package/dist/csv-emit-D-SdR7uI.js +1 -0
- package/dist/{data-table-BhKjjiOS.js → data-table-Bd1OPNrr.js} +1 -1
- package/dist/{deploys-B55g6ZB4.js → deploys-QTSsCrTy.js} +1 -1
- package/dist/detect-installed-DRy7nYdn.js +1 -0
- package/dist/detect-installed-V9TMnJNX.js +1 -0
- package/dist/{devices-DnfuD112.js → devices-BHB5eE46.js} +1 -1
- package/dist/{doctor-BW-2V9HT.js → doctor-ZiR9bxJ7.js} +3 -3
- package/dist/{domains-C3_-68fv.js → domains-XD1saNip.js} +3 -3
- package/dist/{emit-D4YlMlzk.js → emit-5vELQfsB.js} +1 -1
- package/dist/{empty-state-D-krMX62.js → empty-state-CwrzE-7m.js} +1 -1
- package/dist/{ensure-latest-376mu_9d.js → ensure-latest-BfsWmA1w.js} +1 -1
- package/dist/ensure-latest-CEFXfYj4.js +5 -0
- package/dist/error-codes-D7Twp2zv.js +1 -0
- package/dist/{error-codes-DkVjjA_L.js → error-codes-GXDZXpFD.js} +1 -1
- package/dist/{errors-Bdh9GhJX.js → errors-CtgBOnY0.js} +1 -1
- package/dist/{events-tail-vlWXMzbA.js → events-tail-CIVgaryY.js} +1 -1
- package/dist/examples-BIoJ0JX7.js +1 -0
- package/dist/examples-CTNi99cn.js +1 -0
- package/dist/{export-BGrkk9Dl.js → export-4C_LgtHx.js} +1 -1
- package/dist/{formatter-C4YSOKuq.js → formatter-PBF-wEt1.js} +2 -2
- package/dist/{funnel-dN0-GIqN.js → funnel-Bx-KUoOT.js} +1 -1
- package/dist/{geo-Dx6sxVGF.js → geo-BsH8Mm4K.js} +1 -1
- package/dist/{globe-C1SGbvcg.js → globe-DdYu0z0L.js} +2 -2
- package/dist/goals-BX3yilhE.js +7 -0
- package/dist/{grid-CMwhs-Ms.js → grid-ClgMBAEr.js} +1 -1
- package/dist/health-1d05e2CO.js +1 -0
- package/dist/health-D3tlfAiQ.js +2 -0
- package/dist/{heatmaps-0l2Ru9HO.js → heatmaps-CvN3kiii.js} +1 -1
- package/dist/{home-BWFaMKpz.js → home--aqSi3mB.js} +1 -1
- package/dist/init-C-Dvttpj.js +1 -0
- package/dist/init-DzJGP7JS.js +334 -0
- package/dist/{insights-CI2nlPH-.js → insights-DCKvcCon.js} +1 -1
- package/dist/{integrations-CAAixyl-.js → integrations-BrCb7O4l.js} +1 -1
- package/dist/{journeys-D1TwMLYM.js → journeys-DtfJMcYM.js} +1 -1
- package/dist/{keybar-DO5OoZy9.js → keybar-BY1csJGI.js} +1 -1
- package/dist/live-9xYjX3la.js +1 -0
- package/dist/login-BbPNCOaH.js +4 -0
- package/dist/login-Dhkph5rl.js +1 -0
- package/dist/{logout-CF_KmWkd.js → logout-CfCYYReR.js} +1 -1
- package/dist/{metric-card-C4iqxdww.js → metric-card-D8RL2Pev.js} +1 -1
- package/dist/notes-0WwJZpSi.js +10 -0
- package/dist/{pages-DBrCrusk.js → pages-C4N9JCJ9.js} +1 -1
- package/dist/{panel-CTtQ2ue6.js → panel-DbiZwGB3.js} +1 -1
- package/dist/{plans-FCJyqaD0.js → plans-DBfyn8ja.js} +6 -6
- package/dist/{profile-DAsDvBn5.js → profile-D7T8dSQW.js} +3 -3
- package/dist/{progress-row-D73m0Rm7.js → progress-row-BSv_Zm8f.js} +1 -1
- package/dist/{projects-sCO5Jlct.js → projects-CmkWdDdX.js} +1 -1
- package/dist/{prompt-BXvg2B4R.js → prompt-Dae2nnYJ.js} +1 -1
- package/dist/{query-okSllDhT.js → query-Dl5eo-g9.js} +1 -1
- package/dist/{range-tabs-BbJdVWNV.js → range-tabs-Dw9sc3My.js} +1 -1
- package/dist/resolve-site-D8PIddP1.js +2 -0
- package/dist/{retention-BFZT0Eoz.js → retention-Ba-ohZ3s.js} +1 -1
- package/dist/{revenue-BLKT9W78.js → revenue-C2l81NmN.js} +1 -1
- package/dist/secrets-D8e4AxoX.js +1 -0
- package/dist/secrets-zGZxXoM0.js +1 -0
- package/dist/{self-test-Cm_BpRoW.js → self-test-BfzIC6mk.js} +3 -3
- package/dist/{sessions-1JcuQwxq.js → sessions-B0GvJulp.js} +1 -1
- package/dist/settings-CGUKYWAE.js +4 -0
- package/dist/share-DukezAIO.js +6 -0
- package/dist/{site-switcher-bjiIBrvC.js → site-switcher-B4-Gvl06.js} +1 -1
- package/dist/snippet-D3ErXaf9.js +1 -0
- package/dist/snippet-D_-q4Iep.js +1 -0
- package/dist/{sources-BzmLIW2R.js → sources-ht1uzCxP.js} +1 -1
- package/dist/{stats-CPCPx7NP.js → stats-D7TQa-uw.js} +1 -1
- package/dist/{status-agent-BLzMgUbS.js → status-agent-D2vh-F1c.js} +1 -1
- package/dist/team-DVPdK200.js +9 -0
- package/dist/{teams-DtMvj6HT.js → teams-CBn1LS5x.js} +1 -1
- package/dist/telemetry-BgkzI2cW.js +5 -0
- package/dist/{telemetry-M2VyQHie.js → telemetry-CyIcWTLw.js} +1 -1
- package/dist/{telemetry-BaEf884T.js → telemetry-DIAzAYko.js} +1 -1
- package/dist/{themes-6H0KlK3b.js → themes-BBtRXVPz.js} +1 -1
- package/dist/tier-Cz2KfGwA.js +1 -0
- package/dist/token-store-CuZEiQNg.js +1 -0
- package/dist/{token-store-DY6bMFE_.js → token-store-UmKB69od.js} +1 -1
- package/dist/{tour-fOYY-mK0.js → tour-CE8jtA2L.js} +1 -1
- package/dist/unknown-action-Wungfmqy.js +2 -0
- package/dist/update-CXMG8g-D.js +1 -0
- package/dist/{uptime-DdgexgvG.js → uptime-Df2I7T39.js} +1 -1
- package/dist/{usage-ClP0jFdO.js → usage-CgWY4ehT.js} +1 -1
- package/dist/{use-BskEVL9V.js → use-Cpi98HXg.js} +1 -1
- package/dist/{visitors-CbillpiG.js → visitors-DylJZT6Y.js} +1 -1
- package/dist/{vitals-CPe56vny.js → vitals-4vAU4Q6Z.js} +1 -1
- package/dist/webhooks-DBiHyH9U.js +10 -0
- package/dist/{webhooks-forward-DxugrXyz.js → webhooks-forward-CZwKa92u.js} +1 -1
- package/dist/wizard-bin.js +1 -1
- package/package.json +2 -1
- package/dist/analytical-screen-5FvN2k5q.js +0 -2
- package/dist/api-keys-B95XkMjO.js +0 -4
- package/dist/api-v2-BtUO8UBF.js +0 -1
- package/dist/api-v2-BxjgfqHE.js +0 -1
- package/dist/api-ytLQekr6.js +0 -1
- package/dist/audit-Opp6m9NZ.js +0 -9
- package/dist/commands-BE8-kQ9U.js +0 -2
- package/dist/csv-emit-C-9o-imN.js +0 -1
- package/dist/csv-emit-CmlDBfbA.js +0 -1
- package/dist/ensure-latest-2XLXMv9B.js +0 -5
- package/dist/error-codes-CY473EQl.js +0 -1
- package/dist/examples-BytnBT_k.js +0 -1
- package/dist/goals-B3_ITAwR.js +0 -7
- package/dist/health-D7ji_v4S.js +0 -1
- package/dist/health-R0FVZyAu.js +0 -2
- package/dist/init-D2RVRYNC.js +0 -1
- package/dist/init-srGbD_j9.js +0 -329
- package/dist/live-bDOiI3UZ.js +0 -1
- package/dist/login-CH9FIdiK.js +0 -1
- package/dist/login-EknFPQhV.js +0 -2
- package/dist/notes-Dv8LqdRf.js +0 -10
- package/dist/resolve-site-BTVBMF1C.js +0 -2
- package/dist/secrets-ApB7yh2A.js +0 -1
- package/dist/secrets-c-NB_plk.js +0 -1
- package/dist/settings-pmp0d_F3.js +0 -4
- package/dist/share-DulLRuN-.js +0 -6
- package/dist/team-FUYoQ9Na.js +0 -9
- package/dist/telemetry-DXc0eIRy.js +0 -5
- package/dist/tier-DDIroQbc.js +0 -1
- package/dist/token-store-RBywEspd.js +0 -1
- package/dist/update-OE8P_yoy.js +0 -1
- package/dist/webhooks-DvtT1sVr.js +0 -10
- /package/dist/{client-ntsEXSVC.js → client-DNMRt-Hq.js} +0 -0
- /package/dist/{confirm-DS5wux0g.js → confirm-R8wMITfX.js} +0 -0
- /package/dist/{fmt-xxIPQJX-.js → fmt-DKoQbgLw.js} +0 -0
- /package/dist/{keybar-deep-link-B4VJn2ko.js → keybar-deep-link-pVNTDhfX.js} +0 -0
- /package/dist/{open-url-BtI5aLgL.js → open-url-dPoDcwsm.js} +0 -0
- /package/dist/{sparkline-CpoBjjlc.js → sparkline-B7VaYaxH.js} +0 -0
- /package/dist/{theme-Brz9wK0w.js → theme-DSRmbn9T.js} +0 -0
- /package/dist/{ui-C5Te-OTJ.js → ui-aT7D3OhH.js} +0 -0
- /package/dist/{use-fullscreen-ucSyZkjO.js → use-fullscreen-BxfNad7W.js} +0 -0
- /package/dist/{ws-client-DYT7tqCw.js → ws-client-BTP1c9s8.js} +0 -0
package/dist/share-DulLRuN-.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{readConfig as e}from"./config-JVhBplSX.js";import"./api-ytLQekr6.js";import{readToken as t}from"./token-store-RBywEspd.js";import{ApiV2Client as n}from"./api-v2-BtUO8UBF.js";import{confirmDestructive as r}from"./confirm-DS5wux0g.js";import"./theme-Brz9wK0w.js";import"./panel-CTtQ2ue6.js";import"./prompt-BXvg2B4R.js";import{resolveSiteId as i}from"./resolve-site-BTVBMF1C.js";async function a(a){let o=await e(),s=await t({strict:!1}),c=new n({config:o,cliVersion:a.cliVersion,token:s}),l,u;try{({siteId:l,site:u}=await i(c,{explicit:a.siteId,headless:!!a.json,cliVersion:a.cliVersion}))}catch(e){return process.stderr.write(`${e.message}\n`),2}let d=u?.url?u.url.replace(/^https?:\/\//,``).replace(/\/$/,``):u?.name??l;try{switch(a.action){case`enable`:{let e=await c.enableShare(l);if(a.json)return process.stdout.write(JSON.stringify(e,null,2)+`
|
|
2
|
-
`),0;let t=`═`.repeat(72);return process.stdout.write(`\n${t}\n Public dashboard sharing enabled\n url: ${e.url}\n${t}\n\n Anyone with this link can view your dashboard. Disable with\n \`zenovay share disable\` to invalidate the link immediately.\n\n`),0}case`disable`:{let e=await r({resource:`public share link`,name:d,yes:a.yes,destructive:!0});if(!e)return process.stdout.write(`Cancelled.
|
|
3
|
-
`),1;let t=await c.disableShare(l);return a.json?(process.stdout.write(JSON.stringify(t)+`
|
|
4
|
-
`),0):(process.stdout.write(`✔ Public sharing disabled. The previous link is no longer valid.
|
|
5
|
-
`),0)}case`url`:{let e=await c.getShare(l);return a.json?(process.stdout.write(JSON.stringify(e,null,2)+`
|
|
6
|
-
`),0):e.enabled?(process.stdout.write(`Public URL: ${e.url??`—`}\n`),0):(process.stdout.write("Public sharing is disabled. Enable with `zenovay share enable`.\n"),0)}}}catch(e){return process.stderr.write(`✗ ${e.message}\n`),1}}export{a as shareCommand};
|
package/dist/team-FUYoQ9Na.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{readConfig as e}from"./config-JVhBplSX.js";import"./api-ytLQekr6.js";import{readToken as t}from"./token-store-RBywEspd.js";import{ApiV2Client as n}from"./api-v2-BtUO8UBF.js";import{requireTier as r}from"./tier-DDIroQbc.js";import{confirmDestructive as i}from"./confirm-DS5wux0g.js";import{fmtDate as a,formatTable as o,shortId as s}from"./fmt-xxIPQJX-.js";async function c(c){let l=await e(),u=await t({strict:!1}),d=new n({config:l,cliVersion:c.cliVersion,token:u});try{await r(d,`pro`)}catch(e){return process.stderr.write(`✗ ${e.message}\n`),2}try{switch(c.action){case`list`:{let e=await d.listTeam();if(c.json)return process.stdout.write(JSON.stringify(e,null,2)+`
|
|
2
|
-
`),0;let t=[{key:`userId`,header:`user id`,width:14,format:e=>s(String(e))},{key:`email`,header:`email`,width:32,format:e=>String(e??`—`)},{key:`role`,header:`role`,width:8},{key:`joinedAt`,header:`joined`,width:10,format:e=>a(e)}],n=[{key:`id`,header:`invite id`,width:14,format:e=>s(String(e))},{key:`email`,header:`email`,width:32},{key:`role`,header:`role`,width:8},{key:`expiresAt`,header:`expires`,width:10,format:e=>a(e)}];return process.stdout.write(`\nMEMBERS (${e.members.length})\n`),e.members.length===0?process.stdout.write(` — none —
|
|
3
|
-
`):process.stdout.write(o({rows:e.members,cols:t})),process.stdout.write(`\nPENDING INVITES (${e.invites.length})\n`),e.invites.length===0?process.stdout.write(` — none —
|
|
4
|
-
`):process.stdout.write(o({rows:e.invites,cols:n})),process.stdout.write(`
|
|
5
|
-
`),0}case`invite`:{if(!c.email)return process.stderr.write("Error: <email> is required for `team invite`.\n"),2;let e=c.role===`admin`?`admin`:`member`,t=await d.inviteTeamMember({email:c.email,role:e});return c.json?(process.stdout.write(JSON.stringify(t)+`
|
|
6
|
-
`),0):t.status===`already_invited`?(process.stdout.write(`Already invited: ${t.email} (id: ${t.invitationId}).\n`),0):(process.stdout.write(`✔ Invited ${t.email} as ${e} (id: ${t.invitationId}).\n`),0)}case`remove`:{if(!c.userId)return process.stderr.write("Error: <user-id> is required for `team remove`.\n"),2;let e=await i({resource:`team member`,name:s(c.userId),yes:c.yes,destructive:!0});if(!e)return process.stdout.write(`Cancelled.
|
|
7
|
-
`),1;let t=await d.removeTeamMember(c.userId);return c.json?(process.stdout.write(JSON.stringify(t)+`
|
|
8
|
-
`),0):(process.stdout.write(`✔ Removed team member ${s(c.userId)}.\n`),0)}case`role`:{if(!c.userId||!c.role)return process.stderr.write("Error: both <user-id> and <new-role> are required for `team role`.\n"),2;let e=c.role===`admin`?`admin`:`member`,t=await d.updateTeamMemberRole(c.userId,e);return c.json?(process.stdout.write(JSON.stringify(t)+`
|
|
9
|
-
`),0):(process.stdout.write(`✔ Set ${s(c.userId)} role → ${t.role}.\n`),0)}}}catch(e){return process.stderr.write(`✗ ${e.message}\n`),1}}export{c as teamCommand};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{configDir as e,readConfig as t,writeConfig as n}from"./config-JVhBplSX.js";import r from"node:path";import{mkdirSync as i,promises as a,readFileSync as o,writeFileSync as s}from"node:fs";import{ulid as c}from"ulid";const l=`/cli/telemetry/events`,u=5e3,d=20,f=100,p=3e3,m=r.join(e(),`telemetry-pending.json`),h=c(),g=Date.now(),_=[];let v=null,y=null,b=`0.0.0`,x=`https://api.zenovay.com`,S,C=!1,w=null;async function T(e){if(C)return;if(C=!0,b=e.cliVersion,x=e.apiBase??`https://api.zenovay.com`,S=e.token,E()){w=!1;return}let r=await t().catch(()=>null);if(r){if(r.telemetry===void 0){process.stderr.write(`Zenovay CLI sends anonymous usage telemetry to help us improve.
|
|
2
|
-
No site data, file contents, or chat messages are included.
|
|
3
|
-
Disable: \`zenovay telemetry off\` or set ZENOVAY_TELEMETRY=0 / DO_NOT_TRACK=1
|
|
4
|
-
|
|
5
|
-
`),r={...r,telemetry:{enabled:!0,disclosed_at:Date.now()}};try{await n(r)}catch{}}w=D(r),await j().catch(()=>void 0),process.on(`exit`,()=>{_.length>0&&A(_.splice(0))});for(let e of[`SIGINT`,`SIGTERM`])process.on(e,()=>{k()})}}function E(){let e=process.env.ZENOVAY_TELEMETRY;if(e===`0`||e===`false`||e===`off`||e===`no`)return!0;let t=process.env.DO_NOT_TRACK;return t===`1`||t===`true`}function D(e){let t=e.telemetry;return typeof t==`boolean`?t:t&&typeof t==`object`&&`enabled`in t?!!t.enabled:!0}function O(e,t={}){w!==!1&&(_.length>=f||(_.push({ts:Date.now(),event:e,cli_version:b,node_version:process.versions.node,os:process.platform,arch:process.arch,session_id:h,...t}),_.length>=d?k():v||=setTimeout(()=>{v=null,k()},u)))}async function k(){if(y)return y;if(_.length===0)return;if(w===!1){_.length=0;return}v&&(clearTimeout(v),v=null);let e=_.splice(0);return y=(async()=>{try{let t=x.replace(/\/$/,``)+l;await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`,...S?{Authorization:`Bearer ${S}`}:{}},body:JSON.stringify({events:e}),signal:AbortSignal.timeout(p)})}catch{try{A(e.slice(0,f))}catch{}}finally{y=null}})(),y}function A(t){try{i(e(),{recursive:!0,mode:448})}catch{}let n=[];try{let e=o(m,`utf8`),t=JSON.parse(e);Array.isArray(t)&&(n=t.slice(0,f))}catch{}let r=[...n,...t].slice(-f);try{s(m,JSON.stringify(r),{mode:384})}catch{}}async function j(){let e=[];try{let t=await a.readFile(m,`utf8`),n=JSON.parse(t);Array.isArray(n)&&(e=n)}catch{return}if(e.length===0)return;let t=e.slice(-f);try{let e=x.replace(/\/$/,``)+l,n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...S?{Authorization:`Bearer ${S}`}:{}},body:JSON.stringify({events:t}),signal:AbortSignal.timeout(p)});if(n.ok)try{await a.unlink(m)}catch{}}catch{}}async function M(){if(E())return{enabled:!1,source:`env`,endpoint:x.replace(/\/$/,``)+l,pending_count:await N()};let e=await t().catch(()=>null),n=e?.telemetry,r=!0,i,a=`default`;return typeof n==`boolean`?(r=n,a=`config`):n&&typeof n==`object`&&(r=!!n.enabled,i=n.disclosed_at,a=`config`),{enabled:r,source:a,disclosed_at:i,endpoint:x.replace(/\/$/,``)+l,pending_count:await N()}}async function N(){try{let e=await a.readFile(m,`utf8`),t=JSON.parse(e);return Array.isArray(t)?t.length:0}catch{return 0}}async function P(e){let r=await t();await n({...r,telemetry:{enabled:e,disclosed_at:Date.now()}}),w=e}function F(){return Date.now()-g}export{O as emit,k as flush,F as getProcessUptimeMs,M as getTelemetryStatus,T as initTelemetry,P as setTelemetry};
|
package/dist/tier-DDIroQbc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{readConfig as e,updateConfig as t}from"./config-JVhBplSX.js";const n=5*60*1e3,r=new Set([`free`,`pro`,`scale`,`enterprise`]),i={free:0,pro:1,scale:2,enterprise:3},a=`https://app.zenovay.com/billing`;function o(e){let t=(e??`free`).trim().toLowerCase();return r.has(t)?t:`free`}async function s(r){let i=await e(),a=Date.now();if(i.cachedTier&&i.cachedTierAt&&a-i.cachedTierAt<n)return o(i.cachedTier);try{let e=await r.me(),n=o(e.team?.plan);return await t({cachedTier:n,cachedTierAt:a}),n}catch{return i.cachedTier?o(i.cachedTier):`free`}}async function c(e,t){let n=await s(e);if(i[n]>=i[t])return;let r=t.charAt(0).toUpperCase()+t.slice(1);throw Error(`This command requires the ${r} plan or higher (you're on ${n}). Upgrade at ${a}.`)}export{s as getCachedTier,c as requireTier};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{configDir as e}from"./config-JVhBplSX.js";import t from"node:path";import{promises as n}from"node:fs";import{z as r}from"zod";const i=r.object({accessToken:r.string().min(1),refreshToken:r.string().min(1),expiresAt:r.number(),tokenType:r.literal(`Bearer`).default(`Bearer`),scope:r.string().optional(),userId:r.string().optional(),teamId:r.string().optional(),email:r.string().email().optional(),region:r.string().optional(),cliVersionAtIssue:r.string().optional()});function a(){return t.join(e(),`auth.json`)}async function o(e){let r=a(),o;try{o=await n.stat(r)}catch(e){if(e.code===`ENOENT`)return null;throw e}if(process.platform!==`win32`){let n=o.mode&511;if(n&63){let i=e?.strict??!0;if(i)throw Error(`Refusing to read ${r}: file has insecure permissions ${n.toString(8).padStart(3,`0`)} (expected 600). Fix: chmod 600 "${r}" && chmod 700 "${t.dirname(r)}"`)}}let s=await n.readFile(r,`utf8`),c;try{c=JSON.parse(s)}catch{throw Error(`Auth file at ${r} is not valid JSON. Run \`zenovay login\` again.`)}let l=i.safeParse(c);if(!l.success)throw Error(`Auth file at ${r} is malformed. Run \`zenovay login\` again.`);return l.data}async function s(t){let r=e();await n.mkdir(r,{recursive:!0,mode:448});let o=a(),s=i.parse(t),c=JSON.stringify(s,null,2);if(await n.writeFile(o,c,{mode:384}),process.platform!==`win32`){await n.chmod(o,384);try{await n.chmod(r,448)}catch{}}}async function c(){try{await n.unlink(a())}catch(e){if(e.code!==`ENOENT`)throw e}}function l(e,t=3e4){return Date.now()>=e.expiresAt-t}export{a as authPath,c as clearToken,l as isExpired,o as readToken,i as tokenStateSchema,s as writeToken};
|
package/dist/update-OE8P_yoy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{readConfig as e}from"./config-JVhBplSX.js";import{classifyBump as t,fetchManifest as n}from"./check-D9G0N7NB.js";import{applyUpdate as r,detectInstallMethod as i,runNpmGlobalInstall as a}from"./ensure-latest-2XLXMv9B.js";import"./formatter-C4YSOKuq.js";import{emit$1 as o,isHeadless as s}from"./emit-D4YlMlzk.js";async function c(c){let l=await e(),u=await n({cliBase:l.cliBase}),d=t(c.cliVersion,u.latest);if(c.check)return s({json:c.json})?o({type:`info`,message:`latest=${u.latest} current=${c.cliVersion} bump=${d}`}):process.stdout.write(`Current: ${c.cliVersion}\nLatest: ${u.latest}\nBump: ${d}\n`),{updated:!1,from:c.cliVersion,to:u.latest};if(d===`none`)return s({json:c.json})||process.stdout.write(`Already on latest (${c.cliVersion}).\n`),{updated:!1,from:c.cliVersion,to:u.latest};if(d===`downgrade`&&!c.forceDowngrade)throw Error(`Refused to downgrade ${c.cliVersion} → ${u.latest}. Pass --force-downgrade if you really want this.`);let f=i();if(f===`npm-global`){s({json:c.json})||process.stdout.write(`Updating via npm to @zenovay/cli@${u.latest}…\n`);let e=await a(u.latest);return{updated:e,from:c.cliVersion,to:u.latest}}if(f===`npm-local`){let e=`Update your project dependency: npm i @zenovay/cli@${u.latest}`;return s({json:c.json})?o({type:`info`,message:e}):process.stdout.write(`${e}\n`),{updated:!1,from:c.cliVersion,to:u.latest}}try{let e=await r({currentVersion:c.cliVersion,cliBase:l.cliBase,binaryPath:c.binaryPath,forceDowngrade:c.forceDowngrade});return s({json:c.json})?e.updated&&o({type:`update.applied`,from:e.from,to:e.to}):e.updated?process.stdout.write(`Updated ${e.from} → ${e.to}\n`):process.stdout.write(`Not updated (${e.reason??`unknown`}).\n`),e}catch(e){if(/No release binary/i.test(e.message)){let e=`No prebuilt binary for your platform on this release yet. Update via npm instead:\n npm i -g @zenovay/cli@${u.latest}`;return s({json:c.json})?o({type:`info`,message:e}):process.stdout.write(`${e}\n`),{updated:!1,from:c.cliVersion,to:u.latest}}throw e}}export{c as updateCommand};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{readConfig as e}from"./config-JVhBplSX.js";import"./api-ytLQekr6.js";import{readToken as t}from"./token-store-RBywEspd.js";import{emitErrorEnvelope as n}from"./error-codes-DkVjjA_L.js";import{ApiV2Client as r}from"./api-v2-BtUO8UBF.js";import{confirmDestructive as i}from"./confirm-DS5wux0g.js";import"./formatter-C4YSOKuq.js";import{emitEnvelope as a,wrapItem as o,wrapList as s}from"./emit-D4YlMlzk.js";function c(e){return e.length>12?`${e.slice(0,8)}…${e.slice(-4)}`:e}function l(e){return e?new Date(e).toISOString().slice(0,10):`—`}async function u(u){let d=await e(),f=await t({strict:!1}),p=new r({config:d,cliVersion:u.cliVersion,token:f});try{switch(u.action){case`list`:{let{webhooks:e}=await p.listWebhooks();if(u.json)return a(s(e,`webhooks.list`),{legacyKey:`webhooks`,legacyValue:e}),0;if(e.length===0)return process.stdout.write("No webhooks yet. Add one with `zenovay webhooks add <https-url> --events <e1,e2>`.\n"),0;let t=[``,`id`,`url`,`events`,`created`],n=[1,14,40,28,10],r=e=>e.map((e,t)=>(e??``).padEnd(n[t])).join(` `);process.stdout.write(r(t)+`
|
|
2
|
-
`),process.stdout.write(r(n.map(e=>`─`.repeat(e)))+`
|
|
3
|
-
`);for(let t of e){let e=t.status===`disabled`?`○`:`●`,i=t.url.length>n[2]?`${t.url.slice(0,n[2]-1)}…`:t.url,a=t.events.join(`,`),o=a.length>n[3]?`${a.slice(0,n[3]-1)}…`:a;process.stdout.write(r([e,c(t.id),i,o,l(t.createdAt)])+`
|
|
4
|
-
`)}return process.stdout.write(`
|
|
5
|
-
● = active, ○ = disabled
|
|
6
|
-
`),0}case`add`:{if(!u.url)return process.stderr.write("Error: webhook URL is required — e.g. `zenovay webhooks add https://example.com/hook --events traffic_spike`.\n"),2;if(!u.url.startsWith(`https://`))return process.stderr.write(`Error: webhook URL must use https://.
|
|
7
|
-
`),2;let e=(u.events??``).split(`,`).map(e=>e.trim()).filter(Boolean);if(e.length===0)return process.stderr.write(`Error: --events is required (comma-separated). Examples: traffic_spike, traffic_drop, goal_completed, error_spike, website_down, website_up.
|
|
8
|
-
`),2;let t=await p.createWebhook({url:u.url,events:e});if(u.json)return a(o(t,`webhooks.item`)),0;let n=`═`.repeat(72);return process.stdout.write(`\n${n}\n Webhook created\n id: ${t.id}\n url: ${t.url}\n events: ${t.events.join(`, `)}\n secret: ${t.secret}\n${n}\n\n ⚠ Save this secret NOW — it will not be shown again.\n Verify inbound payloads via the X-Zenovay-Signature header (HMAC-SHA256).\n\n`),0}case`delete`:{if(!u.id)return process.stderr.write("Error: webhook id is required for `webhooks delete`.\n"),2;let e=await i({resource:`webhook`,name:c(u.id),yes:u.yes,destructive:!0});if(!e)return process.stdout.write(`Cancelled.
|
|
9
|
-
`),1;let t=await p.deleteWebhook(u.id);return u.json?(a(o(t,`webhooks.deleted`)),0):(process.stdout.write(`✔ Deleted webhook ${c(u.id)}.\n`),0)}case`rotate`:{if(!u.id)return process.stderr.write("Error: webhook id is required for `webhooks rotate`.\n"),2;let e=await i({resource:`webhook secret`,name:c(u.id),yes:u.yes,destructive:!0});if(!e)return process.stdout.write(`Cancelled.
|
|
10
|
-
`),1;let t=await p.rotateWebhookSecret(u.id);if(u.json)return a(o(t,`webhooks.rotated`)),0;let n=`═`.repeat(72);return process.stdout.write(`\n${n}\n Webhook secret rotated\n id: ${c(u.id)}\n rotatedAt: ${t.rotatedAt}\n secret: ${t.secret}\n${n}\n\n ⚠ Save this secret NOW — it will not be shown again.\n The previous secret is no longer valid.\n\n`),0}case`test`:{if(!u.id)return process.stderr.write("Error: webhook id is required for `webhooks test`.\n"),2;let e=await p.testWebhook(u.id);if(u.json)return a(o(e,`webhooks.tested`)),0;let t=e.ok?`✔`:`✗`;return process.stdout.write(`${t} Test fired to webhook ${c(u.id)} — HTTP ${e.status} in ${e.durationMs}ms.\n`),e.ok?0:1}}}catch(e){return n(e,{command:`webhooks ${u.action}`})}}export{u as webhooksCommand};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|