Learn · Data & files
Your project’s CLI
Your project serves your users a CLI whose commands are your deployed queries.
- In the schema
- —
Installer and binary name#
Add your project’s install one-liner to your product documentation. The installer downloads a self-contained binary for macOS, Linux or Windows, verifies the SHA-256 digest and installs the binary under your chosen command name (such as acme).
Typed CLI generated from deployed queries
Every offered query and action in GET /openapi.json becomes a typed subcommand authenticated via /sign-in/cli PKCE or an <APP>_KEY service key.
curl -fsSL https:// acme.napalmdata.com/ cli/ install.sh | shirm https:// acme.napalmdata.com/ cli/ install.ps1 | iexSet the command name (cliName) in your project’s Application access panel or via POST /projects/{id}/endpoint. The name must start with a letter and use only lowercase letters, digits or hyphens, such as acmectl. The command name defaults to your project’s hostname label.
The installer never overwrites an existing executable on PATH or a system binary. On a name collision, the installer stops and tells the user to pass --as <name>.
End-user authentication#
acme login signs the user in against your project’s enabled authentication providers. Every subcommand then runs with that user’s session JWT under your schema’s access policies, so the user sees only permitted rows and your write rules apply.
acme loginacme --helpacme invoices --status openacme close-invoice --id 7b1c… --dry-run| Sign-in method | Terminal login experience |
|---|---|
| Email and password | Prompts for email and password directly in the terminal. |
| Magic link | Emails a one-time code and prompts for it in the terminal. When the project sends a link instead, the user opens it on any device and enters the code shown on the page. |
| OAuth / OIDC (Google, GitHub, etc.) | Opens the local browser and completes the PKCE callback automatically. Over SSH (or with --no-browser), prints a URL to open on any device and prompts for the code shown on that page. |
All terminal login flows use OAuth 2.0 PKCE bound to the originating terminal session and complete at /sign-in/cli. Users can pass --provider or --email to skip interactive prompts.
Subcommands from deployed queries#
Each deployed query and action on your project becomes a subcommand. Declared $variables become typed CLI flags (with _ mapped to -), and the first-line # comment in your .edgeql file becomes the command description. A read-only credential sees only read-only commands.
close-invoice Close an invoice and email the receipt Usage: acme close-invoice --id <uuid> [--note <string>] [--dry-run] [--json] --id uuid --note string, optional Runs a mutation. Pass --dry-run to preview before/after objects without committing.The CLI reads command definitions dynamically from GET /openapi.json, so a newly deployed query becomes a subcommand immediately without users reinstalling the binary. Every command supports --json for scripting, and database mutations support --dry-run to preview before-and-after diffs without committing.
Lifecycle commands (login, logout, whoami, help, update and rollback) are built in. To hide an internal deployed query from the CLI while keeping it callable from your web app, run napalm queries offer acme close-invoice --no-cli or toggle CLI off in the console.
Custom branding#
Your project CLI automatically adopts the branding configured in your project’s sign-in settings across every login and help surface.
- Terminal
--helpoutput - Displays your application name and highlights subcommands in your brand color, contrast-adjusted for light and dark terminals.
- Browser
/sign-in/cliscreen - Renders your light or dark logo and accent color during OAuth and magic-link handshakes.
- Sign-in email
- Uses your application name, logo and accent color on verification codes, password resets and magic links.
Scripts and CI keys#
In automated scripts or CI pipelines, pass a project service key via an environment variable named after your CLI in uppercase with _KEY appended. For example, use ACME_KEY for acme or ACME_CTL_KEY for acme-ctl.
Interactive sessions are saved with 0600 permissions at ~/. acme whoami shows the active identity. acme logout ends the current session, and acme logout --everywhere ends every session for that user.
Internal ops and support tools#
Teams often spend weeks building internal admin dashboards for support tasks such as issuing SLA credits, extending trials, replaying stuck webhooks or toggling feature flags. Because your project CLI exposes every permitted deployed query with --dry-run diff previews, the same binary doubles as a policy-enforced internal ops tool.
Rollback diff previews on support mutations
Passing --dry-run executes the mutating subcommand under the operator's global caller policies, prints exact before-and-after JSON diffs and rolls back cleanly.
# 1. Preview the exact before/after row diff without committingacme credit-wallet --org-slug northwind --amount 5000 --reason "SLA credit #4821" --dry-run # 2. Execute for real once verified (the schema trigger logs global caller in the same commit)acme credit-wallet --org-slug northwind --amount 5000 --reason "SLA credit #4821"Pairing ops subcommands with unforgeable audit triggers#
- Role-gated visibility
- Gate support queries on a
Staffmembership role and hide internal ops commands from public docs as needed. A support key can carry per-key globals (napalm keys create --global) so your access rules distinguish it from other service keys. - Dry runs for every mutation
- Every mutating CLI subcommand accepts
--dry-run. A dry run executes the real statement, rolls back and prints exact before-and-after JSON diffs while leaving customer balances untouched. - Transactional audit triggers
- Attach a schema
triggerso every support mutation recordsglobal callerand the statement timestamp inside the same PostgreSQL transaction.
using extension auth;using extension napalm;using future simple_scoping; module default { global caller := global ext::auth::ClientTokenIdentity; type Note { required title: str; owner: ext::auth::Identity; access policy owner_has_full_access allow all using (.owner ?= global caller); trigger record_change after insert, update for each do ( insert Change { note := __new__, changed_by := global caller, title := __new__.title, } ); } type Change { required note: Note; changed_by: ext::auth::Identity; required title: str; required at: datetime { default := datetime_of_statement(); }; access policy note_owner_can_read allow select using (.note.owner ?= global caller); access policy callers_record_as_themselves allow insert using (.changed_by ?= global caller); }}Project CLI setup#
Your project CLI is live as soon as you enable the project’s HTTP endpoint, turn on at least one sign-in method (or issue a service key) and push your deployed queries with napalm queries push.