# Migrate from a prerelease to 1.0

**Goal:** a project written for a `0.x` prerelease of Récit compiles, validates and builds with
Récit 1.0, without a key, an option or an import that 1.0 refuses.

It follows the [Stability](/documentation/reference/stability) page, which says what 1.0 keeps. It
lists every change a `0.x` project may have to make, taken from the « Migration » sections of the
release notes. `recit migrate` performs some of them; each other step says it is **manual**.

## Before you start

- Commit your project, or copy it: `recit migrate` rewrites files in place.
- Install the 1.0 packages (`recit`, `@recit/cli` and the others your project lists) and Node.js
  22.22 or later.
- List your story files: the Markdown stories (`.md`, `.mdx`), their JSON twins (`kind: "story"`)
  and their sidecars (`kind: "sidecar"`). `recit migrate` and `recit validate` take files, not a
  folder.

## 1. See what recit migrate would change

```bash
recit migrate --dry-run slides.md slides.json
```

Nothing is written. For each file, the report says `nothing to migrate`, or lists every change it
would make, one line each (`pdf.theme: renamed to pdf.colorMode`). A file written for a newer schema
than your Récit reads, or one that cannot be read, is an error: the command goes on with the other
files and exits with 1. Add `--json` for a machine-readable report.

## 2. Run recit migrate

```bash
recit migrate slides.md slides.json
```

The same report, and the files are written. A file that needs no change is left untouched. These are
all the rewrites `recit migrate` performs, in the front matter of a Markdown story and in a JSON
twin or sidecar (its `settings`, and its `format` and `$schema` when they name the former `toon`
id):

| Before (front matter)      | After (front matter)          | Before (JSON)                 | After (JSON)                   |
| -------------------------- | ----------------------------- | ----------------------------- | ------------------------------ |
| `pdf.theme`                | `pdf.colorMode`               | `/settings/pdf/theme`         | `/settings/pdf/colorMode`      |
| `theme.defaultMode`        | `colorMode`                   | `/settings/theme/defaultMode` | `/settings/colorMode`          |
| `format: toon`             | `format: webtoon`             | `/format`: `"toon"`           | `/format`: `"webtoon"`         |
| `$schema` `…/v1/toon.json` | `$schema` `…/v1/webtoon.json` | `/$schema` `…/v1/toon.json`   | `/$schema` `…/v1/webtoon.json` |

A value already written under the new name wins over the old one, and the old key is removed. The
schema version stays `v1`: every `0.x` story is a `v1` story, and `recit migrate` would chain the
steps to a later version once one exists.

**Manual:** in a story, a mode written in place of a theme is not rewritten. In front matter,
`theme: dark` still works in `0.x` and warns; `1.0.0-rc.0` removes it: write `colorMode: dark`. In a
JSON twin, `"theme": "dark"` in `settings` is refused: write `"colorMode": "dark"`.

## 3. Validate the stories

```bash
recit validate slides.md slides.json
```

It reads the `recit.config.*` of the project (or the one `-c, --config` names): a config that still
writes a 0.x key fails with `Invalid recit config`, one line per refused key with its new name. Fix
them in step 4, then run `recit validate` again until it prints no error.

## 4. Fix recit.config.ts (manual)

`recit migrate` does not touch the configuration: a `recit.config.ts` is code. Each key below is
refused by 1.0 with a message that names its replacement.

| 0.x key                                      | In 1.0                                                                                          |
| -------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| `theme: { defaultMode: "dark" }`             | `colorMode: "dark"`, beside `theme:`                                                            |
| `pdf: { theme: "dark" }` (any section)       | `pdf: { colorMode: "dark" }`                                                                    |
| `slides:`                                    | merged into `deck:` (`slides.transition` → `deck.transition`)                                   |
| `publish.decks`                              | `publish.entries`                                                                               |
| `publish.loadDeckConfig`                     | `publish.loadStoryConfig`                                                                       |
| `stories.dir` and the other site keys        | `publish.dir`, `publish.*`                                                                      |
| `stories.autoplay` and the other format keys | `webstory.autoplay`, `webstory.*`                                                               |
| `deck.files`                                 | removed: it chose no file, delete it (`0.x` ignores it with a warning, `1.0.0-rc.0` refuses it) |

