@zenovay/cli 0.1.20 → 0.1.21

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/bin.js CHANGED
@@ -4,4 +4,4 @@ import{readConfig as e}from"./config-CZ9IzjIH.js";import{manifestSchema as t}fro
4
4
  `),t(!0))},m);try{process.stdin.resume(),process.stdin.on(`data`,r)}catch{i(),t(!0)}})}function w(e){try{let t=e.slice(1),n=a(process.execPath,t,{stdio:`inherit`});n.on(`exit`,e=>{process.exit(typeof e==`number`?e:0)}),n.on(`error`,()=>{})}catch{}}function T(e){if(process.env.ZENOVAY_DEBUG_UPDATE===`1`)try{process.stderr.write(`zenovay: ${e}\n`)}catch{}}const E=o.dirname(s(import.meta.url)),D=o.join(E,`..`,`package.json`),O=JSON.parse(c(D,`utf8`)),k=O.version,A=process.argv[0]??`zenovay`;function j(){if(process.env.ZENOVAY_BACKGROUND_UPDATE===`1`&&!(process.env.ZENOVAY_NO_UPDATE_CHECK===`1`||process.env.CI===`true`))try{let e=o.join(E,`lib`,`update`,`worker.js`),t=i(e,[],{detached:!0,stdio:`ignore`});t.unref()}catch{}}const M=r(`zenovay`);M.version(k),M.help(),M.command(`init`,`AI install wizard — add Zenovay tracking to your codebase`).option(`--json`,`Emit NDJSON events to stdout`).option(`--yes`,`Auto-approve all diffs (for CI)`).option(`--skip-mcp`,`Skip MCP client install`).option(`--skip-verify`,`Skip first-event verification`).action(async e=>{let{initCommand:t}=await import(`./init-DbWxI6M2.js`),n=await t({cliVersion:k,cwd:process.cwd(),json:e.json,yes:e.yes,skipMcp:e.skipMcp,skipVerify:e.skipVerify});process.exitCode=n}),M.command(`login`,`Authenticate via OAuth device flow`).option(`--json`,`Emit NDJSON events`).option(`--no-browser`,`Skip opening the browser automatically`).action(async e=>{let{loginCommand:t}=await import(`./login-Bb_At1Ov.js`),n=await t({cliVersion:k,json:e.json,openBrowser:e.browser!==!1,onCode:e=>{process.stdout.write(`\n Open this URL to authorize the CLI:\n ${e.verificationUriComplete??e.verificationUri}\n Or enter code: ${e.userCode}\n\n`)}});!e.json&&n.email?process.stdout.write(`\n ✔ Logged in as ${n.email}\n Try \`zenovay overview\` to see your dashboard, or \`zenovay --help\` for the full command list.\n\n`):e.json||process.stdout.write(`
5
5
  ✔ Logged in.
6
6
 
7
- `)}),M.command(`logout`,`Revoke current session and delete local auth`).option(`--json`,``).action(async e=>{let{logoutCommand:t}=await import(`./logout-B3V_2DRZ.js`);await t({cliVersion:k,json:e.json})}),M.command(`ai`,`3-mode AI assistant (install / chat / mcp)`).option(`--mode <mode>`,`install | chat | mcp`).option(`--json`,``).action(async e=>{let{aiCommand:t}=await import(`./ai-BtL-3tWv.js`),n=await t({cliVersion:k,cwd:process.cwd(),mode:e.mode,json:e.json});process.exitCode=n}),M.command(`watch`,"[ANALYTICS] Alias for `overview` (dashboard summary)").option(`--site-id <id>`,`Site ID`).option(`--interval <ms>`,`Poll interval ms (legacy; ignored by overview)`,{default:15e3}).option(`--json`,``).action(async e=>{let{overviewCommand:t}=await import(`./overview-CGTlmjQy.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`overview`,`[ANALYTICS] Landing dashboard — visitors, pageviews, bounce, top pages`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{overviewCommand:t}=await import(`./overview-CGTlmjQy.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`live`,`[ANALYTICS] Real-time visitors + globe + recent events (2s polling)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{liveCommand:t}=await import(`./live-BeZkd7mo.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`pages`,`[ANALYTICS] Top pages by views — last 24h`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{pagesCommand:t}=await import(`./pages-CEcLNfKb.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`devices`,`[ANALYTICS] Device / browser / OS breakdown — last 24h`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{devicesCommand:t}=await import(`./devices-DiBMDyfc.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`geo`,`[ANALYTICS] Countries + cities + globe — last 24h`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{geoCommand:t}=await import(`./geo-PyqvcLvy.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`retention`,`[BEHAVIOR] Cohort retention heatmap — D1 / D7 / D30 (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{retentionCommand:t}=await import(`./retention-xuYAxg4L.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`uptime`,`[BEHAVIOR] Uptime monitors with status + p95 (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{uptimeCommand:t}=await import(`./uptime-DQUNMxBI.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`sessions`,`[BEHAVIOR] Recent session-replay list (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{sessionsCommand:t}=await import(`./sessions-DXxeC1Om.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`heatmaps`,`[BEHAVIOR] Recent heatmap captures (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{heatmapsCommand:t}=await import(`./heatmaps-CrOP0_TX.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`journeys`,`[BEHAVIOR] Page-to-page transition flow (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{journeysCommand:t}=await import(`./journeys-DegXpwij.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`insights`,`[INTELLIGENCE] AI-generated anomaly / trend / recommendation cards (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{insightsCommand:t}=await import(`./insights-yI1UgyRG.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`events tail`,`Stream live events`).option(`--site-id <id>`,`Site ID`,{default:``}).option(`--filter <expr>`,`Filter expression (e.g. 'type=pageview AND country=US')`).option(`--forward-to <url>`,`POST each event to a webhook with HMAC-SHA256 signature`).option(`--replay-24h`,`Replay the last 24h before going live`).option(`--set-forward-secret <hex>`,`Persist the HMAC secret used by --forward-to`).option(`--json`,``).action(async e=>{let{eventsTailCommand:t}=await import(`./events-tail-BlMK84c8.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json,filter:e.filter,forwardTo:e.forwardTo,replay24h:e.replay24h,setForwardSecret:e.setForwardSecret});process.exitCode=n}),M.command(`health`,`Run self-diagnostic checks`).option(`--json`,``).action(async e=>{let{healthCommand:t}=await import(`./health-BioDPveS.js`),n=await t({cliVersion:k,binaryPath:A,json:e.json});process.exitCode=n}),M.command(`doctor`,`AI-assisted self-healing`).option(`--json`,``).action(async e=>{let{doctorCommand:t}=await import(`./doctor-Cewej993.js`),n=await t({cliVersion:k,binaryPath:A,json:e.json});process.exitCode=n}),M.command(`stats`,`One-shot dashboard summary (scriptable by default)`).option(`--site-id <id>`,`Site ID`).option(`--range <range>`,`Time range: 24h | 7d | 30d`,{default:`24h`}).option(`--watch`,`Auto-refresh every 60s`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{statsCommand:t}=await import(`./stats-DWj2oLhf.js`),n=await t({cliVersion:k,siteId:e.siteId,range:e.range,watch:e.watch,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`sources`,`Traffic source breakdown with delta arrows`).option(`--site-id <id>`,`Site ID`).option(`--period <p>`,`Period: 7d | 30d | 90d | 1y`,{default:`30d`}).option(`--compare <c>`,`Comparison window (use "prev" for period-over-period)`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{sourcesCommand:t}=await import(`./sources-Bs-T6MjS.js`),n=await t({cliVersion:k,siteId:e.siteId,period:e.period,compare:e.compare,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`vitals`,`Core Web Vitals dashboard (LCP / INP / CLS / TTFB / FCP)`).option(`--site-id <id>`,`Site ID`).option(`--url <path>`,`Filter to a single URL`).option(`--device <type>`,`Filter by device: mobile | desktop`).option(`--window <w>`,`Time window: 24h | 7d | 30d | 90d`,{default:`7d`}).option(`--watch`,`Auto-refresh every 5 minutes`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{vitalsCommand:t}=await import(`./vitals-B23CXo61.js`),n=await t({cliVersion:k,siteId:e.siteId,url:e.url,device:e.device,window:e.window,watch:e.watch,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`revenue`,`MRR / ARR / transaction series`).option(`--site-id <id>`,`Site ID`).option(`--range <r>`,`Time range: 24h | 7d | 30d | 1y`,{default:`30d`}).option(`--watch`,`Auto-refresh every 5 minutes`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{revenueCommand:t}=await import(`./revenue-CUHv5LCn.js`),n=await t({cliVersion:k,siteId:e.siteId,range:e.range,watch:e.watch,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`funnels`,`List available funnels`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{funnelCommand:t}=await import(`./funnel-Z3HHRLwg.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`themes`,`List available themes with colored swatches`).option(`--validate <path>`,`Validate a custom theme JSON file`).option(`--json`,`Emit themes JSON to stdout`).action(async e=>{let{themesCommand:t}=await import(`./themes-DbjOibiR.js`),n=await t({cliVersion:k,validate:e.validate,json:e.json});process.exitCode=n}),M.command(`completions [shell]`,`Emit shell-completion script (bash | zsh | fish | nushell | pwsh)`).option(`--list`,`List supported shells`).action(async(e,t)=>{let{completionsCommand:n}=await import(`./completions-CnHbpLqp.js`),r=await n({shell:e,list:t.list});process.exitCode=r}),M.command(`query [sql]`,`Restricted SQL REPL over the analytics schema (Scale+)`).option(`--site-id <id>`,`Site ID`).option(`--max-rows <n>`,`Cap result row count`,{default:1e3}).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async(e,t)=>{let{queryCommand:n}=await import(`./query-DlhhP3PE.js`),r=await n({cliVersion:k,siteId:t.siteId,sql:e,maxRows:typeof t.maxRows==`string`?Number(t.maxRows):t.maxRows,json:t.json,csv:t.csv,tsv:t.tsv,ndjson:t.ndjson});process.exitCode=r}),M.command(`companies`,`B2B identification feed (Scale+)`).option(`--site-id <id>`,`Site ID`).option(`--window <w>`,`Time window: 24h | 7d | 30d | 90d`,{default:`24h`}).option(`--limit <n>`,`Max rows`,{default:100}).option(`--new-only`,`Show only newly identified companies (first-seen in last hour)`).option(`--watch`,`Auto-refresh every 30s`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{companiesCommand:t}=await import(`./companies-Ck1YXksb.js`),n=await t({cliVersion:k,siteId:e.siteId,window:e.window,limit:typeof e.limit==`string`?Number(e.limit):e.limit,newOnly:e.newOnly,watch:e.watch,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`projects`,`List your tracked projects`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{projectsCommand:t}=await import(`./projects-DnzI_z_C.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`deploys`,`Recent GitHub commits overlaid on charts (Wave 4 W5)`).option(`--site-id <id>`,`Site ID`).option(`--branch <name>`,`Filter to a single branch (e.g. main, develop)`).option(`--since <iso>`,`Only commits after this ISO timestamp`).option(`--limit <n>`,`Max rows`,{default:50}).option(`--connect`,`Print the GitHub-integration deep link in app.zenovay.com`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{deploysCommand:t}=await import(`./deploys-BDcSODZT.js`),n=await t({cliVersion:k,siteId:e.siteId,branch:e.branch,since:e.since,limit:typeof e.limit==`string`?Number(e.limit):e.limit,connect:e.connect,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`webhooks forward`,`Forward webhook events to a local URL (stripe-listen-style; W3)`).option(`--to <url>`,`Local URL to POST events to (e.g. localhost:3000/webhook)`).option(`--site-id <id>`,`Site ID`).option(`--sign`,`HMAC-sign each forwarded request with X-Zenovay-Signature`).option(`--secret <hex>`,`HMAC secret (auto-derived from tunnel key if --sign without --secret)`).option(`--max-retries <n>`,`Per-request retry count`,{default:3}).action(async e=>{let{webhooksForwardCommand:t}=await import(`./webhooks-forward-9COAtWRu.js`),n=await t({cliVersion:k,to:e.to,siteId:e.siteId,sign:e.sign,secret:e.secret,maxRetries:typeof e.maxRetries==`string`?Number(e.maxRetries):e.maxRetries});process.exitCode=n}),M.command(`errors`,`Recent error snapshot (Wave 2 lead-in; SSE coming in V2.1)`).option(`--site-id <id>`,`Site ID`).option(`--window <w>`,`Time window: 24h | 7d | 30d | 90d`,{default:`24h`}).option(`--limit <n>`,`Max errors to fetch`,{default:100}).option(`--search <q>`,`Filter by class or message substring`).option(`--watch`,`Auto-refresh every 30s`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{errorsCommand:t}=await import(`./errors-DHpw3PO2.js`),n=await t({cliVersion:k,siteId:e.siteId,window:e.window,limit:typeof e.limit==`string`?Number(e.limit):e.limit,search:e.search,watch:e.watch,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`funnel <id>`,`Funnel drop-off chart for a specific funnel`).option(`--site-id <id>`,`Site ID`).option(`--window <w>`,`Time window: 7d | 30d`,{default:`30d`}).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async(e,t)=>{let{funnelCommand:n}=await import(`./funnel-Z3HHRLwg.js`),r=await n({cliVersion:k,siteId:t.siteId,funnelId:e,window:t.window,json:t.json,csv:t.csv,tsv:t.tsv,ndjson:t.ndjson});process.exitCode=r}),M.command(`use [site]`,`Set / show / reset your default site (used when --site-id is omitted)`).option(`--reset`,`Clear the stored default site`).option(`--show`,`Print the current default and exit`).option(`--json`,`Emit JSON`).action(async(e,t)=>{let{useCommand:n}=await import(`./use-DSsSDVW7.js`),r=await n({cliVersion:k,match:e,reset:t.reset,show:t.show,json:t.json});process.exitCode=r}),M.command(`update`,`Manually install the latest version`).option(`--check`,`Don't install — just print latest`).option(`--force-downgrade`,`Allow downgrading to an older version`).option(`--no-update-check`,`Disable auto-update for this invocation`).option(`--json`,``).action(async e=>{let{updateCommand:t}=await import(`./update-wMGBdUT-.js`);await t({cliVersion:k,binaryPath:A,check:e.check,forceDowngrade:e.forceDowngrade,json:e.json})}),M.parse(process.argv,{run:!1}),(async()=>{await _({binaryPath:A,currentVersion:k,argv:process.argv}),j();try{await M.runMatchedCommand()}catch(e){process.stderr.write(`\n✗ ${e.message}\n`),process.exit(1)}})();
7
+ `)}),M.command(`logout`,`Revoke current session and delete local auth`).option(`--json`,``).action(async e=>{let{logoutCommand:t}=await import(`./logout-B3V_2DRZ.js`);await t({cliVersion:k,json:e.json})}),M.command(`ai`,`3-mode AI assistant (install / chat / mcp)`).option(`--mode <mode>`,`install | chat | mcp`).option(`--json`,``).action(async e=>{let{aiCommand:t}=await import(`./ai-BtL-3tWv.js`),n=await t({cliVersion:k,cwd:process.cwd(),mode:e.mode,json:e.json});process.exitCode=n}),M.command(`watch`,"[ANALYTICS] Alias for `overview` (dashboard summary)").option(`--site-id <id>`,`Site ID`).option(`--interval <ms>`,`Poll interval ms (legacy; ignored by overview)`,{default:15e3}).option(`--json`,``).action(async e=>{let{overviewCommand:t}=await import(`./overview-B26vhFkA.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`overview`,`[ANALYTICS] Landing dashboard — visitors, pageviews, bounce, top pages`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{overviewCommand:t}=await import(`./overview-B26vhFkA.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`live`,`[ANALYTICS] Real-time visitors + globe + recent events (2s polling)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{liveCommand:t}=await import(`./live-BeZkd7mo.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`pages`,`[ANALYTICS] Top pages by views — last 24h`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{pagesCommand:t}=await import(`./pages-CEcLNfKb.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`devices`,`[ANALYTICS] Device / browser / OS breakdown — last 24h`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{devicesCommand:t}=await import(`./devices-DiBMDyfc.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`geo`,`[ANALYTICS] Countries + cities + globe — last 24h`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{geoCommand:t}=await import(`./geo-PyqvcLvy.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`retention`,`[BEHAVIOR] Cohort retention heatmap — D1 / D7 / D30 (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{retentionCommand:t}=await import(`./retention-xuYAxg4L.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`uptime`,`[BEHAVIOR] Uptime monitors with status + p95 (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{uptimeCommand:t}=await import(`./uptime-DQUNMxBI.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`sessions`,`[BEHAVIOR] Recent session-replay list (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{sessionsCommand:t}=await import(`./sessions-DXxeC1Om.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`heatmaps`,`[BEHAVIOR] Recent heatmap captures (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{heatmapsCommand:t}=await import(`./heatmaps-CrOP0_TX.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`journeys`,`[BEHAVIOR] Page-to-page transition flow (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{journeysCommand:t}=await import(`./journeys-DegXpwij.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`insights`,`[INTELLIGENCE] AI-generated anomaly / trend / recommendation cards (Pro+)`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).action(async e=>{let{insightsCommand:t}=await import(`./insights-yI1UgyRG.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json});process.exitCode=n}),M.command(`events tail`,`Stream live events`).option(`--site-id <id>`,`Site ID`,{default:``}).option(`--filter <expr>`,`Filter expression (e.g. 'type=pageview AND country=US')`).option(`--forward-to <url>`,`POST each event to a webhook with HMAC-SHA256 signature`).option(`--replay-24h`,`Replay the last 24h before going live`).option(`--set-forward-secret <hex>`,`Persist the HMAC secret used by --forward-to`).option(`--json`,``).action(async e=>{let{eventsTailCommand:t}=await import(`./events-tail-BlMK84c8.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json,filter:e.filter,forwardTo:e.forwardTo,replay24h:e.replay24h,setForwardSecret:e.setForwardSecret});process.exitCode=n}),M.command(`health`,`Run self-diagnostic checks`).option(`--json`,``).action(async e=>{let{healthCommand:t}=await import(`./health-BioDPveS.js`),n=await t({cliVersion:k,binaryPath:A,json:e.json});process.exitCode=n}),M.command(`doctor`,`AI-assisted self-healing`).option(`--json`,``).action(async e=>{let{doctorCommand:t}=await import(`./doctor-Cewej993.js`),n=await t({cliVersion:k,binaryPath:A,json:e.json});process.exitCode=n}),M.command(`stats`,`One-shot dashboard summary (scriptable by default)`).option(`--site-id <id>`,`Site ID`).option(`--range <range>`,`Time range: 24h | 7d | 30d`,{default:`24h`}).option(`--watch`,`Auto-refresh every 60s`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{statsCommand:t}=await import(`./stats-DWj2oLhf.js`),n=await t({cliVersion:k,siteId:e.siteId,range:e.range,watch:e.watch,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`sources`,`Traffic source breakdown with delta arrows`).option(`--site-id <id>`,`Site ID`).option(`--period <p>`,`Period: 7d | 30d | 90d | 1y`,{default:`30d`}).option(`--compare <c>`,`Comparison window (use "prev" for period-over-period)`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{sourcesCommand:t}=await import(`./sources-Bs-T6MjS.js`),n=await t({cliVersion:k,siteId:e.siteId,period:e.period,compare:e.compare,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`vitals`,`Core Web Vitals dashboard (LCP / INP / CLS / TTFB / FCP)`).option(`--site-id <id>`,`Site ID`).option(`--url <path>`,`Filter to a single URL`).option(`--device <type>`,`Filter by device: mobile | desktop`).option(`--window <w>`,`Time window: 24h | 7d | 30d | 90d`,{default:`7d`}).option(`--watch`,`Auto-refresh every 5 minutes`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{vitalsCommand:t}=await import(`./vitals-B23CXo61.js`),n=await t({cliVersion:k,siteId:e.siteId,url:e.url,device:e.device,window:e.window,watch:e.watch,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`revenue`,`MRR / ARR / transaction series`).option(`--site-id <id>`,`Site ID`).option(`--range <r>`,`Time range: 24h | 7d | 30d | 1y`,{default:`30d`}).option(`--watch`,`Auto-refresh every 5 minutes`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{revenueCommand:t}=await import(`./revenue-CUHv5LCn.js`),n=await t({cliVersion:k,siteId:e.siteId,range:e.range,watch:e.watch,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`funnels`,`List available funnels`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{funnelCommand:t}=await import(`./funnel-Z3HHRLwg.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`themes`,`List available themes with colored swatches`).option(`--validate <path>`,`Validate a custom theme JSON file`).option(`--json`,`Emit themes JSON to stdout`).action(async e=>{let{themesCommand:t}=await import(`./themes-DbjOibiR.js`),n=await t({cliVersion:k,validate:e.validate,json:e.json});process.exitCode=n}),M.command(`completions [shell]`,`Emit shell-completion script (bash | zsh | fish | nushell | pwsh)`).option(`--list`,`List supported shells`).action(async(e,t)=>{let{completionsCommand:n}=await import(`./completions-CnHbpLqp.js`),r=await n({shell:e,list:t.list});process.exitCode=r}),M.command(`query [sql]`,`Restricted SQL REPL over the analytics schema (Scale+)`).option(`--site-id <id>`,`Site ID`).option(`--max-rows <n>`,`Cap result row count`,{default:1e3}).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async(e,t)=>{let{queryCommand:n}=await import(`./query-DlhhP3PE.js`),r=await n({cliVersion:k,siteId:t.siteId,sql:e,maxRows:typeof t.maxRows==`string`?Number(t.maxRows):t.maxRows,json:t.json,csv:t.csv,tsv:t.tsv,ndjson:t.ndjson});process.exitCode=r}),M.command(`companies`,`B2B identification feed (Scale+)`).option(`--site-id <id>`,`Site ID`).option(`--window <w>`,`Time window: 24h | 7d | 30d | 90d`,{default:`24h`}).option(`--limit <n>`,`Max rows`,{default:100}).option(`--new-only`,`Show only newly identified companies (first-seen in last hour)`).option(`--watch`,`Auto-refresh every 30s`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{companiesCommand:t}=await import(`./companies-Ck1YXksb.js`),n=await t({cliVersion:k,siteId:e.siteId,window:e.window,limit:typeof e.limit==`string`?Number(e.limit):e.limit,newOnly:e.newOnly,watch:e.watch,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`projects`,`List your tracked projects`).option(`--site-id <id>`,`Site ID`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{projectsCommand:t}=await import(`./projects-DnzI_z_C.js`),n=await t({cliVersion:k,siteId:e.siteId,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`deploys`,`Recent GitHub commits overlaid on charts (Wave 4 W5)`).option(`--site-id <id>`,`Site ID`).option(`--branch <name>`,`Filter to a single branch (e.g. main, develop)`).option(`--since <iso>`,`Only commits after this ISO timestamp`).option(`--limit <n>`,`Max rows`,{default:50}).option(`--connect`,`Print the GitHub-integration deep link in app.zenovay.com`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{deploysCommand:t}=await import(`./deploys-BDcSODZT.js`),n=await t({cliVersion:k,siteId:e.siteId,branch:e.branch,since:e.since,limit:typeof e.limit==`string`?Number(e.limit):e.limit,connect:e.connect,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`webhooks forward`,`Forward webhook events to a local URL (stripe-listen-style; W3)`).option(`--to <url>`,`Local URL to POST events to (e.g. localhost:3000/webhook)`).option(`--site-id <id>`,`Site ID`).option(`--sign`,`HMAC-sign each forwarded request with X-Zenovay-Signature`).option(`--secret <hex>`,`HMAC secret (auto-derived from tunnel key if --sign without --secret)`).option(`--max-retries <n>`,`Per-request retry count`,{default:3}).action(async e=>{let{webhooksForwardCommand:t}=await import(`./webhooks-forward-9COAtWRu.js`),n=await t({cliVersion:k,to:e.to,siteId:e.siteId,sign:e.sign,secret:e.secret,maxRetries:typeof e.maxRetries==`string`?Number(e.maxRetries):e.maxRetries});process.exitCode=n}),M.command(`errors`,`Recent error snapshot (Wave 2 lead-in; SSE coming in V2.1)`).option(`--site-id <id>`,`Site ID`).option(`--window <w>`,`Time window: 24h | 7d | 30d | 90d`,{default:`24h`}).option(`--limit <n>`,`Max errors to fetch`,{default:100}).option(`--search <q>`,`Filter by class or message substring`).option(`--watch`,`Auto-refresh every 30s`).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async e=>{let{errorsCommand:t}=await import(`./errors-DHpw3PO2.js`),n=await t({cliVersion:k,siteId:e.siteId,window:e.window,limit:typeof e.limit==`string`?Number(e.limit):e.limit,search:e.search,watch:e.watch,json:e.json,csv:e.csv,tsv:e.tsv,ndjson:e.ndjson});process.exitCode=n}),M.command(`funnel <id>`,`Funnel drop-off chart for a specific funnel`).option(`--site-id <id>`,`Site ID`).option(`--window <w>`,`Time window: 7d | 30d`,{default:`30d`}).option(`--json`,``).option(`--csv`,``).option(`--tsv`,``).option(`--ndjson`,``).action(async(e,t)=>{let{funnelCommand:n}=await import(`./funnel-Z3HHRLwg.js`),r=await n({cliVersion:k,siteId:t.siteId,funnelId:e,window:t.window,json:t.json,csv:t.csv,tsv:t.tsv,ndjson:t.ndjson});process.exitCode=r}),M.command(`use [site]`,`Set / show / reset your default site (used when --site-id is omitted)`).option(`--reset`,`Clear the stored default site`).option(`--show`,`Print the current default and exit`).option(`--json`,`Emit JSON`).action(async(e,t)=>{let{useCommand:n}=await import(`./use-DSsSDVW7.js`),r=await n({cliVersion:k,match:e,reset:t.reset,show:t.show,json:t.json});process.exitCode=r}),M.command(`update`,`Manually install the latest version`).option(`--check`,`Don't install — just print latest`).option(`--force-downgrade`,`Allow downgrading to an older version`).option(`--no-update-check`,`Disable auto-update for this invocation`).option(`--json`,``).action(async e=>{let{updateCommand:t}=await import(`./update-wMGBdUT-.js`);await t({cliVersion:k,binaryPath:A,check:e.check,forceDowngrade:e.forceDowngrade,json:e.json})}),M.parse(process.argv,{run:!1}),(async()=>{await _({binaryPath:A,currentVersion:k,argv:process.argv}),j();try{await M.runMatchedCommand()}catch(e){process.stderr.write(`\n✗ ${e.message}\n`),process.exit(1)}})();
@@ -0,0 +1 @@
1
+ import{readConfig as e}from"./config-CZ9IzjIH.js";import{readToken as t}from"./api-DXmhz2DM.js";import"./formatter-BNYzdX5c.js";import{emit as n,isHeadless as r}from"./emit-BmfLGjqr.js";import{Panel as i}from"./panel-BNI8Q_9k.js";import{Banner as a}from"./prompt-CnNQNqeK.js";import{Keybar as o}from"./keybar-CoNHlPOn.js";import"./sparkline-ut0Tvv-E.js";import{resolveSiteId as s}from"./resolve-site-IXvBPhrx.js";import{ApiV2Client as c}from"./api-v2-CRj-zoG9.js";import{EmptyState as l}from"./empty-state-BUlTM7wA.js";import{DataTable as u}from"./data-table-B1FiGp8c.js";import{MetricCard as d}from"./metric-card--FhiQMgt.js";import{Box as f,Text as p,render as m,useApp as h,useInput as g}from"ink";import _,{useEffect as v,useState as y}from"react";import b from"ink-spinner";async function x(i){let a=await e(),o=await t({strict:!1});if(!o)return process.stderr.write("Not logged in — run `zenovay login` first.\n"),2;let l=new c({config:a,cliVersion:i.cliVersion,token:o}),u,d;try{({siteId:u,site:d}=await s(l,{explicit:i.siteId,headless:!!i.json,cliVersion:i.cliVersion}))}catch(e){return process.stderr.write(`${e.message}\n`),2}let f=d?.url?d.url.replace(/^https?:\/\//,``).replace(/\/$/,``):d?.name??u;if(r(i)){let e=await S(l,u);return n({type:`overview.snapshot`,data:e}),0}return new Promise(e=>{let{unmount:t}=m(_.createElement(C,{api:l,siteId:u,siteLabel:f,cliVersion:i.cliVersion,onExit:n=>{t(),e(n)}}))})}async function S(e,t,n){let[r,i]=await Promise.all([e.getStats(t,n).catch(()=>null),e.getPages(t).catch(()=>[])]),a=i.reduce((e,t)=>e+t.views,0);return{visitors:r?.visitors??0,pageviews:r?.pageviews??a,bounceRate:r?.bounceRate??null,avgSession:r?.avgSessionSec??null,series:[],topPages:i.slice(0,10)}}const C=({api:e,siteId:t,siteLabel:n,cliVersion:r,onExit:s})=>{let{exit:c}=h(),[m,x]=y(null),[C,w]=y(!0),[T,E]=y(null),[D,O]=y(`24h`),[k,A]=y(t),[j,M]=y(n),[N,P]=y(!1),[F,I]=y([]);g(async t=>{if(t===`q`){c(),s(0);return}if(t===`1`){O(`24h`);return}if(t===`2`){O(`7d`);return}if(t===`3`){O(`30d`);return}if(t===`4`){O(`90d`);return}if(t===`s`){if(F.length===0)try{let t=await e.getSites();I(t)}catch{}P(e=>!e);return}}),v(()=>{let t=!1;return w(!0),(async()=>{try{let n=await S(e,k,D);t||(x(n),w(!1))}catch(e){t||(E(e.message),w(!1))}})(),()=>{t=!0}},[e,k,D]);let L=()=>_.createElement(i,{title:`Switch site`,state:`idle`},F.length===0?_.createElement(p,{color:`gray`},`Loading your sites…`):F.map(e=>_.createElement(f,{key:e.id},_.createElement(p,{color:e.id===k?`cyan`:`gray`},e.id===k?`› `:` `),_.createElement(p,{bold:e.id===k},e.name),_.createElement(p,{color:`gray`},` (`,e.url.replace(/^https?:\/\//,``).replace(/\/$/,``),`)`))),_.createElement(f,{marginTop:1},_.createElement(p,{color:`gray`},`Press `),_.createElement(p,{color:`cyan`},`[number]`),_.createElement(p,{color:`gray`},` to pick, `),_.createElement(p,{color:`cyan`},`[s]`),_.createElement(p,{color:`gray`},` to close.`)));g(e=>{if(!N)return;let t=Number(e);if(Number.isInteger(t)&&t>=1&&t<=F.length){let e=F[t-1];A(e.id),M(e.url.replace(/^https?:\/\//,``).replace(/\/$/,``)),P(!1)}},{isActive:N});let R=`overview · ${j} · ${D}`,z=[{key:`q`,label:`quit`},{key:`s`,label:`site`},{key:`1-4`,label:`range (24h/7d/30d/90d)`}];if(C)return _.createElement(f,{flexDirection:`column`},_.createElement(a,{version:r,subtitle:R}),_.createElement(i,{title:`Loading`,state:`busy`},_.createElement(f,null,_.createElement(p,{color:`cyan`},_.createElement(b,{type:`dots`})),_.createElement(p,null,` Fetching dashboard…`))),N?L():null);if(T)return _.createElement(f,{flexDirection:`column`},_.createElement(a,{version:r,subtitle:R}),_.createElement(l,{reason:`error`,headline:`Failed to load`,hint:T}),N?L():null,_.createElement(o,{items:z}));if(!m||m.visitors===0&&m.pageviews===0&&m.topPages.length===0)return _.createElement(f,{flexDirection:`column`},_.createElement(a,{version:r,subtitle:R}),_.createElement(l,{reason:`no-data`,headline:`No data yet`,hint:`Visit your site to send the first event — or press [s] to switch to a different site, or [1-4] to widen the time range.`}),N?L():null,_.createElement(o,{items:z}));let B=process.stdout.columns??80,V=Math.max(18,Math.floor(B/4)-1),H=[{key:`path`,label:`path`,width:32},{key:`views`,label:`views`,align:`right`,width:8},{key:`uniqueVisitors`,label:`visitors`,align:`right`,width:8},{key:`avgTime`,label:`avg time`,align:`right`,width:9,format:e=>typeof e==`number`?`${Math.round(e/1e3)}s`:`—`},{key:`bounceRate`,label:`bounce`,align:`right`,width:7,format:e=>typeof e==`number`?`${(e*100).toFixed(0)}%`:`—`}];return _.createElement(f,{flexDirection:`column`},_.createElement(a,{version:r,subtitle:R}),_.createElement(f,{flexDirection:`row`},_.createElement(d,{title:`Visitors`,value:m.visitors,format:`number`,width:V}),_.createElement(d,{title:`Pageviews`,value:m.pageviews,format:`number`,width:V}),_.createElement(d,{title:`Bounce rate`,value:m.bounceRate??``,emptyHint:`—`,format:`percent`,width:V}),_.createElement(d,{title:`Avg session`,value:m.avgSession??``,emptyHint:`—`,format:`duration`,width:V})),_.createElement(i,{title:`Top pages (${D})`},m.topPages.length===0?_.createElement(p,{color:`gray`},`No pages with data in this window yet.`):_.createElement(u,{columns:H,data:m.topPages,zebra:!0})),N?L():null,_.createElement(o,{items:z}))};export{x as overviewCommand};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenovay/cli",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Zenovay CLI — AI install wizard + full terminal analytics dashboard",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +0,0 @@
1
- import{readConfig as e}from"./config-CZ9IzjIH.js";import{readToken as t}from"./api-DXmhz2DM.js";import"./formatter-BNYzdX5c.js";import{emit as n,isHeadless as r}from"./emit-BmfLGjqr.js";import{Panel as i}from"./panel-BNI8Q_9k.js";import{Banner as a}from"./prompt-CnNQNqeK.js";import{Keybar as o}from"./keybar-CoNHlPOn.js";import"./sparkline-ut0Tvv-E.js";import{resolveSiteId as s}from"./resolve-site-IXvBPhrx.js";import{ApiV2Client as c}from"./api-v2-CRj-zoG9.js";import{EmptyState as l}from"./empty-state-BUlTM7wA.js";import{DataTable as u}from"./data-table-B1FiGp8c.js";import{MetricCard as d}from"./metric-card--FhiQMgt.js";import{Box as f,Text as p,render as m,useApp as h,useInput as g}from"ink";import _,{useEffect as v,useState as y}from"react";import b from"ink-spinner";async function x(i){let a=await e(),o=await t({strict:!1});if(!o)return process.stderr.write("Not logged in — run `zenovay login` first.\n"),2;let l=new c({config:a,cliVersion:i.cliVersion,token:o}),u,d;try{({siteId:u,site:d}=await s(l,{explicit:i.siteId,headless:!!i.json,cliVersion:i.cliVersion}))}catch(e){return process.stderr.write(`${e.message}\n`),2}let f=d?.url?d.url.replace(/^https?:\/\//,``).replace(/\/$/,``):d?.name??u;if(r(i)){let e=await S(l,u);return n({type:`overview.snapshot`,data:e}),0}return new Promise(e=>{let{unmount:t}=m(_.createElement(C,{api:l,siteId:u,siteLabel:f,cliVersion:i.cliVersion,onExit:n=>{t(),e(n)}}))})}async function S(e,t){let[n,r]=await Promise.all([e.getStats(t,`24h`).catch(()=>null),e.getPages(t).catch(()=>[])]),i=r.reduce((e,t)=>e+t.views,0);return{visitors:n?.visitors??0,pageviews:n?.pageviews??i,bounceRate:n?.bounceRate??null,avgSession:n?.avgSessionSec??null,series:[],topPages:r.slice(0,10)}}const C=({api:e,siteId:t,siteLabel:n,cliVersion:r,onExit:s})=>{let{exit:c}=h(),[m,x]=y(null),[C,w]=y(!0),[T,E]=y(null);if(g(e=>{e===`q`&&(c(),s(0))}),v(()=>{let n=!1;return(async()=>{try{let r=await S(e,t);n||(x(r),w(!1))}catch(e){n||(E(e.message),w(!1))}})(),()=>{n=!0}},[e,t]),C)return _.createElement(f,{flexDirection:`column`},_.createElement(a,{version:r,subtitle:`overview · ${n}`}),_.createElement(i,{title:`Loading`,state:`busy`},_.createElement(f,null,_.createElement(p,{color:`magenta`},_.createElement(b,{type:`dots`})),_.createElement(p,null,` Fetching dashboard…`))));if(T)return _.createElement(f,{flexDirection:`column`},_.createElement(a,{version:r,subtitle:`overview · ${n}`}),_.createElement(l,{reason:`error`,headline:`Failed to load`,hint:T}));if(!m||m.visitors===0&&m.pageviews===0&&m.topPages.length===0)return _.createElement(f,{flexDirection:`column`},_.createElement(a,{version:r,subtitle:`overview · ${n}`}),_.createElement(l,{reason:`no-data`,headline:`No data yet`,hint:`Visit your site to send the first event`}));let D=process.stdout.columns??80,O=Math.max(18,Math.floor(D/4)-1),k=[{key:`path`,label:`path`,width:32},{key:`views`,label:`views`,align:`right`,width:8},{key:`uniqueVisitors`,label:`visitors`,align:`right`,width:8},{key:`avgTime`,label:`avg time`,align:`right`,width:9,format:e=>typeof e==`number`?`${Math.round(e/1e3)}s`:`—`},{key:`bounceRate`,label:`bounce`,align:`right`,width:7,format:e=>typeof e==`number`?`${(e*100).toFixed(0)}%`:`—`}];return _.createElement(f,{flexDirection:`column`},_.createElement(a,{version:r,subtitle:`overview · ${n}`}),_.createElement(f,{flexDirection:`row`},_.createElement(d,{title:`Visitors`,value:m.visitors,format:`number`,width:O}),_.createElement(d,{title:`Pageviews`,value:m.pageviews,format:`number`,width:O}),_.createElement(d,{title:`Bounce rate`,value:m.bounceRate??``,emptyHint:`—`,format:`percent`,width:O}),_.createElement(d,{title:`Avg session`,value:m.avgSession??``,emptyHint:`—`,format:`duration`,width:O})),_.createElement(i,{title:`Top pages`},m.topPages.length===0?_.createElement(p,{color:`gray`},`— no pages yet —`):_.createElement(u,{columns:k,data:m.topPages,zebra:!0})),_.createElement(o,{items:[{key:`q`,label:`quit`}]}))};export{x as overviewCommand};