lib.contracts-library
Reusable contract library and registry primitives for ContractSpec applications.
@lssm-tech/lib.contracts-librarybun add @lssm-tech/lib.contracts-libraryManifest declarations describe the current workspace; they do not verify registry publication or runtime execution.
Package guide
Contract definitions for library templates and local runtime.
The app-config entries own tenant app blueprint composition, validation, branding and lifecycle contracts. experiments/spec owns their experiment specification and registry prerequisite. These generic application-template surfaces preserve the original nominal registry types and contain no concrete provider binding. Supported contracts-spec/app-config and contracts-spec/experiments/spec imports forward to the same objects.
What It Provides
- Layer: lib.
- Consumers:
bundle.library. - Related ContractSpec packages include
@lssm-tech/lib.contracts-spec,@lssm-tech/lib.schema,@lssm-tech/tool.bun,@lssm-tech/tool.typescript. - Related ContractSpec packages include
@lssm-tech/lib.contracts-spec,@lssm-tech/lib.schema,@lssm-tech/tool.bun,@lssm-tech/tool.typescript.
Installation
npm install @lssm-tech/lib.contracts-library
or
bun add @lssm-tech/lib.contracts-library
Usage
Import the root entrypoint from @lssm-tech/lib.contracts-library, or choose a documented subpath when you only need one part of the package surface.
Feature references in app composition
composeAppConfig from ./app-config/runtime resolves feature references by key. If the composed input carries an explicit version, the registered feature must match it exactly. Strict composition throws the existing missing-reference error on a mismatch. Permissive composition omits the feature and records the requested <key>.v<version> in missing. Key-only references resolve to the feature registered for that key.
checkBrandComposition from ./app-config/brand-composition validates explicit feature versions against the registry and surface versions against the admitted blueprint feature. A refused blueprint key supplies neither capabilities nor operations. The checker uses the same admitted feature for surface validation and operation classification.
Architecture
src/index.tsis the root public barrel and package entrypoint.src/templatesis part of the package's public or composition surface.
Public Entry Points
- Export
.resolves through./src/index.ts. - Export
./templatesresolves through./src/templates/index.ts. - Export
./templates/messagingresolves through./src/templates/messaging.ts. - Export
./templates/recipesresolves through./src/templates/recipes.ts. - Export
./templates/todosresolves through./src/templates/todos.ts. - Export
./app-config/brand-compositionresolves through./src/app-config/brand-composition.ts(defineBrandComposition,checkBrandComposition,indexBrandHosts/resolveBrandHost,selectBrandExperience,resolveBrandAppConfig: composition-only brand specs; every result carriesauthority: 'composition-only'and grants no authority; not forwarded bycontracts-specor the./app-configbarrel). - Export
./examples/maturityresolves through./src/examples/maturity.ts(evaluateExampleMaturity: the beta/stable/experimental stability gate for example packages; hosts collect files, README and scripts).
Local Commands
bun run dev— contractspec-bun-build devbun run build— contractspec-bun-build buildbun run lint— bun run lint:fixbun run lint:check— biome check .bun run lint:fix— biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .bun run typecheck— tsgo --noEmitbun run publish:pkg— bun publish --tolerate-republish --ignore-scripts --verbosebun run publish:pkg:canary— bun publish:pkg --tag canarybun run clean— rm -rf distbun run build:bundle— contractspec-bun-build transpilebun run build:types— contractspec-bun-build typesbun run prebuild— contractspec-bun-build prebuild
Recent Updates
- Replace eslint+prettier by biomejs to optimize speed.
Notes
- Template contracts define the shape consumed by bundle.library — breaking changes cascade to all template renderers.
- Keep contract schemas additive; avoid removing or renaming fields without a migration path.
The explicit editions family owns existing edition composition, storage and evidence helpers. Coach operation declarations and registrars preserve their original schemas and authority requirements. Contract registry, report, installation and CLI declaration leaves retain their existing nominal signatures. The experiments/evaluator leaf owns the original ExperimentEvaluator: random, sticky and targeted allocation, policy and expression callbacks retain their behavior. Built-in targeting-rule expressions use the kernel policy condition grammar with context as the only root and are never run as JavaScript; a rule whose expression fails to parse or evaluate is skipped and reported in targetingErrors and through onTargetingError.
Relationships
Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.
18 declarations
@lssm-tech/lib.contracts-spec-coreworkspace:^
Read the package manual ↗@lssm-tech/lib.schemaworkspace:^
Read the package manual ↗@lssm-tech/lib.contracts-runtime-kernelworkspace:^
Read the package manual ↗@lssm-tech/lib.contracts-runtime-coreworkspace:^
Read the package manual ↗@lssm-tech/lib.surface-runtimeworkspace:^
Read the package manual ↗@lssm-tech/lib.design-catalogworkspace:^
Read the package manual ↗
Declared capabilities
Reusable contract library and registry primitives for ContractSpec applications.
Scripts
publish:pkgbun publish --tolerate-republish --ignore-scripts --verbosepublish:pkg:canarybun publish:pkg --tag canarycleanrm -rf distlintbun run lint:fixlint:fixnode ../../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../../scripts/biome.cjs check --write .lint:checknode ../../../../scripts/biome.cjs check .buildcontractspec-bun-build buildbuild:bundlecontractspec-bun-build transpilebuild:typescontractspec-bun-build typestestbun testprebuildcontractspec-bun-build prebuildtypechecktsgo --noEmitdevcontractspec-bun-build dev