Open Code Review (OCR) — CLI

docs / modules / cli

← all docs

Open Code Review (OCR) — CLI

flowchart LR IN["Input\nCLI args/flags, config.json, rule.json, environment variables"] --> ACT["CLI\nCobra command tree: review, scan, delegate, session, config, llm, rules, viewer, completion."] ACT --> OUT["Output\na fully-populated agent.Args / scan.Args, dispatched to the right package"]

Cobra command tree: review, scan, delegate, session, config, llm, rules, viewer, completion. Package: cmd/opencodereview/.

What flows through it

flowchart LR IN["CLI args/flags, config.json, rule.json, environment variables"] --> MOD["CLI"] MOD --> OUT["a fully-populated agent.Args / scan.Args, dispatched to the right package"]

Technical details

Package: cmd/opencodereview/ Depends on: diff, config_rules, agent, scan, delegate, session, llm, tool, mcp, viewer Depended on by: (nothing in this package set imports it directly — used only by the CLI entry point or externally)

What actually happens here

root.go registers ten subcommands. review_cmd.go / scan_cmd.go resolve the LLM endpoint (internal/llm.ResolveEndpoint*), build the rule resolver and file filter from internal/config, construct the tool registry (registering built-ins then any configured MCP servers), and call agent.New(...).Run() or scan.NewAgent(...).Run(). config_cmd.go and provider_cmd.go/provider_tui.go drive the interactive provider/model setup wizard shown in the README's screenshot.

How the LLM / model version is chosen

No model call in the CLI layer itself — it only resolves which model/provider/protocol downstream calls will use, via internal/llm.ResolveEndpointWithOptions (env var OCR_LLM_PROTOCOL, or config.json llm.protocol / provider preset).

Deterministic (non-LLM) work in this module

All of it: flag parsing, config file loading and merge, endpoint resolution, tool registry assembly, and command dispatch are plain Go with no model call.


Part of the module docs index. Full interactive version, with every module side by side: architecture.html §7. Cross-cutting mechanisms this module participates in (retry, compression, manifest, resume, hashing): LLD.