@rulemetric/cli
v0.2.1
Published
The RuleMetric CLI. Manages instructions, sessions, evals, and (as of the user-management release) organizations.
Readme
@rulemetric/cli
The RuleMetric CLI. Manages instructions, sessions, evals, and (as of the user-management release) organizations.
Auth
rulemetric auth login # interactive — writes ~/.config/rulemetric/env
rulemetric auth create-key # generate a long-lived API key
rulemetric auth whoami # print the current userCredentials are read from (first match wins):
RULEMETRIC_API_URL+RULEMETRIC_API_KEY(orRULEMETRIC_ACCESS_TOKEN)~/.config/rulemetric/env~/.config/rulemetric/auth.json(JSON fallback, requiresjq).env.localin the project root (development)
Org commands
The org commands let you list and switch the "active org" used by every
subsequent CLI invocation. Sessions captured by hooks/proxy/MCP while an
active org is set will stamp sessions.org_id to that org.
rulemetric org list # list orgs you belong to; star marks the active one
rulemetric org current # print the active org's slug, name, and role
rulemetric org switch <slug> # set the active org (cached locally)
rulemetric org switch --clear # clear the active org (back to personal mode)Active-org resolution order:
RULEMETRIC_ORG_IDenvironment variable (process-scoped override)- Local cache at
~/.config/rulemetric/active-org.json(written byrulemetric org switch) - None (sessions captured without an org_id)
A background prefetch refreshes the cache on a TTL so a slug change in the
web UI is picked up by the next CLI run without an explicit org switch.
Creating an org: Currently web-only — visit /orgs/new in the
dashboard. The CLI will adopt the org once you org switch <slug> (or set
the active org in the web UI, which the CLI cache picks up).
Other top-level commands
rulemetric instructions ...— list, get, create, edit, push, pullrulemetric convert ...— format conversion (25+ formats)rulemetric import ...— bulk import from a project treerulemetric sessions ...— list/get/import sessionsrulemetric evals ...— eval target/case/run/optimize commandsrulemetric insights sync|generate— push local session-meta + facets uprulemetric hooks install|uninstall|run <name>— manage tool hook scriptsrulemetric proxy ...— start/stop the mitmproxy capture layerrulemetric service install|uninstall— launchd services for API + worker
Tests
pnpm --filter @rulemetric/cli test:unit # unit tests (no creds needed)
pnpm --filter @rulemetric/cli test:e2e # e2e (needs Supabase creds)E2E tests start a real Hono API on port 3001 and create a temp Supabase
user; see apps/cli/e2e/global-setup.ts.
