Installation

Requirements, installing ocra from npm, and building it from source.

Requirements

  • Node.js 22.19 or newer
  • Git
  • An API key for at least one model provider

The default OpenCode runtime comes along as an optional dependency; to leave it out, see Without OpenCode.

From npm

npm install -g @open-cr-agent/cli
ocra --version

To update: npm install -g @open-cr-agent/cli@latest. To remove it: npm uninstall -g @open-cr-agent/cli.

Or run it without installing:

npx @open-cr-agent/cli review

npm 11.16 and later warn that opencode-ai has an install script not covered by allowScripts, and npm 12 blocks it. ocra does not need it (it finds the binary in the platform package), so leave it blocked.

Without OpenCode

The OpenCode runtime, @open-cr-agent/runtime-opencode, is about 165 MB of the 175 MB an install takes. If every model is on a declared endpoint and the configuration sets "runtime": "direct" (Choosing the runtime), leave it out. npm install -g installs optional dependencies regardless, so install into a directory of its own:

npm install --prefix ~/.ocra --omit=optional @open-cr-agent/cli
~/.ocra/node_modules/.bin/ocra --version   # or put ~/.ocra/node_modules/.bin on your PATH

--omit=optional works the same for ocra as a project dependency. ocra review --plan needs no runtime. A review on opencode (the default) then stops before any model call with exit code 2, naming both fixes: set "runtime": "direct", or install the runtime at ocra's exact version (npm install --prefix ~/.ocra @open-cr-agent/runtime-opencode@<version>).

In the GitHub Action, the input opencode: false does the same (GitHub).

Container image

Each release since 0.2.0 is also a container image for amd64 and arm64, ghcr.io/jma49/ocra:<version>: the just-published packages installed as the GitHub Action installs them (pinned dependencies, signatures and provenance checked), with git, running as the unprivileged node user.

docker run --rm --user "$(id -u):$(id -g)" --volume "$PWD:/repo" \
  --env GEMINI_API_KEY ghcr.io/jma49/ocra:0.7.0 ocra review --from main

Images after 0.2.0 have ocra as entrypoint, so docker run <image> review --from main works; a leading ocra works with every image. Run as your own user so it can write .ocra/sessions/, and pass the model key and OCRA_* variables with --env. To check an image's origin, see Verifying a release.

From source

To work on ocra or run an unreleased version:

git clone https://github.com/jma49/Open-CR-Agent.git
cd Open-CR-Agent
npm install
npm run build
npm link --workspace @open-cr-agent/cli

npm link puts ocra on your PATH. To update:

git pull && npm install && npm run build

To remove it: npm unlink --global @open-cr-agent/cli.

Or run the built CLI without linking:

node /path/to/Open-CR-Agent/packages/cli/dist/main.js review

OpenCode binary

ocra looks for OpenCode in opencode-ai's platform package, then in opencode-ai/bin/ (where its install script puts it). If neither has it, point ocra at one:

export OCRA_OPENCODE_BIN=/path/to/opencode
Edit on GitHub

On this page