@observejs/cli
v0.1.0
Published
Cross-platform CLI for Observe.js — `npx observejs init` and `npx observejs verify`.
Maintainers
Readme
@observejs/cli
Cross-platform CLI for Observe.js. Works on macOS, Linux, Windows, and any Node 18+ CI environment.
npx observejs init # install + configure
npx observejs verify # send a test event end-to-end
npx observejs doctor # diagnose an existing installinit
Detects Next.js (App Router), your package manager (pnpm/yarn/bun/npm),
installs @observejs/nextjs + @observejs/browser +
@observejs/plugin-auto-track, writes NEXT_PUBLIC_OBSERVE_API_KEY to
.env.local, creates app/observe-provider.tsx, and wraps {children} in
your root layout with <ObserveProvider>.
npx observejs init
# or fully non-interactive
npx observejs init --api-key pk_live_xxx --yesFlags:
| Flag | Description |
| ---------------- | -------------------------------------------------- |
| --api-key | Tracking key (skips interactive prompt) |
| --yes | Accept defaults without prompting |
| --skip-install | Don't run the package-manager install |
verify
Loads your key from .env.local, pings the ingest health endpoint, and POSTs
a cli.verify event. Exits non-zero on any failure — perfect for CI.
npx observejs verifyOutput:
Observe.js verify
✔ API key found (pk_l…f3a2)
› Checking ingest endpoint: https://observejs.lovable.app/api/public/v1/health
✔ Ingest endpoint reachable
› Sending test event…
✔ Test event accepted
Installation verifieddoctor
Static checks against the current project — useful when something looks off
but verify already passed.
License
MIT
