Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

refactor(framework): extract emission SPI, add foundation layer - #292

Merged
wmadden merged 19 commits into
mainfrom
tml-2193-complete-prisma-nextframework-components-extraction-and
Apr 4, 2026
Merged

wmadden merged 19 commits into
mainfrom
tml-2193-complete-prisma-nextframework-components-extraction-and

Conversation

@wmadden

@wmadden wmadden commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor

closes TML-2193

Intent

Make @prisma-next/contract a true leaf package with zero framework-domain dependencies by extracting emission SPI types to @prisma-next/framework-components/emission, and express the real layering hierarchy between leaf packages (utils, plan, contract) and framework-core packages (operations, framework-components, config) via a new foundation layer.

Change map

The story

  1. Add emission SPI types to framework-components. Create emission-types.ts with the emission SPI interfaces (TargetFamilyHook, ValidationContext, GenerateContractTypesOptions, TypeRenderEntry, TypeRenderer, ParameterizedCodecDescriptor). Wire the ./emission subpath. Consolidate TypesImportSpec and RenderTypeContext by importing from their existing canonical locations rather than duplicating.

  2. Migrate consumers domain-by-domain. Three passes — framework domain (control-plane, emitter), SQL domain (SQL emitter, family), Mongo domain (Mongo emitter). Each pass splits the old import { Contract, TargetFamilyHook, ... } from '@prisma-next/contract/types' into separate imports: contract data types stay, emission SPI types move to @prisma-next/framework-components/emission.

  3. Remove emission SPI types from contract. Delete ~200 lines of type definitions from contract/src/types.ts, remove re-exports from the ./types barrel, drop @prisma-next/operations dependency. Contract is now a true leaf.

  4. Clean up naming debt. Remove the pointless TypeRenderContext = RenderTypeContext alias (consumers now use RenderTypeContext directly). Unify the two different TypeRenderer types — the emission module now uses the canonical 4-variant union from type-renderers.ts. Rename types.ts → types-import-spec.ts. Delete dead emitter/target-family.ts re-export module (zero consumers).

  5. Introduce the foundation layer. Move utils, plan, contract from 1-core/shared/ to 0-foundation/shared/. Add foundation to architecture.config.json layer ordering. Update repository.directory in each moved package.

  6. Document the dependency inversion pattern. Add ADR 183 explaining why SPI types live at the lowest consuming layer (framework-components) rather than alongside their implementations (emitters). Update the framework-components README to describe the ./emission subpath and its DI rationale.

  7. Rewrite the contract README. Remove stale references to emission SPI types, @prisma-next/operations dependency, and deleted subpath exports. Fix relative links broken by the directory move.

