opencroc 0.6.0 → 1.3.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 -21
- package/README.en.md +414 -317
- package/README.ja.md +386 -317
- package/README.md +417 -317
- package/README.zh-CN.md +414 -317
- package/dist/cli/index.js +1405 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +1188 -3
- package/dist/index.js +4112 -248
- package/dist/index.js.map +1 -1
- package/dist/web/index.html +734 -0
- package/package.json +80 -74
package/README.en.md
CHANGED
|
@@ -1,317 +1,414 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="assets/banner.png" alt="OpenCroc banner" width="820" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<h1 align="center">OpenCroc</h1>
|
|
6
|
-
|
|
7
|
-
<p align="center">
|
|
8
|
-
<strong>AI-native E2E testing framework that reads your source code, generates tests, and self-heals failures.</strong>
|
|
9
|
-
</p>
|
|
10
|
-
|
|
11
|
-
<p align="center">
|
|
12
|
-
<a href="https://www.npmjs.com/package/opencroc"><img src="https://img.shields.io/npm/v/opencroc?color=green" alt="npm version" /></a>
|
|
13
|
-
<a href="https://github.com/opencroc/opencroc/actions/workflows/ci.yml"><img src="https://github.com/opencroc/opencroc/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI" /></a>
|
|
14
|
-
<a href="https://github.com/opencroc/opencroc/blob/main/LICENSE"><img src="https://img.shields.io/github/license/opencroc/opencroc" alt="MIT License" /></a>
|
|
15
|
-
<a href="https://opencroc.com"><img src="https://img.shields.io/badge/docs-opencroc.com-blue" alt="Documentation" /></a>
|
|
16
|
-
</p>
|
|
17
|
-
|
|
18
|
-
<p align="center">
|
|
19
|
-
<a href="README.en.md">English</a> | <a href="README.zh-CN.md">简体中文</a> | <a href="README.ja.md">日本語</a>
|
|
20
|
-
</p>
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## What is OpenCroc?
|
|
25
|
-
|
|
26
|
-
OpenCroc is an **AI-native end-to-end testing framework** built on top of [Playwright](https://playwright.dev). Instead of writing test scripts by hand, OpenCroc **reads your backend source code** (models, controllers, DTOs) and automatically generates complete E2E test suites, including API chains, seed data, request bodies, and assertions.
|
|
27
|
-
|
|
28
|
-
When tests fail, OpenCroc does not just report errors. It **traces the root cause** through the full request chain, **generates fix patches**, and **re-runs tests to verify the fix** autonomously.
|
|
29
|
-
|
|
30
|
-
### Key Capabilities
|
|
31
|
-
|
|
32
|
-
| Capability | Description |
|
|
33
|
-
|---|---|
|
|
34
|
-
| **Source-Aware Test Generation** | Parses Sequelize/TypeORM models, Express/NestJS controllers, and DTO decorators via [ts-morph](https://ts-morph.com) to understand your API surface |
|
|
35
|
-
| **AI-Driven Configuration** | LLM generates request body templates, seed data, parameter mappings, validated by 3-layer verification (schema -> semantic -> dry-run) |
|
|
36
|
-
| **Intelligent Chain Planning** | Builds API dependency DAGs, performs topological sorting, and plans test chains with greedy coverage optimization |
|
|
37
|
-
| **Log-Driven Completion Detection** | Goes beyond `networkidle`; verifies request completion by matching backend execution logs (`api_exec end`) |
|
|
38
|
-
| **Failure Chain Attribution** | Traces failures through the full call chain: network errors -> slow APIs -> backend logs -> root cause |
|
|
39
|
-
| **Controlled Self-Healing** | `backup -> AI patch -> dry-run -> apply -> re-run -> verify -> rollback`, with safety gates at every step |
|
|
40
|
-
| **Impact Analysis** | BFS traversal of foreign key relations to map blast radius and auto-generate Mermaid diagrams |
|
|
41
|
-
|
|
42
|
-
## Quick Start
|
|
43
|
-
|
|
44
|
-
### Prerequisites
|
|
45
|
-
|
|
46
|
-
- Node.js >= 18
|
|
47
|
-
- A backend project with Express/NestJS + Sequelize/TypeORM
|
|
48
|
-
|
|
49
|
-
### Installation
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
npm install opencroc --save-dev
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Initialize
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
npx opencroc init
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
This will:
|
|
62
|
-
1. Scan your project structure
|
|
63
|
-
2. Detect your ORM and framework
|
|
64
|
-
3. Create `opencroc.config.ts` with sensible defaults
|
|
65
|
-
4. Generate a sample test suite
|
|
66
|
-
|
|
67
|
-
### Generate Tests
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
# Generate tests for a single module
|
|
71
|
-
npx opencroc generate --module=knowledge-base
|
|
72
|
-
|
|
73
|
-
# Generate tests for all detected modules
|
|
74
|
-
npx opencroc generate --all
|
|
75
|
-
|
|
76
|
-
# Dry-run (preview without writing files)
|
|
77
|
-
npx opencroc generate --all --dry-run
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Run Tests
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
# Run all generated tests
|
|
84
|
-
npx opencroc test
|
|
85
|
-
|
|
86
|
-
# Run specific module
|
|
87
|
-
npx opencroc test --module=knowledge-base
|
|
88
|
-
|
|
89
|
-
# Run with self-healing enabled
|
|
90
|
-
npx opencroc test --self-heal
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Validate AI Configs
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
# Validate generated configurations
|
|
97
|
-
npx opencroc validate --all
|
|
98
|
-
|
|
99
|
-
# Compare AI-generated vs baseline results
|
|
100
|
-
npx opencroc compare --baseline=report-a.json --current=report-b.json
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
- **
|
|
205
|
-
- **
|
|
206
|
-
- **
|
|
207
|
-
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/banner.png" alt="OpenCroc banner" width="820" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">OpenCroc</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>AI-native E2E testing framework that reads your source code, generates tests, and self-heals failures.</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/opencroc"><img src="https://img.shields.io/npm/v/opencroc?color=green" alt="npm version" /></a>
|
|
13
|
+
<a href="https://github.com/opencroc/opencroc/actions/workflows/ci.yml"><img src="https://github.com/opencroc/opencroc/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI" /></a>
|
|
14
|
+
<a href="https://github.com/opencroc/opencroc/blob/main/LICENSE"><img src="https://img.shields.io/github/license/opencroc/opencroc" alt="MIT License" /></a>
|
|
15
|
+
<a href="https://opencroc.com"><img src="https://img.shields.io/badge/docs-opencroc.com-blue" alt="Documentation" /></a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="README.en.md">English</a> | <a href="README.zh-CN.md">简体中文</a> | <a href="README.ja.md">日本語</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## What is OpenCroc?
|
|
25
|
+
|
|
26
|
+
OpenCroc is an **AI-native end-to-end testing framework** built on top of [Playwright](https://playwright.dev). Instead of writing test scripts by hand, OpenCroc **reads your backend source code** (models, controllers, DTOs) and automatically generates complete E2E test suites, including API chains, seed data, request bodies, and assertions.
|
|
27
|
+
|
|
28
|
+
When tests fail, OpenCroc does not just report errors. It **traces the root cause** through the full request chain, **generates fix patches**, and **re-runs tests to verify the fix** autonomously.
|
|
29
|
+
|
|
30
|
+
### Key Capabilities
|
|
31
|
+
|
|
32
|
+
| Capability | Description |
|
|
33
|
+
|---|---|
|
|
34
|
+
| **Source-Aware Test Generation** | Parses Sequelize/TypeORM models, Express/NestJS controllers, and DTO decorators via [ts-morph](https://ts-morph.com) to understand your API surface |
|
|
35
|
+
| **AI-Driven Configuration** | LLM generates request body templates, seed data, parameter mappings, validated by 3-layer verification (schema -> semantic -> dry-run) |
|
|
36
|
+
| **Intelligent Chain Planning** | Builds API dependency DAGs, performs topological sorting, and plans test chains with greedy coverage optimization |
|
|
37
|
+
| **Log-Driven Completion Detection** | Goes beyond `networkidle`; verifies request completion by matching backend execution logs (`api_exec end`) |
|
|
38
|
+
| **Failure Chain Attribution** | Traces failures through the full call chain: network errors -> slow APIs -> backend logs -> root cause |
|
|
39
|
+
| **Controlled Self-Healing** | `backup -> AI patch -> dry-run -> apply -> re-run -> verify -> rollback`, with safety gates at every step |
|
|
40
|
+
| **Impact Analysis** | BFS traversal of foreign key relations to map blast radius and auto-generate Mermaid diagrams |
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
### Prerequisites
|
|
45
|
+
|
|
46
|
+
- Node.js >= 18
|
|
47
|
+
- A backend project with Express/NestJS + Sequelize/TypeORM
|
|
48
|
+
|
|
49
|
+
### Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install opencroc --save-dev
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Initialize
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx opencroc init
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This will:
|
|
62
|
+
1. Scan your project structure
|
|
63
|
+
2. Detect your ORM and framework
|
|
64
|
+
3. Create `opencroc.config.ts` with sensible defaults
|
|
65
|
+
4. Generate a sample test suite
|
|
66
|
+
|
|
67
|
+
### Generate Tests
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Generate tests for a single module
|
|
71
|
+
npx opencroc generate --module=knowledge-base
|
|
72
|
+
|
|
73
|
+
# Generate tests for all detected modules
|
|
74
|
+
npx opencroc generate --all
|
|
75
|
+
|
|
76
|
+
# Dry-run (preview without writing files)
|
|
77
|
+
npx opencroc generate --all --dry-run
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Run Tests
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Run all generated tests
|
|
84
|
+
npx opencroc test
|
|
85
|
+
|
|
86
|
+
# Run specific module
|
|
87
|
+
npx opencroc test --module=knowledge-base
|
|
88
|
+
|
|
89
|
+
# Run with self-healing enabled
|
|
90
|
+
npx opencroc test --self-heal
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Validate AI Configs
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Validate generated configurations
|
|
97
|
+
npx opencroc validate --all
|
|
98
|
+
|
|
99
|
+
# Compare AI-generated vs baseline results
|
|
100
|
+
npx opencroc compare --baseline=report-a.json --current=report-b.json
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Launch OpenCroc Studio
|
|
104
|
+
|
|
105
|
+
OpenCroc Studio is a **pixel-art croc office** with a real-time **knowledge graph** UI. It runs as a local web server and visualizes your project structure, agent status, and test results.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Start Studio (opens browser at http://localhost:8765)
|
|
109
|
+
npx opencroc serve
|
|
110
|
+
|
|
111
|
+
# Custom port
|
|
112
|
+
npx opencroc serve --port 3000
|
|
113
|
+
|
|
114
|
+
# Don't auto-open browser
|
|
115
|
+
npx opencroc serve --no-open
|
|
116
|
+
|
|
117
|
+
# Specify host (e.g. for remote access)
|
|
118
|
+
npx opencroc serve --host 0.0.0.0 --port 8765
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Studio features:
|
|
122
|
+
- **Knowledge Graph Canvas** — interactive graph of your project's models, controllers, and API relations (drag, zoom, hover)
|
|
123
|
+
- **Pixel Croc Office** — 6 AI agents (Parser 🐊, Analyzer 🐊, Tester 🐊, Healer 🐊, Planner 🐊, Reporter 🐊) with live status animations
|
|
124
|
+
- **Real-time WebSocket** — agent status and graph changes push to the browser instantly
|
|
125
|
+
- **Module Sidebar** — browse discovered modules and agent states at a glance
|
|
126
|
+
- **REST API** — `GET /api/project` (graph data), `GET /api/agents` (agent states), `POST /api/project/refresh` (re-scan)
|
|
127
|
+
|
|
128
|
+
### Full Pipeline (One Command)
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Run everything: generate → execute → analyze → heal → report
|
|
132
|
+
npx opencroc run
|
|
133
|
+
|
|
134
|
+
# With options
|
|
135
|
+
npx opencroc run --module=users --self-heal --report html,json
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### CI/CD Integration
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Generate GitHub Actions workflow
|
|
142
|
+
npx opencroc ci --platform github
|
|
143
|
+
|
|
144
|
+
# Generate GitLab CI pipeline
|
|
145
|
+
npx opencroc ci --platform gitlab --self-heal
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Dashboard & Reports
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Generate visual dashboard
|
|
152
|
+
npx opencroc dashboard
|
|
153
|
+
|
|
154
|
+
# Generate reports in multiple formats
|
|
155
|
+
npx opencroc report --format html,json,markdown
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Architecture
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
162
|
+
│ OpenCroc Studio (localhost:8765) │
|
|
163
|
+
│ Pixel Croc Office + Knowledge Graph + WebSocket │
|
|
164
|
+
├─────────────────────────────────────────────────────────────┤
|
|
165
|
+
│ CLI / Orchestrator │
|
|
166
|
+
├──────────┬──────────┬──────────┬──────────┬─────────────────┤
|
|
167
|
+
│ Source │ Chain │ Test │ Execution│ Self-Healing │
|
|
168
|
+
│ Parser │ Planner │Generator │ Engine │ Engine │
|
|
169
|
+
│ │ │ │ │ │
|
|
170
|
+
│ ts-morph │ DAG + │ Template │Playwright│ AI Attribution │
|
|
171
|
+
│ Model │ Topo │ + AI │ + Log │ + Controlled │
|
|
172
|
+
│ Controller│ Sort + │ Config │ Driven │ Fix + Verify │
|
|
173
|
+
│ DTO │ Greedy │ Merge │ Assert │ + Rollback │
|
|
174
|
+
├──────────┴──────────┴──────────┴──────────┴─────────────────┤
|
|
175
|
+
│ Observation Bus (Network + Backend Logs) │
|
|
176
|
+
├──────────────────────────────────────────────────────────────┤
|
|
177
|
+
│ Report Engine (HTML / JSON / Markdown) │
|
|
178
|
+
└──────────────────────────────────────────────────────────────┘
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 6-Stage Pipeline
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
Source Scan -> ER Diagram -> API Analysis -> Chain Planning -> Test Generation -> Failure Analysis
|
|
185
|
+
│ │ │ │ │ │
|
|
186
|
+
ts-morph Mermaid Dependency Topological Playwright + Root Cause +
|
|
187
|
+
parsing erDiagram DAG builder + greedy AI body/seed Impact map
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## How It Works
|
|
191
|
+
|
|
192
|
+
### 1. Source Parsing
|
|
193
|
+
|
|
194
|
+
OpenCroc uses [ts-morph](https://ts-morph.com) to statically analyze your backend:
|
|
195
|
+
|
|
196
|
+
- **Models**: Extracts table names, column types, indexes, and foreign keys from Sequelize `Model.init()` / TypeORM `@Entity()`
|
|
197
|
+
- **Controllers**: Extracts routes, HTTP methods, and path parameters from Express `router.get/post/put/delete`
|
|
198
|
+
- **DTOs**: Extracts validation rules from `@IsString()`, `@IsNumber()`, `@IsOptional()` decorators
|
|
199
|
+
|
|
200
|
+
### 2. AI Configuration Generation
|
|
201
|
+
|
|
202
|
+
For each module, OpenCroc calls an LLM (OpenAI / ZhiPu / any OpenAI-compatible API) to generate:
|
|
203
|
+
|
|
204
|
+
- **Request body templates**: Field-accurate POST/PUT payloads
|
|
205
|
+
- **Seed data**: `beforeAll` setup steps with correct API sequences
|
|
206
|
+
- **Parameter mappings**: Path parameter aliases (`/:id` -> `categoryId`)
|
|
207
|
+
- **ID aliases**: Preventing ID conflicts across multi-resource chains
|
|
208
|
+
|
|
209
|
+
Each config is validated through **3 layers**:
|
|
210
|
+
1. **Schema validation**: JSON structure completeness
|
|
211
|
+
2. **Semantic validation**: Field values match source code metadata
|
|
212
|
+
3. **Dry-run validation**: TypeScript compilation check
|
|
213
|
+
|
|
214
|
+
Failed configs are automatically fixed (up to 3 rounds) before being written.
|
|
215
|
+
|
|
216
|
+
### 3. Log-Driven Completion
|
|
217
|
+
|
|
218
|
+
Instead of relying on fragile `networkidle` signals:
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
Frontend Request -> Backend api_exec start log -> Backend processing -> api_exec end log
|
|
222
|
+
↓
|
|
223
|
+
OpenCroc polls end logs to confirm completion
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
This catches cases where the frontend appears idle but the backend is still processing.
|
|
227
|
+
|
|
228
|
+
### 4. Self-Healing Loop
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
Test Failure
|
|
232
|
+
-> AI Attribution (LLM + heuristic fallback)
|
|
233
|
+
-> Generate Fix Patch
|
|
234
|
+
-> Dry-Run Validation
|
|
235
|
+
-> Apply Patch (with backup)
|
|
236
|
+
-> Re-run Failed Tests
|
|
237
|
+
-> Verify Fix
|
|
238
|
+
-> Commit or Rollback
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Real-World Validation
|
|
242
|
+
|
|
243
|
+
OpenCroc has been validated against a **production-scale RBAC system** (multi-tenant enterprise permission management) with 100+ Sequelize models, 75+ Express controllers, and embedded associations:
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
$ npx tsx examples/rbac-system/smoke-test.ts
|
|
247
|
+
|
|
248
|
+
Modules : 5 (default, aigc, data-platform, integration, workflow)
|
|
249
|
+
ER Diagrams : 5
|
|
250
|
+
[default] 102 tables, 65 relations
|
|
251
|
+
[aigc] 6 tables, 0 relations
|
|
252
|
+
[data-platform] 4 tables, 0 relations
|
|
253
|
+
[integration] 14 tables, 0 relations
|
|
254
|
+
[workflow] 2 tables, 0 relations
|
|
255
|
+
Chain Plans : 5
|
|
256
|
+
[aigc] 78 chains, 150 steps
|
|
257
|
+
Generated Files: 78
|
|
258
|
+
Duration : 1153ms
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Key findings:
|
|
262
|
+
- **102 tables** and **65 foreign key relations** correctly extracted from flat model layout
|
|
263
|
+
- **Embedded associations** (`.belongsTo()` / `.hasMany()` inside model files) detected without dedicated association files
|
|
264
|
+
- **78 test files** generated across 5 modules in just over 1 second
|
|
265
|
+
- Handles both flat (`models/*.ts`) and nested (`models/module/*.ts`) directory structures
|
|
266
|
+
|
|
267
|
+
## Configuration
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
// opencroc.config.ts
|
|
271
|
+
import { defineConfig } from 'opencroc';
|
|
272
|
+
|
|
273
|
+
export default defineConfig({
|
|
274
|
+
// Backend source paths
|
|
275
|
+
backend: {
|
|
276
|
+
modelsDir: 'src/models',
|
|
277
|
+
controllersDir: 'src/controllers',
|
|
278
|
+
servicesDir: 'src/services',
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
// Target application
|
|
282
|
+
baseUrl: 'http://localhost:3000',
|
|
283
|
+
apiBaseUrl: 'http://localhost:3000/api',
|
|
284
|
+
|
|
285
|
+
// AI configuration
|
|
286
|
+
ai: {
|
|
287
|
+
provider: 'openai', // 'openai' | 'zhipu' | 'custom'
|
|
288
|
+
apiKey: process.env.AI_API_KEY,
|
|
289
|
+
model: 'gpt-4o-mini',
|
|
290
|
+
},
|
|
291
|
+
|
|
292
|
+
// Test execution
|
|
293
|
+
execution: {
|
|
294
|
+
workers: 4,
|
|
295
|
+
timeout: 30_000,
|
|
296
|
+
retries: 1,
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
// Log-driven completion (requires backend instrumentation)
|
|
300
|
+
logCompletion: {
|
|
301
|
+
enabled: true,
|
|
302
|
+
endpoint: '/internal/test-logs',
|
|
303
|
+
pollIntervalMs: 500,
|
|
304
|
+
timeoutMs: 10_000,
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
// Self-healing
|
|
308
|
+
selfHealing: {
|
|
309
|
+
enabled: false,
|
|
310
|
+
fixScope: 'config-only', // 'config-only' | 'config-and-source'
|
|
311
|
+
maxFixRounds: 3,
|
|
312
|
+
dryRunFirst: true,
|
|
313
|
+
},
|
|
314
|
+
});
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Supported Tech Stacks
|
|
318
|
+
|
|
319
|
+
| Layer | Supported | Planned |
|
|
320
|
+
|---|---|---|
|
|
321
|
+
| **ORM** | Sequelize, TypeORM, Prisma, Drizzle | — |
|
|
322
|
+
| **Framework** | Express | NestJS, Fastify, Koa |
|
|
323
|
+
| **Test Runner** | Playwright | — |
|
|
324
|
+
| **LLM** | OpenAI, ZhiPu (GLM), Ollama (local) | Anthropic |
|
|
325
|
+
| **Database** | MySQL, PostgreSQL | SQLite, MongoDB |
|
|
326
|
+
|
|
327
|
+
## Comparison
|
|
328
|
+
|
|
329
|
+
| Feature | OpenCroc | Playwright | Metersphere | auto-playwright |
|
|
330
|
+
|---|---|---|---|---|
|
|
331
|
+
| Source-aware generation | ✅ | ❌ | ❌ | ❌ |
|
|
332
|
+
| AI config generation + validation | ✅ | ❌ | ❌ | ❌ |
|
|
333
|
+
| Log-driven completion | ✅ | ❌ | ❌ | ❌ |
|
|
334
|
+
| Failure chain attribution | ✅ | ❌ | Partial | ❌ |
|
|
335
|
+
| Self-healing with rollback | ✅ | ❌ | ❌ | ❌ |
|
|
336
|
+
| API dependency DAG | ✅ | ❌ | ❌ | ❌ |
|
|
337
|
+
| Zero-config test generation | ✅ | Codegen only | Manual | NL->action |
|
|
338
|
+
| Impact blast radius analysis | ✅ | ❌ | ❌ | ❌ |
|
|
339
|
+
|
|
340
|
+
## Roadmap
|
|
341
|
+
|
|
342
|
+
- [x] 6-stage source-to-test pipeline
|
|
343
|
+
- [x] AI configuration generation with 3-layer validation
|
|
344
|
+
- [x] Controlled self-healing loop
|
|
345
|
+
- [x] Log-driven completion detection
|
|
346
|
+
- [x] Failure chain attribution + impact analysis
|
|
347
|
+
- [x] TypeORM / Prisma adapter
|
|
348
|
+
- [x] Ollama local LLM support
|
|
349
|
+
- [x] Real-world validation (102 tables, 65 relations, 78 generated tests)
|
|
350
|
+
- [x] GitHub Actions / GitLab CI integration
|
|
351
|
+
- [x] VS Code extension scaffold
|
|
352
|
+
- [x] Plugin system
|
|
353
|
+
- [x] HTML / JSON / Markdown report generation
|
|
354
|
+
- [x] NestJS controller parser
|
|
355
|
+
- [x] Visual dashboard (opencroc.com)
|
|
356
|
+
- [x] Drizzle ORM adapter
|
|
357
|
+
- [x] AI Config Suggester + Enhanced DTO-aware Suggester
|
|
358
|
+
- [x] Auto-Fixer (4 strategies: interface-path, DTO field, seed dependency, param mapping)
|
|
359
|
+
- [x] 3-layer config validation (schema → semantic → dry-run)
|
|
360
|
+
- [x] DTO Parser (ts-morph interface + express-validator extraction)
|
|
361
|
+
- [x] Baseline Comparator (Playwright report diff + regression detection)
|
|
362
|
+
- [x] Module config preset loader
|
|
363
|
+
- [x] LLM-enhanced chain planner
|
|
364
|
+
- [x] Runtime infrastructure (Playwright config, auth setup, teardown, network monitor)
|
|
365
|
+
- [x] Full orchestration pipeline
|
|
366
|
+
- [x] Advanced reporters (checklist, workorder, token tracking)
|
|
367
|
+
- [x] OpenCroc Studio — pixel croc office + knowledge graph UI (`opencroc serve`)
|
|
368
|
+
|
|
369
|
+
## Release Snapshot
|
|
370
|
+
|
|
371
|
+
- Current stable release: `1.3.0`
|
|
372
|
+
- npm dist-tag `latest`: `1.3.0`
|
|
373
|
+
- Roadmap status: M1 Studio delivered
|
|
374
|
+
- Full-suite quality gate: 34 test files / 373 tests passing on Node.js 20.x & 22.x
|
|
375
|
+
|
|
376
|
+
### Version Rhythm
|
|
377
|
+
|
|
378
|
+
- `0.3.x`: plugin system, CI templates, reporters, VS Code scaffold, CI hardening
|
|
379
|
+
- `0.4.x`: NestJS controller parser
|
|
380
|
+
- `0.5.x`: Drizzle ORM adapter
|
|
381
|
+
- `0.6.x`: visual dashboard + Windows Vitest stability hardening
|
|
382
|
+
- `0.7.x – 0.9.x`: runtime infrastructure (Playwright generators, auth, log-driven detection, rules engine)
|
|
383
|
+
- `1.0.0`: full orchestration pipeline
|
|
384
|
+
- `1.1.0`: advanced self-healing (dialog loop, controlled fixer, auto-fix PR generation)
|
|
385
|
+
- `1.2.0`: advanced reporters (checklist, workorder, token tracking) + Sprint 0-3 migration complete
|
|
386
|
+
- `1.3.0`: OpenCroc Studio M1 — Fastify server, knowledge graph API, pixel croc office frontend
|
|
387
|
+
|
|
388
|
+
### Release Verification
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
npm run lint
|
|
392
|
+
npm run typecheck
|
|
393
|
+
npm test
|
|
394
|
+
npm view opencroc version dist-tags --json
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
## Documentation
|
|
398
|
+
|
|
399
|
+
Visit **[opencroc.com](https://opencroc.com)** for full documentation, or browse:
|
|
400
|
+
|
|
401
|
+
- [Architecture Guide](docs/architecture.md)
|
|
402
|
+
- [Configuration Reference](docs/configuration.md)
|
|
403
|
+
- [Backend Instrumentation Guide](docs/backend-instrumentation.md)
|
|
404
|
+
- [AI Provider Setup](docs/ai-providers.md)
|
|
405
|
+
- [Self-Healing Guide](docs/self-healing.md)
|
|
406
|
+
- [Troubleshooting](docs/troubleshooting.md)
|
|
407
|
+
|
|
408
|
+
## Contributing
|
|
409
|
+
|
|
410
|
+
We welcome contributions. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
411
|
+
|
|
412
|
+
## License
|
|
413
|
+
|
|
414
|
+
[MIT](LICENSE) © 2026 OpenCroc Contributors
|