Docs article
Contract Spec
Review the full YAML contract surface, constraints, and minimal valid schema patterns.
Contract Spec#
TasteKernel contract files are YAML-first and validated with the @tastekernel/contract-schema package.
Default file name:
tastekernel.contract.yml
Validate at any time:
tastekernel validateTop-level structure#
Required top-level sections:
versionprojectsourcestokenscomponentsmotioncopyrulesignorewaivers
Project#
project controls scan targets and framework assumptions.
name: display name for reports and exportsframework:nextjsorreactstyling:tailwindorcsscomponentDirs: component discovery rootscodeGlobs: source globs for TS/JS/TSX/JSXcssGlobs: CSS globs for PostCSS parsing
Sources#
sources declares token origin mode.
tailwindMode:v3-config|v4-theme|manualtailwindFiles: source files inspectedconfigFiles: supporting config filesdetectedFiles: best-effort detection traces
Tokens#
Token groups:
colorsspacingradiusshadowstypography
Each token entry supports:
idvaluealiasespreferredClassNamescssVardescription
Components#
components.allowed defines approved usage:
importSourcebannedHtmlSubstitutesallowedVariantsallowedSizesdeprecatedreplacement
components.deprecated maps legacy component names to replacements.
Motion#
Motion constraints:
maxDurationMsallowedDurationsMsallowedEasingsbannedEasingsallowedAnimationNamesdisallowInlineAnimationValues
Copy#
Copy constraints:
toneKeywordsbannedPhrasespreferredReplacementscheckedPropscheckTextNodesallowlistPatterns
Rules and severity#
Rules are keyed by rule id. Each entry can define:
severity:off | info | warn | error | ignoreignoreGlobsfolderGlobs
Example:
rules:
token/no-raw-color:
severity: error
component/no-inline-style:
severity: warnIgnore and waivers#
Ignore levels:
.tastekernelignorefile- contract-level
ignore.globs - contract-level
ignore.perRule - inline comments (rule-specific, with justification)
Waivers:
fileruleIdreason- optional
expiresAt
Minimal valid example#
version: 1
project:
name: Example
framework: nextjs
styling: tailwind
componentDirs: [src/components/ui]
codeGlobs: [src/**/*.{ts,tsx,js,jsx}]
cssGlobs: [src/**/*.css]
sources:
tailwindMode: manual
tailwindFiles: []
configFiles: []
detectedFiles: []
tokens:
colors: []
spacing: []
radius: []
shadows: []
typography: []
components:
allowed: {}
deprecated: {}
motion:
maxDurationMs: 250
allowedDurationsMs: [75, 100, 150, 200, 250]
allowedEasings: [ease, ease-in, ease-out, ease-in-out]
bannedEasings: []
allowedAnimationNames: [spin, pulse]
disallowInlineAnimationValues: true
copy:
toneKeywords: [calm, direct, friendly]
bannedPhrases: []
preferredReplacements: {}
checkedProps: [title, placeholder, aria-label]
checkTextNodes: true
allowlistPatterns: []
rules: {}
ignore:
globs: [node_modules/**, .next/**, dist/**, build/**]
perRule: {}
waivers: []