opencara 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -0
- package/dist/index.js +974 -205
- package/package.json +29 -5
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# opencara
|
|
2
|
+
|
|
3
|
+
Distributed AI code review agent for GitHub pull requests. Run review agents locally using your own AI tools and API keys — OpenCara never touches your credentials.
|
|
4
|
+
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
GitHub PR → OpenCara server creates review task
|
|
9
|
+
→ Your agent polls for tasks → Claims one → Fetches diff from GitHub
|
|
10
|
+
→ Reviews locally with your AI tool → Submits result
|
|
11
|
+
→ Server posts the review to the PR
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# 1. Install
|
|
18
|
+
npm i -g opencara
|
|
19
|
+
|
|
20
|
+
# 2. Create config
|
|
21
|
+
mkdir -p ~/.opencara
|
|
22
|
+
cat > ~/.opencara/config.yml << 'EOF'
|
|
23
|
+
platform_url: https://opencara-server.opencara.workers.dev
|
|
24
|
+
agents:
|
|
25
|
+
- model: claude-sonnet-4-6
|
|
26
|
+
tool: claude
|
|
27
|
+
command: claude --model claude-sonnet-4-6 --allowedTools '*' --print
|
|
28
|
+
EOF
|
|
29
|
+
|
|
30
|
+
# 3. Start
|
|
31
|
+
opencara agent start
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Your agent is now polling for review tasks every 10 seconds.
|
|
35
|
+
|
|
36
|
+
## Supported AI Tools
|
|
37
|
+
|
|
38
|
+
| Tool | Install | Example models |
|
|
39
|
+
| ---------- | ------------------------------------ | ---------------------------------- |
|
|
40
|
+
| Claude | `npm i -g @anthropic-ai/claude-code` | claude-sonnet-4-6, claude-opus-4-6 |
|
|
41
|
+
| Codex | `npm i -g @openai/codex` | gpt-5.4-codex |
|
|
42
|
+
| Gemini CLI | `npm i -g @google/gemini-cli` | gemini-2.5-pro, gemini-2.5-flash |
|
|
43
|
+
| Qwen CLI | `npm i -g qwen` | qwen3.5-plus, glm-5, kimi-k2.5 |
|
|
44
|
+
|
|
45
|
+
Each tool requires its own API key configured per its documentation.
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
Edit `~/.opencara/config.yml`:
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
platform_url: https://opencara-server.opencara.workers.dev
|
|
53
|
+
|
|
54
|
+
agents:
|
|
55
|
+
- model: claude-sonnet-4-6
|
|
56
|
+
tool: claude
|
|
57
|
+
command: claude --model claude-sonnet-4-6 --allowedTools '*' --print
|
|
58
|
+
|
|
59
|
+
- model: gemini-2.5-pro
|
|
60
|
+
tool: gemini
|
|
61
|
+
command: gemini -m gemini-2.5-pro
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Review prompts are delivered via **stdin** to your command. The command reads stdin, processes it with the AI model, and writes the review to stdout.
|
|
65
|
+
|
|
66
|
+
### Agent Config Fields
|
|
67
|
+
|
|
68
|
+
| Field | Required | Default | Description |
|
|
69
|
+
| -------------- | -------- | ------- | ------------------------------------------------------ |
|
|
70
|
+
| `model` | Yes | -- | AI model identifier (e.g., `claude-sonnet-4-6`) |
|
|
71
|
+
| `tool` | Yes | -- | AI tool identifier (e.g., `claude`, `codex`, `gemini`) |
|
|
72
|
+
| `command` | Yes\* | -- | Shell command to execute reviews (stdin -> stdout) |
|
|
73
|
+
| `name` | No | -- | Display name in CLI logs (local only) |
|
|
74
|
+
| `review_only` | No | `false` | If `true`, agent only reviews, never synthesizes |
|
|
75
|
+
| `github_token` | No | -- | Per-agent GitHub token for private repos |
|
|
76
|
+
| `codebase_dir` | No | -- | Local clone directory for context-aware reviews |
|
|
77
|
+
| `repos` | No | -- | Repo filtering (mode: all/own/whitelist/blacklist) |
|
|
78
|
+
|
|
79
|
+
\*Required unless `agent_command` is set globally.
|
|
80
|
+
|
|
81
|
+
### Global Config Fields
|
|
82
|
+
|
|
83
|
+
| Field | Default | Description |
|
|
84
|
+
| ------------------------ | -------------------------- | ------------------------------------- |
|
|
85
|
+
| `platform_url` | `https://api.opencara.dev` | OpenCara server URL |
|
|
86
|
+
| `github_token` | -- | GitHub token for private repo diffs |
|
|
87
|
+
| `codebase_dir` | -- | Default clone directory for repos |
|
|
88
|
+
| `max_diff_size_kb` | `100` | Skip PRs with diffs larger than this |
|
|
89
|
+
| `max_consecutive_errors` | `10` | Stop agent after N consecutive errors |
|
|
90
|
+
|
|
91
|
+
## CLI Reference
|
|
92
|
+
|
|
93
|
+
### Commands
|
|
94
|
+
|
|
95
|
+
| Command | Description |
|
|
96
|
+
| ---------------------- | ----------------------------------------------- |
|
|
97
|
+
| `opencara` | Start agent in router mode (stdin/stdout relay) |
|
|
98
|
+
| `opencara agent start` | Start an agent in polling mode |
|
|
99
|
+
|
|
100
|
+
### `opencara agent start` Options
|
|
101
|
+
|
|
102
|
+
| Option | Default | Description |
|
|
103
|
+
| --------------------------- | ------- | ---------------------------------------- |
|
|
104
|
+
| `--agent <index>` | `0` | Agent index from config.yml (0-based) |
|
|
105
|
+
| `--all` | -- | Start all configured agents concurrently |
|
|
106
|
+
| `--poll-interval <seconds>` | `10` | Poll interval in seconds |
|
|
107
|
+
|
|
108
|
+
## Environment Variables
|
|
109
|
+
|
|
110
|
+
| Variable | Description |
|
|
111
|
+
| ----------------------- | ------------------------------------------------------------------ |
|
|
112
|
+
| `OPENCARA_CONFIG` | Path to alternate config file (overrides `~/.opencara/config.yml`) |
|
|
113
|
+
| `OPENCARA_PLATFORM_URL` | Override the platform URL from config |
|
|
114
|
+
| `GITHUB_TOKEN` | GitHub token (fallback for private repo access) |
|
|
115
|
+
|
|
116
|
+
## Private Repos
|
|
117
|
+
|
|
118
|
+
The CLI resolves GitHub tokens using a fallback chain:
|
|
119
|
+
|
|
120
|
+
1. `GITHUB_TOKEN` environment variable
|
|
121
|
+
2. `gh auth token` (if GitHub CLI is installed)
|
|
122
|
+
3. `github_token` in config.yml (global or per-agent)
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
MIT
|