Skip to content

CLI

The irag CLI provides terminal access to IntelliRag’s code intelligence. Use it in scripts, CI pipelines, or as a quick alternative to the MCP tools.

Terminal window
go install github.com/intellirag/intellirag.io/cli/cmd/irag@latest

Verify the installation:

Terminal window
irag version

Log in with your browser - supports SSO through your organization’s identity provider:

Terminal window
irag auth login

This opens your browser to the IntelliRag login page. After authenticating, the browser redirects back and your credentials are stored locally at ~/.config/irag/credentials.json. Subsequent commands use these credentials automatically, refreshing the access token as needed.

Check your login status:

Terminal window
irag auth status

Log out and remove stored credentials:

Terminal window
irag auth logout

For CI pipelines, Docker containers, and other non-interactive environments, use an API key instead. The CLI resolves credentials in this order:

  1. --api-key flag (highest priority)
  2. RAG_API_KEY environment variable
  3. OAuth2 tokens from ~/.config/irag/credentials.json (from irag auth login)
  4. Config file at ~/.config/irag/config.yaml

Create ~/.config/irag/config.yaml:

api_url: https://api.intellirag.io
api_key: rag_xxxxxxxxxxxx
Flag Short Description
--api-url API server URL
--api-key API key (overrides env and config file)
--output -o Output format: table, json, yaml (default: table)

Search for code semantically:

Terminal window
irag search "authentication middleware" --repo-id abc123

Look up a symbol by its fully qualified name:

Terminal window
irag symbols fqn "com.example.UserService.findById" --repo-id abc123

Trace who calls a method:

Terminal window
irag graph callers "com.example.UserService.findById" --depth 3

Analyze the impact of changing a class:

Terminal window
irag impact "com.example.User" --repo-id abc123

Get JSON output for scripting:

Terminal window
irag debt --repo-id abc123 -o json | jq '.items[] | .file'