karajan-code 1.2.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/LICENSE +21 -0
- package/README.md +441 -0
- package/docs/karajan-code-logo-small.png +0 -0
- package/package.json +60 -0
- package/scripts/install.js +898 -0
- package/scripts/install.sh +7 -0
- package/scripts/postinstall.js +117 -0
- package/scripts/setup-multi-instance.sh +150 -0
- package/src/activity-log.js +59 -0
- package/src/agents/aider-agent.js +25 -0
- package/src/agents/availability.js +32 -0
- package/src/agents/base-agent.js +27 -0
- package/src/agents/claude-agent.js +24 -0
- package/src/agents/codex-agent.js +27 -0
- package/src/agents/gemini-agent.js +25 -0
- package/src/agents/index.js +19 -0
- package/src/agents/resolve-bin.js +60 -0
- package/src/cli.js +200 -0
- package/src/commands/code.js +32 -0
- package/src/commands/config.js +74 -0
- package/src/commands/doctor.js +155 -0
- package/src/commands/init.js +181 -0
- package/src/commands/plan.js +67 -0
- package/src/commands/report.js +340 -0
- package/src/commands/resume.js +39 -0
- package/src/commands/review.js +26 -0
- package/src/commands/roles.js +117 -0
- package/src/commands/run.js +91 -0
- package/src/commands/scan.js +18 -0
- package/src/commands/sonar.js +53 -0
- package/src/config.js +322 -0
- package/src/git/automation.js +100 -0
- package/src/mcp/progress.js +69 -0
- package/src/mcp/run-kj.js +87 -0
- package/src/mcp/server-handlers.js +259 -0
- package/src/mcp/server.js +37 -0
- package/src/mcp/tool-arg-normalizers.js +16 -0
- package/src/mcp/tools.js +184 -0
- package/src/orchestrator.js +1277 -0
- package/src/planning-game/adapter.js +105 -0
- package/src/planning-game/client.js +81 -0
- package/src/prompts/coder.js +60 -0
- package/src/prompts/planner.js +26 -0
- package/src/prompts/reviewer.js +45 -0
- package/src/repeat-detector.js +77 -0
- package/src/review/diff-generator.js +22 -0
- package/src/review/parser.js +93 -0
- package/src/review/profiles.js +66 -0
- package/src/review/schema.js +31 -0
- package/src/review/tdd-policy.js +57 -0
- package/src/roles/base-role.js +127 -0
- package/src/roles/coder-role.js +60 -0
- package/src/roles/commiter-role.js +94 -0
- package/src/roles/index.js +12 -0
- package/src/roles/planner-role.js +81 -0
- package/src/roles/refactorer-role.js +66 -0
- package/src/roles/researcher-role.js +134 -0
- package/src/roles/reviewer-role.js +132 -0
- package/src/roles/security-role.js +128 -0
- package/src/roles/solomon-role.js +199 -0
- package/src/roles/sonar-role.js +65 -0
- package/src/roles/tester-role.js +114 -0
- package/src/roles/triage-role.js +128 -0
- package/src/session-store.js +80 -0
- package/src/sonar/api.js +78 -0
- package/src/sonar/enforcer.js +19 -0
- package/src/sonar/manager.js +163 -0
- package/src/sonar/project-key.js +83 -0
- package/src/sonar/scanner.js +267 -0
- package/src/utils/agent-detect.js +32 -0
- package/src/utils/budget.js +123 -0
- package/src/utils/display.js +346 -0
- package/src/utils/events.js +23 -0
- package/src/utils/fs.js +19 -0
- package/src/utils/git.js +101 -0
- package/src/utils/logger.js +86 -0
- package/src/utils/paths.js +18 -0
- package/src/utils/pricing.js +28 -0
- package/src/utils/process.js +67 -0
- package/src/utils/wizard.js +41 -0
- package/templates/coder-rules.md +24 -0
- package/templates/docker-compose.sonar.yml +60 -0
- package/templates/kj.config.yml +82 -0
- package/templates/review-rules.md +11 -0
- package/templates/roles/coder.md +42 -0
- package/templates/roles/commiter.md +44 -0
- package/templates/roles/planner.md +45 -0
- package/templates/roles/refactorer.md +39 -0
- package/templates/roles/researcher.md +37 -0
- package/templates/roles/reviewer-paranoid.md +38 -0
- package/templates/roles/reviewer-relaxed.md +34 -0
- package/templates/roles/reviewer-strict.md +37 -0
- package/templates/roles/reviewer.md +55 -0
- package/templates/roles/security.md +54 -0
- package/templates/roles/solomon.md +106 -0
- package/templates/roles/sonar.md +49 -0
- package/templates/roles/tester.md +41 -0
- package/templates/roles/triage.md +25 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mánu Fosela
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/karajan-code-logo-small.png" alt="Karajan Code" width="200">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Karajan Code</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
Local multi-agent coding orchestrator with TDD, SonarQube, and automated code review.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/karajan-code"><img src="https://img.shields.io/npm/v/karajan-code.svg" alt="npm version"></a>
|
|
13
|
+
<a href="https://github.com/manufosela/karajan-code/actions"><img src="https://github.com/manufosela/karajan-code/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
14
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
|
|
15
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg" alt="Node.js"></a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What is Karajan Code?
|
|
21
|
+
|
|
22
|
+
Karajan Code (`kj`) orchestrates multiple AI coding agents through an automated pipeline: code generation, static analysis, code review, testing, and security audits — all in a single command.
|
|
23
|
+
|
|
24
|
+
Instead of running one AI agent and manually reviewing its output, `kj` chains agents together with quality gates. The coder writes code, SonarQube scans it, the reviewer checks it, and if issues are found, the coder gets another attempt. This loop runs until the code is approved or the iteration limit is reached.
|
|
25
|
+
|
|
26
|
+
**Key features:**
|
|
27
|
+
- **Multi-agent pipeline** with 11 configurable roles
|
|
28
|
+
- **4 AI agents supported**: Claude, Codex, Gemini, Aider
|
|
29
|
+
- **MCP server** with 11 tools — use `kj` from Claude, Codex, or any MCP-compatible host without leaving your agent. [See MCP setup](#mcp-server)
|
|
30
|
+
- **TDD enforcement** — test changes required when source files change
|
|
31
|
+
- **SonarQube integration** — static analysis with quality gate enforcement (requires [Docker](#requirements))
|
|
32
|
+
- **Review profiles** — standard, strict, relaxed, paranoid
|
|
33
|
+
- **Budget tracking** — per-session token and cost monitoring with `--trace`
|
|
34
|
+
- **Git automation** — auto-commit, auto-push, auto-PR after approval
|
|
35
|
+
- **Session management** — pause/resume with fail-fast detection
|
|
36
|
+
- **Planning Game integration** — optionally pair with [Planning Game](https://github.com/AgenteIA-Geniova/planning-game) for agile project management (tasks, sprints, estimation) — like Jira, but open-source and XP-native
|
|
37
|
+
|
|
38
|
+
> **Best with MCP** — Karajan Code is designed to be used as an MCP server inside your AI agent (Claude, Codex, etc.). The agent sends tasks to `kj_run`, gets real-time progress notifications, and receives structured results — no copy-pasting needed.
|
|
39
|
+
|
|
40
|
+
## Requirements
|
|
41
|
+
|
|
42
|
+
- **Node.js** >= 18
|
|
43
|
+
- **Docker** — required for SonarQube static analysis. If you don't have Docker or don't need SonarQube, disable it with `--no-sonar` or set `sonarqube.enabled: false` in config
|
|
44
|
+
- At least one AI agent CLI installed: Claude, Codex, Gemini, or Aider
|
|
45
|
+
|
|
46
|
+
## Pipeline
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
triage? ─> researcher? ─> planner? ─> coder ─> refactorer? ─> sonar? ─> reviewer ─> tester? ─> security? ─> commiter?
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
| Role | Description | Default |
|
|
53
|
+
|------|-------------|---------|
|
|
54
|
+
| **triage** | Classifies task complexity (trivial/simple/medium/complex) and activates only necessary roles | Off |
|
|
55
|
+
| **researcher** | Investigates codebase context before planning | Off |
|
|
56
|
+
| **planner** | Generates structured implementation plans | Off |
|
|
57
|
+
| **coder** | Writes code and tests following TDD methodology | **Always on** |
|
|
58
|
+
| **refactorer** | Improves code clarity without changing behavior | Off |
|
|
59
|
+
| **sonar** | Runs SonarQube static analysis and quality gate checks | On (if configured) |
|
|
60
|
+
| **reviewer** | Code review with configurable strictness profiles | **Always on** |
|
|
61
|
+
| **tester** | Test quality gate and coverage verification | Off |
|
|
62
|
+
| **security** | OWASP security audit | Off |
|
|
63
|
+
| **solomon** | Conflict resolver when coder and reviewer disagree | Off |
|
|
64
|
+
| **commiter** | Git commit, push, and PR automation after approval | Off |
|
|
65
|
+
|
|
66
|
+
Roles marked with `?` are optional and can be enabled per-run or via config.
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
### From npm (recommended)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install -g karajan-code
|
|
74
|
+
kj init
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### From source
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
git clone https://github.com/manufosela/karajan-code.git
|
|
81
|
+
cd karajan-code
|
|
82
|
+
./scripts/install.sh
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Non-interactive setup (CI/automation)
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
./scripts/install.sh \
|
|
89
|
+
--non-interactive \
|
|
90
|
+
--kj-home /path/to/.karajan \
|
|
91
|
+
--sonar-host http://localhost:9000 \
|
|
92
|
+
--sonar-token "$KJ_SONAR_TOKEN" \
|
|
93
|
+
--coder claude \
|
|
94
|
+
--reviewer codex \
|
|
95
|
+
--run-doctor true
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Multi-instance setup
|
|
99
|
+
|
|
100
|
+
Full guides: [`docs/multi-instance.md`](docs/multi-instance.md) | [`docs/install-two-instances.md`](docs/install-two-instances.md)
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
./scripts/setup-multi-instance.sh
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Supported Agents
|
|
107
|
+
|
|
108
|
+
| Agent | CLI | Install |
|
|
109
|
+
|-------|-----|---------|
|
|
110
|
+
| **Claude** | `claude` | `npm install -g @anthropic-ai/claude-code` |
|
|
111
|
+
| **Codex** | `codex` | `npm install -g @openai/codex` |
|
|
112
|
+
| **Gemini** | `gemini` | See [Gemini CLI docs](https://github.com/google-gemini/gemini-cli) |
|
|
113
|
+
| **Aider** | `aider` | `pip install aider-chat` |
|
|
114
|
+
|
|
115
|
+
`kj init` auto-detects installed agents. If only one is available, it is assigned to all roles automatically.
|
|
116
|
+
|
|
117
|
+
## Quick Start
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Run a task with defaults (claude=coder, codex=reviewer, TDD)
|
|
121
|
+
kj run "Implement user authentication with JWT"
|
|
122
|
+
|
|
123
|
+
# Coder-only mode (skip review)
|
|
124
|
+
kj code "Add input validation to the signup form"
|
|
125
|
+
|
|
126
|
+
# Review-only mode (review current diff)
|
|
127
|
+
kj review "Check the authentication changes"
|
|
128
|
+
|
|
129
|
+
# Generate an implementation plan
|
|
130
|
+
kj plan "Refactor the database layer to use connection pooling"
|
|
131
|
+
|
|
132
|
+
# Full pipeline with all options
|
|
133
|
+
kj run "Fix critical SQL injection in search endpoint" \
|
|
134
|
+
--coder claude \
|
|
135
|
+
--reviewer codex \
|
|
136
|
+
--reviewer-fallback claude \
|
|
137
|
+
--methodology tdd \
|
|
138
|
+
--enable-triage \
|
|
139
|
+
--enable-tester \
|
|
140
|
+
--enable-security \
|
|
141
|
+
--auto-commit \
|
|
142
|
+
--auto-push \
|
|
143
|
+
--max-iterations 5
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## CLI Commands
|
|
147
|
+
|
|
148
|
+
### `kj init`
|
|
149
|
+
|
|
150
|
+
Interactive setup wizard. Auto-detects installed agents and guides coder/reviewer selection, SonarQube configuration, and methodology choice.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
kj init # Interactive wizard
|
|
154
|
+
kj init --no-interactive # Use defaults (for CI)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### `kj run <task>`
|
|
158
|
+
|
|
159
|
+
Run the full pipeline: coder → sonar → reviewer loop.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
kj run "Fix the login bug" [options]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
| Flag | Description |
|
|
166
|
+
|------|-------------|
|
|
167
|
+
| `--coder <name>` | AI agent for coding (claude, codex, gemini, aider) |
|
|
168
|
+
| `--reviewer <name>` | AI agent for review |
|
|
169
|
+
| `--reviewer-fallback <name>` | Fallback reviewer if primary fails |
|
|
170
|
+
| `--coder-model <name>` | Specific model for coder |
|
|
171
|
+
| `--reviewer-model <name>` | Specific model for reviewer |
|
|
172
|
+
| `--planner-model <name>` | Specific model for planner |
|
|
173
|
+
| `--methodology <name>` | `tdd` or `standard` |
|
|
174
|
+
| `--mode <name>` | Review mode: `standard`, `strict`, `paranoid`, `relaxed` |
|
|
175
|
+
| `--max-iterations <n>` | Max coder/reviewer loops |
|
|
176
|
+
| `--max-iteration-minutes <n>` | Timeout per iteration |
|
|
177
|
+
| `--max-total-minutes <n>` | Total session timeout |
|
|
178
|
+
| `--base-branch <name>` | Base branch for diff (default: `main`) |
|
|
179
|
+
| `--base-ref <ref>` | Explicit base ref for diff |
|
|
180
|
+
| `--enable-planner` | Enable planner role |
|
|
181
|
+
| `--enable-refactorer` | Enable refactorer role |
|
|
182
|
+
| `--enable-researcher` | Enable researcher role |
|
|
183
|
+
| `--enable-tester` | Enable tester role |
|
|
184
|
+
| `--enable-security` | Enable security audit role |
|
|
185
|
+
| `--enable-triage` | Enable dynamic triage |
|
|
186
|
+
| `--enable-serena` | Enable Serena MCP integration |
|
|
187
|
+
| `--auto-commit` | Git commit after approval |
|
|
188
|
+
| `--auto-push` | Git push after commit |
|
|
189
|
+
| `--auto-pr` | Create PR after push |
|
|
190
|
+
| `--no-auto-rebase` | Disable auto-rebase before push |
|
|
191
|
+
| `--branch-prefix <prefix>` | Branch naming prefix (default: `feat/`) |
|
|
192
|
+
| `--no-sonar` | Skip SonarQube analysis |
|
|
193
|
+
| `--pg-task <cardId>` | Planning Game card ID for task context |
|
|
194
|
+
| `--pg-project <projectId>` | Planning Game project ID |
|
|
195
|
+
| `--dry-run` | Show what would run without executing |
|
|
196
|
+
| `--json` | Output JSON only |
|
|
197
|
+
|
|
198
|
+
### `kj code <task>`
|
|
199
|
+
|
|
200
|
+
Run coder only (no review loop).
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
kj code "Add error handling to the API client" --coder claude --coder-model sonnet
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### `kj review <task>`
|
|
207
|
+
|
|
208
|
+
Run reviewer only against current diff.
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
kj review "Check auth changes" --reviewer codex --base-ref HEAD~3
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### `kj plan <task>`
|
|
215
|
+
|
|
216
|
+
Generate an implementation plan without writing code.
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
kj plan "Migrate from REST to GraphQL" --planner claude --context "We use Apollo Server"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### `kj scan`
|
|
223
|
+
|
|
224
|
+
Run SonarQube analysis on the current project.
|
|
225
|
+
|
|
226
|
+
### `kj doctor`
|
|
227
|
+
|
|
228
|
+
Check environment: git, Docker, SonarQube, agent CLIs, rule files.
|
|
229
|
+
|
|
230
|
+
### `kj config`
|
|
231
|
+
|
|
232
|
+
Show current configuration.
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
kj config # Pretty print
|
|
236
|
+
kj config --json # JSON output
|
|
237
|
+
kj config --edit # Open in $EDITOR
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### `kj report`
|
|
241
|
+
|
|
242
|
+
Show session reports with budget tracking.
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
kj report # Latest session report
|
|
246
|
+
kj report --list # List all session IDs
|
|
247
|
+
kj report --session-id <id> # Specific session
|
|
248
|
+
kj report --trace # Chronological stage breakdown
|
|
249
|
+
kj report --trace --currency eur # Costs in EUR
|
|
250
|
+
kj report --format json # JSON output
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### `kj resume <sessionId>`
|
|
254
|
+
|
|
255
|
+
Resume a paused session (e.g., after fail-fast).
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
kj resume s_2026-02-28T20-47-24-270Z --answer "yes, proceed with the fix"
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### `kj roles`
|
|
262
|
+
|
|
263
|
+
Inspect pipeline roles and their template instructions.
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
kj roles # List all roles with provider and status
|
|
267
|
+
kj roles show coder # Show coder role template
|
|
268
|
+
kj roles show reviewer-paranoid # Show paranoid review variant
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### `kj sonar`
|
|
272
|
+
|
|
273
|
+
Manage the SonarQube Docker container.
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
kj sonar status # Check container status
|
|
277
|
+
kj sonar start # Start container
|
|
278
|
+
kj sonar stop # Stop container
|
|
279
|
+
kj sonar logs # View container logs
|
|
280
|
+
kj sonar open # Open dashboard in browser
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Configuration
|
|
284
|
+
|
|
285
|
+
Configuration file: `~/.karajan/kj.config.yml` (or `$KJ_HOME/kj.config.yml`)
|
|
286
|
+
|
|
287
|
+
Generated by `kj init`. Full reference:
|
|
288
|
+
|
|
289
|
+
```yaml
|
|
290
|
+
# AI Agents
|
|
291
|
+
coder: claude
|
|
292
|
+
reviewer: codex
|
|
293
|
+
|
|
294
|
+
# Review settings
|
|
295
|
+
review_mode: standard # standard | strict | paranoid | relaxed
|
|
296
|
+
max_iterations: 5
|
|
297
|
+
review_rules: ./review-rules.md
|
|
298
|
+
coder_rules: ./coder-rules.md
|
|
299
|
+
base_branch: main
|
|
300
|
+
|
|
301
|
+
# Coder settings
|
|
302
|
+
coder_options:
|
|
303
|
+
model: null # Override model (e.g., sonnet, o4-mini)
|
|
304
|
+
auto_approve: true
|
|
305
|
+
|
|
306
|
+
# Reviewer settings
|
|
307
|
+
reviewer_options:
|
|
308
|
+
output_format: json
|
|
309
|
+
require_schema: true
|
|
310
|
+
model: null
|
|
311
|
+
deterministic: true
|
|
312
|
+
retries: 1
|
|
313
|
+
fallback_reviewer: codex
|
|
314
|
+
|
|
315
|
+
# Development methodology
|
|
316
|
+
development:
|
|
317
|
+
methodology: tdd # tdd | standard
|
|
318
|
+
require_test_changes: true
|
|
319
|
+
|
|
320
|
+
# SonarQube
|
|
321
|
+
sonarqube:
|
|
322
|
+
enabled: true
|
|
323
|
+
host: http://localhost:9000
|
|
324
|
+
token: null # Set via KJ_SONAR_TOKEN env var
|
|
325
|
+
quality_gate: true
|
|
326
|
+
enforcement_profile: pragmatic
|
|
327
|
+
fail_on: [BLOCKER, CRITICAL]
|
|
328
|
+
ignore_on: [INFO]
|
|
329
|
+
max_scan_retries: 3
|
|
330
|
+
|
|
331
|
+
# Git automation (post-approval)
|
|
332
|
+
git:
|
|
333
|
+
auto_commit: false
|
|
334
|
+
auto_push: false
|
|
335
|
+
auto_pr: false
|
|
336
|
+
auto_rebase: true
|
|
337
|
+
branch_prefix: feat/
|
|
338
|
+
|
|
339
|
+
# Session limits
|
|
340
|
+
session:
|
|
341
|
+
max_iteration_minutes: 15
|
|
342
|
+
max_total_minutes: 120
|
|
343
|
+
max_budget_usd: null # null = unlimited
|
|
344
|
+
fail_fast_repeats: 2
|
|
345
|
+
|
|
346
|
+
# Budget tracking
|
|
347
|
+
budget:
|
|
348
|
+
currency: usd # usd | eur
|
|
349
|
+
exchange_rate_eur: 0.92
|
|
350
|
+
|
|
351
|
+
# Output
|
|
352
|
+
output:
|
|
353
|
+
report_dir: ./.reviews
|
|
354
|
+
log_level: info # debug | info | warn | error
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Environment variables
|
|
358
|
+
|
|
359
|
+
| Variable | Description |
|
|
360
|
+
|----------|-------------|
|
|
361
|
+
| `KJ_HOME` | Override config/sessions directory |
|
|
362
|
+
| `KJ_SONAR_TOKEN` | SonarQube authentication token |
|
|
363
|
+
|
|
364
|
+
## MCP Server
|
|
365
|
+
|
|
366
|
+
Karajan Code exposes an MCP server for integration with any MCP-compatible host (Claude, Codex, custom agents).
|
|
367
|
+
|
|
368
|
+
### Setup
|
|
369
|
+
|
|
370
|
+
After `npm install -g karajan-code`, the MCP server is auto-registered in Claude and Codex configs. Manual config:
|
|
371
|
+
|
|
372
|
+
```json
|
|
373
|
+
{
|
|
374
|
+
"mcpServers": {
|
|
375
|
+
"karajan-mcp": {
|
|
376
|
+
"command": "karajan-mcp"
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### MCP Tools
|
|
383
|
+
|
|
384
|
+
| Tool | Description |
|
|
385
|
+
|------|-------------|
|
|
386
|
+
| `kj_init` | Initialize config and SonarQube |
|
|
387
|
+
| `kj_doctor` | Check system dependencies |
|
|
388
|
+
| `kj_config` | Show configuration |
|
|
389
|
+
| `kj_scan` | Run SonarQube scan |
|
|
390
|
+
| `kj_run` | Run full pipeline (with real-time progress notifications) |
|
|
391
|
+
| `kj_resume` | Resume a paused session |
|
|
392
|
+
| `kj_report` | Read session reports (supports `--trace`) |
|
|
393
|
+
| `kj_roles` | List roles or show role templates |
|
|
394
|
+
| `kj_code` | Run coder-only mode |
|
|
395
|
+
| `kj_review` | Run reviewer-only mode |
|
|
396
|
+
| `kj_plan` | Generate implementation plan |
|
|
397
|
+
|
|
398
|
+
### Recommended Companion MCPs
|
|
399
|
+
|
|
400
|
+
Karajan Code works great on its own, but combining it with these MCP servers gives your AI agent a complete development environment:
|
|
401
|
+
|
|
402
|
+
| MCP | Why | Use case |
|
|
403
|
+
|-----|-----|----------|
|
|
404
|
+
| [**Planning Game MCP**](https://github.com/AgenteIA-Geniova/planning-game-mcp) | MCP bridge for [Planning Game](https://github.com/AgenteIA-Geniova/planning-game), an open-source agile project manager (tasks, sprints, estimation, XP). Only needed if you use Planning Game for task management | `kj_run` with `--pg-task` fetches full task context and updates card status on completion |
|
|
405
|
+
| [**GitHub MCP**](https://github.com/modelcontextprotocol/servers/tree/main/src/github) | Create PRs, manage issues, read repos directly from the agent | Combine with `--auto-push` for end-to-end: code → review → push → PR |
|
|
406
|
+
| [**Serena**](https://github.com/oramasearch/serena) | Symbol-level code navigation (find references, go-to-definition) for JS/TS projects | Enable with `--enable-serena` to inject symbol context into coder/reviewer prompts |
|
|
407
|
+
| [**Chrome DevTools MCP**](https://github.com/anthropics/anthropic-quickstarts/tree/main/chrome-devtools-mcp) | Browser automation, screenshots, console/network inspection | Verify UI changes visually after `kj` modifies frontend code |
|
|
408
|
+
|
|
409
|
+
## Role Templates
|
|
410
|
+
|
|
411
|
+
Each role has a `.md` template with instructions that the AI agent follows. Templates are resolved in priority order:
|
|
412
|
+
|
|
413
|
+
1. **Project override**: `.karajan/roles/<role>.md` (in project root)
|
|
414
|
+
2. **User override**: `$KJ_HOME/roles/<role>.md`
|
|
415
|
+
3. **Built-in**: `templates/roles/<role>.md` (shipped with the package)
|
|
416
|
+
|
|
417
|
+
Use `kj roles show <role>` to inspect any template. Create a project override to customize behavior per-project.
|
|
418
|
+
|
|
419
|
+
**Review variants**: `reviewer-strict`, `reviewer-relaxed`, `reviewer-paranoid` — selectable via `--mode` flag or `review_mode` config.
|
|
420
|
+
|
|
421
|
+
## Contributing
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
git clone https://github.com/manufosela/karajan-code.git
|
|
425
|
+
cd karajan-code
|
|
426
|
+
npm install
|
|
427
|
+
npm test # Run 761+ tests with Vitest
|
|
428
|
+
npm run test:watch # Watch mode
|
|
429
|
+
npm run validate # Lint + test
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
- Tests: [Vitest](https://vitest.dev/)
|
|
433
|
+
- Commits: [Conventional Commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`, `refactor:`, `test:`, `chore:`)
|
|
434
|
+
- PRs: one purpose per PR, < 300 lines changed
|
|
435
|
+
|
|
436
|
+
## Links
|
|
437
|
+
|
|
438
|
+
- [Changelog](CHANGELOG.md)
|
|
439
|
+
- [Security Policy](SECURITY.md)
|
|
440
|
+
- [License (MIT)](LICENSE)
|
|
441
|
+
- [Issues](https://github.com/manufosela/karajan-code/issues)
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "karajan-code",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Local multi-agent coding orchestrator with TDD, SonarQube, and code review pipeline",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Manu Fosela <mjfosela@gmail.com>",
|
|
8
|
+
"homepage": "https://github.com/manufosela/karajan-code#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/manufosela/karajan-code.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/manufosela/karajan-code/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"ai",
|
|
18
|
+
"orchestrator",
|
|
19
|
+
"code-review",
|
|
20
|
+
"tdd",
|
|
21
|
+
"sonarqube",
|
|
22
|
+
"multi-agent",
|
|
23
|
+
"mcp",
|
|
24
|
+
"cli"
|
|
25
|
+
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18.0.0"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"src/",
|
|
31
|
+
"templates/",
|
|
32
|
+
"scripts/",
|
|
33
|
+
"docs/karajan-code-logo-small.png",
|
|
34
|
+
"LICENSE",
|
|
35
|
+
"README.md"
|
|
36
|
+
],
|
|
37
|
+
"bin": {
|
|
38
|
+
"kj": "./src/cli.js",
|
|
39
|
+
"karajan-mcp": "./src/mcp/server.js"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"postinstall": "node scripts/postinstall.js",
|
|
43
|
+
"setup": "node scripts/install.js",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"test:watch": "vitest",
|
|
46
|
+
"lint": "((command -v rg >/dev/null 2>&1 && rg --files src tests | rg '\\.js$') || find src tests -type f -name '*.js') | while IFS= read -r f; do node --check \"$f\"; done",
|
|
47
|
+
"validate": "npm run lint && npm test",
|
|
48
|
+
"mcp": "node src/mcp/server.js"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
52
|
+
"commander": "^14.0.0",
|
|
53
|
+
"execa": "^9.6.0",
|
|
54
|
+
"js-yaml": "^4.1.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
58
|
+
"vitest": "^4.0.0"
|
|
59
|
+
}
|
|
60
|
+
}
|