Behavior changes & evidence

  • Contract package is now a leaf with zero framework-domain dependencies: Before, @prisma-next/contract depended on @prisma-next/operations (via ValidationContext's reference to OperationRegistry). After, the contract package depends only on @prisma-next/utils and arktype.

  • Emission SPI types importable from @prisma-next/framework-components/emission: New subpath providing the canonical import location for all emission pipeline types.

  • Foundation layer enforced in architecture config: utils, plan, contract at layer: foundation (below core).

    • Why: These packages are true leaves with no framework-domain dependencies.
    • Implementation: architecture.config.json — lines 3–8 (new glob), line 347 (layerOrder)
  • No behavioral changes to runtime, emitter, or validation logic: Pure code-move. All consumer code changes are import path updates only.

Compatibility / migration / risk

  • No breaking changes. Package names (@prisma-next/contract, @prisma-next/utils, @prisma-next/plan) are unchanged. Only directory locations moved.
  • Must merge after Phase A. This branch is based on tml-2190-m5-phase-a-update-emission-to-use-new-contract-type since Phase A modifies TargetFamilyHook and touches many of the same consumer files.
  • Consumers importing emission SPI from @prisma-next/contract/types will get TypeScript errors. All known in-repo consumers are updated.

Follow-ups / open questions

  • Shim removal (core-execution-plane, core-control-plane deprecated re-exports): Will be handled incidentally during M5 Phase A/B when those consumer files are already being modified for the Contract type migration.

Non-goals / intentionally out of scope

  • Narrowing the TargetFamilyHook interface — deferred to M6.
  • Shim package removal — deferred to Phase A/B (natural merge point).
  • Removing GenerateContractTypesOptions — deferred to M6 (hook interface narrowing).

Summary by CodeRabbit

  • Chores

    • Introduced a new foundational layer and moved foundational packages to it to simplify dependency structure.
    • Exposed emission SPI types from the framework-components package and updated import surfaces across tooling and families.
    • Adjusted package metadata and internal package mappings to reflect the new layout.
  • Documentation

    • Added an ADR explaining SPI placement and rationale.
    • Added/updated package READMEs to document the new structure and public exports.

@coderabbitai

coderabbitai Bot commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 0b536ae8-6797-4dd2-81df-ce529c64c5be

📥 Commits

Reviewing files that changed from the base of the PR and between e6f92bc and fd68178.

📒 Files selected for processing (1)
  • packages/1-framework/0-foundation/shared/contract/README.md
✅ Files skipped from review due to trivial changes (1)
  • packages/1-framework/0-foundation/shared/contract/README.md

📝 Walkthrough

Walkthrough

Moved emission SPI types out of the contract package into @prisma-next/framework-components/emission, relocated several shared packages to the foundation layer, introduced a typed executionHash and made ExecutionSection include an executionHash, and updated imports and package metadata across framework and tooling packages.

Changes

Cohort / File(s) Summary
Architecture / Layering
architecture.config.json
Added foundation layer for framework and updated layerOrder.framework.
Foundation: contract, plan, utils
packages/1-framework/0-foundation/shared/contract/*, packages/1-framework/0-foundation/shared/plan/package.json, packages/1-framework/0-foundation/shared/utils/package.json
Moved packages to foundation layer; added contract README; updated package repository.directory fields.
Contract types & runtime
packages/1-framework/0-foundation/shared/contract/src/types.ts, .../src/exports/types.ts, .../src/testing-factories.ts
Removed emitter SPI/type exports from contract; added executionHash helper; made ExecutionSection generic and include executionHash; adjusted testing overrides.
Framework-components: emission SPI
packages/1-framework/1-core/shared/framework-components/src/emission-types.ts, .../src/exports/emission.ts, .../package.json, .../tsdown.config.ts, .../README.md
Added new emission SPI type definitions and public ./emission export; updated package exports, build entries, README, and runtime dependency.
Internal imports updated
packages/1-framework/1-core/shared/framework-components/src/*
Refactored internal imports to consume new emission export (TypesImportSpec, TargetFamilyHook, etc.).
Core control-plane emission
packages/1-framework/1-core/migration/control-plane/src/emission/*
Switched type imports to @prisma-next/framework-components/emission.
Emitter tooling (core, mongo, sql)
packages/1-framework/3-tooling/emitter/*, packages/2-mongo-family/3-tooling/emitter/*, packages/2-sql/3-tooling/emitter/*
Added dependency on framework-components where needed; updated many type-only imports to @prisma-next/framework-components/emission; removed re-exports from contract.
Emitter tests & fixtures
packages/1-framework/3-tooling/emitter/test/*, packages/2-mongo-family/1-core/test/fixtures/*, packages/2-mongo-family/3-tooling/emitter/test/*, packages/2-sql/**/test/*
Updated tests and fixtures to use new types/imports; added ORM fixture generator script; made fixture models include explicit empty relations.
SQL runtime & authoring adjustments
packages/2-sql/2-authoring/contract-ts/src/build-contract.ts, packages/2-sql/5-runtime/test/*
Consolidated import forms; replaced coreHash usage with executionHash in tests.
Documentation / ADR
docs/architecture, docs/adrs/ADR 183 - SPI types live at the lowest consuming layer.md, packages/1-framework/1-core/shared/framework-components/README.md
Added ADR documenting SPI placement; updated framework-components README with emission SPI guidance; removed old core contract README.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • jkomyno
  • aqrln
  • jacek-prisma

Poem

🐰
Hopping through types with a twirl and a twitch,
I moved the SPIs to their rightful niche,
Execution hashes snug in a brand-typed coat,
Packages shifted — I handled the tote,
Cheers — the codebase sings, one tidy stitch.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor(framework): extract emission SPI, add foundation layer' clearly and concisely describes the main changes: extracting emission SPI types and adding a foundation layer to the framework architecture.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2193-complete-prisma-nextframework-components-extraction-and

Comment @coderabbitai help to get the list of available commands and usage tips.

@wmadden
wmadden force-pushed the tml-2190-m5-phase-a-update-emission-to-use-new-contract-type branch from 9f5b649 to 3ff5055 Compare April 4, 2026 07:28
@wmadden
wmadden force-pushed the tml-2193-complete-prisma-nextframework-components-extraction-and branch from 34a38b3 to f025a31 Compare April 4, 2026 07:28
@wmadden
wmadden force-pushed the tml-2190-m5-phase-a-update-emission-to-use-new-contract-type branch from 17dbaca to 6338a45 Compare April 4, 2026 11:29
@wmadden
wmadden force-pushed the tml-2193-complete-prisma-nextframework-components-extraction-and branch 2 times, most recently from a731a7c to a609b7d Compare April 4, 2026 16:51
@pkg-pr-new

pkg-pr-new Bot commented Apr 4, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/runtime-executor

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/runtime-executor@292

@prisma-next/mongo-core

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-core@292

@prisma-next/mongo-orm

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-orm@292

@prisma-next/mongo-runtime

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-runtime@292

@prisma-next/family-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/family-mongo@292

@prisma-next/sql-runtime

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-runtime@292

@prisma-next/extension-paradedb

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-paradedb@292

@prisma-next/extension-pgvector

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-pgvector@292

@prisma-next/postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/postgres@292

@prisma-next/sql-orm-client

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-orm-client@292

@prisma-next/target-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-mongo@292

@prisma-next/adapter-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-mongo@292

@prisma-next/driver-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-mongo@292

@prisma-next/contract-authoring

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract-authoring@292

@prisma-next/contract-ts

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract-ts@292

@prisma-next/ids

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/ids@292

@prisma-next/psl-parser

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/psl-parser@292

@prisma-next/psl-printer

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/psl-printer@292

@prisma-next/cli

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/cli@292

@prisma-next/emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/emitter@292

@prisma-next/migration-tools

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/migration-tools@292

@prisma-next/vite-plugin-contract-emit

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/vite-plugin-contract-emit@292

@prisma-next/mongo-contract-psl

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-contract-psl@292

@prisma-next/mongo-query-ast

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-query-ast@292

@prisma-next/mongo-emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-emitter@292

@prisma-next/sql-contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract@292

@prisma-next/sql-errors

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-errors@292

@prisma-next/sql-operations

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-operations@292

@prisma-next/sql-schema-ir

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-schema-ir@292

@prisma-next/sql-contract-psl

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-psl@292

@prisma-next/sql-contract-ts

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-ts@292

@prisma-next/sql-contract-emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-emitter@292

@prisma-next/family-sql

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/family-sql@292

@prisma-next/sql-lane-query-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-lane-query-builder@292

@prisma-next/sql-relational-core

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-relational-core@292

@prisma-next/sql-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-builder@292

@prisma-next/target-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-postgres@292

@prisma-next/adapter-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-postgres@292

@prisma-next/driver-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-postgres@292

@prisma-next/contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract@292

@prisma-next/plan

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/plan@292

@prisma-next/utils

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/utils@292

@prisma-next/core-control-plane

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/core-control-plane@292

@prisma-next/core-execution-plane

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/core-execution-plane@292

@prisma-next/config

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/config@292

@prisma-next/framework-components

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/framework-components@292

@prisma-next/operations

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/operations@292

commit: fd68178

Base automatically changed from tml-2190-m5-phase-a-update-emission-to-use-new-contract-type to main April 4, 2026 17:13
wmadden added 18 commits April 4, 2026 19:14
…ionHash from ContractBase

executionHash belongs inside the execution section, not as a top-level
contract field. This removes the TExecutionHash type parameter from
ContractBase, DocumentContract, and SqlContract.
…endency

Rewrote the detailed plan to reflect what tasks 3.10, 3.12, and 3.13
already completed. Key decisions:

- Emission SPI types move to a new ./emission subpath (not lumped into
  ./control) for thematic coherence alongside ./authoring, ./components
- Duplicate TypesImportSpec/RenderTypeContext consolidated to one home
  in framework-components
- Shim removal (core-execution-plane, core-control-plane deprecated
  re-exports) deferred to follow-up task 5.11.1 to limit diff size
- Must sequence after Phase A (5.A1-A6) due to overlapping consumer
  files in contract/types.ts and ~30 downstream import sites
- Foundation layer (0-foundation/) done last as purely organizational
- No overlap/conflict with M6 (which narrows TargetFamilyHook after)
Create ./emission subpath with TargetFamilyHook, ValidationContext,
GenerateContractTypesOptions, TypeRenderContext, TypeRenderEntry,
TypeRenderer, and ParameterizedCodecDescriptor. Consolidate duplicate
TypesImportSpec and RenderTypeContext by re-exporting from their
existing canonical locations in the package.

Add @prisma-next/operations dependency for ValidationContext's
OperationRegistry reference. Update control-descriptors.ts to import
TargetFamilyHook from the local module instead of @prisma-next/contract.
…ts/emission

Split imports in control-plane emission, framework emitter src and
tests to import emission SPI types (TargetFamilyHook, ValidationContext,
TypesImportSpec, etc.) from framework-components/emission instead of
contract/types. Contract data types (Contract, ContractMarkerRecord)
remain imported from contract/types.

Add @prisma-next/framework-components dependency to @prisma-next/emitter.
…ssion

Split imports in SQL emitter hook, family assembly, and control instance
to import emission SPI types from framework-components/emission instead
of contract/types.
…mission

Split imports in Mongo emitter hook and tests. Add
@prisma-next/framework-components dependency to @prisma-next/mongo-emitter.
Delete TargetFamilyHook, ValidationContext, GenerateContractTypesOptions,
TypeRenderContext, TypeRenderEntry, TypeRenderer, ParameterizedCodecDescriptor,
TypesImportSpec, and RenderTypeContext from contract/types.ts and its
export barrel. These types now live in @prisma-next/framework-components/emission.

Drop @prisma-next/operations dependency from contract — contract is now
a true leaf package with no framework-domain dependencies.
Move utils, plan, and contract from 1-core/shared/ to 0-foundation/shared/.
This makes contract a true leaf package in the architecture, sitting below
the core layer where framework-components, operations, and config live.

Add foundation layer to architecture.config.json with layerOrder
preceding core, so lint:deps enforces that foundation packages cannot
import from core or above.
Drop the pointless TypeRenderContext = RenderTypeContext alias from
emission-types.ts. Consumers now import RenderTypeContext directly.

Remove the simplified TypeRenderer union from emission-types.ts — the
canonical 4-variant TypeRenderer from type-renderers.ts is now the
single definition. The emission barrel re-exports it from type-renderers
so consumers of ./emission still resolve it. This eliminates the name
collision between ./emission and ./components subpaths.
The file contains only TypesImportSpec — give it a meaningful name
instead of the generic grab-bag types.ts.
Delete target-family.ts (pure re-export shim with zero consumers) and
remove the duplicate TargetFamilyHook/TypesImportSpec/ValidationContext
re-exports from exports/index.ts. Consumers import these directly from
@prisma-next/framework-components/emission.
Add a section to framework-components README explaining why emission SPI
types live in the core layer rather than alongside their implementations.

Record ADR 183 — SPI types live at the lowest consuming layer — as a
cross-cutting architectural decision.
Remove all references to emission SPI types (TargetFamilyHook,
ValidationContext, TypesImportSpec) which now live in
@prisma-next/framework-components/emission. Remove stale dependency on
@prisma-next/operations. Remove deleted subpath exports (./framework-
components, ./ir). Fix relative links broken by the directory move from
1-core/shared/contract to 0-foundation/shared/contract. Add link to
ADR 183.
Add executionHash() branded factory and export it alongside coreHash()
and profileHash(). Fix test factories and test files that used unbranded
strings or wrong hash constructors for executionHash fields. Fix
createContract factory to accept execution input without executionHash
(computed internally). Remove unused Contract imports from emitter tests.
Replace hand-written orm-contract.d.ts fixtures with emitter-generated
versions that align with the current Contract and MongoContract types.
Add relations:{} to orm-contract.json models that lacked it. Add
generate-orm-fixture.ts script for reproducible regeneration. Fix
integration test to use bracket notation for index-signature properties.
TargetFamilyHook was imported but unused after base branch removed the
satisfies clause. Lockfile updated for moved contract package symlinks.
@wmadden
wmadden force-pushed the tml-2193-complete-prisma-nextframework-components-extraction-and branch from adc4eb5 to e6f92bc Compare April 4, 2026 17:14

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/2-mongo-family/3-tooling/emitter/test/generate-orm-fixture.ts (1)

15-26: Consider using a factory function to avoid the type assertion.

The as Contract cast is necessary here because spreading JSON loses literal type information. While acceptable in test tooling, a factory function like createContract() could provide type safety and reduce the need for assertions.

However, since this is a test fixture generator and not production code, the current approach is pragmatic.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/2-mongo-family/3-tooling/emitter/test/generate-orm-fixture.ts`
around lines 15 - 26, The test fixture uses a typed variable "contract:
Contract" and then forces a type with "as Contract" after spreading
ormContractJson; remove this assertion by adding a small factory function (e.g.,
createContract) that accepts a Partial<Contract> or the raw ormContractJson plus
overrides (target, profileHash, storage, capabilities, extensionPacks, meta) and
returns a properly typed Contract; update the usage to call
createContract({...}) instead of spreading and asserting so the return value is
correctly typed without "as Contract" while preserving the same fields and
values (reference the existing variable name "contract" and the Contract type).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/1-framework/0-foundation/shared/contract/README.md`:
- Line 48: The README currently points to the wrong SQL schema package path;
update the string "@prisma-next/sql-query/schemas/data-contract-sql-v1.json" to
the correct package name
"@prisma-next/sql-contract-ts/schemas/data-contract-sql-v1.json" in the README
so the SQL contracts reference the actual schema file (look for the sentence
containing For SQL contracts, use ... and replace the package path).

---

Nitpick comments:
In `@packages/2-mongo-family/3-tooling/emitter/test/generate-orm-fixture.ts`:
- Around line 15-26: The test fixture uses a typed variable "contract: Contract"
and then forces a type with "as Contract" after spreading ormContractJson;
remove this assertion by adding a small factory function (e.g., createContract)
that accepts a Partial<Contract> or the raw ormContractJson plus overrides
(target, profileHash, storage, capabilities, extensionPacks, meta) and returns a
properly typed Contract; update the usage to call createContract({...}) instead
of spreading and asserting so the return value is correctly typed without "as
Contract" while preserving the same fields and values (reference the existing
variable name "contract" and the Contract type).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 1133e5f3-13b5-4fa1-afa5-520c16d81b35

📥 Commits

Reviewing files that changed from the base of the PR and between 9a7d670 and e6f92bc.

⛔ Files ignored due to path filters (3)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • projects/contract-domain-extraction/plan.md is excluded by !projects/**
  • projects/contract-domain-extraction/plans/5.11-extract-framework-components-package-plan.md is excluded by !projects/**
📒 Files selected for processing (108)
  • architecture.config.json
  • docs/architecture docs/adrs/ADR 183 - SPI types live at the lowest consuming layer.md
  • packages/1-framework/0-foundation/shared/contract/README.md
  • packages/1-framework/0-foundation/shared/contract/biome.jsonc
  • packages/1-framework/0-foundation/shared/contract/package.json
  • packages/1-framework/0-foundation/shared/contract/schemas/data-contract-document-v1.json
  • packages/1-framework/0-foundation/shared/contract/src/canonicalization.ts
  • packages/1-framework/0-foundation/shared/contract/src/contract-types.ts
  • packages/1-framework/0-foundation/shared/contract/src/domain-types.ts
  • packages/1-framework/0-foundation/shared/contract/src/exports/hashing.ts
  • packages/1-framework/0-foundation/shared/contract/src/exports/testing.ts
  • packages/1-framework/0-foundation/shared/contract/src/exports/types.ts
  • packages/1-framework/0-foundation/shared/contract/src/exports/validate-contract.ts
  • packages/1-framework/0-foundation/shared/contract/src/exports/validate-domain.ts
  • packages/1-framework/0-foundation/shared/contract/src/hashing.ts
  • packages/1-framework/0-foundation/shared/contract/src/testing-factories.ts
  • packages/1-framework/0-foundation/shared/contract/src/types.ts
  • packages/1-framework/0-foundation/shared/contract/src/validate-contract.ts
  • packages/1-framework/0-foundation/shared/contract/src/validate-domain.ts
  • packages/1-framework/0-foundation/shared/contract/test/canonicalization.test.ts
  • packages/1-framework/0-foundation/shared/contract/test/contract-factories.test.ts
  • packages/1-framework/0-foundation/shared/contract/test/contract-types.test-d.ts
  • packages/1-framework/0-foundation/shared/contract/test/contract-types.test.ts
  • packages/1-framework/0-foundation/shared/contract/test/domain-types.test.ts
  • packages/1-framework/0-foundation/shared/contract/test/hashing.test.ts
  • packages/1-framework/0-foundation/shared/contract/test/types.test.ts
  • packages/1-framework/0-foundation/shared/contract/test/validate-contract.test.ts
  • packages/1-framework/0-foundation/shared/contract/test/validate-domain.test.ts
  • packages/1-framework/0-foundation/shared/contract/tsconfig.json
  • packages/1-framework/0-foundation/shared/contract/tsconfig.prod.json
  • packages/1-framework/0-foundation/shared/contract/tsdown.config.ts
  • packages/1-framework/0-foundation/shared/contract/vitest.config.ts
  • packages/1-framework/0-foundation/shared/plan/README.md
  • packages/1-framework/0-foundation/shared/plan/biome.jsonc
  • packages/1-framework/0-foundation/shared/plan/package.json
  • packages/1-framework/0-foundation/shared/plan/src/errors.ts
  • packages/1-framework/0-foundation/shared/plan/src/exports/errors.ts
  • packages/1-framework/0-foundation/shared/plan/src/exports/types.ts
  • packages/1-framework/0-foundation/shared/plan/src/index.ts
  • packages/1-framework/0-foundation/shared/plan/src/types.ts
  • packages/1-framework/0-foundation/shared/plan/test/errors.test.ts
  • packages/1-framework/0-foundation/shared/plan/tsconfig.json
  • packages/1-framework/0-foundation/shared/plan/tsconfig.prod.json
  • packages/1-framework/0-foundation/shared/plan/tsdown.config.ts
  • packages/1-framework/0-foundation/shared/plan/vitest.config.ts
  • packages/1-framework/0-foundation/shared/utils/README.md
  • packages/1-framework/0-foundation/shared/utils/biome.jsonc
  • packages/1-framework/0-foundation/shared/utils/package.json
  • packages/1-framework/0-foundation/shared/utils/src/abortable.ts
  • packages/1-framework/0-foundation/shared/utils/src/array-equal.ts
  • packages/1-framework/0-foundation/shared/utils/src/assertions.ts
  • packages/1-framework/0-foundation/shared/utils/src/defined.ts
  • packages/1-framework/0-foundation/shared/utils/src/exports/abortable.ts
  • packages/1-framework/0-foundation/shared/utils/src/exports/array-equal.ts
  • packages/1-framework/0-foundation/shared/utils/src/exports/assertions.ts
  • packages/1-framework/0-foundation/shared/utils/src/exports/defined.ts
  • packages/1-framework/0-foundation/shared/utils/src/exports/redact-db-url.ts
  • packages/1-framework/0-foundation/shared/utils/src/exports/result.ts
  • packages/1-framework/0-foundation/shared/utils/src/redact-db-url.ts
  • packages/1-framework/0-foundation/shared/utils/src/result.ts
  • packages/1-framework/0-foundation/shared/utils/test/abortable.test.ts
  • packages/1-framework/0-foundation/shared/utils/test/array-equal.test.ts
  • packages/1-framework/0-foundation/shared/utils/test/assertions.test.ts
  • packages/1-framework/0-foundation/shared/utils/test/defined.test.ts
  • packages/1-framework/0-foundation/shared/utils/test/redact-db-url.test.ts
  • packages/1-framework/0-foundation/shared/utils/test/result.test.ts
  • packages/1-framework/0-foundation/shared/utils/tsconfig.json
  • packages/1-framework/0-foundation/shared/utils/tsconfig.prod.json
  • packages/1-framework/0-foundation/shared/utils/tsdown.config.ts
  • packages/1-framework/0-foundation/shared/utils/vitest.config.ts
  • packages/1-framework/1-core/migration/control-plane/src/emission/emit.ts
  • packages/1-framework/1-core/migration/control-plane/src/emission/types.ts
  • packages/1-framework/1-core/shared/contract/README.md
  • packages/1-framework/1-core/shared/framework-components/README.md
  • packages/1-framework/1-core/shared/framework-components/package.json
  • packages/1-framework/1-core/shared/framework-components/src/control-descriptors.ts
  • packages/1-framework/1-core/shared/framework-components/src/control-stack.ts
  • packages/1-framework/1-core/shared/framework-components/src/emission-types.ts
  • packages/1-framework/1-core/shared/framework-components/src/exports/emission.ts
  • packages/1-framework/1-core/shared/framework-components/src/framework-components.ts
  • packages/1-framework/1-core/shared/framework-components/src/types-import-spec.ts
  • packages/1-framework/1-core/shared/framework-components/tsdown.config.ts
  • packages/1-framework/3-tooling/emitter/package.json
  • packages/1-framework/3-tooling/emitter/src/domain-type-generation.ts
  • packages/1-framework/3-tooling/emitter/src/exports/index.ts
  • packages/1-framework/3-tooling/emitter/src/target-family.ts
  • packages/1-framework/3-tooling/emitter/test/domain-type-generation.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.integration.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.roundtrip.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.test.ts
  • packages/2-mongo-family/1-core/test/fixtures/orm-contract.d.ts
  • packages/2-mongo-family/1-core/test/fixtures/orm-contract.json
  • packages/2-mongo-family/3-tooling/emitter/package.json
  • packages/2-mongo-family/3-tooling/emitter/src/index.ts
  • packages/2-mongo-family/3-tooling/emitter/test/emitter-hook.e2e.test.ts
  • packages/2-mongo-family/3-tooling/emitter/test/emitter-hook.generation.test.ts
  • packages/2-mongo-family/3-tooling/emitter/test/generate-orm-fixture.ts
  • packages/2-sql/2-authoring/contract-ts/src/build-contract.ts
  • packages/2-sql/3-tooling/emitter/src/index.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.generation.basic.test.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.parameterized-types.test.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.types.test.ts
  • packages/2-sql/3-tooling/family/src/core/assembly.ts
  • packages/2-sql/3-tooling/family/src/core/control-instance.ts
  • packages/2-sql/3-tooling/family/test/emit-parameterized.test.ts
  • packages/2-sql/3-tooling/family/test/schema-verify.defaults.test.ts
  • packages/2-sql/5-runtime/test/mutation-default-generators.test.ts
  • packages/2-sql/5-runtime/test/sql-context.test.ts
💤 Files with no reviewable changes (3)
  • packages/1-framework/3-tooling/emitter/src/target-family.ts
  • packages/1-framework/1-core/shared/contract/README.md
  • packages/1-framework/3-tooling/emitter/src/exports/index.ts

@wmadden
wmadden merged commit 132ba5f into main Apr 4, 2026
14 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant