@klevar/docs-cli
v0.1.23
Published
Brain CLI wrapper for the Klevar Docs API — covers all 165 production endpoints + digest snapshot. Source of truth for the Brain repo's docs control surface.
Downloads
2,345
Maintainers
Readme
@klevar/docs-cli
Brain CLI wrapper for the Klevar Docs API. Covers all 165 production endpoints + a digest snapshot for daily ops surfacing.
Install
npm install @klevar/docs-cliConfigure
Create ~/.klevar/docs.env (or set env vars):
DOCS_API_KEY=<your-bearer-token>
DOCS_API_URL=https://docs.klevar.aiOr pass per-invocation:
npx klevar-docs --api-key=<token> --api-url=https://docs.klevar.ai invoice listUsage
npx klevar-docs version
npx klevar-docs ping
npx klevar-docs invoice list
npx klevar-docs invoice create --entity llc --client mathias \
--line "Retainer:1500" --currency EUR --due 2026-06-30
npx klevar-docs reports revenue --entity llc --year 2026
npx klevar-docs hash-chain verify --entity <id>
npx klevar-docs admin events --limit 10--help lists every command group.
Output modes:
- default — human-readable
--json— machine-parseable--quiet— IDs only, for shell pipelines
Programmatic
import { createClient } from '@klevar/docs-cli';
import { checkDocs } from '@klevar/docs-cli/digest';
import { loadConfig } from '@klevar/docs-cli/config';
const config = loadConfig();
const client = createClient(config);
const digest = await checkDocs({ client });
console.log(digest.overdue_invoice_count);What it covers
29 command modules covering every PRD §12 surface:
- Lifecycle: invoice / pro-forma / credit-note / payment / storno
- AP: vendor / vendor-bill / vendor-payment / vendor-credit-note / intercompany
- Pipeline: documents / templates / signatures / signing-cert / hash-chain / factur-x / xrechnung / signers
- Operations: entity / clients / recurring / resolutions / reports / webhooks / email / audit / admin
- Reconciliation: reconcile / bulk
53 stub commands (endpoints not yet live in production) print honest "not yet implemented" messages and exit 0.
CI guarantee
The source repo (klevar-docs) runs scripts/check-cli-coverage.ts on every PR — fails CI if any production endpoint lacks a CLI command, if a CLI references a path absent from the OpenAPI spec, or if a CLI body literal drifts from the OpenAPI requestBody schema (B148 schema-shape diff). Means this package's coverage tracks the API drift-free.
Releasing
Maintainer flow (B148 E3):
# From repo root, on a clean working tree:
./tools/scripts/release.sh patch # bump 0.1.1 → 0.1.2
# or release.ps1 patch on WindowsBehind the scenes:
npm --tag-version-prefix=cli-v version <kind>intools/bumpstools/package.json, commits, and tagscli-v<new-version>.git push origin --tagspushes the new tag..github/workflows/publish-cli.ymlfires on thecli-v*.*.*tag, validates the tag matchestools/package.json, builds, and runsnpm publish --access public.
Required repo secret: NPM_TOKEN (an Automation token from npmjs.org → Access Tokens). Set once via gh secret set NPM_TOKEN or the GitHub web UI.
Manual fallback: trigger the Publish @klevar/docs-cli to npm workflow from the Actions tab and supply the tag name as input.
License
UNLICENSED — internal Klevar Group tooling.
