npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@onebooks/cli

v0.1.0

Published

OneBooks developer CLI: sign in to the developer console, list apps, deploy and test hosted functions, and scaffold a new embedded app from a template.

Readme

@onebooks/cli

The OneBooks developer CLI (onebooks): sign in to the developer console, list your apps, deploy and test hosted functions, and scaffold a new embedded app from a starter template.

Zero runtime dependencies — node:util's parseArgs, the global fetch, and node:readline for prompts. ESM, TypeScript, Node ≥ 20.

Install

npm install -g @onebooks/cli
onebooks --version

Or run any command without a global install: npx @onebooks/cli <command>.

Commands

onebooks login [--api <url>] [--email <email>]
onebooks logout
onebooks whoami [--json]
onebooks apps list [--org <slug-or-id>] [--json]
onebooks functions list --app <appId> [--json]
onebooks functions deploy --app <appId> --name <fn> --file <path>
                           [--events a,b] [--egress host1,host2] [--description "..."]
                           [--activate] [--notes "..."] [--json]
                           (--events is required when <fn> doesn't exist yet)
onebooks functions logs --app <appId> --name <fn>
                         [--status QUEUED|RUNNING|SUCCEEDED|FAILED|SKIPPED] [--cursor <runId>] [--json]
onebooks functions test --app <appId> --name <fn>
                         --business <sandboxBusinessId> --event <type>
                         [--data '{"...":"..."}'] [--json]
onebooks init <dir> [--template embedded-node]

Every command supports -h/--help. Data-returning commands support --json for the raw API response; without it, output is a generic human-friendly rendering (a table for an array of objects, key: value lines for a single object).

login

Prompts for email and password (password input is masked), signs in against {apiBase}/api/dev-auth/sign-in/email, and saves the session to ~/.config/onebooks/config.json (created at mode 0600 — it holds a bearer token). --api <url> points at a non-default API (defaults to the last one used, or https://api.getonebooks.com).

apps list

Lists your apps across every organization you belong to. The id column — not clientId — is what every functions command's --app flag expects; the developer console's own routes (/developer/apps/:id/...) key on the internal id, while clientId is the public OAuth client_id used everywhere else (authorize URLs, token requests, …).

functions deploy

Creates the function if a function with that --name doesn't already exist on --app (via --events/--egress/--description, comma-separated for the first two), uploads --file's contents as a new version, and — with --activate — makes that version live immediately. Source is capped at 1 MB, matching the hosted runtime's own limit; this is checked locally before uploading.

  • Creating a function requires --events (a function must run on at least one event): without it the command stops with a usage error before creating or uploading anything.
  • --egress hostnames are lowercased (hostnames are case-insensitive and the API rejects mixed case) and de-duplicated.
  • For an existing function, --events, --egress and --description are ignored (the command says so) — change them on the app's Functions tab in the developer console; deploy only uploads a new version.
  • Upload one self-contained ES module — the hosted sandbox loads only that file, so bundle any imports first.

functions test

Fires a synthetic event of --event's type against --business (one of your organization's sandbox tenants, with the app installed). --data overrides the event catalog's sample payload for that event type with your own JSON, if given.

init

onebooks init my-app
cd my-app
cp .env.example .env
npm install
node server.mjs

Scaffolds developer-sdk/templates/embedded-node (currently the only template) into a new or empty directory — see that template's own README for the full walkthrough (console setup, scopes, sandbox, running behind a tunnel, deploying its example function).

The template declares @onebooks/node as file:../../node, which only resolves inside the OneBooks repository, so init rewrites that dependency — to ^<CLI version> from npm, or to the local developer-sdk/node folder when the CLI runs from a OneBooks source checkout — and prints what it chose:

  • run from a OneBooks source checkout (developer-sdk/cli), it points at the node/ package next to cli/ by absolute path — "@onebooks/node": "file:/…/node" — and, if that package hasn't been built, prints the npm install && npm run build command to run first (npm links the folder as-is, so it needs its dist/ and its own node_modules);
  • otherwise it writes the ^<CLI version> range for npm.

The template's .gitignore (which keeps .env and data/ — your client secret and stored tokens — out of git) ships inside the CLI as _gitignore, because npm renames a packed .gitignore; init restores the real name.

Config file

~/.config/onebooks/config.json:

{
  "apiBase": "https://api.getonebooks.com",
  "consoleToken": "…"
}

Always written at mode 0600. onebooks logout clears consoleToken but keeps apiBase. Override the config directory (for tests, or to run two isolated sessions) with the ONEBOOKS_CONFIG_DIR environment variable.

Development

npm install
npm run build       # tsc -> dist/, copies developer-sdk/templates/* -> dist/templates, chmod +x dist/bin.js
npm test            # node:test via tsx — no network; config tests use a throwaway ONEBOOKS_CONFIG_DIR
npm run typecheck

After building, the real binary works standalone:

node dist/bin.js --help
node dist/bin.js init /tmp/try-it

Tests cover argument parsing (missing required flags, unknown subcommands, --help on every command), functions deploy against a fake console API (--events required on create, lowercased --egress), init (dependency rewrite, _gitignore restore) and config file handling (mode 0600, default values, round-tripping, logout preserving apiBase) — see test/commands.test.ts and test/config.test.ts. login's HTTP/token logic is tested directly via the exported signIn() helper (with a fake fetch) rather than by simulating a terminal prompt.

License

MIT