Upgrade from 1.x

Move a 1.x project from doctor to check, and from links, stats, snapshot and brief to context.

Contentbit 2.0 checks the pages your build wrote. contentbit check replaces doctor, and contentbit context replaces links, stats, snapshot, and brief. Both commands read a build folder. Checking a running server comes later.

Upgrade step by step

  1. Move every contentbit package in package.json to 2.0 at once. @contentbit/react, @contentbit/astro and @contentbit/blocks have no changes of their own, but the packages share one version and must match, and contentbit studio starts only the Studio of its own version. Name the packages your project has, and with npm run npm install in place of pnpm add:

    pnpm add -D contentbit@latest @contentbit/studio@latest
    pnpm add @contentbit/core@latest @contentbit/blocks@latest @contentbit/astro@latest
  2. Build the site. check and context read its build folder.

  3. Run contentbit init. It keeps your files, prints the site.build and links.routes that the config lacks, names each script that runs a removed command, and replaces the agent guidance that 1.x installed.

  4. Add the printed fields to contentbit.config.ts. Change the content:check script to contentbit check, and remove the scripts that run removed commands. In CI, build the site before content:check runs.

  5. Delete .contentbit/link-index.json. Nothing reads or writes it any more.

  6. Run content:check and fix what it reports. If you kept the example that 1.x init wrote, check reports it: content/related.md has no built page, and the example page has no title. Delete the two files and the example page, or give each a page with a title and a description.

The sections below list every breaking change, in the words of the package changelogs.

Replace doctor with check

  • contentbit doctor exits 2 and names check. doctor --strict-warnings is check --strict. check keeps --strict-seo, --watch, --json, --seo-config, --no-seo, --key-field, --slug-field, --locale-field and --default-locale.
  • check takes a build folder as its argument, not content globs. It reads Markdown only from content in the Contentbit config, not from a content:doctor script. Build the site before check runs, in CI too. Without a build folder, check runs the Markdown checks alone and says so. A build folder that you pass or that site.build names must exist and hold an HTML page, or check exits 2.
  • check has no --registry or --no-generic-blocks. It reports block findings only when the config names a registry or sets genericBlocks: true.
  • check has no --link-resolve, and reports no frontmatter link finding, such as CB_LINK_ORPHAN, CB_LINK_UNRESOLVED or CB_KEY_DUPLICATE. validate still reports them.
  • check has no --min-section-words, and nothing reports CB_THIN_SECTION or CB_BLOCKLESS_DOCUMENT any more.
  • The Markdown checks no longer report CB_H1_MISSING, CB_INTERNAL_URL_UNRESOLVED or CB_MARKDOWN_ANCHOR_UNRESOLVED, which guessed at the built page. check reports CB_PAGE_H1_MISSING, CB_LINK_PAGE_MISSING and CB_LINK_ANCHOR_MISSING from the built pages instead, and the two link findings are errors. A run with no build checks no internal URL or #anchor link in Markdown.
  • With a build folder, check reports CB_PAGE_TITLE_DUPLICATE, CB_PAGE_DESCRIPTION_DUPLICATE, CB_PAGE_H1_MULTIPLE, CB_LINK_FILE_MISSING and CB_PAGE_IMAGE_ALT_MISSING from the built pages, in place of the Markdown findings CB_TITLE_DUPLICATE, CB_DESCRIPTION_DUPLICATE, CB_H1_MULTIPLE, CB_MARKDOWN_LINK_UNRESOLVED and CB_IMAGE_ALT_MISSING.
  • The SEO config's requiredLinksTo, minOutgoingLinks and minIncomingLinks count content links between built pages. A link in the page's header, nav, aside or footer landmarks does not count, and neither does a link outside the page content or a frontmatter linksTo that the page does not render. A header inside main, an article or a section is content, and so are a callout aside and a footer inside a blockquote or a card, so their links count. CB_PAGE_LINK_REQUIRED, CB_PAGE_OUTGOING_LINKS_MIN and CB_PAGE_INCOMING_LINKS_MIN replace CB_SEO_LINK_REQUIRED, CB_SEO_OUTGOING_LINKS_MIN and CB_SEO_INCOMING_LINKS_MIN, and a Markdown file with no built page gets none of them.
  • check --json prints a contentbit.site-check.v1 report. The Markdown findings that doctor --json printed in findings are in content.findings, with the same fields and with paths relative to the project root. The report has no linkGraph or seo section and no suggestions count, and the text report has no repair plan.
  • contentbit links, stats, snapshot and brief exit 2 and name what replaced them. context lists every page's links in and out, gives each page's outline and words, prints the site as JSON with --json, and carries a page's SEO brief as its contract.
  • context reads the build folder, as check does, so build the site first. It takes --build, --origin, --seo-config, --no-seo and --json. It reads the registry and the link resolver fields from the Contentbit config, in place of --registry, --no-generic-blocks, --link-resolve, --key-field, --slug-field, --locale-field and --default-locale. snapshot --revision, stats --no-validate and links --out have no replacement.
  • Nothing writes .contentbit/link-index.json any more, and links --fix has no replacement. An alias in linksTo still resolves to its page, and validate still reports a target that no page has.
  • snapshot printed a contentbit.project-snapshot.v1. context --json prints a contentbit.site-context.v1, which is a different format.
  • The page context's contract is a contentbit.seo.brief.v2, where brief --json printed a contentbit.seo.brief.v1. It has no findings, since the page's findings are in findings and contentFindings. Its requiredLinksTo holds the page type's links only, not the frontmatter linksTo, and its relatedPages are the pages of the same type. target and each related page keep id, source, path, key, slug, locale, title and type.

Set up with init, adopt and agents

init prints the config fields that check needs. See Site fields and Page routes. content is optional in the config, but validate still needs it or explicit globs.

  • init installs only contentbit. init --blocks sets up what 1.x init set up by default: the block registry, a renderer, Studio, the block guide and the example content. --target, --md, --no-page and --no-styled need --blocks.
  • The content:check script that init writes runs contentbit check, not contentbit validate. init keeps an existing content:check script and prints a note, and writes no content:links or content:doctor script. It keeps every other script too, and names each one that runs a removed command for you to remove.
  • adopt has no --dry-run, which did nothing, since adopt changes no file. It proposes a frontmatter title only where one is missing, and no slug. adopt --json prints a contentbit.adoption.v2, where 1.x printed a contentbit.adoption.v1. Its finding and proposal paths are relative to the project root, and it has no dryRun field.
  • The agent guidance that 1.x installed tells agents to run removed commands. init replaces it as contentbit agents does: the AGENTS.md block, and the Claude Code skills when .claude/ exists. With init --no-agents, run contentbit agents. check warns with CB_SKILL_DRIFT while an installed skill is older than version 10.

Studio

  • The Markdown dashboard moves to /documents. It has no link graph, and a document lists no frontmatter links or backlinks, since its built page lists the links in and out.
  • contentbit studio has no --link-resolve or --min-section-words.
  • contentbit studio starts only the @contentbit/studio of its own version. With a 1.x Studio still installed, it exits 2 and prints the command that installs the right one.
  • startStudio, scanProject and scanDocument take loadSeo, a function that reads the SEO config, in place of seoConfig and seoConfigPath, and take no minSectionWords. scanGraph and the StudioGraph type are removed. A StudioProject has no linkGraph, and a StudioDocument has no linksTo or linkedFrom.

Core API

  • @contentbit/core no longer exports buildLinkIndex, validateLinks, serializeLinkIndex, aliasReplacementsForPage, linkGraphSummary or DEFAULT_MIN_SECTION_WORDS, or the SerializedLinkIndex and LinkAliasEntry types. A LinkIndex has no aliases or aliasEntries. scanContentProject still returns the link index and its diagnostics.
  • scanContentProject takes no minSectionWords and reports no CB_THIN_SECTION or CB_BLOCKLESS_DOCUMENT. scanContentIntegrity and scanContentProject report no CB_H1_MISSING, CB_INTERNAL_URL_UNRESOLVED or CB_MARKDOWN_ANCHOR_UNRESOLVED.
  • evaluateSeoProject takes no linkIndex and reports no CB_SEO_LINK_REQUIRED, CB_SEO_OUTGOING_LINKS_MIN or CB_SEO_INCOMING_LINKS_MIN. An SeoPage has no linkedFrom.
  • An SeoBrief is a contentbit.seo.brief.v2. It has no findings, its target and relatedPages are SeoBriefPages, and its requiredLinksTo holds the page type's links only. formatSeoBriefMarkdown prints no intent or keywords.