Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The metamodel is the **durable spine**; generated code is **regenerated output**

The first four ship per-language today across the five ports (TS / C# / Java / Python / Kotlin), with cross-port conformance corpora verifying byte-identical behavior. The fifth ships its vocabulary, its `verify` checks and a `requirement-tests` generator in every port, and its authoring lint in TypeScript only. The sixth is content the other five compose, shipped as named opt-in artifacts:

1. **Codegen** *(reference helpers, not core — see "Core vs helpers" above; ejectable in every port)* — emit per-language code (Drizzle/Zod + Fastify for TS, EF Core + ASP.NET for C#, Spring REST + DTO + Repository for Java via `codegen-spring`, Pydantic + FastAPI for Python, KotlinPoet + Exposed + Spring for Kotlin via `codegen-kotlin`). Hand-edit-preserving regen via three-way merge (TypeScript only).
1. **Codegen** *(reference helpers, not core — see "Core vs helpers" above; ejectable in every port)* — emit per-language code (Drizzle/Zod + Fastify for TS, EF Core + ASP.NET for C#, Spring REST + DTO + Repository for Java via `codegen-spring`, Pydantic + FastAPI for Python, KotlinWriter + Exposed + Spring for Kotlin via `codegen-kotlin`). Hand-edit-preserving regen via three-way merge (TypeScript only).
2. **Runtime metadata** — load metadata at runtime, drive behavior dynamically (CRUD, validation, relationships, dynamic admin UIs, LLM tool registration). On Kysely (TS), a DB-API 2 driver via ObjectManager (Python), modernized JDBC + Spring-tx via OMDB (Java), Exposed (Kotlin). **C# runtime metadata is on the roadmap** — its EF Core output is generated code, not a metadata-driven runtime; the runtime `MetaObjects` package depends only on YamlDotNet and ships no data access.
3. **Drift detection** — `meta verify` catches divergence between code and metadata (covers entity codegen, prompt templates, output parsers, schema). Quality-of-life on top of codegen + runtime.
4. **Prompt construction** — a prompt is code, not a string scattered across services. Declare a prompt's payload as a typed projection (payload bloat becomes a diff), keep its text external and provider-resolved, and render it deterministically: snapshot-testable, cache-stable (no whitespace change silently breaking exact-prefix prompt-cache hits), and drift-checked at build time so a renamed field can't degrade a prompt. Conformance-gated, so the guarantee holds in every language port. **Render + payload-VO codegen + `verify` + parser-on-receipt for a *responding* `template.prompt` — one carrying `@responseRef` (FR-006) — + the output-format prompt fragment & tolerant `extract` parser (FR-010) ship in all five ports today** (since 0.24.0 the whole inbound tier keys off `@responseRef`; a `template.output` is outbound-only and emits no parser — ADR-0052) — the library-side building blocks of the pillar are complete. The one remaining library-side piece is MCP exposure of declared prompts/tools (see `spec/roadmap.md`); the application-level consolidation (eval harness, end-to-end declared-prompt orchestration) and consumer adoption are exercised in adopter projects, not in this library repo. Designed in `docs/superpowers/specs/2026-05-22-fr-004-cross-language-prompt-construction-design.md`.
Expand Down Expand Up @@ -71,7 +71,7 @@ PyPI has had no product change since `0.25.0` — nothing is broken.
- **C#** — `MetaObjects` (loader + canonical serializer + conformance) + `MetaObjects.Render` (Mustache + payload-VO + `verify`) + `MetaObjects.Codegen` (EF Core entities + `AppDbContext` + CRUD minimal-API routes). Schema migrations run in EF Core Migrations or the Node `meta migrate` reference helper (ADR-0015): the C# migrate engine and the `migrate`/`--from-db` CLI surface were removed; the C# CLI is codegen (`init`/`gen`/`eject`), `verify` and `fmt` only, packaged as a .NET tool invoked **`dotnet meta`** (not a bare `meta` — that name belongs to the Node schema CLI). EF Core runtime data-access stays per-port.
- **Java** — `metadata` + `omdb` + `om` + `core-spring` + `metadata-ktx` (Kotlin facade) + `codegen-spring` (Spring controllers + DTOs + repositories + filter allowlists + payload records + output parsers) + `codegen-mustache` + `codegen-plantuml` + `render` + `maven-plugin` (`metaobjects:generate`/`metaobjects:editor` + a `metaobjects:verify` **codegen-drift** goal — distinct from the removed live-DB `metaobjects:verify`; Kotlin generators run through `metaobjects:generate` via the shared SPI). FR-003 (OMDB runtime persistence + binding registry + typed jsonb + Spring-tx + source/origin metamodel) fully shipped, including Plan 4 (engine-debt remediation: atomic mapping cache, JDBC codec registry, `inTransaction` template). **Schema migrations run in the project's own tool or the reference migration helper** (`@metaobjectsdev/cli migrate`); the Java port's diff-and-converge migration engine and its `metaobjects:migrate` / live-DB-drift `metaobjects:verify` Maven goals were removed, and per ADR-0015 Decision 2 the dev/test runtime auto-create path (`MetaClassDBValidatorService` + the drivers' `createTable`/`createIndex`/`createForeignKey`/`createSequence` DDL) is **also** removed — **OMDB is pure data-access** (CRUD/query/codec/transactions only).
- **Python** — `metaobjects` (loader + canonical serializer + conformance + render + verify + codegen) + an `ObjectManager` runtime layer. The `migrate` module was removed (migrations run in the project's own tool or the Node `meta migrate` reference helper, ADR-0015); Python is pure data-access (codegen + ObjectManager runtime), with a **`metaobjects` console-script** (`gen`/`verify` codegen — no `migrate`). All five conformance corpora green.
- **Kotlin** — `codegen-kotlin` (KotlinPoet on JVM): entity + Exposed table + Spring controller + payload + relations + filter allowlist + validator + stored-proc + output-parser generators. `integration-tests-kotlin` runs the persistence-conformance corpus through Exposed against Testcontainers Postgres.
- **Kotlin** — `codegen-kotlin` (laid out by `KotlinWriter`, ADR-0063, on the JVM): entity + Exposed table + Spring controller + payload + relations + filter allowlist + validator + stored-proc + output-parser generators. `integration-tests-kotlin` runs the persistence-conformance corpus through Exposed against Testcontainers Postgres.

**Cross-port conformance corpora** (every port runs the shared corpus):
- Metamodel: `fixtures/conformance/` (584 fixtures; 48 shared corpora in total — per-corpus counts + the corpus x port matrix live in `docs/CONFORMANCE.md`). TS / C# / Java / Python all green.
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,19 @@ there is described in full here. This list is where to start.
instead of answering 400, and an omitted nullable one starts at the default instead of NULL.
Every call that passed the argument compiles and behaves as before; a call that leaves it out
now compiles and gets the default.
- **Kotlin: KotlinPoet is no longer a dependency of `codegen-kotlin`, so an owned `entity`,
`exposed-table`, `routes`, `relations`, `repository`, `spring-config` or `api-docs` generator
ejected before 1.3.0 no longer compiles.** Those seven named KotlinPoet types, directly or
through the helpers they call: `KotlinTypeMapper.kotlinTypeName`,
`payloadTypeName`, `mapValueScalarTypeName` and `enumTypeName` return
`com.metaobjects.generator.kotlin.writer.KotlinTypeName` / `KotlinClassName` where they
returned KotlinPoet's `TypeName` / `ClassName`, and `KotlinPoetFileWriter` is removed. Re-eject
the generator (`mvn metaobjects:eject`) and re-apply your changes. `KotlinClassName` keeps the
members those copies used (`packageName`, `simpleName`, `canonicalName`, `parameterizedBy`,
`copy(nullable = …)`), and `toString()` spells a type fully qualified as KotlinPoet did, so code
that reads a type as text behaves as before. A copy of any other Kotlin generator still
compiles unchanged. A build that relied on getting KotlinPoet transitively through `codegen-kotlin`
declares it itself.
- **Kotlin: a request body that cannot be read answers with an `issues` list.** The generated
`MetaDecimalWire.kt` (one per generated package) maps the failure into the
validation envelope every other 400 uses: `{"error": "validation", "issues": [{"code", "path",
Expand Down Expand Up @@ -1749,6 +1762,20 @@ four `rules.*` and `verify.lifecycle.unreachable` settings, held to `fixtures/ru
`StringBuilder`; an owned copy ejected at an earlier version carries its own and still compiles
(`EjectedAtBaseGeneratorsCompatTest`).

- **The last Kotlin generators write through `KotlinWriter`, and KotlinPoet leaves the build**
(ADR-0063): the entity generator (the data class with its Java builder and cross-field
properties, the TPH `<Sub>Validation` shape, the abstract interface shape and `MetaNetJson.kt`),
the enum emitter and the Spring config generator. `KotlinTypeMapper` answers with the writer's
own `KotlinTypeName` / `KotlinClassName` (`writer/KotlinTypeName.kt`) instead of KotlinPoet's,
`KotlinCrossFieldRules.rules` answers each rule as a Kotlin expression string, and
`KotlinPoetFileWriter` is gone: every file goes through `GeneratedFileWriter`'s marker guard, as
before. The layout ratchet's allowlist of unconverted files is empty; the ratchet still fails a
generator that types its own layout or imports KotlinPoet. **The output changes in layout
only:** no explicit `public`, no `kotlin.*` imports, a four-space indent, imports in one sorted
group, a one-line KDoc on one line, and a call or constructor that fits written on one line
(`fun build(): Author = Author(id = id, name = name)`). Regenerating shows those diffs and
nothing else; `MetaNetJson.kt` is byte-identical. See Upgrading for owned copies.

- **Python publishes a shared model (FR-023).** A `shared-model` generator, wired in
`metaobjects.config.yaml` like any other (`metaobjects gen --list` names its options), writes
`<name>.metaobjects.json` and `metaobjects.pkg.json` for a consumer's `deps sync`: `name` and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ both a one-call seam Kotlin uses idiomatically.
> `LlmTraceHelperGenerator` emits a Java `record<Entity>(...)` helper (per concrete
> entity extending `LlmCallBase` with a `@responseRef`-carrying `template.prompt`);
> Kotlin code calls it directly (same JVM, same classpath) — there is no separate
> Kotlin-native (`codegen-kotlin`/KotlinPoet) trace-helper emitter yet. What's TS-only
> Kotlin-native (`codegen-kotlin`) trace-helper emitter yet. What's TS-only
> is the **`call<Entity>` render→call→record convenience loop** — neither JVM
> generator emits it, because the `LlmClient` seam it wraps is BYO / vendor-neutral on
> the JVM (ADR-0024). So you compose render → your LLM call → the generated Java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The Kotlin port is a **codegen tier built on top of the Java port**. The loader,
render engine, and Maven plugin are all Java; `codegen-kotlin` emits idiomatic
Kotlin (`data class` (no `@Serializable` — entities are Jackson-compatible, not
kotlinx-serialized), Exposed `Table` objects, Spring
`@RestController`/`@Configuration`) via KotlinPoet. Codegen runs as the same
`@RestController`/`@Configuration`), laid out by `KotlinWriter`. Codegen runs as the same
build-time Maven plugin goal the Java port uses — there is no standalone `meta`
binary on the JVM side (the Node `meta` is for schema migrations only; see the
migration reference).
Expand All @@ -27,7 +27,7 @@ All artifacts share `groupId` `com.metaobjects` and one version property:
| `metaobjects-metadata` | metamodel + loader |
| `metaobjects-metadata-ktx` | thin Kotlin facade over the Java loader + render engine |
| `metaobjects-render` | render + `Verify` + tolerant `extract` (prompt/template) |
| `metaobjects-codegen-kotlin` | the Kotlin (KotlinPoet) generators |
| `metaobjects-codegen-kotlin` | the Kotlin generators (laid out by `KotlinWriter`) |
| `metaobjects-maven-plugin` | the build-time codegen plugin |

The generated code compiles against the consumer's own runtime dependencies, which the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ are good at different things.

| | Programmatic | Declarative template |
|---|---|---|
| What you write | a `Generator` in the port's language, using its AST builder (ts-poet, KotlinPoet, …) | a `.mustache` file + `{ template, scope, outputPattern, format? }` |
| What you write | a `Generator` in the port's language, using its code writer (`JavaWriter`, `KotlinWriter`, …) | a `.mustache` file + `{ template, scope, outputPattern, format? }` |
| Output shape | expressed in code | **is the file you are editing** |
| Cross-language | per-port by construction | one template emits for any language — it renders against the neutral, byte-gated data dict |
| Logic | any | what a template can express: sections, iteration, presence flags |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The Kotlin port is a **codegen tier built on top of the Java port** — the loader,
render engine, and Maven plugin are all Java; `metaobjects-codegen-kotlin` emits
idiomatic Kotlin (KotlinPoet: `data class` (no `@Serializable` — entities are
idiomatic Kotlin (laid out by `KotlinWriter`: `data class` (no `@Serializable` — entities are
Jackson-compatible, not kotlinx-serialized), Exposed `Table` objects,
Spring `@RestController`). Codegen runs as the same Maven plugin goal the Java port
uses (`mvn metaobjects:generate`). Schema migration is the project's own tool or the
Expand Down Expand Up @@ -119,7 +119,7 @@ project needing a shape the built-ins do not emit has two legitimate answers and
is a finding on its own: a **programmatic** generator (implement
`com.metaobjects.generator.Generator`, name the class in a `<generator>` element), or a
**declarative template** (`TemplateScopeGenerator`, wired with `<template>` / `<scope>` /
`<outputPattern>` / `<format>` / `<templatesDir>` — no KotlinPoet involved). Prefer the
`<outputPattern>` / `<format>` / `<templatesDir>` — no `KotlinWriter` involved). Prefer the
template when the output SHAPE is the thing being iterated on or the same output is
wanted in another language; prefer code when the logic is gnarly. See
`docs/features/codegen-concepts.md` §3.
Expand Down
Loading
Loading