@codecommentsai/cli
v0.2.0
Published
CodeComments CLI — review a git diff from your terminal.
Downloads
42
Readme
@codecommentsai/cli
Run a CodeComments review against a local git diff. Same engine as the GitHub App — just pointed at whatever you have checked out.
Install
curl -fsSL https://codecomments.ai/install.sh | shThe script runs npm install -g @codecommentsai/cli and points you at the
installed launcher. Requires Node.js ≥ 20 and npm. If npm's global bin
directory isn't on your PATH, the installer prints the exact line to
add to your shell rc.
Or install directly with npm:
npm install -g @codecommentsai/cliPin to a specific version with CODECOMMENTS_VERSION=1.2.3 before
running the curl command, or use npm install -g @codecommentsai/[email protected].
Authenticate
Interactive (recommended for laptops)
codecomments loginOpens your browser, asks you to sign in if needed, and shows an approval
page where you name the device. The new token is written to
~/.config/codecomments/config.json with 0600 permissions — you never see
or paste the plaintext.
Options:
--api-url <url>— point at a self-hosted backend; persisted in the config.--timeout <minutes>— how long to wait for browser approval (default: 5).
Headless (CI, containers, SSH)
Generate a token at codecomments.ai/dashboard/settings/cli, then save it locally:
# as a positional argument (convenient locally)
codecomments auth ccmt_xxxxxxxxxxxxxxxxxxxxxxxx
# or piped on stdin (safer — never appears in process listings)
printf '%s' "$CODECOMMENTS_TOKEN" | codecomments authThe token is written to ~/.config/codecomments/config.json with 0600 permissions.
Review
From the root of a git repo:
# Review HEAD vs origin/main (default)
codecomments review
# Against a different base
codecomments review --base origin/develop
# Review a pre-generated patch file
codecomments review --diff my.patch
# Pipe a diff on stdin
git diff main...feature | codecomments review --stdin
# Machine-readable output
codecomments review --jsonExit code is 1 when any P1 (blocking) finding is present, 0 otherwise —
safe to drop into CI.
Commands
| Command | What it does |
| ----------------------------- | -------------------------------------------------------------- |
| codecomments login | Browser-based auth. Use on laptops. |
| codecomments auth [<token>] | Save a pasted token. Use in CI / headless. Omit for stdin. |
| codecomments review | Review the current branch against a base. |
| codecomments whoami | Print the saved token fingerprint. |
Env vars
XDG_CONFIG_HOME— respected when resolving the config path.
Pointing at a non-default backend
Pass --api-url when running either codecomments login or
codecomments auth. The URL is persisted in the config and reused by every
subsequent review call. To switch backends, rerun the same command with a
new URL.
