@evopos/cli
v0.1.0
Published
EvoPOS plugin developer CLI: device login, validate, pack, deploy to the sandbox, submit for review
Readme
@evopos/cli
Command-line tool for EvoPOS plugin developers: sign in, validate, pack, deploy to your sandbox and submit for review.
npm install -g @evopos/cli # or: npx @evopos/cli <command>
evopos login
cd my-plugin
evopos deploy --submitNode.js 20 or newer. No runtime dependencies besides @evopos/contracts.
Commands
| Command | What it does |
|---|---|
| evopos login [--no-browser] [--with-token \| --token <t>] | Device-code sign-in: prints a code, opens the browser, waits for approval and saves the token |
| evopos logout | Revokes the token on the server and removes it from this machine |
| evopos whoami | Account, token (name, expiry), sandbox slug and kassa URL, API address |
| evopos validate [dir] | Checks manifest.json against the contract and that every referenced file exists |
| evopos pack [dir] [--out <file>] | Builds a reproducible .zip (default .evopos/<id>-<version>.zip) |
| evopos deploy [dir] [--submit] [--no-build] | npm run build (if package.json has it), pack, upload a draft to the sandbox, optionally submit |
| evopos submit [dir] [--id <id>] [--version <v>] | Sends a draft version for review (id and version default to the manifest) |
| evopos open [--print] | Opens the sandbox kassa in the browser, or only prints the URL |
dir defaults to the current directory. If dir/dist/manifest.json exists, dist/ is the package root; otherwise dir/manifest.json is used and the files of dir are packed (without node_modules, package.json, README.md, dist, and names starting with .).
Common flags: --api <url>, --json, -h/--help, -v/--version.
Environment
| Variable | Meaning |
|---|---|
| EVOPOS_TOKEN | CLI token (evo_cli_...). Takes priority over the saved login; use it in CI |
| EVOPOS_API_BASE | API address. Order: --api, this variable, https://developers.evopos.az |
| EVOPOS_CONFIG_DIR | Where credentials.json lives |
| NO_COLOR | Disables colour (colour is also off when output is not a terminal) |
The API address must be https. Plain http is accepted only for localhost, 127.0.0.1, [::1], *.localhost and *.test.
Where the token is stored
credentials.json in $EVOPOS_CONFIG_DIR, else %APPDATA%\evopos (Windows), else $XDG_CONFIG_HOME/evopos, else ~/.config/evopos. The folder is 0700, the file 0600; the CLI warns if the file is readable by others. Tokens are kept per API address. The token is never printed, not even with --json.
In CI prefer EVOPOS_TOKEN or evopos login --with-token < token-file. --token <t> works but stays in shell history.
Scripting
With --json stdout is exactly one JSON object; progress and warnings go to stderr. On failure the object is {"error": "<code>", "message": "...", "errors": [...]} (errors only when there are details).
Exit codes: 0 success, 1 error (network, server, invalid package, not logged in), 2 wrong usage (unknown command or flag, bad API address).
evopos deploy --submit --json | jq -r '.status'Programmatic API
import { packPlugin, validateManifestFile, EvoposClient, resolveApiBase } from '@evopos/cli';
const { file, sha256, manifest } = packPlugin({ dir: './my-plugin' });
const { base } = resolveApiBase(undefined, process.env);
const client = new EvoposClient({ base, token: process.env.EVOPOS_TOKEN });
await client.uploadPackage(await readFile(file));packPlugin({ dir, out?, extraFiles? }) returns { file, bytes, files, sha256, manifest }. The same archive is produced for the same input (fixed entry order and timestamps).
Development
npm run typecheck -w packages/cli
npm test -w packages/cli
npm run build -w packages/cli