@corbat-tech/coco 1.4.0 โ†’ 1.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corbat-tech/coco",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Autonomous Coding Agent with Self-Review, Quality Convergence, and Production-Ready Output",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,6 +19,25 @@
19
19
  "README.md",
20
20
  "LICENSE"
21
21
  ],
22
+ "scripts": {
23
+ "dev": "tsx src/cli/index.ts",
24
+ "build": "tsup",
25
+ "build:watch": "tsup --watch",
26
+ "typecheck": "tsc --noEmit",
27
+ "lint": "oxlint src test",
28
+ "lint:fix": "oxlint src test --fix",
29
+ "format": "oxfmt --check src test",
30
+ "format:fix": "oxfmt --write src test",
31
+ "test": "vitest run",
32
+ "test:watch": "vitest",
33
+ "test:coverage": "vitest run --coverage",
34
+ "test:e2e": "vitest run --config vitest.e2e.config.ts",
35
+ "benchmark": "tsx test/benchmarks/quality-benchmark.ts",
36
+ "docs": "typedoc",
37
+ "docs:watch": "typedoc --watch",
38
+ "prepublishOnly": "pnpm build",
39
+ "check": "pnpm typecheck && pnpm lint && pnpm test"
40
+ },
22
41
  "keywords": [
23
42
  "ai",
24
43
  "agent",
@@ -50,6 +69,7 @@
50
69
  "engines": {
51
70
  "node": ">=22.0.0"
52
71
  },
72
+ "packageManager": "pnpm@10.0.0",
53
73
  "dependencies": {
54
74
  "@anthropic-ai/sdk": "^0.74.0",
55
75
  "@clack/prompts": "^1.0.0",
@@ -65,6 +85,7 @@
65
85
  "glob": "^13.0.1",
66
86
  "highlight.js": "^11.11.1",
67
87
  "json5": "^2.2.3",
88
+ "jsonrepair": "^3.13.2",
68
89
  "marked": "^15.0.0",
69
90
  "marked-terminal": "^7.0.0",
70
91
  "minimatch": "^10.1.2",
@@ -86,23 +107,5 @@
86
107
  "typedoc": "^0.28.16",
87
108
  "typescript": "^5.7.0",
88
109
  "vitest": "^3.0.0"
89
- },
90
- "scripts": {
91
- "dev": "tsx src/cli/index.ts",
92
- "build": "tsup",
93
- "build:watch": "tsup --watch",
94
- "typecheck": "tsc --noEmit",
95
- "lint": "oxlint src test",
96
- "lint:fix": "oxlint src test --fix",
97
- "format": "oxfmt --check src test",
98
- "format:fix": "oxfmt --write src test",
99
- "test": "vitest run",
100
- "test:watch": "vitest",
101
- "test:coverage": "vitest run --coverage",
102
- "test:e2e": "vitest run --config vitest.e2e.config.ts",
103
- "benchmark": "tsx test/benchmarks/quality-benchmark.ts",
104
- "docs": "typedoc",
105
- "docs:watch": "typedoc --watch",
106
- "check": "pnpm typecheck && pnpm lint && pnpm test"
107
110
  }
108
- }
111
+ }
package/README.old.md DELETED
@@ -1,310 +0,0 @@
1
- <p align="center">
2
- <img src="https://img.shields.io/badge/v1.2.3-stable-blueviolet?style=for-the-badge" alt="Version">
3
- <img src="https://img.shields.io/badge/TypeScript-5.7-3178c6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript">
4
- <img src="https://img.shields.io/badge/Node.js-22+-339933?style=for-the-badge&logo=nodedotjs&logoColor=white" alt="Node.js">
5
- <img src="https://img.shields.io/badge/License-MIT-f5c542?style=for-the-badge" alt="MIT License">
6
- <img src="https://img.shields.io/badge/Tests-4350%2B_passing-22c55e?style=for-the-badge" alt="Tests">
7
- </p>
8
-
9
- <h1 align="center">๐Ÿฅฅ Corbat-Coco</h1>
10
-
11
- <p align="center">
12
- <strong>The open-source coding agent that iterates on your code until it's actually production-ready.</strong>
13
- </p>
14
-
15
- <p align="center">
16
- <em>Generate โ†’ Test โ†’ Measure โ†’ Fix โ†’ Repeat โ€” autonomously.</em>
17
- </p>
18
-
19
- ---
20
-
21
- ## Why Coco?
22
-
23
- Most AI coding tools generate code and hand it to you. If something breaks โ€” tests fail, types don't match, a security issue slips in โ€” that's your problem.
24
-
25
- Coco takes a different approach. After generating code, it **runs your tests, measures quality across 12 dimensions, diagnoses what's wrong, and fixes it** โ€” in a loop, autonomously โ€” until the code actually meets a quality bar you define.
26
-
27
- ```
28
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
29
- โ”‚ Generate โ”‚ โ”€โ”€โ–บ โ”‚ Test โ”‚ โ”€โ”€โ–บ โ”‚ Measure โ”‚ โ”€โ”€โ–บ โ”‚ Fix โ”‚
30
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
31
- โ”‚
32
- Score < 85? โ”‚ โ”€โ”€โ–บ Loop back
33
- Score โ‰ฅ 85? โ”‚ โ”€โ”€โ–บ Done โœ…
34
- ```
35
-
36
- This is the **Quality Convergence Loop** โ€” Coco's core differentiator.
37
-
38
- ---
39
-
40
- ## Quick Start
41
-
42
- ```bash
43
- npm install -g @corbat-tech/coco
44
- coco # Opens interactive REPL โ€” guided setup on first run
45
- ```
46
-
47
- That's it. Coco walks you through provider configuration on first launch.
48
-
49
- ```bash
50
- # Or use it directly:
51
- coco "Add a REST API endpoint for user authentication with tests"
52
- ```
53
-
54
- ---
55
-
56
- ## What You Can Do
57
-
58
- Coco works from the interactive REPL (`coco`). You can use **slash commands** or just **talk naturally** โ€” Coco understands both.
59
-
60
- ### Slash Commands
61
-
62
- | Command | What it does | Example |
63
- |---------|-------------|---------|
64
- | `/help` | Show available commands and usage | `/help review` |
65
- | `/status` | Project status, git info, session stats | `/status` |
66
- | `/review` | Code review with severity-rated findings | `/review --base main` |
67
- | `/diff` | Visual diff with syntax highlighting | `/diff --staged` |
68
- | `/ship` | Full release pipeline: review โ†’ test โ†’ lint โ†’ branch โ†’ version โ†’ commit โ†’ PR โ†’ CI โ†’ merge | `/ship --minor` |
69
- | `/compact` | Reduce context when conversation gets long | `/compact` |
70
- | `/clear` | Clear conversation history | `/clear` |
71
-
72
- ### Natural Language
73
-
74
- You don't need to memorize commands. Just describe what you want:
75
-
76
- | What you say | What happens |
77
- |-------------|-------------|
78
- | "review the code" / "revisa el cรณdigo" | Runs `/review` |
79
- | "let's ship it" / "publica los cambios" | Runs `/ship` |
80
- | "how are we doing?" / "cรณmo va?" | Runs `/status` |
81
- | "create a PR" / "crea un pull request" | Runs `/ship` |
82
- | "show me the diff" / "muรฉstrame los cambios" | Runs `/diff` |
83
- | "help" / "ayuda" | Runs `/help` |
84
-
85
- ### `/ship` โ€” Release Pipeline
86
-
87
- The most powerful command. Orchestrates the entire release flow in one step:
88
-
89
- ```
90
- /ship # Full pipeline (10 steps)
91
- /ship --skip-tests # Skip test step
92
- /ship --draft # Create draft PR
93
- /ship --patch # Force patch version bump
94
- /ship --minor # Force minor version bump
95
- /ship --major # Force major version bump
96
- /ship --no-version # Skip version bumping
97
- /ship -m "feat: add auth" # Pre-set commit message
98
- ```
99
-
100
- Pipeline: **Preflight โ†’ Review โ†’ Tests โ†’ Lint โ†’ Branch โ†’ Version โ†’ Commit โ†’ PR โ†’ CI โ†’ Merge & Release**
101
-
102
- Each step is interactive โ€” Coco asks before proceeding when decisions are needed. Press `Ctrl+C` at any point to cancel safely.
103
-
104
- ---
105
-
106
- ## What Coco Does Well
107
-
108
- ### Quality Convergence Loop
109
-
110
- Coco doesn't just generate code โ€” it iterates until quality converges:
111
-
112
- | Iteration | Score | What happened |
113
- |:---------:|:-----:|---------------|
114
- | 1 | 52 | Code generated โ€” 3 tests failing, no error handling |
115
- | 2 | 71 | Tests fixed, security vulnerability found |
116
- | 3 | 84 | Security patched, coverage improved to 82% |
117
- | 4 | 91 | All green โ€” quality converged โœ… |
118
-
119
- The quality bar is yours to set:
120
-
121
- ```bash
122
- coco build --min-quality 90 # Per-run override
123
- coco config set quality.minScore 90 # Persist in project config
124
- ```
125
-
126
- Default is **85** (senior-level). You can also configure max iterations, convergence threshold, coverage targets, and security requirements โ€” see `coco config init`.
127
-
128
- ### 12-Dimension Quality Scoring
129
-
130
- Every iteration measures your code across 12 dimensions using real static analysis:
131
-
132
- | Dimension | How it's measured |
133
- |-----------|-------------------|
134
- | Test Coverage | c8/v8 instrumentation |
135
- | Security | Pattern matching + optional Snyk |
136
- | Complexity | Cyclomatic complexity via AST parsing |
137
- | Duplication | Line-based similarity detection |
138
- | Correctness | Test pass rate + build verification |
139
- | Style | oxlint / eslint / biome integration |
140
- | Documentation | JSDoc coverage analysis |
141
- | Readability | AST: naming quality, function length, nesting |
142
- | Maintainability | AST: file size, coupling, function count |
143
- | Test Quality | Assertion density, edge case coverage |
144
- | Completeness | Export density + test file coverage |
145
- | Robustness | Error handling pattern detection |
146
-
147
- > **Transparency note**: 7 dimensions use instrumented measurements. 5 use heuristic-based static analysis. We label which is which โ€” no black boxes.
148
-
149
- ### Multi-Provider Support
150
-
151
- Bring your own API keys. Coco works with:
152
-
153
- | Provider | Auth | Models |
154
- |----------|------|--------|
155
- | **Anthropic** | API key / OAuth PKCE | Claude Opus, Sonnet, Haiku |
156
- | **OpenAI** | API key | GPT-5.3 Codex, GPT-4.1, o4-mini |
157
- | **Google** | API key / gcloud ADC | Gemini 3, 2.5 Pro/Flash |
158
- | **Ollama** | Local | Any local model (8-24GB RAM) |
159
- | **LM Studio** | Local | Any GGUF model (8-32GB RAM) |
160
- | **Moonshot** | API key | Kimi models |
161
-
162
- ### Multi-Agent Architecture
163
-
164
- Six specialized agents with weighted-scoring routing:
165
-
166
- - **Researcher** โ€” Explores, analyzes, maps the codebase
167
- - **Coder** โ€” Writes and edits code (default route)
168
- - **Tester** โ€” Generates tests, improves coverage
169
- - **Reviewer** โ€” Code review, quality auditing
170
- - **Optimizer** โ€” Refactoring and performance
171
- - **Planner** โ€” Architecture design, task decomposition
172
-
173
- Coco picks the right agent for each task automatically. When confidence is low, it defaults to the coder โ€” no guessing games.
174
-
175
- ### Interactive REPL
176
-
177
- A terminal-first experience with:
178
-
179
- - **Ghost-text completion** โ€” Tab to accept inline suggestions
180
- - **Slash commands** โ€” `/ship`, `/review`, `/diff`, `/status`, `/help`, `/compact`, `/clear`
181
- - **Image paste** โ€” `Ctrl+V` to paste screenshots for visual context
182
- - **Intent recognition** โ€” Natural language mapped to commands
183
- - **Context management** โ€” Automatic compaction when context grows large
184
-
185
- ### Production Hardening
186
-
187
- - **Error recovery** with typed error strategies and exponential backoff
188
- - **Checkpoint/Resume** โ€” `Ctrl+C` saves state, `coco resume` picks up where you left off
189
- - **AST validation** โ€” Syntax-checks generated code before saving
190
- - **Convergence analysis** โ€” Detects oscillation, diminishing returns, and stuck patterns
191
- - **Path sandboxing** โ€” Tools can only access files within the project
192
-
193
- ---
194
-
195
- ## COCO Methodology
196
-
197
- Four phases, each with a dedicated executor:
198
-
199
- ```
200
- CONVERGE ORCHESTRATE COMPLETE OUTPUT
201
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
202
- โ”‚ Gather โ”‚ โ”‚ Design โ”‚ โ”‚ Execute with โ”‚ โ”‚ Generate โ”‚
203
- โ”‚ reqs โ”‚ โ”€โ”€โ–บ โ”‚ architecture โ”‚โ”€โ”€โ–บโ”‚ quality โ”‚โ”€โ”€โ–บโ”‚ CI/CD, โ”‚
204
- โ”‚ + spec โ”‚ โ”‚ + backlog โ”‚ โ”‚ convergence โ”‚ โ”‚ docs โ”‚
205
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
206
- โ†‘ โ†“
207
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
208
- โ”‚ Convergence โ”‚
209
- โ”‚ Loop โ”‚
210
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
211
- ```
212
-
213
- 1. **Converge** โ€” Understand what needs to be built. Gather requirements, produce a spec.
214
- 2. **Orchestrate** โ€” Design the architecture, decompose into a task backlog.
215
- 3. **Complete** โ€” Execute each task with the quality convergence loop.
216
- 4. **Output** โ€” Generate CI/CD pipelines, documentation, and deployment config.
217
-
218
- ---
219
-
220
- ## Use Cases
221
-
222
- Coco is designed for developers who want AI assistance with **accountability**:
223
-
224
- - **Feature development** โ€” Describe what you want, get tested and reviewed code
225
- - **Vibe coding** โ€” Explore ideas interactively; Coco handles the quality checks
226
- - **Refactoring** โ€” Point at code and say "make this better" โ€” Coco iterates until metrics improve
227
- - **Test generation** โ€” Improve coverage with meaningful tests, not boilerplate
228
- - **Code review** โ€” Get multi-dimensional quality feedback on existing code
229
- - **Learning** โ€” See how code quality improves across iterations
230
-
231
- ---
232
-
233
- ## Development
234
-
235
- ```bash
236
- git clone https://github.com/corbat/corbat-coco
237
- cd corbat-coco
238
- pnpm install
239
- pnpm dev # Run in dev mode (tsx)
240
- pnpm test # 4,350+ tests via Vitest
241
- pnpm check # typecheck + lint + test
242
- pnpm build # Production build (tsup)
243
- ```
244
-
245
- ### Project Structure
246
-
247
- ```
248
- src/
249
- โ”œโ”€โ”€ agents/ # Multi-agent coordination + weighted routing
250
- โ”œโ”€โ”€ cli/ # REPL, commands, input handling, output rendering
251
- โ”œโ”€โ”€ orchestrator/ # Phase coordinator + state recovery
252
- โ”œโ”€โ”€ phases/ # COCO phases (converge/orchestrate/complete/output)
253
- โ”œโ”€โ”€ quality/ # 12 quality analyzers + convergence engine
254
- โ”œโ”€โ”€ providers/ # 7 LLM providers + OAuth flows
255
- โ”œโ”€โ”€ tools/ # 20+ tool implementations
256
- โ”œโ”€โ”€ hooks/ # Lifecycle hooks (safety, lint, format, audit)
257
- โ”œโ”€โ”€ mcp/ # MCP server for external integration
258
- โ””โ”€โ”€ config/ # Zod-validated configuration system
259
- ```
260
-
261
- ### Technology Stack
262
-
263
- | Component | Technology |
264
- |-----------|-----------|
265
- | Language | TypeScript (ESM, strict mode) |
266
- | Runtime | Node.js 22+ |
267
- | Testing | Vitest (4,350+ tests) |
268
- | Linting | oxlint |
269
- | Formatting | oxfmt |
270
- | Build | tsup |
271
- | Schema validation | Zod |
272
-
273
- ---
274
-
275
- ## Known Limitations
276
-
277
- We'd rather you know upfront:
278
-
279
- - **TypeScript/JavaScript first** โ€” Other languages have basic support but fewer analyzers
280
- - **CLI-only** โ€” No IDE extension yet (VS Code integration is planned)
281
- - **Iteration takes time** โ€” The convergence loop adds 2-5 minutes per task. For quick one-line fixes, a simpler tool may be faster
282
- - **Heuristic analyzers** โ€” 5 of 12 quality dimensions use pattern-based heuristics, not deep semantic analysis
283
- - **LLM-dependent** โ€” Output quality depends on the model you connect. Larger models produce better results
284
- - **Early stage** โ€” Actively developed. Not yet battle-tested at large enterprise scale
285
-
286
- ---
287
-
288
- ## Contributing
289
-
290
- We welcome contributions of all kinds:
291
-
292
- - Bug reports and feature requests
293
- - New quality analyzers
294
- - Additional LLM provider integrations
295
- - Documentation and examples
296
- - Real-world usage feedback
297
-
298
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
299
-
300
- ---
301
-
302
- ## About
303
-
304
- Corbat-Coco is built by [Corbat](https://corbat.tech), a technology consultancy that believes AI coding tools should be transparent, measurable, and open source.
305
-
306
- <p align="center">
307
- <a href="https://github.com/corbat/corbat-coco">GitHub</a> ยท <a href="https://corbat.tech">corbat.tech</a>
308
- </p>
309
-
310
- <p align="center"><strong>MIT License</strong> ยท Made by developers who measure before they ship. ๐Ÿฅฅ</p>