# Moving articles to Press Kit

`@sonordev/press-kit` owns Sonor's article and publication rendering, including
Broadcast artwork and supporting photos. Site Kit continues to provide the
site's layout, shared transport, SEO, analytics, forms, revalidation and MCP.
Press Kit 1 requires Site Kit 8.3 or newer. There's still one `SONOR_API_KEY` in
`.env.local`, and no new provider or project ID.

Site Kit 8.x keeps its existing article imports as compatibility shims built
from the same source. This is a package migration; it doesn't publish articles,
schedule broadcasts, change URLs or change the project's visual rules.

## Migrate an existing publication

```bash
npx sonor-setup@latest codemod --only press-kit --json
npx sonor-setup@latest codemod --only press-kit --write --json
pnpm install
pnpm build
npx sonor-setup verify --json
```

Use sonor-setup 7.4 or newer. `press-kit` selects only the article migration,
using the same engine as the full codemod. The first command previews the diff. The second
changes imports, adds Press Kit and raises the Site Kit floor to 8.3, preserving
the existing range style. Commerce imports and dependencies remain unchanged. Use `--only site-kit-8`
to migrate both article and commerce packages. Review
reported manual follow-ups, especially dependency overrides and non-registry
ranges. Use the site's package manager for install and build.

| Use                                                                                   | Preferred import                         |
| ------------------------------------------------------------------------------------- | ---------------------------------------- |
| Client components such as `TableOfContents`, `NewsletterWidget`, `ArticleViewTracker` | `@sonordev/press-kit/articles`           |
| Data, static params, metadata, feeds, sitemaps and photo placement helpers            | `@sonordev/press-kit/articles/server`    |
| RSC components such as `Article`, `ArticleList`, `PublicationLayout`                  | `@sonordev/press-kit/articles/server-ui` |
| Article types only                                                                    | `@sonordev/press-kit`                    |

Keep `SiteKitLayout` from `@sonordev/site-kit/layout`. Preserve the publication's
existing routing object and `basePath`; replacing a package name doesn't mean
renaming `/theforge`, `/news` or `/insights`.

```tsx
import { Article } from '@sonordev/press-kit/articles/server-ui'

export default async function Story({ params }: { params: Promise<{ slug: string }> }) {
  const { slug } = await params
  return <Article slug={slug} basePath="/news" />
}
```

## Keep site MCP and live updates aligned

New MCP scaffolds use Press Kit automatically. For an existing server, pass the
same public readers the website uses; existing server files aren't overwritten
by the CLI unless `--force` is passed.

```ts
import { sonorMcpServer } from '@sonordev/site-kit/mcp/sonor'
import { getAllArticles, getArticle } from '@sonordev/press-kit/articles/server'

export const mcpServer = sonorMcpServer({
  businessName: 'Your business',
  articles: { path: '/news', readMany: getAllArticles, readOne: getArticle },
})
```

Both readers receive the configured sub-site. `list_articles` and `get_article`
keep their existing names, public data and approved supporting photo descriptions.
They don't expose private briefs or source file IDs. Sites without articles use
`articles: false` (CLI: `--no-articles`) and don't need Press Kit.

Keep the revalidation route in Site Kit:

```ts
import { createRevalidateRoute } from '@sonordev/site-kit/revalidate'
export const POST = createRevalidateRoute({ publicationBasePath: '/news' })
```

The scaffold and doctor recognize either package's article imports, including
local reader barrels. Check an article with supporting photos, the publication
index, its feeds and site MCP locally before deploying. Photo assignments,
descriptions, crops, stage rules and save/publish actions stay in Sonor; moving
the website package doesn't add a second editorial workflow.
