opencroc 1.8.3 → 1.8.4

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