Generated Files and Customization
What the CLI actually writes, and how safe-update detection works.
File destinations
Controlled by prism.json (written by init):
{
"alias": "@/components/prism",
"uiDir": "components/prism/ui",
"fieldsDir": "components/prism/fields",
"css": "app/globals.css",
"typescript": true
}Layer 1 primitives go into uiDir, Layer 2 field components into fieldsDir, both import
other Prism files through alias.
The safe-update marker
Every installed file starts with a content-hash comment:
// prism-hash: 4be8e671abe1c499This hash is computed from the file's own content at install time. On a later add, Prism
recomputes the hash of the file currently on disk (excluding the marker line) and compares it
to the stored one:
- Match: the file is untouched since install, safe to update or leave alone.
- Mismatch: the file was edited since install, refused unless
--force. - No marker at all: a foreign file already exists at that path, refused unless
--force, since it was never installed byprismrepo.
Customizing an installed file
Every installed file is real, ordinary source in your project. Edit input.tsx to change
every field built on it; edit text-field.tsx to change what TextField renders. There is no
registration step to undo and no build process that regenerates these files, they're yours
once written, see Customization Model.
AST-aware registry updates
registry.ts is never rewritten wholesale. add uses ts-morph to find the defineRegistry({ ... }) call, add the new import, and add the new property to the object literal, without
disturbing existing entries or their comments. If the file's structure isn't recognized (for
example, registry.ts doesn't contain a defineRegistry({...}) call with a plain object
literal), add makes no changes and prints the exact import line and registry entry to add by
hand, rather than guessing at a transformation.