# Manifest

The CLI compiles `borkol.content.ts` to this JSON and sends it as the body of [`PUT /v1/api/objects/schema`](/api/build-a-site/schema#put-v1apiobjectsschema). The store checks the shape first, then plans what the push changes.

## Shape

```json title="Manifest"
{
  "version": 1,
  "site": "bakery-web",
  "types": [{
    "key": "bread", "name": "Bread", "plural_name": "Breads", "help": null,
    "settings": {
      "publishable": true, "singleton": false, "hierarchical": false,
      "slug": { "source": "name", "prefixes": { "nl": "/brood" } },
      "menu": null
    },
    "properties": [
      { "key": "name", "label": "Name", "kind": "text", "required": true, "localized": true,
        "options": null, "config": null, "help": null },
      { "key": "size", "label": "Size", "kind": "select", "options": ["small", "large"] },
      { "key": "body", "label": "Body", "kind": "sections", "section_type_keys": ["hero"] }
    ]
  }],
  "page": {
    "properties": [{ "key": "hero_title", "label": "Hero title", "kind": "text", "localized": true }],
    "body": { "section_type_keys": ["hero"] }
  },
  "section_types": [{
    "key": "hero", "name": "Hero", "icon": "image", "group": "Intro", "help": null,
    "looks": [{ "key": "full", "name": "Full" }, { "key": "split", "name": "Split" }],
    "fields": [
      { "key": "title", "label": "Title", "kind": "text", "required": true, "localized": true,
        "help": "Max 6 words." },
      { "key": "media", "label": "Media", "kind": "media", "required": false, "localized": false }
    ],
    "item_label_field": "title",
    "thumbnail_media_id": null
  }]
}
```

| Field | Rule |
|---|---|
| `version` | `1`. |
| `site` | The site key: lowercase letters and digits joined by hyphens, at most 50 characters. |
| `types[].key` | Kebab case, `^[a-z0-9]+(-[a-z0-9]+)*$`, at most 40 characters, unique in the manifest. Singletons too: `site-settings`, never `site_settings`. Not `page` (see `page` below) and not `types`, `records`, `properties` or `bulk`. |
| `types[].name` | Required, at most 100 characters. `plural_name` defaults to the English plural of `name`. |
| `help` (type, property) | Optional, at most 500 characters. Shown under the label in the editors and read by agents. |
| `settings.publishable` | Default `true`. `singleton` and `hierarchical` default `false`. |
| `settings.slug` | `null` (no addresses) or `{source, prefixes}`: `source` is a `text` property of the same type, `prefixes` maps a locale tag to `""` or a path that starts with `/` and has no trailing `/`, each segment a slug (lowercase letters, digits and dashes: `/blog`, `/shop/bread`; no `.`, `..`, empty segment or `%`). A prefix stored before this rule keeps working until it changes. |
| `settings.menu` | `null` keeps the stored menu placement; an object (`placement`, `icon`, `position`) changes the keys it names. |
| `properties[].key` | Snake case, `^[a-z][a-z0-9_]*$`, at most 40 characters, unique in the type. |
| `properties[].label` | Required, at most 100 characters. |
| `properties[].kind` | Every property kind except `customer` and `token_variant` (commerce-bound kinds configured in the dashboard only): `text`, `textarea`, `number`, `money`, `boolean`, `select`, `date`, `richtext`, `media`, `link`, `icon`, `record_ref_list`, `color`, `email`, `phone`, `datetime`, `tags`, `record_ref`, `media_list`, `repeater`, `sections`. |
| `required`, `localized` | Default `false`. `localized` is refused for kinds whose value cannot be a per-language map (`sections`, `repeater`, `boolean`, `number`, `money`, `record_ref`, `record_ref_list`, `color`, `date`, `datetime`, `media_list`). |
| `options` | Required on `select` (1 to 50 strings of at most 100 characters), not allowed on any other kind. |
| `config` | `repeater`: `fields` (the row fields) and `item_label_field`. `record_ref`, `record_ref_list`: `object_type_keys`. `sections`: `min_items`, `max_items`. Nothing on other kinds. |
| `section_type_keys` | Required on `sections` (1 to 50 section type keys, snake case), not allowed on other kinds. Every key is a section type of the store or one in `section_types`. |
| `page` | Optional. `null` leaves the standard Pages type alone. `properties` are the site's own page properties next to the core ones (`title`, `body`, `seo_title`, `seo_description`, `social_image`). `body.section_type_keys` narrows the sections the page body allows. |
| `section_types[].key` | Snake case, at most 50 characters, unique in the manifest. |
| `section_types[].name` | Required, at most 100 characters. `icon` is a Lucide icon name or `null`, `group` (at most 50 characters) groups the section picker, `help` at most 500 characters. |
| `section_types[].looks` | Optional list of `{key, name}`, at most 20, keys snake case and unique. No looks means one look, `default`. |
| `section_types[].fields` | The section field kit (`FieldSchema`): `key`, `label`, `kind`, `required`, `localized`, `config`, at most 40 fields, repeaters nest one level. Every field and row field may carry `help` (at most 500 characters), kept in the stored fields. `item_label_field` is one of the fields or `null`. A list field (`record_ref_list`, `media_list`, `repeater`, `tags`) may carry `config.min_items` (0 to 100) and `config.max_items` (1 to 100, at least the minimum); saves outside them are refused, a translated `tags` field counts per language. |
| `section_types[].thumbnail_media_id` | A media id of the store (uploaded during the push) or `null`. |

A shape error answers 422 with errors keyed by dotted path into the manifest, for example
`types.0.key` or `types.0.properties.2.options`.

## The plan

A push is forward-only: it never deletes a type, a property or a value. The plan lists one op
per change, in the order it applies, each `{op, target, key, detail}` with `target` one of
`type`, `property`, `section_type`, `section_field`, `page` and `key` like `bread` or
`bread.name` (`page.hero_title` for a page property).

| Op | When |
|---|---|
| `add` | A type, property or section type that does not exist yet, or a field a site section type gains (target `section_field`, key `hero.lead`, detail its kind). A new section type's detail is like `2 fields, looks full, split, thumbnail`. A new type is created managed by the site; the property `name` it would get by default is left out unless the manifest declares it. |
| `update` | A changed `name`, `plural_name`, `help`, `settings` (`publishable`, `singleton`, `hierarchical`, `slug`, `menu`), or on a property a changed `label`, `help`, `required`, `localized` (only while no record holds a value), `position` (its place in the manifest list), select `options` (appended, reordered, or an option dropped that no record uses), `section_type_keys`, `config` (a repeater may append optional row fields). The detail names what changes. |
| `update` on `section_type` | A changed `name`, `icon`, `group`, `help`, `item_label_field`, thumbnail, `looks` (appended, renamed or reordered) or `fields` (a changed label, help, required flag or config; a field dropped while no record uses the type). The detail names what changes. |
| `update` on `page.body` | `page.body.section_type_keys` differs from the sections the Pages body allows; the push replaces that list. |
| `update` with detail `claim` on `section_type` | A seeded or dashboard-made section type with the same key that no record, trashed ones included, uses. The site's definition replaces it and it becomes managed by the site. |
| `update` with detail `claim` | A type made in the dashboard with the same key, or the Pages type. It becomes managed by the site however many records it holds; its records stay as they are. |
| `archive` | A property, type or section type of this site that the manifest no longer lists (a section type: `archive with N records` when live records hold a section of it; its sections keep their data). The detail is `archive with N values` when live records hold values for the property, `archive with N records` when the type has live records. An archived type takes its records out of every list and out of the trash purge until it comes back. Core page properties are never archived. |
| `unarchive` | An archived property, type or section type of this site whose key is back in the manifest. Its values return unchanged. |
| `refuse` | A kind change; a select option removed while a record uses it; a translation change on a property holding values; a repeater row field removed, renamed or changed in kind, or a new required row field; a page property that redefines (or by that removes) a core property; an unsupported kind (`customer`, `token_variant`); an unknown section type key; a type managed by another site, or a deleted dashboard type holding the key; settings the type cannot take (a single record setting on a type with more records, publishing turned off with drafts left, subpages turned off with child records); an address prefix another type holds after the push (detail `address prefix /p is used by Y`), including a type coming back from archive whose prefix was taken meanwhile; a seeded or dashboard-made section type key that records use, trashed ones included, (detail `section key hero is used by 3 records`); a section type managed by another site; a look removed from a site section type; a section field that changes kind; while records (trashed ones too) use the section type, a field removed, changed in translation, losing an option or turned required, or a new required field; a sections property or `page.body` dropping a section type that records (trashed ones too) hold (detail `removes section cta_band that 3 records use`); a property turned required while records (trashed ones too) have no value, or a new required property on a type with records; a repeater row field removed, renamed, changed in kind or added as required; a thumbnail id that is not a media item of the store; an unknown key in `page.body.section_type_keys`; a list limit (`min_items`, `max_items`, on a sections property, a section field or a row field) added or tightened while records (trashed ones too) hold a list outside it (detail `max 12 while 3 records hold more`). |

Every check runs while planning, so a dry run that plans no `refuse` applies as shown. Applying runs every op in one database transaction. It applies nothing when the plan holds
any `refuse`, and nothing when it archives values unless the push says yes (`yes=1`, the
CLI's `--yes`). A second push of the same manifest plans no ops.

Renaming a key is an `add` plus an `archive`: add the new key, move the values, then remove
the old key. Rolling back is a git revert plus a push; an unarchive brings the data back.