## 5. Rename the CLI options in your scripts (manual)

| 0.x                                                                       | In 1.0                                                                                                                  |
| ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `recit export --theme <mode>`                                             | `recit export --color-mode <mode>`                                                                                      |
| `--out <dir>` (`render`, `prompts build`, `skills export`, `form schema`) | `-o, --output <dir>`; in `0.x` the last three still read `--out`, with a warning, and `1.0.0-rc.0` removes it           |
| `recit render --engine remotion`, `engine: "remotion"`                    | removed: drop it; the `frames` engine draws the same pixels with Chromium and an ffmpeg with `libx264` (`RECIT_FFMPEG`) |

A tool that parsed the output of `recit validate`, `recit convert --to deck` or the MCP tool
`validate_story` reads the one diagnostic format now: `✖ <file>:<line> — <message> (<code>)`.

## 6. Use the words of 1.0

The vocabulary settled during `0.x` ([glossary](/documentation/reference/glossary)). Where a name
was in a file you write, it changed with the word:

- **webstory**: the format of full-screen `9:16` cards was `stories`. Write `format: webstory`,
  `--to webstory`, `recit init --format webstory`, the `webstory:` section of the config, and the
  package `@recit/webstory` (was `@recit/stories`). **Manual.**
- **webtoon**: the format of vertical strips was `toon`. Write `format: webtoon` (front matter, twin
  and `series.json`), `recit init --format webtoon` and `recit schema webtoon`, the `webtoon:`
  section of the config, the MCP guide `recit://guide/webtoon` and the package `@recit/webtoon`
  (`@recit/toon` was never released). Every old spelling is still read as `webtoon` with a
  `deprecated-format-id` warning until 1.0. `recit migrate` rewrites `format: toon` in the stories
  (and a twin's `$schema` that names `schema/v1/toon.json`, a file 1.0 no longer publishes); the
  `toon:` section of the config, the CLI option and the MCP address are renamed by hand. The public
  names `ToonSourceSchema`, `TOON_SHAPE_PATHS`, `TOON_TAIL_PATH` and the `Toon…` types of
  `@recit/core` keep a `@deprecated` alias of the same name in `Webtoon…`.
- **film**: what the motion format renders, `film.json`, `--to film`, and the MCP tools `build_film`
  and `validate_film`. A deck is the slide format and nothing else.
- **scene**: the unit of every format. The types say so (step 8): `SceneConfig`, not
  `SlideMetadata`.
- **colorMode**: `light`, `dark` or `system`, never a theme. A theme is a named set of tokens
  (`warm-editorial`). This is the rename `recit migrate` performs in step 2 and you perform in the
  config in step 4.

## 7. Update your styles (manual)

- Dark mode is one attribute, `data-mantine-color-scheme="dark"` on `<html>`. A `theme.customCss`, a
  site's `styles.css` or a component module that wrote `.dark …` or `:global(.dark) …` writes
  `[data-mantine-color-scheme="dark"] …` or `light-dark()` instead.
- A deck carries no Tailwind utilities. A utility class (`flex`, `gap-4`…) in a component or a
  slide, or `@apply` in `theme.customCss`, becomes CSS in `customCss` or in a `*.module.css` next to
  the component, which `recit build` bundles. `@recit/theme/tailwind.css` is removed;
  `@recit/theme/reset.css` is the reset every deck is drawn on.

## 8. Update your imports (manual)

Only code that imports Récit's packages needs this step. TypeScript names each missing import.

### Renamed

| 0.x name                                 | In 1.0                           |
| ---------------------------------------- | -------------------------------- |
| `SlideMetadata` (`@recit/core`)          | `SceneConfig`                    |
| `SlideDensityReport`                     | `SceneDensityReport`             |
| `DeckDensitySummary`                     | `StoryDensitySummary`            |
| `GlobalDeckMetadata`                     | `StoryFrontmatter`               |
| `ParsedDeckDocument`                     | `ParsedStoryDocument`            |
| `SlidesConfigSchema`, `SlidesConfig`     | `DeckConfigSchema`, `DeckConfig` |
| `resolveDeckConfig`                      | `resolveStoryConfig`             |
| `getLoadedDecks` (`@recit/site-stories`) | `getLoadedStories`               |
| `getLocaleDecks`                         | `getLocaleStories`               |
| `findDeck`                               | `findStory`                      |
| `LoadedDeck`                             | `LoadedStory`                    |
| `DeckSummary`                            | `StorySummaryEntry`              |
| `DeckThumbnail`                          | `StoryThumbnail`                 |
| `StorySource`                            | `StoryEntry`                     |
| `toHslTriplet` (`@recit/core`)           | `toHslTriplet` of `@recit/theme` |

`recit/config` exports the names of `@recit/core/config` and `defineConfig`. The names of the site
plugin it used to export (`companionViteConfig`, `LANGUAGE_SWITCHER_SLOT`,
`RECIT_PLUGIN_CONFIG_NAME`, `RecitSiteConfig`, `recitSitePlugin`, `RecitSitePlugin`,
`siteIntegration`, `toVitePluginOptions` and `withLanguageSwitcher`) come from
`@recit/site-stories/config`.

### Removed from the public entries

Internal functions left the package entries before 1.0. None has a public replacement: copy the
function into your project, or ask for it back in an issue. Types, zod schemas and data constants
stay public, and so do the commands that used them (`recit build`, `dev`, `convert`, `validate`,
`i18n`, `schema`…).

- `@recit/core`: `accessibilityToDiagnostics`, `applyStrings`, `atlasCodec`, `atlasSettingsFields`,
  `backgroundLayer` (`buildThemeCss` writes the layer), `bookCodec`, `bookSettingsFields`,
  `calendarCodec`, `calendarSettingsFields`, `checkAtlasSource`, `checkBookSource`,
  `checkDirectorySource`, `checkEntries`, `checkGlossarySource`, `checkSlideLayoutImage`,
  `commonEntryFields`, `commonEntryPairs`, `createUiStrings`, `ctaLines`, `deprecatedDiagnostic`,
  `directoryCodec`, `directorySettingsFields`, `entryFields`, `entryLineDiagnostics`,
  `entrySceneAttributes`, `entrySceneFields`, `estimateSpeechDuration`, `extractEsmLines`,
  `firstDifference`, `formatAtlasDuration`, `formatCta`, `formatPackage`, `frontmatterProblems`,
  `glossaryCodec`, `glossarySettingsFields`, `hashString`, `hasUiPack`, `hoistMdxPreamble`,
  `isRRuleGrammar`, `isSlideAspectRatio`, `isValidIsbn13`, `isValidLocalDateTime`,
  `isValidPlainDate`, `isValidQuarter`, `joinList`, `jsonSchemaStability`, `letteringToMarkdown`,
  `matchSlideSeparator`, `parseAtlasCamera`, `parseAtlasCenter`, `parseAtlasDuration`,
  `parseAtlasLayer`, `parseDirectorySection`, `parseGeo`, `parseGlossarySection`,
  `parseInlineConfig`, `parseInlineConfigWithDiagnostics`, `parseRoadmapLane`,
  `parseSceneDirectiveComment`, `pixelRecipeSize` (the mask rows `PIXEL_MASK_PRESETS` and
  `pixelMaskRows` stay), `reportCodec`, `reportSettingsFields`, `resolveAspectRatioDimensions`,
  `resolveDensityLimits`, `resolveStoryPdfOptions`, `resolveUiLocale`, `roadmapSettingsFields`,
  `sceneAttributes`, `splitAtlasBody`, `splitCta`, `splitEventTitle`, `splitList`, `spriteCell`,
  `spriteFrameAt`, `spriteProblems`, `toonCodec`, `toonSceneDiagnostics`, `trimEmptyLines`,
  `unknownFormatMessage`, `unknownKindMessage`, `unknownSourceIssue`, `unknownTokens`,
  `webstoryCodec`, `webstorySettingsFields`. To read or validate a story, `compileStory`,
  `validateStoryText`, `safeValidateStorySource` and the schemas of `@recit/core/schema` stay
  public.
- `@recit/components`: `createPixelRandom`, `fitFontSize`, `glossaryListToHast`,
  `normalizeGridCols`, `pixelCellScale`, `pixelTokenVariable`, `plainSummary`, `readTermDirective`,
  `referencedTerms`, `spriteDirective`, `spritePicture`, `spriteToHast`, `syntheticSpriteSheet`,
  `termIdOf`, `termToHast`, `tokenToColor`, `unknownTermMessage`, `waitForFonts`.
- `@recit/deck`: `applyStepVisibility`, `aspectOf`, `asSyncMessage`, `computeFitScale`,
  `computeStageScale`, `deckChannelName`, `isFooterVisible`, `nextPosition`, `parseDeckMode`,
  `parseProps`, `parseSlideIndex`, `parseStepIndex`, `parseSyncMessage`, `prevPosition`,
  `resolveSlideComponent`, `selectCodeTab`, `updateSlideUrl`, `variantsFor`, `wrapSlideIndex`. The
  `Presentation` component and its props stay the entry of a deck.
- `@recit/motion`: `attrPropValue`, `buildSprite`, `buildTextCard`, `Checkbox`, `Chip`,
  `composeStyle`, `cubicBezier`, `lintFilmGlyphs`, `ListRow`, `Sparkle`, `stateAt`,
  `statesDuration`, `stepEnd`, `stepSpec`, `stepStyleAt`, `suspiciousGlyphs`, `transcriptTimestamp`,
  `uiSceneDuration`, `vttTimestamp`.
- `@recit/motion-blocks`: `blockAnimationEnd`, `chapterTimeline`, `clampTime`, `clockAfterToggle`,
  `clockAtEnd`, `clockAtStart`, `compareBarsTimeline`, `filmBlockTypes`, `layoutFor`,
  `listTimeline`, `panelTimelineFor`, `panelTravel`, `pixelFrameAt`, `pixelRowsAt`,
  `pixelTimelineFor`, `sceneStartTime`, `spriteMsAt`, `spriteTimeline`, `statementTimeline`,
  `statTimeline`, `textcardTimelineFor`, `titleTimeline`, `uiMockTimeline`, `uiSceneTimeline`,
  `uiSceneTimelineFor`, `watchReducedMotion`.
- `@recit/cli`: `buildApp`, `checkLink`, `checkLinks`, `checkTranslations`, `convertFile`, `devApp`,
  `extractDeck`, `extractTranslations`, `findStories`, `iconApp`, `jsonSchemaFor`, `loadAppSite`,
  `loadI18n`, `loadPreviewFormat`, `mobileApp`, `motionDuration`, `previewApp`, `renderDeckPage`,
  `startMotionDevServer`, `storyDataSources`, `translationStatus`, `validateLinks`,
  `validateStoryFile`. Two have a replacement: `calendarIncludedEvents` and `calendarPlaces`, the
  joins of a calendar, are `includedRoadmaps` and `calendarPlaces` of `@recit/calendar/node`, which
  take the reading of the roadmap and of the directory as options. The CLI's own roadmap reader is
  not exported: [Joins in Node](/formats/calendar/overview#joins-in-node) shows the one to write,
  with public names only.
- `create-recit`: `defaultIo`, `detectPackageManager`, `isFreeFolder`, `isTemplateName`,
  `nextSteps`, `ownVersion`, `projectManifest`, `readCatalog`, `restoredName`, `runCommand`,
  `templateManifest`, `templateTsconfig`. `create-recit` stays the entry.

### Removed by the releases still to come

Book, calendar, report, roadmap, glossary, directory, `:::form`, webtoon and web stories have joined
the contract (see [Stability](/documentation/reference/stability)). The packages still outside 1.0
(atlas, the maps of `@recit/geo`…) are reworked one at a time before they join it. A name one of
them removes from a public entry is listed here, with its replacement, in the release that removes
it.

- `@recit/atlas` (preview): `compileAtlas(input, options)` is `storyToAtlas(input, options)`, which
  returns `{ atlas, diagnostics }` (the atlas no longer carries its `diagnostics`); `AtlasModel` is
  `Atlas` and `CompileAtlasOptions` is `StoryToAtlasOptions`. `buildAtlas`, `BuildAtlasOptions` and
  `AtlasSceneText` are removed with no public replacement: go through `storyToAtlas`.
- `@recit/atlas/components`: `atlasStrings` is `atlasMessages` and `AtlasStrings` is
  `AtlasMessages`. There is no alias.
- `@recit/webstory`: the player (`StoryPlayer`, `StoryCard`, `ProgressBars`, `TapZones`, `StoryCTA`,
  `PauseButton`, `MuteToggle`, `ShareButton`, `StoryCover`, `StoryRail`, `useStoryPlayer`,
  `usePrefersReducedMotion`, `useDocumentHidden`, `HOLD_DELAY` and the `…Props`) moves to
  `@recit/webstory/components`; `@recit/webstory/model` is removed (import from `@recit/webstory`),
  and `@recit/webstory/motion` is removed (import `webstoryToFilm` and `motionToWebstory` from
  `@recit/webstory/bridge`). `compileWebstory(input, options)` is `storyToWebstory(input, options)`,
  which returns `{ webstory, story, diagnostics }` (the view no longer carries its `diagnostics`);
  `CompiledWebstory` is `WebstoryResult`, `CompileWebstoryOptions` is `StoryToWebstoryOptions` and
  `WebstoryView` is `Webstory`. There is no alias.
- `@recit/webtoon`: the reader (`WebtoonReader`, `Panel`, `Bubble`, `Caption`, `Sfx`,
  `PlaceholderPanel`, `EpisodeNav`) is in `@recit/webtoon/components`, `webtoonToFilm` in
  `@recit/webtoon/bridge`, and the model in `@recit/webtoon`, where `storyToWebtoon(story, options)`
  returns `{ webtoon, diagnostics }`. `WebtoonView`, `WebtoonPanelView`, `WebtoonLetteringView` and
  `WebtoonSeriesView` are `@deprecated` aliases of `Webtoon`, `WebtoonPanel`,
  `WebtoonPanelLettering` and `WebtoonSeries` until 1.0.

### Changed return shapes

`storyToFilm(story, options)` of `@recit/motion/source` (and `@recit/motion/node`) returns
`{ film?, diagnostics }`, the shape of every `…ToFilm`, instead of `{ ok, film, warnings }` or
`{ ok, message, issues }`. Each diagnostic is the `Diagnostic` of `@recit/core` (`severity`, `code`,
`message`, `line` or `path`) with its `file`, `sceneIndex`, `sceneId` and `blockType`; the film
comes back only when no diagnostic is an `error`. `parseFilmSource`, `parseMarkdownFilm` and
`readFilmFile` keep `{ ok, … }`, and `toFilmSourceResult` turns the new result into it:

```ts
import { formatDiagnostic } from "@recit/core";
import { storyToFilm } from "@recit/motion/source";

// before: const result = storyToFilm(story, { file }); if (result.ok) use(result.film);
const { film, diagnostics } = storyToFilm(story, { file });
if (film) use(film);
for (const diagnostic of diagnostics)
  console.error(formatDiagnostic(diagnostic, diagnostic.file ?? "film"));
```

The bridges of the formats return the same shape. `webtoonToFilm(webtoon, options)` of
`@recit/webtoon/bridge` and `webstoryToFilm(result, options)` of `@recit/webstory/bridge` return
`{ film?, diagnostics }` instead of `{ ok, film }` or `{ ok, message }`, and
`motionToWebstory(source)` returns `{ webstory?, diagnostics }` (a `16:9` film — cards are `9:16`,
`4:5` or `1:1` — is a `webstory-aspect` diagnostic instead of an exception):

```ts
import { formatDiagnostic } from "@recit/core";
import { storyToWebstory } from "@recit/webstory";
import { webstoryToFilm } from "@recit/webstory/bridge";

// before: const result = webstoryToFilm(await compileWebstory(markdown, { file }), { file });
//         if (result.ok) use(result.film); else console.error(result.message);
const { film, diagnostics } = webstoryToFilm(await storyToWebstory(markdown, { file }), { file });
if (film) use(film);
for (const diagnostic of diagnostics)
  console.error(formatDiagnostic(diagnostic, diagnostic.file ?? file));
```

## Check

1. `recit migrate --dry-run` on every story file says `nothing to migrate` for each.
2. `recit validate` on every story file prints no error.
3. `recit build` (or `recit-site build` for a site) succeeds, and your typecheck passes.

When all three pass, the project is on 1.0. The [Stability](/documentation/reference/stability) page
says what 1.0 promises from here on.
