@bareium/cli
v0.1.3
Published
Command-line interface for Bareium — short links, deep links and click analytics from the terminal.
Maintainers
Readme
@bareium/cli
The command line for Bareium — shorten links, read click analytics and manage folders, tags and domains without leaving the terminal.
It is a client of the public REST API, not a second door into the database, so plan quotas, workspace scoping, audit logging and rate limits apply exactly as they do to any other caller.
Requirements
- Node 18 or newer
- A Bareium API key — Settings → API in the dashboard
There is no separate plan gate. The CLI calls the same REST API your key already reaches; whatever your plan allows there, it allows here.
Install
npm install -g @bareium/cli
bareium loginOr without installing anything:
npx -y @bareium/cli shorten https://example.comQuick start
bareium login # paste a key, once per machine
bareium shorten https://example.com/launch --slug launch
bareium links
bareium stats launch --range 7dshorten prints the short URL on stdout and nothing else, so it composes:
LINK=$(bareium shorten "$DEPLOY_URL" --slug "pr-$PR_NUMBER")Commands
| Command | Does | Writes |
|---|---|---|
| bareium shorten <url> | Creates a short link. Spends one from the monthly link allowance. | yes |
| bareium links | Lists this workspace's links. | no |
| bareium stats <link> | Clicks, referrers, countries and devices for one link. | no |
| bareium delete <link> | Deletes a link permanently. Confirms first. | yes |
| bareium search <term> | Finds links, campaigns and domains. | no |
| bareium folders / tags | Lists folders and tags. | no |
| bareium domains | Lists custom domains, verification and TLS status. | no |
| bareium whoami | Workspace, plan, limits and usage so far. | no |
| bareium login / logout | Stores or removes the API key. | no |
<link> is a slug, a short URL or a link id — launch,
bareium.in/launch, https://bareium.in/launch and the UUID all work. Only an
exact slug match counts; a slug that exists on two domains is reported as
ambiguous rather than guessed at.
Run bareium help <command> for a command's own options.
Creating links
bareium shorten https://example.com \
--slug spring-sale \
--domain acme.link \
--expires 30d \
--folder Marketing --tag campaign --create-missing--expires takes an ISO date, a full timestamp, or a duration (45m, 12h,
30d, 2w). --folder and --tag take names; --create-missing makes any
that do not exist yet, and without it an unknown name is an error listing what
the workspace does have.
TRAI-compliant SMS links: --trai, with --trai-header to set the header
segment. Deep links: --ios-scheme, --android-scheme, --ios-store-id,
--android-package, --deep-link-fallback. Deep linking is a paid feature and
the API refuses it below Pro — see the exit codes below.
Configuration
| | |
|---|---|
| BAREIUM_API_KEY | Overrides the stored key. Set this in CI instead of running login. |
| BAREIUM_API_URL | The API host. Defaults to production; set it only to point at a staging host. |
| BAREIUM_CONFIG_DIR | Where the config lives. Defaults to ~/.config/bareium. |
| NO_COLOR | Turns colour off, as does --no-color and any non-terminal stdout. |
bareium login stores the key in ~/.config/bareium/config.json, mode 0600.
The environment always wins over the file, so one command can run against
another workspace without disturbing what is stored.
--api-url is worth setting explicitly when you hold a staging key, so a test
run cannot write to live data.
Scripting
--json prints machine-readable output on stdout and nothing else — no header,
no colour. Everything conversational goes to stderr.
Exit codes are part of the interface:
| Code | Means |
|---|---|
| 0 | Done. |
| 1 | Failed. |
| 2 | The command was wrong — bad flag, missing argument. |
| 3 | No key, or the key was rejected. |
| 4 | The plan does not include this. Retrying will not help. |
| 5 | Rate limited or out of allowance. Wait and retry. |
| 6 | Bareium could not be reached — network, DNS, or the wrong host. |
The 4-versus-5 split is the one the API itself draws, and it is the reason a CI step can tell "upgrade the plan" from "try again in a minute" without reading English out of stderr.
Safety
deleteconfirms before it acts, and refuses outright when nothing can answer the prompt. Pass--yesto mean it. The blast radius of a wrong deletion is somebody's already-printed QR code.- The API key sits in plain text in the config file. Anyone holding it can
create and read links in that workspace.
logoutremoves the local copy; if it may have leaked, revoke the key itself in Settings → API. - The CLI never prints a key in full, not even in
whoami.
Licence
MIT — see LICENSE. This licence covers cli/ only. The rest of Bareium is
private and carries no licence.
Bugs
There is no public issue tracker — the repository is private. Report problems through support at bareium.com.
