Commit c038688
refactor(gql): migrate to IR-based code generation architecture (#73)
## Summary
- Replace 4 individual language generator scripts with unified IR-based
plugin system
- Single GraphQL schema parsing instead of 5 separate parsers
- Generated output is 100% identical to previous scripts
## Architecture
```
GraphQL Schema (src/*.graphql)
↓
[1] Parser (codegen/core/parser.ts)
↓
[2] Transformer → IR (codegen/core/transformer.ts)
↓
[3] Language Plugins (codegen/plugins/*.ts)
↓
Generated Files (src/generated/*)
```
## Changes
### New Plugin System (`codegen/plugins/`)
| Plugin | Features |
|--------|----------|
| **swift.ts** | Codable protocol, ErrorCode custom init, platform
defaults |
| **kotlin.ts** | Sealed interface, fromJson/toJson, nullable patterns |
| **dart.ts** | Sealed class, factory constructors, extends/implements |
| **gdscript.ts** | _init() pattern, from_json/to_json, Variant type |
### Deleted Scripts (3,687 lines removed)
- `generate-swift-types.mjs` (831 lines)
- `generate-kotlin-types.mjs` (939 lines)
- `generate-dart-types.mjs` (1,105 lines)
- `generate-gdscript-types.mjs` (812 lines)
### Documentation Updates
- `CONTRIBUTING.md` - Added IR architecture documentation
- `CLAUDE.md` - Added code generation system section
- `packages/gql/CONVENTION.md` - Added code generation architecture
section
- `knowledge/internal/04-platform-packages.md` - Comprehensive GQL
section
## Test plan
- [x] `bun run generate` completes successfully
- [x] Generated Swift types match previous output (byte-identical)
- [x] Generated Kotlin types match previous output (byte-identical)
- [x] Generated Dart types match previous output (byte-identical)
- [x] Generated GDScript types match previous output (byte-identical)
- [x] Types synced to `packages/apple` and `packages/google`
🤖 Generated with [Claude Code](https://claude.ai/code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Centralized IR-based GraphQL code generation with language plugins
producing Swift, Kotlin, Dart, and GDScript outputs and a CLI to
generate per-language artifacts.
* **Documentation**
* Extensive guides added: codegen architecture, IR types, plugin model,
templates, and updated regeneration instructions.
* **Chores**
* Replaced legacy per-language generator scripts with the new
centralized generator; added template tooling dependency and updated
generate scripts.
<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent a3932a4 commit c038688
66 files changed
Lines changed: 6896 additions & 3734 deletions
File tree
- .claude/commands
- knowledge/internal
- packages
- apple/Sources/Models
- google/openiap/src/main/java/dev/hyo/openiap
- gql
- codegen
- core
- plugins
- templates
- dart
- gdscript
- kotlin
- swift
- scripts
- src/generated
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
713 | 714 | | |
714 | 715 | | |
715 | 716 | | |
716 | | - | |
| 717 | + | |
| 718 | + | |
717 | 719 | | |
718 | 720 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
60 | 81 | | |
61 | 82 | | |
62 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
| |||
275 | 283 | | |
276 | 284 | | |
277 | 285 | | |
278 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
279 | 299 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | 300 | | |
290 | | - | |
| 301 | + | |
291 | 302 | | |
292 | 303 | | |
293 | 304 | | |
294 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
295 | 363 | | |
296 | 364 | | |
297 | 365 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments