@klevar/portal-cli
v0.1.1
Published
First-class npm CLI for the Klevar Client Management Portal
Readme
@klevar/portal-cli
First-class npm CLI for the Klevar Client Management Portal.
Install
Run without installing:
npx @klevar/portal-cli helpInstall globally for repeated use:
npm install -g @klevar/portal-cli
klevar-portal helpConfiguration
Configuration is read from environment variables or ~/.klevar/portal.env.
PORTAL_API_URL=https://api.klevar.ai
PORTAL_API_KEY=cmp_live_replace_me
PORTAL_TOKEN=PORTAL_API_URL defaults to http://127.0.0.1:3100 for local development. Use PORTAL_TOKEN only for client portal commands.
Do not paste API keys, portal tokens, or production secrets into chat logs, issue trackers, screenshots, or committed files.
Command Examples
npx @klevar/portal-cli health
npx @klevar/portal-cli tenant info
npx @klevar/portal-cli clients list
npx @klevar/portal-cli clients create --name "Stefan" --email "[email protected]" --platform direct
npx @klevar/portal-cli projects create <clientId> --name "Idealo" --externalRef "idealo:ksh.de"
npx @klevar/portal-cli metrics push --external_ref "idealo:ksh.de" --source_ref "run:33" --snapshot_date "2026-04-12" --metrics '{"score":88}'
npx @klevar/portal-cli portal me --portal-token "<client-token>"Brain Usage
Brain usage should prefer the published npx @klevar/portal-cli entrypoint.
Brain agents should call:
npx @klevar/portal-cli <resource> <action> [id] [--key value]The local compatibility wrapper remains available for old automation after a build:
npm run cli:build
klevar-portal clients listNew automation should use npx @klevar/portal-cli.
Auth Modes
- Admin and integration commands use
X-API-Key. - Portal commands use
PORTAL_TOKENor--portal-token. - Public commands such as health checks and onboarding submission do not require credentials.
Explicit no-CLI exemptions are tracked in tools/commands/_exemptions.ts:
POST /api/admin/login,POST /api/admin/logout, andGET /api/admin/meare browser/session-only routes.POST /api/tenants/registeris public bootstrap/self-registration, not a normal operational CLI action.POST /api/integration/klevar-docs/eventsis an inbound webhook called by Klevar Docs.
npm Release Flow
The npm release flow is automated in GitHub Actions and can be dry-run locally.
Dry-run locally:
npm run cli:publish:dryManual publish:
npm run cli:publishGitHub Actions also provides:
.github/workflows/auto-publish-cli.yml: publishes frommainwhentools/**changes..github/workflows/publish-cli.yml: manual orportal-cli-v*.*.*tag fallback.
Security Notes
Do not paste API keys into shell history on shared machines. Prefer ~/.klevar/portal.env with user-only file permissions or a secret manager. Rotate a key immediately if it appears in logs or commits.
