Configuration
Configure sources, governance, and output.
primitiv.config.js
// primitiv.config.js
module.exports = {
sources: {
codebase: {
root: "./src",
patterns: ["**/*.css", "**/*.ts", "**/*.tsx"],
ignore: ["node_modules", "dist", ".next"]
},
// figma: {
// token: process.env.FIGMA_ACCESS_TOKEN,
// fileId: "your-figma-file-id"
// },
// storybook: {
// url: "http://localhost:6006"
// }
},
governance: {
sourceOfTruth: "codebase", // "codebase" | "figma" | "storybook" | "manual"
onConflict: "warn" // "error" | "warn" | "auto-resolve"
},
output: {
path: "./primitiv.contract.json"
}
}Sources
Configure which design sources Primitiv scans. Each source uses an adapter:
- codebase — scans CSS variables, TypeScript tokens, and React components from your filesystem
- figma — connects to Figma via the Variables API (requires access token and file ID)
- storybook — scans components and variants via the Storybook manifest
Governance
Controls how Primitiv handles conflicts between sources:
sourceOfTruth— which source wins when sources disagree ("codebase","figma","storybook", or"manual")onConflict— what to do when a conflict is detected ("error","warn", or"auto-resolve")
Output
path— where to write the resolved contract file (default:./primitiv.contract.json)