Compiler and generators
Deterministic manifest compilation, semantic compatibility reports, and independently packaged artifact targets.
Install the compiler, CLI, and only the independently versioned targets your build needs:
pnpm add -D @fabricorg/compiler@^2.2.0 @fabricorg/fabric-gen@^0.5.0 \
@fabricorg/gen-types@^2.0.1 @fabricorg/gen-events@^0.2.4 \
@fabricorg/gen-capability@^0.5.0 @fabricorg/gen-docs@^0.2.4 \
@fabricorg/gen-prisma@^2.0.1 @fabricorg/gen-graphql@^3.1.0 \
@fabricorg/gen-sdui@^0.5.1 @fabricorg/gen-conformance@^0.3.0
# Required by applications that run generated GraphQL resolvers and conformance suites
pnpm add @fabricorg/platform@^1.2.0 @fabricorg/assembly@^0.3.0 \
@fabricorg/projection-host@^1.1.0 @fabricorg/platform-host@^6.0.0@fabricorg/compiler exposes compileManifestBundle, diffModuleManifests, runGenerator, GeneratorTarget, and CertificationProfile. It normalizes manifest v1 or v2 bundles into a deterministic intermediate representation, sorts modules, records a SHA-256 manifest digest and compiler version, and accepts optional conformance adapters. Required JSON Schema, state-machine, and policy invariant references resolve against the manifest. Required Host-adapter and application-owned invariants need evidence from the capability's named CertificationProfile, or compilation fails closed. diffModuleManifests reports generated-artifact semantic compatibility. Source and runtime compatibility come from optional definitions, while wire compatibility is negotiated through manifestVersion; those are distinct planes. The compiler has no runtime role.
Independent targets generate TypeScript types (@fabricorg/gen-types), event registries (@fabricorg/gen-events), capability usage contracts (@fabricorg/gen-capability), documentation (@fabricorg/gen-docs), Prisma reference schemas and review-only compatibility reports (@fabricorg/gen-prisma), GraphQL subgraphs and resolvers (@fabricorg/gen-graphql), SDUI data-shape bindings (@fabricorg/gen-sdui), and executable conformance suites (@fabricorg/gen-conformance).
@fabricorg/gen-graphql projects each view's JSON Schema into named GraphQL types rather than an opaque JSON scalar, declares the Federation 2 @link directive, and emits createResolvers() — an executable resolver map whose Query fields read through ProjectionHost and whose Mutation fields submit through submitAction(). A shape it cannot represent — oneOf, anyOf, allOf, tuple items, a multi-type union, a non-local $ref — fails the generator rather than silently degrading to JSON; only a schema that genuinely admits any value projects as JSON. Recursive #/$defs references resolve to a single named type.
@fabricorg/gen-capability emits a usage contract carrying its own formatVersion, validated by assertUsageContract and described by the published USAGE_CONTRACT_JSON_SCHEMA. Experience semantics stay inside extensions; the contract never interprets them.
@fabricorg/gen-conformance emits both a plan and a runnable suite per module. MODULE_CONFORMANCE_CHECKS are the eight a module can verify against a governed host; PLATFORM_CONFORMANCE_CHECKS are the two documentation checks a repository owns. A check that a module cannot exercise reports not-applicable with a reason rather than passing silently. @fabricorg/gen-conformance/memory ships a reference harness so a generated suite runs with no database, queue or network. createCertificationResult still refuses incomplete mandatory evidence across both families. @fabricorg/fabric-gen exports GENERATOR_TARGETS, generateFromManifest(), initializeCapability(), exportModuleManifestFile(), and checkApplication(). Its CLI scaffolds capabilities, exports an authored module into the manifest the generators read, writes or checks deterministic generated artifacts, and verifies approved application composition. fabric-gen export imports a FabricModule from a TypeScript or JavaScript file, normalizes it with exportModuleManifest(), and compiles the result before writing, so a bad field is reported against the authored module rather than inside a generator. It names the export it used, and refuses rather than guessing when a file exports more than one module. Outputs contain no timestamps, include compiler and target versions, and stale files fail check mode. Prisma output is a reviewed input to ordinary migration tooling, never an automatic migration.
fabric-gen init capability case-review
fabric-gen export --module ./case-review/module.ts --out ./fabric-manifest.json
fabric-gen --input ./fabric-manifest.json --out ./generated \
--targets types,events,capability,docs,prisma,graphql,sdui,conformance
fabric-gen check-application --config ./fabric.application.json
fabric-gen --input ./fabric-manifest.json --out ./generated --check
`check-application` verifies lockfile integrity, exact runtime capability
versions and compiler digests, promoted release structure and digest, and the
release-to-assembly identity before deployment.Capability roles, extension slots, stability, deprecation, and certification metadata are declared in the manifest; action/event/view shapes are derived. Archetype findings enter through a compiler adapter, so the compiler does not know archetype names.
Related portable APIs include assertPortableJsonSchema, DeclarativeInvariant, CapabilityMetadata, and createViewRegistry. They remain owned by @fabricorg/platform; generators consume their serialized manifest representation rather than importing application code.