Skip to content

Commit bb437ec

Browse files
oyvindbergclaude
andcommitted
Add TUI, Bridge Types, matchers, and Avro/gRPC integration
Interactive TUI (draft): - tui-react: React-like abstraction with EventRegistry, StateStore, RenderContext - Screens: Splash, MainMenu, SchemaBrowser, SpecBrowser, Source/Output/Type editors - Domain Type Builder: 6-step wizard for cross-database composite types - Form components with mouse support, hover states, click handlers - Sliding navigation with animations Bridge Types: - Domain types unifying data models across multiple database sources - Primary source with aligned sources for cross-database compatibility - Code generation for Scala, Java, and Kotlin - CLI `typr check` command for validation Matchers (renamed from selectors): - Negation support with exclude patterns - Split model (schema properties) vs api (parameters) matchers - JSON Schema for typr.yaml with IDE validation Avro/gRPC Integration: - Wire codegen into `typr generate` command - Boundaries system (renamed from sources) - Cats/fs2-kafka framework with IO-based publishers/listeners - Effect types at output level with computed types Other: - Bump tui-scala to 0.0.8 - Regenerate all testers Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7ba83f3 commit bb437ec

844 files changed

Lines changed: 48380 additions & 5416 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ __pycache__/
2424
db/duckdb/test.db
2525
db/duckdb/test.db.wal
2626
duckdb-test/
27-
.snapshot-test.lock
27+
.snapshot-test.lock
28+
typr.sh

CLAUDE.md

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,26 @@ bleep fmt
3838
# Regenerate tuples, rowparsers and so on. runs bleep sourcegen scripts
3939
bleep sourcegen
4040

41-
# Code generation scripts
42-
bleep generate-postgres # PostgreSQL AdventureWorks + Showcase schemas
43-
bleep generate-mariadb # MariaDB test + Showcase schemas
44-
bleep generate-duckdb # DuckDB test + Showcase schemas
45-
bleep generate-oracle # Oracle test + Showcase schemas
46-
bleep generate-sqlserver # SQL Server test + Showcase schemas
47-
bleep generate-openapi-test # OpenAPI code generation
48-
bleep generate-sources # Typr's internal generated code
49-
50-
# Run all generators in parallel. much faster
51-
bleep generate-all
41+
# Typr's internal generated code
42+
bleep generate-sources
5243

5344
# Documentation
5445
bleep generate-docs # Generate documentation with mdoc
5546
```
5647

48+
### Typr CLI for Code Generation
49+
Database code generation is done via the **typr CLI** instead of bleep scripts:
50+
51+
```bash
52+
# Generate code (reads typr.yaml config)
53+
bleep run typr generate <outputs>
54+
```
55+
56+
The CLI reads configuration from `typr.yaml` and generates type-safe code for:
57+
- Tables, views, and custom SQL queries
58+
- Type overrides (scalar types, composite types)
59+
- Selected schemas and tables
60+
5761
### Gradle for Kotlin
5862
Kotlin modules have Gradle build files for IDE support and alternative building:
5963
```bash
@@ -115,16 +119,16 @@ testers/pg/scala/anorm/
115119

116120
### Generation Variants
117121

118-
The `GeneratedPostgres.scala` script generates multiple variants:
119-
- Scala 2.13 + Anorm + PlayJson
120-
- Scala 3 + Anorm + PlayJson
121-
- Scala 2.13 + Doobie + Circe
122-
- Scala 3 + Doobie + Circe
123-
- Scala 2.13 + ZIO-JDBC + ZioJson
124-
- Scala 3 + ZIO-JDBC + ZioJson
125-
- Java + Typo DSL + Jackson
126-
- Scala 3 with Java types + Typo DSL + Jackson
127-
- Scala 3 with Scala types + Typo DSL + Jackson
122+
The typr CLI supports generating code for multiple combinations:
123+
- Scala 2.13 + Anorm + PlayJson (PostgreSQL only)
124+
- Scala 3 + Anorm + PlayJson (PostgreSQL only)
125+
- Scala 2.13 + Doobie + Circe (PostgreSQL only)
126+
- Scala 3 + Doobie + Circe (PostgreSQL only)
127+
- Scala 2.13 + ZIO-JDBC + ZioJson (PostgreSQL only)
128+
- Scala 3 + ZIO-JDBC + ZioJson (PostgreSQL only)
129+
- Java + Typo DSL + Jackson (all databases)
130+
- Kotlin + Typo DSL + Jackson (all databases)
131+
- Scala 3 + Typo DSL + Jackson (all databases)
128132

129133
## Docker-Compose Database Setup
130134

@@ -167,7 +171,7 @@ docker-compose down
167171
docker-compose up -d
168172

169173
# 4. Regenerate code
170-
bleep generate-postgres
174+
bleep run typr generate <outputs>
171175
```
172176

173177
**MariaDB schema changes:**
@@ -178,7 +182,7 @@ docker-compose down
178182
docker-compose up -d
179183

180184
# 3. Regenerate code
181-
bleep generate-mariadb
185+
bleep run typr generate <outputs>
182186
```
183187

184188
**Oracle schema changes:**
@@ -193,15 +197,15 @@ docker-compose up -d
193197
docker-compose logs -f oracle
194198

195199
# 4. Regenerate code
196-
bleep generate-oracle
200+
bleep run typr generate <outputs>
197201
```
198202

199203
**Complete reset (all databases):**
200204
```bash
201205
docker-compose down -v # -v removes volumes
202206
docker-compose up -d
203-
# Wait for all databases to initialize
204-
bleep generate-all
207+
# Wait for all databases to initialize, then regenerate
208+
bleep run typr generate <outputs>
205209
```
206210

207211
### Persistent Volumes
@@ -333,14 +337,10 @@ typr-dsl-anorm/ # [LEGACY] Anorm-specific DSL (Scala, Postgre
333337
typr-dsl-doobie/ # [LEGACY] Doobie-specific DSL (Scala, PostgreSQL only)
334338
typr-dsl-zio-jdbc/ # [LEGACY] ZIO-JDBC-specific DSL (Scala, PostgreSQL only)
335339
336-
typr-scripts/ # Generation scripts
337-
├── GeneratedPostgres.scala # PostgreSQL generation
338-
├── GeneratedMariaDb.scala # MariaDB generation
339-
├── GeneratedDuckDb.scala # DuckDB generation
340-
├── GeneratedOracle.scala # Oracle generation
341-
├── GeneratedSqlServer.scala # SQL Server generation
342-
├── GenerateOpenApiTest.scala # OpenAPI generation
343-
├── GenerateAll.scala # Run all generators
340+
typr-scripts/ # Build and publishing scripts
341+
├── GeneratedSources.scala # Typr's internal generated code
342+
├── PublishLocal.scala # Local publishing
343+
├── Publish.scala # Release publishing
344344
└── ...
345345
346346
sql-init/ # Schema files (mounted to Docker)
@@ -442,7 +442,7 @@ WHERE p.productcategory = :category_id:myapp.production.productcategory.Productc
442442
1. **Create Test Case**: Add SQL file in `sql-init/postgres/issueNNN.sql` (or appropriate database folder)
443443
2. **Update Install Script**: Add to `sql-init/postgres/00-install.sh` for PostgreSQL
444444
3. **Restart Database**: `docker-compose down && docker-compose up -d`
445-
4. **Generate Code**: Run appropriate generator (e.g., `bleep generate-postgres`)
445+
4. **Generate Code**: Run `bleep run typr generate <outputs>`
446446
5. **Trace Issue**: Examine generated code
447447
6. **Commit Test Setup**: Commit before making changes
448448
7. **Implement Fix**: Make code changes
@@ -517,7 +517,7 @@ docker-compose logs -f oracle
517517

518518
### Code Generation Philosophy
519519
- Never generate code that relies on derivation - we are the deriver
520-
- Run appropriate generator (e.g., `bleep generate-postgres`) before testing to see codegen effects
520+
- Run `bleep run typr generate <outputs>` before testing to see codegen effects
521521

522522
### Development Rules
523523
- Always run `bleep fmt` and `bleep test` before commiting
@@ -533,4 +533,5 @@ docker-compose logs -f oracle
533533
- WHEN YOU CHANGE CODE, NEVER LEAVE DANGLING COMMENTS DESCRIBING HOW IT WAS BEFORE OR WHY YOU MADE A CHANGE. WE HAVE GIT FOR THAT
534534
- when restarting a database container always restart only the one you want to restart. it takes ages to start all
535535
- UNDER NO CIRCUMSTANCE, EVER. FUCKING EVER. WILL CLAUDE GIVE UP AND REVERT ALL THE FILES
536-
- NEVER HIDE PROBLEMS BY WORKING AROUND THEM. When you discover an issue (e.g., serialization doesn't work, types don't match, framework integration fails), IMMEDIATELY TELL THE USER. Do not quietly work around it with simpler/different code and pretend everything is fine. Tests exist to find these problems - report them, don't hide them.
536+
- NEVER HIDE PROBLEMS BY WORKING AROUND THEM. When you discover an issue (e.g., serialization doesn't work, types don't match, framework integration fails), IMMEDIATELY TELL THE USER. Do not quietly work around it with simpler/different code and pretend everything is fine. Tests exist to find these problems - report them, don't hide them.
537+
- **DO NOT COMPARE WITH "PRE-EXISTING" STATE.** When there are compilation errors or test failures, FIX THEM. Do not check if they existed before your changes, do not stash and compare with HEAD, do not say "these are pre-existing errors". The branch has many commits and may have just been rebased - "pre-existing" is meaningless. If it doesn't compile, fix it.

0 commit comments

Comments
 (0)