Skip to main content

Where the CLI finds the key

A command that needs a key uses, in this order:
  1. WIDGETIC_API_KEY in the environment. It is used as it is and never written anywhere. Use it in scripts, CI jobs and agents.
  2. The key of the profile that widgetic auth login saved.
auth login checks the key with the server before it saves it. It saves none that the server refuses, and none whose workspace has no plan, and it says why (When the workspace has no plan). --no-verify saves the key without asking the server. A key is never taken from an argument, because an argument stays in your shell history and in the list of running processes. The CLI sends the key to the API’s own address and to nowhere else: a redirect to another host does not carry it along.
A saved key is plain text in a file that only you can read (see Files the CLI keeps). On a shared machine, or in CI, prefer WIDGETIC_API_KEY from a secret store over a saved key.

Profiles

A profile is a name for a saved key. --profile NAME picks one for a single call, WIDGETIC_PROFILE picks one for a whole shell, and default is used when neither is given. A name uses letters, digits, dots, hyphens and underscores, at most 64 of them. A key works in one workspace only, so keep a profile for each workspace you use:

Environment variables

Files the CLI keeps

The CLI keeps two files in one folder. The folder is ~/.config/widgetic ($XDG_CONFIG_HOME/widgetic when that is set), %APPDATA%\widgetic on Windows, or the folder that WIDGETIC_CONFIG_DIR names.

Check the setup

doctor is the first thing to run when something does not work. It checks the CLI and Node, the contracts the CLI was built from, the key and where it comes from, the REST API, the MCP server (the tool contract it speaks and the tools it offers, compared with this CLI) and the workspace the key works in, with its plan. A check that cannot run says why, and does not fail the others. This is what it prints before any key is saved:
Your versions and timings differ. doctor exits with 1 when a check fails and 0 otherwise, and --json prints every check for a script to read.

Look things up

  • widgetic --help is the menu, and --help works at every level.
  • widgetic schema api <group> <command> and widgetic schema mcp <command> print everything one command takes, with the JSON Schema its input is checked against. It works offline and describes the version that is installed.
  • widgetic docs prints the guide for AI agents and widgetic docs index prints every command with its help line. Both work offline, with no key, and match the installed version.
To point an agent at them, add this to the project’s AGENTS.md:
widgetic completion prints the script that completes commands and flags with the Tab key:

Secrets in a command

A value that the API marks as a secret, such as the key of an adapter, the secret half of a storage key or a database connection string, is never typed as the text of a flag, because what is typed stays in your shell’s history and in the list of processes. The flag takes @path (a file) or - (a prompt that does not show what you type, or standard input when there is no terminal):
A secret typed as the text of the flag is refused with exit code 2, nothing is sent, and the error does not repeat it. --dry-run prints [redacted] in its place, whether the secret came from a flag or from a --data document. The command’s help says which flags take secrets.

Keep the CLI up to date

After a command, at a terminal, the CLI says when a newer version is on npm, shows both versions and asks:
  • It never gets in the way. The look for the newest version is one small request to the npm registry, with no key and nothing from your account. It runs beside your command with a limit of 2 seconds, and its answer is kept for 24 hours (1 hour after a failure). The question comes after the command has printed its result, on standard error, and nothing that happens in it changes the command’s exit code.
  • It asks a person, and only a person. Never with --json or --yes, never when standard input, output or error is not a terminal, never in CI, never when NO_UPDATE_NOTIFIER or WIDGETIC_NO_UPDATE_CHECK is set, and never for --help, --version, help, completion or update. WIDGETIC_DEBUG=1 says which of these applied.
  • The default is no. Enter, Ctrl-C and 20 seconds of silence all mean no. A no is remembered for 7 days for that version, and a newer version asks at once. A server that refuses the CLI as too old (exit code 7) always gets the question.
  • It installs what it showed. On yes it runs the global install command of the package manager that installed this copy (npm, pnpm, yarn or bun), pinned to the version it showed, and then checks that the installed copy changed. A copy it cannot place, such as one inside a project’s node_modules, is not touched: the CLI prints the new version and the command to run.
widgetic update does the same whenever you ask. It asks npm itself instead of using the answer it kept. --check only reports, --yes installs without asking, and --json prints {package, current, latest, updateAvailable, updated, installedWith, command} and never asks (add --yes to install). In CI, pin the version you tested instead: npm install -g @widgetic/cli@0.1.17. A server can refuse a CLI that is too old with 426, which the CLI reports as exit code 7.