id: fragment.editor-content-admin.001
freshvibe_way_version: v8
date: 2026-07-31
last_rewritten: 2026-07-31 (Phase 8 v2)

# editor-content-admin — records CRUD for the content types

## What it does

The content admin is the operator's CRUD interface for the **records** (the data, not the types). For each content type (BlogPost, Recipe, Listing, etc.), the operator can:
- List all records of that type
- Create a new record
- Edit an existing record
- Delete a record

## Why this is its own feature

This is the operator-facing **§3.11-§3.14** surface (manual + AI both, with 3-tier AI approval per oscar-website-mavis's b238). The records are the operator's day-to-day work — they spend 80% of their editing time here. Cluster rule holds:

1. **Content type picker** — first screen, lists all available types (per-site, plus opt-in globals)
2. **Records list** — paginated list of records for the chosen type, sortable by created/updated/title
3. **Record form** — form generated from the type's field schema, using `runtime/content-types.js` RENDERERS
4. **Save / Cancel** — save calls `runtime/content-items/store.js` create or update
5. **Delete** — soft-delete (status=archived) is the only delete; history preserved
6. **AI affordances** — per §3.13: small writes (1 record) auto, medium (2-10) summary+1-click, large (>10 or multi-type) full diff+approval
7. **Templates** — "New from template" button that pulls from the templates store

## Where the data lives

Per Phase 8 v2: per-site content store. The records are scoped to the site via the bootstrap. No shared VPS PB.

The **content-type schema** is read from `runtime/content-types/cache.js` (per-site, with the 7 defaults from `schemas/content-types-default.json`).

The **records** are read from `runtime/content-items/store.js` (per-site, same bootstrap).

## AI affordances (§3.11-§3.14)

When the operator triggers an AI action in this fragment (via the editor-shell or the AI panel):

- **SMALL (1 record write)**: AI writes the record, then asks the operator "Save this?"
- **MEDIUM (2-10 records of one type)**: AI shows a summary of what it would write, asks for 1-click approval
- **LARGE (>10 records or multi-type)**: AI shows a full diff, requires explicit per-record approval

This is the 3-tier rule from oscar-website-mavis's b238 (merged at 3e7a575).

## Usage

```js
import { openContentAdmin } from '../editor-content-admin/index.js';

const panel = openContentAdmin({
  type: 'Recipe',         // optional: skip the picker and go straight to Recipe
  item: existingItem,     // optional: edit this record instead of creating a new one
  onSaved: (item) => { /* refresh the page */ },
  onCancelled: () => { /* close */ }
});
```

## Where it sits in the chrome

The content admin is one of the panels available in the operator's `{ }` Dev button dock. It co-exists with:
- **editor-inspector** (edits one module instance)
- **editor-navigator** (structure tree)
- **editor-save-for-reuse** (review invented content types)
- **editor-templates** (template management)
- **outline** (region tags + sub-widget tags)

## Contract

This fragment exposes:
- `openContentAdmin(opts)` → DOM element
- `closeContentAdmin()` → void

Cross-fragment imports go through `index.js`, not `runtime/`. Implementation is in `runtime/content-admin.js` (existing) + `runtime/content-items/store.js` (new, Phase 8 v2).
