Skip to content

Generate design-system manifests

Crumbs can emit a versioned JSON manifest for local compatibility, policy, and design-system tooling. The manifest includes only the roots you explicitly provide; it does not crawl a repository or imply complete package coverage.

Use the tooling-only entrypoint from a build script. Pass stable package and compiler/artifact identities, package-relative source origins, and the style sidecar captured by the compiler:

import { writeFile } from "node:fs/promises"
import {
assembleManifest,
encodeCanonicalManifest,
projectTokenContract,
transformCssTsToStyleSheetWithManifestSidecar,
} from "@opsydyn/crumbs-css/tooling/manifest"
import { button } from "./components/button.css"
import { tokens } from "./tokens.css"
const packageRoot = process.cwd()
const tokenOrigin = { path: "src/tokens.css.ts", exportPath: "tokens" }
const componentOrigin = { path: "src/components/button.css.ts", exportPath: "button" }
const tokenRecords = projectTokenContract(tokens, tokenOrigin)
const { sidecar } = await transformCssTsToStyleSheetWithManifestSidecar(
`${packageRoot}/src/components/button.css.ts`,
packageRoot,
{ declaredTokenIds: new Set(tokenRecords.map((token) => token.id)) },
)
const manifest = assembleManifest({
package: { name: "@acme/design-system", version: "1.0.0" },
producer: {
compiler: { name: "@opsydyn/crumbs-css", version: "1.1.0" },
artifact: { name: "crumbs.native-styles", version: 1 },
},
tokenContracts: [{ contract: tokens, origin: tokenOrigin }],
componentRecipes: [{ recipe: button, origin: componentOrigin }],
styleSidecars: [sidecar],
lifecycleAnnotations: [
{
entityId: "@acme/ui#Button@1",
deprecatedSince: "2.0.0",
reason: "Use the refreshed component contract.",
replacement: { id: "@acme/ui#ActionButton@1", resolution: "external" },
},
],
})
await writeFile("design-system-manifest.json", encodeCanonicalManifest(manifest))

Use the token and component descriptors as the source of contract metadata. Provide only the style modules relevant to the report. If a style references a token outside those contracts, retain its stable external identity where available; legacy or unknown references appear under manifest.coverage.unresolved. Do not convert an unresolved reference into an invented token ID.

Source origins must be package-relative and include their logical export path. Lifecycle annotations are separate assembly inputs keyed by stable entity ID; declared replacements must resolve within the supplied roots, while external replacements require an explicit stable ID.

manifest.coverage.roots describes the selected contracts, recipes, and style modules, not every file in a package. The manifest carries token visibility, domains, aliases, public component surfaces, defaults, lifecycle records, dependencies and provenance. It never includes resolved theme values.

Style capability records are labeled compiler-observed: they mean the compiler admitted a primitive/property pair from the final composed output. They do not prove device rendering, accessibility acceptance, or platform behavior. Keep those claims tied to the separate native/device qualification matrix.

The tooling subpath validates and encodes data through Effect 4 Schema, but its public surface and output are plain TypeScript records and JSON. Ordinary app imports from the package root, theme, theme/core, tokens, or style do not need an Effect import. Do not re-export the manifest tooling API from an application runtime entrypoint.

Use manifest:check to inspect the provider manifest for dependencies on its private tokens. Supplying a baseline switches the command to compatibility comparison. Each known consumer must be passed explicitly:

Terminal window
# Check the current provider contract for private-token dependencies.
bun run manifest:check -- --current design-system-manifest.json
# Check private-token edges and include these consumers in the report.
bun run manifest:check -- --current design-system-manifest.json \
--consumer apps/web/design-system-manifest.json \
--consumer apps/mobile/design-system-manifest.json --format json
# Compare against a previous provider contract and attribute known token use.
bun run manifest:check -- --baseline releases/1.2.0/design-system-manifest.json \
--current design-system-manifest.json \
--consumer apps/web/design-system-manifest.json --format text

--consumer is repeatable. Crumbs reads only the named files: it does not scan the repository, discover packages, or assume the supplied manifests are the complete consumer set. Consumer impact is attached when a supplied consumer contains an external dependency edge with a stable to identity matching a provider token. Unresolved or internal edges are not treated as proven consumer references.

Reports are deterministic schema-v1 JSON (--format json) or readable text (--format text, the default). Findings carry error, warning, or info levels. An error-level finding returns exit status 1; a report without errors returns 0. Invalid arguments, unreadable input, and invalid or incompatible manifests return 2. These levels describe findings; they do not calculate a SemVer recommendation or authorize a release.

Read analysisLimits with the findings. explicit-coverage means analysis is limited to the declared roots in the files provided. consumer-manifests-not-supplied means consumer impact is unknown because no consumer files were passed. component-use-unavailable means manifest v1 cannot say which supplied consumers use a component slot or variant, so component contract changes do not have statically known consumer attribution. Unresolved references, when present, are also reported. A report therefore describes the evidence supplied to it; it does not prove complete package coverage or visual impact.

In this repository, bun scripts/m9-2-manifest-qualification.ts regenerates the fixed M9.2 fixture report and receipt under docs/evidence/2026-09-27-m9-2-manifest-compatibility/. It accepts only the checked-in qualification fixture contents and is intended for repository qualification, not arbitrary consumer manifests.

To repeat Crumbs’ M9.1 fixture and determinism check, resolve the packed export map, audit the packed runtime graphs, and run the Expo iOS/web checks in this repository, run bun run manifest:qualify. It resolves the declared ESM and CommonJS targets and confirms the types target exists. The packed consumer execution and declaration typecheck are covered by the separate manifest-export.test.ts test in bun run check. The generated receipt is stored at docs/evidence/2026-09-27-m9-1-deterministic-manifest/qualification.json; Android remains a separate parked device gate.