Compiling
MongoDB Run the compiler to turn your models and prompts into runnable code. You must run it after adding or changing models or queries. When using Mask Databases, run mask-sync-fetch to get the latest, then node mask.compile.cjs when you have new prompts, and mask-sync-push to share your changes.
Compile
- Run from your project root
- Turns your models and prompts into runnable code
node mask.compile.cjsRequirements
You need project-root mask.compile.cjs that calls runWithMaskConfig with overrideConfig including database, dbModulePath, and syncApiKey (from @local/mask/compiler). The compiler does not run without them. See Configuration.
When to run
- After adding or changing any
MaskModels.define(...)orMaskDatabase.prompt(...)in your source (or after changingregisteryinsideoverrideConfiginmask.compile.cjs). - After cloning the repo — run
mask-sync-fetchto get the latest from Mask Databases, thennode mask.compile.cjsif you have new or changed prompts. - When deploying — run
mask-sync-fetchso production has the latest queries; runnode mask.compile.cjsonly if your build includes new prompts.
Sync and compile
When syncApiKey is set: run mask-sync-fetch to get the latest from the server, node mask.compile.cjs when you add or change prompts, and mask-sync-push to share your changes. See Sync for the full workflow.
If a prompt fails to compile
Fix or remove the prompt in your code then run node mask.compile.cjs again. If you want it gone everywhere: delete it from your project in the Mask Databases dashboard. If it hasn’t been pushed yet (no mask-sync-push for this prompt), you can remove it locally with mask-delete (see Deleting prompts), then re-run node mask.compile.cjs.